3 changes smbmount wants in samba:

1) Allow an application using libsmb to control if CAP_LARGE_FILES is set
   in the client capabilities.

2) Make strchr_m and strrchr_m efficient for the common case of searching for
   an ascii character, using the same reasoning as in strlower_m.
   The conversions done in strchr_m are kind of expensive ...

3) strchr_w(ws, UCS2_CHAR('\0')) doesn't find the end of the string,
   and that makes strchr_m(string, '\0') fail. (2) fixes that, but I'm
   guessing strchr_w is also supposed to work like strchr does.

patch vs SAMBA-3_0, please apply (to all relevant branches?)

/Urban


diff -urN -X exclude samba-3_0.old/source/libsmb/cliconnect.c 
samba-3_0/source/libsmb/cliconnect.c
--- samba-3_0.old/source/libsmb/cliconnect.c    Thu Oct 17 19:10:24 2002
+++ samba-3_0/source/libsmb/cliconnect.c        Sat Oct 19 12:13:30 2002
@@ -124,6 +124,9 @@
        if (cli->capabilities & CAP_UNICODE)
                capabilities |= CAP_UNICODE;
 
+       if (cli->capabilities & CAP_LARGE_FILES)
+               capabilities |= CAP_LARGE_FILES;
+
        return capabilities;
 }
 
diff -urN -X exclude samba-3_0.old/source/lib/util_str.c 
samba-3_0/source/lib/util_str.c
--- samba-3_0.old/source/lib/util_str.c Wed Oct  2 21:12:14 2002
+++ samba-3_0/source/lib/util_str.c     Sat Oct 19 16:46:34 2002
@@ -990,6 +990,9 @@
        pstring s2;
        smb_ucs2_t *p;
 
+       if (!(c & 0x80))
+               return strchr(s, c);    /* ascii */
+
        push_ucs2(NULL, ws, s, sizeof(ws), STR_TERMINATE);
        p = strchr_w(ws, UCS2_CHAR(c));
        if (!p)
@@ -1005,6 +1008,9 @@
        pstring s2;
        smb_ucs2_t *p;
 
+       if (!(c & 0x80))
+               return strchr(s, c);    /* ascii */
+
        push_ucs2(NULL, ws, s, sizeof(ws), STR_TERMINATE);
        p = strrchr_w(ws, UCS2_CHAR(c));
        if (!p)
diff -urN -X exclude samba-3_0.old/source/lib/util_unistr.c 
samba-3_0/source/lib/util_unistr.c
--- samba-3_0.old/source/lib/util_unistr.c      Wed Sep 25 17:18:52 2002
+++ samba-3_0/sourcelib/util_unistr.c/  Sat Oct 19 20:45:34 2002
@@ -335,6 +335,7 @@
                if (c == *s) return (smb_ucs2_t *)s;
                s++;
        }
+       if (c == *s) return (smb_ucs2_t *)s;
        return NULL;
 }
 

Reply via email to