From 5603dab6478fbb40206a8664a308b5db5b1863e8 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 12 Oct 2011 22:55:34 +1100 Subject: libcli/auth: Provide a struct loadparm_context to schannel calls This will allow us to pass this down to the tdb_wrap layer. Andrew Bartlett --- libcli/auth/schannel_proto.h | 2 +- libcli/auth/schannel_state.h | 6 +++--- libcli/auth/schannel_state_tdb.c | 17 +++++++++-------- libcli/auth/wscript_build | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'libcli') diff --git a/libcli/auth/schannel_proto.h b/libcli/auth/schannel_proto.h index e3aeb5a9bc..7ee4c1c079 100644 --- a/libcli/auth/schannel_proto.h +++ b/libcli/auth/schannel_proto.h @@ -26,7 +26,7 @@ struct schannel_state; struct tdb_wrap *open_schannel_session_store(TALLOC_CTX *mem_ctx, - const char *private_dir); + struct loadparm_context *lp_ctx); NTSTATUS netsec_incoming_packet(struct schannel_state *state, bool do_unseal, diff --git a/libcli/auth/schannel_state.h b/libcli/auth/schannel_state.h index 017fdbe28d..f9d02ddb4e 100644 --- a/libcli/auth/schannel_state.h +++ b/libcli/auth/schannel_state.h @@ -24,16 +24,16 @@ #define _LIBCLI_AUTH_SCHANNEL_STATE_H__ NTSTATUS schannel_get_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, const char *computer_name, struct netlogon_creds_CredentialState **creds); NTSTATUS schannel_save_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, struct netlogon_creds_CredentialState *creds); NTSTATUS schannel_check_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, const char *computer_name, struct netr_Authenticator *received_authenticator, struct netr_Authenticator *return_authenticator, diff --git a/libcli/auth/schannel_state_tdb.c b/libcli/auth/schannel_state_tdb.c index 76110b89ef..8910041f99 100644 --- a/libcli/auth/schannel_state_tdb.c +++ b/libcli/auth/schannel_state_tdb.c @@ -25,6 +25,7 @@ #include "system/filesys.h" #include "../lib/tdb_compat/tdb_compat.h" #include "../lib/util/util_tdb.h" +#include "../lib/param/param.h" #include "../libcli/auth/schannel.h" #include "../librpc/gen_ndr/ndr_schannel.h" #include "lib/util/tdb_wrap.h" @@ -37,10 +38,10 @@ *******************************************************************************/ struct tdb_wrap *open_schannel_session_store(TALLOC_CTX *mem_ctx, - const char *private_dir) + struct loadparm_context *lp_ctx) { struct tdb_wrap *tdb_sc = NULL; - char *fname = talloc_asprintf(mem_ctx, "%s/schannel_store.tdb", private_dir); + char *fname = lpcfg_private_path(mem_ctx, lp_ctx, "schannel_store.tdb"); if (!fname) { return NULL; @@ -201,7 +202,7 @@ NTSTATUS schannel_fetch_session_key_tdb(struct tdb_wrap *tdb_sc, *******************************************************************************/ NTSTATUS schannel_get_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, const char *computer_name, struct netlogon_creds_CredentialState **_creds) { @@ -215,7 +216,7 @@ NTSTATUS schannel_get_creds_state(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - tdb_sc = open_schannel_session_store(tmpctx, db_priv_dir); + tdb_sc = open_schannel_session_store(tmpctx, lp_ctx); if (!tdb_sc) { return NT_STATUS_ACCESS_DENIED; } @@ -239,7 +240,7 @@ NTSTATUS schannel_get_creds_state(TALLOC_CTX *mem_ctx, *******************************************************************************/ NTSTATUS schannel_save_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, struct netlogon_creds_CredentialState *creds) { TALLOC_CTX *tmpctx; @@ -251,7 +252,7 @@ NTSTATUS schannel_save_creds_state(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - tdb_sc = open_schannel_session_store(tmpctx, db_priv_dir); + tdb_sc = open_schannel_session_store(tmpctx, lp_ctx); if (!tdb_sc) { return NT_STATUS_ACCESS_DENIED; } @@ -273,7 +274,7 @@ NTSTATUS schannel_save_creds_state(TALLOC_CTX *mem_ctx, ********************************************************************/ NTSTATUS schannel_check_creds_state(TALLOC_CTX *mem_ctx, - const char *db_priv_dir, + struct loadparm_context *lp_ctx, const char *computer_name, struct netr_Authenticator *received_authenticator, struct netr_Authenticator *return_authenticator, @@ -290,7 +291,7 @@ NTSTATUS schannel_check_creds_state(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - tdb_sc = open_schannel_session_store(tmpctx, db_priv_dir); + tdb_sc = open_schannel_session_store(tmpctx, lp_ctx); if (!tdb_sc) { status = NT_STATUS_ACCESS_DENIED; goto done; diff --git a/libcli/auth/wscript_build b/libcli/auth/wscript_build index acb1ce38f0..2afab44ac2 100644 --- a/libcli/auth/wscript_build +++ b/libcli/auth/wscript_build @@ -26,7 +26,7 @@ bld.SAMBA_SUBSYSTEM('LIBCLI_AUTH', bld.SAMBA_SUBSYSTEM('COMMON_SCHANNEL', source='schannel_state_tdb.c schannel_sign.c', - deps='tdb-wrap UTIL_TDB' + deps='tdb-wrap UTIL_TDB samba-hostconfig' ) -- cgit