1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

r6490: BUG 1998: patch from Olaf Imig <Olaf.Imig@bifab.de>; fix byte ordering bug when storing 16-bit RAP print job ids

This commit is contained in:
Gerald Carter 2005-04-26 14:14:16 +00:00 committed by Gerald (Jerry) Carter
parent 5fa5454218
commit 2c66a4098a

View File

@ -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);