diff options
author | Jeremy Allison <jra@samba.org> | 2001-03-26 21:52:43 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-03-26 21:52:43 +0000 |
commit | 8600979fad54ba8b70656494a39f3d2bf048b08e (patch) | |
tree | 4dff2066463cdfef59b15be310739531635d6af4 /source3/lib/substitute.c | |
parent | e670b3564c3c12baaab0e988f155a86b9437f66e (diff) | |
download | samba-8600979fad54ba8b70656494a39f3d2bf048b08e.tar.gz samba-8600979fad54ba8b70656494a39f3d2bf048b08e.tar.bz2 samba-8600979fad54ba8b70656494a39f3d2bf048b08e.zip |
Patch to make automount lookup fallback to get home directory from getpwnam.
From Robert Montjoy <Rob_Montjoy@ECECS.UC.EDU>.
Jeremy.
(This used to be commit 1fe60064bddf29fd778918d3f1a7026002029bd7)
Diffstat (limited to 'source3/lib/substitute.c')
-rw-r--r-- | source3/lib/substitute.c | 24 |
1 files changed, 15 insertions, 9 deletions
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 |