diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-01-10 12:30:13 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:38 -0500 |
commit | e8c06b9221d9818042ea8a08efccfc88f17a9e3e (patch) | |
tree | 8181177fccc6bdb203853da303977a33d066eb77 /source4/rpc_server/netlogon/schannel_state.c | |
parent | 577218b2aded7adb367f3f33bcc5560f3d4c0ec2 (diff) | |
download | samba-e8c06b9221d9818042ea8a08efccfc88f17a9e3e.tar.gz samba-e8c06b9221d9818042ea8a08efccfc88f17a9e3e.tar.bz2 samba-e8c06b9221d9818042ea8a08efccfc88f17a9e3e.zip |
r4641: Push a few more details into the schannel ldb, and into the
credentials struct it maintains.
Clearly much of this will be replaced with some system to pass and
store the session_info, as that is the 'right way' to handle this.
Andrew Bartlett
(This used to be commit c6fcb33a887fbf0c0b42c3bc331df942a985128c)
Diffstat (limited to 'source4/rpc_server/netlogon/schannel_state.c')
-rw-r--r-- | source4/rpc_server/netlogon/schannel_state.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source4/rpc_server/netlogon/schannel_state.c b/source4/rpc_server/netlogon/schannel_state.c index 7dc60a1617..56f7152c14 100644 --- a/source4/rpc_server/netlogon/schannel_state.c +++ b/source4/rpc_server/netlogon/schannel_state.c @@ -55,7 +55,6 @@ static struct ldb_wrap *schannel_db_connect(TALLOC_CTX *mem_ctx) use a simple ldb structure */ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, - const char *computer_name, struct creds_CredentialState *creds) { struct ldb_wrap *ldb; @@ -63,6 +62,7 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, struct ldb_val val, seed; char *s; char *f; + char *sct; time_t expiry = time(NULL) + SCHANNEL_CREDENTIALS_EXPIRY; int ret; @@ -85,13 +85,20 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } + sct = talloc_asprintf(mem_ctx, "%u", (unsigned int)creds->secure_channel_type); + + if (sct == NULL) { + talloc_free(ldb); + return NT_STATUS_NO_MEMORY; + } + msg = ldb_msg_new(mem_ctx); if (msg == NULL) { talloc_free(ldb); return NT_STATUS_NO_MEMORY; } - msg->dn = talloc_strdup(msg, computer_name); + msg->dn = talloc_asprintf(msg, "computerName=%s", creds->computer_name); if (msg->dn == NULL) { talloc_free(ldb); talloc_free(msg); @@ -108,6 +115,9 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, ldb_msg_add_value(ldb->ldb, msg, "seed", &seed); ldb_msg_add_string(ldb->ldb, msg, "expiry", s); ldb_msg_add_string(ldb->ldb, msg, "negotiateFlags", f); + ldb_msg_add_string(ldb->ldb, msg, "secureChannelType", sct); + ldb_msg_add_string(ldb->ldb, msg, "accountName", creds->account_name); + ldb_msg_add_string(ldb->ldb, msg, "computerName", creds->computer_name); ldb_delete(ldb->ldb, msg->dn); @@ -154,7 +164,7 @@ NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - expr = talloc_asprintf(mem_ctx, "(dn=%s)", computer_name); + expr = talloc_asprintf(mem_ctx, "(dn=computerName=%s)", computer_name); if (expr == NULL) { talloc_free(ldb); return NT_STATUS_NO_MEMORY; @@ -191,6 +201,12 @@ NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx, (*creds)->negotiate_flags = ldb_msg_find_int(res[0], "negotiateFlags", 0); + (*creds)->secure_channel_type = ldb_msg_find_int(res[0], "secureChannelType", 0); + + (*creds)->account_name = talloc_reference(*creds, ldb_msg_find_string(res[0], "accountName", NULL)); + + (*creds)->computer_name = talloc_reference(*creds, ldb_msg_find_string(res[0], "computerName", NULL)); + talloc_free(ldb); return NT_STATUS_OK; |