Author pitrou
Recipients eric.araujo, mrts, pitrou, rosslagerwall, schmir, tarek, teamnoir
Date 2011-01-05.17:06:01
SpamBayes Score 1.05314e-07
Marked as misclassified No
Message-id <1294247158.3701.14.camel@localhost.localdomain>
In-reply-to <1294246698.05.0.388210070558.issue4489@psf.upfronthosting.co.za>
Content
Le mercredi 05 janvier 2011 à 16:58 +0000, Ross Lagerwall a écrit :
> Ross Lagerwall <rosslagerwall@gmail.com> added the comment:
> 
> Updated patch removes the race condition. Since an open follows symlinks, you can't just fstat the fd to see if it is a link. I followed the following to overcome this:
> https://www.securecoding.cert.org/confluence/display/seccode/POS35-C.+Avoid+race+conditions+while+checking+for+the+existence+of+a+symbolic+link

Nice. I am unsure about the following piece of code:

+        if stat.S_ISDIR(mode):
+            if stat.S_ISLNK(mode):
+                try:
+                    raise OSError("Cannot call rmtree on a symbolic
link")
+                except OSError:
+                    onerror(os.fstatat, (dirfd, name), sys.exc_info())

If rmtree() encounters a symlink *inside* the tree, I would expect it to
simply remove the symlink, rather than choke and abort (it's also what
the unsafe implementation does).
History
Date User Action Args
2011-01-05 17:06:04pitrousetrecipients: + pitrou, schmir, tarek, eric.araujo, mrts, teamnoir, rosslagerwall
2011-01-05 17:06:01pitroulinkissue4489 messages
2011-01-05 17:06:01pitroucreate