summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-08-31 02:18:59 +0000
committerAndrew Tridgell <tridge@samba.org>1997-08-31 02:18:59 +0000
commitf434139087ea45ed1eb578267843943b0f04c94c (patch)
tree573b9db9136913863364f057c7fe66c84fc7bd6d /source3/printing
parent06dc98f220dba6d602010df235679c6584cba279 (diff)
downloadsamba-f434139087ea45ed1eb578267843943b0f04c94c.tar.gz
samba-f434139087ea45ed1eb578267843943b0f04c94c.tar.bz2
samba-f434139087ea45ed1eb578267843943b0f04c94c.zip
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)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/printing.c24
1 files changed, 22 insertions, 2 deletions
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;
+}