Find default smb.conf path correctly, when it was not specified on the
[ira/wip.git] / source4 / param / loadparm.c
index 2d9af333259d1b61218e232064e476af073d69ea..c1a012474b53f87f2b36395b32f84811eefad635 100644 (file)
@@ -2427,13 +2427,19 @@ const char *lp_configfile(struct loadparm_context *lp_ctx)
        return lp_ctx->szConfigFile;
 }
 
-bool lp_load_default(struct loadparm_context *lp_ctx)
+const char *lp_default_path(void)
 {
-    const char *path;
     if (getenv("SMB_CONF_PATH"))
-        path = getenv("SMB_CONF_PATH");
+        return getenv("SMB_CONF_PATH");
     else
-        path = dyn_CONFIGFILE;
+        return dyn_CONFIGFILE;
+}
+
+bool lp_load_default(struct loadparm_context *lp_ctx)
+{
+    const char *path;
+
+    path = lp_default_path();
 
     if (!file_exist(path)) {
            /* We allow the default smb.conf file to not exist,