Twaek for use of host well known names

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/devmodules/dev-libs/ec@35635 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2012-10-05 14:40:19 +00:00
parent a5cc8bba3f
commit f185875dc8
4 changed files with 32 additions and 5 deletions

View file

@ -2054,7 +2054,12 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
{
ctlName = @"Control";
}
ctlHost = [NSHost controlWellKnownName];
if (nil != (ctlHost = [NSHost controlWellKnownName]))
{
/* Map to operating system host name.
*/
ctlHost = [[NSHost hostWithWellKnownName: ctlHost] name];
}
if (nil == ctlHost)
{
ctlHost = @"*";

View file

@ -707,7 +707,10 @@ static BOOL commandIsRepeat (NSString *string)
{
name = @"Control";
}
host = [NSHost controlWellKnownName];
if (nil != (host = [NSHost controlWellKnownName]))
{
host = [[NSHost hostWithWellKnownName: host] name];
}
if (nil == host)
{
host = @"*";

View file

@ -2319,13 +2319,28 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
NSDictionary *conf;
NSDictionary *d;
NSArray *a;
NSString *base = [self cmdDataDirectory];
NSHost *host;
NSString *base;
NSString *path;
NSString *str;
unsigned count;
unsigned i;
BOOL changed = NO;
host = [NSHost currentHost];
str = [NSHost controlWellKnownName];
if (nil != str)
{
if (NO == [str isEqual: [host wellKnownName]])
{
NSLog(@"Well known name of Control host (%@) does not match"
@" that of current host (%@)", str, [host wellKnownName]);
[self cmdQuit: 1];
return NO;
}
}
base = [self cmdDataDirectory];
path = [base stringByAppendingPathComponent: @"AlertConfig.plist"];
if ([mgr isReadableFileAtPath: path] == YES
&& (d = [NSDictionary dictionaryWithContentsOfFile: path]) != nil)

View file

@ -457,6 +457,10 @@ ecHostName()
NSString *name;
[ecLock lock];
if (nil == hostName)
{
hostName = [[[NSHost currentHost] wellKnownName] retain];
}
name = [hostName retain];
[ecLock unlock];
return [name autorelease];
@ -1104,7 +1108,9 @@ static NSString *noFiles = @"No log files to archive";
if (nil != dict)
{
[NSHost setWellKnownNames: dict];
[ecLock lock];
ASSIGN(hostName, [[NSHost currentHost] wellKnownName]);
[ecLock unlock];
}
GSDebugAllocationActive([cmdDefs boolForKey: @"Memory"]);
@ -1373,8 +1379,6 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
stringClass = [NSString class];
cmdLogMap = [[NSMutableDictionary alloc] initWithCapacity: 4];
hostName = [[[NSHost currentHost] wellKnownName] retain];
cmdDebugModes = [[NSMutableSet alloc] initWithCapacity: 4];
cmdDebugKnown = [[NSMutableDictionary alloc] initWithCapacity: 4];