summaryrefslogtreecommitdiff
path: root/source3/passdb/secrets.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-02-15 23:15:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:10:09 -0500
commit3e4cf56fa3f9d465d27dadaa6790bbcdea5d3cd9 (patch)
treea9a118e20c04313e585301e46b27ac8081cafdb5 /source3/passdb/secrets.c
parent2f2ab29cc110bebce3804f57c32ee55b691e81de (diff)
downloadsamba-3e4cf56fa3f9d465d27dadaa6790bbcdea5d3cd9.tar.gz
samba-3e4cf56fa3f9d465d27dadaa6790bbcdea5d3cd9.tar.bz2
samba-3e4cf56fa3f9d465d27dadaa6790bbcdea5d3cd9.zip
r13519: Fix the credentials chaining across netlogon pipe disconnects.
I mean it this time :-). Jeremy. (This used to be commit 80f4868944d349015d2b64c2414b06466a8194aa)
Diffstat (limited to 'source3/passdb/secrets.c')
-rw-r--r--source3/passdb/secrets.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 8f93bec9bc..6e46ea57fe 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -997,7 +997,7 @@ BOOL secrets_store_schannel_session_info(TALLOC_CTX *mem_ctx, const struct dcinf
BOOL secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx,
const char *remote_machine,
- struct dcinfo *pdc)
+ struct dcinfo **ppdc)
{
TDB_CONTEXT *tdb_sc = NULL;
TDB_DATA value;
@@ -1008,10 +1008,11 @@ BOOL secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx,
unsigned char *pmach_pw = NULL;
uint32 l1, l2, l3, l4, l5;
int ret;
+ struct dcinfo *pdc = NULL;
char *keystr = talloc_asprintf(mem_ctx, "%s/%s", SECRETS_SCHANNEL_STATE,
remote_machine);
- ZERO_STRUCTP(pdc);
+ *ppdc = NULL;
if (!keystr) {
return False;
@@ -1035,6 +1036,8 @@ BOOL secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx,
tdb_close(tdb_sc);
+ pdc = TALLOC_ZERO_P(mem_ctx, struct dcinfo);
+
/* Retrieve the record. */
ret = tdb_unpack(value.dptr, value.dsize, "dBBBBBfff",
&pdc->sequence,
@@ -1049,13 +1052,13 @@ BOOL secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx,
if (ret == -1 || l1 != 8 || l2 != 8 || l3 != 8 || l4 != 8 || l5 != 16) {
talloc_free(keystr);
+ talloc_free(pdc);
SAFE_FREE(pseed_chal);
SAFE_FREE(pclnt_chal);
SAFE_FREE(psrv_chal);
SAFE_FREE(psess_key);
SAFE_FREE(pmach_pw);
SAFE_FREE(value.dptr);
- ZERO_STRUCTP(pdc);
return False;
}
@@ -1070,7 +1073,7 @@ BOOL secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx,
pdc->challenge_sent = True;
pdc->authenticated = True;
- DEBUG(3,("secrets_store_schannel_session_info: restored schannel info key %s\n",
+ DEBUG(3,("secrets_restore_schannel_session_info: restored schannel info key %s\n",
keystr ));
SAFE_FREE(pseed_chal);
@@ -1081,5 +1084,8 @@ BOOL secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx,
talloc_free(keystr);
SAFE_FREE(value.dptr);
+
+ *ppdc = pdc;
+
return True;
}