summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-15 13:51:54 +0100
committerGünther Deschner <gd@samba.org>2008-02-15 14:04:55 +0100
commit401c0a6551efe2ac574d4fa0337c15ee2dd61da7 (patch)
treeac807afe886243ea0f88a2e4e377efc8dc5cde99
parent1976c7acc7f98914be50c0dd5d5c259511e273fa (diff)
downloadsamba-401c0a6551efe2ac574d4fa0337c15ee2dd61da7.tar.gz
samba-401c0a6551efe2ac574d4fa0337c15ee2dd61da7.tar.bz2
samba-401c0a6551efe2ac574d4fa0337c15ee2dd61da7.zip
Add netlogon_creds_client_check and netlogon_creds_client_step.
Guenther (This used to be commit 41d33a2507e3fae7837bb8e42b1ac30cc31c31dc)
-rw-r--r--source3/libsmb/credentials.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source3/libsmb/credentials.c b/source3/libsmb/credentials.c
index 1256a6210e..f03bf22df1 100644
--- a/source3/libsmb/credentials.c
+++ b/source3/libsmb/credentials.c
@@ -329,6 +329,25 @@ bool creds_client_check(const struct dcinfo *dc, const DOM_CHAL *rcv_srv_chal_in
return True;
}
+bool netlogon_creds_client_check(const struct dcinfo *dc,
+ const struct netr_Credential *rcv_srv_chal_in)
+{
+ if (memcmp(dc->srv_chal.data, rcv_srv_chal_in->data,
+ sizeof(dc->srv_chal.data))) {
+
+ DEBUG(0,("netlogon_creds_client_check: credentials check failed.\n"));
+ DEBUGADD(5,("netlogon_creds_client_check: challenge : %s\n",
+ credstr(rcv_srv_chal_in->data)));
+ DEBUGADD(5,("calculated: %s\n", credstr(dc->srv_chal.data)));
+ return false;
+ }
+
+ DEBUG(10,("netlogon_creds_client_check: credentials check OK.\n"));
+
+ return true;
+}
+
+
/****************************************************************************
Step the client credentials to the next element in the chain, updating the
current client and server credentials and the seed
@@ -345,3 +364,15 @@ void creds_client_step(struct dcinfo *dc, DOM_CRED *next_cred_out)
next_cred_out->challenge = dc->clnt_chal;
next_cred_out->timestamp.time = dc->sequence;
}
+
+void netlogon_creds_client_step(struct dcinfo *dc,
+ struct netr_Authenticator *next_cred_out)
+{
+ dc->sequence += 2;
+ creds_step(dc);
+ creds_reseed(dc);
+
+ memcpy(&next_cred_out->cred.data, &dc->clnt_chal.data,
+ sizeof(next_cred_out->cred.data));
+ next_cred_out->timestamp = dc->sequence;
+}