From 81ae199bb72886f2f1ed87b22b4c75b6b99c72f6 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Thu, 31 Oct 2019 12:44:45 +0100 Subject: s3: replace standard_sub_advanced with talloc_sub_advanced in one place BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745 Signed-off-by: Ralph Boehme Reviewed-by: Andreas Schneider --- source3/printing/printing.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source3/printing/printing.c') diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 42036a56bb5..0ad07046850 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -2819,7 +2819,7 @@ WERROR print_job_start(const struct auth_session_info *server_info, struct spoolss_DeviceMode *devmode, uint32_t *_jobid) { uint32_t jobid; - char *path; + char *path = NULL, *userstr = NULL; struct printjob pjob; const char *sharename = lp_const_servicename(snum); struct tdb_print_db *pdb = get_print_db_byname(sharename); @@ -2866,13 +2866,19 @@ WERROR print_job_start(const struct auth_session_info *server_info, fstrcpy(pjob.clientmachine, clientmachine); - fstrcpy(pjob.user, lp_printjob_username(snum)); - standard_sub_advanced(sharename, + userstr = talloc_sub_advanced(talloc_tos(), + sharename, server_info->unix_info->sanitized_username, path, server_info->unix_token->gid, server_info->unix_info->sanitized_username, server_info->info->domain_name, - pjob.user, sizeof(pjob.user)); + lp_printjob_username(snum)); + if (userstr == NULL) { + werr = WERR_NOT_ENOUGH_MEMORY; + goto fail; + } + strlcpy(pjob.user, userstr, sizeof(pjob.user)); + TALLOC_FREE(userstr); fstrcpy(pjob.queuename, lp_const_servicename(snum)); -- cgit v1.2.1