svn commit: samba r10776 - in trunk/source: include rpc_parse rpc_server

jerry at samba.org jerry at samba.org
Thu Oct 6 16:23:51 GMT 2005


Author: jerry
Date: 2005-10-06 16:23:51 +0000 (Thu, 06 Oct 2005)
New Revision: 10776

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

Log:
I admit that I don't completely understand the \ntsvcs pipe
and that this is a really horrible hack.  But since 
I just need enough of the pipe to get rid of warnings
when launching the MMC services plugin, I can live with myself.

This fixes the final "Invalid Device ID" warning popup by
ensuring that the device list is double NULL terminated.
I added a new UNI_STR_DBLTERMINATE flag to init_unistr2().
It was easy and cleaner than coming up with a new set of UNISTR2
initialization functions.  I know we will have to eventually 
clean this up,  but its enough for now.



Modified:
   trunk/source/include/rpc_misc.h
   trunk/source/rpc_parse/parse_misc.c
   trunk/source/rpc_parse/parse_ntsvcs.c
   trunk/source/rpc_server/srv_ntsvcs_nt.c


Changeset:
Modified: trunk/source/include/rpc_misc.h
===================================================================
--- trunk/source/include/rpc_misc.h	2005-10-06 15:25:53 UTC (rev 10775)
+++ trunk/source/include/rpc_misc.h	2005-10-06 16:23:51 UTC (rev 10776)
@@ -27,7 +27,7 @@
 #define SMB_RPC_INTERFACE_VERSION 1
 #define PRS_POINTER_CAST BOOL (*)(const char*, prs_struct*, int, void*)
 
-enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_TERMINATE = 2, UNI_BROKEN_NON_NULL = 3 };
+enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_TERMINATE = 2, UNI_BROKEN_NON_NULL = 3, UNI_STR_DBLTERMINATE = 4 };
 
 
 

Modified: trunk/source/rpc_parse/parse_misc.c
===================================================================
--- trunk/source/rpc_parse/parse_misc.c	2005-10-06 15:25:53 UTC (rev 10775)
+++ trunk/source/rpc_parse/parse_misc.c	2005-10-06 16:23:51 UTC (rev 10776)
@@ -830,6 +830,8 @@
 	if (buf) {
 		/* We always null terminate the copy. */
 		len = strlen(buf) + 1;
+		if ( flags == UNI_STR_DBLTERMINATE )
+			len++;
 	} else {
 		/* no buffer -- nothing to do */
 		str->uni_max_len = 0;
@@ -859,6 +861,8 @@
 		if (flags == UNI_STR_TERMINATE || flags == UNI_MAXLEN_TERMINATE) {
 			num_chars++;
 		}
+		if ( flags == UNI_STR_DBLTERMINATE )
+			num_chars += 2;
 	}
 
 	str->uni_max_len = num_chars;

Modified: trunk/source/rpc_parse/parse_ntsvcs.c
===================================================================
--- trunk/source/rpc_parse/parse_ntsvcs.c	2005-10-06 15:25:53 UTC (rev 10775)
+++ trunk/source/rpc_parse/parse_ntsvcs.c	2005-10-06 16:23:51 UTC (rev 10776)
@@ -79,7 +79,7 @@
 
 	if ( !prs_pointer("devicename", ps, depth, (void**)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) )
 		return False;
-	if( !prs_align(ps) )
+	if ( !prs_align(ps) )
 		return False;
 		
 	if ( !prs_uint32("flags", ps, depth, &q_u->flags) )

Modified: trunk/source/rpc_server/srv_ntsvcs_nt.c
===================================================================
--- trunk/source/rpc_server/srv_ntsvcs_nt.c	2005-10-06 15:25:53 UTC (rev 10775)
+++ trunk/source/rpc_server/srv_ntsvcs_nt.c	2005-10-06 16:23:51 UTC (rev 10776)
@@ -80,11 +80,9 @@
 	rpcstr_pull(device, q_u->devicename->buffer, sizeof(device), q_u->devicename->uni_str_len*2, 0);
 	devicepath = get_device_path( device );
 
-	/* From the packet traces I've see, I think this really should be an array
-	   of UNISTR2's.  But I've never seen more than one string in spite of the 
-	   fact that the string in double NULL terminated.  -- jerry */
+	/* This has to be DOUBLE NULL terminated */
 
-	init_unistr2( &r_u->devicepath, devicepath, UNI_STR_TERMINATE );
+	init_unistr2( &r_u->devicepath, devicepath, UNI_STR_DBLTERMINATE );
 	r_u->needed = r_u->devicepath.uni_str_len;
 
 	return WERR_OK;



More information about the samba-cvs mailing list