diff -up autofs-5.0.1/lib/nss_tok.l.default-nsswitch autofs-5.0.1/lib/nss_tok.l --- autofs-5.0.1/lib/nss_tok.l.default-nsswitch 2007-10-18 13:10:51.000000000 +0800 +++ autofs-5.0.1/lib/nss_tok.l 2007-10-18 13:11:39.000000000 +0800 @@ -58,6 +58,8 @@ int nss_wrap(void); #define YY_MAIN 0 #endif +extern unsigned int nss_automount_found; + %} %option nounput @@ -87,6 +89,7 @@ other [[:alnum:]@$%^&*()-+_":;?,<>./'{} %% ^{automount}: { + nss_automount_found = 1; BEGIN(AUTOMOUNT); } diff -up autofs-5.0.1/lib/nss_parse.y.default-nsswitch autofs-5.0.1/lib/nss_parse.y --- autofs-5.0.1/lib/nss_parse.y.default-nsswitch 2007-10-18 13:10:51.000000000 +0800 +++ autofs-5.0.1/lib/nss_parse.y 2007-10-18 13:11:39.000000000 +0800 @@ -47,6 +47,8 @@ struct nss_action act[NSS_STATUS_MAX]; #define YYLTYPE_IS_TRIVIAL 0 #endif +unsigned int nss_automount_found; + extern int nss_lineno; extern int nss_lex(void); extern FILE *nss_in; @@ -185,10 +187,16 @@ int nsswitch_parse(struct list_head *lis nss_in = nsswitch; + nss_automount_found = 0; nss_list = list; status = nss_parse(); nss_list = NULL; + /* No "automount" nsswitch entry, use "files" */ + if (!nss_automount_found) + if (add_source(list, "files")) + status = 0; + pthread_cleanup_pop(1); pthread_cleanup_pop(1);