s3: rename talloc_sub_advanced() to talloc_sub_full()
[samba.git] / source3 / printing / print_generic.c
index 8f557376d76f103c358c8a6c0ea840636f812cb3..9c47d3ff7a51f4f587b6edfc9ef85c53a8af42b4 100644 (file)
@@ -19,8 +19,8 @@
 
 #include "includes.h"
 #include "printing.h"
+#include "smbd/proto.h"
 
-extern struct current_user current_user;
 extern userdom_struct current_user_info;
 
 /****************************************************************************
@@ -72,11 +72,11 @@ 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),
+               syscmd = talloc_sub_full(ctx,
+                               lp_servicename(talloc_tos(), snum),
                                current_user_info.unix_name,
                                "",
-                               current_user.ut.gid,
+                               get_current_gid(NULL),
                                get_current_username(),
                                current_user_info.domain,
                                syscmd);
@@ -85,7 +85,7 @@ static int print_run_command(int snum, const char* printername, bool do_sub,
                }
        }
 
-       ret = smbrun_no_sanitize(syscmd,outfd);
+       ret = smbrun_no_sanitize(syscmd, outfd, NULL);
 
        DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
 
@@ -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_lppause_command(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_lpresume_command(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_print_command(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++) {
@@ -288,7 +288,7 @@ static int generic_job_submit(int snum, struct printjob *pjob,
                ret = 0;
        }
        if (pjob->sysjob == -1) {
-               DEBUG(0, ("failed to get sysjob for job %u (%s), tracking as "
+               DEBUG(2, ("failed to get sysjob for job %u (%s), tracking as "
                          "Unix job\n", pjob->jobid, jobname));
        }
 
@@ -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_queuepause_command(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_queueresume_command(talloc_tos(), snum), NULL, NULL);
 }
 
 /****************************************************************************