From f434139087ea45ed1eb578267843943b0f04c94c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 31 Aug 1997 02:18:59 +0000 Subject: fixed a bug in the printjob encoding/decoding. We weren't doing it for the print_ functions in reply.c, with the effect that you couldn't cancel print jobs from smbclient or from older dos clients. we now use a couple of utility functions printjob_encode() and printjob_decode() rather than sticking the bitops inline in each place. also fixed a bunch of places that used foo%0xFF rather than foo&0xFF Note that this isn't really me doing the commit, it can't be as I'm working on my thesis ... (This used to be commit 3556763be3acbf01c967ee9717943dd44163fb9f) --- source3/printing/printing.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/printing.c b/source3/printing/printing.c index c4dd9803eb..c83d216989 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -929,8 +929,8 @@ int get_printqueue(int snum,int cnum,print_queue_struct **queue, if (!printername || !*printername) { - DEBUG(6,("replacing printer name with service (snum=(%s,%d))\n", - lp_servicename(snum),snum)); + DEBUG(6,("xx replacing printer name with service (snum=(%s,%d))\n", + lp_servicename(snum),snum)); printername = lp_servicename(snum); } @@ -1080,3 +1080,23 @@ void status_printjob(int cnum,int snum,int jobid,int status) } + +/**************************************************************************** +we encode print job numbers over the wire so that when we get them back we can +tell not only what print job they are but also what service it belongs to, +this is to overcome the problem that windows clients tend to send the wrong +service number when doing print queue manipulation! +****************************************************************************/ +int printjob_encode(int snum, int job) +{ + return ((snum&0xFF)<<8) | (job & 0xFF); +} + +/**************************************************************************** +and now decode them again ... +****************************************************************************/ +void printjob_decode(int jobid, int *snum, int *job) +{ + (*snum) = (jobid >> 8) & 0xFF; + (*job) = jobid & 0xFF; +} -- cgit