summaryrefslogtreecommitdiff
path: root/source4/rpc_server/netlogon
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-06-05 05:01:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:30 -0500
commit5341ad20e1b8953c9256cd8e04a7e55ba9ef84b5 (patch)
tree9d2c21766becd650905c32b1195d6a0203f93110 /source4/rpc_server/netlogon
parent4c6f04d83f20ecfe62cd87dadf9b48a898502ea7 (diff)
downloadsamba-5341ad20e1b8953c9256cd8e04a7e55ba9ef84b5.tar.gz
samba-5341ad20e1b8953c9256cd8e04a7e55ba9ef84b5.tar.bz2
samba-5341ad20e1b8953c9256cd8e04a7e55ba9ef84b5.zip
r1030: added server side schannel support
(This used to be commit 2ac79dfba0e64056a680f21d7dd0c007f79d4a70)
Diffstat (limited to 'source4/rpc_server/netlogon')
-rw-r--r--source4/rpc_server/netlogon/schannel_state.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source4/rpc_server/netlogon/schannel_state.c b/source4/rpc_server/netlogon/schannel_state.c
index f4190f21b4..eaa5013572 100644
--- a/source4/rpc_server/netlogon/schannel_state.c
+++ b/source4/rpc_server/netlogon/schannel_state.c
@@ -88,13 +88,17 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
ldb_msg_add_value(ldb, &msg, "sessionKey", &val);
ldb_msg_add_string(ldb, &msg, "expiry", s);
+ ldb_delete(ldb, msg.dn);
+
ret = ldb_add(ldb, &msg);
- ldb_close(ldb);
if (ret != 0) {
+ DEBUG(1,("Unable to add %s to session key db - %s\n", msg.dn, ldb_errstring(ldb)));
+ ldb_close(ldb);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
+ ldb_close(ldb);
return NT_STATUS_OK;
}
@@ -110,13 +114,20 @@ NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
struct ldb_message **res;
int ret;
const struct ldb_val *val;
+ char *expr=NULL;
ldb = schannel_db_connect(mem_ctx);
if (ldb == NULL) {
return NT_STATUS_NO_MEMORY;
}
- ret = ldb_search(ldb, NULL, LDB_SCOPE_SUBTREE, "(dn=%s)", NULL, &res);
+ expr = talloc_asprintf(mem_ctx, "(dn=%s)", computer_name);
+ if (expr == NULL) {
+ ldb_close(ldb);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ret = ldb_search(ldb, NULL, LDB_SCOPE_SUBTREE, expr, NULL, &res);
if (ret != 1) {
ldb_close(ldb);
return NT_STATUS_INVALID_HANDLE;