summaryrefslogtreecommitdiff
path: root/source4/auth/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/auth/auth.c')
-rw-r--r--source4/auth/auth.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/source4/auth/auth.c b/source4/auth/auth.c
index 57e2c050c1..1dc55de61e 100644
--- a/source4/auth/auth.c
+++ b/source4/auth/auth.c
@@ -23,6 +23,7 @@
#include "auth/auth.h"
#include "lib/events/events.h"
#include "build.h"
+#include "param/param.h"
/***************************************************************************
Set a fixed challenge
@@ -41,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;
}
@@ -92,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",
@@ -103,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;
};
@@ -114,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);
}
@@ -375,7 +376,7 @@ 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;
@@ -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);
@@ -443,9 +444,8 @@ static int num_backends;
The 'name' can be later used by other backends to find the operations
structure for this backend.
*/
-NTSTATUS auth_register(const void *_ops)
+NTSTATUS auth_register(const struct auth_operations *ops)
{
- const struct auth_operations *ops = _ops;
struct auth_operations *new_ops;
if (auth_backend_byname(ops->name) != NULL) {
@@ -455,13 +455,14 @@ NTSTATUS auth_register(const void *_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;
@@ -510,15 +511,15 @@ 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");
+ shared_init = load_samba_modules(NULL, global_loadparm, "auth");
run_init_functions(static_init);
run_init_functions(shared_init);