summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-04-26 14:14:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:42 -0500
commitfd237d99031d2903e62364fbafcff2b57636a9f6 (patch)
tree2fa35e97f25fb39f37baa83c8c6a077d460ab3c4
parentce8dee5c3c3aef931ee6aae6feec9d87fa1a1dde (diff)
downloadsamba-fd237d99031d2903e62364fbafcff2b57636a9f6.tar.gz
samba-fd237d99031d2903e62364fbafcff2b57636a9f6.tar.bz2
samba-fd237d99031d2903e62364fbafcff2b57636a9f6.zip
r6490: BUG 1998: patch from Olaf Imig <Olaf.Imig@bifab.de>; fix byte ordering bug when storing 16-bit RAP print job ids
(This used to be commit 2c66a4098a3c9ca0a12160d4193d65085ece1dfe)
-rw-r--r--source3/printing/printing.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 572ecb373a..03bdb7d421 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -67,6 +67,7 @@ uint16 pjobid_to_rap(const char* sharename, uint32 jobid)
uint16 rap_jobid;
TDB_DATA data, key;
struct rap_jobid_key jinfo;
+ uint8 buf[2];
DEBUG(10,("pjobid_to_rap: called.\n"));
@@ -96,7 +97,8 @@ uint16 pjobid_to_rap(const char* sharename, uint32 jobid)
rap_jobid = ++next_rap_jobid;
if (rap_jobid == 0)
rap_jobid = ++next_rap_jobid;
- data.dptr = (char *)&rap_jobid;
+ SSVAL(buf,0,rap_jobid);
+ data.dptr = buf;
data.dsize = sizeof(rap_jobid);
tdb_store(rap_tdb, key, data, TDB_REPLACE);
tdb_store(rap_tdb, data, key, TDB_REPLACE);
@@ -109,13 +111,15 @@ uint16 pjobid_to_rap(const char* sharename, uint32 jobid)
BOOL rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid)
{
TDB_DATA data, key;
+ uint8 buf[2];
DEBUG(10,("rap_to_pjobid called.\n"));
if (!rap_tdb)
return False;
- key.dptr = (char *)&rap_jobid;
+ SSVAL(buf,0,rap_jobid);
+ key.dptr = buf;
key.dsize = sizeof(rap_jobid);
data = tdb_fetch(rap_tdb, key);
if ( data.dptr && data.dsize == sizeof(struct rap_jobid_key) )
@@ -140,6 +144,7 @@ static void rap_jobid_delete(const char* sharename, uint32 jobid)
TDB_DATA key, data;
uint16 rap_jobid;
struct rap_jobid_key jinfo;
+ uint8 buf[2];
DEBUG(10,("rap_jobid_delete: called.\n"));
@@ -165,7 +170,8 @@ static void rap_jobid_delete(const char* sharename, uint32 jobid)
rap_jobid = SVAL(data.dptr, 0);
SAFE_FREE(data.dptr);
- data.dptr = (char *)&rap_jobid;
+ SSVAL(buf,0,rap_jobid);
+ data.dptr=buf;
data.dsize = sizeof(rap_jobid);
tdb_delete(rap_tdb, key);
tdb_delete(rap_tdb, data);