diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-01-02 07:51:13 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:07:55 -0500 |
commit | 500d5523d2a83234d6bfbf264d78293426488bfc (patch) | |
tree | 2a90456d248fb4c27184771ac2ede645356e6025 /source4/rpc_server/netlogon/schannel_state.c | |
parent | 1a988ec9af7960616fb4661b20d86ff05146d836 (diff) | |
download | samba-500d5523d2a83234d6bfbf264d78293426488bfc.tar.gz samba-500d5523d2a83234d6bfbf264d78293426488bfc.tar.bz2 samba-500d5523d2a83234d6bfbf264d78293426488bfc.zip |
r4475: fixed smbd to work with the small changes in the ldb API (the most important
change was in the ldb_msg_add_*() routines, which now use the msg as a context,
and thus it needs to be a talloc ptr)
(This used to be commit 1a4713bfd0e519f3eb7b3241121ff914a6eeef18)
Diffstat (limited to 'source4/rpc_server/netlogon/schannel_state.c')
-rw-r--r-- | source4/rpc_server/netlogon/schannel_state.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/source4/rpc_server/netlogon/schannel_state.c b/source4/rpc_server/netlogon/schannel_state.c index e02ef04ad5..564564e8c2 100644 --- a/source4/rpc_server/netlogon/schannel_state.c +++ b/source4/rpc_server/netlogon/schannel_state.c @@ -47,8 +47,6 @@ static struct ldb_wrap *schannel_db_connect(TALLOC_CTX *mem_ctx) return NULL; } - ldb_set_alloc(ldb->ldb, talloc_realloc_fn, mem_ctx); - return ldb; } @@ -61,7 +59,7 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, struct creds_CredentialState *creds) { struct ldb_wrap *ldb; - struct ldb_message msg; + struct ldb_message *msg; struct ldb_val val, seed; char *s = NULL; time_t expiry = time(NULL) + SCHANNEL_CREDENTIALS_EXPIRY; @@ -79,11 +77,16 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } + msg = ldb_msg_new(mem_ctx); + if (msg == NULL) { + talloc_free(ldb); + return NT_STATUS_NO_MEMORY; + } - ZERO_STRUCT(msg); - msg.dn = talloc_strdup(mem_ctx, computer_name); - if (msg.dn == NULL) { + msg->dn = talloc_strdup(msg, computer_name); + if (msg->dn == NULL) { talloc_free(ldb); + talloc_free(msg); return NT_STATUS_NO_MEMORY; } @@ -93,23 +96,25 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, seed.data = creds->seed.data; seed.length = sizeof(creds->seed.data); - ldb_msg_add_value(ldb->ldb, &msg, "sessionKey", &val); - ldb_msg_add_value(ldb->ldb, &msg, "seed", &seed); - ldb_msg_add_string(ldb->ldb, &msg, "expiry", s); + ldb_msg_add_value(ldb->ldb, msg, "sessionKey", &val); + ldb_msg_add_value(ldb->ldb, msg, "seed", &seed); + ldb_msg_add_string(ldb->ldb, msg, "expiry", s); - ldb_delete(ldb->ldb, msg.dn); + ldb_delete(ldb->ldb, msg->dn); - ret = ldb_add(ldb->ldb, &msg); + ret = ldb_add(ldb->ldb, msg); talloc_free(s); if (ret != 0) { DEBUG(0,("Unable to add %s to session key db - %s\n", - msg.dn, ldb_errstring(ldb->ldb))); + msg->dn, ldb_errstring(ldb->ldb))); talloc_free(ldb); + talloc_free(msg); return NT_STATUS_INTERNAL_DB_CORRUPTION; } + talloc_free(msg); talloc_free(ldb); return NT_STATUS_OK; |