Replaced the NSMenuExtra and created the AFSBackgrounder that will do all work for aklog at login and manage the Status menu in menu bar
Reviewed-on: http://gerrit.openafs.org/262
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
//
#import <Cocoa/Cocoa.h>
-
+#import "AFSMenuCredentialContoller.h"
@interface AFSBackgrounderDelegate : NSObject {
+@public
IBOutlet NSMenu *backgrounderMenu;
+ IBOutlet NSMenuItem *startStopMenuItem;
+ IBOutlet NSMenuItem *getReleaseTokenMenuItem;
NSStatusItem *statusItem;
- NSImage *statusImage;
- NSImage *statusHighlightImage;
+
+
+ BOOL afsState; //0-off 1-on
+ BOOL gotToken; //0-no 1-one o more token
+
+@protected
+ NSString *afsSysPath;
+ NSNumber *useAklogPrefValue;
+ NSNumber *showStatusMenu;
+ //Icon for state visualization
+ NSImage *hasTokenImage;
+ NSImage *noTokenImage;
+
+ //credential windows mainWindow
+ AFSMenuCredentialContoller *credentialMenuController;
+
+ //NSTimer for tokens refresh
+ NSTimer *timerForCheckTokensList;
+ NSLock *tokensLock;
+
}
+- (void)startTimer;
+- (void)stopTimer;
+- (BOOL)useAklogPrefValue;
+- (void)readPreferenceFile:(NSNotification *)notification;
+- (void)getToken:(id)sender;
+- (void)releaseToken:(id)sender;
+- (void)updateAfsStatus:(NSTimer*)timer;
+- (void)klogUserEven:(NSNotification *)notification;
+- (void)chageMenuVisibility:(NSNotification *)notification;
+- (NSImage*)getImageFromBundle:(NSString*)fileName fileExt:(NSString*)ext;
+- (NSImage*)imageToRender;
+- (void)updateMenu;
+- (void)repairHelperTool;
+- (void) afsVolumeMountChange:(NSNotification *)notification;
+-(NSStatusItem*)statusItem;
+-(void) setStatusItem:(BOOL)show;
+-(NSImage*)imageToRender;
+-(IBAction) startStopEvent:(id)sender;
+-(IBAction) getReleaseTokenEvent:(id)sender;
@end
//
#import "AFSBackgrounderDelegate.h"
-
+#import "AFSMenuExtraView.h"
+#import "AFSPropertyManager.h"
+#import "TaskUtil.h"
+#import "TokenCredentialController.h"
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <sys/errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
@implementation AFSBackgrounderDelegate
+#pragma mark NSApp Delegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSLog(@"applicationDidFinishLaunching");
//Create the NSStatusBar and set its length
statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
//Used to detect where our files are
- NSBundle *bundle = [NSBundle mainBundle];
-
- //Allocates and loads the images into the application which will be used for our NSStatusItem
- statusImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"hasToken" ofType:@"png"]];
- statusHighlightImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"noToken" ofType:@"png"]];
+ //NSBundle *bundle = [NSBundle mainBundle];
//Sets the images in our NSStatusItem
- [statusItem setImage:statusImage];
- [statusItem setAlternateImage:statusHighlightImage];
-
- //Tells the NSStatusItem what menu to load
- [statusItem setMenu:backgrounderMenu];
- //Sets the tooptip for our item
- [statusItem setToolTip:@"Andrews Menu Item"];
- //Enables highlighting
- [statusItem setHighlightMode:YES];
+ statusItem = nil;
+
+
+ // Get the imge for menu
+ //Load image for menu rappresentation
+ hasTokenImage = [self getImageFromBundle:@"hasToken"
+ fileExt:@"png"];
+
+ noTokenImage = [self getImageFromBundle:@"noToken"
+ fileExt:@"png"];
+
+ //Start to read the afs path
+ [self readPreferenceFile:nil];
+ [self startTimer];
+
+
+
+ // Register for preference user change
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(readPreferenceFile:)
+ name:kAFSMenuExtraID object:kPrefChangeNotification];
+
+ // Register for afs state change
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(afsVolumeMountChange:)
+ name:kAFSMenuExtraID object:kMExtraAFSStateChange];
+
+ // Register for menu state change
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(chageMenuVisibility:)
+ name:kAFSMenuExtraID object:kMExtraAFSMenuChangeState];
+
+ //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];
+
+ //try to see if we need tho show the menu at startup
+ NSLog(@"showStatusMenu %d", [showStatusMenu intValue]);
+ [self setStatusItem:[showStatusMenu boolValue]];
+
+}
+
+- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
+ if(afsSysPath) [afsSysPath release];
+
+ //release the lock
+ [self stopTimer];
+
+ if(hasTokenImage) [hasTokenImage release];
+ if(noTokenImage) [noTokenImage release];
+
+ // Unregister for preference change
+ [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kAFSMenuExtraID object:kPrefChangeNotification];
+ [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kAFSMenuExtraID object:kMExtraAFSStateChange];
+ [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kAFSMenuExtraID object:kMExtraAFSMenuChangeState];
+ [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self name:NSWorkspaceDidMountNotification object:nil];
+ [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self name:NSWorkspaceDidUnmountNotification object:nil];
+
+
+ // send notify that menuextra has closed
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfsCommanderID object:kPrefChangeNotification];
+
+ return NSTerminateNow;
+}
+// -------------------------------------------------------------------------------
+// -(void) readPreferenceFile
+// -------------------------------------------------------------------------------
+- (void) readPreferenceFile:(NSNotification *)notification
+{
+ NSLog(@"Reading preference file");
+ if(afsSysPath) {
+ [afsSysPath release];
+ afsSysPath = nil;
+ }
+
+ afsSysPath = PREFERENCE_AFS_SYS_PAT_STATIC;
+
+ // read the preference for aklog use
+ useAklogPrefValue = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_AKLOG,
+ (CFStringRef)kAfsCommanderID,
+ kCFPreferencesCurrentUser,
+ kCFPreferencesAnyHost);
+
+ showStatusMenu = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU,
+ (CFStringRef)kAfsCommanderID,
+ kCFPreferencesCurrentUser,
+ kCFPreferencesAnyHost);
+ //set the menu name
+ [self updateAfsStatus:nil];
+}
+
+// -------------------------------------------------------------------------------
+// -(void) readPreferenceFile
+// -------------------------------------------------------------------------------
+- (void)chageMenuVisibility:(NSNotification *)notification {
+ NSLog(@"chageMenuVisibility");
+ [self readPreferenceFile:nil];
+ NSLog(@"showStatusMenu: %d", [showStatusMenu intValue]);
+ [self setStatusItem:[showStatusMenu boolValue]];
+}
+
+// -------------------------------------------------------------------------------
+// - (void)startStopAfs:(id)sender
+// -------------------------------------------------------------------------------
+- (void)startStopAfs:(id)sender
+{
+ NSLog(@"startStopAfs: %s",[afsSysPath UTF8String]);
+ 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 = [[NSBundle mainBundle] pathForResource:@"afshlp" ofType:@""];
+
+ //[startStopScript setString: resourcePath];
+ //NSLog(@"LAunch repair HelperTool");
+ //Check helper app
+ [self repairHelperTool];
+
+ // make the parameter to call the root helper app
+ //NSLog(@"Path installazione afs: %s",[afsSysPath UTF8String]);
+ //NSLog(@"Path installazione afsd: %s", [afsdPath UTF8String]);
+ status = [[AuthUtil shared] autorize];
+ if(status == noErr){
+ if(currentAfsState){
+ //shutdown afs
+ //NSLog(@"Shutting down afs");
+ NSMutableString *afsKextPath = [[NSMutableString alloc] initWithCapacity:256];
+ [afsKextPath setString:afsSysPath];
+ [afsKextPath appendString:@"/etc/afs.kext"];
+
+ //NSLog(@"executeTaskWithAuth");
+ const char *stopAfsArgs[] = {"stop_afs", [afsKextPath UTF8String], [afsdPath UTF8String], 0L};
+ [[AuthUtil shared] execUnixCommand:[rootHelperApp UTF8String]
+ args:stopAfsArgs
+ output:nil];
+ } else {
+ //NSLog(@"Starting up afs");
+ const char *startAfsArgs[] = {[[ [NSBundle mainBundle] 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:kAfsCommanderID object:kMenuExtraEventOccured];
+ }
+
+}
+
+// -------------------------------------------------------------------------------
+// -(void) getToken
+// -------------------------------------------------------------------------------
+- (void)getToken:(id)sender
+{
+
+ NSRect globalRect;
+ globalRect.origin = [[[statusItem view] window] convertBaseToScreen:[[statusItem view] frame].origin];
+ globalRect.size = [[statusItem view] frame].size;
+ AFSPropertyManager *afsPropMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath ];
+ [afsPropMngr loadConfiguration];
+
+
+ if([useAklogPrefValue intValue]==NSOnState ) {
+ NSLog(@"Use Aklog");
+ [afsPropMngr getTokens:false
+ usr:nil
+ pwd:nil];
+ [self klogUserEven:nil];
+ } else {
+ NSLog(@"Use Klog");
+ // register for user event
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(klogUserEven:)
+ name:kAFSMenuExtraID
+ object:kLogWindowClosed];
+
+ credentialMenuController = [[AFSMenuCredentialContoller alloc] initWhitRec:globalRect
+ afsPropManager:afsPropMngr];
+ [credentialMenuController showWindow];
+ }
+
+ //Dispose afs manager
+ [afsPropMngr release];
+}
+
+// -------------------------------------------------------------------------------
+// -(void) releaseToken
+// -------------------------------------------------------------------------------
+- (void)releaseToken:(id)sender
+{
+ AFSPropertyManager *afsMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath];
+ [afsMngr unlog:nil];
+ [afsMngr release];
+ [self updateAfsStatus:nil];
+}
+
+
+// -------------------------------------------------------------------------------
+// -(void) afsVolumeMountChange - Track for mount unmount afs volume
+// -------------------------------------------------------------------------------
+- (void) afsVolumeMountChange:(NSNotification *)notification{
+ [self updateAfsStatus:nil];
+}
+
+// -------------------------------------------------------------------------------
+// -(void) updateAfsStatus
+// -------------------------------------------------------------------------------
+- (void)updateAfsStatus:(NSTimer*)timer
+{
+ //Try to locking
+ if(![tokensLock tryLock]) return;
+
+ // check the afs state in esclusive mode
+ AFSPropertyManager *afsMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath];
+ afsState = [afsMngr checkAfsStatus];
+
+ NSArray *tokens = [afsMngr getTokenList];
+ [afsMngr release];
+ gotToken = [tokens count] > 0;
+ [tokens release];
+ [self updateMenu];
+
+ //unlock
+ [tokensLock unlock];
+}
+
+// -------------------------------------------------------------------------------
+// -(void) klogUserEven
+// -------------------------------------------------------------------------------
+-(void) klogUserEven:(NSNotification *)notification
+{
+ if(credentialMenuController) {
+ [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kAFSMenuExtraID object:kLogWindowClosed];
+ [credentialMenuController closeWindow];
+ [credentialMenuController release];
+ credentialMenuController = nil;
+ }
+ //Send notification to PreferencePane
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfsCommanderID object:kMenuExtraEventOccured];
+
+ [self updateAfsStatus:nil];
+}
+#pragma mark Operational Function
+// -------------------------------------------------------------------------------
+// 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(updateAfsStatus:)
+ userInfo:nil
+ repeats:YES];
+ [timerForCheckTokensList fire];
+}
+
+// -------------------------------------------------------------------------------
+// stopTimer:
+// -------------------------------------------------------------------------------
+- (void)stopTimer{
+ if(!timerForCheckTokensList) return;
+ [timerForCheckTokensList invalidate];
+ timerForCheckTokensList = nil;
+}
+// -------------------------------------------------------------------------------
+// -(void) getImageFromBundle
+// -------------------------------------------------------------------------------
+- (NSImage*)getImageFromBundle:(NSString*)fileName fileExt:(NSString*)ext
+{
+ return [[NSImage alloc]initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:fileName
+ ofType:ext]];
+}
+
+
+
+
+// -------------------------------------------------------------------------------
+// -(void) updateMenu
+// -------------------------------------------------------------------------------
+- (void)updateMenu{
+ [getReleaseTokenMenuItem setEnabled:afsState];
+ [startStopMenuItem setTitle:afsState?kAfsButtonShutdown:kAfsButtonStartup];
+ [[statusItem view] setNeedsDisplay:YES];
+
+}
+
+
+// -------------------------------------------------------------------------------
+// -(void) useAklogPrefValue
+// -------------------------------------------------------------------------------
+- (BOOL)useAklogPrefValue
+{
+ if(useAklogPrefValue) return [useAklogPrefValue intValue] == NSOnState;
+ else return NSOffState;
+}
+
+// -------------------------------------------------------------------------------
+// repairHelperTool:
+// -------------------------------------------------------------------------------
+- (void) repairHelperTool
+{
+ struct stat st;
+ int fdTool;
+ int status = 0;
+ NSLog(@"repairHelperTool");
+ 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
+// -------------------------------------------------------------------------------
+-(NSStatusItem*)statusItem {
+ return statusItem;
+}
+
+// -------------------------------------------------------------------------------
+// setStatusItem
+// -------------------------------------------------------------------------------
+-(void)setStatusItem:(BOOL)show {
+ if(show) {
+ if(statusItem) return;
+ statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
+ [statusItem setView:[[AFSMenuExtraView alloc] initWithFrame:[[statusItem view] frame]
+ backgrounder:self
+ menu:backgrounderMenu]];
+ //Tells the NSStatusItem what menu to load
+ [statusItem setMenu:backgrounderMenu];
+ //Sets the tooptip for our item
+ [statusItem setToolTip:@"OpenAFS Preference"];
+ //Enables highlighting
+ [statusItem setHighlightMode:YES];
+ [statusItem setImage:noTokenImage];
+ } else {
+ if(!statusItem) return;
+ [statusItem release];
+ statusItem = nil;
+ }
+}
+// -------------------------------------------------------------------------------
+// -(void) imageToRender
+// -------------------------------------------------------------------------------
+- (NSImage*)imageToRender
+{
+ if(gotToken){
+ return hasTokenImage;
+ } else {
+ return noTokenImage;
+ }
+}
+
+
+-(IBAction) startStopEvent:(id)sender {
+ [self startStopAfs:sender];
+}
+
+-(IBAction) getReleaseTokenEvent:(id)sender {
+ [self getToken:sender];
}
@end
--- /dev/null
+//
+// AFSMenuCredentialContoller.h
+// AFSCommander
+//
+// Created by Claudio on 14/07/07.
+// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "CredentialWindowController.h"
+#import "AFSPropertyManager.h"
+
+@interface AFSMenuCredentialContoller : NSObject {
+ NSRect viewRect;
+ id credentialView;
+ id credentialController;
+ NSPanel *credentialWindow;
+ id credWinController;
+ AFSPropertyManager *afsPropMngr;
+}
+-(id) initWhitRec:(NSRect)rect afsPropManager:(AFSPropertyManager*)afsPropManager;
+-(void) showWindow;
+-(void) closeWindow;
+@end
--- /dev/null
+//
+// AFSMenuCredentialContoller.m
+// AFSCommander
+//
+// Created by Claudio on 14/07/07.
+// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
+//
+
+#import "AFSMenuCredentialContoller.h"
+#import "CredentialWindowController.h"
+#import "global.h"
+#import "AFSPropertyManager.h"
+
+@implementation AFSMenuCredentialContoller
+
+-(id) initWhitRec:(NSRect)rect afsPropManager:(AFSPropertyManager*)afsPropManager;
+{
+ viewRect = rect;
+ credentialWindow = nil;
+ afsPropMngr = [afsPropManager retain];
+ NSLog(@"init AFSMenuCredentialContoller");
+ return [self init];
+}
+
+- (void)dealloc {
+ NSLog(@"dealloc AFSMenuCredentialContoller");
+ if(credentialWindow) [credentialWindow release];
+ [super dealloc];
+
+} // dealloc
+
+-(void) showWindow
+{
+ // calculate the point where show the window
+ NSPoint topLeft = {viewRect.origin.x-160,[[NSScreen mainScreen] frame].size.height-kMenuBarHeight};
+ NSLog(@"viewRect.origin.x=%d, topLeft.x=%d", viewRect.origin.x, topLeft.x);
+ // load the bundle for
+ [NSBundle loadNibNamed:@"CredentialWindow.nib" owner:self];
+ NSLog(@"prepare to open window CredentialWindow");
+
+ credentialWindow = [[NSWindow alloc] initWithContentRect:[((NSView*) credentialView) frame]
+ styleMask:NSTitledWindowMask /*| NSUtilityWindowMask*/
+ backing:NSBackingStoreBuffered
+ defer:YES screen:[NSScreen mainScreen]];
+ NSLog(@"Finestra");
+ [credentialWindow setTitle:@"Klog"];
+ [credentialWindow setFrameTopLeftPoint:topLeft];
+ [credentialWindow setContentView:credentialView];
+ [credentialWindow makeKeyAndOrderFront:self];
+ NSLog(@"creata");
+
+}
+
+-(void) closeWindow
+{
+ NSLog(@"closeWindow");
+ if([(CredentialWindowController*)credWinController takenToken] && afsPropMngr) {
+ [afsPropMngr getTokens:true
+ usr:[(CredentialWindowController*)credWinController uName]
+ pwd:[(CredentialWindowController*)credWinController uPwd]];
+ [afsPropMngr release];
+ afsPropMngr = nil;
+ }
+ [credentialWindow close];
+ credentialWindow = nil;
+}
+@end
--- /dev/null
+//
+// AFSMenuExtra.h
+// AFSCommander
+//
+// Created by Claudio on 10/07/07.
+// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
+//
+
+
+#import <Cocoa/Cocoa.h>
+#import "SystemUIPlugin.h"
+#import "global.h"
+#import "AFSMenuCredentialContoller.h"
+@class AFSMenuExtraView;
+@interface AFSMenuExtra : NSMenuExtra {
+ @public
+ BOOL afsState; //0-off 1-on
+ BOOL gotToken; //0-no 1-one o more token
+
+ @protected
+ NSString *afsSysPath;
+ NSNumber *useAklogPrefValue;
+ //menu extra
+ NSMenu *theMenu;
+
+ //Menu extra view
+ AFSMenuExtraView *theView;
+ // menu reference
+ NSMenuItem *startStopMenu;
+ NSMenuItem *loginMenu;
+ NSMenuItem *unlogMenu;
+
+ //Icon for state visualization
+ NSImage *hasTokenImage;
+ NSImage *noTokenImage;
+
+ //credential windows mainWindow
+ AFSMenuCredentialContoller *credentialMenuController;
+
+ //NSTimer for tokens refresh
+ NSTimer *timerForCheckTokensList;
+ NSLock *tokensLock;
+}
+- (void)startTimer;
+- (void)stopTimer;
+- (BOOL)useAklogPrefValue;
+- (void)readPreferenceFile:(NSNotification *)notification;
+- (void)getToken:(id)sender;
+- (void)releaseToken:(id)sender;
+- (void)updateAfsStatus:(NSTimer*)timer;
+- (void)klogUserEven:(NSNotification *)notification;
+- (NSImage*)getImageFromBundle:(NSString*)fileName fileExt:(NSString*)ext;
+- (NSImage*)imageToRender;
+- (void)updateMenu;
+- (void)repairHelperTool;
+- (void) afsVolumeMountChange:(NSNotification *)notification;
+@end
--- /dev/null
+//
+// AFSMenuExtra.m
+// AFSCommander
+//
+// Created by Claudio on 10/07/07.
+// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
+//
+
+#import "AFSMenuExtra.h"
+#import "AFSMenuExtraView.h"
+#import "AFSPropertyManager.h"
+#import "TaskUtil.h"
+#import "TokenCredentialController.h"
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <sys/errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+@implementation AFSMenuExtra
+// -------------------------------------------------------------------------------
+// -(id) initWithBundle
+// -------------------------------------------------------------------------------
+- (id) initWithBundle:(NSBundle *)bundle
+{
+ self = [super initWithBundle:bundle];
+ if( self == nil )
+ return nil;
+
+ // allocate the lock
+ tokensLock = [[NSLock alloc] init];
+ // inizialize the afspath
+ afsSysPath = nil;
+ credentialMenuController = nil;
+
+ theView = [[AFSMenuExtraView alloc] initWithFrame:[[self view] frame]
+ menuExtra:self];
+ [self setView:theView];
+
+
+ // Get the imge for menu
+ //Load image for menu rappresentation
+ hasTokenImage = [self getImageFromBundle:@"hasToken"
+ fileExt:@"png"];
+
+ noTokenImage = [self getImageFromBundle:@"noToken"
+ fileExt:@"png"];
+
+ theMenu = [[NSMenu alloc] initWithTitle: @""];
+ [theMenu setAutoenablesItems: NO];
+ startStopMenu = [theMenu addItemWithTitle: kAfsOff action: @selector(startStopAfs:) keyEquivalent: @""];
+ [startStopMenu setTarget:self];
+
+ loginMenu = [theMenu addItemWithTitle: kMenuLogin action: @selector(getToken:) keyEquivalent: @""];
+ [loginMenu setTarget:self];
+
+ unlogMenu = [theMenu addItemWithTitle: kMenuUnlog action: @selector(releaseToken:) keyEquivalent: @""];
+ [unlogMenu setTarget:self];
+
+ // Register for preference user change
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(readPreferenceFile:)
+ name:kAFSMenuExtraID object:kPrefChangeNotification];
+
+ // Register for afs state change
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(afsVolumeMountChange:)
+ name:kAFSMenuExtraID object:kMExtraAFSStateChange];
+
+
+ //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];
+ //Start to read the afs path
+ [self readPreferenceFile:nil];
+ [self startTimer];
+ return self;
+}
+
+// -------------------------------------------------------------------------------
+// -(void) willUnload
+// -------------------------------------------------------------------------------
+- (void) willUnload {
+ //release the lock
+ [self stopTimer];
+
+ if(hasTokenImage) [hasTokenImage release];
+ if(noTokenImage) [noTokenImage release];
+
+ // Unregister for preference change
+ [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kAFSMenuExtraID object:kPrefChangeNotification];
+ [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kAFSMenuExtraID object:kMExtraAFSStateChange];
+ [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self name:NSWorkspaceDidMountNotification object:nil];
+ [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self name:NSWorkspaceDidUnmountNotification object:nil];
+
+
+ [tokensLock release];
+}
+
+// -------------------------------------------------------------------------------
+// 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(updateAfsStatus:)
+ userInfo:nil
+ repeats:YES];
+ [timerForCheckTokensList fire];
+}
+
+// -------------------------------------------------------------------------------
+// stopTimer:
+// -------------------------------------------------------------------------------
+- (void)stopTimer{
+ if(!timerForCheckTokensList) return;
+ [timerForCheckTokensList invalidate];
+ timerForCheckTokensList = nil;
+}
+// -------------------------------------------------------------------------------
+// -(void) dealloc
+// -------------------------------------------------------------------------------
+- (void) dealloc
+{
+ [theMenu release];
+ [theView release];
+ if(afsSysPath) [afsSysPath release];
+ // send notify that menuextra has closed
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:afsCommanderID object:kPrefChangeNotification];
+ [super dealloc];
+}
+
+// -------------------------------------------------------------------------------
+// -(NSMenu*) menu
+// -------------------------------------------------------------------------------
+- (NSMenu *) menu
+{
+ return theMenu;
+}
+
+
+// -------------------------------------------------------------------------------
+// -(void) readPreferenceFile
+// -------------------------------------------------------------------------------
+- (void) readPreferenceFile:(NSNotification *)notification
+{
+ NSLog(@"Reading preference file");
+ //CFPreferencesSynchronize((CFStringRef)afsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
+ //CFPreferencesSynchronize((CFStringRef)afsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
+ if(afsSysPath) {
+ [afsSysPath release];
+ afsSysPath = nil;
+ }
+
+ afsSysPath = PREFERENCE_AFS_SYS_PAT_STATIC;/*(NSString*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_AFS_SYS_PAT,
+ (CFStringRef)afsCommanderID,
+ kCFPreferencesAnyUser,
+ kCFPreferencesAnyHost);*/
+ //NSLog(@"Path readed %s", (afsSysPath==nil?[afsSysPath UTF8String]:@" no path found "));
+
+ // read the preference for aklog use
+ useAklogPrefValue = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_AKLOG,
+ (CFStringRef)afsCommanderID,
+ kCFPreferencesCurrentUser,
+ kCFPreferencesAnyHost);
+ //set the menu name
+ //NSLog(@"Preference readed for useAklogPrefValue %d", [useAklogPrefValue intValue]);
+
+ [self updateAfsStatus:nil];
+}
+
+// -------------------------------------------------------------------------------
+// -(void) readPreferenceFile
+// -------------------------------------------------------------------------------
+- (void)startStopAfs:(id)sender
+{
+ NSLog(@"startStopAfs: %s",[afsSysPath UTF8String]);
+ 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:@""];
+
+ //[startStopScript setString: resourcePath];
+ //NSLog(@"LAunch repair HelperTool");
+ //Check helper app
+ [self repairHelperTool];
+
+ // make the parameter to call the root helper app
+ //NSLog(@"Path installazione afs: %s",[afsSysPath UTF8String]);
+ //NSLog(@"Path installazione afsd: %s", [afsdPath UTF8String]);
+ status = [[AuthUtil shared] autorize];
+ if(status == noErr){
+ if(currentAfsState){
+ //shutdown afs
+ //NSLog(@"Shutting down afs");
+ NSMutableString *afsKextPath = [[NSMutableString alloc] initWithCapacity:256];
+ [afsKextPath setString:afsSysPath];
+ [afsKextPath appendString:@"/etc/afs.kext"];
+
+ //NSLog(@"executeTaskWithAuth");
+ const char *stopAfsArgs[] = {"stop_afs", [afsKextPath UTF8String], [afsdPath UTF8String], 0L};
+ [[AuthUtil shared] execUnixCommand:[rootHelperApp UTF8String]
+ args:stopAfsArgs
+ output:nil];
+ } else {
+ //NSLog(@"Starting up afs");
+ 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
+{
+
+ NSRect globalRect;
+ globalRect.origin = [[[self view] window] convertBaseToScreen:[[self view] frame].origin];
+ globalRect.size = [[self view] frame].size;
+ AFSPropertyManager *afsPropMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath ];
+ [afsPropMngr loadConfiguration];
+
+
+ if([useAklogPrefValue intValue]==NSOnState ) {
+ NSLog(@"Use Aklog");
+ [afsPropMngr getTokens:false
+ usr:nil
+ pwd:nil];
+ [self klogUserEven:nil];
+ } else {
+ NSLog(@"Use Klog");
+ // register for user event
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(klogUserEven:)
+ name:kAFSMenuExtraID
+ object:kLogWindowClosed];
+
+ credentialMenuController = [[AFSMenuCredentialContoller alloc] initWhitRec:globalRect
+ afsPropManager:afsPropMngr];
+ [credentialMenuController showWindow];
+ }
+
+ //Dispose afs manager
+ [afsPropMngr release];
+}
+
+// -------------------------------------------------------------------------------
+// -(void) releaseToken
+// -------------------------------------------------------------------------------
+- (void)releaseToken:(id)sender
+{
+ AFSPropertyManager *afsMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath];
+ [afsMngr unlog:nil];
+ [afsMngr release];
+ [self updateAfsStatus:nil];
+}
+
+
+// -------------------------------------------------------------------------------
+// -(void) afsVolumeMountChange - Track for mount unmount afs volume
+// -------------------------------------------------------------------------------
+- (void) afsVolumeMountChange:(NSNotification *)notification{
+ [self updateAfsStatus:nil];
+}
+
+// -------------------------------------------------------------------------------
+// -(void) updateAfsStatus
+// -------------------------------------------------------------------------------
+- (void)updateAfsStatus:(NSTimer*)timer
+{
+ //Try to locking
+ if(![tokensLock tryLock]) return;
+
+ // check the afs state in esclusive mode
+ AFSPropertyManager *afsMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath];
+ afsState = [afsMngr checkAfsStatus];
+
+ NSArray *tokens = [afsMngr getTokenList];
+ [afsMngr release];
+ gotToken = [tokens count] > 0;
+ [tokens release];
+ // update the menu item title
+ [startStopMenu setTitle:afsState?kAfsButtonShutdown:kAfsButtonStartup];
+
+ [self updateMenu];
+
+ [theView setNeedsDisplay:YES];
+
+ //unlock
+ [tokensLock unlock];
+}
+
+// -------------------------------------------------------------------------------
+// -(void) klogUserEven
+// -------------------------------------------------------------------------------
+-(void) klogUserEven:(NSNotification *)notification
+{
+ if(credentialMenuController) {
+ [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kAFSMenuExtraID object:kLogWindowClosed];
+ [credentialMenuController closeWindow];
+ [credentialMenuController release];
+ credentialMenuController = nil;
+ }
+ //Send notification to PreferencePane
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:afsCommanderID object:kMenuExtraEventOccured];
+
+ [self updateAfsStatus:nil];
+}
+
+// -------------------------------------------------------------------------------
+// -(void) getImageFromBundle
+// -------------------------------------------------------------------------------
+- (NSImage*)getImageFromBundle:(NSString*)fileName fileExt:(NSString*)ext
+{
+ return [[NSImage alloc]initWithContentsOfFile:[[self bundle] pathForResource:fileName
+ ofType:ext]];
+}
+
+// -------------------------------------------------------------------------------
+// -(void) imageToRender
+// -------------------------------------------------------------------------------
+- (NSImage*)imageToRender
+{
+ if(gotToken){
+ return hasTokenImage;
+ } else {
+ return noTokenImage;
+ }
+}
+
+
+// -------------------------------------------------------------------------------
+// -(void) updateMenu
+// -------------------------------------------------------------------------------
+- (void)updateMenu{
+ [loginMenu setEnabled:afsState];
+ [unlogMenu setEnabled:afsState];
+}
+
+
+// -------------------------------------------------------------------------------
+// -(void) useAklogPrefValue
+// -------------------------------------------------------------------------------
+- (BOOL)useAklogPrefValue
+{
+ if(useAklogPrefValue) return [useAklogPrefValue intValue] == NSOnState;
+ else return NSOffState;
+}
+
+// -------------------------------------------------------------------------------
+// repairHelperTool:
+// -------------------------------------------------------------------------------
+- (void) repairHelperTool
+{
+ struct stat st;
+ int fdTool;
+ int status = 0;
+ NSLog(@"repairHelperTool");
+ 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
--- /dev/null
+//
+// AFSMenuExtraView.h
+// AFSCommander
+//
+// Created by Claudio Bisegni on 11/07/07.
+// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "AFSBackgrounderDelegate.h"
+
+@interface AFSMenuExtraView : NSView {
+ AFSBackgrounderDelegate *backgrounderDelegator;
+ NSStatusItem *statusItem;
+ NSMenu *statusItemMenu;
+ BOOL isMenuVisible;
+}
+- initWithFrame:(NSRect)myRect backgrounder:(AFSBackgrounderDelegate*)backgrounder menu:(NSMenu*)menu;
+- (NSAttributedString*) makeKerberosIndicator:(int*)fontHeight;
+@end
--- /dev/null
+//
+// AFSMenuExtraView.m
+// AFSCommander
+//
+// Created by Claudio Bisegni on 11/07/07.
+// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
+//
+
+#import "AFSMenuExtraView.h"
+#import "AFSPropertyManager.h"
+#import "global.h"
+
+@implementation AFSMenuExtraView
+
+- initWithFrame:(NSRect)myRect
+ backgrounder:(AFSBackgrounderDelegate*)backgrounder
+ menu:(NSMenu*)menu{
+
+ // Have super init
+ self = [super initWithFrame:myRect];
+ if(!self) {
+ return nil;
+ }
+
+ // Store our extra
+ backgrounderDelegator = backgrounder;
+ statusItem = [backgrounderDelegator statusItem];
+ statusItemMenu = menu;
+ isMenuVisible = NO;
+ return self;
+
+} // initWithFrame
+
+- (void)dealloc {
+
+ [super dealloc];
+
+} // dealloc
+
+- (void)drawRect:(NSRect)rect
+{
+ NSImage *image = nil;
+ int fontHeight = 0;
+ NSAttributedString *kerberosStringIndicator = nil;
+
+ //check if we nedd to simulate the background menu clicked
+ [statusItem drawStatusBarBackgroundInRect:[self bounds]
+ withHighlight:isMenuVisible];
+
+ image = [backgrounderDelegator imageToRender];
+ if (image) {
+ // Live updating even when menu is down handled by making the extra
+ // draw the background if needed.
+ [image compositeToPoint:NSMakePoint(0, 0) operation:NSCompositeSourceOver];
+ }
+
+
+
+
+ //Draw, if necessary, the kerberos indicator for aklog usage for get token
+ if([backgrounderDelegator useAklogPrefValue] == NSOnState) {
+ kerberosStringIndicator = [[self makeKerberosIndicator:&fontHeight] autorelease];
+ if(kerberosStringIndicator) [kerberosStringIndicator drawAtPoint:NSMakePoint(0, kMenuBarHeight-fontHeight)];
+ }
+}
+
+/*!
+ @method makeKerberosIndicator
+ @abstract Make the kerberos indicator
+ @discussion Make a letter to render in menu view to inform the user if is enable aklog use
+*/
+- (NSAttributedString*) makeKerberosIndicator:(int*)fontHeight {
+ NSFont *font = [NSFont fontWithName:@"Palatino-Roman" size:9.0];
+ NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:font
+ forKey:NSFontAttributeName];
+ NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"K"
+ attributes:attrsDictionary];
+ *fontHeight = [attrString size].height;
+ return attrString;
+}
+
+-(void)mouseDown:(NSEvent *)event {
+ [statusItemMenu setDelegate:self];
+ [statusItem popUpStatusItemMenu:statusItemMenu];
+ [self setNeedsDisplay:YES];
+}
+
+- (void)menuWillOpen:(NSMenu *)menu {
+ isMenuVisible = YES;
+ [self setNeedsDisplay:YES];
+}
+
+- (void)menuDidClose:(NSMenu *)menu {
+ isMenuVisible = NO;
+ [statusItemMenu setDelegate:nil];
+ [self setNeedsDisplay:YES];
+}
+@end
--- /dev/null
+//
+// CredentialWindowController.h
+// AFSCommander
+//
+// Created by Claudio on 14/07/07.
+// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "AFSMenuCredentialContoller.h"
+#import "global.h"
+
+@interface CredentialWindowController : NSObject {
+ id credentialView;
+ id afsMenuController;
+ id textEditUserName;
+ id textEditPassword;
+
+ BOOL taken;
+ NSString *uName;
+ NSString *uPwd;
+
+}
+
+- (IBAction) getToken:(id) sender;
+- (IBAction) closePanel:(id) sender;
+- (BOOL) takenToken;
+- (NSString*) uName;
+- (NSString*) uPwd;
+@end
--- /dev/null
+//
+// CredentialWindowController.m
+// AFSCommander
+//
+// Created by Claudio on 14/07/07.
+// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
+//
+
+#import "CredentialWindowController.h"
+#import "AFSPropertyManager.h"
+
+@implementation CredentialWindowController
+// -------------------------------------------------------------------------------
+// awakeFromNib:
+// -------------------------------------------------------------------------------
+- (void)awakeFromNib
+{
+ NSLog(@"awakeFromNib");
+}
+
+// -------------------------------------------------------------------------------
+// getToken:
+// -------------------------------------------------------------------------------
+- (IBAction) getToken:(id) sender
+{
+ uName = [((NSTextField*) textEditUserName) stringValue];
+ uPwd = [((NSTextField*) textEditPassword) stringValue];
+ if(uName == @"" || uPwd == @"") return;
+ taken = YES;
+
+
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kLogWindowClosed];
+}
+
+
+// -------------------------------------------------------------------------------
+// closePanel:
+// -------------------------------------------------------------------------------
+- (IBAction) closePanel:(id) sender
+{
+ taken = NO;
+ NSLog(@"closePanel");
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kLogWindowClosed];
+}
+
+
+// -------------------------------------------------------------------------------
+// takenToken:
+// -------------------------------------------------------------------------------
+- (BOOL) takenToken
+{
+ return taken;
+}
+
+// -------------------------------------------------------------------------------
+// takenToken:
+// -------------------------------------------------------------------------------
+- (NSString*) uName
+{
+ return uName;
+}
+
+// -------------------------------------------------------------------------------
+// takenToken:
+// -------------------------------------------------------------------------------
+- (NSString*) uPwd
+{
+ return uPwd;
+}
+
+@end
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<int key="connectionID">12</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">startStopEvent:</string>
+ <reference key="source" ref="437456796"/>
+ <reference key="destination" ref="77178862"/>
+ </object>
+ <int key="connectionID">15</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">getReleaseTokenEvent:</string>
+ <reference key="source" ref="437456796"/>
+ <reference key="destination" ref="10398219"/>
+ </object>
+ <int key="connectionID">16</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">getReleaseTokenMenuItem</string>
+ <reference key="source" ref="437456796"/>
+ <reference key="destination" ref="10398219"/>
+ </object>
+ <int key="connectionID">17</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">startStopMenuItem</string>
+ <reference key="source" ref="437456796"/>
+ <reference key="destination" ref="77178862"/>
+ </object>
+ <int key="connectionID">18</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilderKit</string>
<string>com.apple.InterfaceBuilderKit</string>
- <string>{{244, 767}, {125, 53}}</string>
+ <string>{{113, 626}, {125, 53}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">12</int>
+ <int key="maxID">18</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">AFSBackgrounderDelegate</string>
<string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>getReleaseTokenEvent:</string>
+ <string>getToken:</string>
+ <string>releaseToken:</string>
+ <string>startStopEvent:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
<object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">backgrounderMenu</string>
- <string key="NS.object.0">NSMenu</string>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>backgrounderMenu</string>
+ <string>getReleaseTokenMenuItem</string>
+ <string>startStopMenuItem</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSMenu</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ </object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBClasses</key>
+ <array>
+ <dict>
+ <key>CLASS</key>
+ <string>FirstResponder</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>AFSMenuCredentialContoller</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>credWinController</key>
+ <string>CredentialWindowController</string>
+ <key>credentialController</key>
+ <string>id</string>
+ <key>credentialView</key>
+ <string>id</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>closePanel</key>
+ <string>id</string>
+ <key>getToken</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>CredentialWindowController</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>afsMenuController</key>
+ <string>id</string>
+ <key>credentialView</key>
+ <string>id</string>
+ <key>textEditPassword</key>
+ <string>id</string>
+ <key>textEditUserName</key>
+ <string>id</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ </array>
+ <key>IBVersion</key>
+ <string>1</string>
+</dict>
+</plist>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBFramework Version</key>
+ <string>644</string>
+ <key>IBLastKnownRelativeProjectPath</key>
+ <string>../AFSCommander.xcodeproj</string>
+ <key>IBOldestOS</key>
+ <integer>5</integer>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>248</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>9C31</string>
+ <key>targetFramework</key>
+ <string>IBCocoaFramework</string>
+</dict>
+</plist>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
+ <string>it.infn.lnf.network.${PRODUCT_NAME:identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
//for check system version
int prefStartUp;
// Main View
+ BOOL startAFSAtLogin;
IBOutlet NSView *afsCommanderView;
IBOutlet NSSearchField *textSearchField;
IBOutlet NSTextField *afsDefaultCellLabel;
IBOutlet NSButton *installKRB5AuthAtLoginButton;
IBOutlet NSButton *useAklogCheck;
IBOutlet NSTextField *afsVersionLabel;
- BOOL startAFSAtLogin;
IBOutlet NSButton *checkButtonAfsAtBootTime;
IBOutlet NSTextField *textFieldDevInfoLabel;
+ IBOutlet NSTextField *statCacheEntry;
+ IBOutlet NSTextField *dCacheDim;
+ IBOutlet NSTextField *cacheDimension;
+ IBOutlet NSTextField *daemonNumber;
+ IBOutlet NSTextField *afsRootMountPoint;
+ IBOutlet NSTextField *nVolEntry;
+ IBOutlet NSButton *dynRoot;
+ IBOutlet NSButton *afsDB;
+ IBOutlet NSButton *verbose;
+ IBOutlet NSBox *groupsBox;
- //NSString *appID;
//id installationPathTextField;
id startStopButton;
id cellList;
id tokensTable;
id afsMenucheckBox;
- //cache manager IBOutlet
- IBOutlet NSTextField *statCacheEntry;
- IBOutlet NSTextField *dCacheDim;
- IBOutlet NSTextField *cacheDimension;
- IBOutlet NSTextField *daemonNumber;
- IBOutlet NSTextField *afsRootMountPoint;
- IBOutlet NSTextField *nVolEntry;
- IBOutlet NSButton *dynRoot;
- IBOutlet NSButton *afsDB;
- IBOutlet NSButton *verbose;
- IBOutlet NSBox *groupsBox;
-
//Configuration sheet
id ipConfigurationSheet;
id ipConfControllerCommander;
- (void) manageButtonState:(int) rowSelected;
- (void) setAfsStatus;
- (void) refreshTokens:(NSTimer*)theTimer;
-- (BOOL) isAFSMenuExtraLoaded;
-- (void) addAFSMenuExtra;
-- (void) removeAFSMenuExtra;
- (void) repairHelperTool;
- (void) writePreferenceFile;
- (void) readPreferenceFile;
-- (void) mextraChangeActivation:(NSNotification *)notification;
- (void) refreshGui:(NSNotification *)notification;
- (void) afsVolumeMountChange:(NSNotification *)notification;
-@end
\ No newline at end of file
+@end
+
+@interface AFSCommanderPref (NSTableDataSource)
+- (id) getTableTokensListValue:(int) colId row:(int)row;
+- (id) getTableCelListValue:(int) colId row:(int)row;
+@end;
\ No newline at end of file
- (id)initWithBundle:(NSBundle *)bundle
{
if ( ( self = [super initWithBundle:bundle] ) != nil ) {
- //appID = afsCommanderID;
+ //appID = kAfsCommanderID;
prefStartUp = 1;
}
return self;
SInt32 osxMnVers = 0;
if (Gestalt(gestaltSystemVersionMajor, &osxMJVers) == noErr && Gestalt(gestaltSystemVersionMinor, &osxMnVers) == noErr) {
if (osxMJVers == 10 && osxMnVers>= 5) {
- // we are working on leopard
- NSLog(@"Leopard AFSCommander adapting");
[afsCommanderView setFrameSize:NSMakeSize(668, [afsCommanderView frame].size.height)];
prefStartUp = 0;
}
// -------------------------------------------------------------------------------
- (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 {
+
+ }
+
+
// Set Developer info
[textFieldDevInfoLabel setStringValue:kDevelopInfo];
// creating the lock
afsProperty = [[AFSPropertyManager alloc] init];
// register preference pane to detect menuextra killed by user
- [[NSDistributedNotificationCenter defaultCenter] addObserver:self
+/* [[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(mextraChangeActivation:)
- name:afsCommanderID
- object:kMExtraClosedNotification];
+ name:kAfsCommanderID
+ object:kMExtraClosedNotification];*/
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(refreshGui:)
- name:afsCommanderID
+ name:kAfsCommanderID
object:kMenuExtraEventOccured];
//Register for mount/unmount afs volume
//check the afs state
[self setAfsStatus];
- // check the MenuExtra state
- [self mextraChangeActivation:nil];
-
// let show the configuration after prefpane is open
[self refreshConfiguration:nil];
[self searchCellTextEvent:nil];
}
+// -------------------------------------------------------------------------------
+// credentialAtLoginTimeEventCreationLaunchAgentDir:
+// -------------------------------------------------------------------------------
+- (void) credentialAtLoginTimeEventCreationLaunchAgentDir:(NSWindow*)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo {
+ [alert close];
+ switch (returnCode) {
+ case 1:
+ NSLog(@"Yes");
+ if([[NSFileManager defaultManager] createDirectoryAtPath:[HOME_LAUNCHD_AGENT_FOLDER stringByExpandingTildeInPath]
+ attributes:nil]) {
+
+ //Create the file
+ [PListManager installBackgrounderLaunchdFile:YES
+ resourcePath:[[self bundle] resourcePath]];
+ [self showMessage:kDirectoryCreated];
+ } else {
+ [self showMessage:kErrorCreatingDirectory];
+ }
+ break;
+ case 0:
+ NSLog(@"No");
+
+ break;
+ }
+}
+
+
// -------------------------------------------------------------------------------
// willUnselect:
// -------------------------------------------------------------------------------
// unregister preference pane to detect menuextra killed by user
[[NSDistributedNotificationCenter defaultCenter] removeObserver:self
- name:afsCommanderID
+ name:kAfsCommanderID
object:kMExtraClosedNotification];
[[NSDistributedNotificationCenter defaultCenter] removeObserver:self
- name:afsCommanderID
+ name:kAfsCommanderID
object:kMenuExtraEventOccured];
[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self
name:NSWorkspaceDidMountNotification object:nil];
{
// read the preference for afs path
- //NSString *afsSysPath = PREFERENCE_AFS_SYS_PAT_STATIC;/*(NSString*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_AFS_SYS_PAT, (CFStringRef)afsCommanderID,
+ //NSString *afsSysPath = PREFERENCE_AFS_SYS_PAT_STATIC;/*(NSString*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_AFS_SYS_PAT, (CFStringRef)kAfsCommanderID,
// kCFPreferencesAnyUser, kCFPreferencesAnyHost);*/
/*if(afsSysPath){
[((NSTextField*) installationPathTextField ) setStringValue:afsSysPath];
}*/
// read the preference for aklog use
- NSNumber *useAklogPrefValue = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_AKLOG, (CFStringRef)afsCommanderID,
+ 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]];
if(useAklogPrefValue){
- [useAklogCheck setState:[useAklogPrefValue intValue]];
- [aklogCredentialAtLoginTime setEnabled:[useAklogPrefValue intValue]];
+ [aklogCredentialAtLoginTime setEnabled:[aklogTokenAtLogin boolValue]];
} else {
- [useAklogCheck setState:NSOffState];
[aklogCredentialAtLoginTime setEnabled:NSOffState];
[aklogCredentialAtLoginTime setState:NSOffState];
- [PListManager installLaunchdFile:NO
- resourcePath:nil];
}
- //check if krb5 at startup is enable at system level
- [installKRB5AuthAtLoginButton setState:[PListManager checkKrb5AtLoginTimeLaunchdEnable]];
-
- //check if the user has installed and enabled the afs agent
- [aklogCredentialAtLoginTime setState:[PListManager checkAklogAtLoginTimeLaunchdEnable]];
-
//check for AFS enable at startup
NSNumber *afsEnableStartupTime = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_START_AFS_AT_STARTUP,
- (CFStringRef)afsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
+ (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, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
+ [(NSButton*)afsMenucheckBox setState: [showStatusMenu boolValue]];
}
// -------------------------------------------------------------------------------
//Set the preference for afs path
/*CFPreferencesSetValue((CFStringRef)PREFERENCE_AFS_SYS_PAT,
(CFStringRef)[((NSTextField*) installationPathTextField ) stringValue],
- (CFStringRef)afsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);*/
+ (CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);*/
//Set the preference for aklog use
CFPreferencesSetValue((CFStringRef)PREFERENCE_USE_AKLOG,
(CFNumberRef)[NSNumber numberWithInt:[useAklogCheck state]],
- (CFStringRef)afsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
-
-
- // Notify
- if ([self isAFSMenuExtraLoaded]) [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kPrefChangeNotification];
-
+ (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
//set AFS enable state at startup
CFPreferencesSetValue((CFStringRef)PREFERENCE_START_AFS_AT_STARTUP,
(CFNumberRef)[NSNumber numberWithBool:startAFSAtLogin],
- (CFStringRef)afsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
+ (CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
- CFPreferencesSynchronize((CFStringRef)afsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
- CFPreferencesSynchronize((CFStringRef)afsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+ //set aklog at login
+ CFPreferencesSetValue((CFStringRef)PREFERENCE_AKLOG_TOKEN_AT_LOGIN,
+ (CFNumberRef)[NSNumber numberWithBool:[aklogCredentialAtLoginTime state]],
+ (CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
+
+ //set aklog at login
+ CFPreferencesSetValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU,
+ (CFNumberRef)[NSNumber numberWithBool:[afsMenucheckBox state]],
+ (CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
+
+ CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
+ CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kPrefChangeNotification];
}
// -------------------------------------------------------------------------------
pwd:nil];
[self refreshTokens:nil];
//Inform afs menuextra to updata afs status
- if ([self isAFSMenuExtraLoaded]) [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange];
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange];
} else {
[NSBundle loadNibNamed:@"CredentialPanel" owner:self];
}
[self refreshTokens:nil];
//Inform afs menuextra to updata afs status
- if ([self isAFSMenuExtraLoaded]) [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange];
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange];
}
//afs menu extra is loaded inform it to read preference
@try {
if(![useAklogCheck state]) {
- //Remove launchd ctrl file
- [PListManager installLaunchdFile:NO resourcePath:[[self bundle] resourcePath]];
-
//deselect the checkbox
[aklogCredentialAtLoginTime setState:NO];
}
// credentialAtLoginTimeEvent:
// -------------------------------------------------------------------------------
- (IBAction) credentialAtLoginTimeEvent:(id) sender {
- @try {
- [PListManager installLaunchdFile:[aklogCredentialAtLoginTime state]
- resourcePath:[[self bundle] resourcePath]];
-
-
-
- }
- @catch (NSException * e) {
- if([e userInfo] != nil && [[e userInfo] isKindOfClass:[NSNumber class]]) {
- if([((NSNumber*)[e userInfo]) intValue] == 1) {
- // 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);
- }
- } else {
- [self showMessage:[e reason]];
- }
- }
- @finally {
- [aklogCredentialAtLoginTime setState:[PListManager checkAklogAtLoginTimeLaunchdEnable]];
- }
-
+ [self writePreferenceFile];
}
// -------------------------------------------------------------------------------
}
}
-// -------------------------------------------------------------------------------
-// credentialAtLoginTimeEventCreationLaunchAgentDir:
-// -------------------------------------------------------------------------------
-- (void) credentialAtLoginTimeEventCreationLaunchAgentDir:(NSWindow*)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo {
- [alert close];
- switch (returnCode) {
- case 1:
- NSLog(@"Yes");
- if([[NSFileManager defaultManager] createDirectoryAtPath:[HOME_LAUNCHD_AGENT_FOLDER stringByExpandingTildeInPath]
- attributes:nil]) {
-
- //Create the file
- [PListManager installLaunchdFile:YES
- resourcePath:[[self bundle] resourcePath]];
-
- //refresh the check box
- [aklogCredentialAtLoginTime setState:[PListManager checkAklogAtLoginTimeLaunchdEnable]];
- [self showMessage:kDirectoryCreated];
- } else {
- [self showMessage:kErrorCreatingDirectory];
- }
- break;
- case 0:
- NSLog(@"No");
-
- break;
- }
-}
// -------------------------------------------------------------------------------
// afsMenuActivationEvent:
// -------------------------------------------------------------------------------
-(IBAction) afsMenuActivationEvent:(id) sender
{
- if([(NSButton*)afsMenucheckBox state] == NSOffState){
- // must remove the menu
- [self removeAFSMenuExtra];
- } else {
- // must add the menu
- [self addAFSMenuExtra];
- }
+ CFPreferencesSetValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU,
+ (CFNumberRef)[NSNumber numberWithBool:[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];
}
// -------------------------------------------------------------------------------
[tokensLock unlock];
}
-
-// -------------------------------------------------------------------------------
-// isExtraMenuLoaded:
-// -------------------------------------------------------------------------------
-- (BOOL) isAFSMenuExtraLoaded
-{
- void *menu;
- if ((CoreMenuExtraGetMenuExtra((CFStringRef)kAFSMenuExtraID, &menu) == 0) && menu) {
- return YES;
- }
- else {
- return NO;
- }
-}
-
-// -------------------------------------------------------------------------------
-// isExtraMenuLoaded:
-// -------------------------------------------------------------------------------
-- (void)addAFSMenuExtra {
-
- void *menuCracker = 0L;
-
- //Check for MenuCracker
- if ((CoreMenuExtraGetMenuExtra((CFStringRef)kMenuCrakerMenuExtraID, &menuCracker) != 0) || !menuCracker) {
- NSLog(@"MenuCracker not present");
-
- // load the MenuCracker.menu menu extra
- CoreMenuExtraAddMenuExtra((CFURLRef)kMenuCrakerMenuExtra, 0, 0, 0, 0, 0);
- } else NSLog(@"MenuCracker alredy loaded");
-
-
- //Load the AFSCommander menu extra
- CoreMenuExtraAddMenuExtra((CFURLRef)kAFSMenuExtra, 0, 0, 0, 0, 0);
-}
-
// -------------------------------------------------------------------------------
// removeExtra:
// -------------------------------------------------------------------------------
- (IBAction) enableLink:(id) sender {
}
-
-
-// -------------------------------------------------------------------------------
-// removeExtra:
-// -------------------------------------------------------------------------------
-- (void)removeAFSMenuExtra{
- void *menu;
- if ((CoreMenuExtraGetMenuExtra((CFStringRef)kAFSMenuExtraID, &menu) == 0) && menu) {
- CoreMenuExtraRemoveMenuExtra(menu, 0);
- }
-}
-
-
-// -------------------------------------------------------------------------------
-// mextraChangeActivation:
-// -------------------------------------------------------------------------------
-- (void)mextraChangeActivation:(NSNotification *)notification
-{
- // set the afsmenu check state
- [(NSButton*)afsMenucheckBox setState: [self isAFSMenuExtraLoaded]?NSOnState:NSOffState];
-}
@end
@implementation AFSCommanderPref (NSTableDataSource)
[sheet orderOut:self];
[self refreshTokens:nil];
//Inform afs menuextra to updata afs status
- if ([self isAFSMenuExtraLoaded]) [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange];
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kMExtraAFSStateChange];
}
+++ /dev/null
-//
-// AFSMenuCredentialContoller.h
-// AFSCommander
-//
-// Created by Claudio on 14/07/07.
-// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "CredentialWindowController.h"
-#import "AFSPropertyManager.h"
-
-@interface AFSMenuCredentialContoller : NSObject {
- NSRect viewRect;
- id credentialView;
- id credentialController;
- NSPanel *credentialWindow;
- id credWinController;
- AFSPropertyManager *afsPropMngr;
-}
--(id) initWhitRec:(NSRect)rect afsPropManager:(AFSPropertyManager*)afsPropManager;
--(void) showWindow;
--(void) closeWindow;
-@end
+++ /dev/null
-//
-// AFSMenuCredentialContoller.m
-// AFSCommander
-//
-// Created by Claudio on 14/07/07.
-// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
-//
-
-#import "AFSMenuCredentialContoller.h"
-#import "CredentialWindowController.h"
-#import "global.h"
-#import "AFSPropertyManager.h"
-
-@implementation AFSMenuCredentialContoller
-
--(id) initWhitRec:(NSRect)rect afsPropManager:(AFSPropertyManager*)afsPropManager;
-{
- viewRect = rect;
- credentialWindow = nil;
- afsPropMngr = [afsPropManager retain];
- NSLog(@"init AFSMenuCredentialContoller");
- return [self init];
-}
-
-- (void)dealloc {
- NSLog(@"dealloc AFSMenuCredentialContoller");
- if(credentialWindow) [credentialWindow release];
- [super dealloc];
-
-} // dealloc
-
--(void) showWindow
-{
- // calculate the point where show the window
- NSPoint topLeft = {viewRect.origin.x-160,[[NSScreen mainScreen] frame].size.height-kMenuBarHeight};
- NSLog(@"viewRect.origin.x=%d, topLeft.x=%d", viewRect.origin.x, topLeft.x);
- // load the bundle for
- [NSBundle loadNibNamed:@"CredentialWindow.nib" owner:self];
- NSLog(@"prepare to open window CredentialWindow");
-
- credentialWindow = [[NSWindow alloc] initWithContentRect:[((NSView*) credentialView) frame]
- styleMask:NSTitledWindowMask /*| NSUtilityWindowMask*/
- backing:NSBackingStoreBuffered
- defer:YES screen:[NSScreen mainScreen]];
- NSLog(@"Finestra");
- [credentialWindow setTitle:@"Klog"];
- [credentialWindow setFrameTopLeftPoint:topLeft];
- [credentialWindow setContentView:credentialView];
- [credentialWindow makeKeyAndOrderFront:self];
- NSLog(@"creata");
-
-}
-
--(void) closeWindow
-{
- NSLog(@"closeWindow");
- if([(CredentialWindowController*)credWinController takenToken] && afsPropMngr) {
- [afsPropMngr getTokens:true
- usr:[(CredentialWindowController*)credWinController uName]
- pwd:[(CredentialWindowController*)credWinController uPwd]];
- [afsPropMngr release];
- afsPropMngr = nil;
- }
- [credentialWindow close];
- credentialWindow = nil;
-}
-@end
+++ /dev/null
-//
-// AFSMenuExtra.h
-// AFSCommander
-//
-// Created by Claudio on 10/07/07.
-// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
-//
-
-
-#import <Cocoa/Cocoa.h>
-#import "SystemUIPlugin.h"
-#import "global.h"
-#import "AFSMenuCredentialContoller.h"
-@class AFSMenuExtraView;
-@interface AFSMenuExtra : NSMenuExtra {
- @public
- BOOL afsState; //0-off 1-on
- BOOL gotToken; //0-no 1-one o more token
-
- @protected
- NSString *afsSysPath;
- NSNumber *useAklogPrefValue;
- //menu extra
- NSMenu *theMenu;
-
- //Menu extra view
- AFSMenuExtraView *theView;
- // menu reference
- NSMenuItem *startStopMenu;
- NSMenuItem *loginMenu;
- NSMenuItem *unlogMenu;
-
- //Icon for state visualization
- NSImage *hasTokenImage;
- NSImage *noTokenImage;
-
- //credential windows mainWindow
- AFSMenuCredentialContoller *credentialMenuController;
-
- //NSTimer for tokens refresh
- NSTimer *timerForCheckTokensList;
- NSLock *tokensLock;
-}
-- (void)startTimer;
-- (void)stopTimer;
-- (BOOL)useAklogPrefValue;
-- (void)readPreferenceFile:(NSNotification *)notification;
-- (void)getToken:(id)sender;
-- (void)releaseToken:(id)sender;
-- (void)updateAfsStatus:(NSTimer*)timer;
-- (void)klogUserEven:(NSNotification *)notification;
-- (NSImage*)getImageFromBundle:(NSString*)fileName fileExt:(NSString*)ext;
-- (NSImage*)imageToRender;
-- (void)updateMenu;
-- (void)repairHelperTool;
-- (void) afsVolumeMountChange:(NSNotification *)notification;
-@end
+++ /dev/null
-//
-// AFSMenuExtra.m
-// AFSCommander
-//
-// Created by Claudio on 10/07/07.
-// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
-//
-
-#import "AFSMenuExtra.h"
-#import "AFSMenuExtraView.h"
-#import "AFSPropertyManager.h"
-#import "TaskUtil.h"
-#import "TokenCredentialController.h"
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-@implementation AFSMenuExtra
-// -------------------------------------------------------------------------------
-// -(id) initWithBundle
-// -------------------------------------------------------------------------------
-- (id) initWithBundle:(NSBundle *)bundle
-{
- self = [super initWithBundle:bundle];
- if( self == nil )
- return nil;
-
- // allocate the lock
- tokensLock = [[NSLock alloc] init];
- // inizialize the afspath
- afsSysPath = nil;
- credentialMenuController = nil;
-
- theView = [[AFSMenuExtraView alloc] initWithFrame:[[self view] frame]
- menuExtra:self];
- [self setView:theView];
-
-
- // Get the imge for menu
- //Load image for menu rappresentation
- hasTokenImage = [self getImageFromBundle:@"hasToken"
- fileExt:@"png"];
-
- noTokenImage = [self getImageFromBundle:@"noToken"
- fileExt:@"png"];
-
- theMenu = [[NSMenu alloc] initWithTitle: @""];
- [theMenu setAutoenablesItems: NO];
- startStopMenu = [theMenu addItemWithTitle: kAfsOff action: @selector(startStopAfs:) keyEquivalent: @""];
- [startStopMenu setTarget:self];
-
- loginMenu = [theMenu addItemWithTitle: kMenuLogin action: @selector(getToken:) keyEquivalent: @""];
- [loginMenu setTarget:self];
-
- unlogMenu = [theMenu addItemWithTitle: kMenuUnlog action: @selector(releaseToken:) keyEquivalent: @""];
- [unlogMenu setTarget:self];
-
- // Register for preference user change
- [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(readPreferenceFile:)
- name:kAFSMenuExtraID object:kPrefChangeNotification];
-
- // Register for afs state change
- [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(afsVolumeMountChange:)
- name:kAFSMenuExtraID object:kMExtraAFSStateChange];
-
-
- //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];
- //Start to read the afs path
- [self readPreferenceFile:nil];
- [self startTimer];
- return self;
-}
-
-// -------------------------------------------------------------------------------
-// -(void) willUnload
-// -------------------------------------------------------------------------------
-- (void) willUnload {
- //release the lock
- [self stopTimer];
-
- if(hasTokenImage) [hasTokenImage release];
- if(noTokenImage) [noTokenImage release];
-
- // Unregister for preference change
- [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kAFSMenuExtraID object:kPrefChangeNotification];
- [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kAFSMenuExtraID object:kMExtraAFSStateChange];
- [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self name:NSWorkspaceDidMountNotification object:nil];
- [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self name:NSWorkspaceDidUnmountNotification object:nil];
-
-
- [tokensLock release];
-}
-
-// -------------------------------------------------------------------------------
-// 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(updateAfsStatus:)
- userInfo:nil
- repeats:YES];
- [timerForCheckTokensList fire];
-}
-
-// -------------------------------------------------------------------------------
-// stopTimer:
-// -------------------------------------------------------------------------------
-- (void)stopTimer{
- if(!timerForCheckTokensList) return;
- [timerForCheckTokensList invalidate];
- timerForCheckTokensList = nil;
-}
-// -------------------------------------------------------------------------------
-// -(void) dealloc
-// -------------------------------------------------------------------------------
-- (void) dealloc
-{
- [theMenu release];
- [theView release];
- if(afsSysPath) [afsSysPath release];
- // send notify that menuextra has closed
- [[NSDistributedNotificationCenter defaultCenter] postNotificationName:afsCommanderID object:kPrefChangeNotification];
- [super dealloc];
-}
-
-// -------------------------------------------------------------------------------
-// -(NSMenu*) menu
-// -------------------------------------------------------------------------------
-- (NSMenu *) menu
-{
- return theMenu;
-}
-
-
-// -------------------------------------------------------------------------------
-// -(void) readPreferenceFile
-// -------------------------------------------------------------------------------
-- (void) readPreferenceFile:(NSNotification *)notification
-{
- NSLog(@"Reading preference file");
- //CFPreferencesSynchronize((CFStringRef)afsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
- //CFPreferencesSynchronize((CFStringRef)afsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
-
- if(afsSysPath) {
- [afsSysPath release];
- afsSysPath = nil;
- }
-
- afsSysPath = PREFERENCE_AFS_SYS_PAT_STATIC;/*(NSString*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_AFS_SYS_PAT,
- (CFStringRef)afsCommanderID,
- kCFPreferencesAnyUser,
- kCFPreferencesAnyHost);*/
- //NSLog(@"Path readed %s", (afsSysPath==nil?[afsSysPath UTF8String]:@" no path found "));
-
- // read the preference for aklog use
- useAklogPrefValue = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_AKLOG,
- (CFStringRef)afsCommanderID,
- kCFPreferencesCurrentUser,
- kCFPreferencesAnyHost);
- //set the menu name
- //NSLog(@"Preference readed for useAklogPrefValue %d", [useAklogPrefValue intValue]);
-
- [self updateAfsStatus:nil];
-}
-
-// -------------------------------------------------------------------------------
-// -(void) readPreferenceFile
-// -------------------------------------------------------------------------------
-- (void)startStopAfs:(id)sender
-{
- NSLog(@"startStopAfs: %s",[afsSysPath UTF8String]);
- 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:@""];
-
- //[startStopScript setString: resourcePath];
- //NSLog(@"LAunch repair HelperTool");
- //Check helper app
- [self repairHelperTool];
-
- // make the parameter to call the root helper app
- //NSLog(@"Path installazione afs: %s",[afsSysPath UTF8String]);
- //NSLog(@"Path installazione afsd: %s", [afsdPath UTF8String]);
- status = [[AuthUtil shared] autorize];
- if(status == noErr){
- if(currentAfsState){
- //shutdown afs
- //NSLog(@"Shutting down afs");
- NSMutableString *afsKextPath = [[NSMutableString alloc] initWithCapacity:256];
- [afsKextPath setString:afsSysPath];
- [afsKextPath appendString:@"/etc/afs.kext"];
-
- //NSLog(@"executeTaskWithAuth");
- const char *stopAfsArgs[] = {"stop_afs", [afsKextPath UTF8String], [afsdPath UTF8String], 0L};
- [[AuthUtil shared] execUnixCommand:[rootHelperApp UTF8String]
- args:stopAfsArgs
- output:nil];
- } else {
- //NSLog(@"Starting up afs");
- 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
-{
-
- NSRect globalRect;
- globalRect.origin = [[[self view] window] convertBaseToScreen:[[self view] frame].origin];
- globalRect.size = [[self view] frame].size;
- AFSPropertyManager *afsPropMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath ];
- [afsPropMngr loadConfiguration];
-
-
- if([useAklogPrefValue intValue]==NSOnState ) {
- NSLog(@"Use Aklog");
- [afsPropMngr getTokens:false
- usr:nil
- pwd:nil];
- [self klogUserEven:nil];
- } else {
- NSLog(@"Use Klog");
- // register for user event
- [[NSDistributedNotificationCenter defaultCenter] addObserver:self
- selector:@selector(klogUserEven:)
- name:kAFSMenuExtraID
- object:kLogWindowClosed];
-
- credentialMenuController = [[AFSMenuCredentialContoller alloc] initWhitRec:globalRect
- afsPropManager:afsPropMngr];
- [credentialMenuController showWindow];
- }
-
- //Dispose afs manager
- [afsPropMngr release];
-}
-
-// -------------------------------------------------------------------------------
-// -(void) releaseToken
-// -------------------------------------------------------------------------------
-- (void)releaseToken:(id)sender
-{
- AFSPropertyManager *afsMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath];
- [afsMngr unlog:nil];
- [afsMngr release];
- [self updateAfsStatus:nil];
-}
-
-
-// -------------------------------------------------------------------------------
-// -(void) afsVolumeMountChange - Track for mount unmount afs volume
-// -------------------------------------------------------------------------------
-- (void) afsVolumeMountChange:(NSNotification *)notification{
- [self updateAfsStatus:nil];
-}
-
-// -------------------------------------------------------------------------------
-// -(void) updateAfsStatus
-// -------------------------------------------------------------------------------
-- (void)updateAfsStatus:(NSTimer*)timer
-{
- //Try to locking
- if(![tokensLock tryLock]) return;
-
- // check the afs state in esclusive mode
- AFSPropertyManager *afsMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath];
- afsState = [afsMngr checkAfsStatus];
-
- NSArray *tokens = [afsMngr getTokenList];
- [afsMngr release];
- gotToken = [tokens count] > 0;
- [tokens release];
- // update the menu item title
- [startStopMenu setTitle:afsState?kAfsButtonShutdown:kAfsButtonStartup];
-
- [self updateMenu];
-
- [theView setNeedsDisplay:YES];
-
- //unlock
- [tokensLock unlock];
-}
-
-// -------------------------------------------------------------------------------
-// -(void) klogUserEven
-// -------------------------------------------------------------------------------
--(void) klogUserEven:(NSNotification *)notification
-{
- if(credentialMenuController) {
- [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kAFSMenuExtraID object:kLogWindowClosed];
- [credentialMenuController closeWindow];
- [credentialMenuController release];
- credentialMenuController = nil;
- }
- //Send notification to PreferencePane
- [[NSDistributedNotificationCenter defaultCenter] postNotificationName:afsCommanderID object:kMenuExtraEventOccured];
-
- [self updateAfsStatus:nil];
-}
-
-// -------------------------------------------------------------------------------
-// -(void) getImageFromBundle
-// -------------------------------------------------------------------------------
-- (NSImage*)getImageFromBundle:(NSString*)fileName fileExt:(NSString*)ext
-{
- return [[NSImage alloc]initWithContentsOfFile:[[self bundle] pathForResource:fileName
- ofType:ext]];
-}
-
-// -------------------------------------------------------------------------------
-// -(void) imageToRender
-// -------------------------------------------------------------------------------
-- (NSImage*)imageToRender
-{
- if(gotToken){
- return hasTokenImage;
- } else {
- return noTokenImage;
- }
-}
-
-
-// -------------------------------------------------------------------------------
-// -(void) updateMenu
-// -------------------------------------------------------------------------------
-- (void)updateMenu{
- [loginMenu setEnabled:afsState];
- [unlogMenu setEnabled:afsState];
-}
-
-
-// -------------------------------------------------------------------------------
-// -(void) useAklogPrefValue
-// -------------------------------------------------------------------------------
-- (BOOL)useAklogPrefValue
-{
- if(useAklogPrefValue) return [useAklogPrefValue intValue] == NSOnState;
- else return NSOffState;
-}
-
-// -------------------------------------------------------------------------------
-// repairHelperTool:
-// -------------------------------------------------------------------------------
-- (void) repairHelperTool
-{
- struct stat st;
- int fdTool;
- int status = 0;
- NSLog(@"repairHelperTool");
- 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
+++ /dev/null
-//
-// AFSMenuExtraView.h
-// AFSCommander
-//
-// Created by Claudio Bisegni on 11/07/07.
-// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "SystemUIPlugin.h"
-#import "AFSMenuExtra.h"
-
-@interface AFSMenuExtraView : NSMenuExtraView {
- AFSMenuExtra *theMenuExtra;
-
-}
-- (NSAttributedString*) makeKerberosIndicator:(int*)fontHeight;
-@end
+++ /dev/null
-//
-// AFSMenuExtraView.m
-// AFSCommander
-//
-// Created by Claudio Bisegni on 11/07/07.
-// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
-//
-
-#import "AFSMenuExtraView.h"
-#import "AFSPropertyManager.h"
-@implementation AFSMenuExtraView
-
-- initWithFrame:(NSRect)myRect menuExtra:(AFSMenuExtra*)myExtra {
-
- // Have super init
- self = [super initWithFrame:myRect];
- if(!self) {
- return nil;
- }
-
- // Store our extra
- theMenuExtra = myExtra;
-
- // Send it on back
- return self;
-
-} // initWithFrame
-
-- (void)dealloc {
-
- [super dealloc];
-
-} // dealloc
-
-- (void)drawRect:(NSRect)rect
-{
- NSImage *image = nil;
- int fontHeight = 0;
- NSAttributedString *kerberosStringIndicator = nil;
-
- image = [theMenuExtra imageToRender];
- if (image) {
- // Live updating even when menu is down handled by making the extra
- // draw the background if needed.
- if ([theMenuExtra isMenuDown]) {
- [theMenuExtra drawMenuBackground:YES];
- }
- [image compositeToPoint:NSMakePoint(0, 0) operation:NSCompositeSourceOver];
- }
-
- //Draw, if necessary, the kerberos indicator for aklog usage for get token
- if([theMenuExtra useAklogPrefValue] == NSOnState) {
- kerberosStringIndicator = [[self makeKerberosIndicator:&fontHeight] autorelease];
- if(kerberosStringIndicator) [kerberosStringIndicator drawAtPoint:NSMakePoint(0, kMenuBarHeight-fontHeight)];
- }
-}
-
-/*!
- @method makeKerberosIndicator
- @abstract Make the kerberos indicator
- @discussion Make a letter to render in menu view to inform the user if is enable aklog use
-*/
-- (NSAttributedString*) makeKerberosIndicator:(int*)fontHeight {
- NSFont *font = [NSFont fontWithName:@"Palatino-Roman" size:9.0];
- NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:font
- forKey:NSFontAttributeName];
- NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"K"
- attributes:attrsDictionary];
- *fontHeight = [attrString size].height;
- return attrString;
-}
-@end
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IBClasses</key>
- <array>
- <dict>
- <key>CLASS</key>
- <string>FirstResponder</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>SUPERCLASS</key>
- <string>NSObject</string>
- </dict>
- <dict>
- <key>CLASS</key>
- <string>AFSMenuCredentialContoller</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>OUTLETS</key>
- <dict>
- <key>credWinController</key>
- <string>CredentialWindowController</string>
- <key>credentialController</key>
- <string>id</string>
- <key>credentialView</key>
- <string>id</string>
- </dict>
- <key>SUPERCLASS</key>
- <string>NSObject</string>
- </dict>
- <dict>
- <key>ACTIONS</key>
- <dict>
- <key>closePanel</key>
- <string>id</string>
- <key>getToken</key>
- <string>id</string>
- </dict>
- <key>CLASS</key>
- <string>CredentialWindowController</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>OUTLETS</key>
- <dict>
- <key>afsMenuController</key>
- <string>id</string>
- <key>credentialView</key>
- <string>id</string>
- <key>textEditPassword</key>
- <string>id</string>
- <key>textEditUserName</key>
- <string>id</string>
- </dict>
- <key>SUPERCLASS</key>
- <string>NSObject</string>
- </dict>
- </array>
- <key>IBVersion</key>
- <string>1</string>
-</dict>
-</plist>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IBFramework Version</key>
- <string>644</string>
- <key>IBLastKnownRelativeProjectPath</key>
- <string>../AFSCommander.xcodeproj</string>
- <key>IBOldestOS</key>
- <integer>5</integer>
- <key>IBOpenObjects</key>
- <array>
- <integer>248</integer>
- </array>
- <key>IBSystem Version</key>
- <string>9C31</string>
- <key>targetFramework</key>
- <string>IBCocoaFramework</string>
-</dict>
-</plist>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>AFSMenuExtra</string>
- <key>CFBundleIdentifier</key>
- <string>it.infn.lnf.network.AFSMenuExtra</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundlePackageType</key>
- <string>BNDL</string>
- <key>CFBundleSignature</key>
- <string>INFN</string>
- <key>CFBundleVersion</key>
- <string>0.2a</string>
- <key>NSPrincipalClass</key>
- <string>AFSMenuExtra</string>
-</dict>
-</plist>
+++ /dev/null
-//
-// CredentialWindowController.h
-// AFSCommander
-//
-// Created by Claudio on 14/07/07.
-// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "AFSMenuCredentialContoller.h"
-#import "global.h"
-
-@interface CredentialWindowController : NSObject {
- id credentialView;
- id afsMenuController;
- id textEditUserName;
- id textEditPassword;
-
- BOOL taken;
- NSString *uName;
- NSString *uPwd;
-
-}
-
-- (IBAction) getToken:(id) sender;
-- (IBAction) closePanel:(id) sender;
-- (BOOL) takenToken;
-- (NSString*) uName;
-- (NSString*) uPwd;
-@end
+++ /dev/null
-//
-// CredentialWindowController.m
-// AFSCommander
-//
-// Created by Claudio on 14/07/07.
-// Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
-//
-
-#import "CredentialWindowController.h"
-#import "AFSPropertyManager.h"
-
-@implementation CredentialWindowController
-// -------------------------------------------------------------------------------
-// awakeFromNib:
-// -------------------------------------------------------------------------------
-- (void)awakeFromNib
-{
- NSLog(@"awakeFromNib");
-}
-
-// -------------------------------------------------------------------------------
-// getToken:
-// -------------------------------------------------------------------------------
-- (IBAction) getToken:(id) sender
-{
- uName = [((NSTextField*) textEditUserName) stringValue];
- uPwd = [((NSTextField*) textEditPassword) stringValue];
- if(uName == @"" || uPwd == @"") return;
- taken = YES;
-
-
- [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kLogWindowClosed];
-}
-
-
-// -------------------------------------------------------------------------------
-// closePanel:
-// -------------------------------------------------------------------------------
-- (IBAction) closePanel:(id) sender
-{
- taken = NO;
- NSLog(@"closePanel");
- [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kLogWindowClosed];
-}
-
-
-// -------------------------------------------------------------------------------
-// takenToken:
-// -------------------------------------------------------------------------------
-- (BOOL) takenToken
-{
- return taken;
-}
-
-// -------------------------------------------------------------------------------
-// takenToken:
-// -------------------------------------------------------------------------------
-- (NSString*) uName
-{
- return uName;
-}
-
-// -------------------------------------------------------------------------------
-// takenToken:
-// -------------------------------------------------------------------------------
-- (NSString*) uPwd
-{
- return uPwd;
-}
-
-@end
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleExecutable</key>
- <string>MenuCracker</string>
- <key>CFBundleGetInfoString</key>
- <string>MenuCracker 1.4 ©2001-2006, james_007_bond@users.sourceforge.net</string>
- <key>CFBundleIdentifier</key>
- <string>net.sourceforge.menucracker2</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>MenuCracker</string>
- <key>CFBundlePackageType</key>
- <string>BNDL</string>
- <key>CFBundleShortVersionString</key>
- <string>1.4</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>6</string>
- <key>NSMenuExtraWidth</key>
- <integer>0</integer>
- <key>NSPrincipalClass</key>
- <string>CPUExtra</string>
-</dict>
-</plist>
+++ /dev/null
-{\rtf1\mac\ansicpg10000\cocoartf102
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Bold;\f2\fnil\fcharset77 Monaco;
-}
-{\colortbl;\red255\green255\blue255;\red118\green15\blue80;\red0\green0\blue255;\red35\green110\blue37;
-}
-\margl1440\margr1440\vieww17140\viewh9140\viewkind0
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural
-
-\f0\fs24 \cf0 Welcome to
-\f1\b MenuCracker
-\f0\b0 .\
-\
-Menu cracker is a little tool to reenable the menu extra that Apple closed in Mac OS X 10.2 (code named Jaguar). Using MenuCracker you can use all your 10.1 Menu Extras unmodified.\
-\
-If you are an end user and you just want to make sure everything works as it was before 10.2:\
-\
-- first copy MenuCracker.menu anywhere in your home directory (Applications and Library/Bundles are relatively good choices)\
-\
-- Then double click on the installed version or drag it to the menubar.\
-\
-That's it.\
-\
-From then on all your third party menu extra will work.\
-\
-If you are a developer and your menu extra is controlled by an application there is some work for you to do. First add the MenuCracker binary to the resource folder of your application or preference pane. Then before calling
-\f2\fs20 \CocoaLigature0 CoreMenuExtraAddMenuExtra()
-\f0\fs24 \CocoaLigature1 for your menu extra execute the following code:\
-\
-\pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\li1440\fi-1440\ql\qnatural
-
-\f2\fs20 \cf0 \CocoaLigature0 NSString *menuExtraPath = [[[\cf2 self\cf0 bundle] resourcePath] stringByAppendingPathComponent:@"MenuCracker.menu"];\
- CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)menuExtraPath, kCFURLPOSIXPathStyle, \cf2 NO\cf0 );\
-\pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\li960\fi-960\ql\qnatural
-\cf0 \cf2 unsigned\cf0 \cf2 int\cf0 outExtra;\
-\pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\li1440\fi-1440\ql\qnatural
-\cf0 \
- CoreMenuExtraAddMenuExtra(url, 0, \cf3 0\cf0 , \cf2 nil\cf0 , \cf3 0\cf0 , &outExtra);\
-\pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\li1920\fi-1920\ql\qnatural
-\cf0
-\f0\fs24 \cf4 // Do not check the return value as it is always going to return an error
-\f2\fs20 \cf0 \
-\pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\li1440\fi-1440\ql\qnatural
-\cf0 CFRelease(url);\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural
-
-\f0\fs24 \cf0 \CocoaLigature1 \
-That's it.\
-\
-You can find the latest version of MenuCracker at http://sourceforge.net/projects/menucracker.\
-\
--- james_007_bond @ users.sourceforge.net}
\ No newline at end of file
3228B9B4102052A900DF98DA /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327309620C2AB433008C322B /* Security.framework */; };
3228B9BE102052BE00DF98DA /* version.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3228B9BD102052BE00DF98DA /* version.plist */; };
3228B9D5102070A200DF98DA /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3276591D10204E08004CA418 /* Info.plist */; };
- 3228BA1910207A4200DF98DA /* hasToken.png in Resources */ = {isa = PBXBuildFile; fileRef = 3228BA1810207A4200DF98DA /* hasToken.png */; };
- 3228BA1B10207A5200DF98DA /* noToken.png in Resources */ = {isa = PBXBuildFile; fileRef = 3228BA1A10207A5200DF98DA /* noToken.png */; };
322B90450C2F0A2D0068F99A /* start_afs.sh in Resources */ = {isa = PBXBuildFile; fileRef = 322B90430C2F0A2D0068F99A /* start_afs.sh */; };
322B90460C2F0A2D0068F99A /* stop_afs.sh in Resources */ = {isa = PBXBuildFile; fileRef = 322B90440C2F0A2D0068F99A /* stop_afs.sh */; };
322CEF600C211D220060D66D /* DBCellElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 322CEF5F0C211D220060D66D /* DBCellElement.m */; };
322CEF6E0C211DCC0060D66D /* CellIp.m in Sources */ = {isa = PBXBuildFile; fileRef = 322CEF6D0C211DCC0060D66D /* CellIp.m */; };
+ 3231522010243E09005901AA /* AFSMenuCredentialContoller.m in Sources */ = {isa = PBXBuildFile; fileRef = 3231521A10243E09005901AA /* AFSMenuCredentialContoller.m */; };
+ 3231522210243E09005901AA /* AFSMenuExtraView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3231521E10243E09005901AA /* AFSMenuExtraView.m */; };
+ 3231522610243E10005901AA /* CredentialWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3231522510243E10005901AA /* CredentialWindowController.m */; };
+ 3231522810243E21005901AA /* CredentialWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 3231522710243E21005901AA /* CredentialWindow.nib */; };
+ 3231522B10243E2C005901AA /* hasToken.png in Resources */ = {isa = PBXBuildFile; fileRef = 3231522910243E2C005901AA /* hasToken.png */; };
+ 3231522C10243E2C005901AA /* noToken.png in Resources */ = {isa = PBXBuildFile; fileRef = 3231522A10243E2C005901AA /* noToken.png */; };
324D67FD0DA13194007E1561 /* OpenAFSPreference.xib in Resources */ = {isa = PBXBuildFile; fileRef = 324D67FB0DA13194007E1561 /* OpenAFSPreference.xib */; };
324D683D0DA133A3007E1561 /* IpPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 324D683B0DA133A3007E1561 /* IpPanel.xib */; };
324D684A0DA133CF007E1561 /* CredentialPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 324D68480DA133CF007E1561 /* CredentialPanel.xib */; };
- 325311AB0C44F38200FAF2F3 /* AFSPropertyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 32B0AFDE0C01729400272348 /* AFSPropertyManager.m */; };
- 325311AF0C44F38D00FAF2F3 /* CellIp.m in Sources */ = {isa = PBXBuildFile; fileRef = 322CEF6D0C211DCC0060D66D /* CellIp.m */; };
- 325311B00C44F38D00FAF2F3 /* DBCellElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 322CEF5F0C211D220060D66D /* DBCellElement.m */; };
- 325311B10C44F39200FAF2F3 /* TaskUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 327756260C3053A100C15D11 /* TaskUtil.m */; };
- 325311B20C44F39300FAF2F3 /* AuthUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 3213E9400C2ABFD200D3D2F6 /* AuthUtil.m */; };
- 325311B30C44F39400FAF2F3 /* FileUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 3273088C0C2A9B05008C322B /* FileUtil.m */; };
325311D00C44F4B100FAF2F3 /* licenza.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 325311CF0C44F4B100FAF2F3 /* licenza.rtf */; };
- 325312190C44F7BD00FAF2F3 /* AFSMenuExtraView.m in Sources */ = {isa = PBXBuildFile; fileRef = 325312180C44F7BD00FAF2F3 /* AFSMenuExtraView.m */; };
- 325313520C45153400FAF2F3 /* SecurityFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327308D20C2AA364008C322B /* SecurityFoundation.framework */; };
- 325313550C45153500FAF2F3 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 327309620C2AB433008C322B /* Security.framework */; };
- 3253138D0C45157A00FAF2F3 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
- 325313B10C4516A900FAF2F3 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 325313B00C4516A900FAF2F3 /* Info.plist */; };
3273088D0C2A9B05008C322B /* FileUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 3273088B0C2A9B05008C322B /* FileUtil.h */; };
3273088E0C2A9B05008C322B /* FileUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 3273088C0C2A9B05008C322B /* FileUtil.m */; };
327308C30C2AA2E1008C322B /* FileUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 3273088C0C2A9B05008C322B /* FileUtil.m */; };
32B0AFE00C01729400272348 /* AFSPropertyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 32B0AFDE0C01729400272348 /* AFSPropertyManager.m */; };
32B565740D8FAF62005255F2 /* NSString+search.h in Headers */ = {isa = PBXBuildFile; fileRef = 32B565720D8FAF62005255F2 /* NSString+search.h */; };
32B565750D8FAF62005255F2 /* NSString+search.m in Sources */ = {isa = PBXBuildFile; fileRef = 32B565730D8FAF62005255F2 /* NSString+search.m */; };
- 32B565760D8FAF62005255F2 /* NSString+search.m in Sources */ = {isa = PBXBuildFile; fileRef = 32B565730D8FAF62005255F2 /* NSString+search.m */; };
32C4A9580C268D9B009280A0 /* IpConfiguratorCommander.m in Sources */ = {isa = PBXBuildFile; fileRef = 32C4A9570C268D9B009280A0 /* IpConfiguratorCommander.m */; };
32C4A9B80C26A0FA009280A0 /* IpConfiguratorCommander.m in Sources */ = {isa = PBXBuildFile; fileRef = 32C4A9570C268D9B009280A0 /* IpConfiguratorCommander.m */; };
32C4A9B90C26A0FB009280A0 /* IpConfiguratorCommander.h in Headers */ = {isa = PBXBuildFile; fileRef = 32C4A9560C268D9B009280A0 /* IpConfiguratorCommander.h */; };
32CF013F0C203C5600A8DC58 /* TestLib.m in Sources */ = {isa = PBXBuildFile; fileRef = 32CFFEFD0C20316B00A8DC58 /* TestLib.m */; };
32CF01460C203CA800A8DC58 /* AFSPropertyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 32B0AFDE0C01729400272348 /* AFSPropertyManager.m */; };
32CF014C0C203CBD00A8DC58 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
- 32D45E070C4B4D9C00A1012D /* afshlp in Resources */ = {isa = PBXBuildFile; fileRef = 49683EE40C3446380093C7C8 /* afshlp */; };
32DE818C0DF573200069A05C /* LynkCreationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 32DE818A0DF573200069A05C /* LynkCreationController.h */; };
32DE818D0DF573200069A05C /* LynkCreationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 32DE818B0DF573200069A05C /* LynkCreationController.m */; };
32DE81BD0DF57BDA0069A05C /* SymLinkEdit.xib in Resources */ = {isa = PBXBuildFile; fileRef = 32DE81BC0DF57BDA0069A05C /* SymLinkEdit.xib */; };
+ 32E299A3102491AA00D2C2E5 /* AFSBackgrounder.app in Resources */ = {isa = PBXBuildFile; fileRef = 3276591B10204E08004CA418 /* AFSBackgrounder.app */; };
492AFA860C51301D00AEDC93 /* TokenCredentialController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3219259B0C339DAE00B55E86 /* TokenCredentialController.h */; };
492AFA870C51301E00AEDC93 /* TokenCredentialController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3219259C0C339DAE00B55E86 /* TokenCredentialController.m */; };
- 492AFB280C51483600AEDC93 /* CredentialWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 492AFB270C51483600AEDC93 /* CredentialWindow.nib */; };
4934D4170DC38958000511D2 /* PListManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 498DCB420DC2240B00D143C8 /* PListManager.m */; };
493564E80CE711F300699A24 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 493564E70CE711F300699A24 /* Carbon.framework */; };
4940075B0CE62EB500F40D0A /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4940075A0CE62EB500F40D0A /* CoreServices.framework */; };
- 4941F4C00C491D2D00B29A73 /* TokenCredentialController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3219259C0C339DAE00B55E86 /* TokenCredentialController.m */; };
- 4941F5100C4929C000B29A73 /* AFSMenuCredentialContoller.m in Sources */ = {isa = PBXBuildFile; fileRef = 4941F50F0C4929C000B29A73 /* AFSMenuCredentialContoller.m */; };
- 4941F6320C49379000B29A73 /* CredentialWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4941F6310C49379000B29A73 /* CredentialWindowController.m */; };
- 494435170DC35D4C00C7A333 /* LoginTimeDaemon in Resources */ = {isa = PBXBuildFile; fileRef = 4998A6860DC33BEC00146652 /* LoginTimeDaemon */; };
- 494BD4880C43EEA400DB0A3A /* SystemUIPlugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 494BD4870C43EEA400DB0A3A /* SystemUIPlugin.framework */; };
- 494BD48C0C43EEC300DB0A3A /* AFSMenuExtra.m in Sources */ = {isa = PBXBuildFile; fileRef = 494BD48B0C43EEC300DB0A3A /* AFSMenuExtra.m */; };
- 494C75110C4605C000D3A2D2 /* AFSMenuExtra.menu in Resources */ = {isa = PBXBuildFile; fileRef = 494C74DE0C46052800D3A2D2 /* AFSMenuExtra.menu */; };
- 49575BB50C53CBDB00B3BC32 /* hasToken.png in Resources */ = {isa = PBXBuildFile; fileRef = 49575BB30C53CBDB00B3BC32 /* hasToken.png */; };
- 49575BB60C53CBDB00B3BC32 /* noToken.png in Resources */ = {isa = PBXBuildFile; fileRef = 49575BB40C53CBDB00B3BC32 /* noToken.png */; };
495B04400D219A2900F1E328 /* ViewUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = 495B043E0D219A2900F1E328 /* ViewUtility.h */; };
495B04410D219A2900F1E328 /* ViewUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 495B043F0D219A2900F1E328 /* ViewUtility.m */; };
495B04420D219A2900F1E328 /* ViewUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 495B043F0D219A2900F1E328 /* ViewUtility.m */; };
495C39470D81EA3C003426FC /* Kerberos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 495C39460D81EA3C003426FC /* Kerberos.framework */; };
- 495C39480D81EA3C003426FC /* Kerberos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 495C39460D81EA3C003426FC /* Kerberos.framework */; };
495C39490D81EA3C003426FC /* Kerberos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 495C39460D81EA3C003426FC /* Kerberos.framework */; };
495C39CC0D81F742003426FC /* Kerberos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 495C39460D81EA3C003426FC /* Kerberos.framework */; };
49683EEC0C3446600093C7C8 /* afshlp.m in Sources */ = {isa = PBXBuildFile; fileRef = 49683EEB0C3446600093C7C8 /* afshlp.m */; };
49B766450DCA47A50014A80F /* DialogUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B766430DCA47A50014A80F /* DialogUtility.h */; };
49B766460DCA47A50014A80F /* DialogUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 49B766440DCA47A50014A80F /* DialogUtility.m */; };
49E05CAD0C2674DA002AAEF2 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8D202CF70486D31800D8A456 /* Info.plist */; };
- 49E43BA60C47D53F00084436 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3223836A0C32A96F00380547 /* Localizable.strings */; };
49E43BE70C47D9EE00084436 /* global.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E43BE60C47D9EE00084436 /* global.h */; };
- 49E43C730C47E0EA00084436 /* start_afs.sh in Resources */ = {isa = PBXBuildFile; fileRef = 322B90430C2F0A2D0068F99A /* start_afs.sh */; };
- 49E43C740C47E0EC00084436 /* stop_afs.sh in Resources */ = {isa = PBXBuildFile; fileRef = 322B90440C2F0A2D0068F99A /* stop_afs.sh */; };
49E43D2E0C480B8200084436 /* afshlp in Resources */ = {isa = PBXBuildFile; fileRef = 49683EE40C3446380093C7C8 /* afshlp */; };
49FFE7D20C2AED7200DF83CF /* AuthUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 3213E9400C2ABFD200D3D2F6 /* AuthUtil.m */; };
8D202CEA0486D31800D8A456 /* AFSCommander_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32DBCFA20370C41700C91783 /* AFSCommander_Prefix.pch */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
- 3279B9800C451A63008FE3FA /* PBXContainerItemProxy */ = {
+ 32E29A9810249A1200D2C2E5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 089C1669FE841209C02AAC07 /* Project object */;
proxyType = 1;
- remoteGlobalIDString = 494BD4680C43ED0C00DB0A3A;
- remoteInfo = AFSMenuExtra;
- };
- 494435680DC35D6F00C7A333 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 089C1669FE841209C02AAC07 /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 4998A6850DC33BEC00146652;
- remoteInfo = LoginTimeDaemon;
+ remoteGlobalIDString = 49683EE30C3446380093C7C8 /* afshlp */;
+ remoteInfo = afshlp;
};
- 49575C270C53CD9A00B3BC32 /* PBXContainerItemProxy */ = {
+ 32E29A9A10249A1600D2C2E5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 089C1669FE841209C02AAC07 /* Project object */;
proxyType = 1;
- remoteGlobalIDString = 49683EE30C3446380093C7C8;
- remoteInfo = afshlp;
+ remoteGlobalIDString = 3276591A10204E08004CA418 /* AFSBackgrounder */;
+ remoteInfo = AFSBackgrounder;
};
/* End PBXContainerItemProxy section */
-/* Begin PBXCopyFilesBuildPhase section */
- 494D72C90C350BC400B1FD21 /* CopyFiles */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 2147483647;
- dstPath = MenuCracker.menu;
- dstSubfolderSpec = 7;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXCopyFilesBuildPhase section */
-
/* Begin PBXFileReference section */
089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
322884020C3E45C800E778CC /* InfoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InfoController.m; sourceTree = "<group>"; };
3228B9AF1020526900DF98DA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = AFSBackgrounder/main.m; sourceTree = "<group>"; };
3228B9BD102052BE00DF98DA /* version.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = version.plist; path = AFSBackgrounder/resource/version.plist; sourceTree = "<group>"; };
- 3228BA1810207A4200DF98DA /* hasToken.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = hasToken.png; sourceTree = "<group>"; };
- 3228BA1A10207A5200DF98DA /* noToken.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = noToken.png; sourceTree = "<group>"; };
322B90430C2F0A2D0068F99A /* start_afs.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = start_afs.sh; sourceTree = "<group>"; };
322B90440C2F0A2D0068F99A /* stop_afs.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = stop_afs.sh; sourceTree = "<group>"; };
322CEF5E0C211D220060D66D /* DBCellElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBCellElement.h; sourceTree = "<group>"; };
322CEF5F0C211D220060D66D /* DBCellElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBCellElement.m; sourceTree = "<group>"; };
322CEF6C0C211DCC0060D66D /* CellIp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CellIp.h; sourceTree = "<group>"; };
322CEF6D0C211DCC0060D66D /* CellIp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CellIp.m; sourceTree = "<group>"; };
+ 3231521910243E09005901AA /* AFSMenuCredentialContoller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFSMenuCredentialContoller.h; path = AFSBackgrounder/AFSMenuCredentialContoller.h; sourceTree = "<group>"; };
+ 3231521A10243E09005901AA /* AFSMenuCredentialContoller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFSMenuCredentialContoller.m; path = AFSBackgrounder/AFSMenuCredentialContoller.m; sourceTree = "<group>"; };
+ 3231521B10243E09005901AA /* AFSMenuExtra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFSMenuExtra.h; path = AFSBackgrounder/AFSMenuExtra.h; sourceTree = "<group>"; };
+ 3231521C10243E09005901AA /* AFSMenuExtra.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFSMenuExtra.m; path = AFSBackgrounder/AFSMenuExtra.m; sourceTree = "<group>"; };
+ 3231521D10243E09005901AA /* AFSMenuExtraView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFSMenuExtraView.h; path = AFSBackgrounder/AFSMenuExtraView.h; sourceTree = "<group>"; };
+ 3231521E10243E09005901AA /* AFSMenuExtraView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFSMenuExtraView.m; path = AFSBackgrounder/AFSMenuExtraView.m; sourceTree = "<group>"; };
+ 3231522410243E10005901AA /* CredentialWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CredentialWindowController.h; sourceTree = "<group>"; };
+ 3231522510243E10005901AA /* CredentialWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CredentialWindowController.m; sourceTree = "<group>"; };
+ 3231522710243E21005901AA /* CredentialWindow.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = CredentialWindow.nib; path = AFSBackgrounder/resource/CredentialWindow.nib; sourceTree = "<group>"; };
+ 3231522910243E2C005901AA /* hasToken.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = hasToken.png; path = AFSBackgrounder/resource/hasToken.png; sourceTree = "<group>"; };
+ 3231522A10243E2C005901AA /* noToken.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = noToken.png; path = AFSBackgrounder/resource/noToken.png; sourceTree = "<group>"; };
324D67FC0DA13194007E1561 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/OpenAFSPreference.xib; sourceTree = "<group>"; };
324D683C0DA133A3007E1561 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/IpPanel.xib; sourceTree = "<group>"; };
324D68490DA133CF007E1561 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/CredentialPanel.xib; sourceTree = "<group>"; };
325311CF0C44F4B100FAF2F3 /* licenza.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = licenza.rtf; sourceTree = "<group>"; };
- 325312170C44F7BD00FAF2F3 /* AFSMenuExtraView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFSMenuExtraView.h; sourceTree = "<group>"; };
- 325312180C44F7BD00FAF2F3 /* AFSMenuExtraView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFSMenuExtraView.m; sourceTree = "<group>"; };
- 325313B00C4516A900FAF2F3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = Info.plist; path = AfsMenuExtraResource/Info.plist; sourceTree = "<group>"; };
3273088B0C2A9B05008C322B /* FileUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileUtil.h; sourceTree = "<group>"; };
3273088C0C2A9B05008C322B /* FileUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FileUtil.m; sourceTree = "<group>"; };
327308D20C2AA364008C322B /* SecurityFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SecurityFoundation.framework; path = /System/Library/Frameworks/SecurityFoundation.framework; sourceTree = "<absolute>"; };
32DE817D0DF571630069A05C /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/SymLinkEdit.xib; sourceTree = "<group>"; };
32DE818A0DF573200069A05C /* LynkCreationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LynkCreationController.h; sourceTree = "<group>"; };
32DE818B0DF573200069A05C /* LynkCreationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LynkCreationController.m; sourceTree = "<group>"; };
- 492AFB270C51483600AEDC93 /* CredentialWindow.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = CredentialWindow.nib; path = AfsMenuExtraResource/CredentialWindow.nib; sourceTree = "<group>"; };
493564E70CE711F300699A24 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
4940075A0CE62EB500F40D0A /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
- 4941F50E0C4929C000B29A73 /* AFSMenuCredentialContoller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFSMenuCredentialContoller.h; sourceTree = "<group>"; };
- 4941F50F0C4929C000B29A73 /* AFSMenuCredentialContoller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFSMenuCredentialContoller.m; sourceTree = "<group>"; };
- 4941F6300C49379000B29A73 /* CredentialWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CredentialWindowController.h; sourceTree = "<group>"; };
- 4941F6310C49379000B29A73 /* CredentialWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CredentialWindowController.m; sourceTree = "<group>"; };
494BD47B0C43EDF900DB0A3A /* SystemUIPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SystemUIPlugin.h; sourceTree = "<group>"; };
- 494BD4870C43EEA400DB0A3A /* SystemUIPlugin.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemUIPlugin.framework; path = /System/Library/PrivateFrameworks/SystemUIPlugin.framework; sourceTree = "<absolute>"; };
- 494BD48A0C43EEC300DB0A3A /* AFSMenuExtra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFSMenuExtra.h; sourceTree = "<group>"; };
- 494BD48B0C43EEC300DB0A3A /* AFSMenuExtra.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFSMenuExtra.m; sourceTree = "<group>"; };
- 494C74DE0C46052800D3A2D2 /* AFSMenuExtra.menu */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AFSMenuExtra.menu; sourceTree = BUILT_PRODUCTS_DIR; };
- 49575BB30C53CBDB00B3BC32 /* hasToken.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = hasToken.png; sourceTree = "<group>"; };
- 49575BB40C53CBDB00B3BC32 /* noToken.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = noToken.png; sourceTree = "<group>"; };
495B043E0D219A2900F1E328 /* ViewUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewUtility.h; sourceTree = "<group>"; };
495B043F0D219A2900F1E328 /* ViewUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewUtility.m; sourceTree = "<group>"; };
495C39460D81EA3C003426FC /* Kerberos.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kerberos.framework; path = /System/Library/Frameworks/Kerberos.framework; sourceTree = "<absolute>"; };
);
runOnlyForDeploymentPostprocessing = 0;
};
- 494BD4670C43ED0C00DB0A3A /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 494BD4880C43EEA400DB0A3A /* SystemUIPlugin.framework in Frameworks */,
- 325313520C45153400FAF2F3 /* SecurityFoundation.framework in Frameworks */,
- 325313550C45153500FAF2F3 /* Security.framework in Frameworks */,
- 3253138D0C45157A00FAF2F3 /* Cocoa.framework in Frameworks */,
- 495C39480D81EA3C003426FC /* Kerberos.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
49683EE20C3446380093C7C8 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
children = (
32CFFEF90C20314100A8DC58 /* Stand Alone Program */,
08FB77AFFE84173DC02AAC07 /* Classes */,
- 494BD47A0C43EDD400DB0A3A /* AFSMenuExtra */,
3276591010204DB4004CA418 /* AFSBackgrounder */,
32DBCFA10370C40200C91783 /* Other Sources */,
089C167CFE841241C02AAC07 /* Resources */,
1058C7AEFEA557BF11CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
- 494BD4870C43EEA400DB0A3A /* SystemUIPlugin.framework */,
327309620C2AB433008C322B /* Security.framework */,
327308D20C2AA364008C322B /* SecurityFoundation.framework */,
089C1672FE841209C02AAC07 /* Foundation.framework */,
8D202CF80486D31800D8A456 /* OpenAFS.prefPane */,
32CF01390C203C1800A8DC58 /* Test */,
49683EE40C3446380093C7C8 /* afshlp */,
- 494C74DE0C46052800D3A2D2 /* AFSMenuExtra.menu */,
4998A6860DC33BEC00146652 /* LoginTimeDaemon */,
3276591B10204E08004CA418 /* AFSBackgrounder.app */,
);
3228B9B21020527000DF98DA /* resource */ = {
isa = PBXGroup;
children = (
- 3228BA1810207A4200DF98DA /* hasToken.png */,
- 3228BA1A10207A5200DF98DA /* noToken.png */,
+ 3231522910243E2C005901AA /* hasToken.png */,
+ 3231522A10243E2C005901AA /* noToken.png */,
+ 3231522710243E21005901AA /* CredentialWindow.nib */,
3276591D10204E08004CA418 /* Info.plist */,
3228B9BD102052BE00DF98DA /* version.plist */,
3276592D10204F8D004CA418 /* AFSBackounderMainMenu.xib */,
name = "Afs Element";
sourceTree = "<group>";
};
- 325313A10C4515A700FAF2F3 /* Resource */ = {
+ 3231522310243E10005901AA /* CredentialWindow */ = {
isa = PBXGroup;
children = (
- 49575BB30C53CBDB00B3BC32 /* hasToken.png */,
- 49575BB40C53CBDB00B3BC32 /* noToken.png */,
- 325313B00C4516A900FAF2F3 /* Info.plist */,
- 492AFB270C51483600AEDC93 /* CredentialWindow.nib */,
+ 3231522510243E10005901AA /* CredentialWindowController.m */,
+ 3231522410243E10005901AA /* CredentialWindowController.h */,
);
- name = Resource;
+ name = CredentialWindow;
+ path = AFSBackgrounder/CredentialWindow;
sourceTree = "<group>";
};
327308880C2A99A1008C322B /* Utility */ = {
isa = PBXGroup;
children = (
3228B9AF1020526900DF98DA /* main.m */,
- 3276592F10204F9E004CA418 /* AFSBackgrounderDelegate.h */,
3276593010204F9E004CA418 /* AFSBackgrounderDelegate.m */,
+ 3276592F10204F9E004CA418 /* AFSBackgrounderDelegate.h */,
+ 3231521C10243E09005901AA /* AFSMenuExtra.m */,
+ 3231521B10243E09005901AA /* AFSMenuExtra.h */,
+ 3231521E10243E09005901AA /* AFSMenuExtraView.m */,
+ 3231521D10243E09005901AA /* AFSMenuExtraView.h */,
+ 3231521A10243E09005901AA /* AFSMenuCredentialContoller.m */,
+ 3231521910243E09005901AA /* AFSMenuCredentialContoller.h */,
+ 3231522310243E10005901AA /* CredentialWindow */,
3228B9B21020527000DF98DA /* resource */,
);
name = AFSBackgrounder;
name = "Lynk Creation";
sourceTree = "<group>";
};
- 4941F62F0C49377000B29A73 /* CredentialWindow */ = {
- isa = PBXGroup;
- children = (
- 4941F6300C49379000B29A73 /* CredentialWindowController.h */,
- 4941F6310C49379000B29A73 /* CredentialWindowController.m */,
- );
- name = CredentialWindow;
- sourceTree = "<group>";
- };
- 494BD47A0C43EDD400DB0A3A /* AFSMenuExtra */ = {
- isa = PBXGroup;
- children = (
- 494BD48A0C43EEC300DB0A3A /* AFSMenuExtra.h */,
- 494BD48B0C43EEC300DB0A3A /* AFSMenuExtra.m */,
- 325312170C44F7BD00FAF2F3 /* AFSMenuExtraView.h */,
- 325312180C44F7BD00FAF2F3 /* AFSMenuExtraView.m */,
- 4941F50E0C4929C000B29A73 /* AFSMenuCredentialContoller.h */,
- 4941F50F0C4929C000B29A73 /* AFSMenuCredentialContoller.m */,
- 4941F62F0C49377000B29A73 /* CredentialWindow */,
- 325313A10C4515A700FAF2F3 /* Resource */,
- );
- name = AFSMenuExtra;
- sourceTree = "<group>";
- };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
productReference = 32CF01390C203C1800A8DC58 /* Test */;
productType = "com.apple.product-type.tool";
};
- 494BD4680C43ED0C00DB0A3A /* AFSMenuExtra */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 494BD46C0C43ED0D00DB0A3A /* Build configuration list for PBXNativeTarget "AFSMenuExtra" */;
- buildPhases = (
- 494BD4650C43ED0C00DB0A3A /* Resources */,
- 494BD4660C43ED0C00DB0A3A /* Sources */,
- 494BD4670C43ED0C00DB0A3A /* Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- 49575C280C53CD9A00B3BC32 /* PBXTargetDependency */,
- );
- name = AFSMenuExtra;
- productName = AFSMenuExtra;
- productReference = 494C74DE0C46052800D3A2D2 /* AFSMenuExtra.menu */;
- productType = "com.apple.product-type.bundle";
- };
49683EE30C3446380093C7C8 /* afshlp */ = {
isa = PBXNativeTarget;
buildConfigurationList = 49683EE70C34465D0093C7C8 /* Build configuration list for PBXNativeTarget "afshlp" */;
8D202CF00486D31800D8A456 /* Sources */,
8D202CF20486D31800D8A456 /* Frameworks */,
8D202CF50486D31800D8A456 /* Rez */,
- 494D72C90C350BC400B1FD21 /* CopyFiles */,
- 3281A5B00CD7432A00907CF6 /* ShellScript */,
);
buildRules = (
);
dependencies = (
- 3279B9810C451A63008FE3FA /* PBXTargetDependency */,
- 494435690DC35D6F00C7A333 /* PBXTargetDependency */,
+ 32E29A9910249A1200D2C2E5 /* PBXTargetDependency */,
+ 32E29A9B10249A1600D2C2E5 /* PBXTargetDependency */,
);
name = OpenAFS;
productInstallPath = "$(HOME)/Library/PreferencePanes";
8D202CE80486D31800D8A456 /* OpenAFS */,
32CF01380C203C1800A8DC58 /* Test */,
49683EE30C3446380093C7C8 /* afshlp */,
- 494BD4680C43ED0C00DB0A3A /* AFSMenuExtra */,
4998A6850DC33BEC00146652 /* LoginTimeDaemon */,
3276591A10204E08004CA418 /* AFSBackgrounder */,
);
3276592E10204F8D004CA418 /* AFSBackounderMainMenu.xib in Resources */,
3228B9BE102052BE00DF98DA /* version.plist in Resources */,
3228B9D5102070A200DF98DA /* Info.plist in Resources */,
- 3228BA1910207A4200DF98DA /* hasToken.png in Resources */,
- 3228BA1B10207A5200DF98DA /* noToken.png in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 494BD4650C43ED0C00DB0A3A /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 325313B10C4516A900FAF2F3 /* Info.plist in Resources */,
- 49E43BA60C47D53F00084436 /* Localizable.strings in Resources */,
- 49E43C730C47E0EA00084436 /* start_afs.sh in Resources */,
- 49E43C740C47E0EC00084436 /* stop_afs.sh in Resources */,
- 32D45E070C4B4D9C00A1012D /* afshlp in Resources */,
- 492AFB280C51483600AEDC93 /* CredentialWindow.nib in Resources */,
- 49575BB50C53CBDB00B3BC32 /* hasToken.png in Resources */,
- 49575BB60C53CBDB00B3BC32 /* noToken.png in Resources */,
+ 3231522810243E21005901AA /* CredentialWindow.nib in Resources */,
+ 3231522B10243E2C005901AA /* hasToken.png in Resources */,
+ 3231522C10243E2C005901AA /* noToken.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
322B90460C2F0A2D0068F99A /* stop_afs.sh in Resources */,
3223836C0C32A96F00380547 /* Localizable.strings in Resources */,
325311D00C44F4B100FAF2F3 /* licenza.rtf in Resources */,
- 494C75110C4605C000D3A2D2 /* AFSMenuExtra.menu in Resources */,
49E43D2E0C480B8200084436 /* afshlp in Resources */,
324D67FD0DA13194007E1561 /* OpenAFSPreference.xib in Resources */,
324D683D0DA133A3007E1561 /* IpPanel.xib in Resources */,
324D684A0DA133CF007E1561 /* CredentialPanel.xib in Resources */,
- 494435170DC35D4C00C7A333 /* LoginTimeDaemon in Resources */,
32DE81BD0DF57BDA0069A05C /* SymLinkEdit.xib in Resources */,
+ 32E299A3102491AA00D2C2E5 /* AFSBackgrounder.app in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
};
/* End PBXRezBuildPhase section */
-/* Begin PBXShellScriptBuildPhase section */
- 3281A5B00CD7432A00907CF6 /* ShellScript */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- comments = "Copy the menucraker.menu into resources";
- files = (
- );
- inputPaths = (
- );
- outputPaths = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "\nif [ \"$ACTION\" = \"build\" ]\nthen\n\techo \"Start coping MenuCraker.menu\"\n\techo $SRCROOT/MenuCracker.menu\n\techo $TARGET_BUILD_DIR/$PRODUCT_NAME.prefPane/Resources/\t\n\tcp -R $SRCROOT/MenuCracker.menu $TARGET_BUILD_DIR/$PRODUCT_NAME.prefPane/Contents/Resources/MenuCracker.menu\nfi\n\n";
- };
-/* End PBXShellScriptBuildPhase section */
-
/* Begin PBXSourcesBuildPhase section */
3276591810204E08004CA418 /* Sources */ = {
isa = PBXSourcesBuildPhase;
3276592A10204EE5004CA418 /* DialogUtility.m in Sources */,
3276593110204F9E004CA418 /* AFSBackgrounderDelegate.m in Sources */,
3228B9B01020526900DF98DA /* main.m in Sources */,
+ 3231522010243E09005901AA /* AFSMenuCredentialContoller.m in Sources */,
+ 3231522210243E09005901AA /* AFSMenuExtraView.m in Sources */,
+ 3231522610243E10005901AA /* CredentialWindowController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
);
runOnlyForDeploymentPostprocessing = 0;
};
- 494BD4660C43ED0C00DB0A3A /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 494BD48C0C43EEC300DB0A3A /* AFSMenuExtra.m in Sources */,
- 325311AB0C44F38200FAF2F3 /* AFSPropertyManager.m in Sources */,
- 325311AF0C44F38D00FAF2F3 /* CellIp.m in Sources */,
- 325311B00C44F38D00FAF2F3 /* DBCellElement.m in Sources */,
- 325311B10C44F39200FAF2F3 /* TaskUtil.m in Sources */,
- 325311B20C44F39300FAF2F3 /* AuthUtil.m in Sources */,
- 325311B30C44F39400FAF2F3 /* FileUtil.m in Sources */,
- 325312190C44F7BD00FAF2F3 /* AFSMenuExtraView.m in Sources */,
- 4941F4C00C491D2D00B29A73 /* TokenCredentialController.m in Sources */,
- 4941F5100C4929C000B29A73 /* AFSMenuCredentialContoller.m in Sources */,
- 4941F6320C49379000B29A73 /* CredentialWindowController.m in Sources */,
- 32B565760D8FAF62005255F2 /* NSString+search.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
49683EE10C3446380093C7C8 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
- 3279B9810C451A63008FE3FA /* PBXTargetDependency */ = {
+ 32E29A9910249A1200D2C2E5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
- target = 494BD4680C43ED0C00DB0A3A /* AFSMenuExtra */;
- targetProxy = 3279B9800C451A63008FE3FA /* PBXContainerItemProxy */;
- };
- 494435690DC35D6F00C7A333 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 4998A6850DC33BEC00146652 /* LoginTimeDaemon */;
- targetProxy = 494435680DC35D6F00C7A333 /* PBXContainerItemProxy */;
+ target = 49683EE30C3446380093C7C8 /* afshlp */;
+ targetProxy = 32E29A9810249A1200D2C2E5 /* PBXContainerItemProxy */;
};
- 49575C280C53CD9A00B3BC32 /* PBXTargetDependency */ = {
+ 32E29A9B10249A1600D2C2E5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
- target = 49683EE30C3446380093C7C8 /* afshlp */;
- targetProxy = 49575C270C53CD9A00B3BC32 /* PBXContainerItemProxy */;
+ target = 3276591A10204E08004CA418 /* AFSBackgrounder */;
+ targetProxy = 32E29A9A10249A1600D2C2E5 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ INSTALL_PATH = /Library/PreferencePanes;
PREBINDING = NO;
+ SKIP_INSTALL = NO;
};
name = Debug;
};
};
name = Release;
};
- 494BD46D0C43ED0D00DB0A3A /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- COPY_PHASE_STRIP = NO;
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
- );
- FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"";
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = YES;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- GCC_MODEL_TUNING = G5;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
- INFOPLIST_FILE = "AFSMenuExtra-Info.plist";
- INSTALL_PATH = "$(HOME)/Library/Bundles";
- OTHER_LDFLAGS = (
- "-framework",
- Foundation,
- "-framework",
- AppKit,
- );
- PREBINDING = NO;
- PRODUCT_NAME = AFSMenuExtra;
- WRAPPER_EXTENSION = menu;
- ZERO_LINK = YES;
- };
- name = Debug;
- };
- 494BD46E0C43ED0D00DB0A3A /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- COPY_PHASE_STRIP = YES;
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
- );
- FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"";
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
- GCC_MODEL_TUNING = G5;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
- INFOPLIST_FILE = "AFSMenuExtra-Info.plist";
- INSTALL_PATH = "$(HOME)/Library/Bundles";
- OTHER_LDFLAGS = (
- "-framework",
- Foundation,
- "-framework",
- AppKit,
- );
- PREBINDING = NO;
- PRODUCT_NAME = AFSMenuExtra;
- WRAPPER_EXTENSION = menu;
- ZERO_LINK = NO;
- };
- name = Release;
- };
49683EE80C34465D0093C7C8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- 494BD46C0C43ED0D00DB0A3A /* Build configuration list for PBXNativeTarget "AFSMenuExtra" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 494BD46D0C43ED0D00DB0A3A /* Debug */,
- 494BD46E0C43ED0D00DB0A3A /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
49683EE70C34465D0093C7C8 /* Build configuration list for PBXNativeTarget "afshlp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
#define AUTH_FILE_BK @"/etc/authorization_bk"
#define TMP_FILE @"/tmp/authorization"
-#define HOME_LAUNCHD_AGENT_FOLDER @"~/Library/LaunchAgents"
-#define AKLOG_LAUNCHD_CONTROL_FILE @"~/Library/LaunchAgents/it.infn.lnf.afslogintimedaemon.plist"
-#define AKLOG_LAUNCHD_TMP_CONTROL_FILE @"/tmp/it.infn.lnf.afslogintimedaemon.plist"
-#define LOGIN_TIME_DAEMON_NAME @"LoginTimeDaemon"
+#define HOME_LAUNCHD_AGENT_FOLDER @"~/Library/LaunchAgents"
+#define BACKGROUNDER_LAUNCHD_CONTROL_FILE @"~/Library/LaunchAgents/it.infn.lnf.network.AFSBackgrounder.plist"
+#define BACKGROUNDER_LAUNCHD_TMP_CONTROL_FILE @"/tmp/it.infn.lnf.network.AFSBackgrounder.plist"
+#define BACKGROUNDER_AGENT_NAME @"AFSBackgrounder.app/Contents/MacOS/AFSBackgrounder"
#define LAUNCHD_DAEMON_FOLDER @"/Library/LaunchDaemons"
-#define AFS_STARTUP_TMP_CONTROL_FILE @"/tmp/it.infn.lnf.afsstartup.plist"
-#define AFS_STARTUP_CONTROL_FILE @"/Library/LaunchDaemons/it.infn.lnf.afsstartup.plist"
+#define AFS_STARTUP_TMP_CONTROL_FILE @"/tmp/it.infn.lnf.network.afsstartup.plist"
+#define AFS_STARTUP_CONTROL_FILE @"/Library/LaunchDaemons/it.infn.lnf.network.afsstartup.plist"
/*!
@class PListManager
@abstract Install the afs agent launchd config file
@discussion <#(comprehensive description)#>
*/
-+(void) installLaunchdFile:(BOOL)install resourcePath:(NSString*) rsrcPath;
++(void) installBackgrounderLaunchdFile:(BOOL)install resourcePath:(NSString*) rsrcPath;
/*!
@method checkAklogAtLoginTimeLaunchdEnable
@abstract check if the user has installed or enabled the afs agent
@discussion <#(comprehensive description)#>
*/
-+(BOOL) checkAklogAtLoginTimeLaunchdEnable;
++(BOOL) checkLoginTimeLaunchdBackgrounder;
/*!
@method installAfsStartupLaunchdFile
// -------------------------------------------------------------------------------
// installLaunchdFile:
// -------------------------------------------------------------------------------
-+(void) installLaunchdFile:(BOOL)install resourcePath:(NSString*) rsrcPath {
++(void) installBackgrounderLaunchdFile:(BOOL)install resourcePath:(NSString*) rsrcPath {
NSData *plistData = nil;
NSMutableDictionary *launchdDic = nil;
NSString *error = nil;
- NSString *daemonPath = [[rsrcPath stringByAppendingString:@"/"] stringByAppendingString:LOGIN_TIME_DAEMON_NAME];
+ NSString *backgrounderPath = [[rsrcPath stringByAppendingString:@"/"] stringByAppendingString:BACKGROUNDER_AGENT_NAME];
if(![[NSFileManager defaultManager] fileExistsAtPath:[HOME_LAUNCHD_AGENT_FOLDER stringByExpandingTildeInPath]]) {
@throw [NSException exceptionWithName:@"PListManager:installLaunchdFile"
reason:@"The folder ~/Library/LaunchAgent doesn't exist!"
- userInfo:[NSNumber numberWithInt:1]];
+ userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
+ forKey:@"agent_folder_error"]];
}
if(install) {
- if(![[NSFileManager defaultManager] fileExistsAtPath:[AKLOG_LAUNCHD_CONTROL_FILE stringByExpandingTildeInPath]]) {
+ if(![[NSFileManager defaultManager] fileExistsAtPath:[BACKGROUNDER_LAUNCHD_CONTROL_FILE stringByExpandingTildeInPath]]) {
launchdDic = [[NSMutableDictionary alloc] init];
- [launchdDic setObject:@"it.infn.lnf.afslogintimedaemon"
+ [launchdDic setObject:@"it.infn.lnf.network.AFSBackgrounder"
forKey:@"Label"];
[launchdDic setObject:@"Aqua"
forKey:@"LimitLoadToSessionType"];
- [launchdDic setObject:[NSArray arrayWithObject:daemonPath]
+ [launchdDic setObject:[NSArray arrayWithObject:backgrounderPath]
forKey:@"ProgramArguments"];
[launchdDic setObject:[NSNumber numberWithBool:YES]
}
- if(![plistData writeToFile:AKLOG_LAUNCHD_TMP_CONTROL_FILE atomically:NO]) {
+ if(![plistData writeToFile:BACKGROUNDER_LAUNCHD_TMP_CONTROL_FILE atomically:NO]) {
@throw [NSException exceptionWithName:@"PListManager:installLaunchdFile"
reason:@"Temp file write error"
userInfo:nil];
}
//now we can move the file
- [TaskUtil executeTaskSearchingPath:@"mv" args:[NSArray arrayWithObjects:AKLOG_LAUNCHD_TMP_CONTROL_FILE, [HOME_LAUNCHD_AGENT_FOLDER stringByExpandingTildeInPath], nil]];
+ [TaskUtil executeTaskSearchingPath:@"mv" args:[NSArray arrayWithObjects:BACKGROUNDER_LAUNCHD_TMP_CONTROL_FILE, [BACKGROUNDER_LAUNCHD_CONTROL_FILE stringByExpandingTildeInPath], nil]];
}
} else {
// delete launchd configuration file
- [TaskUtil executeTaskSearchingPath:@"rm" args:[NSArray arrayWithObjects:[AKLOG_LAUNCHD_CONTROL_FILE stringByExpandingTildeInPath], nil]];
+ [TaskUtil executeTaskSearchingPath:@"rm" args:[NSArray arrayWithObjects:[BACKGROUNDER_LAUNCHD_CONTROL_FILE stringByExpandingTildeInPath], nil]];
}
}
// -------------------------------------------------------------------------------
// checkAklogAtLoginTimeLaunchdEnable:
// -------------------------------------------------------------------------------
-+(BOOL) checkAklogAtLoginTimeLaunchdEnable {
- BOOL result = [[NSFileManager defaultManager] fileExistsAtPath:[AKLOG_LAUNCHD_CONTROL_FILE stringByExpandingTildeInPath]];
++(BOOL) checkLoginTimeLaunchdBackgrounder {
+ BOOL result = [[NSFileManager defaultManager] fileExistsAtPath:[BACKGROUNDER_LAUNCHD_CONTROL_FILE stringByExpandingTildeInPath]];
return result;
}
afsdPath:(NSString*)afsdPath {
NSData *plistData = nil;
NSMutableDictionary *launchdDic = nil;
- NSMutableArray *argDic = nil;
NSString *error = nil;
OSErr status = noErr;
void readPreferenceFile()
{
// read the preference for afs path
- afsSysPath = (NSString*)CFPreferencesCopyAppValue((CFStringRef)PREFERENCE_AFS_SYS_PAT, (CFStringRef)afsCommanderID);
+ afsSysPath = (NSString*)CFPreferencesCopyAppValue((CFStringRef)PREFERENCE_AFS_SYS_PAT, (CFStringRef)kAfsCommanderID);
// read the preference for aklog use
- NSNumber *useAklogPrefValue = (NSNumber*)CFPreferencesCopyAppValue((CFStringRef)PREFERENCE_USE_AKLOG, (CFStringRef)afsCommanderID);
+ NSNumber *useAklogPrefValue = (NSNumber*)CFPreferencesCopyAppValue((CFStringRef)PREFERENCE_USE_AKLOG, (CFStringRef)kAfsCommanderID);
useAklog = [useAklogPrefValue boolValue];
}
// PREFERENCE KEY
-#define PREFERENCE_AFS_SYS_PAT @"PREFERENCE_AFS_SYS_PAT"
-#define PREFERENCE_AFS_SYS_PAT_STATIC @"/var/db/openafs"
-#define PREFERENCE_USE_AKLOG @"PREFERENCE_USE_AKLOG"
-#define PREFERENCE_START_AFS_AT_STARTUP @"PREFERENCE_START_AFS_AT_STARTUP"
+#define PREFERENCE_AFS_SYS_PAT @"PREFERENCE_AFS_SYS_PAT"
+#define PREFERENCE_AFS_SYS_PAT_STATIC @"/var/db/openafs"
+#define PREFERENCE_USE_AKLOG @"PREFERENCE_USE_AKLOG"
+#define PREFERENCE_START_AFS_AT_STARTUP @"PREFERENCE_START_AFS_AT_STARTUP"
+#define PREFERENCE_SHOW_STATUS_MENU @"PREFERENCE_SHOW_STATUS_MENU"
+#define PREFERENCE_AKLOG_TOKEN_AT_LOGIN @"PREFERENCE_AKLOG_TOKEN_AT_LOGIN"
// AFSMENUEXTRA INFO
-#define kAFSMenuExtra [NSURL fileURLWithPath:[[self bundle] pathForResource:@"AFSMenuExtra" ofType:@"menu" inDirectory:@""]]
+#define kAFSMenuExtra [NSURL fileURLWithPath:[[self bundle] pathForResource:@"AFSBackgrounder" ofType:@"app" inDirectory:@""]]
#define kMenuCrakerMenuExtra [NSURL fileURLWithPath:[[self bundle] pathForResource:@"MenuCracker" ofType:@"menu" inDirectory:@""]]
-#define kAFSMenuExtraID @"it.infn.lnf.network.AFSMenuExtra"
+
+//notification id
+
#define kMenuCrakerMenuExtraID @"net.sourceforge.menucracker2"
//Application id
-#define afsCommanderID @"it.infn.lnf.network.openafs"
+#define kAFSMenuExtraID @"it.infn.lnf.network.AFSBackgrounder"
+#define kAfsCommanderID @"it.infn.lnf.network.openafs"
// Changed preference notification key
#define kPrefChangeNotification @"preference_changed"
//KLog menuextra window close
#define kMExtraClosedNotification @"preference_changed"
// Update MenuExtra AfsState notification key
#define kMExtraAFSStateChange @"menu_extra_afs_state_change"
-
+// Update MenuExtra for show menu notification key
+#define kMExtraAFSMenuChangeState @"kMExtraAFSMenuChangeState"