svn commit: samba r23501 - in branches: SAMBA_3_0/source/smbd SAMBA_3_0_26/source/smbd

vlendec at samba.org vlendec at samba.org
Thu Jun 14 15:50:48 GMT 2007


Author: vlendec
Date: 2007-06-14 15:50:47 +0000 (Thu, 14 Jun 2007)
New Revision: 23501

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23501

Log:
Move notify_rename before rename_internals_fsp and call it from there.

Modified:
   branches/SAMBA_3_0/source/smbd/reply.c
   branches/SAMBA_3_0_26/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/reply.c	2007-06-14 14:45:37 UTC (rev 23500)
+++ branches/SAMBA_3_0/source/smbd/reply.c	2007-06-14 15:50:47 UTC (rev 23501)
@@ -4230,6 +4230,48 @@
 	return ((memcmp(psrc, pdst, slen) == 0) && pdst[slen] == '/');
 }
 
+/*
+ * Do the notify calls from a rename
+ */
+
+static void notify_rename(connection_struct *conn, BOOL is_dir,
+			  const char *oldpath, const char *newpath)
+{
+	char *olddir, *newdir;
+	const char *oldname, *newname;
+	uint32 mask;
+
+	mask = is_dir ? FILE_NOTIFY_CHANGE_DIR_NAME
+		: FILE_NOTIFY_CHANGE_FILE_NAME;
+
+	if (!parent_dirname_talloc(NULL, oldpath, &olddir, &oldname)
+	    || !parent_dirname_talloc(NULL, newpath, &newdir, &newname)) {
+		TALLOC_FREE(olddir);
+		return;
+	}
+
+	if (strcmp(olddir, newdir) == 0) {
+		notify_fname(conn, NOTIFY_ACTION_OLD_NAME, mask, oldpath);
+		notify_fname(conn, NOTIFY_ACTION_NEW_NAME, mask, newpath);
+	}
+	else {
+		notify_fname(conn, NOTIFY_ACTION_REMOVED, mask, oldpath);
+		notify_fname(conn, NOTIFY_ACTION_ADDED, mask, newpath);
+	}
+	TALLOC_FREE(olddir);
+	TALLOC_FREE(newdir);
+
+	/* this is a strange one. w2k3 gives an additional event for
+	   CHANGE_ATTRIBUTES and CHANGE_CREATION on the new file when renaming
+	   files, but not directories */
+	if (!is_dir) {
+		notify_fname(conn, NOTIFY_ACTION_MODIFIED,
+			     FILE_NOTIFY_CHANGE_ATTRIBUTES
+			     |FILE_NOTIFY_CHANGE_CREATION,
+			     newpath);
+	}
+}
+
 /****************************************************************************
  Rename an open file - given an fsp.
 ****************************************************************************/
@@ -4366,6 +4408,8 @@
 
 		rename_open_files(conn, lck, newname);
 
