r6155: Fixes bug #1133
authorDerrell Lipman <derrell@samba.org>
Thu, 31 Mar 2005 20:28:47 +0000 (20:28 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:56:25 +0000 (10:56 -0500)
Added provision for overloading some global configuration options via the new,
per-user file ~/.smb/smb.conf.append which is read after the global config
file is read (and only if the global config file was read).  This leave the
original, BC behavior of ~/.smb/smb.conf which, if found, is read but causes
the global config file to not be read.

Also fixed a potential seg fault in to lp_dump_one().
(This used to be commit 2c5a6305bd127b1a7e65356c2b3aa5c13cd2bd74)

source3/libsmb/libsmbclient.c
source3/param/loadparm.c

index ae9a660a09a72f25059a1b1fb5e0442ce671879a..657d0925b0aed32e8435ec242cd9b15298d1a79c 100644 (file)
@@ -5169,10 +5169,25 @@ SMBCCTX * smbc_init_context(SMBCCTX * context)
                          * defaults ...
                          */
 
-                   if (!lp_load(dyn_CONFIGFILE, True, False, False)) {
-                      DEBUG(5, ("Could not load either config file: %s or %s\n",
-                             conf, dyn_CONFIGFILE));
-                   }
+                        if (!lp_load(dyn_CONFIGFILE, True, False, False)) {
+                                DEBUG(5, ("Could not load either config file: "
+                                          "%s or %s\n",
+                                          conf, dyn_CONFIGFILE));
+                        } else {
+                                /*
+                                 * We loaded the global config file.  Now lets
+                                 * load user-specific modifications to the
+                                 * global config.
+                                 */
+                                slprintf(conf, sizeof(conf),
+                                         "%s/.smb/smb.conf.append", home);
+                                if (!lp_load(conf, True, False, False)) {
+                                        DEBUG(10,
+                                              ("Could not append config file: "
+                                               "%s\n",
+                                               conf));
+                                }
+                        }
                 }
 
                 reopen_logs();  /* Get logging working ... */
index f28b0c49ae4d1feed5a4cc0ff683ef7405fb0c9c..8ec7efddcdc97af20fee7b878508df0af291a19a 100644 (file)
@@ -73,7 +73,7 @@ extern pstring user_socket_options;
 
 /* some helpful bits */
 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && ServicePtrs[(i)]->valid)
-#define VALID(i) ServicePtrs[i]->valid
+#define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
 
 int keepalive = DEFAULT_KEEPALIVE;
 BOOL use_getwd_cache = True;