r25446: Merge some changes I made on the way home from SFO:
[jelmer/samba4-debian.git] / source / auth / auth.c
index b74bbc33714acb62f71fd27451f8fb648ac91d05..20524b34a4fe1e1b3e7268e5e465644e40bb0061 100644 (file)
@@ -23,6 +23,7 @@
 #include "auth/auth.h"
 #include "lib/events/events.h"
 #include "build.h"
+#include "param/param.h"
 
 /***************************************************************************
  Set a fixed challenge
@@ -416,15 +417,15 @@ NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx,
                             struct auth_context **auth_ctx)
 {
        const char **auth_methods = NULL;
-       switch (lp_server_role()) {
+       switch (lp_server_role(global_loadparm)) {
        case ROLE_STANDALONE:
-               auth_methods = lp_parm_string_list(-1, "auth methods", "standalone", NULL);
+               auth_methods = lp_parm_string_list(global_loadparm, NULL, "auth methods", "standalone", NULL);
                break;
        case ROLE_DOMAIN_MEMBER:
-               auth_methods = lp_parm_string_list(-1, "auth methods", "member server", NULL);
+               auth_methods = lp_parm_string_list(global_loadparm, NULL, "auth methods", "member server", NULL);
                break;
        case ROLE_DOMAIN_CONTROLLER:
-               auth_methods = lp_parm_string_list(-1, "auth methods", "domain controller", NULL);
+               auth_methods = lp_parm_string_list(global_loadparm, NULL, "auth methods", "domain controller", NULL);
                break;
        }
        return auth_context_create_methods(mem_ctx, auth_methods, ev, msg, auth_ctx);
@@ -454,13 +455,14 @@ NTSTATUS auth_register(const struct auth_operations *ops)
                return NT_STATUS_OBJECT_NAME_COLLISION;
        }
 
-       backends = realloc_p(backends, struct auth_backend, num_backends+1);
-       if (!backends) {
-               return NT_STATUS_NO_MEMORY;
-       }
+       backends = talloc_realloc(talloc_autofree_context(), backends, 
+                                 struct auth_backend, num_backends+1);
+       NT_STATUS_HAVE_NO_MEMORY(backends);
 
-       new_ops = smb_xmemdup(ops, sizeof(*ops));
-       new_ops->name = smb_xstrdup(ops->name);
+       new_ops = talloc_memdup(backends, ops, sizeof(*ops));
+       NT_STATUS_HAVE_NO_MEMORY(new_ops);
+       new_ops->name = talloc_strdup(new_ops, ops->name);
+       NT_STATUS_HAVE_NO_MEMORY(new_ops->name);
 
        backends[num_backends].ops = new_ops;
 
@@ -517,7 +519,7 @@ NTSTATUS auth_init(void)
        if (initialized) return NT_STATUS_OK;
        initialized = True;
        
-       shared_init = load_samba_modules(NULL, "auth");
+       shared_init = load_samba_modules(NULL, global_loadparm, "auth");
 
        run_init_functions(static_init);
        run_init_functions(shared_init);