For aklog has been added the workaround for kerberos function KLAcquireInitialTickets that in 10.6 return always error.
First is called KLCacheHasValidTickets for check user ticket presence, if there are no ticket KLAcquireNewInitialTickets will be called for get user credential.
Has been removed also many deprecated api.
Reviewed-on: http://gerrit.openafs.org/341
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
//Dispose afs manager
[afsPropMngr release];
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfsCommanderID
+ object:kMenuExtraEventOccured];
}
// -------------------------------------------------------------------------------
{
[afsMngr unlog:nil];
[self updateAfsStatus:nil];
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfsCommanderID
+ object:kMenuExtraEventOccured];
}
}
-(IBAction) getReleaseTokenEvent:(id)sender {
- [self getToken:sender];
+ if(gotToken)
+ [self releaseToken:sender];
+ else
+ [self getToken:sender];
}
@end
}
- initWithFrame:(NSRect)myRect backgrounder:(AFSBackgrounderDelegate*)backgrounder menu:(NSMenu*)menu;
- (NSAttributedString*) makeKerberosIndicator:(int*)fontHeight;
+- (void)mouseDown:(NSEvent *)event;
+- (void)menuWillOpen:(NSMenu *)menu;
+- (void)menuDidClose:(NSMenu *)menu;
+- (void)menuNeedsUpdate:(NSMenu *)menu;
@end
@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];
+ NSFont *font = [NSFont systemFontOfSize:9.0];
NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:font
forKey:NSFontAttributeName];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"K"
switch (returnCode) {
case 1:
if([[NSFileManager defaultManager] createDirectoryAtPath:[HOME_LAUNCHD_AGENT_FOLDER stringByExpandingTildeInPath]
- attributes:nil]) {
+ withIntermediateDirectories:NO
+ attributes:nil
+ error:nil]) {
//Create the file
[PListManager installBackgrounderLaunchdFile:YES
do {
DBCellElement *cellElement = (DBCellElement*)[filteredCellDB objectAtIndex:index];
[[afsProperty getCellList] removeObject:cellElement];
- } while ((index = [selectedIndex indexGreaterThanIndex: index]) != NSNotFound);
+ } while ((index = [selectedIndex indexGreaterThanIndex:index]) != NSNotFound);
}
}
break;
- (void) refreshGui:(NSNotification *)notification{
BOOL afsIsUp = [afsProperty checkAfsStatus];
[self setAfsStatus];
- //[self refreshTokens:nil];
+ [self refreshTokens:nil];
[tokensButton setEnabled:afsIsUp];
[unlogButton setEnabled:afsIsUp];
}
NSString *afsdOptionStrData = [[NSString alloc] initWithData:fileHData
encoding:NSASCIIStringEncoding];*/
if(!filePath) return;
- [self readAFSDParamLineContent:[[NSString stringWithContentsOfFile:filePath] stringByStandardizingPath]];
+ [self readAFSDParamLineContent:[[NSString stringWithContentsOfFile:filePath
+ encoding:NSUTF8StringEncoding
+ error:nil] stringByStandardizingPath]];
}
// -------------------------------------------------------------------------------
NSScanner *lineScanner = nil;
//Get file content
- NSString *newAFSDConfContent = [NSString stringWithContentsOfFile:filePath];
+ NSString *newAFSDConfContent = [NSString stringWithContentsOfFile:filePath
+ encoding:NSUTF8StringEncoding
+ error:nil];
//get lines in array
NSArray *confLines = [newAFSDConfContent componentsSeparatedByString:@"\n"];
// +(void) aklog
// -------------------------------------------------------------------------------
-(void) aklog:(NSString*)theCell noKerberosCall:(BOOL)krb5CallEnable {
- KLPrincipal princ = nil;
- KLStatus kstatus = noErr;
- char *princName = malloc(255);
+ KLPrincipal princ = nil;
+ KLStatus kstatus = noErr;
+ char *princName = 0L;
+ KLBoolean outFoundValidTickets = false;
@try {
// trying to ket kerberos ticket
if(krb5CallEnable) {
- kstatus = KLAcquireInitialTickets (0L, 0L, &princ, &princName);
- if(kstatus != noErr && kstatus != klUserCanceledErr) @throw [NSException exceptionWithName:@"aklog"
- reason:kPathNotEmpty
- userInfo:nil];
+ kstatus = KLCacheHasValidTickets(nil, nil, &outFoundValidTickets, nil, nil);
+ //kstatus = KLAcquireInitialTickets (0L, 0L, &princ, &princName);
+ if(!outFoundValidTickets) {
+ kstatus = KLAcquireNewInitialTickets(nil, nil, &princ, &princName);
+ if(kstatus != noErr && kstatus != klUserCanceledErr) @throw [NSException exceptionWithName:@"aklog"
+ reason:@"KLAcquireInitialTickets"
+ userInfo:nil];
+ }
} else kstatus = klNoErr;
- //ok to launch aklog
+
+ //ok to launch aklog
if(kstatus == klNoErr) [TaskUtil executeTaskSearchingPath:@"aklog"
args:(theCell==nil?[NSArray arrayWithObjects:nil]:[NSArray arrayWithObjects:@"-c", theCell, nil])];
}
@finally {
// destory the kerberos va
- if(princName && princ != nil)
- KLDisposeString(princName);
- else if(princName) free(princName);
+ if (kstatus == klNoErr) {
+ KLDisposeString (princName);
+ KLDisposePrincipal (princ);
+ }
}
}
if (bytesRead < 1) break;
//write (fileno (stdout), buff, bytesRead);
if(output) {
- [output appendString:[NSString stringWithCString:buff length:bytesRead]];
+ [output appendString:[NSString stringWithCString:buff encoding:NSUTF8StringEncoding]];
}
}
}
1DBD214D08BA80EA00186707 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = (
- ppc,
- i386,
- );
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+ ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = /Library/PreferencePanes;
+ ONLY_ACTIVE_ARCH = NO;
PREBINDING = NO;
SKIP_INSTALL = NO;
+ VALID_ARCHS = "i386 ppc x86_64";
};
name = Debug;
};
break;
case 5:
+ case 6:
if(enable){
//remove
toRemove = DELETE_IN_10_5;
+(BOOL) checkKrb5AtLoginTimeLaunchdEnable {
BOOL result = false;
NSString *authFileContent = nil;
- authFileContent = [NSString stringWithContentsOfFile:AUTH_FILE];
+ authFileContent = [NSString stringWithContentsOfFile:AUTH_FILE
+ encoding:NSUTF8StringEncoding
+ error:nil];
if(authFileContent) {
result = [authFileContent rangeOfString:ADD_IN_PLIST].location != NSNotFound;
}
NSLog(@"Start afs from helper");
setuid(0);
const char *startArgs[] = {argv[2], argv[3], 0L};
+ NSLog(@"%s, %s, %s", argv[1], argv[2], argv[3]);
[[AuthUtil shared] execUnixCommand:argv[1]
args:startArgs
output:nil];
setuid(0);
NSLog(@"Manage start_afs_at_startup with option %s from helper", argv[2]);
[PListManager manageAfsStartupLaunchdFile:YES
- afsStartupScript:[NSString stringWithCString:argv[2]]
- afsBasePath:[NSString stringWithCString:argv[4]]
- afsdPath:[NSString stringWithCString:argv[3]]];
+ afsStartupScript:[NSString stringWithCString:argv[2] encoding:NSUTF8StringEncoding]
+ afsBasePath:[NSString stringWithCString:argv[4] encoding:NSUTF8StringEncoding]
+ afsdPath:[NSString stringWithCString:argv[3] encoding:NSUTF8StringEncoding]];
}
}