diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-07-18 15:07:23 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-07-18 15:07:23 +0930 |
commit | fe72740e8221575921c22030d6d4fcb19201b03b (patch) | |
tree | 0b1bb254e23d6541eede8f2ff4494af477fd5566 /source3/printing | |
parent | c809eec53fb1d2a36909e4934dff349f91e3359e (diff) | |
download | samba-fe72740e8221575921c22030d6d4fcb19201b03b.tar.gz samba-fe72740e8221575921c22030d6d4fcb19201b03b.tar.bz2 samba-fe72740e8221575921c22030d6d4fcb19201b03b.zip |
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 <rusty@rustcorp.com.au>
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/load.c | 2 | ||||
-rw-r--r-- | source3/printing/notify.c | 16 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 10 | ||||
-rw-r--r-- | source3/printing/nt_printing_ads.c | 2 | ||||
-rw-r--r-- | source3/printing/nt_printing_os2.c | 2 | ||||
-rw-r--r-- | source3/printing/print_cups.c | 28 | ||||
-rw-r--r-- | source3/printing/print_generic.c | 26 | ||||
-rw-r--r-- | source3/printing/print_iprint.c | 24 | ||||
-rw-r--r-- | source3/printing/printing.c | 38 | ||||
-rw-r--r-- | source3/printing/printspoolss.c | 5 | ||||
-rw-r--r-- | source3/printing/spoolssd.c | 12 |
11 files changed, 86 insertions, 79 deletions
diff --git a/source3/printing/load.c b/source3/printing/load.c index af4dcc7a2b..136d055088 100644 --- a/source3/printing/load.c +++ b/source3/printing/load.c @@ -40,7 +40,7 @@ static void add_auto_printers(void) if (pnum < 0) return; - auto_serv = lp_auto_services(); + auto_serv = lp_auto_services(talloc_tos()); str = SMB_STRDUP(auto_serv); TALLOC_FREE(auto_serv); if (str == NULL) { diff --git a/source3/printing/notify.c b/source3/printing/notify.c index b6b7ea045e..4040a2bab4 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -423,7 +423,7 @@ void notify_printer_status(struct tevent_context *ev, struct messaging_context *msg_ctx, int snum, uint32 status) { - const char *sharename = lp_servicename(snum); + const char *sharename = lp_servicename(talloc_tos(), snum); if (sharename) notify_printer_status_byname(ev, msg_ctx, sharename, status); @@ -511,7 +511,7 @@ void notify_printer_driver(struct tevent_context *ev, struct messaging_context *msg_ctx, int snum, const char *driver_name) { - const char *sharename = lp_servicename(snum); + const char *sharename = lp_servicename(talloc_tos(), snum); send_notify_field_buffer( ev, msg_ctx, @@ -523,7 +523,7 @@ void notify_printer_comment(struct tevent_context *ev, struct messaging_context *msg_ctx, int snum, const char *comment) { - const char *sharename = lp_servicename(snum); + const char *sharename = lp_servicename(talloc_tos(), snum); send_notify_field_buffer( ev, msg_ctx, @@ -535,7 +535,7 @@ void notify_printer_sharename(struct tevent_context *ev, struct messaging_context *msg_ctx, int snum, const char *share_name) { - const char *sharename = lp_servicename(snum); + const char *sharename = lp_servicename(talloc_tos(), snum); send_notify_field_buffer( ev, msg_ctx, @@ -547,7 +547,7 @@ void notify_printer_printername(struct tevent_context *ev, struct messaging_context *msg_ctx, int snum, const char *printername) { - const char *sharename = lp_servicename(snum); + const char *sharename = lp_servicename(talloc_tos(), snum); send_notify_field_buffer( ev, msg_ctx, @@ -559,7 +559,7 @@ void notify_printer_port(struct tevent_context *ev, struct messaging_context *msg_ctx, int snum, const char *port_name) { - const char *sharename = lp_servicename(snum); + const char *sharename = lp_servicename(talloc_tos(), snum); send_notify_field_buffer( ev, msg_ctx, @@ -571,7 +571,7 @@ void notify_printer_location(struct tevent_context *ev, struct messaging_context *msg_ctx, int snum, const char *location) { - const char *sharename = lp_servicename(snum); + const char *sharename = lp_servicename(talloc_tos(), snum); send_notify_field_buffer( ev, msg_ctx, @@ -583,7 +583,7 @@ void notify_printer_sepfile(struct tevent_context *ev, struct messaging_context *msg_ctx, int snum, const char *sepfile) { - const char *sharename = lp_servicename(snum); + const char *sharename = lp_servicename(talloc_tos(), snum); send_notify_field_buffer( ev, msg_ctx, diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index b821d28326..5050a5d0dc 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -621,7 +621,7 @@ static uint32 get_correct_cversion(struct auth_session_info *session_info, server_messaging_context(), &conn, printdollar_snum, - lp_pathname(printdollar_snum), + lp_pathname(talloc_tos(), printdollar_snum), session_info, &oldcwd); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0,("get_correct_cversion: create_conn_struct " @@ -1008,7 +1008,7 @@ WERROR move_driver_to_download_area(struct auth_session_info *session_info, server_messaging_context(), &conn, printdollar_snum, - lp_pathname(printdollar_snum), + lp_pathname(talloc_tos(), printdollar_snum), session_info, &oldcwd); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0,("move_driver_to_download_area: create_conn_struct " @@ -1206,7 +1206,7 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx, } result = winreg_get_printer(mem_ctx, b, - lp_servicename(snum), + lp_servicename(talloc_tos(), snum), &pinfo2); if (!W_ERROR_IS_OK(result)) { continue; /* skip */ @@ -1544,7 +1544,7 @@ bool delete_driver_files(const struct auth_session_info *session_info, server_messaging_context(), &conn, printdollar_snum, - lp_pathname(printdollar_snum), + lp_pathname(talloc_tos(), printdollar_snum), session_info, &oldcwd); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0,("delete_driver_files: create_conn_struct " @@ -1728,7 +1728,7 @@ bool print_access_check(const struct auth_session_info *session_info, /* Get printer name */ - pname = lp_printername(snum); + pname = lp_printername(talloc_tos(), snum); if (!pname || !*pname) { errno = EACCES; diff --git a/source3/printing/nt_printing_ads.c b/source3/printing/nt_printing_ads.c index 3551148565..87cab63ceb 100644 --- a/source3/printing/nt_printing_ads.c +++ b/source3/printing/nt_printing_ads.c @@ -366,7 +366,7 @@ WERROR check_published_printers(struct messaging_context *msg_ctx) } result = winreg_get_printer_internal(tmp_ctx, session_info, msg_ctx, - lp_servicename(snum), + lp_servicename(talloc_tos(), snum), &pinfo2); if (!W_ERROR_IS_OK(result)) { continue; diff --git a/source3/printing/nt_printing_os2.c b/source3/printing/nt_printing_os2.c index 80c02ebc1a..de76d72940 100644 --- a/source3/printing/nt_printing_os2.c +++ b/source3/printing/nt_printing_os2.c @@ -73,7 +73,7 @@ static bool set_driver_mapping(const char *from, const char *to) */ WERROR spoolss_map_to_os2_driver(TALLOC_CTX *mem_ctx, const char **pdrivername) { - const char *mapfile = lp_os2_driver_map(); + const char *mapfile = lp_os2_driver_map(talloc_tos()); char **lines = NULL; const char *drivername; int numlines = 0; diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index b5c7b0d4ec..d6903bc3ff 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -66,8 +66,8 @@ static http_t *cups_connect(TALLOC_CTX *frame) int timeout = lp_cups_connection_timeout(); size_t size; - if (lp_cups_server() != NULL && strlen(lp_cups_server()) > 0) { - if (!push_utf8_talloc(frame, &server, lp_cups_server(), &size)) { + if (lp_cups_server(talloc_tos()) != NULL && strlen(lp_cups_server(talloc_tos())) > 0) { + if (!push_utf8_talloc(frame, &server, lp_cups_server(talloc_tos()), &size)) { return NULL; } } else { @@ -914,7 +914,8 @@ static int cups_job_submit(int snum, struct printjob *pjob, ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, language->language); - if (!push_utf8_talloc(frame, &printername, lp_printername(snum), + if (!push_utf8_talloc(frame, &printername, + lp_printername(talloc_tos(), snum), &size)) { goto out; } @@ -951,7 +952,8 @@ static int cups_job_submit(int snum, struct printjob *pjob, * add any options defined in smb.conf */ - if (!push_utf8_talloc(frame, &cupsoptions, lp_cups_options(snum), &size)) { + if (!push_utf8_talloc(frame, &cupsoptions, + lp_cups_options(talloc_tos(), snum), &size)) { goto out; } num_options = 0; @@ -973,7 +975,7 @@ static int cups_job_submit(int snum, struct printjob *pjob, if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) { if (response->request.status.status_code >= IPP_OK_CONFLICT) { DEBUG(0,("Unable to print file to %s - %s\n", - lp_printername(snum), + lp_printername(talloc_tos(), snum), ippErrorString(cupsLastError()))); } else { ret = 0; @@ -987,7 +989,7 @@ static int cups_job_submit(int snum, struct printjob *pjob, } } else { DEBUG(0,("Unable to print file to `%s' - %s\n", - lp_printername(snum), + lp_printername(talloc_tos(), snum), ippErrorString(cupsLastError()))); } @@ -1412,8 +1414,8 @@ static int cups_queue_pause(int snum) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, language->language); - if (!push_utf8_talloc(frame, &printername, lp_printername(snum), - &size)) { + if (!push_utf8_talloc(frame, &printername, + lp_printername(talloc_tos(), snum), &size)) { goto out; } slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s", @@ -1434,14 +1436,14 @@ static int cups_queue_pause(int snum) if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) { if (response->request.status.status_code >= IPP_OK_CONFLICT) { DEBUG(0,("Unable to pause printer %s - %s\n", - lp_printername(snum), + lp_printername(talloc_tos(), snum), ippErrorString(cupsLastError()))); } else { ret = 0; } } else { DEBUG(0,("Unable to pause printer %s - %s\n", - lp_printername(snum), + lp_printername(talloc_tos(), snum), ippErrorString(cupsLastError()))); } @@ -1516,7 +1518,7 @@ static int cups_queue_resume(int snum) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, language->language); - if (!push_utf8_talloc(frame, &printername, lp_printername(snum), + if (!push_utf8_talloc(frame, &printername, lp_printername(talloc_tos(), snum), &size)) { goto out; } @@ -1538,14 +1540,14 @@ static int cups_queue_resume(int snum) if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) { if (response->request.status.status_code >= IPP_OK_CONFLICT) { DEBUG(0,("Unable to resume printer %s - %s\n", - lp_printername(snum), + lp_printername(talloc_tos(), snum), ippErrorString(cupsLastError()))); } else { ret = 0; } } else { DEBUG(0,("Unable to resume printer %s - %s\n", - lp_printername(snum), + lp_printername(talloc_tos(), snum), ippErrorString(cupsLastError()))); } diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c index 8f557376d7..efe910d7b4 100644 --- a/source3/printing/print_generic.c +++ b/source3/printing/print_generic.c @@ -73,7 +73,7 @@ static int print_run_command(int snum, const char* printername, bool do_sub, if (do_sub && snum != -1) { syscmd = talloc_sub_advanced(ctx, - lp_servicename(snum), + lp_servicename(talloc_tos(), snum), current_user_info.unix_name, "", current_user.ut.gid, @@ -117,8 +117,8 @@ static int generic_job_pause(int snum, struct printjob *pjob) /* need to pause the spooled entry */ slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob); - return print_run_command(snum, lp_printername(snum), True, - lp_lppausecommand(snum), NULL, + return print_run_command(snum, lp_printername(talloc_tos(), snum), True, + lp_lppausecommand(talloc_tos(), snum), NULL, "%j", jobstr, NULL); } @@ -132,8 +132,8 @@ static int generic_job_resume(int snum, struct printjob *pjob) /* need to pause the spooled entry */ slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob); - return print_run_command(snum, lp_printername(snum), True, - lp_lpresumecommand(snum), NULL, + return print_run_command(snum, lp_printername(talloc_tos(), snum), True, + lp_lpresumecommand(talloc_tos(), snum), NULL, "%j", jobstr, NULL); } @@ -254,8 +254,8 @@ static int generic_job_submit(int snum, struct printjob *pjob, slprintf(job_size, sizeof(job_size)-1, "%lu", (unsigned long)pjob->size); /* send it to the system spooler */ - ret = print_run_command(snum, lp_printername(snum), True, - lp_printcommand(snum), NULL, + ret = print_run_command(snum, lp_printername(talloc_tos(), snum), True, + lp_printcommand(talloc_tos(), snum), NULL, "%s", p, "%J", jobname, "%f", p, @@ -272,8 +272,8 @@ static int generic_job_submit(int snum, struct printjob *pjob, * determine the backend job identifier (sysjob). */ pjob->sysjob = -1; - ret = generic_queue_get(lp_printername(snum), printing_type, lpq_cmd, - &q, &status); + ret = generic_queue_get(lp_printername(talloc_tos(), snum), + printing_type, lpq_cmd, &q, &status); if (ret > 0) { int i; for (i = 0; i < ret; i++) { @@ -307,8 +307,8 @@ static int generic_job_submit(int snum, struct printjob *pjob, ****************************************************************************/ static int generic_queue_pause(int snum) { - return print_run_command(snum, lp_printername(snum), True, - lp_queuepausecommand(snum), NULL, NULL); + return print_run_command(snum, lp_printername(talloc_tos(), snum), True, + lp_queuepausecommand(talloc_tos(), snum), NULL, NULL); } /**************************************************************************** @@ -316,8 +316,8 @@ static int generic_queue_pause(int snum) ****************************************************************************/ static int generic_queue_resume(int snum) { - return print_run_command(snum, lp_printername(snum), True, - lp_queueresumecommand(snum), NULL, NULL); + return print_run_command(snum, lp_printername(talloc_tos(), snum), True, + lp_queueresumecommand(talloc_tos(), snum), NULL, NULL); } /**************************************************************************** diff --git a/source3/printing/print_iprint.c b/source3/printing/print_iprint.c index ea0c93778b..62073ddf89 100644 --- a/source3/printing/print_iprint.c +++ b/source3/printing/print_iprint.c @@ -50,10 +50,12 @@ iprint_passwd_cb(const char *prompt) /* I - Prompt */ static const char *iprint_server(void) { - if ((lp_iprint_server() != NULL) && (strlen(lp_iprint_server()) > 0)) { + const char *server = lp_iprint_server(talloc_tos()); + + if ((lp_iprint_server(server) != NULL) && (strlen(server) > 0)) { DEBUG(10, ("iprint server explicitly set to %s\n", - lp_iprint_server())); - return lp_iprint_server(); + server)); + return server; } DEBUG(10, ("iprint server left to default %s\n", cupsServer())); @@ -576,7 +578,7 @@ static int iprint_job_pause(int snum, struct printjob *pjob) "attributes-natural-language", NULL, language->language); slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(), - lp_printername(snum)); + lp_printername(talloc_tos(), snum)); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -590,7 +592,7 @@ static int iprint_job_pause(int snum, struct printjob *pjob) */ slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s", - lp_printername(snum)); + lp_printername(talloc_tos(), snum)); if ((response = cupsDoRequest(http, request, httpPath)) != NULL) { if (response->request.status.status_code >= IPP_OK_CONFLICT) { @@ -676,7 +678,7 @@ static int iprint_job_resume(int snum, struct printjob *pjob) "attributes-natural-language", NULL, language->language); slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(), - lp_printername(snum)); + lp_printername(talloc_tos(), snum)); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -690,7 +692,7 @@ static int iprint_job_resume(int snum, struct printjob *pjob) */ slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s", - lp_printername(snum)); + lp_printername(talloc_tos(), snum)); if ((response = cupsDoRequest(http, request, httpPath)) != NULL) { if (response->request.status.status_code >= IPP_OK_CONFLICT) { @@ -777,7 +779,7 @@ static int iprint_job_submit(int snum, struct printjob *pjob, "attributes-natural-language", NULL, language->language); slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(), - lp_printername(snum)); + lp_printername(talloc_tos(), snum)); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -796,19 +798,19 @@ static int iprint_job_submit(int snum, struct printjob *pjob, * Do the request and get back a response... */ - slprintf(uri, sizeof(uri) - 1, "/ipp/%s", lp_printername(snum)); + slprintf(uri, sizeof(uri) - 1, "/ipp/%s", lp_printername(talloc_tos(), snum)); if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) { if (response->request.status.status_code >= IPP_OK_CONFLICT) { DEBUG(0,("Unable to print file to %s - %s\n", - lp_printername(snum), + lp_printername(talloc_tos(), snum), ippErrorString(cupsLastError()))); } else { ret = 0; } } else { DEBUG(0,("Unable to print file to `%s' - %s\n", - lp_printername(snum), + lp_printername(talloc_tos(), snum), ippErrorString(cupsLastError()))); } diff --git a/source3/printing/printing.c b/source3/printing/printing.c index b473c9492f..9a7b110925 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1660,15 +1660,15 @@ static void print_queue_update(struct messaging_context *msg_ctx, /* don't strip out characters like '$' from the printername */ lpqcommand = talloc_string_sub2(ctx, - lp_lpqcommand(snum), + lp_lpqcommand(talloc_tos(), snum), "%p", - lp_printername(snum), + lp_printername(talloc_tos(), snum), false, false, false); if (!lpqcommand) { return; } lpqcommand = talloc_sub_advanced(ctx, - lp_servicename(snum), + lp_servicename(talloc_tos(), snum), current_user_info.unix_name, "", current_user.ut.gid, @@ -1680,15 +1680,15 @@ static void print_queue_update(struct messaging_context *msg_ctx, } lprmcommand = talloc_string_sub2(ctx, - lp_lprmcommand(snum), + lp_lprmcommand(talloc_tos(), snum), "%p", - lp_printername(snum), + lp_printername(talloc_tos(), snum), false, false, false); if (!lprmcommand) { return; } lprmcommand = talloc_sub_advanced(ctx, - lp_servicename(snum), + lp_servicename(talloc_tos(), snum), current_user_info.unix_name, "", current_user.ut.gid, @@ -2141,8 +2141,8 @@ static bool print_job_delete1(struct tevent_context *ev, if (pjob->spooled && pjob->sysjob != -1) { result = (*(current_printif->job_delete))( - lp_printername(snum), - lp_lprmcommand(snum), + lp_printername(talloc_tos(), snum), + lp_lprmcommand(talloc_tos(), snum), pjob); /* Delete the tdb entry if the delete succeeded or the job hasn't @@ -2230,7 +2230,7 @@ WERROR print_job_delete(const struct auth_session_info *server_info, "Permission denied-- user not allowed to delete, \ pause, or resume print job. User name: %s. Printer name: %s.", uidtoname(server_info->unix_token->uid), - lp_printername(snum) ); + lp_printername(talloc_tos(), snum) ); /* END_ADMIN_LOG */ werr = WERR_ACCESS_DENIED; @@ -2320,7 +2320,7 @@ WERROR print_job_pause(const struct auth_session_info *server_info, "Permission denied-- user not allowed to delete, \ pause, or resume print job. User name: %s. Printer name: %s.", uidtoname(server_info->unix_token->uid), - lp_printername(snum) ); + lp_printername(talloc_tos(), snum) ); /* END_ADMIN_LOG */ werr = WERR_ACCESS_DENIED; @@ -2392,7 +2392,7 @@ WERROR print_job_resume(const struct auth_session_info *server_info, "Permission denied-- user not allowed to delete, \ pause, or resume print job. User name: %s. Printer name: %s.", uidtoname(server_info->unix_token->uid), - lp_printername(snum) ); + lp_printername(talloc_tos(), snum) ); /* END_ADMIN_LOG */ werr = WERR_ACCESS_DENIED; goto err_out; @@ -2665,7 +2665,7 @@ static WERROR print_job_checks(const struct auth_session_info *server_info, /* see if we have sufficient disk space */ if (lp_minprintspace(snum)) { minspace = lp_minprintspace(snum); - ret = sys_fsusage(lp_pathname(snum), &dspace, &dsize); + ret = sys_fsusage(lp_pathname(talloc_tos(), snum), &dspace, &dsize); if (ret == 0 && dspace < 2*minspace) { DEBUG(3, ("print_job_checks: " "disk space check failed.\n")); @@ -2710,7 +2710,7 @@ static WERROR print_job_spool_file(int snum, uint32_t jobid, * Verify that the file name is ok, within path, and it is * already already there */ if (output_file) { - path = lp_pathname(snum); + path = lp_pathname(talloc_tos(), snum); len = strlen(path); if (strncmp(output_file, path, len) == 0 && (output_file[len - 1] == '/' || output_file[len] == '/')) { @@ -2739,7 +2739,7 @@ static WERROR print_job_spool_file(int snum, uint32_t jobid, } slprintf(pjob->filename, sizeof(pjob->filename)-1, - "%s/%s%.8u.XXXXXX", lp_pathname(snum), + "%s/%s%.8u.XXXXXX", lp_pathname(talloc_tos(), snum), PRINT_SPOOL_PREFIX, (unsigned int)jobid); pjob->fd = mkstemp(pjob->filename); @@ -2784,7 +2784,7 @@ WERROR print_job_start(const struct auth_session_info *server_info, return WERR_INTERNAL_DB_CORRUPTION; } - path = lp_pathname(snum); + path = lp_pathname(talloc_tos(), snum); werr = print_job_checks(server_info, msg_ctx, snum, &njobs); if (!W_ERROR_IS_OK(werr)) { @@ -2974,16 +2974,16 @@ NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum, /* don't strip out characters like '$' from the printername */ lpq_cmd = talloc_string_sub2(tmp_ctx, - lp_lpqcommand(snum), + lp_lpqcommand(talloc_tos(), snum), "%p", - lp_printername(snum), + lp_printername(talloc_tos(), snum), false, false, false); if (lpq_cmd == NULL) { status = NT_STATUS_PRINT_CANCELLED; goto fail; } lpq_cmd = talloc_sub_advanced(tmp_ctx, - lp_servicename(snum), + lp_servicename(talloc_tos(), snum), current_user_info.unix_name, "", current_user.ut.gid, @@ -3044,7 +3044,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx, uint32 i; int max_reported_jobs = lp_max_reported_jobs(snum); bool ret = False; - const char* sharename = lp_servicename(snum); + const char* sharename = lp_servicename(talloc_tos(), snum); TALLOC_CTX *tmp_ctx = talloc_new(msg_ctx); if (tmp_ctx == NULL) { return false; diff --git a/source3/printing/printspoolss.c b/source3/printing/printspoolss.c index b94314e420..8a38a7fe7a 100644 --- a/source3/printing/printspoolss.c +++ b/source3/printing/printspoolss.c @@ -78,7 +78,7 @@ NTSTATUS print_spool_open(files_struct *fsp, status = NT_STATUS_NO_MEMORY; goto done; } - pf->svcname = talloc_strdup(pf, lp_servicename(SNUM(fsp->conn))); + pf->svcname = lp_servicename(pf, SNUM(fsp->conn)); /* the document name is derived from the file name. * "Remote Downlevel Document" is added in front to @@ -118,7 +118,8 @@ NTSTATUS print_spool_open(files_struct *fsp, */ pf->filename = talloc_asprintf(pf, "%s/%sXXXXXX", - lp_pathname(SNUM(fsp->conn)), + lp_pathname(talloc_tos(), + SNUM(fsp->conn)), PRINT_SPOOL_PREFIX); if (!pf->filename) { status = NT_STATUS_NO_MEMORY; diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c index f4bba76bc7..bb043bdba7 100644 --- a/source3/printing/spoolssd.c +++ b/source3/printing/spoolssd.c @@ -58,7 +58,7 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx, static void spoolss_reopen_logs(int child_id) { - char *lfile = lp_logfile(); + char *lfile = lp_logfile(talloc_tos()); char *ext; int rc; @@ -80,10 +80,12 @@ static void spoolss_reopen_logs(int child_id) if (strstr(lfile, ext) == NULL) { if (child_id) { rc = asprintf(&lfile, "%s.%d", - lp_logfile(), child_id); + lp_logfile(talloc_tos()), + child_id); } else { rc = asprintf(&lfile, "%s.%s", - lp_logfile(), ext); + lp_logfile(talloc_tos()), + ext); } } } @@ -607,14 +609,14 @@ static void print_queue_forward(struct messaging_context *msg, static char *get_bq_logfile(void) { - char *lfile = lp_logfile(); + char *lfile = lp_logfile(talloc_tos()); int rc; if (lfile == NULL || lfile[0] == '\0') { rc = asprintf(&lfile, "%s/log.%s.bq", get_dyn_LOGFILEBASE(), DAEMON_NAME); } else { - rc = asprintf(&lfile, "%s.bq", lp_logfile()); + rc = asprintf(&lfile, "%s.bq", lp_logfile(talloc_tos())); } if (rc == -1) { lfile = NULL; |