svn commit: samba r4032 - in branches/SAMBA_3_0/source/lib: .

jra at samba.org jra at samba.org
Thu Dec 2 00:55:48 GMT 2004


Author: jra
Date: 2004-12-02 00:55:47 +0000 (Thu, 02 Dec 2004)
New Revision: 4032

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

Log:
Fix bug #2110 - ensure we convert to ucs2 correctly.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/ms_fnmatch.c
   branches/SAMBA_3_0/source/lib/util_unistr.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/ms_fnmatch.c
===================================================================
--- branches/SAMBA_3_0/source/lib/ms_fnmatch.c	2004-12-02 00:55:46 UTC (rev 4031)
+++ branches/SAMBA_3_0/source/lib/ms_fnmatch.c	2004-12-02 00:55:47 UTC (rev 4032)
@@ -167,9 +167,18 @@
 		}
 	}
 
-	pstrcpy_wa(p, pattern);
-	pstrcpy_wa(s, string);
+	if (push_ucs2(NULL, p, pattern, sizeof(p), STR_TERMINATE) == (size_t)-1) {
+		/* Not quite the right answer, but finding the right one
+		  under this failure case is expensive, and it's pretty close */
+		return -1;
+	}
 
+	if (push_ucs2(NULL, s, string, sizeof(s), STR_TERMINATE) == (size_t)-1) {
+		/* Not quite the right answer, but finding the right one
+		   under this failure case is expensive, and it's pretty close */
+		return -1;
+	}
+
 	if (protocol <= PROTOCOL_LANMAN2) {
 		/*
 		  for older negotiated protocols it is possible to

Modified: branches/SAMBA_3_0/source/lib/util_unistr.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_unistr.c	2004-12-02 00:55:46 UTC (rev 4031)
+++ branches/SAMBA_3_0/source/lib/util_unistr.c	2004-12-02 00:55:47 UTC (rev 4032)
@@ -708,16 +708,6 @@
   The char* arguments must NOT be multibyte - to be completely sure
   of this only pass string constants */
 
-
-void pstrcpy_wa(smb_ucs2_t *dest, const char *src)
-{
-	int i;
-	for (i=0;i<PSTRING_LEN;i++) {
-		dest[i] = UCS2_CHAR(src[i]);
-		if (src[i] == 0) return;
-	}
-}
-
 int strcmp_wa(const smb_ucs2_t *a, const char *b)
 {
 	while (*b && *a == UCS2_CHAR(*b)) { a++; b++; }



More information about the samba-cvs mailing list