When loading the default configuration, allow the configuration file to be
[metze/samba/wip.git] / source4 / param / loadparm.c
index 79132a388aa5c27fca3c5f2e9a4c23e097b66d81..2d9af333259d1b61218e232064e476af073d69ea 100644 (file)
@@ -228,8 +228,6 @@ struct loadparm_service
 };
 
 
-struct loadparm_context *global_loadparm = NULL;
-
 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
 
 
@@ -2298,7 +2296,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
        lp_do_global_parameter(lp_ctx, "ntvfs handler", "unixuid default");
        lp_do_global_parameter(lp_ctx, "max connections", "-1");
 
-       lp_do_global_parameter(lp_ctx, "dcerpc endpoint servers", "epmapper srvsvc wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi winreg dssetup unixinfo");
+       lp_do_global_parameter(lp_ctx, "dcerpc endpoint servers", "epmapper srvsvc wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi winreg dssetup unixinfo browser");
        lp_do_global_parameter(lp_ctx, "server services", "smb rpc nbt wrepl ldap cldap kdc drepl winbind ntp_signd");
        lp_do_global_parameter(lp_ctx, "ntptr providor", "simple_ldb");
        lp_do_global_parameter(lp_ctx, "auth methods:domain controller", "anonymous sam_ignoredomain");
@@ -2431,10 +2429,19 @@ const char *lp_configfile(struct loadparm_context *lp_ctx)
 
 bool lp_load_default(struct loadparm_context *lp_ctx)
 {
+    const char *path;
     if (getenv("SMB_CONF_PATH"))
-        return lp_load(lp_ctx, getenv("SMB_CONF_PATH"));
+        path = getenv("SMB_CONF_PATH");
     else
-        return lp_load(lp_ctx, dyn_CONFIGFILE);
+        path = dyn_CONFIGFILE;
+
+    if (!file_exist(path)) {
+           /* We allow the default smb.conf file to not exist, 
+            * basically the equivalent of an empty file. */
+           return true;
+    }
+
+    return lp_load(lp_ctx, path);
 }
 
 /**
@@ -2480,7 +2487,7 @@ bool lp_load(struct loadparm_context *lp_ctx, const char *filename)
 
        reload_charcnv(lp_ctx);
 
-       ntstatus_check_dos_mapping = lp_nt_status_support(lp_ctx);
+       /* FIXME: ntstatus_check_dos_mapping = lp_nt_status_support(lp_ctx); */
 
        /* FIXME: This is a bit of a hack, but we can't use a global, since 
         * not everything that uses lp also uses the socket library */
@@ -2692,6 +2699,7 @@ struct gensec_settings *lp_gensec_settings(TALLOC_CTX *mem_ctx, struct loadparm_
        struct gensec_settings *settings = talloc(mem_ctx, struct gensec_settings);
        if (settings == NULL)
                return NULL;
+       SMB_ASSERT(lp_ctx != NULL);
        settings->lp_ctx = talloc_reference(settings, lp_ctx);
        settings->iconv_convenience = lp_iconv_convenience(lp_ctx);
        settings->target_hostname = lp_parm_string(lp_ctx, NULL, "gensec", "target_hostname");