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;
}
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;
}
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 */
/* 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;
}
/* 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;
}
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;
}
/* 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;
}
/* 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;
}
/* 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
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;
}
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;
}
/* 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;
}
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.
*
/* 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;
}
/* 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
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;
}