From 0524e0d1915f519a76d62540b695abc16634d4c9 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Wed, 18 Apr 2012 11:57:10 -0400 Subject: [PATCH] macos: update AFS prefs pane modify afshelper to just run what it's told instead of offering fixed operations. this avoids having a setuid tool around. in spite of apple's suggestion this is correct, it's actually more dangerous. instead, elevate privilege only to run a small set of commands, then drop. allow unlocking of the prefs pane, but make the menu extra prompt for authentication when needed. deactivate controls in the prefs pane when locked. Change-Id: I0e2510efc98605f464e04d26cc8f2ce2bfe116f4 Reviewed-on: http://gerrit.openafs.org/7196 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- .../AFSBackgrounder/AFSBackgrounderDelegate.h | 1 - .../AFSBackgrounder/AFSBackgrounderDelegate.m | 65 +- .../AFSPreference/AFSBackgrounder/AFSMenuExtra.h | 1 - .../AFSPreference/AFSBackgrounder/AFSMenuExtra.m | 107 +- .../AFSBackgrounder/AFSMenuExtraView.h | 2 +- .../DARWIN/AFSPreference/AFSCommanderPref.h | 15 +- .../DARWIN/AFSPreference/AFSCommanderPref.m | 1646 ++++++++-------- .../DARWIN/AFSPreference/AFSPropertyManager.h | 2 +- .../DARWIN/AFSPreference/AFSPropertyManager.m | 97 +- .../English.lproj/OpenAFSPreference.xib | 1960 +++++++++----------- .../DARWIN/AFSPreference/IpConfiguratorCommander.m | 28 +- src/platform/DARWIN/AFSPreference/PListManager.h | 6 +- src/platform/DARWIN/AFSPreference/PListManager.m | 51 +- src/platform/DARWIN/AFSPreference/TaskUtil.h | 1 + src/platform/DARWIN/AFSPreference/TaskUtil.m | 31 + src/platform/DARWIN/AFSPreference/afshlp.m | 216 +-- 16 files changed, 1794 insertions(+), 2435 deletions(-) diff --git a/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSBackgrounderDelegate.h b/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSBackgrounderDelegate.h index c4799c6..371ac82 100644 --- a/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSBackgrounderDelegate.h +++ b/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSBackgrounderDelegate.h @@ -65,7 +65,6 @@ - (NSImage*)getImageFromBundle:(NSString*)fileName fileExt:(NSString*)ext; - (NSImage*)imageToRender; - (void)menuNeedsUpdate:(NSMenu *)menu; -- (void)repairHelperTool; - (void) afsVolumeMountChange:(NSNotification *)notification; - (void) updateLinkModeStatusWithpreferenceStatus:(BOOL)status; -(NSStatusItem*)statusItem; diff --git a/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSBackgrounderDelegate.m b/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSBackgrounderDelegate.m index 94bef26..d2d81fa 100644 --- a/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSBackgrounderDelegate.m +++ b/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSBackgrounderDelegate.m @@ -335,22 +335,26 @@ - (void)startStopAfs:(id)sender { @try { - BOOL currentAfsState = NO; + BOOL currentAfsState = NO; + OSErr status = [[AuthUtil shared] autorize]; + if(status == noErr){ currentAfsState = [afsMngr checkAfsStatus]; // make the parameter to call the root helper app if(currentAfsState){ - //shutdown afs - NSLog(@"Shutting down afs"); - [afsMngr shutdown]; + //shutdown afs + NSLog(@"Shutting down afs"); + [afsMngr shutdown]; } else { - //Start afs - NSLog(@"Starting up afs"); - [afsMngr startup]; + //Start afs + NSLog(@"Starting up afs"); + [afsMngr startup]; } + } }@catch (NSException * e) { NSLog(@"error %@", [e reason]); }@finally { [self updateAfsStatus:nil]; + [[AuthUtil shared] deautorize]; //Send notification to preferencepane [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfsCommanderID object:kMenuExtraEventOccured]; } @@ -525,53 +529,6 @@ else return NSOffState; } -// ------------------------------------------------------------------------------- -// repairHelperTool: -// ------------------------------------------------------------------------------- -- (void) repairHelperTool -{ - struct stat st; - int fdTool; - int status = 0; - NSString *afshlpPath = [[NSBundle mainBundle] pathForResource:@"afshlp" ofType:nil]; - - - - // Open tool exclusively, so nobody can change it while we bless it. - fdTool = open([afshlpPath UTF8String], O_NONBLOCK | O_RDONLY | O_EXLOCK, 0); - - if(fdTool == -1) - { - NSLog(@"Exclusive open while repairing tool failed: %d.", errno); - exit(-1); - } - - if(fstat(fdTool, &st)) - { - NSLog(@"fstat failed."); - exit(-1); - } - - if(st.st_uid != 0) - { - status = [[AuthUtil shared] autorize]; - if(status == noErr){ - fchown(fdTool, 0, st.st_gid); - - // Disable group and world writability and make setuid root. - fchmod(fdTool, (st.st_mode & (~(S_IWGRP | S_IWOTH)))/* | S_ISUID*/); - const char *args[] = {"root", [afshlpPath UTF8String],0L}; - [[AuthUtil shared] execUnixCommand:"/usr/sbin/chown" - args:args - output:nil]; - [[AuthUtil shared] deautorize]; - } - } else NSLog(@"st_uid = 0"); - close(fdTool); - NSLog(@"Self-repair done."); - -} - #pragma mark accessor // ------------------------------------------------------------------------------- // statusItem diff --git a/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtra.h b/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtra.h index 1c41e24..54487b3 100644 --- a/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtra.h +++ b/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtra.h @@ -52,6 +52,5 @@ - (NSImage*)getImageFromBundle:(NSString*)fileName fileExt:(NSString*)ext; - (NSImage*)imageToRender; - (void)updateMenu; -- (void)repairHelperTool; - (void) afsVolumeMountChange:(NSNotification *)notification; @end diff --git a/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtra.m b/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtra.m index 0073a31..3816862 100644 --- a/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtra.m +++ b/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtra.m @@ -177,62 +177,6 @@ } // ------------------------------------------------------------------------------- -// -(void) readPreferenceFile -// ------------------------------------------------------------------------------- -- (void)startStopAfs:(id)sender -{ - if(!afsSysPath) return; - - OSStatus status = noErr; - NSString *afsdPath = [TaskUtil searchExecutablePath:@"afsd"]; - NSString *rootHelperApp = nil; - BOOL currentAfsState = NO; - - @try { - if(afsdPath == nil) return; - AFSPropertyManager *afsMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath]; - currentAfsState = [afsMngr checkAfsStatus]; - [afsMngr release]; - - rootHelperApp = [[self bundle] pathForResource:@"afshlp" ofType:@""]; - - //Check helper app - [self repairHelperTool]; - - // make the parameter to call the root helper app - status = [[AuthUtil shared] autorize]; - if(status == noErr){ - if(currentAfsState){ - //shutdown afs - NSMutableString *afsKextPath = [[NSMutableString alloc] initWithCapacity:256]; - [afsKextPath setString:afsSysPath]; - [afsKextPath appendString:@"/etc/afs.kext"]; - - const char *stopAfsArgs[] = {"stop_afs", [afsKextPath UTF8String], [afsdPath UTF8String], 0L}; - [[AuthUtil shared] execUnixCommand:[rootHelperApp UTF8String] - args:stopAfsArgs - output:nil]; - } else { - const char *startAfsArgs[] = {[[[self bundle] pathForResource:@"start_afs" ofType:@"sh"] UTF8String], [afsSysPath UTF8String], [afsdPath UTF8String], 0L}; - [[AuthUtil shared] execUnixCommand:[rootHelperApp UTF8String] - args:startAfsArgs - output:nil]; - } - } - } - @catch (NSException * e) { - NSLog([e reason]); - } - @finally { - [[AuthUtil shared] deautorize]; - [self updateAfsStatus:nil]; - //Send notification to preferencepane - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:afsCommanderID object:kMenuExtraEventOccured]; - } - -} - -// ------------------------------------------------------------------------------- // -(void) getToken // ------------------------------------------------------------------------------- - (void)getToken:(id)sender @@ -368,53 +312,4 @@ if(useAklogPrefValue) return [useAklogPrefValue intValue] == NSOnState; else return NSOffState; } - -// ------------------------------------------------------------------------------- -// repairHelperTool: -// ------------------------------------------------------------------------------- -- (void) repairHelperTool -{ - struct stat st; - int fdTool; - int status = 0; - NSString *afshlpPath = [[self bundle] pathForResource:@"afshlp" ofType:nil]; - - - - // Open tool exclusively, so nobody can change it while we bless it. - fdTool = open([afshlpPath UTF8String], O_NONBLOCK | O_RDONLY | O_EXLOCK, 0); - - if(fdTool == -1) - { - NSLog(@"Exclusive open while repairing tool failed: %d.", errno); - exit(-1); - } - - if(fstat(fdTool, &st)) - { - NSLog(@"fstat failed."); - exit(-1); - } - - if(st.st_uid != 0) - { - status = [[AuthUtil shared] autorize]; - if(status == noErr){ - fchown(fdTool, 0, st.st_gid); - - // Disable group and world writability and make setuid root. - fchmod(fdTool, (st.st_mode & (~(S_IWGRP | S_IWOTH)))/* | S_ISUID*/); - const char *args[] = {"root", [afshlpPath UTF8String],0L}; - [[AuthUtil shared] execUnixCommand:"/usr/sbin/chown" - args:args - output:nil]; - [[AuthUtil shared] deautorize]; - } - } else NSLog(@"st_uid = 0"); - - - - close(fdTool); - NSLog(@"Self-repair done."); - -}@end +@end diff --git a/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtraView.h b/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtraView.h index 915dc2f..6d1ce18 100644 --- a/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtraView.h +++ b/src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtraView.h @@ -9,7 +9,7 @@ #import #import "AFSBackgrounderDelegate.h" -@interface AFSMenuExtraView : NSView { +@interface AFSMenuExtraView : NSView { AFSBackgrounderDelegate *backgrounderDelegator; NSStatusItem *statusItem; NSMenu *statusItemMenu; diff --git a/src/platform/DARWIN/AFSPreference/AFSCommanderPref.h b/src/platform/DARWIN/AFSPreference/AFSCommanderPref.h index a9f1cad..7666255 100644 --- a/src/platform/DARWIN/AFSPreference/AFSCommanderPref.h +++ b/src/platform/DARWIN/AFSPreference/AFSCommanderPref.h @@ -7,6 +7,7 @@ // #import +#import #import "AFSPropertyManager.h" #import "global.h" #import "ViewUtility.h" @@ -20,12 +21,13 @@ int CoreMenuExtraRemoveMenuExtra(void *menuExtra, int whoCares); -@interface AFSCommanderPref : NSPreferencePane +@interface AFSCommanderPref : NSPreferencePane { //for check system version int prefStartUp; // Main View BOOL startAFSAtLogin; + IBOutlet SFAuthorizationView *authView; IBOutlet NSView *afsCommanderView; IBOutlet NSSearchField *textSearchField; IBOutlet NSTextField *afsDefaultCellLabel; @@ -104,6 +106,7 @@ int CoreMenuExtraRemoveMenuExtra(void *menuExtra, int whoCares); NSLock *tokensLock; } +- (BOOL)isUnlocked; - (void) mainViewDidLoad; - (void) willUnselect; - (void) didSelect; @@ -144,11 +147,8 @@ int CoreMenuExtraRemoveMenuExtra(void *menuExtra, int whoCares); - (void) modifyCell:(DBCellElement*) cellElement; - (void) modifyCellByIDX:(int) idx; - (void) showMessage:(NSString*) message; -- (void) tableViewCellmanageButtonState:(int) rowSelected; -- (void) tableViewLinkmanageButtonState:(NSIndexSet *) rowsSelectedIndex; - (void) setAfsStatus; - (void) refreshTokens:(NSTimer*)theTimer; -- (void) repairHelperTool; - (void) writePreferenceFile; - (void) readPreferenceFile; - (void) refreshGui:(NSNotification *)notification; @@ -157,8 +157,13 @@ int CoreMenuExtraRemoveMenuExtra(void *menuExtra, int whoCares); - (void)tabView:(NSTabView *)tabView willSelectTabViewItem: (NSTabViewItem *)tabViewItem; @end +@interface AFSCommanderPref (TableDelegate) +- (void) tableViewCellmanageButtonState:(int) rowSelected; +- (void) tableViewLinkmanageButtonState:(NSIndexSet *) rowsSelectedIndex; +@end; + @interface AFSCommanderPref (NSTableDataSource) - (id) getTableTokensListValue:(int) colId row:(int)row; - (id) getTableCelListValue:(int) colId row:(int)row; - (id) getTableLinkValue:(int) colId row:(int)row; -@end; \ No newline at end of file +@end; diff --git a/src/platform/DARWIN/AFSPreference/AFSCommanderPref.m b/src/platform/DARWIN/AFSPreference/AFSCommanderPref.m index dcc7344..dd6d9bf 100644 --- a/src/platform/DARWIN/AFSPreference/AFSCommanderPref.m +++ b/src/platform/DARWIN/AFSPreference/AFSCommanderPref.m @@ -58,7 +58,7 @@ { if ( ( self = [super initWithBundle:bundle] ) != nil ) { //appID = kAfsCommanderID; - prefStartUp = 1; + prefStartUp = 1; } return self; } @@ -67,16 +67,16 @@ // mainView: // ------------------------------------------------------------------------------- - (NSView *) mainView { - if (prefStartUp == 1){ - SInt32 osxMJVers = 0; - SInt32 osxMnVers = 0; - if (Gestalt(gestaltSystemVersionMajor, &osxMJVers) == noErr && Gestalt(gestaltSystemVersionMinor, &osxMnVers) == noErr) { - if (osxMJVers == 10 && osxMnVers>= 5) { - [afsCommanderView setFrameSize:NSMakeSize(668, [afsCommanderView frame].size.height)]; + if (prefStartUp == 1){ + SInt32 osxMJVers = 0; + SInt32 osxMnVers = 0; + if (Gestalt(gestaltSystemVersionMajor, &osxMJVers) == noErr && Gestalt(gestaltSystemVersionMinor, &osxMnVers) == noErr) { + if (osxMJVers == 10 && osxMnVers>= 5) { + [afsCommanderView setFrameSize:NSMakeSize(668, [afsCommanderView frame].size.height)]; prefStartUp = 0; - } - } + } } + } return afsCommanderView; } @@ -86,12 +86,17 @@ // ------------------------------------------------------------------------------- - (void) mainViewDidLoad { - //CellServDB Table - [((NSTableView*)cellList) setDelegate:self]; - [((NSTableView*)cellList) setTarget:self]; - [((NSTableView*)cellList) setDoubleAction:@selector(tableDoubleAction:)]; - - + //CellServDB Table + [cellList setDelegate:self]; + [cellList setTarget:self]; + [cellList setDoubleAction:@selector(tableDoubleAction:)]; + + // Setup security. + AuthorizationItem items = {kAuthorizationRightExecute, 0, NULL, 0}; + AuthorizationRights rights = {1, &items}; + [authView setAuthorizationRights:&rights]; + authView.delegate = self; + [authView updateStatus:nil]; } // ------------------------------------------------------------------------------- @@ -99,102 +104,102 @@ // ------------------------------------------------------------------------------- - (void) didSelect { - //try to install the launchd file for backgrounder - //Remove launchd ctrl file - @try { - [PListManager installBackgrounderLaunchdFile:YES - resourcePath:[[self bundle] resourcePath]]; - } - @catch (NSException * e) { - NSDictionary *excecptDic = [e userInfo]; - NSNumber *keyNum = [excecptDic objectForKey:@"agent_folder_error"]; - if(keyNum && [keyNum boolValue]) { - // the dir HOME_LAUNCHD_AGENT_FOLDER (PListManager.h) must be created - NSBeginAlertSheet([[NSString stringWithString:kDoYouWantCreateTheDirectory] stringByAppendingString:HOME_LAUNCHD_AGENT_FOLDER], - @"Create", @"Cancel", nil, - [[self mainView] window], self, @selector(credentialAtLoginTimeEventCreationLaunchAgentDir:returnCode:contextInfo:), NULL, - nil, @"", nil); - } - } - @finally { - + //try to install the launchd file for backgrounder + //Remove launchd ctrl file + @try { + [PListManager installBackgrounderLaunchdFile:YES + resourcePath:[[self bundle] resourcePath]]; + } + @catch (NSException * e) { + NSDictionary *excecptDic = [e userInfo]; + NSNumber *keyNum = [excecptDic objectForKey:@"agent_folder_error"]; + if(keyNum && [keyNum boolValue]) { + // the dir HOME_LAUNCHD_AGENT_FOLDER (PListManager.h) must be created + NSBeginAlertSheet([[NSString stringWithString:kDoYouWantCreateTheDirectory] stringByAppendingString:HOME_LAUNCHD_AGENT_FOLDER], + @"Create", @"Cancel", nil, + [[self mainView] window], self, @selector(credentialAtLoginTimeEventCreationLaunchAgentDir:returnCode:contextInfo:), NULL, + nil, @"", nil); } + } + @finally { - - // Set Developer info - [textFieldDevInfoLabel setStringValue:kDevelopInfo]; - // creating the lock - tokensLock = [[NSLock alloc] init]; - - //Initialization cellservdb and token list - filteredCellDB = nil; - tokenList = nil; - - [self readPreferenceFile]; - - // alloc the afs property mananger - afsProperty = [[AFSPropertyManager alloc] init]; - - // register preference pane to detect menuextra killed by user - [[NSDistributedNotificationCenter defaultCenter] addObserver:self - selector:@selector(refreshTokensNotify:) - name:kAfsCommanderID - object:kMExtraTokenOperation]; - - [[NSDistributedNotificationCenter defaultCenter] addObserver:self - selector:@selector(refreshGui:) - name:kAfsCommanderID - object:kMenuExtraEventOccured]; - - //Register for mount/unmount afs volume - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self - selector:@selector(afsVolumeMountChange:) - name:NSWorkspaceDidMountNotification object:nil]; - - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self - selector:@selector(afsVolumeMountChange:) - name:NSWorkspaceDidUnmountNotification object:nil]; - - // set self as table data source - [cellList setDataSource:self]; - [tokensTable setDataSource:self]; - //[tableViewLink setDataSource:self]; - //check the afs state - [self setAfsStatus]; - - // let show the configuration after prefpane is open - [self refreshConfiguration:nil]; - - // refresh the token list - //[self refreshTokens:nil]; - - //refresh table to reflect the NSSearchField contained text - [self searchCellTextEvent:nil]; + } + + + // Set Developer info + [textFieldDevInfoLabel setStringValue:kDevelopInfo]; + // creating the lock + tokensLock = [[NSLock alloc] init]; + + //Initialization cellservdb and token list + filteredCellDB = nil; + tokenList = nil; + + [self readPreferenceFile]; + + // alloc the afs property mananger + afsProperty = [[AFSPropertyManager alloc] init]; + + // register preference pane to detect menuextra killed by user + [[NSDistributedNotificationCenter defaultCenter] addObserver:self + selector:@selector(refreshTokensNotify:) + name:kAfsCommanderID + object:kMExtraTokenOperation]; + + [[NSDistributedNotificationCenter defaultCenter] addObserver:self + selector:@selector(refreshGui:) + name:kAfsCommanderID + object:kMenuExtraEventOccured]; + + //Register for mount/unmount afs volume + [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self + selector:@selector(afsVolumeMountChange:) + name:NSWorkspaceDidMountNotification object:nil]; + + [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self + selector:@selector(afsVolumeMountChange:) + name:NSWorkspaceDidUnmountNotification object:nil]; + + // set self as table data source + [cellList setDataSource:self]; + [tokensTable setDataSource:self]; + //[tableViewLink setDataSource:self]; + //check the afs state + [self setAfsStatus]; + + // let show the configuration after prefpane is open + [self refreshConfiguration:nil]; + + // refresh the token list + //[self refreshTokens:nil]; + + //refresh table to reflect the NSSearchField contained text + [self searchCellTextEvent:nil]; } // ------------------------------------------------------------------------------- // credentialAtLoginTimeEventCreationLaunchAgentDir: // ------------------------------------------------------------------------------- - (void) credentialAtLoginTimeEventCreationLaunchAgentDir:(NSWindow*)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo { - [alert close]; - switch (returnCode) { - case 1: - if([[NSFileManager defaultManager] createDirectoryAtPath:[HOME_LAUNCHD_AGENT_FOLDER stringByExpandingTildeInPath] - withIntermediateDirectories:NO - attributes:nil - error:nil]) { - - //Create the file - [PListManager installBackgrounderLaunchdFile:YES - resourcePath:[[self bundle] resourcePath]]; - [self showMessage:kDirectoryCreated]; - } else { - [self showMessage:kErrorCreatingDirectory]; - } - break; - case 0: - break; + [alert close]; + switch (returnCode) { + case 1: + if([[NSFileManager defaultManager] createDirectoryAtPath:[HOME_LAUNCHD_AGENT_FOLDER stringByExpandingTildeInPath] + withIntermediateDirectories:NO + attributes:nil + error:nil]) { + + //Create the file + [PListManager installBackgrounderLaunchdFile:YES + resourcePath:[[self bundle] resourcePath]]; + [self showMessage:kDirectoryCreated]; + } else { + [self showMessage:kErrorCreatingDirectory]; } + break; + case 0: + break; + } } @@ -203,36 +208,36 @@ // ------------------------------------------------------------------------------- - (void)willUnselect { - // remove self as datasource - [((NSTableView*)cellList) setDataSource:nil]; - [((NSTableView*)tokensTable) setDataSource:nil]; - - //release the afs property manager - if(afsProperty) [afsProperty release]; - //release tokens list - if(tokenList) [tokenList release]; - //Remove the cell temp array - if(filteredCellDB) [filteredCellDB release]; - - [self writePreferenceFile]; - - // unregister preference pane to detect menuextra killed by user - [[NSDistributedNotificationCenter defaultCenter] removeObserver:self - name:kAfsCommanderID - object:kMExtraClosedNotification]; - [[NSDistributedNotificationCenter defaultCenter] removeObserver:self - name:kAfsCommanderID - object:kMExtraTokenOperation]; - [[NSDistributedNotificationCenter defaultCenter] removeObserver:self - name:kAfsCommanderID - object:kMenuExtraEventOccured]; - [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self - name:NSWorkspaceDidMountNotification object:nil]; - [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self - name:NSWorkspaceDidUnmountNotification object:nil]; - - [self stopTimer]; - [tokensLock release]; + // remove self as datasource + [cellList setDataSource:nil]; + [tokensTable setDataSource:nil]; + + //release the afs property manager + if(afsProperty) [afsProperty release]; + //release tokens list + if(tokenList) [tokenList release]; + //Remove the cell temp array + if(filteredCellDB) [filteredCellDB release]; + + [self writePreferenceFile]; + + // unregister preference pane to detect menuextra killed by user + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self + name:kAfsCommanderID + object:kMExtraClosedNotification]; + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self + name:kAfsCommanderID + object:kMExtraTokenOperation]; + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self + name:kAfsCommanderID + object:kMenuExtraEventOccured]; + [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self + name:NSWorkspaceDidMountNotification object:nil]; + [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self + name:NSWorkspaceDidUnmountNotification object:nil]; + + [self stopTimer]; + [tokensLock release]; } @@ -240,23 +245,23 @@ // startTimer: // ------------------------------------------------------------------------------- - (void)startTimer{ - //start the time for check tokens validity - if(timerForCheckTokensList) return; - timerForCheckTokensList = [NSTimer scheduledTimerWithTimeInterval:TOKENS_REFRESH_TIME_IN_SEC - target:self - selector:@selector(refreshTokens:) - userInfo:nil - repeats:YES]; - [timerForCheckTokensList fire]; + //start the time for check tokens validity + if(timerForCheckTokensList) return; + timerForCheckTokensList = [NSTimer scheduledTimerWithTimeInterval:TOKENS_REFRESH_TIME_IN_SEC + target:self + selector:@selector(refreshTokens:) + userInfo:nil + repeats:YES]; + [timerForCheckTokensList fire]; } // ------------------------------------------------------------------------------- // stopTimer: // ------------------------------------------------------------------------------- - (void)stopTimer{ - if(!timerForCheckTokensList) return; - [timerForCheckTokensList invalidate]; - timerForCheckTokensList = nil; + if(!timerForCheckTokensList) return; + [timerForCheckTokensList invalidate]; + timerForCheckTokensList = nil; } @@ -265,73 +270,72 @@ // ------------------------------------------------------------------------------- - (void) readPreferenceFile { - // read the preference for aklog use - NSNumber *useAklogPrefValue = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_AKLOG, (CFStringRef)kAfsCommanderID, - kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - NSNumber *aklogTokenAtLogin = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_AKLOG_TOKEN_AT_LOGIN, (CFStringRef)kAfsCommanderID, - kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - [useAklogCheck setState:[useAklogPrefValue intValue]]; - [aklogCredentialAtLoginTime setEnabled:useAklogPrefValue && [useAklogPrefValue boolValue]]; - [aklogCredentialAtLoginTime setState:aklogTokenAtLogin && [aklogTokenAtLogin boolValue]]; - - //check krb5 at login time - [installKRB5AuthAtLoginButton setState:[PListManager checkKrb5AtLoginTimeLaunchdEnable]]; - - //check for AFS enable at startup - NSNumber *afsEnableStartupTime = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_START_AFS_AT_STARTUP, - (CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost); - if(afsEnableStartupTime) - startAFSAtLogin = [afsEnableStartupTime boolValue]; - else - startAFSAtLogin = false; - //set the check button state - [checkButtonAfsAtBootTime setState:startAFSAtLogin]; - - NSNumber *showStatusMenu = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - [(NSButton*)afsMenucheckBox setState: [showStatusMenu boolValue]]; - - //backgrounder state - [backgrounderActivationCheck setState:[PListManager launchdJobState:BACKGROUNDER_P_FILE]]; - - //link enabled status - NSNumber *linkEnabledStatus = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_LINK, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - [checkEnableLink setState:[linkEnabledStatus boolValue]]; - - //check the user preference for manage the renew - NSNumber *checkRenew = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_KRB5_CHECK_ENABLE, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - if(checkRenew)[nsButtonEnableDisableKrb5RenewCheck setState:[checkRenew intValue]]; - - NSNumber *renewTime = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_KRB5_RENEW_TIME, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - if(!renewTime) renewTime = [NSNumber numberWithInt:PREFERENCE_KRB5_RENEW_TIME_DEFAULT_VALUE]; - - //update gui - NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; - NSDateComponents *weekdayComponents = [gregorian components:(NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) - fromDate:[NSDate dateWithTimeIntervalSince1970:[renewTime intValue]]]; - [nsTextFieldKrb5RenewTimeD setIntValue:[weekdayComponents day]-1]; - [nsTextFieldKrb5RenewTimeH setIntValue:[weekdayComponents hour]-1]; - [nsTextFieldKrb5RenewTimeM setIntValue:[weekdayComponents minute]]; - [nsTextFieldKrb5RenewTimeS setIntValue:[weekdayComponents second]]; - [nsStepperKrb5RenewTimeD setIntValue:[weekdayComponents day]-1]; - [nsStepperKrb5RenewTimeH setIntValue:[weekdayComponents hour]-1]; - [nsStepperKrb5RenewTimeM setIntValue:[weekdayComponents minute]]; - [nsStepperKrb5RenewTimeS setIntValue:[weekdayComponents second]]; - - NSNumber *renewCheckTimeInterval = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_KRB5_RENEW_CHECK_TIME_INTERVALL, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - if(renewCheckTimeInterval && [renewCheckTimeInterval intValue])[nsTextFieldKrb5RenewCheckIntervall setIntValue:[renewCheckTimeInterval intValue]]; - else [nsTextFieldKrb5RenewCheckIntervall setIntValue:PREFERENCE_KRB5_RENEW_CHECK_TIME_INTERVALL_DEFAULT_VALUE]; - - NSNumber *expireTimeForRenew = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_KRB5_SEC_TO_EXPIRE_TIME_FOR_RENEW, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - if(expireTimeForRenew && [expireTimeForRenew intValue])[nsTextFieldKrb5SecToExpireDateForRenew setIntValue:[expireTimeForRenew intValue]]; - else [nsTextFieldKrb5SecToExpireDateForRenew setIntValue:PREFERENCE_KRB5_SEC_TO_EXPIRE_TIME_FOR_RENEW_DEFAULT_VALUE]; - - //link configuration - NSData *prefData = (NSData*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - linkConfiguration = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData - mutabilityOption:NSPropertyListMutableContainers - format:nil - errorDescription:nil]; - + // read the preference for aklog use + NSNumber *useAklogPrefValue = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_AKLOG, (CFStringRef)kAfsCommanderID, + kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + NSNumber *aklogTokenAtLogin = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_AKLOG_TOKEN_AT_LOGIN, (CFStringRef)kAfsCommanderID, + kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + [useAklogCheck setState:[useAklogPrefValue intValue]]; + [aklogCredentialAtLoginTime setEnabled:useAklogPrefValue && [useAklogPrefValue boolValue]]; + [aklogCredentialAtLoginTime setState:aklogTokenAtLogin && [aklogTokenAtLogin boolValue]]; + + //check krb5 at login time + [installKRB5AuthAtLoginButton setState:[PListManager checkKrb5AtLoginTimeLaunchdEnable]]; + + //check for AFS enable at startup + NSNumber *afsEnableStartupTime = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_START_AFS_AT_STARTUP, + (CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost); + if(afsEnableStartupTime) + startAFSAtLogin = [afsEnableStartupTime boolValue]; + else + startAFSAtLogin = false; + //set the check button state + [checkButtonAfsAtBootTime setState:startAFSAtLogin]; + + NSNumber *showStatusMenu = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + [(NSButton*)afsMenucheckBox setState: [showStatusMenu boolValue]]; + + //backgrounder state + [backgrounderActivationCheck setState:[PListManager launchdJobState:BACKGROUNDER_P_FILE]]; + + //link enabled status + NSNumber *linkEnabledStatus = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_LINK, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + [checkEnableLink setState:[linkEnabledStatus boolValue]]; + + //check the user preference for manage the renew + NSNumber *checkRenew = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_KRB5_CHECK_ENABLE, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + if(checkRenew)[nsButtonEnableDisableKrb5RenewCheck setState:[checkRenew intValue]]; + + NSNumber *renewTime = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_KRB5_RENEW_TIME, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + if(!renewTime) renewTime = [NSNumber numberWithInt:PREFERENCE_KRB5_RENEW_TIME_DEFAULT_VALUE]; + + //update gui + NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + NSDateComponents *weekdayComponents = [gregorian components:(NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) + fromDate:[NSDate dateWithTimeIntervalSince1970:[renewTime intValue]]]; + [nsTextFieldKrb5RenewTimeD setIntValue:[weekdayComponents day]-1]; + [nsTextFieldKrb5RenewTimeH setIntValue:[weekdayComponents hour]-1]; + [nsTextFieldKrb5RenewTimeM setIntValue:[weekdayComponents minute]]; + [nsTextFieldKrb5RenewTimeS setIntValue:[weekdayComponents second]]; + [nsStepperKrb5RenewTimeD setIntValue:[weekdayComponents day]-1]; + [nsStepperKrb5RenewTimeH setIntValue:[weekdayComponents hour]-1]; + [nsStepperKrb5RenewTimeM setIntValue:[weekdayComponents minute]]; + [nsStepperKrb5RenewTimeS setIntValue:[weekdayComponents second]]; + + NSNumber *renewCheckTimeInterval = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_KRB5_RENEW_CHECK_TIME_INTERVALL, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + if(renewCheckTimeInterval && [renewCheckTimeInterval intValue])[nsTextFieldKrb5RenewCheckIntervall setIntValue:[renewCheckTimeInterval intValue]]; + else [nsTextFieldKrb5RenewCheckIntervall setIntValue:PREFERENCE_KRB5_RENEW_CHECK_TIME_INTERVALL_DEFAULT_VALUE]; + + NSNumber *expireTimeForRenew = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_KRB5_SEC_TO_EXPIRE_TIME_FOR_RENEW, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + if(expireTimeForRenew && [expireTimeForRenew intValue])[nsTextFieldKrb5SecToExpireDateForRenew setIntValue:[expireTimeForRenew intValue]]; + else [nsTextFieldKrb5SecToExpireDateForRenew setIntValue:PREFERENCE_KRB5_SEC_TO_EXPIRE_TIME_FOR_RENEW_DEFAULT_VALUE]; + + //link configuration + NSData *prefData = (NSData*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + linkConfiguration = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData + mutabilityOption:NSPropertyListMutableContainers + format:nil + errorDescription:nil]; } // ------------------------------------------------------------------------------- @@ -339,56 +343,56 @@ // ------------------------------------------------------------------------------- - (void) writePreferenceFile { - //Set the preference for afs path - //Set the preference for aklog use - CFPreferencesSetValue((CFStringRef)PREFERENCE_USE_AKLOG, - (CFNumberRef)[NSNumber numberWithInt:[useAklogCheck state]], - (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - //set AFS enable state at startup - CFPreferencesSetValue((CFStringRef)PREFERENCE_START_AFS_AT_STARTUP, - (CFNumberRef)[NSNumber numberWithBool:startAFSAtLogin], - (CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost); - - //set aklog at login - CFPreferencesSetValue((CFStringRef)PREFERENCE_AKLOG_TOKEN_AT_LOGIN, - (CFNumberRef)[NSNumber numberWithBool:[aklogCredentialAtLoginTime state]], - (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - //set aklog at login - CFPreferencesSetValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU, - (CFNumberRef)[NSNumber numberWithBool:[(NSButton*)afsMenucheckBox state]], - (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - //preference for link - CFPreferencesSetValue((CFStringRef)PREFERENCE_USE_LINK, - (CFNumberRef)[NSNumber numberWithBool:[checkEnableLink state]], - (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - //preference for renew time - NSLog(@"%d %d %d %d", [nsTextFieldKrb5RenewTimeD intValue],[nsTextFieldKrb5RenewTimeH intValue],[nsTextFieldKrb5RenewTimeM intValue],[nsTextFieldKrb5RenewTimeS intValue]); - NSInteger totalSeconds = ([nsTextFieldKrb5RenewTimeD intValue]*24*60*60)+ - ([nsTextFieldKrb5RenewTimeH intValue]*60*60)+ - ([nsTextFieldKrb5RenewTimeM intValue]*60)+ - [nsTextFieldKrb5RenewTimeS intValue]; - - CFPreferencesSetValue((CFStringRef)PREFERENCE_KRB5_RENEW_TIME, - (CFNumberRef)[NSNumber numberWithInt:totalSeconds], - (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - //expire time for renew - CFPreferencesSetValue((CFStringRef)PREFERENCE_KRB5_SEC_TO_EXPIRE_TIME_FOR_RENEW, - (CFNumberRef)[NSNumber numberWithInt:[nsTextFieldKrb5SecToExpireDateForRenew intValue]], - (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - //sec to expiretime for renew job - CFPreferencesSetValue((CFStringRef)PREFERENCE_KRB5_RENEW_CHECK_TIME_INTERVALL, - (CFNumberRef)[NSNumber numberWithInt:[nsTextFieldKrb5RenewCheckIntervall intValue]], - (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost); - CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kPrefChangeNotification]; + //Set the preference for afs path + //Set the preference for aklog use + CFPreferencesSetValue((CFStringRef)PREFERENCE_USE_AKLOG, + (CFNumberRef)[NSNumber numberWithInt:[useAklogCheck state]], + (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + //set AFS enable state at startup + CFPreferencesSetValue((CFStringRef)PREFERENCE_START_AFS_AT_STARTUP, + (CFNumberRef)[NSNumber numberWithBool:startAFSAtLogin], + (CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost); + + //set aklog at login + CFPreferencesSetValue((CFStringRef)PREFERENCE_AKLOG_TOKEN_AT_LOGIN, + (CFNumberRef)[NSNumber numberWithBool:[aklogCredentialAtLoginTime state]], + (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + //set aklog at login + CFPreferencesSetValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU, + (CFNumberRef)[NSNumber numberWithBool:[(NSButton*)afsMenucheckBox state]], + (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + //preference for link + CFPreferencesSetValue((CFStringRef)PREFERENCE_USE_LINK, + (CFNumberRef)[NSNumber numberWithBool:[checkEnableLink state]], + (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + //preference for renew time + //NSLog(@"%d %d %d %d", [nsTextFieldKrb5RenewTimeD intValue],[nsTextFieldKrb5RenewTimeH intValue],[nsTextFieldKrb5RenewTimeM intValue],[nsTextFieldKrb5RenewTimeS intValue]); + NSInteger totalSeconds = ([nsTextFieldKrb5RenewTimeD intValue]*24*60*60)+ + ([nsTextFieldKrb5RenewTimeH intValue]*60*60)+ + ([nsTextFieldKrb5RenewTimeM intValue]*60)+ + [nsTextFieldKrb5RenewTimeS intValue]; + + CFPreferencesSetValue((CFStringRef)PREFERENCE_KRB5_RENEW_TIME, + (CFNumberRef)[NSNumber numberWithInt:totalSeconds], + (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + //expire time for renew + CFPreferencesSetValue((CFStringRef)PREFERENCE_KRB5_SEC_TO_EXPIRE_TIME_FOR_RENEW, + (CFNumberRef)[NSNumber numberWithInt:[nsTextFieldKrb5SecToExpireDateForRenew intValue]], + (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + //sec to expiretime for renew job + CFPreferencesSetValue((CFStringRef)PREFERENCE_KRB5_RENEW_CHECK_TIME_INTERVALL, + (CFNumberRef)[NSNumber numberWithInt:[nsTextFieldKrb5RenewCheckIntervall intValue]], + (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost); + CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kPrefChangeNotification]; } // ------------------------------------------------------------------------------- @@ -396,29 +400,25 @@ // ------------------------------------------------------------------------------- - (IBAction) saveConfiguration:(id) sender { - @try{ - - //[afsProperty setCellName:[cellNameTextEdit stringValue]]; - [afsProperty setCellName:[afsProperty getDefaultCellName]]; - - //save configurations - [afsProperty saveConfigurationFiles:YES]; - - - //Reload all configuration - [self refreshConfiguration:nil]; - - //refresh table to reflect the NSSearchField contained text - [self searchCellTextEvent:nil]; + @try{ + [afsProperty setCellName:[afsProperty getDefaultCellName]]; + + //save configurations + [afsProperty saveConfigurationFiles:YES]; - //Show dialog for notifity al saving process ar gone ell - [self showMessage:kConfigurationSaved]; - }@catch(NSException *e){ - [self showMessage:[e reason]]; - } @finally { - [((NSTableView*)cellList) reloadData]; - } + //Reload all configuration + [self refreshConfiguration:nil]; + + //refresh table to reflect the NSSearchField contained text + [self searchCellTextEvent:nil]; + //Show dialog for notifity al saving process ar gone ell + [self showMessage:kConfigurationSaved]; + }@catch(NSException *e){ + [self showMessage:[e reason]]; + } @finally { + [cellList reloadData]; + } } // ------------------------------------------------------------------------------- @@ -426,16 +426,16 @@ // ------------------------------------------------------------------------------- - (IBAction) saveCacheManagerParam:(id) sender { - @try{ - //Update the value form view to afs property manager class - [self updateCacheParamFromView]; - [afsProperty saveCacheConfigurationFiles:YES]; - [self showMessage:kSavedCacheConfiguration]; - }@catch(NSException *e){ - [self showMessage:[e reason]]; - } @finally { - [((NSTableView*)cellList) reloadData]; - } + @try{ + //Update the value form view to afs property manager class + [self updateCacheParamFromView]; + [afsProperty saveCacheConfigurationFiles:YES]; + [self showMessage:kSavedCacheConfiguration]; + }@catch(NSException *e){ + [self showMessage:[e reason]]; + } @finally { + [cellList reloadData]; + } } // ------------------------------------------------------------------------------- @@ -443,31 +443,31 @@ // ------------------------------------------------------------------------------- - (IBAction) refreshConfiguration:(id) sender { - NSString *afsBasePath = PREFERENCE_AFS_SYS_PAT_STATIC; - @try{ - // set the afs path - [afsProperty setPath:afsBasePath]; - - // load configuration - [afsProperty loadConfiguration]; - - //set the afs version label - [afsVersionLabel setStringValue:[afsProperty getAfsVersion]]; - - //set the current default cell - [afsDefaultCellLabel setStringValue:[afsProperty getDefaultCellName]]; - - // Update cache view - [self fillCacheParamView]; - - //Filter the cellServDb and allocate filtered array - [self filterCellServDB:nil]; - - }@catch(NSException *e){ - [self showMessage:[e reason]]; - } @finally { - [((NSTableView*)cellList) reloadData]; - } + NSString *afsBasePath = PREFERENCE_AFS_SYS_PAT_STATIC; + @try{ + // set the afs path + [afsProperty setPath:afsBasePath]; + + // load configuration + [afsProperty loadConfiguration]; + + //set the afs version label + [afsVersionLabel setStringValue:[afsProperty getAfsVersion]]; + + //set the current default cell + [afsDefaultCellLabel setStringValue:[afsProperty getDefaultCellName]]; + + // Update cache view + [self fillCacheParamView]; + + //Filter the cellServDb and allocate filtered array + [self filterCellServDB:nil]; + + }@catch(NSException *e){ + [self showMessage:[e reason]]; + } @finally { + [cellList reloadData]; + } } // ------------------------------------------------------------------------------- @@ -475,19 +475,19 @@ // ------------------------------------------------------------------------------- -(void) fillCacheParamView { - [dynRoot setState:[afsProperty dynRoot]?NSOnState:NSOffState]; - [afsDB setState:[afsProperty afsDB]?NSOnState:NSOffState]; - [statCacheEntry setIntValue:[afsProperty statCacheEntry]]; - [dCacheDim setIntValue:[afsProperty dCacheDim]]; - [cacheDimension setIntValue:[afsProperty cacheDimension]]; - [daemonNumber setIntValue:[afsProperty daemonNumber]]; - [afsRootMountPoint setStringValue:[afsProperty afsRootMountPoint]]; - [nVolEntry setIntValue:[afsProperty nVolEntry]]; - - //new version property - //[verbose setEnabled:[afsProperty useAfsdConfConfigFile]]; - [verbose setState:[afsProperty verbose]?NSOnState:NSOffState]; - + [dynRoot setState:[afsProperty dynRoot]?NSOnState:NSOffState]; + [afsDB setState:[afsProperty afsDB]?NSOnState:NSOffState]; + [statCacheEntry setIntValue:[afsProperty statCacheEntry]]; + [dCacheDim setIntValue:[afsProperty dCacheDim]]; + [cacheDimension setIntValue:[afsProperty cacheDimension]]; + [daemonNumber setIntValue:[afsProperty daemonNumber]]; + [afsRootMountPoint setStringValue:[afsProperty afsRootMountPoint]]; + [nVolEntry setIntValue:[afsProperty nVolEntry]]; + + //new version property + //[verbose setEnabled:[afsProperty useAfsdConfConfigFile]]; + [verbose setState:[afsProperty verbose]?NSOnState:NSOffState]; + } // ------------------------------------------------------------------------------- @@ -495,22 +495,21 @@ // ------------------------------------------------------------------------------- -(void) updateCacheParamFromView { - NSString *tmpAfsPath = [afsRootMountPoint stringValue]; - if(!tmpAfsPath || ([tmpAfsPath length] == 0) || ([tmpAfsPath characterAtIndex:0] != '/')) - @throw [NSException exceptionWithName:@"updateCacheParamFromView" - reason:kBadAfsRootMountPoint - userInfo:nil]; + NSString *tmpAfsPath = [afsRootMountPoint stringValue]; + if(!tmpAfsPath || ([tmpAfsPath length] == 0) || ([tmpAfsPath characterAtIndex:0] != '/')) + @throw [NSException exceptionWithName:@"updateCacheParamFromView" + reason:kBadAfsRootMountPoint + userInfo:nil]; - - [afsProperty setDynRoot:[dynRoot state]==NSOnState]; - [afsProperty setAfsDB:[afsDB state]==NSOnState]; - [afsProperty setStatCacheEntry:[statCacheEntry intValue]]; - [afsProperty setDCacheDim:[dCacheDim intValue]]; - [afsProperty setCacheDimension:[cacheDimension intValue]]; - [afsProperty setDaemonNumber:[daemonNumber intValue]]; - [afsProperty setAfsRootMountPoint:tmpAfsPath]; - [afsProperty setNVolEntry:[nVolEntry intValue]]; - [afsProperty setVerbose:[verbose state]==NSOnState]; + [afsProperty setDynRoot:[dynRoot state]==NSOnState]; + [afsProperty setAfsDB:[afsDB state]==NSOnState]; + [afsProperty setStatCacheEntry:[statCacheEntry intValue]]; + [afsProperty setDCacheDim:[dCacheDim intValue]]; + [afsProperty setCacheDimension:[cacheDimension intValue]]; + [afsProperty setDaemonNumber:[daemonNumber intValue]]; + [afsProperty setAfsRootMountPoint:tmpAfsPath]; + [afsProperty setNVolEntry:[nVolEntry intValue]]; + [afsProperty setVerbose:[verbose state]==NSOnState]; } @@ -519,8 +518,8 @@ // ------------------------------------------------------------------------------- - (IBAction) showCellIP:(id) sender { - int rowSelected = [((NSTableView *) cellList) selectedRow]; - [self modifyCellByIDX:rowSelected]; + int rowSelected = [((NSTableView *) cellList) selectedRow]; + [self modifyCellByIDX:rowSelected]; } // ------------------------------------------------------------------------------- @@ -528,7 +527,7 @@ // ------------------------------------------------------------------------------- -(void) modifyCellByIDX:(int) idx { - [self modifyCell:[self getCellByIDX:idx]]; + [self modifyCell:[self getCellByIDX:idx]]; } // ------------------------------------------------------------------------------- @@ -536,13 +535,13 @@ // ------------------------------------------------------------------------------- -(void) modifyCell:(DBCellElement*) cellElement { - [NSBundle loadNibNamed:@"IpPanel" owner:self]; - [((IpConfiguratorCommander*) ipConfControllerCommander) setWorkCell:cellElement]; - [NSApp beginSheet: ipConfigurationSheet + [NSBundle loadNibNamed:@"IpPanel" owner:self]; + [((IpConfiguratorCommander*) ipConfControllerCommander) setWorkCell:cellElement]; + [NSApp beginSheet: ipConfigurationSheet modalForWindow: [[self mainView] window] - modalDelegate: self + modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:contextInfo:) - contextInfo: nil]; + contextInfo: nil]; } // ------------------------------------------------------------------------------- @@ -550,132 +549,78 @@ // ------------------------------------------------------------------------------- - (IBAction) addRemoveCell:(id) sender { - switch([((NSControl*) sender) tag]){ - case ADD_CELL_CONTROL_TAG: - { - DBCellElement *newCell = [[DBCellElement alloc] init]; - if(!newCell) break; - - [newCell setCellName:kNewCellName]; - [newCell setCellComment:kNewCellComment]; - //cellArray = ; - [[afsProperty getCellList] addObject:newCell]; - [newCell release]; - - //Modify new cell - [self modifyCell:newCell]; - } - break; - - case REMOVE_CELL_CONTROL_TAG: - { - int index = 0; - NSIndexSet *selectedIndex = [(NSTableView*)cellList selectedRowIndexes]; - if( [selectedIndex count] > 0) { - index = [selectedIndex firstIndex]; - do { - DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:index]; - [[afsProperty getCellList] removeObject:cellElement]; - } while ((index = [selectedIndex indexGreaterThanIndex:index]) != NSNotFound); - } - } - break; - } - //Filter the cellServDb and allocate filtered array - [self searchCellTextEvent:nil]; - [(NSTableView*)cellList deselectAll:nil]; - [(NSTableView*)cellList reloadData]; -} - -// ------------------------------------------------------------------------------- -// repairHelperTool: -// ------------------------------------------------------------------------------- -- (void) repairHelperTool -{ - struct stat st; - int fdTool; - int status = 0; - NSLog(@"repairHelperTool"); - NSString *afshlpPath = [[self bundle] pathForResource:@"afshlp" ofType:nil]; + switch([((NSControl*) sender) tag]){ + case ADD_CELL_CONTROL_TAG: + { + DBCellElement *newCell = [[DBCellElement alloc] init]; + if(!newCell) break; + [newCell setCellName:kNewCellName]; + [newCell setCellComment:kNewCellComment]; + //cellArray = ; + [[afsProperty getCellList] addObject:newCell]; + [newCell release]; - - // Open tool exclusively, so nobody can change it while we bless it. - fdTool = open([afshlpPath UTF8String], O_NONBLOCK | O_RDONLY | O_EXLOCK, 0); - - if(fdTool == -1) - { - NSLog(@"Exclusive open while repairing tool failed: %d.", errno); - exit(-1); + //Modify new cell + [self modifyCell:newCell]; } + break; - if(fstat(fdTool, &st)) + case REMOVE_CELL_CONTROL_TAG: { - NSLog(@"fstat failed."); - exit(-1); + int index = 0; + NSIndexSet *selectedIndex = [(NSTableView*)cellList selectedRowIndexes]; + if( [selectedIndex count] > 0) { + index = [selectedIndex firstIndex]; + do { + DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:index]; + [[afsProperty getCellList] removeObject:cellElement]; + } while ((index = [selectedIndex indexGreaterThanIndex:index]) != NSNotFound); + } } - - if(st.st_uid != 0) - { - status = [[AuthUtil shared] autorize]; - if(status == noErr){ - fchown(fdTool, 0, st.st_gid); - - // Disable group and world writability and make setuid root. - fchmod(fdTool, (st.st_mode & (~(S_IWGRP | S_IWOTH)))/* | S_ISUID*/); - const char *args[] = {"root", [afshlpPath UTF8String],0L}; - [[AuthUtil shared] execUnixCommand:"/usr/sbin/chown" - args:args - output:nil]; - [[AuthUtil shared] deautorize]; - } - } else NSLog(@"st_uid = 0"); - - - - close(fdTool); - - NSLog(@"Self-repair done."); - + break; + } + //Filter the cellServDb and allocate filtered array + [self searchCellTextEvent:nil]; + [cellList deselectAll:nil]; + [cellList reloadData]; } - // ------------------------------------------------------------------------------- // startStopAfs: // ------------------------------------------------------------------------------- - (IBAction) startStopAfs:(id) sender { - BOOL currentAfsState = NO; - @try { - currentAfsState = [afsProperty checkAfsStatus]; - // make the parameter to call the root helper app - if(currentAfsState){ - //shutdown afs - NSLog(@"Shutting down afs"); - [afsProperty shutdown]; - } else { - //Start afs - NSLog(@"Starting up afs"); - [afsProperty startup]; - } - [self refreshGui:nil]; - } - @catch (NSException * e) { - [self showMessage:[e reason]]; - } - @finally { - [[AuthUtil shared] deautorize]; + BOOL currentAfsState = NO; + @try { + currentAfsState = [afsProperty checkAfsStatus]; + // make the parameter to call the root helper app + if(currentAfsState){ + //shutdown afs + NSLog(@"Shutting down afs"); + [afsProperty shutdown]; + } else { + //Start afs + NSLog(@"Starting up afs"); + [afsProperty startup]; } + [self refreshGui:nil]; + } + @catch (NSException * e) { + [self showMessage:[e reason]]; + } + @finally { + } } // ------------------------------------------------------------------------------- // info: // ------------------------------------------------------------------------------- - (void) refreshGui:(NSNotification *)notification{ - BOOL afsIsUp = [afsProperty checkAfsStatus]; - [self setAfsStatus]; - [tokensButton setEnabled:afsIsUp]; - [unlogButton setEnabled:afsIsUp]; + BOOL afsIsUp = [afsProperty checkAfsStatus]; + [self setAfsStatus]; + [tokensButton setEnabled:afsIsUp]; + [unlogButton setEnabled:afsIsUp]; } @@ -683,18 +628,19 @@ // -(void) refreshTokensNotify:(NSNotification*)notification // ------------------------------------------------------------------------------- -(void) refreshTokensNotify:(NSNotification*)notification { - [self refreshTokens:nil]; + [self refreshTokens:nil]; } // ------------------------------------------------------------------------------- // afsVolumeMountChange: Track the afs volume state change // ------------------------------------------------------------------------------- +// XXX should use mountdir not /afs - (void) afsVolumeMountChange:(NSNotification *)notification{ - // Cehck if is mounted or unmounted afs - if([[[notification userInfo] objectForKey:@"NSDevicePath"] isEqualToString:@"/afs"]){ - [self setAfsStatus]; - [self refreshTokens:nil]; - } + // Check if is mounted or unmounted afs + if([[[notification userInfo] objectForKey:@"NSDevicePath"] isEqualToString:@"/afs"]){ + [self setAfsStatus]; + [self refreshTokens:nil]; + } } // ------------------------------------------------------------------------------- @@ -702,13 +648,13 @@ // ------------------------------------------------------------------------------- - (IBAction) info:(id) sender { - [((InfoController*) infoController) showHtmlResource:[[self bundle] pathForResource:@"license" ofType:@"rtf"]]; + [infoController showHtmlResource:[[self bundle] pathForResource:@"license" ofType:@"rtf"]]; - [NSApp beginSheet: infoSheet + [NSApp beginSheet: infoSheet modalForWindow: [[self mainView] window] - modalDelegate: self + modalDelegate: self didEndSelector: @selector(didEndInfoSheet:returnCode:contextInfo:) - contextInfo: nil]; + contextInfo: nil]; } // ------------------------------------------------------------------------------- @@ -716,7 +662,7 @@ // ------------------------------------------------------------------------------- - (IBAction) tableDoubleAction:(id) sender { - [self showCellIP:nil]; + [self showCellIP:nil]; } // ------------------------------------------------------------------------------- @@ -724,24 +670,24 @@ // ------------------------------------------------------------------------------- - (IBAction) getNewToken:(id) sender { - BOOL useAklog = [useAklogCheck state] == NSOnState; - if(useAklog){ - //[AFSPropertyManager aklog]; - [afsProperty getTokens:false - usr:nil - pwd:nil]; - [self refreshTokens:nil]; - //Inform afs menuextra to updata afs status - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange]; + BOOL useAklog = [useAklogCheck state] == NSOnState; + if(useAklog){ + //[AFSPropertyManager aklog]; + [afsProperty getTokens:false + usr:nil + pwd:nil]; + [self refreshTokens:nil]; + //Inform afs menuextra to updata afs status + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange]; - } else { - [NSBundle loadNibNamed:@"CredentialPanel" owner:self]; - [NSApp beginSheet: credentialSheet - modalForWindow: [[self mainView] window] - modalDelegate: self - didEndSelector: @selector(didEndCredentialSheet:returnCode:contextInfo:) - contextInfo: nil]; - } + } else { + [NSBundle loadNibNamed:@"CredentialPanel" owner:self]; + [NSApp beginSheet: credentialSheet + modalForWindow: [[self mainView] window] + modalDelegate: self + didEndSelector: @selector(didEndCredentialSheet:returnCode:contextInfo:) + contextInfo: nil]; + } } @@ -750,23 +696,22 @@ // ------------------------------------------------------------------------------- - (IBAction) unlog:(id) sender { - int index = -1; - NSIndexSet *selectedIndex = [(NSTableView*)tokensTable selectedRowIndexes]; - if( [selectedIndex count] > 0) { - index = [selectedIndex firstIndex]; - do { - NSString *tokenDesc = [tokenList objectAtIndex:index]; - NSString *cellToUnlog = [tokenDesc estractTokenByDelimiter:@"afs@" - endToken:@" "]; - [afsProperty unlog:cellToUnlog]; - } while ((index = [selectedIndex indexGreaterThanIndex: index]) != NSNotFound); - } else { - [afsProperty unlog:nil]; - } - [self refreshTokens:nil]; - //Inform afs menuextra to updata afs status - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange]; - + int index = -1; + NSIndexSet *selectedIndex = [tokensTable selectedRowIndexes]; + if( [selectedIndex count] > 0) { + index = [selectedIndex firstIndex]; + do { + NSString *tokenDesc = [tokenList objectAtIndex:index]; + NSString *cellToUnlog = [tokenDesc estractTokenByDelimiter:@"afs@" + endToken:@" "]; + [afsProperty unlog:cellToUnlog]; + } while ((index = [selectedIndex indexGreaterThanIndex: index]) != NSNotFound); + } else { + [afsProperty unlog:nil]; + } + [self refreshTokens:nil]; + //Inform afs menuextra to updata afs status + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange]; } @@ -775,47 +720,43 @@ // ------------------------------------------------------------------------------- - (IBAction) aklogSwitchEvent:(id) sender { - //afs menu extra is loaded inform it to read preference - @try { - if(![useAklogCheck state]) { - //deselect the checkbox - [aklogCredentialAtLoginTime setState:NO]; - } - - [self writePreferenceFile]; - - //Enable disable aklog at login time checkbox according the useAklog checkbox - [aklogCredentialAtLoginTime setEnabled:[useAklogCheck state]]; - - } - @catch (NSException * e) { - [self showMessage:[e reason]]; + //afs menu extra is loaded inform it to read preference + @try { + if(![useAklogCheck state]) { + //deselect the checkbox + [aklogCredentialAtLoginTime setState:NO]; } - + [self writePreferenceFile]; + + //Enable disable aklog at login time checkbox according the useAklog checkbox + [aklogCredentialAtLoginTime setEnabled:[useAklogCheck state]]; + + } + @catch (NSException * e) { + [self showMessage:[e reason]]; + } } // ------------------------------------------------------------------------------- // credentialAtLoginTimeEvent: // ------------------------------------------------------------------------------- - (IBAction) credentialAtLoginTimeEvent:(id) sender { - [self writePreferenceFile]; + [self writePreferenceFile]; } // ------------------------------------------------------------------------------- // afsStartupSwitchEvent: // ------------------------------------------------------------------------------- - (IBAction) afsStartupSwitchEvent:(id) sender { - NSString *rootHelperApp = [[self bundle] pathForResource:@"afshlp" ofType:@""]; - //get the new state - startAFSAtLogin = [checkButtonAfsAtBootTime state]; - const char *startupConfigureOption[] = {"start_afs_at_startup", startAFSAtLogin?"enable":"disable", 0L}; - if([[AuthUtil shared] autorize] == noErr) { - //now disable the launchd configuration - [[AuthUtil shared] execUnixCommand:[rootHelperApp UTF8String] - args:startupConfigureOption - output:nil]; - } + NSString *rootHelperApp = [[self bundle] pathForResource:@"afshlp" ofType:@""]; + //get the new state + startAFSAtLogin = [checkButtonAfsAtBootTime state]; + [PListManager launchctlStringCommandAuth:startAFSAtLogin?@"load":@"unload" + option:[NSArray arrayWithObjects:@"-w", nil] + plistName:@AFS_DAEMON_PATH + helper:rootHelperApp + withAuthRef:[[authView authorization] authorizationRef]]; } @@ -823,20 +764,11 @@ // afsMenuActivationEvent: // ------------------------------------------------------------------------------- - (IBAction) krb5KredentialAtLoginTimeEvent:(id) sender { - // - NSString *rootHelperApp = [[self bundle] pathForResource:@"afshlp" ofType:@""]; - const char *args[] = {"enable_krb5_startup", [[installKRB5AuthAtLoginButton stringValue] UTF8String], "", 0L}; - - //Check helper app - [self repairHelperTool]; - if([[AuthUtil shared] autorize] == noErr) { - [[AuthUtil shared] execUnixCommand:[rootHelperApp UTF8String] - args:args - output:nil]; - - //check if all is gone well - [installKRB5AuthAtLoginButton setState:[PListManager checkKrb5AtLoginTimeLaunchdEnable]]; - } + NSString *rootHelperApp = [[self bundle] pathForResource:@"afshlp" ofType:@""]; + [PListManager krb5TiketAtLoginTime:[installKRB5AuthAtLoginButton state] helper:rootHelperApp]; + + //check if all is gone well + [installKRB5AuthAtLoginButton setState:[PListManager checkKrb5AtLoginTimeLaunchdEnable]]; } // ------------------------------------------------------------------------------- @@ -844,15 +776,15 @@ // ------------------------------------------------------------------------------- -(IBAction) afsMenuActivationEvent:(id) sender { - CFPreferencesSetValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU, - (CFNumberRef)[NSNumber numberWithBool:[(NSButton*)afsMenucheckBox state]], - (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost); - CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - //notify the backgrounder - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSMenuChangeState]; + CFPreferencesSetValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU, + (CFNumberRef)[NSNumber numberWithBool:[(NSButton*)afsMenucheckBox state]], + (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost); + CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + //notify the backgrounder + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSMenuChangeState]; } // ------------------------------------------------------------------------------- @@ -861,10 +793,9 @@ // ------------------------------------------------------------------------------- - (IBAction) searchCellTextEvent:(id) sender { - - NSString *searchText = [[textSearchField stringValue] lowercaseString]; //filter string - [self filterCellServDB:searchText]; - [((NSTableView*)cellList) reloadData]; + NSString *searchText = [[textSearchField stringValue] lowercaseString]; //filter string + [self filterCellServDB:searchText]; + [((NSTableView*)cellList) reloadData]; } // ------------------------------------------------------------------------------- @@ -872,39 +803,39 @@ // clear the NSSearchField and showw all CellServDB table // ------------------------------------------------------------------------------- - (void) clearCellServDBFiltering { - //Clear the text search - [textSearchField setStringValue:@""]; - //load the temp array with all cell servdb - [self searchCellTextEvent:nil]; + //Clear the text search + [textSearchField setStringValue:@""]; + //load the temp array with all cell servdb + [self searchCellTextEvent:nil]; } // --------------------------------------o----------------------------------------- // filterCellServDB: // make the NSMutableArray with all cellservdb or filtered element // ------------------------------------------------------------------------------- - (void) filterCellServDB:(NSString*)textToFilter { - DBCellElement *cellElement; //Filtered element - BOOL doFilter = !(textToFilter == nil || ([textToFilter length] == 0)); - - // We can do filtering and make the temp array - if(filteredCellDB){ - [filteredCellDB release]; - } - filteredCellDB = [[NSMutableArray alloc] init]; - NSEnumerator *e = [[afsProperty getCellList] objectEnumerator]; - while(cellElement = (DBCellElement*)[e nextObject]) { - // check if the element can be get - if(doFilter) { - //Get the CellServDB array enumerator - NSRange rsltRng = [[[cellElement getCellName] lowercaseString] rangeOfString:textToFilter]; - if(rsltRng.location != NSNotFound) { - //we can add this cell to filtered - [filteredCellDB addObject:[cellElement retain]]; - } - } else { - [filteredCellDB addObject:[cellElement retain]]; - - } + DBCellElement *cellElement; //Filtered element + BOOL doFilter = !(textToFilter == nil || ([textToFilter length] == 0)); + + // We can do filtering and make the temp array + if(filteredCellDB){ + [filteredCellDB release]; + } + filteredCellDB = [[NSMutableArray alloc] init]; + NSEnumerator *e = [[afsProperty getCellList] objectEnumerator]; + while(cellElement = (DBCellElement*)[e nextObject]) { + // check if the element can be get + if(doFilter) { + //Get the CellServDB array enumerator + NSRange rsltRng = [[[cellElement getCellName] lowercaseString] rangeOfString:textToFilter]; + if(rsltRng.location != NSNotFound) { + //we can add this cell to filtered + [filteredCellDB addObject:[cellElement retain]]; + } + } else { + [filteredCellDB addObject:[cellElement retain]]; + } + } } // ------------------------------------------------------------------------------- @@ -912,8 +843,8 @@ // ------------------------------------------------------------------------------- - (DBCellElement*) getCurrentCellInDB { - int rowSelected = [((NSTableView *) cellList) selectedRow]; - return [self getCellByIDX:rowSelected]; + int rowSelected = [cellList selectedRow]; + return [self getCellByIDX:rowSelected]; } // ------------------------------------------------------------------------------- @@ -921,23 +852,22 @@ // ------------------------------------------------------------------------------- - (DBCellElement*) getCellByIDX:(int) idx { - //NSMutableArray *cellArray = [afsProperty getCellList]; - DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:idx]; - return cellElement; + DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:idx]; + return cellElement; } // ------------------------------------------------------------------------------- // showMessage: // ------------------------------------------------------------------------------- -(void) showMessage:(NSString*) message{ - NSAlert *alert = [[NSAlert alloc] init]; - - [alert setMessageText:message]; - [alert beginSheetModalForWindow:[[self mainView] window] - modalDelegate:nil - didEndSelector:nil - contextInfo:nil]; - [alert release]; + NSAlert *alert = [[NSAlert alloc] init]; + + [alert setMessageText:message]; + [alert beginSheetModalForWindow:[[self mainView] window] + modalDelegate:nil + didEndSelector:nil + contextInfo:nil]; + [alert release]; } // ------------------------------------------------------------------------------- @@ -945,46 +875,36 @@ // ------------------------------------------------------------------------------- -(void) setAfsStatus { - - BOOL afsIsUp = [afsProperty checkAfsStatus]; - BOOL afsEnabledAtStartup = NO; - - NSMutableString *commandOutput = [NSMutableString stringWithCapacity:20]; - NSString *rootHelperApp = [[self bundle] pathForResource:@"afshlp" ofType:@""]; - -#if 0 - // make the parameter to call the root helper app - const char *checkAFSDaemonParam[] = {"check_afs_daemon", 0L}; - if([[AuthUtil shared] autorize] == noErr) { - //now disable the launchd configuration - [[AuthUtil shared] execUnixCommand:[rootHelperApp UTF8String] - args:checkAFSDaemonParam - output:commandOutput]; - afsEnabledAtStartup = [commandOutput rangeOfString:@"afshlp:afs daemon registration result:1"].location!=NSNotFound; - } -#else - afsEnabledAtStartup = 1; -#endif - - + BOOL afsIsUp = [afsProperty checkAfsStatus]; + BOOL afsEnabledAtStartup = NO; + NSString *rootHelperApp = [[self bundle] pathForResource:@"afshlp" ofType:@""]; + + if ([self isUnlocked]) { + afsEnabledAtStartup = ( + [TaskUtil executeTaskWithAuth:@"/bin/launchctl" + arguments:[NSArray arrayWithObjects:@"list", + @"org.openafs.filesystems.afs", nil] + helper:rootHelperApp + withAuthRef:[[authView authorization] authorizationRef] + ] == noErr)?YES:NO; + [checkButtonAfsAtBootTime setState:afsEnabledAtStartup]; + } + [startStopButton setTitle: (afsIsUp?kAfsButtonShutdown:kAfsButtonStartup)]; - [((NSButton *)startStopButton) setTitle: (afsIsUp?kAfsButtonShutdown:kAfsButtonStartup)]; - - NSMutableAttributedString *colorTitle =[[NSMutableAttributedString alloc] initWithAttributedString:[((NSButton *)startStopButton) attributedTitle]]; + NSMutableAttributedString *colorTitle =[[NSMutableAttributedString alloc] initWithAttributedString:[startStopButton attributedTitle]]; NSRange titleRange = NSMakeRange(0, [colorTitle length]); - + [colorTitle addAttribute:NSForegroundColorAttributeName - value:(afsIsUp?[NSColor redColor]:[NSColor blackColor]) - range:titleRange]; - - [((NSButton *)startStopButton) setAttributedTitle:colorTitle]; - [checkButtonAfsAtBootTime setState:afsEnabledAtStartup]; - if(afsIsUp) { - [self startTimer]; - } else { - [self stopTimer]; - } + value:(afsIsUp?[NSColor redColor]:[NSColor blackColor]) + range:titleRange]; + + [startStopButton setAttributedTitle:colorTitle]; + if(afsIsUp) { + [self startTimer]; + } else { + [self stopTimer]; + } } // ------------------------------------------------------------------------------- @@ -992,87 +912,86 @@ // ------------------------------------------------------------------------------- - (void) refreshTokens:(NSTimer*)theTimer; { - if(![tokensLock tryLock]) return; - if(tokenList){ - [tokenList release]; - } - - tokenList = [afsProperty getTokenList]; - [((NSTableView*)tokensTable) reloadData]; - [tokensLock unlock]; + if(![tokensLock tryLock]) return; + if(tokenList){ + [tokenList release]; + } + + tokenList = [afsProperty getTokenList]; + [tokensTable reloadData]; + [tokensLock unlock]; } // ------------------------------------------------------------------------------- // removeExtra: // ------------------------------------------------------------------------------- - (IBAction) addLink:(id) sender { - [NSBundle loadNibNamed:@"SymLinkEdit" owner:self]; - - [NSApp beginSheet: lyncCreationSheet + [NSBundle loadNibNamed:@"SymLinkEdit" owner:self]; + + [NSApp beginSheet: lyncCreationSheet modalForWindow: [[self mainView] window] - modalDelegate: self + modalDelegate: self didEndSelector: @selector(didEndSymlinkSheet:returnCode:contextInfo:) - contextInfo: nil]; - + contextInfo: nil]; } // ------------------------------------------------------------------------------- // removeExtra: // ------------------------------------------------------------------------------- - (IBAction) removeLink:(id) sender { - if(!linkConfiguration) return; - int index = 0; - NSArray *keys = [linkConfiguration allKeys]; - NSIndexSet *linkToRemove = [tableViewLink selectedRowIndexes]; - if( [linkToRemove count] > 0) { - index = [linkToRemove firstIndex]; - do { - [linkConfiguration removeObjectForKey:[keys objectAtIndex:index]]; - } while ((index = [linkToRemove indexGreaterThanIndex:index]) != -1); - } - - //write the new configuration - NSData *prefData = nil; - if([linkConfiguration count] > 0) { - prefData = [NSPropertyListSerialization dataWithPropertyList:linkConfiguration - format:NSPropertyListXMLFormat_v1_0 - options:0 - error:nil]; - } - CFPreferencesSetValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION, - (CFDataRef)prefData, - (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - - //reload the new data - [tableViewLink reloadData]; + if(!linkConfiguration) return; + int index = 0; + NSArray *keys = [linkConfiguration allKeys]; + NSIndexSet *linkToRemove = [tableViewLink selectedRowIndexes]; + if( [linkToRemove count] > 0) { + index = [linkToRemove firstIndex]; + do { + [linkConfiguration removeObjectForKey:[keys objectAtIndex:index]]; + } while ((index = [linkToRemove indexGreaterThanIndex:index]) != -1); + } + + //write the new configuration + NSData *prefData = nil; + if([linkConfiguration count] > 0) { + prefData = [NSPropertyListSerialization dataWithPropertyList:linkConfiguration + format:NSPropertyListXMLFormat_v1_0 + options:0 + error:nil]; + } + CFPreferencesSetValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION, + (CFDataRef)prefData, + (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + + //reload the new data + [tableViewLink reloadData]; } // ------------------------------------------------------------------------------- // removeExtra: // ------------------------------------------------------------------------------- - (IBAction) enableLink:(id) sender { - [self writePreferenceFile]; + [self writePreferenceFile]; } // ------------------------------------------------------------------------------- // removeExtra: // ------------------------------------------------------------------------------- - (IBAction) manageBackgrounderActivation:(id)sender { - [PListManager launchctlCommand:[(NSButton*)sender state] - userDomain:YES - option:[NSArray arrayWithObjects:@"-S", @"Aqua", nil] - plistName:[NSString stringWithFormat:@"%@.plist", BACKGROUNDER_P_FILE]]; - //re ad the status to check taht all is gone well - [backgrounderActivationCheck setState:[PListManager launchdJobState:BACKGROUNDER_P_FILE]]; + [PListManager launchctlCommand:[(NSButton*)sender state] + userDomain:YES + option:[NSArray arrayWithObjects:@"-S", @"Aqua", nil] + plistName:[NSString stringWithFormat:@"%@.plist", BACKGROUNDER_P_FILE]]; + //read the status to check that all is gone well + [backgrounderActivationCheck setState:[PListManager launchdJobState:BACKGROUNDER_P_FILE]]; } // ------------------------------------------------------------------------------- // tableViewLinkPerformClick: // ------------------------------------------------------------------------------- - (IBAction) tableViewLinkPerformClick:(id) sender { - NSLog(@"tableViewLinkPerformClick"); + NSLog(@"tableViewLinkPerformClick"); } // ------------------------------------------------------------------------------- @@ -1080,29 +999,49 @@ // ------------------------------------------------------------------------------- - (void)tabView:(NSTabView *)tabView willSelectTabViewItem: (NSTabViewItem *)tabViewItem { - //check to see if the cache param tab is the tab that will be selected - if([((NSString*)[tabViewItem identifier]) intValue] == TAB_LINK) - { - [tableViewLink reloadData]; - } + //check to see if the cache param tab is the tab that will be selected + if([((NSString*)[tabViewItem identifier]) intValue] == TAB_LINK) + { + [tableViewLink reloadData]; + } } // ------------------------------------------------------------------------------- // tableViewLinkPerformClick: // ------------------------------------------------------------------------------- - (IBAction) enableDisableKrb5RenewCheck:(id) sender { - //NSLog(@"enableDisableKrb5RenewCheck"); - CFPreferencesSetValue((CFStringRef)PREFERENCE_KRB5_CHECK_ENABLE, - (CFNumberRef) [NSNumber numberWithInt:[(NSButton*)sender intValue]], - (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - //notify the backgrounder - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kPrefChangeNotification]; + //NSLog(@"enableDisableKrb5RenewCheck"); + CFPreferencesSetValue((CFStringRef)PREFERENCE_KRB5_CHECK_ENABLE, + (CFNumberRef) [NSNumber numberWithInt:[(NSButton*)sender intValue]], + (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + //notify the backgrounder + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kPrefChangeNotification]; } // ------------------------------------------------------------------------------- // tableViewLinkPerformClick: // ------------------------------------------------------------------------------- - (IBAction) krb5RenewParamChange:(id) sender { } + + +- (BOOL)isUnlocked { + return [authView authorizationState] == SFAuthorizationViewUnlockedState; +} + +- (void)authorizationViewDidAuthorize:(SFAuthorizationView *)view { + // enable things + [startStopButton setEnabled:[self isUnlocked]]; + [checkButtonAfsAtBootTime setEnabled:[self isUnlocked]]; + [self setAfsStatus]; + [installKRB5AuthAtLoginButton setEnabled:[self isUnlocked]]; +} + +- (void)authorizationViewDidDeauthorize:(SFAuthorizationView *)view { + // disable things + [startStopButton setEnabled:[self isUnlocked]]; + [checkButtonAfsAtBootTime setEnabled:[self isUnlocked]]; + [installKRB5AuthAtLoginButton setEnabled:[self isUnlocked]]; +} @end @implementation AFSCommanderPref (NSTableDataSource) @@ -1116,29 +1055,28 @@ - (void)tableView:(NSTableView *)table setObjectValue:(id)data forTableColumn:(NSTableColumn *)col - row:(int)row + row:(int)row { - NSString *identifier = (NSString*)[col identifier]; - switch([table tag]){ - case TABLE_TOKENS_LIST: - break; - - case TABLE_CELL_LIST: - // we are editing checkbox for cellservdb table - if([identifier intValue] == CELLSRVDB_TABLE_USR_DFLT_CHECK_COLUMN) { - // set the user default cell - DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:row]; - [afsProperty setDefaultCellByName:[cellElement getCellName]]; - //[afsDefaultCellLabel setStringValue:[afsProperty getDefaultCellName]]; - [((NSTableView*)cellList) reloadData]; - } else if([identifier intValue] == CELLSRVDB_TABLE_DFLT_CHECK_COLUMN) { - // set the cell for wich the user want to get token - DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:row]; - [cellElement setUserDefaultForToken:![cellElement userDefaultForToken]]; - } - break; - } + NSString *identifier = (NSString*)[col identifier]; + switch([table tag]){ + case TABLE_TOKENS_LIST: + break; + case TABLE_CELL_LIST: + // we are editing checkbox for cellservdb table + if([identifier intValue] == CELLSRVDB_TABLE_USR_DFLT_CHECK_COLUMN) { + // set the user default cell + DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:row]; + [afsProperty setDefaultCellByName:[cellElement getCellName]]; + //[afsDefaultCellLabel setStringValue:[afsProperty getDefaultCellName]]; + [((NSTableView*)cellList) reloadData]; + } else if([identifier intValue] == CELLSRVDB_TABLE_DFLT_CHECK_COLUMN) { + // set the cell for wich the user want to get token + DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:row]; + [cellElement setUserDefaultForToken:![cellElement userDefaultForToken]]; + } + break; + } } @@ -1146,31 +1084,28 @@ // tableView: // refresh delegate method for two AFSCommander table // ------------------------------------------------------------------------------- -- (id) tableView:(NSTableView *) aTableView - objectValueForTableColumn:(NSTableColumn *) aTableColumn - row:(int) rowIndex +- (id) tableView:(NSTableView *) aTableView +objectValueForTableColumn:(NSTableColumn *) aTableColumn + row:(int) rowIndex { + id result = nil; + NSString *identifier = (NSString*)[aTableColumn identifier]; + switch([aTableView tag]){ + case TABLE_TOKENS_LIST: + //We are refreshing tokens table + result = [self getTableTokensListValue:[identifier intValue] row:rowIndex]; + break; - id result = nil; - NSString *identifier = (NSString*)[aTableColumn identifier]; - switch([aTableView tag]){ - case TABLE_TOKENS_LIST: - //We are refreshing tokens table - result = [self getTableTokensListValue:[identifier intValue] row:rowIndex]; - break; - - case TABLE_CELL_LIST: - //We are refreshing cell db table - result = [self getTableCelListValue:[identifier intValue] row:rowIndex]; - break; - - case TABLE_LINK_LIST: - result = [self getTableLinkValue:[identifier intValue] row:rowIndex]; - break; - - - } - return result; + case TABLE_CELL_LIST: + //We are refreshing cell db table + result = [self getTableCelListValue:[identifier intValue] row:rowIndex]; + break; + + case TABLE_LINK_LIST: + result = [self getTableLinkValue:[identifier intValue] row:rowIndex]; + break; + } + return result; } @@ -1179,14 +1114,14 @@ // ------------------------------------------------------------------------------- - (id)getTableTokensListValue:(int) colId row:(int)row { - id result = nil; - if(!tokenList) return nil; - switch(colId){ - case 0: - result = (NSString*)[tokenList objectAtIndex:row]; - break; - } - return result; + id result = nil; + if(!tokenList) return nil; + switch(colId){ + case 0: + result = (NSString*)[tokenList objectAtIndex:row]; + break; + } + return result; } @@ -1195,26 +1130,26 @@ // ------------------------------------------------------------------------------- - (id)getTableCelListValue:(int) colId row:(int)row { - id result = nil; - //NSMutableArray *cellArray = [afsProperty getCellList]; - DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:row]; - switch(colId){ - case CELLSRVDB_TABLE_USR_DFLT_CHECK_COLUMN: - result = [NSNumber numberWithInt:[cellElement userDefaultForCell]]; - break; - - case CELLSRVDB_TABLE_DFLT_CHECK_COLUMN: - result = [NSNumber numberWithInt:[cellElement userDefaultForToken]]; - break; - case CELLSRVDB_TABLE_NAME_COLUMN: - result = [cellElement getCellName]; - break; - - case CELLSRVDB_TABLE_DESCRIPTION_COLUMN: - result = [cellElement getCellComment]; - break; - } - return result; + id result = nil; + //NSMutableArray *cellArray = [afsProperty getCellList]; + DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:row]; + switch(colId){ + case CELLSRVDB_TABLE_USR_DFLT_CHECK_COLUMN: + result = [NSNumber numberWithInt:[cellElement userDefaultForCell]]; + break; + + case CELLSRVDB_TABLE_DFLT_CHECK_COLUMN: + result = [NSNumber numberWithInt:[cellElement userDefaultForToken]]; + break; + case CELLSRVDB_TABLE_NAME_COLUMN: + result = [cellElement getCellName]; + break; + + case CELLSRVDB_TABLE_DESCRIPTION_COLUMN: + result = [cellElement getCellComment]; + break; + } + return result; } // ------------------------------------------------------------------------------- @@ -1222,18 +1157,18 @@ // ------------------------------------------------------------------------------- - (id)getTableLinkValue:(int) colId row:(int)row { - id result = nil; - NSArray *allKey = [linkConfiguration allKeys]; - switch(colId){ - case TABLE_COLUMN_LINK_NAME: - result = [allKey objectAtIndex:row]; - break; - - case TABLE_COLUMN_LINK_PATH: - result = [linkConfiguration objectForKey:[allKey objectAtIndex:row]]; - break; - } - return result; + id result = nil; + NSArray *allKey = [linkConfiguration allKeys]; + switch(colId){ + case TABLE_COLUMN_LINK_NAME: + result = [allKey objectAtIndex:row]; + break; + + case TABLE_COLUMN_LINK_PATH: + result = [linkConfiguration objectForKey:[allKey objectAtIndex:row]]; + break; + } + return result; } @@ -1242,25 +1177,21 @@ // ------------------------------------------------------------------------------- - (int)numberOfRowsInTableView:(NSTableView *)aTableView { - int rowCount = 0; - //NSMutableArray *cellArray = nil; - switch([aTableView tag]){ - case TABLE_TOKENS_LIST: - if(tokenList) rowCount = [tokenList count]; - break; - - case TABLE_CELL_LIST: - //cellArray = [afsProperty getCellList]; - if(filteredCellDB) rowCount = [filteredCellDB count]; - break; - - case TABLE_LINK_LIST: - if(linkConfiguration) rowCount = [linkConfiguration count]; - break; - - - } - return rowCount; + int rowCount = 0; + switch([aTableView tag]){ + case TABLE_TOKENS_LIST: + if(tokenList) rowCount = [tokenList count]; + break; + + case TABLE_CELL_LIST: + if(filteredCellDB) rowCount = [filteredCellDB count]; + break; + + case TABLE_LINK_LIST: + if(linkConfiguration) rowCount = [linkConfiguration count]; + break; + } + return rowCount; } @end @@ -1271,22 +1202,21 @@ // ------------------------------------------------------------------------------- - (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTable { - switch([aTable tag]){ - case TABLE_TOKENS_LIST: - - break; - - case TABLE_CELL_LIST: - [self tableViewCellmanageButtonState:[aTable selectedRow]]; - break; - - case TABLE_LINK_LIST: - break; - - - } + switch([aTable tag]){ + case TABLE_TOKENS_LIST: + break; - return YES; + case TABLE_CELL_LIST: + [self tableViewCellmanageButtonState:[aTable selectedRow]]; + break; + + case TABLE_LINK_LIST: + break; + + + } + + return YES; } // ------------------------------------------------------------------------------- @@ -1294,56 +1224,50 @@ // ------------------------------------------------------------------------------- - (BOOL)tableView:(NSTableView *)aTable shouldSelectRow:(int)aRow { - switch([aTable tag]){ - case TABLE_TOKENS_LIST: - - break; - - case TABLE_CELL_LIST: - [self tableViewCellmanageButtonState:aRow]; - break; - - case TABLE_LINK_LIST: - break; - - - } + switch([aTable tag]){ + case TABLE_TOKENS_LIST: + break; + + case TABLE_CELL_LIST: + [self tableViewCellmanageButtonState:aRow]; + break; - return YES; + case TABLE_LINK_LIST: + break; + } + return YES; } // ------------------------------------------------------------------------------- // tableView: // ------------------------------------------------------------------------------- - (void)tableViewSelectionDidChange:(NSNotification *)aNotification { - NSTableView *aTable = [aNotification object]; - switch([aTable tag]){ - case TABLE_TOKENS_LIST: - break; - - case TABLE_CELL_LIST: - break; - - case TABLE_LINK_LIST: - [self tableViewLinkmanageButtonState:[aTable selectedRowIndexes]]; - break; - - - } + NSTableView *aTable = [aNotification object]; + switch([aTable tag]){ + case TABLE_TOKENS_LIST: + break; + + case TABLE_CELL_LIST: + break; + + case TABLE_LINK_LIST: + [self tableViewLinkmanageButtonState:[aTable selectedRowIndexes]]; + break; + } } // ------------------------------------------------------------------------------- // manageButtonState: // ------------------------------------------------------------------------------- -(void) tableViewCellmanageButtonState:(int) rowSelected { - [((NSControl*) cellIpButton) setEnabled:rowSelected >= 0]; - [((NSControl*) removeCellButton) setEnabled:rowSelected >= 0]; + [cellIpButton setEnabled:rowSelected >= 0]; + [removeCellButton setEnabled:rowSelected >= 0]; } // ------------------------------------------------------------------------------- // manageButtonState: // ------------------------------------------------------------------------------- -(void) tableViewLinkmanageButtonState:(NSIndexSet *) rowsSelectedIndex { - [buttonRemoveLink setEnabled:[rowsSelectedIndex count]>0]; + [buttonRemoveLink setEnabled:[rowsSelectedIndex count]>0]; } @end @@ -1355,9 +1279,9 @@ - (void)didEndSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { [sheet orderOut:self]; - //Filter the cellServDb and allocate filtered array - [self searchCellTextEvent:nil]; - [((NSTableView*)cellList) reloadData]; + //Filter the cellServDb and allocate filtered array + [self searchCellTextEvent:nil]; + [cellList reloadData]; } // ------------------------------------------------------------------------------- @@ -1365,18 +1289,17 @@ // ------------------------------------------------------------------------------- - (void)didEndCredentialSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { - if([((TokenCredentialController*)credentialCommander) takenToken] == YES){ - /*[AFSPropertyManager klog:[((TokenCredentialController*)credentialCommander) uName] - uPwd:[((TokenCredentialController*)credentialCommander) uPwd] ];*/ - [afsProperty getTokens:true - usr:[((TokenCredentialController*)credentialCommander) uName] - pwd:[((TokenCredentialController*)credentialCommander) uPwd]]; - } + if([((TokenCredentialController*)credentialCommander) takenToken] == YES){ + /*[AFSPropertyManager klog:[((TokenCredentialController*)credentialCommander) uName] + uPwd:[((TokenCredentialController*)credentialCommander) uPwd] ];*/ + [afsProperty getTokens:true + usr:[((TokenCredentialController*)credentialCommander) uName] + pwd:[((TokenCredentialController*)credentialCommander) uPwd]]; + } [sheet orderOut:self]; - [self refreshTokens:nil]; - //Inform afs menuextra to updata afs status - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange]; - + [self refreshTokens:nil]; + //Inform afs menuextra to updata afs status + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange]; } // ------------------------------------------------------------------------------- @@ -1384,7 +1307,7 @@ // ------------------------------------------------------------------------------- - (void)didEndInfoSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { - [sheet orderOut:self]; + [sheet orderOut:self]; } // ------------------------------------------------------------------------------- @@ -1392,9 +1315,8 @@ // ------------------------------------------------------------------------------- - (void)didEndSymlinkSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { - [lyncCreationSheet orderOut:self]; - [self readPreferenceFile]; - [tableViewLink reloadData]; - + [lyncCreationSheet orderOut:self]; + [self readPreferenceFile]; + [tableViewLink reloadData]; } @end diff --git a/src/platform/DARWIN/AFSPreference/AFSPropertyManager.h b/src/platform/DARWIN/AFSPreference/AFSPropertyManager.h index e229c76..0ed4cd4 100644 --- a/src/platform/DARWIN/AFSPreference/AFSPropertyManager.h +++ b/src/platform/DARWIN/AFSPreference/AFSPropertyManager.h @@ -29,7 +29,7 @@ NSString *afsRootMountPoint; int statCacheEntry; int dCacheDim; - int cacheDimension; + int cacheDimension; int daemonNumber; int nVolEntry; bool dynRoot; diff --git a/src/platform/DARWIN/AFSPreference/AFSPropertyManager.m b/src/platform/DARWIN/AFSPreference/AFSPropertyManager.m index fb696da..e96fc74 100644 --- a/src/platform/DARWIN/AFSPreference/AFSPropertyManager.m +++ b/src/platform/DARWIN/AFSPreference/AFSPropertyManager.m @@ -92,7 +92,6 @@ if(cellList) {[cellList removeAllObjects];[cellList release];} if(cellName) {[cellName release];} if(futil) { - [futil endAutorization]; [futil release]; futil = nil; } @@ -360,7 +359,7 @@ NSCharacterSet *returnCS = [NSCharacterSet characterSetWithCharactersInString:@"\n"]; NSFileHandle *fileH = [NSFileHandle fileHandleForReadingAtPath:filePath]; - if (!fileH) return nil; + if (!fileH) return 0; NSData *fileHData = [fileH readDataToEndOfFile]; NSString *cacheInfoStrData = [[NSString alloc] initWithData:fileHData encoding:NSASCIIStringEncoding]; @@ -465,7 +464,7 @@ // ------------------------------------------------------------------------------- -(int) readOldAfsdOption:(NSString*)filePath { - if(!filePath) return nil; + if(!filePath) return 0; return [self readAFSDParamLineContent:[[NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil] stringByStandardizingPath]]; @@ -475,7 +474,7 @@ // readAFSDParamLineContent: // ------------------------------------------------------------------------------- -(int) readAFSDParamLineContent:(NSString*) paramLine{ - if (!paramLine) return nil; + if (!paramLine) return 0; NSString *tmpString = nil; NSCharacterSet *space = [NSCharacterSet characterSetWithCharactersInString:@" "]; @@ -537,16 +536,16 @@ // ------------------------------------------------------------------------------- -(int) readNewAfsdOption:(NSString*)filePath { - if(!filePath) return nil; - NSString *currentLines = nil; - NSString *paramValue = nil; - NSScanner *lineScanner = nil; + if(!filePath) return 0; + NSString *currentLines = 0; + NSString *paramValue = 0; + NSScanner *lineScanner = 0; //Get file content NSString *newAFSDConfContent = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; - if (!newAFSDConfContent) return nil; + if (!newAFSDConfContent) return 0; //get lines in array NSArray *confLines = [newAFSDConfContent componentsSeparatedByString:@"\n"]; @@ -1078,23 +1077,18 @@ // ------------------------------------------------------------------------------- -(void) shutdown { - @try { - const char *stopArgs[] = {"stop", 0L}; - if([[AuthUtil shared] autorize] == noErr) { - [[AuthUtil shared] execUnixCommand:AFS_DAEMON_STARTUPSCRIPT - args:stopArgs - output:nil]; - } - - } - @catch (NSException * e) { - @throw e; - } - @finally { - - } - - + NSString *rootHelperApp = [[NSBundle bundleForClass:[self class]] pathForResource:@"afshlp" ofType:@""]; + @try { + const char *stopArgs[] = {AFS_DAEMON_STARTUPSCRIPT, "stop", 0L}; + [[AuthUtil shared] execUnixCommand:[rootHelperApp fileSystemRepresentation] + args:stopArgs + output:nil]; + } + @catch (NSException * e) { + @throw e; + } + @finally { + } } @@ -1103,24 +1097,20 @@ // ------------------------------------------------------------------------------- -(void) startup { - @try { - const char *startArgs[] = {"start", 0L}; - if([[AuthUtil shared] autorize] == noErr) { - [[AuthUtil shared] execUnixCommand:AFS_DAEMON_STARTUPSCRIPT - args:startArgs - output:nil]; - } - - } - @catch (NSException * e) { - @throw e; - } - @finally { - - } - - + NSString *rootHelperApp = [[NSBundle bundleForClass:[self class]] pathForResource:@"afshlp" ofType:@""]; + @try { + const char *startArgs[] = {AFS_DAEMON_STARTUPSCRIPT, "start", 0L}; + [[AuthUtil shared] execUnixCommand:[rootHelperApp fileSystemRepresentation] + args:startArgs + output:nil]; + } + @catch (NSException * e) { + @throw e; + } + @finally { + } } + // ------------------------------------------------------------------------------- // -(void) saveConfigurationFiles // ------------------------------------------------------------------------------- @@ -1166,13 +1156,6 @@ encoding: NSUTF8StringEncoding error:&err]; - // backup original file - if([futil startAutorization] != noErr){ - @throw [NSException exceptionWithName:@"saveConfigurationFiles:startAutorization" - reason:kUserNotAuth - userInfo:nil]; - } - if(makeBackup) [self backupConfigurationFiles]; // install ThisCell @@ -1220,12 +1203,6 @@ [self writeAfsdOption:useAfsdConfVersion?AFSD_TMP_NEW_PREFERENCE_FILE:AFSD_TMP_OLD_PREFERENCE_FILE]; // backup original file - if([futil startAutorization] != noErr){ - @throw [NSException exceptionWithName:@"AFSPropertyManager:saveCacheConfigurationFiles:startAutorization" - reason:kUserNotAuth - userInfo:nil]; - } - if(makeBackup) { //cacheinfo [self backupFile:@"/etc/cacheinfo"]; @@ -1294,11 +1271,6 @@ { @try{ - if([futil startAutorization] != noErr){ - @throw [NSException exceptionWithName:@"backupConfigurationFiles:startAutorization" - reason:kUserNotAuth - userInfo:nil]; - } //This cell [self backupFile:@"/etc/ThisCell"]; @@ -1308,7 +1280,6 @@ //TheseCell [self backupFile:@"/etc/TheseCells"]; - //[futil endAutorization]; } @catch (NSException *e) { @throw e; } @finally { @@ -1329,8 +1300,6 @@ //Check if the file at path exist NSFileManager *fileManager = [NSFileManager defaultManager]; - - //check if th efile exist if(![fileManager fileExistsAtPath:[filePath stringByExpandingTildeInPath]]) return; // store the source path diff --git a/src/platform/DARWIN/AFSPreference/English.lproj/OpenAFSPreference.xib b/src/platform/DARWIN/AFSPreference/English.lproj/OpenAFSPreference.xib index 80acbdf..b1190ba 100644 --- a/src/platform/DARWIN/AFSPreference/English.lproj/OpenAFSPreference.xib +++ b/src/platform/DARWIN/AFSPreference/English.lproj/OpenAFSPreference.xib @@ -2,30 +2,46 @@ 1050 - 10C540 - 762 - 1038.25 - 458.00 + 11D50d + 2182 + 1138.32 + 568.00 com.apple.InterfaceBuilder.CocoaPlugin - 762 + 2182 - + YES - + NSTabView + NSStepper + NSButton + NSCustomObject + NSTableView + NSCustomView + NSSearchField + NSTextField + NSNumberFormatter + NSSearchFieldCell + NSWindowTemplate + NSTextFieldCell + NSStepperCell + NSButtonCell + NSTableColumn + NSBox + NSView + NSScrollView + NSTabViewItem + NSTextView + NSScroller + NSTableHeaderView YES com.apple.InterfaceBuilder.CocoaPlugin - YES - - YES - - - YES - + PluginDependencyRecalculationVersion + YES @@ -48,7 +64,7 @@ View - {1.79769e+308, 1.79769e+308} + 274 @@ -59,6 +75,8 @@ 256 {{17, 1}, {304, 14}} + + YES 67239424 @@ -97,7 +115,7 @@ YES - 256 + 274 YES @@ -105,6 +123,8 @@ 268 {{13, 7}, {109, 28}} + + YES 67239424 @@ -132,6 +152,8 @@ 265 {{526, 9}, {21, 23}} + + YES -2080244224 @@ -159,6 +181,8 @@ 268 {{138, 13}, {117, 18}} + + YES 67239424 @@ -184,10 +208,14 @@ {{1, 1}, {562, 43}} + + {{17, 423}, {564, 45}} + + {0, 0} 67239424 @@ -223,6 +251,8 @@ 274 {{13, 15}, {572, 401}} + + YES @@ -249,6 +279,8 @@ 256 {516, 140} + + 1 YES @@ -256,13 +288,14 @@ 256 {516, 17} + + - - + + -2147483392 {{-22, 0}, {12, 17}} - YES @@ -318,7 +351,7 @@ 12 - -692060160 + -155189248 2 @@ -327,10 +360,12 @@ 0 YES 0 + 1 {{1, 17}, {516, 140}} + @@ -341,6 +376,8 @@ -2147483392 {{494, 17}, {11, 80}} + + 256 _doScroller: @@ -351,6 +388,8 @@ -2147483392 {{1, 97}, {505, 11}} + + 257 _doScroller: @@ -365,22 +404,22 @@ {{1, 0}, {516, 17}} + 4 - {{17, 199}, {518, 158}} - - 562 + + + 133682 - QSAAAEEgAABBYAAAQWAAAA @@ -388,6 +427,8 @@ 265 {{329, 164}, {80, 28}} + + YES 67239424 @@ -411,6 +452,8 @@ 265 {{407, 164}, {133, 28}} + + YES 67239424 @@ -434,6 +477,8 @@ 268 {{14, 172}, {86, 18}} + + YES 67239424 @@ -458,7 +503,7 @@ YES - 256 + 274 YES @@ -466,6 +511,8 @@ 268 {{5, 32}, {75, 18}} + + YES 67239424 @@ -488,6 +535,8 @@ 268 {{5, 12}, {167, 18}} + + YES 67239424 @@ -510,6 +559,8 @@ 268 {{5, 52}, {170, 18}} + + YES 67239424 @@ -530,10 +581,14 @@ {{1, 1}, {193, 78}} + + {{113, 97}, {195, 94}} + + {0, 0} 67239424 @@ -557,6 +612,8 @@ 268 {{14, 152}, {96, 18}} + + YES 67239424 @@ -574,9 +631,21 @@ 25 + + + 268 + {{3, 3}, {400, 40}} + + + + _NS:9 + SFAuthorizationView + {{10, 25}, {552, 363}} + + Tokens @@ -632,7 +701,7 @@ AXDescription NSAccessibilityEncodedAttributesValueType - + YES cancel @@ -926,7 +995,7 @@ 15 - 1522532352 + 2059403264 1 @@ -935,6 +1004,7 @@ 0 YES 0 + 1 {{1, 17}, {516, 271}} @@ -984,12 +1054,11 @@ {{15, 41}, {518, 289}} - 562 + 133682 - QSAAAEEgAABBiAAAQYgAAA @@ -1032,7 +1101,7 @@ YES - 256 + 274 YES @@ -1075,7 +1144,7 @@ numberStyle positiveFormat - + YES @@ -1096,12 +1165,12 @@ NaN - + YES - - + YES + @@ -1159,7 +1228,7 @@ minimumIntegerDigits positiveFormat - + YES @@ -1177,7 +1246,7 @@ NaN - + @@ -1239,7 +1308,7 @@ minimumIntegerDigits positiveFormat - + YES @@ -1258,7 +1327,7 @@ NaN - + @@ -1363,7 +1432,7 @@ numberStyle positiveFormat - + YES @@ -1387,7 +1456,7 @@ NaN - + @@ -1482,7 +1551,7 @@ numberStyle positiveFormat - + YES @@ -1501,7 +1570,7 @@ NaN - + @@ -1766,7 +1835,7 @@ 17 - -557842432 + -20971520 2 @@ -1775,6 +1844,7 @@ 0 YES 0 + 1 {{1, 17}, {501, 283}} @@ -1823,7 +1893,7 @@ {{17, 41}, {518, 316}} - 50 + 133170 @@ -1913,7 +1983,7 @@ YES - 256 + 274 YES @@ -1965,7 +2035,7 @@ numberStyle positiveInfinitySymbol - + YES @@ -1990,7 +2060,7 @@ NaN - + @@ -2057,7 +2127,7 @@ numberStyle positiveInfinitySymbol - + YES @@ -2082,7 +2152,7 @@ NaN - + @@ -2183,7 +2253,7 @@ numberStyle positiveInfinitySymbol - + YES @@ -2206,7 +2276,7 @@ NaN - + @@ -2269,7 +2339,7 @@ numberStyle positiveInfinitySymbol - + YES @@ -2292,7 +2362,7 @@ NaN - + @@ -2355,7 +2425,7 @@ numberStyle positiveInfinitySymbol - + YES @@ -2378,7 +2448,7 @@ NaN - + @@ -2473,7 +2543,7 @@ numberStyle positiveInfinitySymbol - + YES @@ -2496,7 +2566,7 @@ NaN - + @@ -2582,6 +2652,8 @@ 289 {{323, 3}, {258, 11}} + + YES 68288064 @@ -2600,9 +2672,12 @@ {595, 486} + + - {{0, 0}, {1920, 1178}} - {1.79769e+308, 1.79769e+308} + {{0, 0}, {1680, 1028}} + {10000000000000, 10000000000000} + YES 9 @@ -2616,7 +2691,7 @@ View - {1.79769e+308, 1.79769e+308} + 256 @@ -2635,7 +2710,7 @@ 2322 - {662, 14} + {673, 14} @@ -2653,11 +2728,11 @@ - 662 + 673 1 - 2913 + 67111777 0 @@ -2668,7 +2743,7 @@ NSBackgroundColor NSColor - + YES 6 @@ -2692,7 +2767,7 @@ NSColor NSUnderline - + YES 1 @@ -2702,21 +2777,40 @@ + + 0 6 - {1337, 1e+07} + {1337, 10000000} {114, 0} - {{1, 1}, {662, 423}} + {{1, 1}, {673, 423}} - {4, -5} - 1 + {4, 5} + + 79691776 + + YES + + YES + + + + file://localhost/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/DVTIbeamCursor.tiff + + + + + 3 + MCAwAA + + 4 @@ -2745,7 +2839,7 @@ {{20, 40}, {675, 425}} - 18 + 133138 @@ -2776,8 +2870,9 @@ {715, 485} - {{0, 0}, {1920, 1178}} - {1.79769e+308, 1.79769e+308} + {{0, 0}, {1680, 1028}} + {10000000000000, 10000000000000} + YES InfoController @@ -2876,30 +2971,6 @@ - infoPanel - - - - 226 - - - - texEditInfo - - - - 227 - - - - closePanel: - - - - 228 - - - afsCommanderView @@ -2972,14 +3043,6 @@ - delegate - - - - 669 - - - textSearchField @@ -2995,14 +3058,6 @@ 817 - - delegate - - - - 886 - - startStopAfs: @@ -3252,22 +3307,6 @@ - dataSource - - - - 2060 - - - - delegate - - - - 2061 - - - buttonRemoveLink @@ -3323,70 +3362,6 @@ 2093 - - takeIntegerValueFrom: - - - - 2104 - - - - takeIntegerValueFrom: - - - - 2114 - - - - takeIntegerValueFrom: - - - - 2120 - - - - takeIntegerValueFrom: - - - - 2127 - - - - takeIntValueFrom: - - - - 2128 - - - - takeIntValueFrom: - - - - 2129 - - - - takeIntegerValueFrom: - - - - 2140 - - - - takeIntValueFrom: - - - - 2141 - - nsTextFieldKrb5RenewTimeD @@ -3450,80 +3425,208 @@ 2149 - - - - YES - - 0 - - - + + + authView + + - - -2 - - - File's Owner + 2151 + + + + delegate + + - - -1 - - - First Responder + 669 + + + + delegate + + - - -3 - - - Application + 886 + + + + infoPanel + + - - 12 - - - YES - - - - PrefPane + 226 + + + + texEditInfo + + - - 6 - - - YES - - - - - - + 227 + + + + closePanel: + + - - 101 - - - YES - - - - - - - + 228 + + + + dataSource + + - - 104 - - - YES - - - + 2060 + + + + delegate + + - - 105 + 2061 + + + + takeIntValueFrom: + + + + 2128 + + + + takeIntegerValueFrom: + + + + 2104 + + + + takeIntegerValueFrom: + + + + 2127 + + + + takeIntegerValueFrom: + + + + 2114 + + + + takeIntValueFrom: + + + + 2129 + + + + takeIntegerValueFrom: + + + + 2120 + + + + takeIntValueFrom: + + + + 2141 + + + + takeIntegerValueFrom: + + + + 2140 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 12 + + + YES + + + + PrefPane + + + 6 + + + YES + + + + + + + + + 101 + + + YES + + + + + + + + + + 104 + + + YES + + + + + + 105 YES @@ -3533,6 +3636,7 @@ + @@ -4864,86 +4968,54 @@ + + 2150 + + + YES YES + -1.IBPluginDependency + -2.IBPluginDependency -3.IBPluginDependency - -3.ImportedFromIB2 101.IBPluginDependency - 101.ImportedFromIB2 104.IBPluginDependency - 104.ImportedFromIB2 105.IBPluginDependency - 105.ImportedFromIB2 1103.IBPluginDependency - 1103.ImportedFromIB2 1107.IBPluginDependency - 1107.ImportedFromIB2 1111.IBPluginDependency - 1111.ImportedFromIB2 1122.IBPluginDependency - 1122.ImportedFromIB2 1199.IBPluginDependency - 1199.ImportedFromIB2 - 12.IBEditorWindowLastContentRect 12.IBPluginDependency - 12.IBViewEditorWindowController.showingBoundsRectangles - 12.IBViewEditorWindowController.showingLayoutRectangles 12.IBWindowTemplateEditedContentRect - 12.ImportedFromIB2 - 12.windowTemplate.hasMinSize - 12.windowTemplate.maxSize - 12.windowTemplate.minSize 1203.IBPluginDependency - 1203.ImportedFromIB2 1204.IBPluginDependency - 1204.ImportedFromIB2 1207.IBPluginDependency - 1207.ImportedFromIB2 1209.IBPluginDependency - 1209.ImportedFromIB2 1280.IBPluginDependency - 1280.ImportedFromIB2 1422.IBPluginDependency - 1422.ImportedFromIB2 1426.IBPluginDependency - 1426.ImportedFromIB2 1715.IBPluginDependency - 1715.ImportedFromIB2 177.IBPluginDependency - 177.ImportedFromIB2 178.IBPluginDependency - 178.ImportedFromIB2 1787.IBPluginDependency - 1787.ImportedFromIB2 1789.IBPluginDependency - 1789.ImportedFromIB2 179.IBPluginDependency - 179.ImportedFromIB2 180.IBPluginDependency - 180.ImportedFromIB2 181.IBPluginDependency - 181.ImportedFromIB2 182.IBPluginDependency - 182.ImportedFromIB2 183.IBPluginDependency - 183.ImportedFromIB2 184.IBPluginDependency - 184.ImportedFromIB2 1845.IBPluginDependency - 1845.ImportedFromIB2 185.IBPluginDependency - 185.ImportedFromIB2 186.IBPluginDependency - 186.ImportedFromIB2 1902.IBPluginDependency - 1902.ImportedFromIB2 1960.IBAttributePlaceholdersKey 1960.IBPluginDependency - 1960.ImportedFromIB2 1964.IBPluginDependency 1965.IBPluginDependency 1966.IBPluginDependency @@ -4980,7 +5052,6 @@ 1998.IBPluginDependency 1999.IBPluginDependency 200.IBPluginDependency - 200.ImportedFromIB2 2000.IBPluginDependency 2000.IBShouldRemoveOnLegacySave 2001.IBPluginDependency @@ -5034,7 +5105,6 @@ 2066.IBPluginDependency 2067.IBPluginDependency 207.IBPluginDependency - 207.ImportedFromIB2 2071.IBPluginDependency 2072.IBPluginDependency 2073.IBAttributePlaceholdersKey @@ -5048,13 +5118,8 @@ 2077.IBPluginDependency 2078.IBPluginDependency 2079.IBPluginDependency - 208.IBEditorWindowLastContentRect 208.IBPluginDependency 208.IBWindowTemplateEditedContentRect - 208.ImportedFromIB2 - 208.windowTemplate.hasMinSize - 208.windowTemplate.maxSize - 208.windowTemplate.minSize 2080.IBNumberFormatterBehaviorMetadataKey 2080.IBNumberFormatterLocalizesFormatMetadataKey 2080.IBPluginDependency @@ -5063,7 +5128,6 @@ 2087.IBPluginDependency 2088.IBPluginDependency 209.IBPluginDependency - 209.ImportedFromIB2 2100.IBPluginDependency 2101.IBPluginDependency 2102.IBAttributePlaceholdersKey @@ -5103,148 +5167,84 @@ 2138.IBPluginDependency 2139.IBPluginDependency 214.IBPluginDependency - 214.ImportedFromIB2 215.IBPluginDependency - 215.ImportedFromIB2 + 2150.IBPluginDependency 216.IBPluginDependency - 216.ImportedFromIB2 - 224.ImportedFromIB2 + 224.IBPluginDependency 265.IBPluginDependency - 265.ImportedFromIB2 337.IBPluginDependency - 337.ImportedFromIB2 338.IBPluginDependency - 338.ImportedFromIB2 339.IBPluginDependency - 339.ImportedFromIB2 340.IBPluginDependency - 340.ImportedFromIB2 342.IBPluginDependency - 342.ImportedFromIB2 344.IBAttributePlaceholdersKey 344.IBPluginDependency - 344.ImportedFromIB2 345.IBPluginDependency - 345.ImportedFromIB2 348.IBAttributePlaceholdersKey 348.IBPluginDependency - 348.ImportedFromIB2 349.IBPluginDependency - 349.ImportedFromIB2 352.IBPluginDependency - 352.ImportedFromIB2 400.IBPluginDependency - 400.ImportedFromIB2 402.IBPluginDependency - 402.ImportedFromIB2 404.IBAttributePlaceholdersKey 404.IBPluginDependency - 404.ImportedFromIB2 406.IBPluginDependency - 406.ImportedFromIB2 408.IBAttributePlaceholdersKey 408.IBPluginDependency - 408.ImportedFromIB2 411.IBNumberFormatterLocalizesFormatMetadataKey 411.IBPluginDependency - 411.ImportedFromIB2 413.IBPluginDependency - 413.ImportedFromIB2 415.IBAttributePlaceholdersKey 415.IBPluginDependency - 415.ImportedFromIB2 417.IBNumberFormatterLocalizesFormatMetadataKey 417.IBPluginDependency - 417.ImportedFromIB2 425.IBPluginDependency - 425.ImportedFromIB2 475.IBPluginDependency - 475.ImportedFromIB2 6.IBPluginDependency - 6.ImportedFromIB2 740.IBNumberFormatterLocalizesFormatMetadataKey 740.IBPluginDependency - 740.ImportedFromIB2 741.IBNumberFormatterLocalizesFormatMetadataKey 741.IBPluginDependency - 741.ImportedFromIB2 742.IBNumberFormatterLocalizesFormatMetadataKey 742.IBPluginDependency - 742.ImportedFromIB2 - + YES com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{208, 366}, {595, 486}} com.apple.InterfaceBuilder.CocoaPlugin - - + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{208, 366}, {595, 486}} - - - {3.40282e+38, 3.40282e+38} - {0, 0} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - ToolTip @@ -5254,7 +5254,6 @@ com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -5299,7 +5298,6 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -5353,7 +5351,6 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -5381,13 +5378,8 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{0, 510}, {715, 485}} com.apple.InterfaceBuilder.CocoaPlugin {{0, 510}, {715, 485}} - - - {3.40282e+38, 3.40282e+38} - {0, 0} com.apple.InterfaceBuilder.CocoaPlugin @@ -5403,7 +5395,6 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -5471,24 +5462,16 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin ToolTip @@ -5498,9 +5481,7 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - ToolTip @@ -5510,15 +5491,10 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - ToolTip @@ -5528,9 +5504,7 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - ToolTip @@ -5540,12 +5514,9 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - ToolTip @@ -5555,44 +5526,32 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - YES - - YES - + YES - - YES - + - 2149 + 2151 @@ -5628,7 +5587,7 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg tableViewLinkPerformClick: unlog: - + YES id id @@ -5655,53 +5614,170 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg id - + YES YES - addCellButton - afsCommanderView - afsDB - afsDefaultCellLabel - afsMenucheckBox - afsRootMountPoint - afsVersionLabel - aklogCredentialAtLoginTime - backgrounderActivationCheck - buttonAddLink - buttonRemoveLink - cacheDimension - cellIpButton - cellList - checkButtonAfsAtBootTime - checkEnableLink - credentialCommander - credentialSheet - dCacheDim - daemonNumber - dynRoot - groupsBox - infoController - infoSheet - installKRB5AuthAtLoginButton - ipConfControllerCommander - ipConfigurationSheet - labelSaveResult - lyncCreationSheet - lynkCreationController - nVolEntry - nsButtonEnableDisableKrb5RenewCheck - nsStepperKrb5RenewTimeD - nsStepperKrb5RenewTimeH - nsStepperKrb5RenewTimeM - nsStepperKrb5RenewTimeS - nsTextFieldKrb5RenewCheckIntervall - nsTextFieldKrb5RenewTimeD - nsTextFieldKrb5RenewTimeH - nsTextFieldKrb5RenewTimeM - nsTextFieldKrb5RenewTimeS - nsTextFieldKrb5SecToExpireDateForRenew - removeCellButton + addLink: + addRemoveCell: + afsMenuActivationEvent: + afsStartupSwitchEvent: + aklogSwitchEvent: + credentialAtLoginTimeEvent: + enableDisableKrb5RenewCheck: + enableLink: + getNewToken: + info: + krb5KredentialAtLoginTimeEvent: + krb5RenewParamChange: + manageBackgrounderActivation: + refreshConfiguration: + removeLink: + saveCacheManagerParam: + saveConfiguration: + searchCellTextEvent: + showCellIP: + startStopAfs: + tableDoubleAction: + tableViewLinkPerformClick: + unlog: + + + YES + + addLink: + id + + + addRemoveCell: + id + + + afsMenuActivationEvent: + id + + + afsStartupSwitchEvent: + id + + + aklogSwitchEvent: + id + + + credentialAtLoginTimeEvent: + id + + + enableDisableKrb5RenewCheck: + id + + + enableLink: + id + + + getNewToken: + id + + + info: + id + + + krb5KredentialAtLoginTimeEvent: + id + + + krb5RenewParamChange: + id + + + manageBackgrounderActivation: + id + + + refreshConfiguration: + id + + + removeLink: + id + + + saveCacheManagerParam: + id + + + saveConfiguration: + id + + + searchCellTextEvent: + id + + + showCellIP: + id + + + startStopAfs: + id + + + tableDoubleAction: + id + + + tableViewLinkPerformClick: + id + + + unlog: + id + + + + + YES + + YES + addCellButton + afsCommanderView + afsDB + afsDefaultCellLabel + afsMenucheckBox + afsRootMountPoint + afsVersionLabel + aklogCredentialAtLoginTime + authView + backgrounderActivationCheck + buttonAddLink + buttonRemoveLink + cacheDimension + cellIpButton + cellList + checkButtonAfsAtBootTime + checkEnableLink + dCacheDim + daemonNumber + dynRoot + groupsBox + installKRB5AuthAtLoginButton + lynkCreationController + nVolEntry + nsButtonEnableDisableKrb5RenewCheck + nsStepperKrb5RenewTimeD + nsStepperKrb5RenewTimeH + nsStepperKrb5RenewTimeM + nsStepperKrb5RenewTimeS + nsTextFieldKrb5RenewCheckIntervall + nsTextFieldKrb5RenewTimeD + nsTextFieldKrb5RenewTimeH + nsTextFieldKrb5RenewTimeM + nsTextFieldKrb5RenewTimeS + nsTextFieldKrb5SecToExpireDateForRenew + removeCellButton saveConfigurationButton startStopButton statCacheEntry @@ -5714,7 +5790,7 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg useAklogCheck verbose - + YES NSControl NSView @@ -5724,6 +5800,7 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg NSTextField NSTextField NSButton + SFAuthorizationView NSButton NSButton NSButton @@ -5732,19 +5809,11 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg NSTableView NSButton NSButton - id - id NSTextField NSTextField NSButton NSBox - id - id NSButton - id - id - id - id LynkCreationController NSTextField NSButton @@ -5772,38 +5841,253 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg NSButton - - IBProjectSource - AFSCommanderPref.h - - - - AFSCommanderPref - NSPreferencePane - + YES YES - cellPopupButton - getTokenButton + addCellButton + afsCommanderView + afsDB + afsDefaultCellLabel + afsMenucheckBox + afsRootMountPoint + afsVersionLabel + aklogCredentialAtLoginTime + authView + backgrounderActivationCheck + buttonAddLink + buttonRemoveLink + cacheDimension + cellIpButton + cellList + checkButtonAfsAtBootTime + checkEnableLink + dCacheDim + daemonNumber + dynRoot + groupsBox + installKRB5AuthAtLoginButton + lynkCreationController + nVolEntry + nsButtonEnableDisableKrb5RenewCheck + nsStepperKrb5RenewTimeD + nsStepperKrb5RenewTimeH + nsStepperKrb5RenewTimeM + nsStepperKrb5RenewTimeS + nsTextFieldKrb5RenewCheckIntervall + nsTextFieldKrb5RenewTimeD + nsTextFieldKrb5RenewTimeH + nsTextFieldKrb5RenewTimeM + nsTextFieldKrb5RenewTimeS + nsTextFieldKrb5SecToExpireDateForRenew + removeCellButton + saveConfigurationButton + startStopButton + statCacheEntry + tableViewLink + textFieldDevInfoLabel + textSearchField + tokensButton + tokensTable + unlogButton + useAklogCheck + verbose - + YES - NSPopUpButton - NSPopUpButton + + addCellButton + NSControl + + + afsCommanderView + NSView + + + afsDB + NSButton + + + afsDefaultCellLabel + NSTextField + + + afsMenucheckBox + NSControl + + + afsRootMountPoint + NSTextField + + + afsVersionLabel + NSTextField + + + aklogCredentialAtLoginTime + NSButton + + + authView + SFAuthorizationView + + + backgrounderActivationCheck + NSButton + + + buttonAddLink + NSButton + + + buttonRemoveLink + NSButton + + + cacheDimension + NSTextField + + + cellIpButton + NSControl + + + cellList + NSTableView + + + checkButtonAfsAtBootTime + NSButton + + + checkEnableLink + NSButton + + + dCacheDim + NSTextField + + + daemonNumber + NSTextField + + + dynRoot + NSButton + + + groupsBox + NSBox + + + installKRB5AuthAtLoginButton + NSButton + + + lynkCreationController + LynkCreationController + + + nVolEntry + NSTextField + + + nsButtonEnableDisableKrb5RenewCheck + NSButton + + + nsStepperKrb5RenewTimeD + NSStepper + + + nsStepperKrb5RenewTimeH + NSStepper + + + nsStepperKrb5RenewTimeM + NSStepper + + + nsStepperKrb5RenewTimeS + NSStepper + + + nsTextFieldKrb5RenewCheckIntervall + NSTextField + + + nsTextFieldKrb5RenewTimeD + NSTextField + + + nsTextFieldKrb5RenewTimeH + NSTextField + + + nsTextFieldKrb5RenewTimeM + NSTextField + + + nsTextFieldKrb5RenewTimeS + NSTextField + + + nsTextFieldKrb5SecToExpireDateForRenew + NSTextField + + + removeCellButton + NSControl + + + saveConfigurationButton + NSControl + + + startStopButton + NSButton + + + statCacheEntry + NSTextField + + + tableViewLink + NSTableView + + + textFieldDevInfoLabel + NSTextField + + + textSearchField + NSSearchField + + + tokensButton + NSButton + + + tokensTable + NSTableView + + + unlogButton + NSButton + + + useAklogCheck + NSButton + + + verbose + NSButton + - IBUserSource - - - - - FirstResponder - NSObject - - IBUserSource - + IBProjectSource + ./Classes/AFSCommanderPref.h @@ -5813,30 +6097,16 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg closePanel: id - - YES - - YES - infoPanel - texEditInfo - - - YES - id - id + + closePanel: + + closePanel: + id IBProjectSource - InfoController.h - - - - InfoController - NSObject - - IBUserSource - + ./Classes/InfoController.h @@ -5850,13 +6120,37 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg save: selectLinkDest: - + YES id id id + + YES + + YES + cancell: + save: + selectLinkDest: + + + YES + + cancell: + id + + + save: + id + + + selectLinkDest: + id + + + YES @@ -5865,402 +6159,40 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg textFieldLinkDestPath textfieldLinkName - + YES NSPanel NSTextField NSTextField + + YES + + YES + lynkCreationSheet + textFieldLinkDestPath + textfieldLinkName + + + YES + + lynkCreationSheet + NSPanel + + + textFieldLinkDestPath + NSTextField + + + textfieldLinkName + NSTextField + + + IBProjectSource - LynkCreationController.h - - - - NSPreferencePane - NSObject - - IBUserSource - - - - - - YES - - NSActionCell - NSCell - - IBFrameworkSource - AppKit.framework/Headers/NSActionCell.h - - - - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - - - NSBox - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSBox.h - - - - NSButton - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSButton.h - - - - NSButtonCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSButtonCell.h - - - - NSCell - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSCell.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSNumberFormatter - NSFormatter - - IBFrameworkSource - Foundation.framework/Headers/NSNumberFormatter.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSPanel - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSPanel.h - - - - NSPopUpButton - NSButton - - IBFrameworkSource - AppKit.framework/Headers/NSPopUpButton.h + ./Classes/LynkCreationController.h @@ -6275,7 +6207,7 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg _lastKeyView _window - + YES NSView NSView @@ -6283,189 +6215,38 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg NSWindow - - IBFrameworkSource - PreferencePanes.framework/Headers/NSPreferencePane.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSScrollView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSScrollView.h - - - - NSScroller - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSScroller.h - - - - NSSearchField - NSTextField - - IBFrameworkSource - AppKit.framework/Headers/NSSearchField.h - - - - NSSearchFieldCell - NSTextFieldCell - - IBFrameworkSource - AppKit.framework/Headers/NSSearchFieldCell.h - - - - NSStepper - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSStepper.h - - - - NSStepperCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSStepperCell.h - - - - NSTabView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSTabView.h - - - - NSTabViewItem - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTabViewItem.h - - - - NSTableColumn - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableColumn.h - - - - NSTableHeaderView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSTableHeaderView.h - - - - NSTableView - NSControl - - - - NSText - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSText.h - - - - NSTextField - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSTextField.h - - - - NSTextFieldCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSTextFieldCell.h - - - - NSTextView - NSText - - IBFrameworkSource - AppKit.framework/Headers/NSTextView.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h - - - - NSView - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h - - - - NSWindow - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h + + YES + + YES + _firstKeyView + _initialKeyView + _lastKeyView + _window + + + YES + + _firstKeyView + NSView + + + _initialKeyView + NSView + + + _lastKeyView + NSView + + + _window + NSWindow + + - - - NSWindow - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h + IBProjectSource + ./Classes/NSPreferencePane.h @@ -6481,7 +6262,6 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg YES - ../OpenAFS.xcodeproj 3 NSSwitch diff --git a/src/platform/DARWIN/AFSPreference/IpConfiguratorCommander.m b/src/platform/DARWIN/AFSPreference/IpConfiguratorCommander.m index 3042397..70a50ab 100644 --- a/src/platform/DARWIN/AFSPreference/IpConfiguratorCommander.m +++ b/src/platform/DARWIN/AFSPreference/IpConfiguratorCommander.m @@ -16,8 +16,8 @@ // ------------------------------------------------------------------------------- - (void)awakeFromNib { - [((NSTableView*)tableViewCellIP) setDelegate:self]; - [((NSTableView*)tableViewCellIP) setDataSource:self]; + [tableViewCellIP setDelegate:self]; + [tableViewCellIP setDataSource:self]; } // ------------------------------------------------------------------------------- @@ -44,8 +44,8 @@ - (void) commitModify { //store the cell name - [cellElement setCellName:[((NSControl*) textFieldCellName) stringValue]]; - [cellElement setCellComment:[((NSControl*) textFieldComment) stringValue]]; + [cellElement setCellName:[textFieldCellName stringValue]]; + [cellElement setCellComment:[textFieldComment stringValue]]; [bkIPArray removeAllObjects]; [bkIPArray setArray:workIPArray]; [workIPArray release]; @@ -81,8 +81,8 @@ [workIPArray addObject:ip]; [ip release]; currentSelectedIP = ip; - [((NSTableView*)tableViewCellIP) reloadData]; - [((NSTableView *) tableViewCellIP) scrollRowToVisible:[[cellElement getIp] count]-1]; + [tableViewCellIP reloadData]; + [tableViewCellIP scrollRowToVisible:[[cellElement getIp] count]-1]; } // ------------------------------------------------------------------------------- @@ -90,10 +90,10 @@ // ------------------------------------------------------------------------------- - (IBAction) cancelIP:(id) sender { - [workIPArray removeObjectAtIndex:[((NSTableView*)tableViewCellIP) selectedRow]]; - [((NSTableView*)tableViewCellIP) deselectAll:nil]; + [workIPArray removeObjectAtIndex:[tableViewCellIP selectedRow]]; + [tableViewCellIP deselectAll:nil]; [self manageTableSelection:-1]; - [((NSTableView*)tableViewCellIP) reloadData]; + [tableViewCellIP reloadData]; } @@ -110,9 +110,9 @@ // ------------------------------------------------------------------------------- - (void) loadValueFromCellIPClass { - [((NSTextField*)textFieldCellName) setStringValue:[cellElement getCellName]]; - [((NSTextField*)textFieldComment) setStringValue:[cellElement getCellComment]]; - [((NSTableView*)tableViewCellIP) reloadData]; + [textFieldCellName setStringValue:[cellElement getCellName]]; + [textFieldComment setStringValue:[cellElement getCellComment]]; + [tableViewCellIP reloadData]; } // ------------------------------------------------------------------------------- @@ -121,7 +121,7 @@ - (void) manageTableSelection:(int)row { //[((NSControl*) modifyButton) setEnabled:row>=0]; - [((NSControl*) deleteButton) setEnabled:row>=0]; + [deleteButton setEnabled:row>=0]; } - (id) getPanel @@ -194,7 +194,7 @@ forTableColumn:(NSTableColumn *)aCol row:(int)aRow { CellIp *ipElement = (CellIp*)[workIPArray objectAtIndex:aRow]; - switch([((NSNumber*)[aCol identifier]) intValue]) + switch([[aCol identifier] intValue]) { case 1: [ipElement setCellIp:[aData description]]; diff --git a/src/platform/DARWIN/AFSPreference/PListManager.h b/src/platform/DARWIN/AFSPreference/PListManager.h index c1fb051..44f90bf 100644 --- a/src/platform/DARWIN/AFSPreference/PListManager.h +++ b/src/platform/DARWIN/AFSPreference/PListManager.h @@ -40,7 +40,7 @@ @abstract Enable or disable the system to get kerberos ticket at login time @discussion <#(comprehensive description)#> */ -+(void) krb5TiketAtLoginTime:(BOOL)enable; ++(void) krb5TiketAtLoginTime:(BOOL)enable helper:(NSString *)helper; /*! @method checkKrb5AtLoginTimeLaunchdEnable @@ -80,9 +80,7 @@ @abstract exec the launchctl command on a particular plist job @discussion <#(comprehensive description)#> */ -+(void) launchctlStringCommand:(NSString*)operation - option:(NSArray*)option - plistName:(NSString*)plistName; ++(void) launchctlStringCommandAuth:(NSString*)operation option:(NSArray*)option plistName:(NSString*)plistName helper:(NSString *)helper withAuthRef:(AuthorizationRef)authRef; /*! @method launchdJobState @abstract check is a job has been submitted to launchd diff --git a/src/platform/DARWIN/AFSPreference/PListManager.m b/src/platform/DARWIN/AFSPreference/PListManager.m index 8497870..977f962 100644 --- a/src/platform/DARWIN/AFSPreference/PListManager.m +++ b/src/platform/DARWIN/AFSPreference/PListManager.m @@ -17,7 +17,8 @@ // ------------------------------------------------------------------------------- // krb5TiketAtLoginTime: // ------------------------------------------------------------------------------- -+(void) krb5TiketAtLoginTime:(BOOL)enable{ ++(void) krb5TiketAtLoginTime:(BOOL)enable helper:(NSString *)helper +{ NSData *plistData = nil; NSString *error = nil; NSString *toRemove = nil; @@ -112,16 +113,15 @@ //now we can move the file futil = [[FileUtil alloc] init]; - if([futil startAutorization] == noErr) { - if(![[NSFileManager defaultManager] fileExistsAtPath:AUTH_FILE_BK]) { - //bk file doesn't exist so make it - [futil autorizedCopy:AUTH_FILE toPath:AUTH_FILE_BK]; - } - // chmod on tmp file - [futil autorizedChown:TMP_FILE owner:@"root" group:@"wheel"]; - //move the file - [futil autorizedMoveFile:TMP_FILE toPath:AUTH_FILE_DIR]; + if(![[NSFileManager defaultManager] fileExistsAtPath:AUTH_FILE_BK]) { + //bk file doesn't exist so make it + [futil autorizedCopy:AUTH_FILE toPath:AUTH_FILE_BK]; } + // chmod on tmp file + [futil autorizedChown:TMP_FILE owner:@"root" group:@"wheel"]; + //move the file + [futil autorizedMoveFile:TMP_FILE toPath:AUTH_FILE_DIR]; + [futil release]; } @@ -223,9 +223,9 @@ // installAfsStartupLaunchdFile: // ------------------------------------------------------------------------------- +(void) manageAfsStartupLaunchdFile:(BOOL)enable - afsStartupScript:(NSString*)afsStartupScript - afsBasePath:(NSString*)afsBasePath - afsdPath:(NSString*)afsdPath { + afsStartupScript:(NSString*)afsStartupScript + afsBasePath:(NSString*)afsBasePath + afsdPath:(NSString*)afsdPath { NSData *plistData = nil; NSMutableDictionary *launchdDic = nil; NSString *error = nil; @@ -288,9 +288,10 @@ // launchctlCommand: // ------------------------------------------------------------------------------- +(void) launchctlCommand:(BOOL)enable - userDomain:(BOOL)userDomain - option:(NSArray*)option - plistName:(NSString*)plistName { + userDomain:(BOOL)userDomain + option:(NSArray*)option + plistName:(NSString*)plistName +{ NSMutableArray *argument = [NSMutableArray array]; NSMutableString *commandPath = [NSMutableString stringWithCapacity:0]; NSUInteger searchDomain = userDomain?NSUserDomainMask:NSSystemDomainMask; @@ -307,17 +308,21 @@ [commandPath appendFormat:@"/LaunchAgents/%@", plistName]; [argument addObject:commandPath]; + //exec the command - [TaskUtil executeTaskSearchingPath:@"launchctl" - args:argument]; + [TaskUtil executeTask:@"/bin/launchctl" + arguments:argument]; } // ------------------------------------------------------------------------------- // launchctlCommand: // ------------------------------------------------------------------------------- -+(void) launchctlStringCommand:(NSString*)operation - option:(NSArray*)option - plistName:(NSString*)plistName { ++(void) launchctlStringCommandAuth:(NSString *)operation + option:(NSArray *)option + plistName:(NSString *)plistName + helper:(NSString *)helper + withAuthRef:(AuthorizationRef)authRef +{ NSMutableArray *argument = [NSMutableArray array]; //set the load unload @@ -330,8 +335,8 @@ [argument addObject: plistName]; //exec the command - [TaskUtil executeTaskSearchingPath:@"launchctl" - args:argument]; + [TaskUtil executeTaskWithAuth:@"/bin/launchctl" + arguments:argument helper:helper withAuthRef:authRef]; } // ------------------------------------------------------------------------------- diff --git a/src/platform/DARWIN/AFSPreference/TaskUtil.h b/src/platform/DARWIN/AFSPreference/TaskUtil.h index b7fc7ec..459b68e 100644 --- a/src/platform/DARWIN/AFSPreference/TaskUtil.h +++ b/src/platform/DARWIN/AFSPreference/TaskUtil.h @@ -16,4 +16,5 @@ +(NSString*) executeTaskSearchingPath:(NSString*)unixCommand args:(NSArray*)args; +(NSString*) executeTask:(NSString*) taskName arguments:(NSArray *)args; +(int) executeTaskWithAuth:(NSString*) taskName arguments:(NSArray *)args authExtForm:(NSData*)auth; ++(int) executeTaskWithAuth:(NSString*) taskName arguments:(NSArray *)args helper:(NSString *)helper withAuthRef:(AuthorizationRef)authRef; @end diff --git a/src/platform/DARWIN/AFSPreference/TaskUtil.m b/src/platform/DARWIN/AFSPreference/TaskUtil.m index c27ee8f..3c94524 100644 --- a/src/platform/DARWIN/AFSPreference/TaskUtil.m +++ b/src/platform/DARWIN/AFSPreference/TaskUtil.m @@ -7,6 +7,7 @@ // #import "TaskUtil.h" +#import "AuthUtil.h" @implementation TaskUtil @@ -75,6 +76,36 @@ // ------------------------------------------------------------------------------- // executeTask: // ------------------------------------------------------------------------------- ++(int) executeTaskWithAuth:(NSString*) taskName arguments:(NSArray *)args helper:(NSString *)helper withAuthRef:(AuthorizationRef)authRef { + const char *rootHelperApp = [helper fileSystemRepresentation]; + OSStatus status; + AuthorizationFlags flags = kAuthorizationFlagDefaults; + int count = [args count]; + char **myArguments = calloc(count + 2, sizeof(char *)); + int i=0; + + myArguments[0] = strdup([taskName UTF8String]); + for(i=0;i < count;i++) { + const char *string = [[args objectAtIndex:i] UTF8String]; + if(!string) + break; + myArguments[1+i] = strdup(string); + } + myArguments[1+i] = NULL; + + // should use SMJobBless but we need to sign things... + status = AuthorizationExecuteWithPrivileges(authRef, rootHelperApp, flags, myArguments, NULL); + + i = 0; + while (myArguments[i] != NULL) { + free(myArguments[i]); + i++; + } + + free(myArguments); + return status; +} + +(int) executeTaskWithAuth:(NSString*) taskName arguments:(NSArray *)args authExtForm:(NSData*)auth { NSString *result = nil; int status = 0; diff --git a/src/platform/DARWIN/AFSPreference/afshlp.m b/src/platform/DARWIN/AFSPreference/afshlp.m index ad59d94..5d2f702 100644 --- a/src/platform/DARWIN/AFSPreference/afshlp.m +++ b/src/platform/DARWIN/AFSPreference/afshlp.m @@ -1,213 +1,11 @@ -// -// afshlp.m -// AFSCommander -// -// Created by Claudio on 28/06/07. -// - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#import "TaskUtil.h" -#import "AuthUtil.h" -#import "PListManager.h" - -#define AFS_DAEMON_STARTUPSCRIPT "/Library/OpenAFS/Tools/root.client/usr/vice/etc/afs.rc" -#define AFS_DAEMON_PATH "/Library/LaunchDaemons/org.openafs.filesystems.afs.plist" - - void stopAfs(int argc, char *argv[]); - void getPath(char **selfPathPtr); - void selfRepair(char *selfPath); - void runWithSelfRepair(char *selfPath,int argc, char *argv[]); - -int main(int argc, char *argv[]) -{ - if (argc < 2) - return 1; // nothing to do - NSString *cmdString = [NSString stringWithCString:(const char *)argv[1] encoding:NSUTF8StringEncoding]; - - if(argc == 2 && [cmdString rangeOfString:@"stop_afs"].location!=NSNotFound ){ - if (setuid(0) == -1) - return 1; - const char *stopArgs[] = {"stop", 0L}; - [[AuthUtil shared] execUnixCommand:AFS_DAEMON_STARTUPSCRIPT - args:stopArgs - output:nil]; - } else if(argc == 2 && [cmdString rangeOfString:@"start_afs"].location!=NSNotFound){ - if (setuid(0) == -1) - return 1; - const char *startArgs[] = {"start", 0L}; - [[AuthUtil shared] execUnixCommand:AFS_DAEMON_STARTUPSCRIPT - args:startArgs - output:nil]; - } else if(argc == 4 && [cmdString rangeOfString:@"enable_krb5_startup"].location!=NSNotFound) { - int olduid = getuid(); - setuid(0); - int arg2 = atoi(argv[2]); - [PListManager krb5TiketAtLoginTime:[[NSNumber numberWithInt:arg2] boolValue]]; - } else if(argc == 3 && [cmdString rangeOfString:@"start_afs_at_startup"].location!=NSNotFound){ - if (setuid(0) == -1) - return 1; - BOOL enable = strcmp("enable", argv[2])==0; - NSLog(@"Manage start_afs_at_startup with option %s from helper", argv[2]); - [PListManager launchctlStringCommand:enable?@"load":@"unload" - option:[NSArray arrayWithObjects:@"-w", nil] - plistName:@AFS_DAEMON_PATH]; -#if 0 - } else if(argc == 2 && [cmdString rangeOfString:@"check_afs_daemon"].location!=NSNotFound) { - NSString *fsResult = [TaskUtil executeTaskSearchingPath:@"launchctl" args:[NSArray arrayWithObjects: @"list", nil]]; - BOOL checkAfsDaemon = (fsResult?([fsResult rangeOfString:@"org.openafs.filesystems.afs"].location != NSNotFound):NO); - printf("afshlp:afs daemon registration result:%d",checkAfsDaemon); -#endif - } - return 0; -} - -#if 0 -void stopAfs(int argc, char *argv[]) -{ - const char *umountArgs[] = {"-f", "/afs", 0L}; - [[AuthUtil shared] execUnixCommand:"/sbin/umount" - args:umountArgs - output:nil]; - - const char *afsdArgs[] = {"-shutdown", 0L}; - [[AuthUtil shared] execUnixCommand:argv[3] - args:afsdArgs - output:nil]; - - const char *kernelExtArgs[] = {argv[2], 0L}; - [[AuthUtil shared] execUnixCommand:"/sbin/kextunload" - args:kernelExtArgs - output:nil]; - - [[AuthUtil shared] deautorize]; -} - -// Code to get the path to the executable using _NSGetExecutablePath. -void getPath(char **selfPathPtr) -{ - uint32_t selfPathSize = MAXPATHLEN; - if(!(*selfPathPtr = malloc(selfPathSize))) - { - exit(-1); - } - if(_NSGetExecutablePath(*selfPathPtr, &selfPathSize) == -1) - { - // Try reallocating selfPath with the size returned by the function. - if(!(*selfPathPtr = realloc(*selfPathPtr, selfPathSize + 1))) - { - NSLog(@"Could not allocate memory to hold executable path."); - exit(-1); - } - if(_NSGetExecutablePath(*selfPathPtr, &selfPathSize) != 0) - { - NSLog(@"Could not get executable path."); - exit(-1); - } - } -} - -int main(int argc, char *argv[]) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - char *selfPath; - - NSLog(@"num of arguments %d", argc); - int status = [[AuthUtil shared] autorize]; - if(status != noErr) exit(-1); - - // Get the path to the tool's executable - getPath(&selfPath); - - //selfRepair(selfPath); - // All done with the executable path - if(selfPath) free(selfPath); - - // Now do the real work of running the command. - runCommand(argc, argv); - [[AuthUtil shared] deautorize]; - [pool release]; - - return 0; -} - -// Self-repair code. Found somehwere in internet -void selfRepair(char *selfPath) +int +main(int argc, char *argv[], char *envp[]) { - struct stat st; - int fdTool; - printf("selfRepair"); - -// [[AuthUtil shared] autorize]; - - // Open tool exclusively, noone can touch it when we work on it, this idea i kepped somewhere in internet - fdTool = open(selfPath, O_NONBLOCK | O_RDONLY | O_EXLOCK, 0); - - if(fdTool == -1) - { - NSLog(@"Open Filed: %d.", errno); - exit(-1); - } - - if(fstat(fdTool, &st)) - { - NSLog(@"fstat failed."); - exit(-1); - } - - // Disable group and world writability and make setuid root. - if ((st.st_uid != 0) || (st.st_mode & S_IWGRP) || (st.st_mode & S_IWOTH) || - !(st.st_mode & S_ISUID)) - { - fchown(fdTool, 0, st.st_gid); - fchmod(fdTool, (st.st_mode & (~(S_IWGRP | S_IWOTH))) | S_ISUID); - } else NSLog(@"st_uid = 0"); - - close(fdTool); - - NSLog(@"Self-repair done."); + int euid; + euid = geteuid(); + if (setuid(euid) != 0) + return -1; + return execve(argv[1], &argv[1], envp); } - -// Code to execute the tool in self-repair mode. -void runWithSelfRepair(char *selfPath, int argc, char *argv[]) -{ - int status; - int pid; - - - // Make the qargs array for passing to child the same args of father - const char *arguments[] = {argv[1], argv[2], argv[3], "--self-repair", 0L}; - - // Get the privileged AuthorizationRef - [[AuthUtil shared] autorize]; - [[AuthUtil shared] execUnixCommand:selfPath - args:arguments - output:nil]; - - pid = wait(&status); - if(pid == -1 || !WIFEXITED(status)) - { - NSLog(@"Error returned from wait()."); - exit(-1); - } - - // Exit with the same exit code as the self-repair child - exit(WEXITSTATUS(status)); -} -#endif -- 1.9.4