bk://cifs.bkbits.net/linux-2.5cifs
stevef@steveft21.ltcsamba|ChangeSet|20040821105904|52624 stevef

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/08/21 05:59:04-05:00 stevef@steveft21.ltcsamba 
#   CIFS: xsymlink support part 1 of 2
#   
#   Signed-off-by: Steve French (sfrench@us.ibm.com)
# 
# fs/cifs/cifspdu.h
#   2004/08/21 05:58:31-05:00 stevef@steveft21.ltcsamba +32 -3
#   xsymlink support part 1 of 2
# 
# ChangeSet
#   2004/08/21 05:47:13-05:00 stevef@steveft21.ltcsamba 
#   CIFS: Workaround Samba bug in incorrectly setting extended security flag in negotiate response (which caused mounts
#   to fail to Samba server which have short, one or two byte, domain names).
#   
#   Signed-off-by:  Steve French (sfrench@us.ibm.com)
# 
# fs/cifs/inode.c
#   2004/08/21 05:17:43-05:00 stevef@steveft21.ltcsamba +1 -1
#   big endian problem in display of number of blocks in inode
# 
# fs/cifs/cifssmb.c
#   2004/08/21 05:17:43-05:00 stevef@steveft21.ltcsamba +6 -5
#   Workaround Samba bug in incorrectly setting extended security flag in negotiate response
# 
# ChangeSet
#   2004/08/19 08:42:46-05:00 stevef@smfhome.smfdom 
#   CIFS: fix 64 bit compiler warning in cifs debug code
#   
#   Signed-off-by: Steve French (sfrench@us.ibm.com)
# 
# fs/cifs/cifsproto.h
#   2004/08/19 08:42:38-05:00 stevef@smfhome.smfdom +1 -1
#   fix 64 bit compiler warning in debug code
# 
diff -Nru a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
--- a/fs/cifs/cifspdu.h	2004-08-21 23:43:07 -07:00
+++ b/fs/cifs/cifspdu.h	2004-08-21 23:43:07 -07:00
@@ -1726,6 +1726,7 @@
 	void (*free) (struct data_blob * data_blob);
 };
 
+
 #ifdef CONFIG_CIFS_POSIX
 /* 
 	For better POSIX semantics from Linux client, (even better
@@ -1774,9 +1775,9 @@
 	
 	COPY (note support for copy across directories) - FUTURE, OPTIONAL
 	setting/getting OS/2 EAs - FUTURE (BB can this handle
-	        setting Linux xattrs perfectly)         - OPTIONAL
-    dnotify                                         - FUTURE, OPTIONAL
-    quota                                           - FUTURE, OPTIONAL
+	setting Linux xattrs perfectly)         - OPTIONAL
+	dnotify                                 - FUTURE, OPTIONAL
+	quota                                   - FUTURE, OPTIONAL
 			
 	Note that various requests implemented for NT interop such as 
 		NT_TRANSACT (IOCTL) QueryReparseInfo
@@ -1801,6 +1802,34 @@
 	
 	
  */
+
+/* xsymlink is a symlink format that can be used
+   to save symlink info in a regular file when 
+   mounted to operating systems that do not
+   support the cifs Unix extensions or EAs (for xattr
+   based symlinks).  For such a file to be recognized
+   as containing symlink data: 
+
+   1) file size must be 1067, 
+   2) signature must begin file data,
+   3) length field must be set to ASCII representation
+	of a number which is less than or equal to 1024, 
+   4) md5 must match that of the path data */
+
+struct xsymlink {
+	/* 1067 bytes */
+	char signature[4]; /* XSym */ /* not null terminated */
+	char cr0;         /* \n */
+/* ASCII representation of length (4 bytes decimal) terminated by \n not null */
+	char length[4];
+	char cr1;         /* \n */
+/* md5 of valid subset of path ie path[0] through path[length-1] */
+	__u8 md5[32];    
+	char cr2;        /* \n */
+/* if room left, then end with \n then 0x20s by convention but not required */
+	char path[1024];  
+};
+
 #endif 
 
 #pragma pack()			/* resume default structure packing */
diff -Nru a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
--- a/fs/cifs/cifsproto.h	2004-08-21 23:43:07 -07:00
+++ b/fs/cifs/cifsproto.h	2004-08-21 23:43:07 -07:00
@@ -37,7 +37,7 @@
 extern unsigned int _GetXid(void);
 extern void _FreeXid(unsigned int);
 #define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__FUNCTION__, xid,current->fsuid));
-#define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__FUNCTION__,curr_xid,rc));}
+#define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__FUNCTION__,curr_xid,(int)rc));}
 extern char *build_path_from_dentry(struct dentry *);
 extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
 extern void renew_parental_timestamps(struct dentry *direntry);
diff -Nru a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
--- a/fs/cifs/cifssmb.c	2004-08-21 23:43:07 -07:00
+++ b/fs/cifs/cifssmb.c	2004-08-21 23:43:07 -07:00
@@ -234,7 +234,8 @@
 
 		/* BB might be helpful to save off the domain of server here */
 
-		if (pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) {
+		if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) && 
+			(server->capabilities & CAP_EXTENDED_SECURITY)) {
 			if (pSMBr->ByteCount < 16)
 				rc = -EIO;
 			else if (pSMBr->ByteCount == 16) {
@@ -3105,7 +3106,7 @@
 					rc += temp_fea->name_len;
 				/* account for prefix user. and trailing null */
 					rc = rc + 5 + 1; 
-					if(rc<buf_size) {
+					if(rc<(int)buf_size) {
 						memcpy(EAData,"user.",5);
 						EAData+=5;
 						memcpy(EAData,temp_ptr,temp_fea->name_len);
@@ -3141,7 +3142,7 @@
 	if (rc == -EAGAIN)
 		goto QAllEAsRetry;
 
-	return rc;
+	return (ssize_t)rc;
 }
 
 ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon,
@@ -3255,7 +3256,7 @@
 						/* found a match */
 						rc = temp_fea->value_len;
 				/* account for prefix user. and trailing null */
-						if(rc<=buf_size) {
+						if(rc<=(int)buf_size) {
 							memcpy(ea_value,
 								temp_fea->name+temp_fea->name_len+1,
 								rc);
@@ -3288,7 +3289,7 @@
 	if (rc == -EAGAIN)
 		goto QEARetry;
 
-	return rc;
+	return (ssize_t)rc;
 }
 
 int
diff -Nru a/fs/cifs/inode.c b/fs/cifs/inode.c
--- a/fs/cifs/inode.c	2004-08-21 23:43:07 -07:00
+++ b/fs/cifs/inode.c	2004-08-21 23:43:07 -07:00
@@ -293,7 +293,7 @@
 
 		/* 512 bytes (2**9) is the fake blocksize that must be used */
 		/* for this calculation */
-			inode->i_blocks = (512 - 1 + pfindData->AllocationSize)
+			inode->i_blocks = (512 - 1 + le64_to_cpu(pfindData->AllocationSize))
 				 >> 9;
 		}
 		pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize);