[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hurd-commit
Subject:    hurd/libdiskfs ChangeLog dir-renamed.c
From:       Jeff Bailey <jbailey () nisa ! net>
Date:       2003-07-28 22:37:24
[Download RAW message or body]

CVSROOT:	/cvsroot/hurd
Module name:	hurd
Branch: 	
Changes by:	Jeff Bailey <jbailey@nisa.net>	03/07/28 18:37:24

Modified files:
	libdiskfs      : ChangeLog dir-renamed.c 

Log message:
	2003-06-11  Ognyan Kulev  <ogi@fmi.uni-sofia.bg>
	
	* dir-renamed.c (diskfs_rename_dir): Check permissions to remove
	FROMNAME before any modification could take place.  Check result
	of removing the from node.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libdiskfs/ChangeLog.diff?tr1=1.182&tr2=1.183&r1=text&r2=text
 http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/libdiskfs/dir-renamed.c.diff?tr1=1.22&tr2=1.23&r1=text&r2=text


Patches:
Index: hurd/libdiskfs/ChangeLog
diff -u hurd/libdiskfs/ChangeLog:1.182 hurd/libdiskfs/ChangeLog:1.183
--- hurd/libdiskfs/ChangeLog:1.182	Thu Jun 27 15:19:13 2002
+++ hurd/libdiskfs/ChangeLog	Mon Jul 28 18:37:24 2003
@@ -1,3 +1,9 @@
+2003-06-11  Ognyan Kulev  <ogi@fmi.uni-sofia.bg>
+	
+	* dir-renamed.c (diskfs_rename_dir): Check permissions to remove
+	FROMNAME before any modification could take place.  Check result
+	of removing the from node.
+
 2002-06-26  Marcus Brinkmann  <marcus@gnu.org>
 
 	* Makefile (DIST_FILES): Variable removed.
Index: hurd/libdiskfs/dir-renamed.c
diff -u hurd/libdiskfs/dir-renamed.c:1.22 hurd/libdiskfs/dir-renamed.c:1.23
--- hurd/libdiskfs/dir-renamed.c:1.22	Thu Oct 11 22:49:17 2001
+++ hurd/libdiskfs/dir-renamed.c	Mon Jul 28 18:37:24 2003
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1994,95,96,97,98,99,2001 Free Software Foundation, Inc.
+   Copyright (C) 1994,95,96,97,98,99,2001,2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -106,8 +106,15 @@
       return 0;
     }
 
-  /* Now we can safely lock fnp */
-  mutex_lock (&fnp->lock);
+  /* Check permissions to remove FROMNAME and lock FNP.  */
+  tmpds = alloca (diskfs_dirstat_size);
+  err = diskfs_lookup (fdp, fromname, REMOVE, &tmpnp, tmpds, fromcred);
+  assert (!tmpnp || tmpnp == fnp);
+  if (tmpnp)
+    diskfs_nrele (tmpnp);
+  diskfs_drop_dirstat (fdp, tmpds);
+  if (err)
+    goto out;
 
   if (tnp)
     {
@@ -199,8 +206,9 @@
   ds = buf;
   mutex_unlock (&fnp->lock);
   err = diskfs_lookup (fdp, fromname, REMOVE, &tmpnp, ds, fromcred);
-  assert (tmpnp == fnp);
-  diskfs_nrele (tmpnp);
+  assert (!tmpnp || tmpnp == fnp);
+  if (tmpnp)
+    diskfs_nrele (tmpnp);
   if (err)
     goto out;
 


_______________________________________________
Commit-hurd mailing list
Commit-hurd@gnu.org
http://mail.gnu.org/mailman/listinfo/commit-hurd


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic