temporary directory improvement

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35393 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2012-08-10 14:31:28 +00:00
parent 48ed95b668
commit 5904a38efd
2 changed files with 14 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2012-08-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPathUtilities.m:
Fix permissions on temporary directory rarther than just failing ...
suggestion by Wolfgang.
2012-08-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileManager.m: ([-createDirectoryAtPath:attributes:])

View file

@ -1989,6 +1989,10 @@ NSTemporaryDirectory(void)
if ((perm != 0700 && perm != 0600) || owner != uid)
{
NSString *secure;
NSNumber *p = [NSNumber numberWithInt: 0700];
attr = [NSDictionary dictionaryWithObject: p
forKey: NSFilePosixPermissions];
/*
* The name of the secure subdirectory reflects the user ID rather
@ -2003,10 +2007,6 @@ NSTemporaryDirectory(void)
if ([manager fileExistsAtPath: tempDirName] == NO)
{
NSNumber *p = [NSNumber numberWithInt: 0700];
attr = [NSDictionary dictionaryWithObject: p
forKey: NSFilePosixPermissions];
if ([manager createDirectoryAtPath: tempDirName
withIntermediateDirectories: YES
attributes: attr
@ -2017,6 +2017,10 @@ NSTemporaryDirectory(void)
return nil;
}
}
else
{
[manager changeFileAttributes: attr atPath: tempDirName];
}
/*
* Check that the new directory is really secure.