[prb] limit on the share name to 13 characters?

Samba-JP TAKAHASHI Motonobu monyo at samba.gr.jp
Tue Jun 26 18:45:31 GMT 2001


>I would be interested also in this patches...if you could 
>post them on the samba user list, I would be grateful
>
>dragos

Sorry, recently I have no time to do it.
Here is a patch we are using in Samba 2.0.9 Japanese Edition.

To apply this patch, against Windows 9x/NT the share name over 12
chars is truncated, and against Windows 2000 the share name limit
becomes 127 chars and a share name over 127 chars is also truncated.

----- Cut Here for Samba 2.0.10 -----
--- param/loadparm.c.org        Sat Apr 22 02:43:12 2000
+++ param/loadparm.c    Wed Jun 27 03:40:54 2001
@@ -2886,12 +2886,16 @@
 ***************************************************************************/
 int lp_servicenumber(char *pszServiceName)
 {
-   int iService;
-
-   for (iService = iNumServices - 1; iService >= 0; iService--)
-      if (VALID(iService) &&
-         strequal(lp_servicename(iService), pszServiceName)) 
-         break;
+    int len, iService;
+    pstring service;
+  
+    len = (get_remote_arch() == RA_WIN2K) ? 127 : 12;
+    for (iService = iNumServices - 1; iService >= 0; iService--)
+        if (VALID(iService)) {
+        strncpy(service, lp_servicename(iService), len);
+        if (strequal(service, pszServiceName))
+           break;
+        }
 
    if (iService < 0)
      DEBUG(7,("lp_servicenumber: couldn't find
%s\n",pszServiceName));
diff -urNP
../../samba-2.0.10-ja-1.0beta2/source/rpc_server/srv_srvsvc.c ./rpc_s
erver/srv_srvsvc.c
--- ../../samba-2.0.10-ja-1.0beta2/source/rpc_server/srv_srvsvc.c
 Fri May 
 4 04:11:43 2001
+++ ./rpc_server/srv_srvsvc.c   Tue Jun 26 09:59:02 2001
@@ -36,13 +36,16 @@
 static void init_srv_share_info_1(SRV_SHARE_INFO_1 *sh1, int snum)
 {
        int len_net_name;
+       pstring service;
        pstring net_name;
        pstring remark;
        uint32 type;
 
-       pstrcpy(net_name, lp_servicename(snum));
+       strncpy(service, lp_servicename(snum),
+               (get_remote_arch() == RA_WIN2K) ? 127 : 12);
+       pstrcpy(net_name, service);
        pstrcpy(remark, lp_comment(snum));
-       pstring_sub(remark,"%S",lp_servicename(snum));
+       pstring_sub(remark,"%S", service);
        len_net_name = strlen(net_name);
 
        /* work out the share type */
----- Cut Here -----

-----
TAKAHASHI Motonobu                    mailto:monyo at samba.gr.jp
Samba Users Group Japan               http://www.samba.gr.jp/





More information about the samba-technical mailing list