summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/auth/auth_builtin.c35
-rw-r--r--source3/auth/auth_domain.c20
-rw-r--r--source3/auth/auth_netlogond.c10
-rw-r--r--source3/auth/auth_sam.c20
-rw-r--r--source3/auth/auth_script.c14
-rw-r--r--source3/auth/auth_server.c13
-rw-r--r--source3/auth/auth_unix.c10
-rw-r--r--source3/auth/auth_util.c26
-rw-r--r--source3/auth/auth_wbc.c11
-rw-r--r--source3/auth/auth_winbind.c14
10 files changed, 101 insertions, 72 deletions
diff --git a/source3/auth/auth_builtin.c b/source3/auth/auth_builtin.c
index b4ed70cfdd..e2ad84834d 100644
--- a/source3/auth/auth_builtin.c
+++ b/source3/auth/auth_builtin.c
@@ -52,11 +52,16 @@ static NTSTATUS check_guest_security(const struct auth_context *auth_context,
static NTSTATUS auth_init_guest(struct auth_context *auth_context, const char *options, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method))
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
+ }
+ result->auth = check_guest_security;
+ result->name = "guest";
- (*auth_method)->auth = check_guest_security;
- (*auth_method)->name = "guest";
+ *auth_method = result;
return NT_STATUS_OK;
}
@@ -104,11 +109,16 @@ static NTSTATUS check_name_to_ntstatus_security(const struct auth_context *auth_
static NTSTATUS auth_init_name_to_ntstatus(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method))
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
+ }
+ result->auth = check_name_to_ntstatus_security;
+ result->name = "name_to_ntstatus";
- (*auth_method)->auth = check_name_to_ntstatus_security;
- (*auth_method)->name = "name_to_ntstatus";
+ *auth_method = result;
return NT_STATUS_OK;
}
@@ -153,12 +163,17 @@ static DATA_BLOB auth_get_fixed_challenge(const struct auth_context *auth_contex
static NTSTATUS auth_init_fixed_challenge(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method))
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
+ }
+ result->auth = check_fixed_challenge_security;
+ result->get_chal = auth_get_fixed_challenge;
+ result->name = "fixed_challenge";
- (*auth_method)->auth = check_fixed_challenge_security;
- (*auth_method)->get_chal = auth_get_fixed_challenge;
- (*auth_method)->name = "fixed_challenge";
+ *auth_method = result;
return NT_STATUS_OK;
}
#endif /* DEVELOPER */
diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c
index 6e182a38e7..3a9da2cc68 100644
--- a/source3/auth/auth_domain.c
+++ b/source3/auth/auth_domain.c
@@ -424,12 +424,16 @@ static NTSTATUS check_ntdomain_security(const struct auth_context *auth_context,
/* module initialisation */
static NTSTATUS auth_init_ntdomain(struct auth_context *auth_context, const char* param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method)) {
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
+ result->name = "ntdomain";
+ result->auth = check_ntdomain_security;
- (*auth_method)->name = "ntdomain";
- (*auth_method)->auth = check_ntdomain_security;
+ *auth_method = result;
return NT_STATUS_OK;
}
@@ -524,12 +528,16 @@ static NTSTATUS check_trustdomain_security(const struct auth_context *auth_conte
/* module initialisation */
static NTSTATUS auth_init_trustdomain(struct auth_context *auth_context, const char* param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method)) {
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
+ result->name = "trustdomain";
+ result->auth = check_trustdomain_security;
- (*auth_method)->name = "trustdomain";
- (*auth_method)->auth = check_trustdomain_security;
+ *auth_method = result;
return NT_STATUS_OK;
}
diff --git a/source3/auth/auth_netlogond.c b/source3/auth/auth_netlogond.c
index bfd12281c4..5e05f1b15b 100644
--- a/source3/auth/auth_netlogond.c
+++ b/source3/auth/auth_netlogond.c
@@ -299,12 +299,16 @@ static NTSTATUS auth_init_netlogond(struct auth_context *auth_context,
const char *param,
auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method)) {
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
+ result->name = "netlogond";
+ result->auth = check_netlogond_security;
- (*auth_method)->name = "netlogond";
- (*auth_method)->auth = check_netlogond_security;
+ *auth_method = result;
return NT_STATUS_OK;
}
diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c
index 01b25178ee..cf121d1dbf 100644
--- a/source3/auth/auth_sam.c
+++ b/source3/auth/auth_sam.c
@@ -517,12 +517,16 @@ done:
/* module initialisation */
static NTSTATUS auth_init_sam_ignoredomain(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method)) {
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
+ result->auth = check_sam_security;
+ result->name = "sam_ignoredomain";
- (*auth_method)->auth = check_sam_security;
- (*auth_method)->name = "sam_ignoredomain";
+ *auth_method = result;
return NT_STATUS_OK;
}
@@ -574,12 +578,16 @@ static NTSTATUS check_samstrict_security(const struct auth_context *auth_context
/* module initialisation */
static NTSTATUS auth_init_sam(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method)) {
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
+ result->auth = check_samstrict_security;
+ result->name = "sam";
- (*auth_method)->auth = check_samstrict_security;
- (*auth_method)->name = "sam";
+ *auth_method = result;
return NT_STATUS_OK;
}
diff --git a/source3/auth/auth_script.c b/source3/auth/auth_script.c
index 5769f21979..81c80eb4fb 100644
--- a/source3/auth/auth_script.c
+++ b/source3/auth/auth_script.c
@@ -121,12 +121,14 @@ static NTSTATUS script_check_user_credentials(const struct auth_context *auth_co
/* module initialisation */
static NTSTATUS auth_init_script(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method)) {
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
-
- (*auth_method)->name = "script";
- (*auth_method)->auth = script_check_user_credentials;
+ result->name = "script";
+ result->auth = script_check_user_credentials;
if (param && *param) {
/* we load the 'fallback' module - if script isn't here, call this
@@ -135,8 +137,10 @@ static NTSTATUS auth_init_script(struct auth_context *auth_context, const char *
if (!load_auth_module(auth_context, param, &priv)) {
return NT_STATUS_UNSUCCESSFUL;
}
- (*auth_method)->private_data = (void *)priv;
+ result->private_data = (void *)priv;
}
+
+ *auth_method = result;
return NT_STATUS_OK;
}
diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c
index f0f0267bdb..4bcb7967c0 100644
--- a/source3/auth/auth_server.c
+++ b/source3/auth/auth_server.c
@@ -454,12 +454,17 @@ use this machine as the password server.\n"));
static NTSTATUS auth_init_smbserver(struct auth_context *auth_context, const char* param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method)) {
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
- (*auth_method)->name = "smbserver";
- (*auth_method)->auth = check_smbserver_security;
- (*auth_method)->get_chal = auth_get_challenge_server;
+ result->name = "smbserver";
+ result->auth = check_smbserver_security;
+ result->get_chal = auth_get_challenge_server;
+
+ *auth_method = result;
return NT_STATUS_OK;
}
diff --git a/source3/auth/auth_unix.c b/source3/auth/auth_unix.c
index 99b94b609e..86c5a586d9 100644
--- a/source3/auth/auth_unix.c
+++ b/source3/auth/auth_unix.c
@@ -129,12 +129,16 @@ static NTSTATUS check_unix_security(const struct auth_context *auth_context,
/* module initialisation */
static NTSTATUS auth_init_unix(struct auth_context *auth_context, const char* param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method)) {
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
+ result->name = "unix";
+ result->auth = check_unix_security;
- (*auth_method)->name = "unix";
- (*auth_method)->auth = check_unix_security;
+ *auth_method = result;
return NT_STATUS_OK;
}
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index ab2ffc259e..1362956e0a 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -2128,32 +2128,6 @@ void free_user_info(struct auth_usersupplied_info **user_info)
SAFE_FREE(*user_info);
}
-/***************************************************************************
- Make an auth_methods struct
-***************************************************************************/
-
-bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method)
-{
- if (!auth_context) {
- smb_panic("no auth_context supplied to "
- "make_auth_methods()!\n");
- }
-
- if (!auth_method) {
- smb_panic("make_auth_methods: pointer to auth_method pointer "
- "is NULL!\n");
- }
-
- *auth_method = TALLOC_P(auth_context, auth_methods);
- if (!*auth_method) {
- DEBUG(0,("make_auth_method: malloc failed!\n"));
- return False;
- }
- ZERO_STRUCTP(*auth_method);
-
- return True;
-}
-
/**
* Verify whether or not given domain is trusted.
*
diff --git a/source3/auth/auth_wbc.c b/source3/auth/auth_wbc.c
index 85b05efb36..b91a57357d 100644
--- a/source3/auth/auth_wbc.c
+++ b/source3/auth/auth_wbc.c
@@ -134,13 +134,16 @@ static NTSTATUS check_wbc_security(const struct auth_context *auth_context,
/* module initialisation */
static NTSTATUS auth_init_wbc(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method)) {
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
+ result->name = "wbc";
+ result->auth = check_wbc_security;
- (*auth_method)->name = "wbc";
- (*auth_method)->auth = check_wbc_security;
-
+ *auth_method = result;
return NT_STATUS_OK;
}
diff --git a/source3/auth/auth_winbind.c b/source3/auth/auth_winbind.c
index 93028c4cd8..86a6194bcf 100644
--- a/source3/auth/auth_winbind.c
+++ b/source3/auth/auth_winbind.c
@@ -128,12 +128,14 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
/* module initialisation */
static NTSTATUS auth_init_winbind(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
{
- if (!make_auth_methods(auth_context, auth_method)) {
+ struct auth_methods *result;
+
+ result = TALLOC_ZERO_P(auth_context, struct auth_methods);
+ if (result == NULL) {
return NT_STATUS_NO_MEMORY;
}
-
- (*auth_method)->name = "winbind";
- (*auth_method)->auth = check_winbind_security;
+ result->name = "winbind";
+ result->auth = check_winbind_security;
if (param && *param) {
/* we load the 'fallback' module - if winbind isn't here, call this
@@ -142,8 +144,10 @@ static NTSTATUS auth_init_winbind(struct auth_context *auth_context, const char
if (!load_auth_module(auth_context, param, &priv)) {
return NT_STATUS_UNSUCCESSFUL;
}
- (*auth_method)->private_data = (void *)priv;
+ result->private_data = (void *)priv;
}
+
+ *auth_method = result;
return NT_STATUS_OK;
}