patch#2 fifos on samba / 2.6.0 cifs

Florian Lohoff flo at rfc822.org
Tue Dec 30 18:42:37 GMT 2003


On Tue, Dec 30, 2003 at 05:07:11PM +0100, Florian Lohoff wrote:
> Hi,
> i am trying to get fifos running (Which is the major showstopper on
> putting roaming linux users homedir on an SMB share)
> 
> I found that using Linux 2.6.0 cifs filesystem i can see fifos and
> symlinks correctly mounting a samba share. I can also create symlinks
> but not fifos.
> 
> By digging through the source i found that this is the default behaviour
> in the samba code as it does not compile in that code 
> 
> #if !defined(HAVE_MAKEDEV_FN)
> 
> As this looks like someone is testing for some function in configure i
> looked there to no success.

I more guess this should habe been an "Ancient code - Please ignore" -
This code wasnt even able to link from mid 2001 on.

This is a more complete version - This at least lets me create 
fifos from a linux 2.6.0 with the cifs patch i sent a couple minutes
ago. 

I guess it misses some sanity checks as checking for upper 32 bits in
major/minor and fail or make nice wrapper around 64bit dev_t :).



--- samba-3.0.0final/source/smbd/trans2.c	2003-09-08 18:04:36.000000000 +0200
+++ samba-3.0.0final.flo/source/smbd/trans2.c	2003-12-30 19:08:13.000000000 +0100
@@ -334,6 +334,29 @@
 }
 
 /****************************************************************************
+ Return the UNIX mode for a file type
+****************************************************************************/
+
+static mode_t smb_to_unix_filetype(uint32 smbtype) {
+	switch(smbtype) {
+		case UNIX_TYPE_DIR:
+			return S_IFDIR;
+		case UNIX_TYPE_SYMLINK:
+			return S_IFLNK;
+		case UNIX_TYPE_CHARDEV:
+			return S_IFCHR;
+		case UNIX_TYPE_BLKDEV:
+			return S_IFBLK;
+		case UNIX_TYPE_FIFO:
+			return S_IFIFO;
+		case UNIX_TYPE_SOCKET:
+			return S_IFSOCK;
+		default:
+			return 0;
+	}
+}
+
+/****************************************************************************
  Return the filetype for UNIX extensions.
 ****************************************************************************/
 
@@ -2834,10 +2857,9 @@
 				 * a new info level should be used for mknod. JRA.
 				 */
 
-#if !defined(HAVE_MAKEDEV_FN)
-				return(ERROR_DOS(ERRDOS,ERRnoaccess));
-#else /* HAVE_MAKEDEV_FN */
 				uint32 file_type = IVAL(pdata,0);
+
+				/* These are uint64 */
 				uint32 dev_major = IVAL(pdata,4);
 				uint32 dev_minor = IVAL(pdata,12);
 
@@ -2867,8 +2889,10 @@
 				DEBUG(10,("call_trans2setfilepathinfo: SMB_SET_FILE_UNIX_BASIC doing mknod dev %.0f mode \
 0%o for file %s\n", (double)dev, unixmode, fname ));
 
+				unixmode|=smb_to_unix_filetype(file_type);
+
 				/* Ok - do the mknod. */
-				if (SMB_VFS_MKNOD(conn,dos_to_unix_static(fname), unixmode, dev) != 0)
+				if (SMB_VFS_MKNOD(conn, fname, unixmode, dev) != 0)
 					return(UNIXERROR(ERRDOS,ERRnoaccess));
 
 				inherit_access_acl(conn, fname, unixmode);
@@ -2876,8 +2900,6 @@
 				SSVAL(params,0,0);
 				send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0);
 				return(-1);
-#endif /* HAVE_MAKEDEV_FN */
-
 			}
 
 			/*


-- 
Florian Lohoff                  flo at rfc822.org             +49-171-2280134
                        Heisenberg may have been here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20031230/d0728cb8/attachment.bin


More information about the samba-technical mailing list