summaryrefslogtreecommitdiff
path: root/source/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
commit3556763be3acbf01c967ee9717943dd44163fb9f (patch)
treee4e60be60413ee1c43ea6044cc799d5b8af33967 /source/printing
parent550e98f2d49a101654b3abde278a7f7edf347ed8 (diff)
downloadsamba-3556763be3acbf01c967ee9717943dd44163fb9f.tar.gz
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 ...
Diffstat (limited to 'source/printing')
-rw-r--r--source/printing/printing.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/source/printing/printing.c b/source/printing/printing.c
index c4dd9803ebe..c83d2169891 100644
--- a/source/printing/printing.c
+++ b/source/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;
+}