+		notify_rename(conn, fsp->is_directory, fsp->fsp_name, newname);
+
 		/*
 		 * A rename acts as a new file create w.r.t. allowing an initial delete
 		 * on close, probably because in Windows there is a new handle to the
@@ -4404,48 +4448,6 @@
 	return status;
 }
 
-/*
- * Do the notify calls from a rename
- */
-
-static void notify_rename(connection_struct *conn, BOOL is_dir,
-			  const char *oldpath, const char *newpath)
-{
-	char *olddir, *newdir;
-	const char *oldname, *newname;
-	uint32 mask;
-
-	mask = is_dir ? FILE_NOTIFY_CHANGE_DIR_NAME
-		: FILE_NOTIFY_CHANGE_FILE_NAME;
-
-	if (!parent_dirname_talloc(NULL, oldpath, &olddir, &oldname)
-	    || !parent_dirname_talloc(NULL, newpath, &newdir, &newname)) {
-		TALLOC_FREE(olddir);
-		return;
-	}
-
-	if (strcmp(olddir, newdir) == 0) {
-		notify_fname(conn, NOTIFY_ACTION_OLD_NAME, mask, oldpath);
-		notify_fname(conn, NOTIFY_ACTION_NEW_NAME, mask, newpath);
-	}
-	else {
-		notify_fname(conn, NOTIFY_ACTION_REMOVED, mask, oldpath);
-		notify_fname(conn, NOTIFY_ACTION_ADDED, mask, newpath);
-	}
-	TALLOC_FREE(olddir);
-	TALLOC_FREE(newdir);
-
-	/* this is a strange one. w2k3 gives an additional event for
-	   CHANGE_ATTRIBUTES and CHANGE_CREATION on the new file when renaming
-	   files, but not directories */
-	if (!is_dir) {
-		notify_fname(conn, NOTIFY_ACTION_MODIFIED,
-			     FILE_NOTIFY_CHANGE_ATTRIBUTES
-			     |FILE_NOTIFY_CHANGE_CREATION,
-			     newpath);
-	}
-}
-
 /****************************************************************************
  The guts of the rename command, split out so it may be called by the NT SMB
  code. 

Modified: branches/SAMBA_3_0_26/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0_26/source/smbd/reply.c	2007-06-14 14:45:37 UTC (rev 23500)
+++ branches/SAMBA_3_0_26/source/smbd/reply.c	2007-06-14 15:50:47 UTC (rev 23501)
@@ -4228,6 +4228,48 @@
 	return ((memcmp(psrc, pdst, slen) == 0) && pdst[slen] == '/');
 }
 
+/*
+ * Do the notify calls from a rename
+ */
+
+static void notify_rename(connection_struct *conn, BOOL is_dir,
+			  const char *oldpath, const char *newpath)
+{
+	char *olddir, *newdir;
+	const char *oldname, *newname;
+	uint32 mask;
+
+	mask = is_dir ? FILE_NOTIFY_CHANGE_DIR_NAME
+		: FILE_NOTIFY_CHANGE_FILE_NAME;
+
+	if (!parent_dirname_talloc(NULL, oldpath, &olddir, &oldname)
+	    || !parent_dirname_talloc(NULL, newpath, &newdir, &newname)) {
+		TALLOC_FREE(olddir);
+		return;
+	}
+
+	if (strcmp(olddir, newdir) == 0) {
+		notify_fname(conn, NOTIFY_ACTION_OLD_NAME, mask, oldpath);
+		notify_fname(conn, NOTIFY_ACTION_NEW_NAME, mask, newpath);
+	}
+	else {
+		notify_fname(conn, NOTIFY_ACTION_REMOVED, mask, oldpath);
+		notify_fname(conn, NOTIFY_ACTION_ADDED, mask, newpath);
+	}
+	TALLOC_FREE(olddir);
+	TALLOC_FREE(newdir);
+
+	/* this is a strange one. w2k3 gives an additional event for
+	   CHANGE_ATTRIBUTES and CHANGE_CREATION on the new file when renaming
+	   files, but not directories */
+	if (!is_dir) {
+		notify_fname(conn, NOTIFY_ACTION_MODIFIED,
+			     FILE_NOTIFY_CHANGE_ATTRIBUTES
+			     |FILE_NOTIFY_CHANGE_CREATION,
+			     newpath);
+	}
+}
+
 /****************************************************************************
  Rename an open file - given an fsp.
 ****************************************************************************/
@@ -4364,6 +4406,8 @@
 
 		rename_open_files(conn, lck, newname);
 
+		notify_rename(conn, fsp->is_directory, fsp->fsp_name, newname);
+
 		/*
 		 * A rename acts as a new file create w.r.t. allowing an initial delete
 		 * on close, probably because in Windows there is a new handle to the
@@ -4402,48 +4446,6 @@
 	return status;
 }
 
-/*
- * Do the notify calls from a rename
- */
-
-static void notify_rename(connection_struct *conn, BOOL is_dir,
-			  const char *oldpath, const char *newpath)
-{
-	char *olddir, *newdir;
-	const char *oldname, *newname;
-	uint32 mask;
-
-	mask = is_dir ? FILE_NOTIFY_CHANGE_DIR_NAME
-		: FILE_NOTIFY_CHANGE_FILE_NAME;
-
-	if (!parent_dirname_talloc(NULL, oldpath, &olddir, &oldname)
-	    || !parent_dirname_talloc(NULL, newpath, &newdir, &newname)) {
-		TALLOC_FREE(olddir);
-		return;
-	}
-
-	if (strcmp(olddir, newdir) == 0) {
-		notify_fname(conn, NOTIFY_ACTION_OLD_NAME, mask, oldpath);
-		notify_fname(conn, NOTIFY_ACTION_NEW_NAME, mask, newpath);
-	}
-	else {
-		notify_fname(conn, NOTIFY_ACTION_REMOVED, mask, oldpath);
-		notify_fname(conn, NOTIFY_ACTION_ADDED, mask, newpath);
-	}
-	TALLOC_FREE(olddir);
-	TALLOC_FREE(newdir);
-
-	/* this is a strange one. w2k3 gives an additional event for
-	   CHANGE_ATTRIBUTES and CHANGE_CREATION on the new file when renaming
-	   files, but not directories */
-	if (!is_dir) {
-		notify_fname(conn, NOTIFY_ACTION_MODIFIED,
-			     FILE_NOTIFY_CHANGE_ATTRIBUTES
-			     |FILE_NOTIFY_CHANGE_CREATION,
-			     newpath);
-	}
-}
-
 /****************************************************************************
  The guts of the rename command, split out so it may be called by the NT SMB
  code. 



More information about the samba-cvs mailing list