On Fri, Jan 26, 2007 at 02:52:06AM -0800, Steve Langasek wrote:
> On Mon, Jan 22, 2007 at 06:42:30PM -0700, dann frazier wrote:
> > This patch was added to workaround #310982 right around the release of 
> > sarge.
> > However, this patch never ended up in sarge. Since then, this bug has been
> > fixed in the upstream 2.4 and 2.6 kernels and this fix exists in the latest
> > sarge, etch and sid kernels.
> 
> Sorry, can you give the exact versions of the kernel packages that fixed
> this for Debian?  Did the fix in question trickle in via upstream in the
> case of etch/sid?

Yes, upstream 2.6.10 (and 2.4.34)

sarge got it in the last round of security updates 2.4.27-10sarge5,
2.6.8-16sarge6

> > Note that the kernel change makes some corner use cases impossible without
> > some additional userspace changes to samba. Upstream has agreed to accept
> > these patches[1], but I don't know if they've been committed yet.
> 
> Even if it's still a case that all server-side perms are ignored, dropping
> this patch is still an improvement for users wanting symlink support,
> apparently.  So I agree with dropping it, as long as we're sure the kernel
> changes are in place.

Cool. What's the samba team's opinion of the userspace patches going into
etch/sarge? Here's a port of the patch that applies to both etch and
sarge:

--- samba-3.0.23d.orig/source/client/smbmnt.c
+++ samba-3.0.23d/source/client/smbmnt.c
@@ -48,6 +48,10 @@
 static unsigned mount_dmask;
 static int user_mount;
 static char *options;
+static int opt_uid = 0;
+static int opt_gid = 0; 
+static int opt_fmode = 0;
+static int opt_dmode = 0; 
 
 static void
 help(void)
@@ -80,11 +84,13 @@
                 case 'u':
                        if (!user_mount) {
                                mount_uid = strtol(optarg, NULL, 0);
+                               opt_uid++;
                        }
                         break;
                 case 'g':
                        if (!user_mount) {
                                mount_gid = strtol(optarg, NULL, 0);
+                               opt_gid++;
                        }
                         break;
                 case 'r':
@@ -92,9 +98,11 @@
                         break;
                 case 'f':
                         mount_fmask = strtol(optarg, NULL, 8);
+                       opt_fmode++;
                         break;
                 case 'd':
                         mount_dmask = strtol(optarg, NULL, 8);
+                       opt_dmode++;
                         break;
                case 'o':
                        options = optarg;
@@ -177,9 +185,17 @@
                data2 = (char *) data;
        }
 
-       slprintf(opts, sizeof(opts)-1,
-                "version=7,uid=%d,gid=%d,file_mode=0%o,dir_mode=0%o,%s",
-                mount_uid, mount_gid, data->file_mode, data->dir_mode,options);
+       slprintf(opts, sizeof(opts)-1, "version=7,");
+       if (opt_uid) 
+               slprintf(opts+strlen(opts), sizeof(opts)-strlen(opts)-1, 
"uid=%d,", mount_uid);
+       if (opt_gid) 
+               slprintf(opts+strlen(opts), sizeof(opts)-strlen(opts)-1, 
"gid=%d,", mount_gid);
+       if (opt_fmode) 
+               slprintf(opts+strlen(opts), sizeof(opts)-strlen(opts)-1, 
"file_mode=%d,", data->file_mode);
+       if (opt_dmode) 
+               slprintf(opts+strlen(opts), sizeof(opts)-strlen(opts)-1, 
"dir_mode=%d,", data->dir_mode);
+       slprintf(opts+strlen(opts), sizeof(opts)-strlen(opts)-1, "%s",options);
+
        if (mount(share_name, ".", "smbfs", flags, data1) == 0)
                return 0;
        return mount(share_name, ".", "smbfs", flags, data2);
@@ -320,4 +336,6 @@
         }
 
        return 0;
-}      
+}
+
+
--- samba-3.0.23d.orig/source/client/smbmount.c
+++ samba-3.0.23d/source/client/smbmount.c
@@ -41,6 +41,10 @@
 static int smb_port = 0;
 static BOOL got_user;
 static BOOL got_pass;
+static BOOL use_uid = 0;
+static BOOL use_gid = 0;
+static BOOL use_fmask = 0;
+static BOOL use_dmask = 0;
 static uid_t mount_uid;
 static gid_t mount_gid;
 static int mount_ro;
@@ -471,22 +475,22 @@
        if (mount_ro) {
                args[i++] = "-r";
        }
-       if (mount_uid) {
+       if (use_uid) {
                slprintf(tmp, sizeof(tmp)-1, "%d", mount_uid);
                args[i++] = "-u";
                args[i++] = smb_xstrdup(tmp);
        }
-       if (mount_gid) {
+       if (use_gid) {
                slprintf(tmp, sizeof(tmp)-1, "%d", mount_gid);
                args[i++] = "-g";
                args[i++] = smb_xstrdup(tmp);
        }
-       if (mount_fmask) {
+       if (use_fmask) {
                slprintf(tmp, sizeof(tmp)-1, "0%o", mount_fmask);
                args[i++] = "-f";
                args[i++] = smb_xstrdup(tmp);
        }
-       if (mount_dmask) {
+       if (use_dmask) {
                slprintf(tmp, sizeof(tmp)-1, "0%o", mount_dmask);
                args[i++] = "-d";
                args[i++] = smb_xstrdup(tmp);
@@ -784,14 +788,18 @@
                                pstrcpy(my_netbios_name,opteq+1);
                        } else if(!strcmp(opts, "uid")) {
                                mount_uid = nametouid(opteq+1);
+                               use_uid++;
                        } else if(!strcmp(opts, "gid")) {
                                mount_gid = nametogid(opteq+1);
+                               use_gid++;
                        } else if(!strcmp(opts, "port")) {
                                smb_port = val;
                        } else if(!strcmp(opts, "fmask")) {
                                mount_fmask = strtol(opteq+1, NULL, 8);
+                               use_fmask++;
                        } else if(!strcmp(opts, "dmask")) {
                                mount_dmask = strtol(opteq+1, NULL, 8);
+                               use_dmask++;
                        } else if(!strcmp(opts, "debug")) {
                                DEBUGLEVEL = val;
                        } else if(!strcmp(opts, "ip")) {



-- 
dann frazier | HP Open Source and Linux Organization


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to