2002-09-04 08:19:45

by Panu Matilainen

[permalink] [raw]
Subject: 32bit UID wraps around with smbfs

Hi,

Smbfs has problems with 32bit UID/GID's: when you do
'smbmount //some/share /mnt/samba -o uid=100000' the mountpoint UID (and
GID) wrap around at 65535.

The attached patch, along with samba recompile against fixed headers
apparently fixes it. This problem is present at least in all 2.4 kernels,
I haven't looked at 2.5.

- Panu -

--- linux/include/linux/smb_mount.h.uid32 Thu Aug 29 17:37:40 2002
+++ linux/include/linux/smb_mount.h Thu Aug 29 17:39:34 2002
@@ -15,9 +15,9 @@

struct smb_mount_data {
int version;
- __kernel_uid_t mounted_uid; /* Who may umount() this filesystem? */
- __kernel_uid_t uid;
- __kernel_gid_t gid;
+ __kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */
+ __kernel_uid32_t uid;
+ __kernel_gid32_t gid;
__kernel_mode_t file_mode;
__kernel_mode_t dir_mode;
};
@@ -42,9 +42,9 @@
struct smb_mount_data_kernel {
int version;

- __kernel_uid_t mounted_uid; /* Who may umount() this filesystem? */
- __kernel_uid_t uid;
- __kernel_gid_t gid;
+ __kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */
+ __kernel_uid32_t uid;
+ __kernel_gid32_t gid;
__kernel_mode_t file_mode;
__kernel_mode_t dir_mode;




2002-09-04 11:10:29

by Urban Widmark

[permalink] [raw]
Subject: Re: 32bit UID wraps around with smbfs

On Wed, 4 Sep 2002, Panu Matilainen wrote:

> Hi,
>
> Smbfs has problems with 32bit UID/GID's: when you do
> 'smbmount //some/share /mnt/samba -o uid=100000' the mountpoint UID (and
> GID) wrap around at 65535.
>
> The attached patch, along with samba recompile against fixed headers
> apparently fixes it. This problem is present at least in all 2.4 kernels,
> I haven't looked at 2.5.

I don't think this is an acceptable fix for the main kernel. You are
changing a binary interface in a stable kernel series.


I personally think that smb_mount_data is a bad idea and are slowly
working on moving smbfs to an ascii interface. With 2.4 any recent
smbmount should be using the ascii interface already, the problem there is
that smbmnt uses the smb_mount_data internally ...

This patch contains stuff I want to have included in samba 2.2.6,
including fixes for smbmnt's uid-abuse:
http://www.hojdpunkten.ac.se/054/samba/smbmount-2.2.5-misc-2.patch.gz

And this is needed to change the storage size of the in-kernel mount
struct:
http://www.hojdpunkten.ac.se/054/samba/smbfs-2.4.18-uid32.patch

/Urban

2002-09-04 11:40:04

by Panu Matilainen

[permalink] [raw]
Subject: Re: 32bit UID wraps around with smbfs

On Wed, 4 Sep 2002, Urban Widmark wrote:

> On Wed, 4 Sep 2002, Panu Matilainen wrote:
>
> > Hi,
> >
> > Smbfs has problems with 32bit UID/GID's: when you do
> > 'smbmount //some/share /mnt/samba -o uid=100000' the mountpoint UID (and
> > GID) wrap around at 65535.
> >
> > The attached patch, along with samba recompile against fixed headers
> > apparently fixes it. This problem is present at least in all 2.4 kernels,
> > I haven't looked at 2.5.
>
> I don't think this is an acceptable fix for the main kernel. You are
> changing a binary interface in a stable kernel series.

Yup.. I had my doubts about the changes (I'm not a kernel hacker, just
poked around and noticed that things seem to work with that change)

> I personally think that smb_mount_data is a bad idea and are slowly
> working on moving smbfs to an ascii interface. With 2.4 any recent
> smbmount should be using the ascii interface already, the problem there is
> that smbmnt uses the smb_mount_data internally ...
>
> This patch contains stuff I want to have included in samba 2.2.6,
> including fixes for smbmnt's uid-abuse:
> http://www.hojdpunkten.ac.se/054/samba/smbmount-2.2.5-misc-2.patch.gz
>
> And this is needed to change the storage size of the in-kernel mount
> struct:
> http://www.hojdpunkten.ac.se/054/samba/smbfs-2.4.18-uid32.patch

Thanks, I'll try these out!

--
- Panu -