[linux-cifs-client] mount/umount cifs with normal user

Lin Li linl at xandros.com
Mon Dec 8 19:07:36 GMT 2003


I meet some problem mount/umount cifs with a normal user (non-root).

It seems there is a bug in mount.cifs.c which makes setuid check fail.

Here is my patch:
------------------------------------------------------
--- mount.cifs.c        30 Sep 2003 15:29:05 -0000      1.3
+++ mount.cifs.c        8 Dec 2003 16:04:44 -0000
@@ -490,7 +490,7 @@
        }

        if((getuid() != 0) && (geteuid() == 0)) {
-               if((statbuf.st_uid == getuid()) && (S_IRWXU == 
statbuf.st_mode & S_IRWXU)) {
+               if((statbuf.st_uid == getuid()) && (S_IRWXU == 
(statbuf.st_mode & S_IRWXU))) {
                        printf("setuid mount allowed\n");
                } else {
                        printf("mount error: permission denied, not 
superuser and cifs.mount not installed SUID\n");
------------------------------------------------------

Also, it misses an umount utility similar to smbumount. In the code of 
smbumount, it uses ioctl(fid, SMB_IOC_GETMOUNTUID, &mount_uid) to check 
if it's a smbfs and if the user matches the mount user. I don't know if 
there is a similar call for cifs. I'm going to write some code which 
checks mounted file system based on the entries in the mtab and  check 
the user using stat  on the mount point.  Any suggestions?

Thanks,
Lin

-- 
Xandros Corporation
Simple. Powerful. Linux.
Visit us at http://www.xandros.com




More information about the linux-cifs-client mailing list