Author: jelmer Date: 2007-11-17 23:10:32 +0000 (Sat, 17 Nov 2007) New Revision: 26021
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26021 Log: Fix unresolved symbol auth_get_challenge. Modified: branches/4.0-python/ branches/4.0-python/source/auth/auth.c branches/4.0-python/source/auth/auth_util.c branches/4.0-python/source/auth/credentials/credentials.h Changeset: Property changes on: branches/4.0-python ___________________________________________________________________ Name: bzr:revision-info ...skipped... Name: bzr:revision-id:v3-trunk0 ...skipped... Modified: branches/4.0-python/source/auth/auth.c =================================================================== --- branches/4.0-python/source/auth/auth.c 2007-11-17 22:50:13 UTC (rev 26020) +++ branches/4.0-python/source/auth/auth.c 2007-11-17 23:10:32 UTC (rev 26021) @@ -24,6 +24,7 @@ #include "lib/events/events.h" #include "build.h" #include "param/param.h" +#include "auth/auth_util.h" /*************************************************************************** Set a fixed challenge @@ -47,62 +48,7 @@ return auth_ctx->challenge.may_be_modified; } -/**************************************************************************** - Try to get a challenge out of the various authentication modules. - Returns a const char of length 8 bytes. -****************************************************************************/ -_PUBLIC_ NTSTATUS auth_get_challenge(struct auth_context *auth_ctx, const uint8_t **_chal) -{ - NTSTATUS nt_status; - struct auth_method_context *method; - if (auth_ctx->challenge.data.length) { - DEBUG(5, ("auth_get_challenge: returning previous challenge by module %s (normal)\n", - auth_ctx->challenge.set_by)); - *_chal = auth_ctx->challenge.data.data; - return NT_STATUS_OK; - } - - for (method = auth_ctx->methods; method; method = method->next) { - DATA_BLOB challenge = data_blob(NULL,0); - - nt_status = method->ops->get_challenge(method, auth_ctx, &challenge); - if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOT_IMPLEMENTED)) { - continue; - } - - NT_STATUS_NOT_OK_RETURN(nt_status); - - if (challenge.length != 8) { - DEBUG(0, ("auth_get_challenge: invalid challenge (length %u) by mothod [%s]\n", - (unsigned)challenge.length, method->ops->name)); - return NT_STATUS_INTERNAL_ERROR; - } - - auth_ctx->challenge.data = challenge; - auth_ctx->challenge.set_by = method->ops->name; - - break; - } - - if (!auth_ctx->challenge.set_by) { - uint8_t chal[8]; - generate_random_buffer(chal, 8); - - auth_ctx->challenge.data = data_blob_talloc(auth_ctx, chal, 8); - NT_STATUS_HAVE_NO_MEMORY(auth_ctx->challenge.data.data); - auth_ctx->challenge.set_by = "random"; - - auth_ctx->challenge.may_be_modified = true; - } - - DEBUG(10,("auth_get_challenge: challenge set by %s\n", - auth_ctx->challenge.set_by)); - - *_chal = auth_ctx->challenge.data.data; - return NT_STATUS_OK; -} - struct auth_check_password_sync_state { bool finished; NTSTATUS status; Modified: branches/4.0-python/source/auth/auth_util.c =================================================================== --- branches/4.0-python/source/auth/auth_util.c 2007-11-17 22:50:13 UTC (rev 26020) +++ branches/4.0-python/source/auth/auth_util.c 2007-11-17 23:10:32 UTC (rev 26021) @@ -28,6 +28,7 @@ #include "dsdb/samdb/samdb.h" #include "auth/credentials/credentials.h" #include "param/param.h" +#include "auth/auth_util.h" /* this default function can be used by mostly all backends * which don't want to set a challenge @@ -694,3 +695,60 @@ return nt_status; } + + +/**************************************************************************** + Try to get a challenge out of the various authentication modules. + Returns a const char of length 8 bytes. +****************************************************************************/ +_PUBLIC_ NTSTATUS auth_get_challenge(struct auth_context *auth_ctx, const uint8_t **_chal) +{ + NTSTATUS nt_status; + struct auth_method_context *method; + + if (auth_ctx->challenge.data.length) { + DEBUG(5, ("auth_get_challenge: returning previous challenge by module %s (normal)\n", + auth_ctx->challenge.set_by)); + *_chal = auth_ctx->challenge.data.data; + return NT_STATUS_OK; + } + + for (method = auth_ctx->methods; method; method = method->next) { + DATA_BLOB challenge = data_blob(NULL,0); + + nt_status = method->ops->get_challenge(method, auth_ctx, &challenge); + if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOT_IMPLEMENTED)) { + continue; + } + + NT_STATUS_NOT_OK_RETURN(nt_status); + + if (challenge.length != 8) { + DEBUG(0, ("auth_get_challenge: invalid challenge (length %u) by mothod [%s]\n", + (unsigned)challenge.length, method->ops->name)); + return NT_STATUS_INTERNAL_ERROR; + } + + auth_ctx->challenge.data = challenge; + auth_ctx->challenge.set_by = method->ops->name; + + break; + } + + if (!auth_ctx->challenge.set_by) { + uint8_t chal[8]; + generate_random_buffer(chal, 8); + + auth_ctx->challenge.data = data_blob_talloc(auth_ctx, chal, 8); + NT_STATUS_HAVE_NO_MEMORY(auth_ctx->challenge.data.data); + auth_ctx->challenge.set_by = "random"; + + auth_ctx->challenge.may_be_modified = true; + } + + DEBUG(10,("auth_get_challenge: challenge set by %s\n", + auth_ctx->challenge.set_by)); + + *_chal = auth_ctx->challenge.data.data; + return NT_STATUS_OK; +} Modified: branches/4.0-python/source/auth/credentials/credentials.h =================================================================== --- branches/4.0-python/source/auth/credentials/credentials.h 2007-11-17 22:50:13 UTC (rev 26020) +++ branches/4.0-python/source/auth/credentials/credentials.h 2007-11-17 23:10:32 UTC (rev 26021) @@ -130,6 +130,7 @@ struct loadparm_context; #include <gssapi/gssapi.h> +#include "krb5.h" struct ccache_container;
