Merge from 1.4.0

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14208 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 2002-07-29 19:37:40 +00:00
parent 2a17d50744
commit b8e7170255
14 changed files with 260 additions and 91 deletions

View file

@ -1,7 +1,7 @@
Announcement
************
The GNUstep Base Library, version 1.3.4, is now available.
The GNUstep Base Library, version 1.4.0, is now available.
What is the GNUstep Base Library?
=================================
@ -19,22 +19,39 @@ portion of the OpenStep standard (the Foundation library).
There is more information available at the GNUstep homepage at
`http://www.gnustep.org'.
Noteworthy changes in version `1.3.4'
Noteworthy changes in version `1.4.0'
=====================================
This is a first pre-release version for 1.4.
Since the last stable release, several interface changes have been made.
You must recompile all libraries/tools/applications that depend on
gnustep-base to avoid any problems.
This version also fixes a potentially destructive bug in gdomap. All
users are urged to upgrade to this version as soon as possible.
* Rewrite of NSURL
* gdomap - don't write pidfile until after setuid away from root
* Add NSZombie class.
* New combined Unix/Windows version of NSFileHandle
* GC improvements
* Other fixes for Windows - DO now works on Windows
* New localization/internationalization tool make_strings
* libffi support.
* Traditional Chinese extensions added.
* New, partially finished Objective-C/Foundation programming manual.
* Runs on Darwin with GNU runtime.
* XML property lists
* gdomap - security bug fixes.
Where can you get it? How can you compile it?
==============================================
The gnustep-base-1.3.4.tar.gz distribution file has been placed on
The gnustep-base-1.4.0.tar.gz distribution file has been placed on
`ftp.gnustep.org' in `pub/gnustep/core'.
The library requires gcc 2.8.0 or higher. See the `GNUstep-HOWTO'

View file

@ -1,16 +1,54 @@
2002-07-29 Adam Fedor <fedor@gnu.org>
* Merge changes from 1.4.0 onto main branch.
2002-07-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSTcpHandle.m: Always use runloop in NSConnectionReplyMode
to avoid other NSDefaultRunLoopMode events being triggered while
executing a DO method. **EXPERIMENTAL**
2002-07-08 Richard Frith-Macdonald <rfm@gnu.org>
2002-07-27 Adam Fedor <fedor@gnu.org>
* Version: 1.4.0
* Source/NSFileManager.m: Don't standardise path before conferting to
filesystem representation ... that would follow links automatically,
and we mustn't do that.
* Tools/gdomap.c: Security enhancement ... call setgroups()
2002-07-23 Adam Fedor <fedor@gnu.org>
* Source/NSInvocation.m ([GSFrameInvocation
-initWithMethodSignature:]): Return nil if signature is nil.
* Source/GSFFCallInvocation.m (-initWithMethodSignature:): Idem.
* Source/GSFFIInvocation (-initWithMethodSignature:): Idem.
2002-07-20 Adam Fedor <fedor@gnu.org>
* Source/NSDecimal.m: ifdef for compiling on Darwin (report
from Carl Eugen).
* Source/NSInvocation.m ([-initWithSelector:): Rewrite to use
designated initializer.
(-initWithTarget:selector:): Idem.
2002-07-18 Adam Fedor <fedor@gnu.org>
* Tools/gdomap.c (main): Write the pidfile before switching away
from root, but only if the user is root.
2002-07-17 Adam Fedor <fedor@gnu.org>
* Source/NSString.m (-getLineStart:end:contentsEnd:forRange:): Fix
lineEnd and contentEnd check for \r\n (particularly at end of
string.
Tue Jul 16 16:43:59 2002 Nicola Pero <n.pero@mi.flashnet.it>
* Headers/gnustep/base/GSXML.h ([GSXMLNode -setNamespace:]): Added
missing method essential to use namespaces.
* Source/Additions/GSXML.m ([GSXMLNode -setNamespace:]): Implemented.
2002-07-08 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileManager.m: Don't standardise path before converting to
filesystem representation.
* Tools/gdomap.c: Security enhancement - call setgroups().
2002-07-03 Adam Fedor <fedor@gnu.org>

View file

@ -9,6 +9,16 @@ The currently released version of the library is
@samp{@value{GNUSTEP-BASE-VERSION}}.
@end ifclear
@section Noteworthy changes in version @samp{1.4.0}
@itemize @bullet
@item gdomap - security bug fixes.
@end itemize
@c ====================================================================
@c Keep the next line just below the list of changes in most recent version.
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{1.3.4}
This is a first pre-release version for 1.4.
@ -21,10 +31,6 @@ users are urged to upgrade to this version as soon as possible.
@item New combined Unix/Windows version of NSFileHandle
@end itemize
@c ====================================================================
@c Keep the next line just below the list of changes in most recent version.
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{1.3.3}
Note there are interface and binary changes in this release that

View file

@ -137,6 +137,7 @@
- (void) setObject: (NSString*)value forKey:(NSString*)key;
- (int) type;
- (NSString*) typeDescription;
- (void) setNamespace: (GSXMLNamespace *)space;
@end

7
NEWS
View file

@ -1,7 +1,12 @@
News
****
The currently released version of the library is `1.3.4'.
The currently released version of the library is `1.4.0'.
Noteworthy changes in version `1.4.0'
=====================================
* gdomap - security bug fixes.
Noteworthy changes in version `1.3.4'
=====================================

View file

@ -1296,6 +1296,11 @@ static NSMapTable *nodeNames = 0;
return desc;
}
- (void) setNamespace: (GSXMLNamespace *)space
{
xmlSetNs (lib, [space lib]);
}
@end
@implementation GSXMLNode (GSPrivate)

View file

@ -469,6 +469,11 @@ static IMP gs_objc_msg_forward (SEL sel)
*/
- (id) initWithMethodSignature: (NSMethodSignature*)aSignature
{
if (aSignature == nil)
{
RELEASE(self);
return nil;
}
_sig = RETAIN(aSignature);
_numArgs = [aSignature numberOfArguments];
_info = [aSignature methodInfo];

View file

@ -204,6 +204,11 @@ static IMP gs_objc_msg_forward (SEL sel)
*/
- (id) initWithMethodSignature: (NSMethodSignature*)aSignature
{
if (aSignature == nil)
{
RELEASE(self);
return nil;
}
_sig = RETAIN(aSignature);
_numArgs = [aSignature numberOfArguments];
_info = [aSignature methodInfo];

View file

@ -26,7 +26,9 @@
*/
#include <math.h>
#if !defined(__APPLE__) || !defined(GNU_RUNTIME)
#include <ctype.h>
#endif
#include <Foundation/NSDecimal.h>
#include <Foundation/NSString.h>
#include <Foundation/NSDictionary.h>

View file

@ -255,7 +255,9 @@ static NSFileManager* defaultManager = nil;
const char *cpath;
cpath = [self fileSystemRepresentationWithPath: completePath];
if (CreateDirectory(cpath, NULL) == FALSE)
return NO;
{
return NO;
}
}
}
@ -487,11 +489,14 @@ static NSFileManager* defaultManager = nil;
fileExists = [self fileExistsAtPath: source isDirectory: &sourceIsDir];
if (!fileExists)
return NO;
{
return NO;
}
fileExists = [self fileExistsAtPath: destination];
if (fileExists)
return NO;
{
return NO;
}
/* Check to see if the source and destination's parent are on the same
physical device so we can perform a rename syscall directly. */
@ -591,18 +596,24 @@ static NSFileManager* defaultManager = nil;
res = GetFileAttributes(cpath);
if (res == WIN32ERR)
return NO;
{
return NO;
}
if (res & FILE_ATTRIBUTE_DIRECTORY)
is_dir = YES;
{
is_dir = YES;
}
else
is_dir = NO;
{
is_dir = NO;
}
#else
struct stat statbuf;
if (lstat(cpath, &statbuf) != 0)
return NO;
{
return NO;
}
is_dir = ((statbuf.st_mode & S_IFMT) == S_IFDIR);
#endif /* MINGW */
}
@ -631,11 +642,15 @@ static NSFileManager* defaultManager = nil;
RELEASE(info);
}
else
result = NO;
{
result = NO;
}
return result;
}
else
return YES;
{
return YES;
}
}
else
{
@ -655,7 +670,9 @@ static NSFileManager* defaultManager = nil;
result = [self removeFileAtPath: next handler: handler];
RELEASE(arp);
if (result == NO)
return NO;
{
return NO;
}
}
if (rmdir([path fileSystemRepresentation]) < 0)
@ -676,11 +693,15 @@ static NSFileManager* defaultManager = nil;
RELEASE(info);
}
else
result = NO;
{
result = NO;
}
return result;
}
else
return YES;
{
return YES;
}
}
}
@ -892,14 +913,18 @@ static NSFileManager* defaultManager = nil;
const char* cpath = [self fileSystemRepresentationWithPath: path];
if (cpath == 0 || *cpath == '\0')
return NO;
{
return NO;
}
else
{
#if defined(__MINGW__)
DWORD res= GetFileAttributes(cpath);
if (res == WIN32ERR)
return NO;
{
return NO;
}
return YES;
#else
return (access(cpath, R_OK) == 0);
@ -912,14 +937,17 @@ static NSFileManager* defaultManager = nil;
const char* cpath = [self fileSystemRepresentationWithPath: path];
if (cpath == 0 || *cpath == '\0')
return NO;
{
return NO;
}
else
{
#if defined(__MINGW__)
DWORD res= GetFileAttributes(cpath);
if (res == WIN32ERR)
return NO;
{
return NO;
return (res & FILE_ATTRIBUTE_READONLY) ? NO : YES;
#else
return (access(cpath, W_OK) == 0);
@ -959,7 +987,9 @@ static NSFileManager* defaultManager = nil;
const char* cpath = [self fileSystemRepresentationWithPath: path];
if (cpath == 0 || *cpath == '\0')
return NO;
{
return NO;
}
else
{
// TODO - handle directories
@ -967,7 +997,9 @@ static NSFileManager* defaultManager = nil;
DWORD res= GetFileAttributes(cpath);
if (res == WIN32ERR)
return NO;
{
return NO;
}
return (res & FILE_ATTRIBUTE_READONLY) ? NO : YES;
#else
cpath = [self fileSystemRepresentationWithPath:
@ -1216,8 +1248,9 @@ static NSFileManager* defaultManager = nil;
* See if this is a directory (don't follow links).
*/
if ([self fileExistsAtPath: path isDirectory: &is_dir] == NO || is_dir == NO)
return nil;
{
return nil;
}
/* We initialize the directory enumerator with justContents == YES,
which tells the NSDirectoryEnumerator code that we only enumerate
the contents non-recursively once, and exit. NSDirectoryEnumerator
@ -1232,8 +1265,9 @@ static NSFileManager* defaultManager = nil;
addImp = [content methodForSelector: @selector(addObject:)];
while ((path = (*nxtImp)(direnum, @selector(nextObject))) != nil)
(*addImp)(content, @selector(addObject:), path);
{
(*addImp)(content, @selector(addObject:), path);
}
RELEASE(direnum);
return content;
@ -1257,8 +1291,9 @@ static NSFileManager* defaultManager = nil;
IMP addImp;
if (![self fileExistsAtPath: path isDirectory: &isDir] || !isDir)
return nil;
{
return nil;
}
direnum = [[NSDirectoryEnumerator alloc] initWithDirectoryPath: path
recurseIntoSubdirectories: YES
followSymlinks: NO
@ -1301,9 +1336,13 @@ static NSFileManager* defaultManager = nil;
int llen = readlink(cpath, lpath, PATH_MAX-1);
if (llen > 0)
return [self stringWithFileSystemRepresentation: lpath length: llen];
{
return [self stringWithFileSystemRepresentation: lpath length: llen];
}
else
return nil;
{
return nil;
}
#else
return nil;
#endif
@ -1414,7 +1453,12 @@ static NSFileManager* defaultManager = nil;
newpath = [newpath stringByReplacingString: @"/" withString: @"\\"];
return [newpath cString];
#else
return [[path stringByStandardizingPath] cString];
/*
* NB ... Don't standardize path, since that would automatically
* follow symbolic links ... and mess up any code wishing to
* examine the link itsself.
*/
return [path cString];
#endif
}

View file

@ -631,19 +631,45 @@ _arg_addr(NSInvocation *inv, int index)
- (id) initWithSelector: (SEL)aSelector
{
return [self initWithArgframe: 0 selector: aSelector];
const char *types;
NSMethodSignature *newSig;
types = sel_get_type(aSelector);
if (types == 0)
{
types = sel_get_type(sel_get_any_typed_uid(sel_get_name(aSelector)));
}
if (types == 0)
{
NSLog(@"Couldn't find encoding type for selector %s.",
sel_get_name(aSelector));
RELEASE(self);
return nil;
}
newSig = [NSMethodSignature signatureWithObjCTypes: types];
return [self initWithMethodSignature: newSig];
}
- (id) initWithTarget: anObject selector: (SEL)aSelector, ...
{
va_list ap;
va_list ap;
NSMethodSignature *newSig;
self = [self initWithArgframe: 0 selector: aSelector];
if (anObject)
{
newSig = [anObject methodSignatureForSelector: aSelector];
self = [self initWithMethodSignature: newSig];
}
else
{
self = [self initWithSelector: aSelector];
}
if (self)
{
int i;
[self setTarget: anObject];
[self setSelector: aSelector];
va_start (ap, aSelector);
for (i = 3; i <= _numArgs; i++)
{
@ -758,22 +784,7 @@ _arg_addr(NSInvocation *inv, int index)
- (id) initWithArgframe: (arglist_t)frame selector: (SEL)aSelector
{
const char *types;
NSMethodSignature *newSig;
types = sel_get_type(aSelector);
if (types == 0)
{
types = sel_get_type(sel_get_any_typed_uid(sel_get_name(aSelector)));
}
if (types == 0)
{
[NSException raise: NSInvalidArgumentException
format: @"Couldn't find encoding type for selector %s.",
sel_get_name(aSelector)];
}
newSig = [NSMethodSignature signatureWithObjCTypes: types];
self = [self initWithMethodSignature: newSig];
self = [self initWithSelector: aSelector];
if (self)
{
[self setSelector: aSelector];
@ -799,6 +810,11 @@ _arg_addr(NSInvocation *inv, int index)
*/
- (id) initWithMethodSignature: (NSMethodSignature*)aSignature
{
if (aSignature == nil)
{
RELEASE(self);
return nil;
}
_sig = RETAIN(aSignature);
_numArgs = [aSignature numberOfArguments];
_info = [aSignature methodInfo];

View file

@ -1840,7 +1840,7 @@ handle_printf_atsign (FILE *stream,
forRange: (NSRange)aRange
{
unichar thischar;
unsigned start, end, len;
unsigned start, end, len, termlen;
unichar (*caiImp)(NSString*, SEL, unsigned int);
len = [self length];
@ -1903,10 +1903,10 @@ handle_printf_atsign (FILE *stream,
if (lineEndIndex || contentsEndIndex)
{
BOOL found = NO;
end = aRange.location + aRange.length;
while (end < len)
{
BOOL done = NO;
thischar = (*caiImp)(self, caiSel, end);
switch (thischar)
@ -1915,22 +1915,24 @@ handle_printf_atsign (FILE *stream,
case (unichar)0x000D:
case (unichar)0x2028:
case (unichar)0x2029:
done = YES;
found = YES;
break;
default:
break;
}
end++;
if (done)
if (found)
break;
}
termlen = 1;
if (lineEndIndex)
{
if (end < len
&& ((*caiImp)(self, caiSel, end) == (unichar)0x000D)
&& ((*caiImp)(self, caiSel, end+1) == (unichar)0x000A))
&& ((*caiImp)(self, caiSel, end-1) == (unichar)0x000D)
&& ((*caiImp)(self, caiSel, end) == (unichar)0x000A))
{
*lineEndIndex = end+1;
termlen = 2;
}
else
{
@ -1939,9 +1941,9 @@ handle_printf_atsign (FILE *stream,
}
if (contentsEndIndex)
{
if (end < len)
if (found)
{
*contentsEndIndex = end-1;
*contentsEndIndex = end-termlen;
}
else
{

View file

@ -35,6 +35,7 @@
#ifndef __MINGW__
#include <sys/param.h> /* for MAXHOSTNAMELEN */
#include <sys/types.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h> /* for inet_ntoa() */
#endif /* !__MINGW__ */
@ -63,6 +64,9 @@
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
#if HAVE_GETOPT_H
#include <getopt.h>
@ -4531,6 +4535,34 @@ printf(
}
}
/* Write the pidfile, but only if the user is root. This allows us
to write to restricted directories without allowing normal users
to mess it up. */
if (pidfile)
{
FILE *fptr;
if (getuid () == 0)
{
fptr = fopen(pidfile, "at");
if (fptr == 0)
{
sprintf(ebuf, "Unable to open pid file - '%s'", pidfile);
gdomap_log(LOG_CRIT);
exit(1);
}
fprintf(fptr, "%d\n", (int) getpid());
fclose(fptr);
chmod(pidfile, 0644);
}
else
{
sprintf(ebuf, "Only root user can write to pid file\n");
gdomap_log(LOG_WARNING);
}
}
#ifndef __MINGW__
/*
* Try to become a 'safe' user now that we have
@ -4542,10 +4574,12 @@ printf(
* Try to be the user who launched us ... so they can kill us too.
*/
setuid (getuid ());
setgid (getgid ());
}
else
{
int uid = -2;
int gid = -2;
#ifdef HAVE_PWD_H
#ifdef HAVE_GETPWNAM
struct passwd *pw = getpwnam("nobody");
@ -4553,27 +4587,16 @@ printf(
if (pw != 0)
{
uid = pw->pw_uid;
gid = pw->pw_gid;
}
#endif
#endif
setuid (uid);
setgid (gid);
setgroups (0, 0); /* Empty additional groups list */
}
#endif /* __MINGW__ */
if (pidfile)
{
FILE *fptr = fopen(pidfile, "at");
if (fptr == 0)
{
sprintf(ebuf, "Unable to open pid file - '%s'", pidfile);
gdomap_log(LOG_CRIT);
exit(1);
}
fprintf(fptr, "%d\n", (int) getpid());
fclose(fptr);
}
#if !defined(__svr4__)
/*
* As another level of paranoia - restrict this process to /tmp

View file

@ -6,8 +6,8 @@ GCC_VERSION=2.8.0
# The version number of this release.
MAJOR_VERSION=1
MINOR_VERSION=3
SUBMINOR_VERSION=4
MINOR_VERSION=4
SUBMINOR_VERSION=0
GNUSTEP_BASE_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
VERSION=${GNUSTEP_BASE_VERSION}