Big Endian archtectures

Jeremy Allison jeremy at valinux.com
Mon Oct 30 19:22:08 GMT 2000


Oh - I see the problem now. As I suspected it's a double
swap problem.

Look at the code in spoolss_notify_printer_name() - it
used dos_PutUnicode() to enter the string into the structure.

dos_PutUnicode() *always* writes little-endian data. Then the
element of the structure is written into the data stream in
uint16 format which will byte swap again on a big endian box.

Ok - try the following patch - this should fix it.

Can you let me know asap if so then I'll commit it (without
the #ifdefs).

Jeremy.

Index: rpc_parse/parse_spoolss.c
===================================================================
RCS file: /data/cvs/samba/source/rpc_parse/parse_spoolss.c,v
retrieving revision 1.97
diff -u -r1.97 parse_spoolss.c
--- rpc_parse/parse_spoolss.c   2000/10/18 00:55:02     1.97
+++ rpc_parse/parse_spoolss.c   2000/10/30 19:19:58
@@ -382,8 +382,14 @@
                x=data->notify_data.data.length+1;
                if(!prs_uint32("string length", ps, depth, &x ))
                        return False;
+#if 1 /* JRATEST */
+               /* These are already in little endian format. Don't byte swap. */
+               if(!prs_uint8s(True,"string",ps,depth,(uint8 *)data->notify_data.data.string,x*2))
+                       return False;
+#else /* JRATEST */
                if(!prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x))
                        return False;
+#endif /* JRATEST */
        }
        if(!prs_align(ps))
                return False;                      

--
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------




More information about the samba-technical mailing list