diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-06-05 01:29:20 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:27 -0500 |
commit | 1a993b800eca5dc8daccc715da46e7b84c604389 (patch) | |
tree | 92f31d8e29d3a297f20dee11b0e75100745f455e /source4 | |
parent | cd35e12c7f96ef5297e78e6cd7a37f118382d722 (diff) | |
download | samba-1a993b800eca5dc8daccc715da46e7b84c604389.tar.gz samba-1a993b800eca5dc8daccc715da46e7b84c604389.tar.bz2 samba-1a993b800eca5dc8daccc715da46e7b84c604389.zip |
r1016: - store the schannel session key after it is established
- move to a centralised way of handling talloc/ldb interaction
(This used to be commit 2b9b752875ba5e03e82f40e31f26bc1f245b3825)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/rpc_server/config.mk | 2 | ||||
-rw-r--r-- | source4/rpc_server/netlogon/dcerpc_netlogon.c | 5 | ||||
-rw-r--r-- | source4/rpc_server/samr/samdb.c | 30 |
3 files changed, 17 insertions, 20 deletions
diff --git a/source4/rpc_server/config.mk b/source4/rpc_server/config.mk index d532256c10..4a7b17cffb 100644 --- a/source4/rpc_server/config.mk +++ b/source4/rpc_server/config.mk @@ -97,6 +97,8 @@ REQUIRED_SUBSYSTEMS = \ [MODULE::dcerpc_netlogon] INIT_OBJ_FILES = \ rpc_server/netlogon/dcerpc_netlogon.o +ADD_OBJ_FILES = \ + rpc_server/netlogon/schannel_state.o REQUIRED_SUBSYSTEMS = \ SAMDB \ DCERPC_COMMON diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index f662e45246..ea76be44f5 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -251,7 +251,10 @@ static NTSTATUS netr_ServerAuthenticate3(struct dcesrv_call_state *dce_call, TAL pipe_state->computer_name = talloc_strdup(pipe_state->mem_ctx, r->in.computer_name); - return NT_STATUS_OK; + /* remember this session key state */ + nt_status = schannel_store_session_key(mem_ctx, pipe_state->computer_name, pipe_state->creds); + + return nt_status; } diff --git a/source4/rpc_server/samr/samdb.c b/source4/rpc_server/samr/samdb.c index e6862eb8f9..872ec82894 100644 --- a/source4/rpc_server/samr/samdb.c +++ b/source4/rpc_server/samr/samdb.c @@ -89,14 +89,6 @@ void samdb_close(void *ctx) } /* - a alloc function for ldb -*/ -static void *samdb_alloc(void *context, void *ptr, size_t size) -{ - return talloc_realloc((TALLOC_CTX *)context, ptr, size); -} - -/* search the sam for the specified attributes - va_list varient */ int samdb_search_v(void *ctx, @@ -116,7 +108,7 @@ int samdb_search_v(void *ctx, return -1; } - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); count = ldb_search(sam_ctx->ldb, basedn, LDB_SCOPE_SUBTREE, expr, attrs, res); @@ -155,7 +147,7 @@ int samdb_search_free(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message **res) { struct samdb_context *sam_ctx = ctx; - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); return ldb_search_free(sam_ctx->ldb, res); } @@ -772,7 +764,7 @@ int samdb_msg_add_string(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg if (s == NULL || a == NULL) { return -1; } - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); return ldb_msg_add_string(sam_ctx->ldb, msg, a, s); } @@ -787,7 +779,7 @@ int samdb_msg_add_delete(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg if (a == NULL) { return -1; } - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); /* we use an empty replace rather than a delete, as it allows for samdb_replace() to be used everywhere */ return ldb_msg_add_empty(sam_ctx->ldb, msg, a, LDB_FLAG_MOD_REPLACE); @@ -837,7 +829,7 @@ int samdb_msg_add_hash(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg, return -1; } memcpy(val.data, hash.hash, 16); - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); return ldb_msg_add_value(sam_ctx->ldb, msg, attr_name, &val); } @@ -858,7 +850,7 @@ int samdb_msg_add_hashes(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg for (i=0;i<count;i++) { memcpy(i*16 + (char *)val.data, hashes[i].hash, 16); } - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); return ldb_msg_add_value(sam_ctx->ldb, msg, attr_name, &val); } @@ -881,7 +873,7 @@ int samdb_msg_add_logon_hours(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message struct ldb_val val; val.length = hours.units_per_week / 8; val.data = hours.bitmap; - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); return ldb_msg_add_value(sam_ctx->ldb, msg, attr_name, &val); } @@ -894,7 +886,7 @@ int samdb_msg_set_string(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg struct samdb_context *sam_ctx = ctx; struct ldb_message_element *el; - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); el = ldb_msg_find_element(msg, attr_name); if (el) { @@ -923,7 +915,7 @@ int samdb_add(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg) { struct samdb_context *sam_ctx = ctx; - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); return ldb_add(sam_ctx->ldb, msg); } @@ -934,7 +926,7 @@ int samdb_delete(void *ctx, TALLOC_CTX *mem_ctx, const char *dn) { struct samdb_context *sam_ctx = ctx; - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); return ldb_delete(sam_ctx->ldb, dn); } @@ -945,7 +937,7 @@ int samdb_modify(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg) { struct samdb_context *sam_ctx = ctx; - ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx); + ldb_set_alloc(sam_ctx->ldb, talloc_ldb_alloc, mem_ctx); return ldb_modify(sam_ctx->ldb, msg); } |