s3: Remove the make_auth_methods routine
authorVolker Lendecke <vl@samba.org>
Sun, 11 Apr 2010 10:37:48 +0000 (12:37 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 11 Apr 2010 11:53:19 +0000 (13:53 +0200)
This was just TALLOC_ZERO_P

source3/auth/auth_builtin.c
source3/auth/auth_domain.c
source3/auth/auth_netlogond.c
source3/auth/auth_sam.c
source3/auth/auth_script.c
source3/auth/auth_server.c
source3/auth/auth_unix.c
source3/auth/auth_util.c
source3/auth/auth_wbc.c
source3/auth/auth_winbind.c

index b4ed70cfddb690bf05ca18605cc4eefe7dfedf4d..e2ad84834da6887fd78779e135d04cf6d4da6d1b 100644 (file)
@@ -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 */
index 6e182a38e77df4f4b77fffa5b04c1077208f0ce4..3a9da2cc686e4ddcb7b82dd58d685fcc2475cbbb 100644 (file)
@@ -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;
 }
 
index bfd12281c4d0a122a578ac9e2f93815f9e7ad99a..5e05f1b15b1d860e7e8ded6c21de88bdd01b8319 100644 (file)
@@ -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;
 }
 
index 01b25178eef7a3ffcb9e5cbf3fa040d7f1658251..cf121d1dbf61100c71920320647eaf6ee87d74c6 100644 (file)
@@ -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;
 }
 
index 5769f21979c1c4e8f9212195b13f841cc8a75f89..81c80eb4fbdd1f85aa6c3fbb2061410ff3a124aa 100644 (file)
@@ -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;
 }
 
index f0f0267bdb8a7129d4ea7ee4d48d64de70134fb3..4bcb7967c04f6c97b98dbf161c00873c3fd89a1d 100644 (file)
@@ -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;
 }
 
index 99b94b609ea8a17e5207382910e83d6adc54aa24..86c5a586d95054cc54305697552023e81f3c6744 100644 (file)
@@ -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;
 }
 
index ab2ffc259ead8fbd75347c0f610433e5e9c4138a..1362956e0a94f6f30a34660ef2b53812d501e40d 100644 (file)
@@ -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.
  *
index 85b05efb36785e6f800b1a6f6870b3dc3e21ae80..b91a57357dbcc5986fe0372a4c2d6ef8b4004a66 100644 (file)
@@ -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;
 }
 
index 93028c4cd823289d7f071f466eb31917bf757d9a..86a6194bcfb98bea52eee81381b260ccfed64307 100644 (file)
@@ -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;
 }