Bug 1234 - 32-bit UID truncated to 16-bits by smbmnt
Summary: 32-bit UID truncated to 16-bits by smbmnt
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: smbmount (unmaintained) (show other bugs)
Version: 3.0.2a
Hardware: All Linux
: P1 critical
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-01 10:09 UTC by Jay Danielsen
Modified: 2005-08-24 10:19 UTC (History)
0 users

See Also:


Attachments
proposed patch - 32-bit UID/GID support for smbmnt (951 bytes, patch)
2004-04-01 10:43 UTC, Jay Danielsen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jay Danielsen 2004-04-01 10:09:17 UTC
smbmnt should use mount_uid & mount_gid instead of data->uid & data->gid
with 2.4+ kernels ... Current code truncates upper
16-bits of UID/GID information - here's a patch I have been using
to fix the 16-bit truncation (samba-3.0.2a-uid32.patch)  ...


/*
 * 32-bit UIDs/GIDs not fully supported by samba. This one line
 * patch adds support for 32-bit values via the ascii interface to
 * smbfs. - jay.danielsen@sun.com
 */
diff -urN samba-3.0.2a-orig/source/client/smbmnt.c samba-3.0.2a/source/client/sm
bmnt.c
--- samba-3.0.2a-orig/source/client/smbmnt.c    2004-02-12 12:39:58.000000000 -0
500
+++ samba-3.0.2a/source/client/smbmnt.c    2004-03-09 23:18:40.000000000 -0500
@@ -162,7 +162,8 @@

     slprintf(opts, sizeof(opts)-1,
          "version=7,uid=%d,gid=%d,file_mode=0%o,dir_mode=0%o,%s",
-         data->uid, data->gid, data->file_mode, data->dir_mode,options);
+         mount_uid, mount_gid, data->file_mode, data->dir_mode,options);
+
     if (mount(share_name, ".", "smbfs", flags, data1) == 0)
         return 0;
     return mount(share_name, ".", "smbfs", flags, data2);
@@ -225,7 +226,7 @@
                 return -1;
         }

-        data.uid = mount_uid;
+        data.uid = mount_uid;    // truncates to 16-bits here!!!
         data.gid = mount_gid;
         data.file_mode = (S_IRWXU|S_IRWXG|S_IRWXO) & mount_fmask;
         data.dir_mode  = (S_IRWXU|S_IRWXG|S_IRWXO) & mount_dmask;
Comment 1 Jay Danielsen 2004-04-01 10:43:35 UTC
Created attachment 464 [details]
proposed patch - 32-bit UID/GID support for smbmnt

replace use of data->uid, data->gid
(__kernel_uid_t == 'unsigned short' from asm/posix_types.h)
with mount_uid, mount_gid
(__uid_t == 'unsigned int' from bits/types.h)
to avoid truncation of value to lower 16-bits.
Comment 2 Gerald (Jerry) Carter (dead mail address) 2005-02-07 07:04:14 UTC
fixed in 3.0.11
Comment 3 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:19:02 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.