summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/epmd.c5
-rw-r--r--source3/rpc_server/lsasd.c6
-rw-r--r--source3/rpc_server/samr/srv_samr_chgpasswd.c10
-rw-r--r--source3/rpc_server/samr/srv_samr_nt.c14
-rw-r--r--source3/rpc_server/spoolss/srv_spoolss_nt.c40
-rw-r--r--source3/rpc_server/srvsvc/srv_srvsvc_nt.c97
-rw-r--r--source3/rpc_server/winreg/srv_winreg_nt.c10
7 files changed, 93 insertions, 89 deletions
diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c
index 46b5c52bb7..f30372edad 100644
--- a/source3/rpc_server/epmd.c
+++ b/source3/rpc_server/epmd.c
@@ -38,7 +38,7 @@ void start_epmd(struct tevent_context *ev_ctx,
static void epmd_reopen_logs(void)
{
- char *lfile = lp_logfile();
+ char *lfile = lp_logfile(talloc_tos());
int rc;
if (lfile == NULL || lfile[0] == '\0') {
@@ -49,7 +49,8 @@ static void epmd_reopen_logs(void)
}
} else {
if (strstr(lfile, DAEMON_NAME) == NULL) {
- rc = asprintf(&lfile, "%s.%s", lp_logfile(), DAEMON_NAME);
+ rc = asprintf(&lfile, "%s.%s",
+ lp_logfile(talloc_tos()), DAEMON_NAME);
if (rc > 0) {
lp_set_logfile(lfile);
SAFE_FREE(lfile);
diff --git a/source3/rpc_server/lsasd.c b/source3/rpc_server/lsasd.c
index 8be70984db..fd6c248294 100644
--- a/source3/rpc_server/lsasd.c
+++ b/source3/rpc_server/lsasd.c
@@ -61,7 +61,7 @@ void start_lsasd(struct tevent_context *ev_ctx,
static void lsasd_reopen_logs(int child_id)
{
- char *lfile = lp_logfile();
+ char *lfile = lp_logfile(talloc_tos());
char *extension;
int rc;
@@ -82,11 +82,11 @@ static void lsasd_reopen_logs(int child_id)
if (strstr(lfile, extension) == NULL) {
if (child_id) {
rc = asprintf(&lfile, "%s.%d",
- lp_logfile(),
+ lp_logfile(talloc_tos()),
child_id);
} else {
rc = asprintf(&lfile, "%s.%s",
- lp_logfile(),
+ lp_logfile(talloc_tos()),
extension);
}
}
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;
}
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index e0612ac36c..ff342dea92 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -374,7 +374,7 @@ static WERROR delete_printer_hook(TALLOC_CTX *ctx, struct security_token *token,
const char *sharename,
struct messaging_context *msg_ctx)
{
- char *cmd = lp_deleteprinter_cmd();
+ char *cmd = lp_deleteprinter_cmd(talloc_tos());
char *command = NULL;
int ret;
bool is_print_op = false;
@@ -2772,7 +2772,7 @@ static void spoolss_notify_share_name(struct messaging_context *msg_ctx,
struct spoolss_PrinterInfo2 *pinfo2,
TALLOC_CTX *mem_ctx)
{
- SETUP_SPOOLSS_NOTIFY_DATA_STRING(data, lp_servicename(snum));
+ SETUP_SPOOLSS_NOTIFY_DATA_STRING(data, lp_servicename(talloc_tos(), snum));
}
/*******************************************************************
@@ -2818,7 +2818,7 @@ static void spoolss_notify_comment(struct messaging_context *msg_ctx,
const char *p;
if (*pinfo2->comment == '\0') {
- p = lp_comment(snum);
+ p = lp_comment(talloc_tos(), snum);
} else {
p = pinfo2->comment;
}
@@ -3385,7 +3385,7 @@ static bool construct_notify_printer_info(struct messaging_context *msg_ctx,
DEBUG(4,("construct_notify_printer_info: Notify type: [%s], number of notify info: [%d] on printer: [%s]\n",
(type == PRINTER_NOTIFY_TYPE ? "PRINTER_NOTIFY_TYPE" : "JOB_NOTIFY_TYPE"),
- option_type->count, lp_servicename(snum)));
+ option_type->count, lp_servicename(talloc_tos(), snum)));
for(field_num=0; field_num < option_type->count; field_num++) {
field = option_type->fields[field_num].field;
@@ -3552,12 +3552,12 @@ static WERROR printserver_notify_info(struct pipes_struct *p,
result = winreg_get_printer_internal(mem_ctx,
get_session_info_system(),
p->msg_ctx,
- lp_servicename(snum),
+ lp_servicename(talloc_tos(), snum),
&pinfo2);
if (!W_ERROR_IS_OK(result)) {
DEBUG(4, ("printserver_notify_info: "
"Failed to get printer [%s]\n",
- lp_servicename(snum)));
+ lp_servicename(talloc_tos(), snum)));
continue;
}
@@ -3640,7 +3640,7 @@ static WERROR printer_notify_info(struct pipes_struct *p,
result = winreg_get_printer_internal(mem_ctx,
get_session_info_system(),
p->msg_ctx,
- lp_servicename(snum), &pinfo2);
+ lp_servicename(talloc_tos(), snum), &pinfo2);
if (!W_ERROR_IS_OK(result)) {
return WERR_BADFID;
}
@@ -3929,7 +3929,7 @@ static WERROR construct_printer_info1(TALLOC_CTX *mem_ctx,
r->flags = flags;
if (info2->comment == NULL || info2->comment[0] == '\0') {
- r->comment = talloc_strdup(mem_ctx, lp_comment(snum));
+ r->comment = lp_comment(mem_ctx, snum);
} else {
r->comment = talloc_strdup(mem_ctx, info2->comment); /* saved comment */
}
@@ -3979,7 +3979,7 @@ static WERROR construct_printer_info2(TALLOC_CTX *mem_ctx,
return result;
}
- r->sharename = talloc_strdup(mem_ctx, lp_servicename(snum));
+ r->sharename = lp_servicename(mem_ctx, snum);
W_ERROR_HAVE_NO_MEMORY(r->sharename);
r->portname = talloc_strdup(mem_ctx, info2->portname);
W_ERROR_HAVE_NO_MEMORY(r->portname);
@@ -3987,7 +3987,7 @@ static WERROR construct_printer_info2(TALLOC_CTX *mem_ctx,
W_ERROR_HAVE_NO_MEMORY(r->drivername);
if (info2->comment[0] == '\0') {
- r->comment = talloc_strdup(mem_ctx, lp_comment(snum));
+ r->comment = lp_comment(mem_ctx, snum);
} else {
r->comment = talloc_strdup(mem_ctx, info2->comment);
}
@@ -4170,7 +4170,7 @@ static WERROR construct_printer_info7(TALLOC_CTX *mem_ctx,
if (is_printer_published(mem_ctx, session_info, msg_ctx,
servername,
- lp_servicename(snum), &guid, NULL)) {
+ lp_servicename(talloc_tos(), snum), &guid, NULL)) {
r->guid = talloc_strdup_upper(mem_ctx, GUID_string2(mem_ctx, &guid));
r->action = DSPRINT_PUBLISH;
} else {
@@ -6089,7 +6089,7 @@ static bool check_printer_ok(TALLOC_CTX *mem_ctx,
static WERROR add_port_hook(TALLOC_CTX *ctx, struct security_token *token, const char *portname, const char *uri)
{
- char *cmd = lp_addport_cmd();
+ char *cmd = lp_addport_cmd(talloc_tos());
char *command = NULL;
int ret;
bool is_print_op = false;
@@ -6150,7 +6150,7 @@ static bool add_printer_hook(TALLOC_CTX *ctx, struct security_token *token,
const char *remote_machine,
struct messaging_context *msg_ctx)
{
- char *cmd = lp_addprinter_cmd();
+ char *cmd = lp_addprinter_cmd(talloc_tos());
char **qlines;
char *command = NULL;
int numlines;
@@ -6705,7 +6705,7 @@ static WERROR update_printer(struct pipes_struct *p,
/* Call addprinter hook */
/* Check changes to see if this is really needed */
- if (*lp_addprinter_cmd() &&
+ if (*lp_addprinter_cmd(talloc_tos()) &&
(!strequal(printer->drivername, old_printer->drivername) ||
!strequal(printer->comment, old_printer->comment) ||
!strequal(printer->portname, old_printer->portname) ||
@@ -6785,7 +6785,7 @@ static WERROR publish_or_unpublish_printer(struct pipes_struct *p,
result = winreg_get_printer_internal(p->mem_ctx,
get_session_info_system(),
p->msg_ctx,
- lp_servicename(snum),
+ lp_servicename(talloc_tos(), snum),
&pinfo2);
if (!W_ERROR_IS_OK(result)) {
return WERR_BADFID;
@@ -6961,7 +6961,7 @@ static WERROR fill_job_info1(TALLOC_CTX *mem_ctx,
r->job_id = queue->sysjob;
- r->printer_name = talloc_strdup(mem_ctx, lp_servicename(snum));
+ r->printer_name = lp_servicename(mem_ctx, snum);
W_ERROR_HAVE_NO_MEMORY(r->printer_name);
r->server_name = talloc_strdup(mem_ctx, pinfo2->servername);
W_ERROR_HAVE_NO_MEMORY(r->server_name);
@@ -7002,7 +7002,7 @@ static WERROR fill_job_info2(TALLOC_CTX *mem_ctx,
r->job_id = queue->sysjob;
- r->printer_name = talloc_strdup(mem_ctx, lp_servicename(snum));
+ r->printer_name = lp_servicename(mem_ctx, snum);
W_ERROR_HAVE_NO_MEMORY(r->printer_name);
r->server_name = talloc_strdup(mem_ctx, pinfo2->servername);
W_ERROR_HAVE_NO_MEMORY(r->server_name);
@@ -7779,7 +7779,7 @@ static WERROR fill_port_2(TALLOC_CTX *mem_ctx,
static WERROR enumports_hook(TALLOC_CTX *ctx, int *count, char ***lines)
{
- char *cmd = lp_enumports_cmd();
+ char *cmd = lp_enumports_cmd(talloc_tos());
char **qlines = NULL;
char *command = NULL;
int numlines;
@@ -8043,7 +8043,7 @@ static WERROR spoolss_addprinterex_level_2(struct pipes_struct *p,
/* FIXME!!! smbd should check to see if the driver is installed before
trying to add a printer like this --jerry */
- if (*lp_addprinter_cmd() ) {
+ if (*lp_addprinter_cmd(talloc_tos()) ) {
char *raddr;
raddr = tsocket_address_inet_addr_string(p->remote_address,
@@ -9572,7 +9572,7 @@ WERROR _spoolss_SetPrinterDataEx(struct pipes_struct *p,
}
result = winreg_get_printer(tmp_ctx, b,
- lp_servicename(snum),
+ lp_servicename(talloc_tos(), snum),
&pinfo2);
if (!W_ERROR_IS_OK(result)) {
goto done;
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index e61fd2f47f..7f34ec28e0 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -261,7 +261,7 @@ static enum srvsvc_ShareType get_share_type(int snum)
type = lp_administrative_share(snum)
? STYPE_PRINTQ_HIDDEN : STYPE_PRINTQ;
}
- if (strequal(lp_fstype(snum), "IPC")) {
+ if (strequal(lp_fstype(talloc_tos(), snum), "IPC")) {
type = lp_administrative_share(snum)
? STYPE_IPC_HIDDEN : STYPE_IPC;
}
@@ -275,7 +275,7 @@ static enum srvsvc_ShareType get_share_type(int snum)
static void init_srv_share_info_0(struct pipes_struct *p,
struct srvsvc_NetShareInfo0 *r, int snum)
{
- r->name = lp_servicename(snum);
+ r->name = lp_servicename(talloc_tos(), snum);
}
/*******************************************************************
@@ -286,13 +286,13 @@ static void init_srv_share_info_1(struct pipes_struct *p,
struct srvsvc_NetShareInfo1 *r,
int snum)
{
- char *net_name = lp_servicename(snum);
- char *remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
+ char *net_name = lp_servicename(talloc_tos(), snum);
+ char *remark = lp_comment(p->mem_ctx, snum);
if (remark) {
remark = talloc_sub_advanced(
- p->mem_ctx, lp_servicename(snum),
- get_current_username(), lp_pathname(snum),
+ p->mem_ctx, lp_servicename(talloc_tos(), snum),
+ get_current_username(), lp_pathname(talloc_tos(), snum),
p->session_info->unix_token->uid, get_current_username(),
"", remark);
}
@@ -314,18 +314,18 @@ static void init_srv_share_info_2(struct pipes_struct *p,
char *path = NULL;
int max_connections = lp_max_connections(snum);
uint32_t max_uses = max_connections!=0 ? max_connections : (uint32_t)-1;
- char *net_name = lp_servicename(snum);
+ char *net_name = lp_servicename(talloc_tos(), snum);
- remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
+ remark = lp_comment(p->mem_ctx, snum);
if (remark) {
remark = talloc_sub_advanced(
- p->mem_ctx, lp_servicename(snum),
- get_current_username(), lp_pathname(snum),
+ p->mem_ctx, lp_servicename(talloc_tos(), snum),
+ get_current_username(), lp_pathname(talloc_tos(), snum),
p->session_info->unix_token->uid, get_current_username(),
"", remark);
}
path = talloc_asprintf(p->mem_ctx,
- "C:%s", lp_pathname(snum));
+ "C:%s", lp_pathname(talloc_tos(), snum));
if (path) {
/*
@@ -379,13 +379,13 @@ static void map_generic_share_sd_bits(struct security_descriptor *psd)
static void init_srv_share_info_501(struct pipes_struct *p,
struct srvsvc_NetShareInfo501 *r, int snum)
{
- const char *net_name = lp_servicename(snum);
- char *remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
+ const char *net_name = lp_servicename(talloc_tos(), snum);
+ char *remark = lp_comment(p->mem_ctx, snum);
if (remark) {
remark = talloc_sub_advanced(
- p->mem_ctx, lp_servicename(snum),
- get_current_username(), lp_pathname(snum),
+ p->mem_ctx, lp_servicename(talloc_tos(), snum),
+ get_current_username(), lp_pathname(talloc_tos(), snum),
p->session_info->unix_token->uid, get_current_username(),
"", remark);
}
@@ -403,22 +403,22 @@ static void init_srv_share_info_501(struct pipes_struct *p,
static void init_srv_share_info_502(struct pipes_struct *p,
struct srvsvc_NetShareInfo502 *r, int snum)
{
- const char *net_name = lp_servicename(snum);
+ const char *net_name = lp_servicename(talloc_tos(), snum);
char *path = NULL;
struct security_descriptor *sd = NULL;
struct sec_desc_buf *sd_buf = NULL;
size_t sd_size = 0;
TALLOC_CTX *ctx = p->mem_ctx;
- char *remark = talloc_strdup(ctx, lp_comment(snum));
+ char *remark = lp_comment(ctx, snum);
if (remark) {
remark = talloc_sub_advanced(
- p->mem_ctx, lp_servicename(snum),
- get_current_username(), lp_pathname(snum),
+ p->mem_ctx, lp_servicename(talloc_tos(), snum),
+ get_current_username(), lp_pathname(talloc_tos(), snum),
p->session_info->unix_token->uid, get_current_username(),
"", remark);
}
- path = talloc_asprintf(ctx, "C:%s", lp_pathname(snum));
+ path = talloc_asprintf(ctx, "C:%s", lp_pathname(talloc_tos(), snum));
if (path) {
/*
* Change / to \\ so that win2k will see it as a valid path. This was added to
@@ -427,7 +427,7 @@ static void init_srv_share_info_502(struct pipes_struct *p,
string_replace(path, '/', '\\');
}
- sd = get_share_security(ctx, lp_servicename(snum), &sd_size);
+ sd = get_share_security(ctx, lp_servicename(talloc_tos(), snum), &sd_size);
sd_buf = make_sec_desc_buf(p->mem_ctx, sd_size, sd);
@@ -450,12 +450,12 @@ static void init_srv_share_info_1004(struct pipes_struct *p,
struct srvsvc_NetShareInfo1004 *r,
int snum)
{
- char *remark = talloc_strdup(p->mem_ctx, lp_comment(snum));
+ char *remark = lp_comment(p->mem_ctx, snum);
if (remark) {
remark = talloc_sub_advanced(
- p->mem_ctx, lp_servicename(snum),
- get_current_username(), lp_pathname(snum),
+ p->mem_ctx, lp_servicename(talloc_tos(), snum),
+ get_current_username(), lp_pathname(talloc_tos(), snum),
p->session_info->unix_token->uid, get_current_username(),
"", remark);
}
@@ -518,7 +518,7 @@ static void init_srv_share_info_1501(struct pipes_struct *p,
size_t sd_size;
TALLOC_CTX *ctx = p->mem_ctx;
- sd = get_share_security(ctx, lp_servicename(snum), &sd_size);
+ sd = get_share_security(ctx, lp_servicename(talloc_tos(), snum), &sd_size);
if (sd) {
sd_buf = make_sec_desc_buf(p->mem_ctx, sd_size, sd);
}
@@ -532,7 +532,7 @@ static void init_srv_share_info_1501(struct pipes_struct *p,
static bool is_hidden_share(int snum)
{
- const char *net_name = lp_servicename(snum);
+ const char *net_name = lp_servicename(talloc_tos(), snum);
return (net_name[strlen(net_name) - 1] == '$') ? True : False;
}
@@ -547,7 +547,8 @@ static bool is_enumeration_allowed(struct pipes_struct *p,
return true;
return share_access_check(p->session_info->security_token,
- lp_servicename(snum), FILE_READ_DATA, NULL);
+ lp_servicename(talloc_tos(), snum),
+ FILE_READ_DATA, NULL);
}
/*******************************************************************
@@ -589,12 +590,12 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
is_enumeration_allowed(p, snum) &&
(all_shares || !is_hidden_share(snum)) ) {
DEBUG(10, ("counting service %s\n",
- lp_servicename(snum) ? lp_servicename(snum) : "(null)"));
+ lp_servicename(talloc_tos(), snum) ? lp_servicename(talloc_tos(), snum) : "(null)"));
allowed[snum] = true;
num_entries++;
} else {
DEBUG(10, ("NOT counting service %s\n",
- lp_servicename(snum) ? lp_servicename(snum) : "(null)"));
+ lp_servicename(talloc_tos(), snum) ? lp_servicename(talloc_tos(), snum) : "(null)"));
}
}
@@ -1155,7 +1156,7 @@ WERROR _srvsvc_NetSrvGetInfo(struct pipes_struct *p,
info102->version_major = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION;
info102->version_minor = SAMBA_MINOR_NBT_ANNOUNCE_VERSION;
info102->server_type = lp_default_server_announce();
- info102->comment = string_truncate(lp_serverstring(),
+ info102->comment = string_truncate(lp_serverstring(talloc_tos()),
MAX_SERVER_STRING_LENGTH);
info102->users = 0xffffffff;
info102->disc = 0xf;
@@ -1181,7 +1182,7 @@ WERROR _srvsvc_NetSrvGetInfo(struct pipes_struct *p,
info101->version_major = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION;
info101->version_minor = SAMBA_MINOR_NBT_ANNOUNCE_VERSION;
info101->server_type = lp_default_server_announce();
- info101->comment = string_truncate(lp_serverstring(),
+ info101->comment = string_truncate(lp_serverstring(talloc_tos()),
MAX_SERVER_STRING_LENGTH);
r->out.info->info101 = info101;
@@ -1588,7 +1589,7 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
switch (r->in.level) {
case 1:
- pathname = talloc_strdup(ctx, lp_pathname(snum));
+ pathname = lp_pathname(ctx, snum);
comment = talloc_strdup(ctx, info->info1->comment);
type = info->info1->type;
psd = NULL;
@@ -1617,7 +1618,7 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
map_generic_share_sd_bits(psd);
break;
case 1004:
- pathname = talloc_strdup(ctx, lp_pathname(snum));
+ pathname = lp_pathname(ctx, snum);
comment = talloc_strdup(ctx, info->info1004->comment);
type = STYPE_DISKTREE;
break;
@@ -1638,8 +1639,8 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
case 1007:
return WERR_ACCESS_DENIED;
case 1501:
- pathname = talloc_strdup(ctx, lp_pathname(snum));
- comment = talloc_strdup(ctx, lp_comment(snum));
+ pathname = lp_pathname(ctx, snum);
+ comment = lp_comment(ctx, snum);
psd = info->info1501->sd;
map_generic_share_sd_bits(psd);
type = STYPE_DISKTREE;
@@ -1675,20 +1676,20 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
string_replace(comment, '"', ' ');
DEBUG(10,("_srvsvc_NetShareSetInfo: change share command = %s\n",
- lp_change_share_cmd() ? lp_change_share_cmd() : "NULL" ));
+ lp_change_share_cmd(talloc_tos()) ? lp_change_share_cmd(talloc_tos()) : "NULL" ));
/* Only call modify function if something changed. */
- if (strcmp(path, lp_pathname(snum)) || strcmp(comment, lp_comment(snum))
+ if (strcmp(path, lp_pathname(talloc_tos(), snum)) || strcmp(comment, lp_comment(talloc_tos(), snum))
|| (lp_max_connections(snum) != max_connections)) {
- if (!lp_change_share_cmd() || !*lp_change_share_cmd()) {
+ if (!lp_change_share_cmd(talloc_tos()) || !*lp_change_share_cmd(talloc_tos())) {
DEBUG(10,("_srvsvc_NetShareSetInfo: No change share command\n"));
return WERR_ACCESS_DENIED;
}
command = talloc_asprintf(p->mem_ctx,
"%s \"%s\" \"%s\" \"%s\" \"%s\" %d",
- lp_change_share_cmd(),
+ lp_change_share_cmd(talloc_tos()),
get_dyn_CONFIGFILE(),
share_name,
path,
@@ -1733,7 +1734,7 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
struct security_descriptor *old_sd;
size_t sd_size;
- old_sd = get_share_security(p->mem_ctx, lp_servicename(snum), &sd_size);
+ old_sd = get_share_security(p->mem_ctx, lp_servicename(talloc_tos(), snum), &sd_size);
if (old_sd && !security_descriptor_equal(old_sd, psd)) {
if (!set_share_security(share_name, psd))
@@ -1781,7 +1782,7 @@ WERROR _srvsvc_NetShareAdd(struct pipes_struct *p,
if (p->session_info->unix_token->uid != sec_initial_uid() && !is_disk_op )
return WERR_ACCESS_DENIED;
- if (!lp_add_share_cmd() || !*lp_add_share_cmd()) {
+ if (!lp_add_share_cmd(talloc_tos()) || !*lp_add_share_cmd(talloc_tos())) {
DEBUG(10,("_srvsvc_NetShareAdd: No add share command\n"));
return WERR_ACCESS_DENIED;
}
@@ -1877,7 +1878,7 @@ WERROR _srvsvc_NetShareAdd(struct pipes_struct *p,
command = talloc_asprintf(ctx,
"%s \"%s\" \"%s\" \"%s\" \"%s\" %d",
- lp_add_share_cmd(),
+ lp_add_share_cmd(talloc_tos()),
get_dyn_CONFIGFILE(),
share_name_in,
path,
@@ -1987,16 +1988,16 @@ WERROR _srvsvc_NetShareDel(struct pipes_struct *p,
if (p->session_info->unix_token->uid != sec_initial_uid() && !is_disk_op )
return WERR_ACCESS_DENIED;
- if (!lp_delete_share_cmd() || !*lp_delete_share_cmd()) {
+ if (!lp_delete_share_cmd(talloc_tos()) || !*lp_delete_share_cmd(talloc_tos())) {
DEBUG(10,("_srvsvc_NetShareDel: No delete share command\n"));
return WERR_ACCESS_DENIED;
}
command = talloc_asprintf(ctx,
"%s \"%s\" \"%s\"",
- lp_delete_share_cmd(),
+ lp_delete_share_cmd(talloc_tos()),
get_dyn_CONFIGFILE(),
- lp_servicename(snum));
+ lp_servicename(talloc_tos(), snum));
if (!command) {
return WERR_NOMEM;
}
@@ -2025,7 +2026,7 @@ WERROR _srvsvc_NetShareDel(struct pipes_struct *p,
return WERR_ACCESS_DENIED;
/* Delete the SD in the database. */
- delete_share_security(lp_servicename(params->service));
+ delete_share_security(lp_servicename(talloc_tos(), params->service));
lp_killservice(params->service);
@@ -2138,7 +2139,7 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p,
server_event_context(),
server_messaging_context(),
&conn,
- snum, lp_pathname(snum),
+ snum, lp_pathname(talloc_tos(), snum),
p->session_info, &oldcwd);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(10, ("create_conn_struct failed: %s\n",
@@ -2282,7 +2283,7 @@ WERROR _srvsvc_NetSetFileSecurity(struct pipes_struct *p,
server_event_context(),
server_messaging_context(),
&conn,
- snum, lp_pathname(snum),
+ snum, lp_pathname(talloc_tos(), snum),
p->session_info, &oldcwd);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(10, ("create_conn_struct failed: %s\n",
diff --git a/source3/rpc_server/winreg/srv_winreg_nt.c b/source3/rpc_server/winreg/srv_winreg_nt.c
index 176848b0d6..38040d4e51 100644
--- a/source3/rpc_server/winreg/srv_winreg_nt.c
+++ b/source3/rpc_server/winreg/srv_winreg_nt.c
@@ -528,7 +528,7 @@ WERROR _winreg_InitiateSystemShutdownEx(struct pipes_struct *p,
int ret = -1;
bool can_shutdown = false;
- shutdown_script = talloc_strdup(p->mem_ctx, lp_shutdown_script());
+ shutdown_script = lp_shutdown_script(p->mem_ctx);
if (!shutdown_script) {
return WERR_NOMEM;
}
@@ -610,7 +610,7 @@ WERROR _winreg_InitiateSystemShutdownEx(struct pipes_struct *p,
WERROR _winreg_AbortSystemShutdown(struct pipes_struct *p,
struct winreg_AbortSystemShutdown *r)
{
- const char *abort_shutdown_script = lp_abort_shutdown_script();
+ const char *abort_shutdown_script = lp_abort_shutdown_script(talloc_tos());
int ret = -1;
bool can_shutdown = false;
@@ -661,7 +661,7 @@ static int validate_reg_filename(TALLOC_CTX *ctx, char **pp_fname )
continue;
}
- share_path = lp_pathname(snum);
+ share_path = lp_pathname(talloc_tos(), snum);
/* make sure we have a path (e.g. [homes] ) */
if (strlen(share_path) == 0) {
@@ -712,7 +712,7 @@ WERROR _winreg_RestoreKey(struct pipes_struct *p,
}
DEBUG(2,("_winreg_RestoreKey: Restoring [%s] from %s in share %s\n",
- regkey->key->name, fname, lp_servicename(snum) ));
+ regkey->key->name, fname, lp_servicename(talloc_tos(), snum) ));
return reg_restorekey(regkey, fname);
}
@@ -746,7 +746,7 @@ WERROR _winreg_SaveKey(struct pipes_struct *p,
return WERR_OBJECT_PATH_INVALID;
DEBUG(2,("_winreg_SaveKey: Saving [%s] to %s in share %s\n",
- regkey->key->name, fname, lp_servicename(snum) ));
+ regkey->key->name, fname, lp_servicename(talloc_tos(), snum) ));
return reg_savekey(regkey, fname);
}