From 8600979fad54ba8b70656494a39f3d2bf048b08e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 26 Mar 2001 21:52:43 +0000 Subject: Patch to make automount lookup fallback to get home directory from getpwnam. From Robert Montjoy . Jeremy. (This used to be commit 1fe60064bddf29fd778918d3f1a7026002029bd7) --- source3/lib/substitute.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'source3/lib/substitute.c') diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index 09a60cf3f1..c4bd1377c2 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -102,16 +102,22 @@ static char *automount_path(char *user_name) #if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT)) - if (lp_nis_home_map()) - { - char *home_path_start; + if (lp_nis_home_map()) { + char *home_path_start; char *automount_value = automount_lookup(user_name); - home_path_start = strchr(automount_value,':'); - if (home_path_start != NULL) - { - DEBUG(5, ("NIS lookup succeeded. Home path is: %s\n", - home_path_start?(home_path_start+1):"")); - pstrcpy(server_path, home_path_start+1); + + if(strlen(automount_value) > 0) { + home_path_start = strchr(automount_value,':'); + if (home_path_start != NULL) { + DEBUG(5, ("NIS lookup succeeded. Home path is: %s\n", + home_path_start?(home_path_start+1):"")); + pstrcpy(server_path, home_path_start+1); + } + } else { + /* NIS key lookup failed: default to user home directory from password file */ + pstrcpy(server_path, get_user_home_dir(user_name)); + DEBUG(5, ("NIS lookup failed. Using Home path from passwd file. Home path is: %s\n", + server_path )); } } #endif -- cgit