s4-dns: added a dns update task
[kai/samba.git] / source4 / param / loadparm.c
index 882de1330e8e7477061ff61438948c86bc05f398..cb23ceab02e1d8b87d4ddfeadf1c388601c2c0ba 100644 (file)
@@ -61,6 +61,7 @@
 #include "smb_server/smb_server.h"
 #include "libcli/raw/signing.h"
 #include "../lib/util/dlinklist.h"
+#include "../lib/util/parmlist.h"
 #include "param/param.h"
 #include "param/loadparm.h"
 #include "libcli/raw/libcliraw.h"
@@ -79,6 +80,7 @@ static bool defaults_saved = false;
 struct loadparm_global
 {
        enum server_role server_role;
+       enum sid_generator sid_generator;
 
        const char **smb_ports;
        char *ncalrpc_dir;
@@ -328,12 +330,18 @@ static const struct enum_list enum_server_role[] = {
        {-1, NULL}
 };
 
+static const struct enum_list enum_sid_generator[] = {
+       {SID_GENERATOR_INTERNAL, "internal"},
+       {SID_GENERATOR_BACKEND, "backend"},
+       {-1, NULL}
+};
 
 #define GLOBAL_VAR(name) offsetof(struct loadparm_global, name)
 #define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
 
 static struct parm_struct parm_table[] = {
        {"server role", P_ENUM, P_GLOBAL, GLOBAL_VAR(server_role), NULL, enum_server_role},
+       {"sid generator", P_ENUM, P_GLOBAL, GLOBAL_VAR(sid_generator), NULL, enum_sid_generator},
 
        {"dos charset", P_STRING, P_GLOBAL, GLOBAL_VAR(dos_charset), NULL, NULL},
        {"unix charset", P_STRING, P_GLOBAL, GLOBAL_VAR(unix_charset), NULL, NULL},
@@ -612,6 +620,7 @@ static const char *lp_string(const char *s)
  int fn_name(struct loadparm_service *service, struct loadparm_service *sDefault) {return((service != NULL)? service->val : sDefault->val);}
 
 _PUBLIC_ FN_GLOBAL_INTEGER(lp_server_role, server_role)
+_PUBLIC_ FN_GLOBAL_INTEGER(lp_sid_generator, sid_generator)
 _PUBLIC_ FN_GLOBAL_LIST(lp_smb_ports, smb_ports)
 _PUBLIC_ FN_GLOBAL_INTEGER(lp_nbt_port, nbt_port)
 _PUBLIC_ FN_GLOBAL_INTEGER(lp_dgram_port, dgram_port)
@@ -2320,7 +2329,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
        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 browser");
-       lp_do_global_parameter(lp_ctx, "server services", "smb rpc nbt wrepl ldap cldap kdc drepl winbind ntp_signd kcc");
+       lp_do_global_parameter(lp_ctx, "server services", "smb rpc nbt wrepl ldap cldap kdc drepl winbind ntp_signd kcc dnsupdate");
        lp_do_global_parameter(lp_ctx, "ntptr providor", "simple_ldb");
        lp_do_global_parameter(lp_ctx, "auth methods:domain controller", "anonymous sam_ignoredomain");
        lp_do_global_parameter(lp_ctx, "auth methods:member server", "anonymous sam winbind");
@@ -2543,6 +2552,10 @@ bool lp_load(struct loadparm_context *lp_ctx, const char *filename)
 
        bRetval = bRetval && lp_update(lp_ctx);
 
+       /* we do this unconditionally, so that it happens even
+          for a missing smb.conf */
+       reload_charcnv(lp_ctx);
+
        return bRetval;
 }
 
@@ -2609,8 +2622,11 @@ struct loadparm_service *lp_service(struct loadparm_context *lp_ctx,
                        serviceName = standard_sub_basic(
                                        lp_ctx->services[iService],
                                        lp_ctx->services[iService]->szService);
-                       if (strequal(serviceName, service_name))
+                       if (strequal(serviceName, service_name)) {
+                               talloc_free(serviceName);
                                return lp_ctx->services[iService];
+                       }
+                       talloc_free(serviceName);
                }
        }