diff options
author | Jeremy Allison <jra@samba.org> | 2005-10-13 18:08:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:04:58 -0500 |
commit | b82981bbc86dbdd057cea9d55e2c0f38f90fa186 (patch) | |
tree | d0cf9acbc17e75e8911fb25203862ce376cf179d | |
parent | 057060feaf7395f475a32f9dad9e149ab0fa6a1c (diff) | |
download | samba-b82981bbc86dbdd057cea9d55e2c0f38f90fa186.tar.gz samba-b82981bbc86dbdd057cea9d55e2c0f38f90fa186.tar.xz samba-b82981bbc86dbdd057cea9d55e2c0f38f90fa186.zip |
r10970: Fix bug #3166 - null pointer dereference if $HOME not
defined. Also clarified confusing error messages.
Jeremy.
(This used to be commit e2639ac9ff8319dde04fc6b4a0c257f7af29cf44)
-rw-r--r-- | source3/libsmb/libsmbclient.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index 1e729abb22..9c7376da44 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -5539,6 +5539,7 @@ SMBCCTX * smbc_init_context(SMBCCTX * context) if (!smbc_initialized) { /* Do some library wide intialisations the first time we get called */ + BOOL conf_loaded = False; /* Set this to what the user wants */ DEBUGLEVEL = context->debug; @@ -5547,16 +5548,22 @@ SMBCCTX * smbc_init_context(SMBCCTX * context) /* Here we would open the smb.conf file if needed ... */ - home = getenv("HOME"); - - slprintf(conf, sizeof(conf), "%s/.smb/smb.conf", home); - load_interfaces(); /* Load the list of interfaces ... */ in_client = True; /* FIXME, make a param */ - if (!lp_load(conf, True, False, False)) { - + home = getenv("HOME"); + if (home) { + slprintf(conf, sizeof(conf), "%s/.smb/smb.conf", home); + if (lp_load(conf, True, False, False)) { + conf_loaded = True; + } else { + DEBUG(5, ("Could not load config file: %s\n", + conf)); + } + } + + if (!conf_loaded) { /* * Well, if that failed, try the dyn_CONFIGFILE * Which points to the standard locn, and if that @@ -5565,10 +5572,9 @@ SMBCCTX * smbc_init_context(SMBCCTX * context) */ if (!lp_load(dyn_CONFIGFILE, True, False, False)) { - DEBUG(5, ("Could not load either config file: " - "%s or %s\n", - conf, dyn_CONFIGFILE)); - } else { + DEBUG(5, ("Could not load config file: %s\n", + dyn_CONFIGFILE)); + } else if (home) { /* * We loaded the global config file. Now lets * load user-specific modifications to the |