[Samba] start of print file spool to samba

Floyd Shackelford floyds at 4peakstech.com
Wed Apr 3 15:14:28 GMT 2002

i am trying to modify samba so that i get control when a print job starts to
spool to samba. i made the following changes to the printing.c file (my
changes are in between the "start change" and "end change" comments):

... snip ...

start spooling a job - return the jobid
int print_job_start(struct current_user *user, int snum, char *jobname)
        int jobid;
        char *path;
        struct printjob pjob;
        int next_jobid;
        user_struct *vuser;

// start change
        char myCommand[1024];
// end change

        errno = 0;

        if (!print_access_check(user, snum, PRINTER_ACCESS_USE)) {
                DEBUG(3, ("print_job_start: job start denied by security
                return -1;

... snip ...

         * If the printer is marked as postscript output a leading
         * file identifier to ensure the file is treated as a raw
         * postscript file.
         * This has a similar effect as CtrlD=0 in WIN.INI file.
         * tim at fsg.com 09/06/94
        if (lp_postscript(snum)) {
                print_job_write(jobid, "%!\n",3);

// start change
slprintf (
  "/usr/local/bin/JobStart.sh %s",
  user->conn->client_address );

// end change

        return jobid;

        if (jobid != -1) {
                tdb_delete(tdb, print_key(jobid));

... snip ...

The problem is that JobStart.sh gets called about 5 times with every job.
Obviously, i have my code in the wrong place. Can anyone suggest a better
place to put it?


Floyd Shackelford
4 Peaks Technology Group, Inc.
VOICE: 334.735.9428
FAX:   916.404.7125
EMAIL: FloydS at 4PeaksTech.com
acta non verba
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.342 / Virus Database: 189 - Release Date: 3/14/2002

More information about the samba mailing list