diff options
author | Samba Release Account <samba-bugs@samba.org> | 1998-03-24 19:21:27 +0000 |
---|---|---|
committer | Samba Release Account <samba-bugs@samba.org> | 1998-03-24 19:21:27 +0000 |
commit | 1a264998cac04221c325e61cc7d954b08ce2ac59 (patch) | |
tree | 7dafb19943aefd56d72d39bdc48ea092d1ceae2a /source3/lib | |
parent | 5d7c8375e4ffb017ef0f9eed7e619e533b3e8d12 (diff) | |
download | samba-1a264998cac04221c325e61cc7d954b08ce2ac59.tar.gz samba-1a264998cac04221c325e61cc7d954b08ce2ac59.tar.bz2 samba-1a264998cac04221c325e61cc7d954b08ce2ac59.zip |
ypserver not available: AUTOMOUNT server and path don't work.
fix: set default values to local server / path _before_ attempting to
find the ypserver's auto.home entry.
(This used to be commit 051ec104feaa48b9d147cc5479857c10915bdd26)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 2d3f8cc916..46fda4ae8b 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -3862,13 +3862,14 @@ static char *automount_lookup(char *user_name) char *automount_server(char *user_name) { static pstring server_name; - -#if (defined(NETGROUP) && defined (AUTOMOUNT)) int home_server_len; - /* set to default of local machine */ + /* use the local machine name as the default */ + /* this will be the default if AUTOMOUNT is not used or fails */ pstrcpy(server_name, local_machine); +#if (defined(NETGROUP) && defined (AUTOMOUNT)) + if (lp_nis_home_map()) { char *automount_value = automount_lookup(user_name); @@ -3881,9 +3882,6 @@ char *automount_server(char *user_name) strncpy(server_name, automount_value, home_server_len); server_name[home_server_len] = '\0'; } -#else - /* use the local machine name instead of the auto-map server */ - pstrcpy(server_name, local_machine); #endif DEBUG(4,("Home server: %s\n", server_name)); @@ -3899,12 +3897,14 @@ char *automount_server(char *user_name) char *automount_path(char *user_name) { static pstring server_path; - -#if (defined(NETGROUP) && defined (AUTOMOUNT)) char *home_path_start; - /* set to default of no string */ - server_path[0] = 0; + /* use the passwd entry as the default */ + /* this will be the default if AUTOMOUNT is not used or fails */ + /* pstrcpy() copes with get_home_dir() returning NULL */ + pstrcpy(server_path, get_home_dir(user_name)); + +#if (defined(NETGROUP) && defined (AUTOMOUNT)) if (lp_nis_home_map()) { @@ -3917,10 +3917,6 @@ char *automount_path(char *user_name) strcpy(server_path, home_path_start+1); } } -#else - /* use the passwd entry instead of the auto-map server entry */ - /* pstrcpy() copes with get_home_dir() returning NULL */ - pstrcpy(server_path, get_home_dir(user_name)); #endif DEBUG(4,("Home server path: %s\n", server_path)); |