svn commit: samba r3395 - in branches/SAMBA_4_0/source/librpc: idl ndr

tridge at samba.org tridge at samba.org
Sat Oct 30 23:19:09 GMT 2004


Author: tridge
Date: 2004-10-30 23:19:09 +0000 (Sat, 30 Oct 2004)
New Revision: 3395

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3395

Log:
added support for "string32" type, to fix the fixed width string
problem that tim found.


Modified:
   branches/SAMBA_4_0/source/librpc/idl/idl_types.h
   branches/SAMBA_4_0/source/librpc/idl/spoolss.idl
   branches/SAMBA_4_0/source/librpc/ndr/libndr.h
   branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/idl_types.h
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/idl_types.h	2004-10-30 22:10:14 UTC (rev 3394)
+++ branches/SAMBA_4_0/source/librpc/idl/idl_types.h	2004-10-30 23:19:09 UTC (rev 3395)
@@ -5,6 +5,7 @@
 #define STR_NOTERM   LIBNDR_FLAG_STR_NOTERM
 #define STR_NULLTERM LIBNDR_FLAG_STR_NULLTERM
 #define STR_BYTESIZE LIBNDR_FLAG_STR_BYTESIZE
+#define STR_FIXLEN32 LIBNDR_FLAG_STR_FIXLEN32
 
 /*
   a UCS2 string prefixed with [size] [offset] [length], all 32 bits
@@ -28,6 +29,11 @@
 #define nstring       [flag(STR_NULLTERM)]                  string
 
 /*
+  fixed length 32 character UCS-2 string
+*/
+#define string32       [flag(STR_FIXLEN32)]                 string
+
+/*
   an ascii string prefixed with [size] [offset] [length], all 32 bits
   null terminated
 */

Modified: branches/SAMBA_4_0/source/librpc/idl/spoolss.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/spoolss.idl	2004-10-30 22:10:14 UTC (rev 3394)
+++ branches/SAMBA_4_0/source/librpc/idl/spoolss.idl	2004-10-30 23:19:09 UTC (rev 3395)
@@ -55,7 +55,7 @@
 	} spoolss_PrinterInfo0;
 
 	typedef struct {
-	        uint16 devicename[32];
+	        string32 devicename;
 		uint16 specversion;
 		uint16 driverversion;
 		uint16 size;
@@ -74,7 +74,7 @@
 		uint16 yresolution;
 		uint16 ttoption;
 		uint16 collate;
-	        uint16 formname[32];
+	        string32 formname;
 		uint16 logpixels;
 		uint32 bitsperpel;
 		uint32 pelswidth;

Modified: branches/SAMBA_4_0/source/librpc/ndr/libndr.h
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/libndr.h	2004-10-30 22:10:14 UTC (rev 3394)
+++ branches/SAMBA_4_0/source/librpc/ndr/libndr.h	2004-10-30 23:19:09 UTC (rev 3395)
@@ -96,7 +96,8 @@
 #define LIBNDR_FLAG_STR_NULLTERM (1<<6)
 #define LIBNDR_FLAG_STR_SIZE2    (1<<7)
 #define LIBNDR_FLAG_STR_BYTESIZE (1<<8)
-#define LIBNDR_STRING_FLAGS      (0x1FC)
+#define LIBNDR_FLAG_STR_FIXLEN32 (1<<9)
+#define LIBNDR_STRING_FLAGS      (0x3FC)
 
 #define LIBNDR_FLAG_REF_ALLOC    (1<<10)
 #define LIBNDR_FLAG_REMAINING    (1<<11)

Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c	2004-10-30 22:10:14 UTC (rev 3394)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c	2004-10-30 23:19:09 UTC (rev 3395)
@@ -673,6 +673,22 @@
 		*s = as;
 		break;
 
+	case LIBNDR_FLAG_STR_FIXLEN32:
+		len1 = 32;
+		NDR_PULL_NEED_BYTES(ndr, len1*byte_mul);
+		ret = convert_string_talloc(ndr, chset, CH_UNIX, 
+					    ndr->data+ndr->offset, 
+					    len1*byte_mul,
+					    (void **)&as);
+		if (ret == -1) {
+			return ndr_pull_error(ndr, NDR_ERR_CHARCNV, 
+					      "Bad character conversion");
+		}
+		NDR_CHECK(ndr_pull_advance(ndr, len1*byte_mul));
+		*s = as;
+		break;
+
+
 	default:
 		return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
 				      ndr->flags & LIBNDR_STRING_FLAGS);
@@ -807,6 +823,18 @@
 		ndr->offset += c_len*byte_mul;
 		break;
 
+	case LIBNDR_FLAG_STR_FIXLEN32:
+		NDR_PUSH_NEED_BYTES(ndr, byte_mul*32);
+		ret = convert_string(CH_UNIX, chset, 
+				     s, s_len + 1,
+				     ndr->data+ndr->offset, byte_mul*32);
+		if (ret == -1) {
+			return ndr_push_error(ndr, NDR_ERR_CHARCNV, 
+					      "Bad character conversion");
+		}
+		ndr->offset += byte_mul*32;
+		break;
+
 	default:
 		return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
 				      ndr->flags & LIBNDR_STRING_FLAGS);



More information about the samba-cvs mailing list