[Samba] start of print file spool to samba

Floyd Shackelford floyds at 4peakstech.com
Wed Apr 24 17:43:02 GMT 2002


i found the following two files with the string "print command":

./param/loadparm.c: {"print command", P_STRING, P_LOCAL,
&sDefault.szPrintcommand, NULL, NULL, FLAG_PRINT | FLAG_GLOBAL},

./printing/print_generic.c: run a given print command


as best as i can tell, it's NOT loadparm.c. so that leaves print_generic.c

it looks like this routine is the place? see my comments in the routine
body.

/***************************************************************************
*
run a given print command
a null terminated list of value/substitute pairs is provided
for local substitution strings
****************************************************************************
/
static int print_run_command(int snum,char *command, int *outfd, ...)
{

        pstring syscmd;
        char *p, *arg;
        int ret;
        va_list ap;
        va_start(ap, outfd);

        if (!command || !*command) return -1;

        if (!VALID_SNUM(snum)) {
                DEBUG(0,("Invalid snum %d for command %s\n", snum,
command));
                return -1;
        }

        pstrcpy(syscmd, command);

        while ((arg = va_arg(ap, char *))) {
                char *value = va_arg(ap,char *);
                pstring_sub(syscmd, arg, value);
        }
        va_end(ap);

        p = PRINTERNAME(snum);

        pstring_sub(syscmd, "%p", p);

        standard_sub_snum(snum,syscmd);

        /* Convert script args to unix-codepage */
        dos_to_unix(syscmd, True);

/*
fws:

this appears to be right before the command gets run. so i would add
something like:

        if (strcmp(syscmd,"print command") == 0)
        {
          // do my thing
        }
*/
        ret = smbrun(syscmd,outfd);

        DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));

        return ret;
}


does this look right to you?

now the problem is: i need the ip address of the client that submitted the
print job. how do i get that?


Regards,

Floyd Shackelford
4 Peaks Technology Group, Inc. <http://www.4peakstech.com/>
VOICE: 334.735.9428
FAX:   916.404.7125
EMAIL: FloydS at 4PeaksTech.com <mailto:FloydS at 4PeaksTech.com>

acta non verba



-----Original Message-----
From: Gerald Carter [mailto:jerry at samba.org]
Sent: Wednesday, April 24, 2002 4:34 PM
To: Floyd Shackelford
Cc: samba at lists.samba.org
Subject: Re: [Samba] start of print file spool to samba


On Wed, 3 Apr 2002, Floyd Shackelford wrote:

> 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?

Look for where we execute the "print command".





cheers, jerry
 ---------------------------------------------------------------------
 Hewlett-Packard                                     http://www.hp.com
 SAMBA Team                                       http://www.samba.org
 --                                            http://www.plainjoe.org
 "Sam's Teach Yourself Samba in 24 Hours" 2ed.      ISBN 0-672-32269-2
 --"I never saved anything for the swim back." Ethan Hawk in Gattaca--

---
Incoming 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

---
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