From fe72740e8221575921c22030d6d4fcb19201b03b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 18 Jul 2012 15:07:23 +0930 Subject: loadparm: make the source3/ lp_ functions take an explicit TALLOC_CTX *. They use talloc_tos() internally: hoist that up to the callers, some of whom don't want to us talloc_tos(). A simple patch, but hits a lot of files. Signed-off-by: Rusty Russell --- source3/rpc_server/samr/srv_samr_chgpasswd.c | 10 +++++----- source3/rpc_server/samr/srv_samr_nt.c | 14 ++++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'source3/rpc_server/samr') diff --git a/source3/rpc_server/samr/srv_samr_chgpasswd.c b/source3/rpc_server/samr/srv_samr_chgpasswd.c index 94d7021349..51c0d0f96a 100644 --- a/source3/rpc_server/samr/srv_samr_chgpasswd.c +++ b/source3/rpc_server/samr/srv_samr_chgpasswd.c @@ -582,12 +582,12 @@ bool chgpasswd(const char *name, const char *rhost, const struct passwd *pass, return false; } - passwordprogram = talloc_strdup(ctx, lp_passwd_program()); + passwordprogram = lp_passwd_program(ctx); if (!passwordprogram || !*passwordprogram) { DEBUG(2, ("chgpasswd: Null password program - no password changing\n")); return false; } - chatsequence = talloc_strdup(ctx, lp_passwd_chat()); + chatsequence = lp_passwd_chat(ctx); if (!chatsequence || !*chatsequence) { DEBUG(2, ("chgpasswd: Null chat sequence - no password changing\n")); return false; @@ -938,12 +938,12 @@ NTSTATUS check_password_complexity(const char *username, char *cmd; /* Use external script to check password complexity */ - if ((lp_check_password_script() == NULL) - || (*(lp_check_password_script()) == '\0')) { + if ((lp_check_password_script(tosctx) == NULL) + || (*(lp_check_password_script(tosctx)) == '\0')) { return NT_STATUS_OK; } - cmd = talloc_string_sub(tosctx, lp_check_password_script(), "%u", + cmd = talloc_string_sub(tosctx, lp_check_password_script(tosctx), "%u", username); if (!cmd) { return NT_STATUS_PASSWORD_RESTRICTION; diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index d7cebb4535..1065f2ac6a 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -545,7 +545,8 @@ NTSTATUS _samr_GetUserPwInfo(struct pipes_struct *p, &password_properties); unbecome_root(); - if (lp_check_password_script() && *lp_check_password_script()) { + if (lp_check_password_script(talloc_tos()) + && *lp_check_password_script(talloc_tos())) { password_properties |= DOMAIN_PASSWORD_COMPLEX; } @@ -2050,7 +2051,8 @@ NTSTATUS _samr_ChangePasswordUser3(struct pipes_struct *p, unix_to_nt_time_abs((NTTIME *)&dominfo->max_password_age, u_expire); unix_to_nt_time_abs((NTTIME *)&dominfo->min_password_age, u_min_age); - if (lp_check_password_script() && *lp_check_password_script()) { + if (lp_check_password_script(talloc_tos()) + && *lp_check_password_script(talloc_tos())) { dominfo->password_properties |= DOMAIN_PASSWORD_COMPLEX; } @@ -3313,7 +3315,7 @@ static NTSTATUS query_dom_info_1(TALLOC_CTX *mem_ctx, unix_to_nt_time_abs((NTTIME *)&r->max_password_age, u_expire); unix_to_nt_time_abs((NTTIME *)&r->min_password_age, u_min_age); - if (lp_check_password_script() && *lp_check_password_script()) { + if (lp_check_password_script(talloc_tos()) && *lp_check_password_script(talloc_tos())) { r->password_properties |= DOMAIN_PASSWORD_COMPLEX; } @@ -3350,7 +3352,7 @@ static NTSTATUS query_dom_info_2(TALLOC_CTX *mem_ctx, unbecome_root(); - r->oem_information.string = lp_serverstring(); + r->oem_information.string = lp_serverstring(r); r->domain_name.string = lp_workgroup(); r->primary.string = lp_netbios_name(); r->sequence_num = seq_num; @@ -3394,7 +3396,7 @@ static NTSTATUS query_dom_info_3(TALLOC_CTX *mem_ctx, static NTSTATUS query_dom_info_4(TALLOC_CTX *mem_ctx, struct samr_DomOEMInformation *r) { - r->oem_information.string = lp_serverstring(); + r->oem_information.string = lp_serverstring(r); return NT_STATUS_OK; } @@ -6266,7 +6268,7 @@ NTSTATUS _samr_GetDomPwInfo(struct pipes_struct *p, &password_properties); unbecome_root(); - if (lp_check_password_script() && *lp_check_password_script()) { + if (lp_check_password_script(talloc_tos()) && *lp_check_password_script(talloc_tos())) { password_properties |= DOMAIN_PASSWORD_COMPLEX; } -- cgit