From db915f26f57d847563b23512e11f850f644dbca5 Mon Sep 17 00:00:00 2001 From: Patrick Wardle Date: Sun, 28 Feb 2016 12:01:51 -1000 Subject: [PATCH] added extra checks on DNS resolution for optimizations removed logic to ignore 'access denied/file not found' - since we might just not have perms, but still want to show em! --- Items/Connection.m | 24 ++++++++---------------- Items/File.m | 14 -------------- RequestRootWindowController.m | 4 ++-- Task.m | 30 ------------------------------ 4 files changed, 10 insertions(+), 62 deletions(-) diff --git a/Items/Connection.m b/Items/Connection.m index cb570f6..19a2127 100644 --- a/Items/Connection.m +++ b/Items/Connection.m @@ -53,19 +53,15 @@ //set icon [self setConnectionIcon]; - //resolve in background - //dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ - - //resolve - [self addressesForHost]; - + //resolve DNS names + if(nil != self.remoteIPAddr) + { + //resolve + [self addressesForHost]; + } //build/set connection string [self setConnectionString]; - - //}); - - } return self; @@ -109,9 +105,8 @@ self.icon = [NSImage imageNamed:@"closedIcon"]; } - //TODO: set other icon? - //YES: close-wait!!! - + //by design, other connection states won't have an icon + // TODO: maybe add other icons? } //set icon for UDP sockets @@ -125,7 +120,6 @@ return; } - //resolve a remote IP address to nice DNS name // ->uses address and port, which are passed to getaddrinfo // note: call from bg thread, cuz it can be slow due to DNS resolution(s) @@ -143,7 +137,6 @@ return; } - //build printable connection string -(void)setConnectionString { @@ -169,7 +162,6 @@ return; } - //convert Connection object to a JSON string -(NSString*)toJSON { diff --git a/Items/File.m b/Items/File.m index 5066cec..097f018 100644 --- a/Items/File.m +++ b/Items/File.m @@ -25,19 +25,6 @@ self = [super initWithParams:params]; if(self) { - //always skip not-existent paths - if(YES != [[NSFileManager defaultManager] fileExistsAtPath:params[KEY_RESULT_PATH]]) - { - //err msg - //syslog(LOG_ERR, "OBJECTIVE-SEE ERROR: %s not found", [params[KEY_RESULT_PATH] UTF8String]); - - //set self to nil - self = nil; - - //bail - goto bail; - } - //extract name self.name = [[self.path lastPathComponent] stringByDeletingPathExtension]; @@ -46,7 +33,6 @@ //grab attributes self.attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.path error:nil]; - } //bail diff --git a/RequestRootWindowController.m b/RequestRootWindowController.m index 8c3d20e..8f0b450 100644 --- a/RequestRootWindowController.m +++ b/RequestRootWindowController.m @@ -153,10 +153,10 @@ installArgs[0] = "-R"; //2nd arg: permissions - // ->4 at front is setuid + // ->note: 4 at front is setuid //TODO: change b4 release // ->make 4755 before deploy (for testing, 777 makes Xcode be able to del it during build!) - installArgs[1] = "4777"; + installArgs[1] = "4755"; //3rd arg: XPC service installArgs[2] = [xpcService UTF8String]; diff --git a/Task.m b/Task.m index 59bef5b..b58671c 100644 --- a/Task.m +++ b/Task.m @@ -525,29 +525,12 @@ bail: //alloc/init File obj file = [[File alloc] initWithParams:@{KEY_RESULT_PATH:filePath}]; - //skip nil files - //TODO: look into what files err out!! - if(nil == file) - { - //next - continue; - } - //sync @synchronized(self.files) { //add to task's files [self.files addObject:file]; } - - /* - //save new files - if(nil == [((AppDelegate*)[[NSApplication sharedApplication] delegate]).taskEnumerator.files objectForKey:filePath]) - { - //save as new - [newFiles addObject:file]; - } - */ } //sort by name @@ -563,19 +546,6 @@ bail: }//sync - /* ...don't need to process as search is done via task iteration - //process all new files - // ->determine type, etc & save into global list - for(File* newFile in newFiles) - { - //sync - @synchronized(((AppDelegate*)[[NSApplication sharedApplication] delegate]).taskEnumerator.files) - { - //save into global list - [((AppDelegate*)[[NSApplication sharedApplication] delegate]).taskEnumerator.files setObject:newFile forKey:filePath]; - } - } - */ }]; return;