r26445: Fix credentials python bindings.
[ira/wip.git] / source / auth / auth.c
index 04aa5f5c91dcaab50a426367dd4da052a564367c..918890b3f621d3e372f3fdb8e85ebeea8f1a649f 100644 (file)
@@ -42,7 +42,7 @@ NTSTATUS auth_context_set_challenge(struct auth_context *auth_ctx, const uint8_t
 /***************************************************************************
  Set a fixed challenge
 ***************************************************************************/
-BOOL auth_challenge_may_be_modified(struct auth_context *auth_ctx) 
+bool auth_challenge_may_be_modified(struct auth_context *auth_ctx) 
 {
        return auth_ctx->challenge.may_be_modified;
 }
@@ -93,7 +93,7 @@ _PUBLIC_ NTSTATUS auth_get_challenge(struct auth_context *auth_ctx, const uint8_
                NT_STATUS_HAVE_NO_MEMORY(auth_ctx->challenge.data.data);
                auth_ctx->challenge.set_by              = "random";
 
-               auth_ctx->challenge.may_be_modified     = True;
+               auth_ctx->challenge.may_be_modified     = true;
        }
 
        DEBUG(10,("auth_get_challenge: challenge set by %s\n",
@@ -104,7 +104,7 @@ _PUBLIC_ NTSTATUS auth_get_challenge(struct auth_context *auth_ctx, const uint8_
 }
 
 struct auth_check_password_sync_state {
-       BOOL finished;
+       bool finished;
        NTSTATUS status;
        struct auth_serversupplied_info *server_info;
 };
@@ -115,7 +115,7 @@ static void auth_check_password_sync_callback(struct auth_check_password_request
        struct auth_check_password_sync_state *s = talloc_get_type(private_data,
                                                   struct auth_check_password_sync_state);
 
-       s->finished = True;
+       s->finished = true;
        s->status = auth_check_password_recv(req, s, &s->server_info);
 }
 
@@ -244,7 +244,7 @@ void auth_check_password_send(struct auth_context *auth_ctx,
        req->callback.private_data      = private_data;
 
        if (!user_info->mapped_state) {
-               nt_status = map_user_info(req, user_info, &user_info_tmp);
+               nt_status = map_user_info(req, lp_workgroup(auth_ctx->lp_ctx), user_info, &user_info_tmp);
                if (!NT_STATUS_IS_OK(nt_status)) goto failed;
                user_info = user_info_tmp;
                req->user_info  = user_info_tmp;
@@ -353,6 +353,7 @@ NTSTATUS auth_check_password_recv(struct auth_check_password_request *req,
 NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **methods, 
                                     struct event_context *ev,
                                     struct messaging_context *msg,
+                                    struct loadparm_context *lp_ctx,
                                     struct auth_context **auth_ctx)
 {
        int i;
@@ -376,11 +377,12 @@ NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **methods,
        ctx = talloc(mem_ctx, struct auth_context);
        NT_STATUS_HAVE_NO_MEMORY(ctx);
        ctx->challenge.set_by           = NULL;
-       ctx->challenge.may_be_modified  = False;
+       ctx->challenge.may_be_modified  = false;
        ctx->challenge.data             = data_blob(NULL, 0);
        ctx->methods                    = NULL;
        ctx->event_ctx                  = ev;
        ctx->msg_ctx                    = msg;
+       ctx->lp_ctx                     = lp_ctx;
 
        for (i=0; methods[i] ; i++) {
                struct auth_method_context *method;
@@ -414,21 +416,22 @@ NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **methods,
 NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, 
                             struct event_context *ev,
                             struct messaging_context *msg,
+                            struct loadparm_context *lp_ctx,
                             struct auth_context **auth_ctx)
 {
        const char **auth_methods = NULL;
-       switch (lp_server_role(global_loadparm)) {
+       switch (lp_server_role(lp_ctx)) {
        case ROLE_STANDALONE:
-               auth_methods = lp_parm_string_list(NULL, "auth methods", "standalone", NULL);
+               auth_methods = lp_parm_string_list(mem_ctx, lp_ctx, NULL, "auth methods", "standalone", NULL);
                break;
        case ROLE_DOMAIN_MEMBER:
-               auth_methods = lp_parm_string_list(NULL, "auth methods", "member server", NULL);
+               auth_methods = lp_parm_string_list(mem_ctx, lp_ctx, NULL, "auth methods", "member server", NULL);
                break;
        case ROLE_DOMAIN_CONTROLLER:
-               auth_methods = lp_parm_string_list(NULL, "auth methods", "domain controller", NULL);
+               auth_methods = lp_parm_string_list(mem_ctx, lp_ctx, NULL, "auth methods", "domain controller", NULL);
                break;
        }
-       return auth_context_create_methods(mem_ctx, auth_methods, ev, msg, auth_ctx);
+       return auth_context_create_methods(mem_ctx, auth_methods, ev, msg, lp_ctx, auth_ctx);
 }
 
 
@@ -511,20 +514,14 @@ const struct auth_critical_sizes *auth_interface_version(void)
 
 NTSTATUS auth_init(void)
 {
-       static BOOL initialized = False;
+       static bool initialized = false;
 
        init_module_fn static_init[] = STATIC_auth_MODULES;
-       init_module_fn *shared_init;
        
        if (initialized) return NT_STATUS_OK;
-       initialized = True;
+       initialized = true;
        
-       shared_init = load_samba_modules(NULL, "auth");
-
        run_init_functions(static_init);
-       run_init_functions(shared_init);
-
-       talloc_free(shared_init);
        
        return NT_STATUS_OK;    
 }