8-byte alignment needed for beginning driver_info_level_6.
authorGerald Carter <jerry@samba.org>
Tue, 9 Jul 2002 23:23:19 +0000 (23:23 +0000)
committerGerald Carter <jerry@samba.org>
Tue, 9 Jul 2002 23:23:19 +0000 (23:23 +0000)
Verified by looking at NT4 and 2k servers.  First time
for everything I guess.

source/include/rpc_spoolss.h
source/rpc_parse/parse_prs.c
source/rpc_parse/parse_spoolss.c

index d16d5289042511ad8e3ddd2cede84fccaa924fa9..82062d52786c2cccac410a78fcce8a548a12e5fc 100755 (executable)
@@ -1513,7 +1513,6 @@ SPOOL_PRINTER_DRIVER_INFO_LEVEL_3;
 
 /* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */
 typedef struct {
-       uint32 unknown;
        uint32 version;
        uint32 name_ptr;
        uint32 environment_ptr;
index 05f38ddd233ef8b51446d254ef6ab29bbabdd124..2ab8c7246e19184ce0e9226edded4010d77e175f 100644 (file)
@@ -447,6 +447,10 @@ BOOL prs_align(prs_struct *ps)
        return True;
 }
 
+/******************************************************************
+ Align on a 2 byte boundary
+ *****************************************************************/
 BOOL prs_align_uint16(prs_struct *ps)
 {
        BOOL ret;
@@ -455,6 +459,23 @@ BOOL prs_align_uint16(prs_struct *ps)
        ps->align = 2;
        ret = prs_align(ps);
        ps->align = old_align;
+       
+       return ret;
+}
+
+/******************************************************************
+ Align on a 8 byte boundary
+ *****************************************************************/
+BOOL prs_align_uint64(prs_struct *ps)
+{
+       BOOL ret;
+       uint8 old_align = ps->align;
+
+       ps->align = 8;
+       ret = prs_align(ps);
+       ps->align = old_align;
+       
        return ret;
 }
 
index 0bcace8a0020d07383567b30994d34be63db214f..c74249878a99179e3d14494fee08759741177844 100644 (file)
@@ -5034,39 +5034,32 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_
        if(!prs_align(ps))
                return False;
 
-       if (!prs_uint32("unknown   ", ps, depth, &il->unknown))
+       /* 
+        * I know this seems weird, but I have no other explanation.
+        * This is observed behavior on both NT4 and 2K servers.
+        * --jerry
+        */
+        
+       if (!prs_align_uint64(ps))
                return False;
 
        /* parse the main elements the packet */
 
-       if(!prs_uint32("cversion   ", ps, depth, &il->version))
+       if(!prs_uint32("cversion       ", ps, depth, &il->version))
                return False;
-
-       if(!prs_uint32("name       ", ps, depth, &il->name_ptr))
+       if(!prs_uint32("name           ", ps, depth, &il->name_ptr))
                return False;
-
-       /*
-        * If name_ptr is NULL then the next 4 bytes are the name_ptr. A driver 
-        * with a NULL name just isn't a driver For example: "HP LaserJet 4si"
-        * from W2K CDROM (which uses unidriver). JohnR 010205
-        */
-       if (!il->name_ptr) {
-               DEBUG(5,("spool_io_printer_driver_info_level_6: name_ptr is NULL! Get next value\n"));
-               if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr))
-                       return False;   
-       }
-       
-       if(!prs_uint32("environment", ps, depth, &il->environment_ptr))
+       if(!prs_uint32("environment    ", ps, depth, &il->environment_ptr))
                return False;
-       if(!prs_uint32("driverpath ", ps, depth, &il->driverpath_ptr))
+       if(!prs_uint32("driverpath     ", ps, depth, &il->driverpath_ptr))
                return False;
-       if(!prs_uint32("datafile   ", ps, depth, &il->datafile_ptr))
+       if(!prs_uint32("datafile       ", ps, depth, &il->datafile_ptr))
                return False;
-       if(!prs_uint32("configfile ", ps, depth, &il->configfile_ptr))
+       if(!prs_uint32("configfile     ", ps, depth, &il->configfile_ptr))
                return False;
-       if(!prs_uint32("helpfile   ", ps, depth, &il->helpfile_ptr))
+       if(!prs_uint32("helpfile       ", ps, depth, &il->helpfile_ptr))
                return False;
-       if(!prs_uint32("monitorname", ps, depth, &il->monitorname_ptr))
+       if(!prs_uint32("monitorname    ", ps, depth, &il->monitorname_ptr))
                return False;
        if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr))
                return False;