svn commit: samba r16788 - in trunk/source/smbd: .
jra at samba.org
jra at samba.org
Mon Jul 3 21:07:27 GMT 2006
Author: jra
Date: 2006-07-03 21:07:26 +0000 (Mon, 03 Jul 2006)
New Revision: 16788
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16788
Log:
Fix bug #3909, when using ea's getting a directory tries to
read ea's from an msdfs link. Stop it from doing that.
Jerry please merge to 3.0.23.
Jeremy.
Modified:
trunk/source/smbd/dosmode.c
trunk/source/smbd/trans2.c
Changeset:
Modified: trunk/source/smbd/dosmode.c
===================================================================
--- trunk/source/smbd/dosmode.c 2006-07-03 18:32:12 UTC (rev 16787)
+++ trunk/source/smbd/dosmode.c 2006-07-03 21:07:26 UTC (rev 16788)
@@ -315,6 +315,57 @@
}
/****************************************************************************
+ Change a unix mode to a dos mode for an ms dfs link.
+****************************************************************************/
+
+uint32 dos_mode_msdfs(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf)
+{
+ uint32 result = 0;
+
+ DEBUG(8,("dos_mode_msdfs: %s\n", path));
+
+ if (!VALID_STAT(*sbuf)) {
+ return 0;
+ }
+
+ /* First do any modifications that depend on the path name. */
+ /* hide files with a name starting with a . */
+ if (lp_hide_dot_files(SNUM(conn))) {
+ const char *p = strrchr_m(path,'/');
+ if (p) {
+ p++;
+ } else {
+ p = path;
+ }
+
+ if (p[0] == '.' && p[1] != '.' && p[1] != 0) {
+ result |= aHIDDEN;
+ }
+ }
+
+ result |= dos_mode_from_sbuf(conn, path, sbuf);
+
+ /* Optimization : Only call is_hidden_path if it's not already
+ hidden. */
+ if (!(result & aHIDDEN) && IS_HIDDEN_PATH(conn,path)) {
+ result |= aHIDDEN;
+ }
+
+ DEBUG(8,("dos_mode_msdfs returning "));
+
+ if (result & aHIDDEN) DEBUG(8, ("h"));
+ if (result & aRONLY ) DEBUG(8, ("r"));
+ if (result & aSYSTEM) DEBUG(8, ("s"));
+ if (result & aDIR ) DEBUG(8, ("d"));
+ if (result & aARCH ) DEBUG(8, ("a"));
+ if (result & FILE_ATTRIBUTE_SPARSE ) DEBUG(8, ("[sparse]"));
+
+ DEBUG(8,("\n"));
+
+ return(result);
+}
+
+/****************************************************************************
Change a unix mode to a dos mode.
****************************************************************************/
Modified: trunk/source/smbd/trans2.c
===================================================================
--- trunk/source/smbd/trans2.c 2006-07-03 18:32:12 UTC (rev 16787)
+++ trunk/source/smbd/trans2.c 2006-07-03 21:07:26 UTC (rev 16788)
@@ -1091,6 +1091,8 @@
while (!found) {
BOOL got_match;
+ BOOL ms_dfs_link = False;
+
/* Needed if we run out of space */
long curr_dirpos = prev_dirpos = dptr_TellDir(conn->dirptr);
dname = dptr_ReadDirName(conn->dirptr,&curr_dirpos,&sbuf);
@@ -1154,8 +1156,7 @@
if(lp_host_msdfs() &&
lp_msdfs_root(SNUM(conn)) &&
- is_msdfs_link(NULL,conn, pathreal, NULL, NULL,
- &sbuf)) {
+ ((ms_dfs_link = is_msdfs_link(NULL,conn, pathreal, NULL, NULL, &sbuf)) == True)) {
DEBUG(5,("get_lanman2_dir_entry: Masquerading msdfs link %s as a directory\n", pathreal));
sbuf.st_mode = (sbuf.st_mode & 0xFFF) | S_IFDIR;
@@ -1168,7 +1169,11 @@
}
}
- mode = dos_mode(conn,pathreal,&sbuf);
+ if (ms_dfs_link) {
+ mode = dos_mode_msdfs(conn,pathreal,&sbuf);
+ } else {
+ mode = dos_mode(conn,pathreal,&sbuf);
+ }
if (!dir_check_ftype(conn,mode,dirtype)) {
DEBUG(5,("[%s] attribs didn't match %x\n",fname,dirtype));
More information about the samba-cvs
mailing list