Changeset 35
- Timestamp:
- 02/16/05 23:22:30 (4 years ago)
- Files:
-
- trunk/Controller.m (modified) (2 diffs)
- trunk/English.lproj/Preferences.nib/classes.nib (modified) (2 diffs)
- trunk/English.lproj/Preferences.nib/info.nib (modified) (3 diffs)
- trunk/English.lproj/Preferences.nib/keyedobjects.nib (modified) (previous)
- trunk/English.lproj/Preferences.nib/objects.nib (modified) (previous)
- trunk/Libs/SSHKeychain.h (modified) (2 diffs)
- trunk/Libs/SSHKeychain.m (modified) (7 diffs)
- trunk/PreferenceController.h (modified) (1 diff)
- trunk/PreferenceViews/SecurityView.h (modified) (2 diffs)
- trunk/PreferenceViews/SecurityView.m (modified) (7 diffs)
- trunk/TODO (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Controller.m
r33 r35 59 59 @"NO", 60 60 @"30", 61 @"0", 61 62 nil 62 63 ] … … 76 77 manageGlobalEnvironmentString, 77 78 checkScreensaverIntervalString, 79 keyTimeoutString, 78 80 nil 79 81 ] trunk/English.lproj/Preferences.nib/classes.nib
r33 r35 78 78 ACTIONS = { 79 79 changeCheckScreensaverInterval = id; 80 changeKeyTimeout = id; 80 81 changeMinutesOfSleep = id; 81 82 changeOnScreensaver = id; 82 83 changeOnSleep = id; 83 myAction = id;84 84 toggleCustomSecuritySettings = id; 85 85 }; … … 93 93 customSecuritySettingsView = id; 94 94 followKeychain = id; 95 keyTimeout = id; 96 keyTimeoutTextfield = id; 95 97 minutesOfSleep = id; 96 98 minutesOfSleepTextfield = id; trunk/English.lproj/Preferences.nib/info.nib
r33 r35 10 10 <string>304 452 416 112 0 0 1024 746 </string> 11 11 <key>640</key> 12 <string> 170 32 495 2920 0 1024 746 </string>12 <string>75 34 495 343 0 0 1024 746 </string> 13 13 <key>722</key> 14 14 <string>446 468 495 234 0 0 1440 878 </string> … … 26 26 <string>446 468 495 234 0 0 1440 878 </string> 27 27 <key>909</key> 28 <string> 56 312495 234 0 0 1024 746 </string>28 <string>264 391 495 234 0 0 1024 746 </string> 29 29 </dict> 30 30 <key>IBFramework Version</key> … … 36 36 </array> 37 37 <key>IBSystem Version</key> 38 <string>7 S215</string>38 <string>7U16</string> 39 39 </dict> 40 40 </plist> trunk/Libs/SSHKeychain.h
r3 r35 9 9 NSString *agentSocketPath; 10 10 BOOL addingKeys; 11 12 int lastAdded; 11 13 12 14 /* Locks */ 13 15 NSLock *keychainLock; 14 16 NSLock *addingKeysLock; 17 NSLock *lastAddedLock; 15 18 } 16 19 … … 37 40 - (BOOL)addKeysToAgent; 38 41 - (BOOL)addKeysToAgentWithInteraction:(BOOL)interaction; 42 - (void)removeKeysAfterTimeout:(id)object; 39 43 - (BOOL)removeKeysFromAgent; 40 44 trunk/Libs/SSHKeychain.m
r28 r35 1 1 #import "SSHKeychain.h" 2 #import "PreferenceController.h" 2 3 3 4 #import "SSHKey.h" 4 5 #import "SSHTool.h" 6 7 #include <unistd.h> 5 8 6 9 SSHKeychain *currentKeychain; … … 50 53 51 54 [keychainLock unlock]; 52 55 56 [lastAddedLock lock]; 57 lastAdded = -1; 58 [lastAddedLock unlock]; 59 53 60 currentKeychain = self; 54 61 … … 65 72 addingKeysLock = [[NSLock alloc] init]; 66 73 keychainLock = [[NSLock alloc] init]; 74 lastAddedLock = [[NSLock alloc] init]; 67 75 68 76 return self; … … 87 95 88 96 [addingKeysLock dealloc]; 89 97 [lastAddedLock dealloc]; 98 90 99 [super dealloc]; 91 100 } … … 242 251 NSMutableArray *paths; 243 252 SSHTool *theTool; 244 int i ;253 int i, ts; 245 254 246 255 paths = [self arrayOfPaths]; … … 300 309 return NO; 301 310 } 311 312 if([[NSUserDefaults standardUserDefaults] integerForKey:keyTimeoutString] > 0) 313 { 314 ts = time(nil); 315 [lastAddedLock lock]; 316 lastAdded = ts; 317 [lastAddedLock unlock]; 318 319 [NSThread detachNewThreadSelector:@selector(removeKeysAfterTimeout:) toTarget:self 320 withObject:[NSNumber numberWithInt:ts]]; 321 } 302 322 303 323 [[NSNotificationCenter defaultCenter] postNotificationName:@"AgentFilled" object:nil]; … … 316 336 } 317 337 338 /* Remove all keys from the ssh-agent from a NSTimer object. */ 339 - (void)removeKeysAfterTimeout:(id)object 340 { 341 int ts; 342 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 343 344 ts = [object intValue]; 345 346 sleep([[NSUserDefaults standardUserDefaults] integerForKey:keyTimeoutString] * 60); 347 348 [lastAddedLock lock]; 349 if(ts == lastAdded) 350 { 351 [lastAddedLock unlock]; 352 [self removeKeysFromAgent]; 353 } 354 355 [lastAddedLock unlock]; 356 357 [pool release]; 358 } 359 318 360 /* Remove all keys from the ssh-agent. */ 319 361 - (BOOL)removeKeysFromAgent 320 362 { 321 363 SSHTool *theTool = [SSHTool toolWithName:@"ssh-add"]; 364 365 [lastAddedLock lock]; 366 lastAdded = -1; 367 [lastAddedLock unlock]; 322 368 323 369 if((!agentSocketPath) || ([[NSFileManager defaultManager] isReadableFileAtPath:agentSocketPath] == NO)) trunk/PreferenceController.h
r33 r35 18 18 #define useCustomSecuritySettingsString @"Use Custom Security Settings" 19 19 #define checkScreensaverIntervalString @"Check Screensaver Interval" 20 #define keyTimeoutString @"Key Timeout" 20 21 21 22 @interface PreferenceController : NSObject trunk/PreferenceViews/SecurityView.h
r33 r35 9 9 IBOutlet id addKeysOnConnection, askForConfirmation, followKeychain, onScreensaver, onSleep; 10 10 IBOutlet id minutesOfSleep, minutesOfSleepTextfield, checkScreensaverInterval, checkScreensaverIntervalTextfield; 11 IBOutlet id keyTimeout, keyTimeoutTextfield; 11 12 } 12 13 … … 17 18 - (IBAction)changeCheckScreensaverInterval:(id)sender; 18 19 20 - (IBAction)changeKeyTimeout:(id)sender; 21 19 22 - (IBAction)toggleCustomSecuritySettings:(id)sender; 20 23 trunk/PreferenceViews/SecurityView.m
r33 r35 13 13 [minutesOfSleepTextfield setRefusesFirstResponder:YES]; 14 14 [checkScreensaverIntervalTextfield setRefusesFirstResponder:YES]; 15 [keyTimeoutTextfield setRefusesFirstResponder:YES]; 15 16 16 17 [addKeysOnConnection setState:[[NSUserDefaults standardUserDefaults] boolForKey:addKeysOnConnectionString]]; … … 50 51 [checkScreensaverIntervalTextfield setIntValue:[prefs integerForKey:checkScreensaverIntervalString]]; 51 52 [checkScreensaverInterval setIntValue:[prefs integerForKey:checkScreensaverIntervalString]]; 53 54 [keyTimeoutTextfield setIntValue:[prefs integerForKey:keyTimeoutString]]; 55 [keyTimeout setIntValue:[prefs integerForKey:keyTimeoutString]]; 52 56 53 57 [useCustomSecuritySettings setState:[[NSUserDefaults standardUserDefaults] boolForKey:useCustomSecuritySettingsString]]; … … 79 83 80 84 [prefs setInteger:[checkScreensaverIntervalTextfield intValue] forKey:checkScreensaverIntervalString]; 85 [prefs setInteger:[keyTimeoutTextfield intValue] forKey:keyTimeoutString]; 86 81 87 } 82 88 … … 91 97 [prefs setInteger:0 forKey:minutesOfSleepString]; 92 98 [prefs setInteger:30 forKey:checkScreensaverIntervalString]; 99 [prefs setInteger:0 forKey:keyTimeoutString]; 93 100 } 94 101 … … 143 150 [prefs setInteger:0 forKey:minutesOfSleepString]; 144 151 [prefs setInteger:30 forKey:checkScreensaverIntervalString]; 152 [prefs setInteger:0 forKey:keyTimeoutString]; 145 153 146 154 [prefs synchronize]; … … 182 190 [checkScreensaverIntervalTextfield setIntValue:[prefs integerForKey:checkScreensaverIntervalString]]; 183 191 [checkScreensaverInterval setIntValue:[prefs integerForKey:checkScreensaverIntervalString]]; 192 193 [keyTimeoutTextfield setIntValue:[prefs integerForKey:keyTimeoutString]]; 194 [keyTimeout setIntValue:[prefs integerForKey:keyTimeoutString]]; 184 195 185 196 } … … 251 262 } 252 263 264 /* The key timeout slidebar has changed. */ 265 - (IBAction)changeKeyTimeout:(id)sender 266 { 267 if(sender == keyTimeout) 268 { 269 [keyTimeoutTextfield setIntValue:[sender intValue]]; 270 } 271 272 else if(sender == keyTimeoutTextfield) 273 { 274 [keyTimeoutTextfield setIntValue:[sender intValue]]; 275 [keyTimeout setIntValue:[sender intValue]]; 276 } 277 } 278 279 253 280 @end trunk/TODO
r34 r35 4 4 - Only add keys from keychain event if keychain holds keys 5 5 - Admin wrapper for tunnel ports < 1024 6 - Option to unload keys after a period of time7 6 - The option to not display messages regarding tunnels (Nov 05 - Marc Liyanage - Feature suggestion for SSHKeychain) 8 7 - Listen to local forwarded ports and start up the tunnel on demand (that's going to require some hacking with random ports to have ssh listening on) … … 10 9 0.8 DONE: 11 10 - Option for screensaver check interval (bart) 11 - Option to unload keys after a period of time (bart) 12 12 13 13 1.0 TODO:
