Samba 3.0 - Bug preventing mkfifo as non-root

Anders Karlsson trudheim at gmail.com
Sun Jan 21 21:20:29 GMT 2007


On Sat, 2007-01-20 at 18:50 -0800, Jeremy Allison wrote:
> On Sun, Jan 21, 2007 at 02:43:25AM +0000, Anders Karlsson wrote:
> > 
> > Grabbed the src.rpm or 3.0.23d and built on my FC6 system. Behaviour is
> > exactly the same as with Fedoras 3.0.23c. Interestingly, mount.cifs is
> > still version 1.10 in those samba packages. Would that have anything to
> > do with creation of FIFOs failing?
> 
> No.

Okay, then that is one less thing to be pre-occupied with. :)

> > I would be really interested in seeing the actual patch / commit that
> > enabled this to work. It would be useful for tinkering around with.
> 
> How are you doing the mount.cifs ?

mount.cifs //localhost/test /mnt/test -o setuids,user=cifs

> I use mount.cifs //server/share /mnt -o user=xxx,pass=yyy
> 
> and then I can :
> 
> cd /mnt; mkfifo foo
> 
> and all works.

I run 'mkfifo /mnt/test/foo' as root, the user cifs and my own user,
none can create the fifo on the cifs mount. I posted a reply to Andrew
Bartlett with a tar archive containing debug data and a copy of the
smb.conf I use. Nothing spectacular. 

> Here is the relevent code from smbd/trans2.c
> 
> 4232                         DEBUG(10,("call_trans2setfilepathinfo:
> SMB_SET_FILE_UNIX_BASIC: name = %s \
> 4233 size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
> 4234                                 fname, (double)size, (unsigned
> int)set_owner, (unsigned int)set_grp, (int)raw_unixmode));
> 4235 
> 4236                         if (!VALID_STAT(sbuf)) {
> 4237 
> 4238                                 /*
> 4239                                  * The only valid use of this is to
> create character and block
> 4240                                  * devices, and named pipes. This
> is deprecated (IMHO) and
> 4241                                  * a new info level should be used
> for mknod. JRA.
> 4242                                  */
> 4243 
> 4244                                 uint32 file_type = IVAL(pdata,0);
> 4245 #if defined(HAVE_MAKEDEV)
> 4246                                 uint32 dev_major = IVAL(pdata,4);
> 4247                                 uint32 dev_minor = IVAL(pdata,12);
> 4248 #endif
> 4249 
> 4250                                 uid_t myuid = geteuid();
> 4251                                 gid_t mygid = getegid();
> 4252                                 SMB_DEV_T dev = (SMB_DEV_T)0;
> 4253 
> 4254                                 if (tran_call ==
> TRANSACT2_SETFILEINFO)
> 4255
> return(ERROR_DOS(ERRDOS,ERRnoaccess));
> 4256 

This is where it drops out.

> 4257                                 if (raw_unixmode ==
> SMB_MODE_NO_CHANGE) {
> 4258                                         return
> ERROR_NT(NT_STATUS_INVALID_PARAMETER);
> 4259                                 }
> 4260 
> 4261 #if defined(HAVE_MAKEDEV)
> 4262                                 dev = makedev(dev_major,
> dev_minor);
> 4263 #endif
> 4264 
> 4265                                 /* We can only create as the
> owner/group we are. */
> 4266 
> 4267                                 if ((set_owner != myuid) &&
> (set_owner != (uid_t)SMB_UID_NO_CHANGE))
> 4268
> return(ERROR_DOS(ERRDOS,ERRnoaccess));
> 4269                                 if ((set_grp != mygid) && (set_grp
> != (gid_t)SMB_GID_NO_CHANGE))
> 4270
> return(ERROR_DOS(ERRDOS,ERRnoaccess));
> 4271 
> 4272                                 switch (file_type) {
> 4273 #if defined(S_IFIFO)
> 4274                                         case UNIX_TYPE_FIFO:
> 4275                                                 unixmode |=
> S_IFIFO;
> 4276                                                 break;
> 4277 #endif
> 4278 #if defined(S_IFSOCK)
> 4279                                         case UNIX_TYPE_SOCKET:
> 4280                                                 unixmode |=
> S_IFSOCK;
> 4281                                                 break;
> 4282 #endif
> 4283 #if defined(S_IFCHR)
> 4284                                         case UNIX_TYPE_CHARDEV:
> 4285                                                 unixmode |=
> S_IFCHR;
> 4286                                                 break;
> 4287 #endif
> 4288 #if defined(S_IFBLK)
> 4289                                         case UNIX_TYPE_BLKDEV:
> 4290                                                 unixmode |=
> S_IFBLK;
> 4291                                                 break;
> 4292 #endif
> 4293                                         default:
> 4294
> return(ERROR_DOS(ERRDOS,ERRnoaccess));
> 4295                                 }
> 4296 
> 4297
> DEBUG(10,("call_trans2setfilepathinfo: SMB_SET_FILE_UNIX_BASIC doing
> mknod dev %.0f mode \
> 4298 0%o for file %s\n", (double)dev, unixmode, fname ));
> 4299 
> 4300                                 /* Ok - do the mknod. */
> 4301                                 if (SMB_VFS_MKNOD(conn,fname,
> unixmode, dev) != 0)
> 4302
> return(UNIXERROR(ERRDOS,ERRnoaccess));
> 4303 

Thanks!

-- 
Anders Karlsson <trudheim at gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3838 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20070121/e9524b3c/smime.bin


More information about the samba-technical mailing list