mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-22 03:11:16 +00:00
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:
parent
a5cc8bba3f
commit
f185875dc8
4 changed files with 32 additions and 5 deletions
|
@ -2054,7 +2054,12 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
||||||
{
|
{
|
||||||
ctlName = @"Control";
|
ctlName = @"Control";
|
||||||
}
|
}
|
||||||
ctlHost = [NSHost controlWellKnownName];
|
if (nil != (ctlHost = [NSHost controlWellKnownName]))
|
||||||
|
{
|
||||||
|
/* Map to operating system host name.
|
||||||
|
*/
|
||||||
|
ctlHost = [[NSHost hostWithWellKnownName: ctlHost] name];
|
||||||
|
}
|
||||||
if (nil == ctlHost)
|
if (nil == ctlHost)
|
||||||
{
|
{
|
||||||
ctlHost = @"*";
|
ctlHost = @"*";
|
||||||
|
|
|
@ -707,7 +707,10 @@ static BOOL commandIsRepeat (NSString *string)
|
||||||
{
|
{
|
||||||
name = @"Control";
|
name = @"Control";
|
||||||
}
|
}
|
||||||
host = [NSHost controlWellKnownName];
|
if (nil != (host = [NSHost controlWellKnownName]))
|
||||||
|
{
|
||||||
|
host = [[NSHost hostWithWellKnownName: host] name];
|
||||||
|
}
|
||||||
if (nil == host)
|
if (nil == host)
|
||||||
{
|
{
|
||||||
host = @"*";
|
host = @"*";
|
||||||
|
|
17
EcControl.m
17
EcControl.m
|
@ -2319,13 +2319,28 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
||||||
NSDictionary *conf;
|
NSDictionary *conf;
|
||||||
NSDictionary *d;
|
NSDictionary *d;
|
||||||
NSArray *a;
|
NSArray *a;
|
||||||
NSString *base = [self cmdDataDirectory];
|
NSHost *host;
|
||||||
|
NSString *base;
|
||||||
NSString *path;
|
NSString *path;
|
||||||
NSString *str;
|
NSString *str;
|
||||||
unsigned count;
|
unsigned count;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
BOOL changed = NO;
|
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"];
|
path = [base stringByAppendingPathComponent: @"AlertConfig.plist"];
|
||||||
if ([mgr isReadableFileAtPath: path] == YES
|
if ([mgr isReadableFileAtPath: path] == YES
|
||||||
&& (d = [NSDictionary dictionaryWithContentsOfFile: path]) != nil)
|
&& (d = [NSDictionary dictionaryWithContentsOfFile: path]) != nil)
|
||||||
|
|
|
@ -457,6 +457,10 @@ ecHostName()
|
||||||
NSString *name;
|
NSString *name;
|
||||||
|
|
||||||
[ecLock lock];
|
[ecLock lock];
|
||||||
|
if (nil == hostName)
|
||||||
|
{
|
||||||
|
hostName = [[[NSHost currentHost] wellKnownName] retain];
|
||||||
|
}
|
||||||
name = [hostName retain];
|
name = [hostName retain];
|
||||||
[ecLock unlock];
|
[ecLock unlock];
|
||||||
return [name autorelease];
|
return [name autorelease];
|
||||||
|
@ -1104,7 +1108,9 @@ static NSString *noFiles = @"No log files to archive";
|
||||||
if (nil != dict)
|
if (nil != dict)
|
||||||
{
|
{
|
||||||
[NSHost setWellKnownNames: dict];
|
[NSHost setWellKnownNames: dict];
|
||||||
|
[ecLock lock];
|
||||||
ASSIGN(hostName, [[NSHost currentHost] wellKnownName]);
|
ASSIGN(hostName, [[NSHost currentHost] wellKnownName]);
|
||||||
|
[ecLock unlock];
|
||||||
}
|
}
|
||||||
|
|
||||||
GSDebugAllocationActive([cmdDefs boolForKey: @"Memory"]);
|
GSDebugAllocationActive([cmdDefs boolForKey: @"Memory"]);
|
||||||
|
@ -1373,8 +1379,6 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
|
||||||
stringClass = [NSString class];
|
stringClass = [NSString class];
|
||||||
cmdLogMap = [[NSMutableDictionary alloc] initWithCapacity: 4];
|
cmdLogMap = [[NSMutableDictionary alloc] initWithCapacity: 4];
|
||||||
|
|
||||||
hostName = [[[NSHost currentHost] wellKnownName] retain];
|
|
||||||
|
|
||||||
cmdDebugModes = [[NSMutableSet alloc] initWithCapacity: 4];
|
cmdDebugModes = [[NSMutableSet alloc] initWithCapacity: 4];
|
||||||
cmdDebugKnown = [[NSMutableDictionary alloc] initWithCapacity: 4];
|
cmdDebugKnown = [[NSMutableDictionary alloc] initWithCapacity: 4];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue