Changeset 3946
- Timestamp:
- 03/23/06 20:47:13 (2 years ago)
- Files:
-
- WiredServer/trunk/PreferencePane/English.lproj/InfoPlist.strings (modified) (1 diff)
- WiredServer/trunk/PreferencePane/English.lproj/Wired.nib/classes.nib (modified) (6 diffs)
- WiredServer/trunk/PreferencePane/English.lproj/Wired.nib/info.nib (modified) (1 diff)
- WiredServer/trunk/PreferencePane/English.lproj/Wired.nib/keyedobjects.nib (modified) (previous)
- WiredServer/trunk/PreferencePane/Locked.tiff (deleted)
- WiredServer/trunk/PreferencePane/Unlocked.tiff (deleted)
- WiredServer/trunk/PreferencePane/WPWired.h (modified) (1 diff)
- WiredServer/trunk/PreferencePane/WPWired.m (modified) (6 diffs)
- WiredServer/trunk/WCAccounts.m (modified) (2 diffs)
- WiredServer/trunk/WCAccountsController.h (modified) (3 diffs)
- WiredServer/trunk/WCAccountsController.m (modified) (8 diffs)
- WiredServer/trunk/WCAuthorization.h (deleted)
- WiredServer/trunk/WCAuthorization.m (deleted)
- WiredServer/trunk/WCConfigController.h (modified) (2 diffs)
- WiredServer/trunk/WCConfigController.m (modified) (15 diffs)
- WiredServer/trunk/WCDashboardController.h (modified) (2 diffs)
- WiredServer/trunk/WCDashboardController.m (modified) (12 diffs)
- WiredServer/trunk/WiredServer.xcodeproj/project.pbxproj (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredServer/trunk/PreferencePane/English.lproj/InfoPlist.strings
r923 r3946 2 2 3 3 CFBundleName = "Wired"; 4 CFBundleShortVersionString = " 1.3";5 CFBundleGetInfoString = " 1.3, Copyright (c) 2003-2004, Zanka Software.";6 NSHumanReadableCopyright = "Copyright (c) 2003-200 4, Zanka Software.";4 CFBundleShortVersionString = "Wired Server 1.3"; 5 CFBundleGetInfoString = "Wired Server 1.3, Copyright (c) 2003-2006, Zanka Software."; 6 NSHumanReadableCopyright = "Copyright (c) 2003-2006, Zanka Software."; WiredServer/trunk/PreferencePane/English.lproj/Wired.nib/classes.nib
r3675 r3946 2 2 IBClasses = ( 3 3 {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 {CLASS = NSObject; LANGUAGE = ObjC; }, 4 5 { 5 6 CLASS = NSPreferencePane; … … 13 14 SUPERCLASS = NSObject; 14 15 }, 16 {CLASS = SFAuthorizationView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, 15 17 { 16 18 ACTIONS = {add = id; delete = id; selectGroup = id; selectType = id; touch = id; }; … … 23 25 "_cannotBeKickedButton" = NSButton; 24 26 "_clearNewsButton" = NSButton; 25 "_configController" = WCConfigController;26 27 "_createAccountsButton" = NSButton; 27 28 "_createFoldersButton" = NSButton; … … 80 81 "_controlPortTextField" = NSTextField; 81 82 "_createCertificateButton" = NSButton; 82 "_dashboardController" = WCDashboardController;83 83 "_deleteTrackerButton" = NSButton; 84 84 "_descriptionTextField" = NSTextField; … … 127 127 LANGUAGE = ObjC; 128 128 OUTLETS = { 129 "_authorizationView" = SFAuthorizationView; 129 130 "_indexButton" = NSButton; 130 131 "_registerButton" = NSButton; … … 167 168 {CLASS = WIGraphView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, 168 169 { 169 ACTIONS = { authorize = id;help = id; };170 ACTIONS = {help = id; }; 170 171 CLASS = WPWired; 171 172 LANGUAGE = ObjC; 172 173 OUTLETS = { 173 174 "_accountsController" = WCAccountsController; 174 "_authorizationStatusButton" = NSButton;175 "_authorizationStatusTextField" = NSTextField;176 175 "_configController" = WCConfigController; 177 176 "_dashboardController" = WCDashboardController; WiredServer/trunk/PreferencePane/English.lproj/Wired.nib/info.nib
r3729 r3946 4 4 <dict> 5 5 <key>IBDocumentLocation</key> 6 <string> 475 146 446 363 0 0 1280 1002</string>6 <string>887 151 446 363 0 0 1920 1178 </string> 7 7 <key>IBFramework Version</key> 8 8 <string>443.0</string> WiredServer/trunk/PreferencePane/WPWired.h
r3011 r3946 38 38 39 39 IBOutlet NSTabView *_tabView; 40 41 IBOutlet NSButton *_authorizationStatusButton;42 IBOutlet NSTextField *_authorizationStatusTextField;43 44 NSImage *_lockedImage, *_unlockedImage;45 40 } 46 41 47 42 48 - (IBAction)authorize:(id)sender;49 43 - (IBAction)help:(id)sender; 50 44 WiredServer/trunk/PreferencePane/WPWired.m
r3857 r3946 38 38 @interface WPWired(Private) 39 39 40 - (void)update; 41 - (void)save; 40 - (void)_save; 41 42 @end 43 44 45 @implementation WPWired(Private) 46 47 - (void)_save { 48 if([_configController saveFromController]) 49 [_accountsController saveFromController]; 50 } 42 51 43 52 @end … … 66 75 67 76 - (void)mainViewDidLoad { 68 _lockedImage = [[NSImage alloc] initWithContentsOfFile:69 [[self bundle] pathForResource:@"Locked" ofType:@"tiff"]];70 _unlockedImage = [[NSImage alloc] initWithContentsOfFile:71 [[self bundle] pathForResource:@"Unlocked" ofType:@"tiff"]];72 73 [_accountsController setRequiresAuthorization:YES];74 [_configController setRequiresAuthorization:YES];75 [_dashboardController setRequiresAuthorization:YES];76 77 77 [_statusController awakeFromController]; 78 78 [_logController awakeFromController]; … … 80 80 [_configController awakeFromController]; 81 81 [_accountsController awakeFromController]; 82 83 [self update];84 82 } 85 83 … … 92 90 93 91 - (void)didUnselect { 94 [self save];92 [self _save]; 95 93 } 96 94 … … 100 98 101 99 - (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem { 102 [self save];100 [self _save]; 103 101 } 104 102 … … 106 104 107 105 #pragma mark - 108 109 - (void)update {110 if([[WCAuthorization authorization] isAuthorized]) {111 [_authorizationStatusButton setImage:_unlockedImage];112 [_authorizationStatusTextField setStringValue:113 WPLS(@"Click the lock to prevent further changes.", @"Authorization status")];114 } else {115 [_authorizationStatusButton setImage:_lockedImage];116 [_authorizationStatusTextField setStringValue:117 WPLS(@"Click the lock to make changes.", @"Authorization status")];118 }119 }120 121 122 123 - (void)save {124 BOOL status = YES;125 126 if(status)127 status = [_configController saveFromController];128 129 if(status)130 status = [_accountsController saveFromController];131 }132 133 134 135 #pragma mark -136 137 - (IBAction)authorize:(id)sender {138 BOOL status = YES;139 140 if([[WCAuthorization authorization] isAuthorized]) {141 [[WCAuthorization authorization] deauthorize];142 } else {143 [_authorizationStatusTextField setStringValue:WPLS(@"Authenticating...", @"Authorization status")];144 [_authorizationStatusTextField display];145 146 status = [[WCAuthorization authorization] authorizeForTasks:147 [NSArray arrayWithObjects:148 WCExpandWiredPath(@"wiredctl"),149 @"/usr/bin/touch",150 @"/bin/mv",151 @"/bin/rm",152 @"/usr/bin/openssl",153 @"/usr/sbin/chown",154 NULL]];155 }156 157 [self update];158 }159 160 161 106 162 107 - (IBAction)help:(id)sender { WiredServer/trunk/WCAccounts.m
r2975 r3946 483 483 484 484 - (id)initWithContentsOfFile:(NSString *)file type:(WCAccountType)type { 485 return [self initWith String:[NSString stringWithContentsOfFile:file] type:type];485 return [self initWithData:[NSData dataWithContentsOfFile:file] type:type]; 486 486 } 487 487 … … 489 489 490 490 - (id)initWithContentsOfURL:(NSURL *)url type:(WCAccountType)type { 491 return [self initWith String:[NSString stringWithContentsOfURL:url] type:type];491 return [self initWithData:[NSData dataWithContentsOfURL:url] type:type]; 492 492 } 493 493 WiredServer/trunk/WCAccountsController.h
r3900 r3946 27 27 */ 28 28 29 @class WC ConfigController, WCAccounts;29 @class WCAccounts; 30 30 31 31 @interface WCAccountsController : NSObject { 32 IBOutlet WCConfigController *_configController;33 34 32 IBOutlet NSTableView *_tableView; 35 33 IBOutlet NSButton *_addButton; … … 73 71 NSImage *_userImage, *_groupImage; 74 72 75 BOOL _requiresAuthorization;76 BOOL _authorized;77 73 BOOL _touched; 78 74 } … … 87 83 - (BOOL)saveFromController; 88 84 89 - (void)setRequiresAuthorization:(BOOL)value;90 - (BOOL)requiresAuthorization;91 92 85 - (IBAction)touch:(id)sender; 93 86 - (IBAction)add:(id)sender; WiredServer/trunk/WCAccountsController.m
r3900 r3946 29 29 #import "WCAccounts.h" 30 30 #import "WCAccountsController.h" 31 #import "WCAuthorization.h"32 31 #import "WCConfig.h" 33 32 #import "WCConfigController.h" 33 #import "WCDashboardController.h" 34 34 #import "WCSettings.h" 35 35 … … 186 186 - (void)_validateAccount:(WCAccount *)account { 187 187 BOOL enabled; 188 BOOL authorized; 189 190 authorized = [self requiresAuthorization] ? _authorized : YES; 191 enabled = authorized && (account != NULL); 188 189 enabled = [[WCDashboardController dashboardController] isAuthorized] && (account != NULL); 192 190 [_addButton setEnabled:enabled]; 193 191 [_deleteButton setEnabled:enabled]; … … 195 193 [_nameTextField setEnabled:enabled]; 196 194 197 enabled = ( authorized&& [account type] == WCAccountUser);195 enabled = ([[WCDashboardController dashboardController] isAuthorized] && [account type] == WCAccountUser); 198 196 [_passwordTextField setEnabled:enabled]; 199 197 [_groupPopUpButton setEnabled:enabled]; 200 198 201 enabled = ( authorized&& [[account group] length] == 0);199 enabled = ([[WCDashboardController dashboardController] isAuthorized] && [[account group] length] == 0); 202 200 [_getUserInfoButton setEnabled:enabled]; 203 201 [_broadcastButton setEnabled:enabled]; … … 260 258 261 259 - (BOOL)_writeUsersToFile:(NSString *)path { 262 NSString *temp; 263 WCAuthorization *authorization; 264 WCConfig *config; 265 BOOL status; 260 NSString *temp; 261 WCDashboardController *controller; 262 WCConfig *config; 266 263 267 264 [self _unselectAccount:[self _selectedAccount]]; 268 265 269 authorization = [WCAuthorization authorization];270 temp = [NSFileManager temporaryPathWithPrefix:@"users" suffix:@"conf"];271 status = [_users writeToFile:temp];272 273 if( status)274 status = [authorization movePath:temp toPath:path];275 276 if(status) {277 config = [_configController config];278 status = [authorization changeOwnerOfPath:path279 toOwner:[config stringForKey:@"user"]280 group:[config stringForKey:@"group"]];281 }282 283 if(status)284 _touched = NO;285 286 return status;266 controller = [WCDashboardController dashboardController]; 267 config = [[WCConfigController configController] config]; 268 temp = [NSFileManager temporaryPathWithPrefix:@"users" suffix:@"conf"]; 269 270 if([_users writeToFile:temp]) { 271 if([controller movePath:temp toPath:path]) { 272 if([controller changeOwnerOfPath:path 273 toOwner:[config stringForKey:@"user"] 274 group:[config stringForKey:@"group"]]) { 275 _touched = NO; 276 277 return YES; 278 } 279 } 280 281 } 282 283 return NO; 287 284 } 288 285 … … 290 287 291 288 - (BOOL)_writeGroupsToFile:(NSString *)path { 292 NSString *temp; 293 WCAuthorization *authorization; 294 WCConfig *config; 295 BOOL status; 289 NSString *temp; 290 WCDashboardController *controller; 291 WCConfig *config; 296 292 297 293 [self _unselectAccount:[self _selectedAccount]]; 298 294 299 authorization = [WCAuthorization authorization];300 temp = [NSFileManager temporaryPathWithPrefix:@"groups" suffix:@"conf"];301 status = [_groups writeToFile:temp];302 303 if( status)304 status = [authorization movePath:temp toPath:path];305 306 if(status) {307 config = [_configController config];308 status = [authorization changeOwnerOfPath:path309 toOwner:[config stringForKey:@"user"]310 group:[config stringForKey:@"group"]];311 }312 313 if(status)314 _touched = NO;315 316 return status;295 controller = [WCDashboardController dashboardController]; 296 config = [[WCConfigController configController] config]; 297 temp = [NSFileManager temporaryPathWithPrefix:@"groups" suffix:@"conf"]; 298 299 if([_groups writeToFile:temp]) { 300 if([controller movePath:temp toPath:path]) { 301 if([controller changeOwnerOfPath:path 302 toOwner:[config stringForKey:@"user"] 303 group:[config stringForKey:@"group"]]) { 304 _touched = NO; 305 306 return YES; 307 } 308 } 309 310 } 311 312 return NO; 317 313 } 318 314 … … 373 369 374 370 - (BOOL)saveFromController { 375 BOOL status = YES;376 377 371 if(_touched) { 378 if(status) 379 status = [self _writeUsersToFile:WCExpandWiredPath(@"users")]; 380 381 if(status) 382 status = [self _writeGroupsToFile:WCExpandWiredPath(@"groups")]; 383 384 if(status) { 385 [[NSNotificationCenter defaultCenter] 386 postNotificationName:WCAccountsDidChange 387 object:NULL]; 372 if([self _writeUsersToFile:WCExpandWiredPath(@"users")]) { 373 if([self _writeGroupsToFile:WCExpandWiredPath(@"groups")]) { 374 [[NSNotificationCenter defaultCenter] postNotificationName:WCAccountsDidChange]; 375 376 return YES; 377 } 388 378 } 389 } 390 391 return status; 379 380 return NO; 381 } 382 383 return YES; 392 384 } 393 385 … … 412 404 413 405 - (void)authorizationStatusDidChange:(NSNotification *)notification { 414 _authorized = [[notification object] boolValue];415 416 406 [self _validateAccount:[self _selectedAccount]]; 417 407 } … … 429 419 [_tableView reloadData]; 430 420 } 431 }432 433 434 435 #pragma mark -436 437 - (void)setRequiresAuthorization:(BOOL)value {438 _requiresAuthorization = value;439 }440 441 442 443 - (BOOL)requiresAuthorization {444 return _requiresAuthorization;445 421 } 446 422 WiredServer/trunk/WCConfigController.h
r3199 r3946 27 27 */ 28 28 29 @class WC DashboardController, WCConfig;29 @class WCConfig; 30 30 31 31 @interface WCConfigController : NSObject { 32 IBOutlet WCDashboardController *_dashboardController;33 34 32 IBOutlet NSPanel *_certificatePanel; 35 33 IBOutlet NSProgressIndicator *_certificateProgressIndicator; … … 114 112 - (WCConfig *)config; 115 113 116 - (void)setRequiresAuthorization:(BOOL)value;117 - (BOOL)requiresAuthorization;118 119 114 - (IBAction)touch:(id)sender; 120 115 - (IBAction)setBanner:(id)sender; WiredServer/trunk/WCConfigController.m
r3859 r3946 31 31 #undef SYSLOG_NAMES 32 32 33 #import "WCAuthorization.h"34 33 #import "WCConfig.h" 35 34 #import "WCConfigController.h" … … 57 56 58 57 - (void)_update { 58 BOOL enabled; 59 59 int method; 60 BOOL enabled; 61 62 enabled = [self requiresAuthorization] ? _authorized : YES; 60 61 enabled = [[WCDashboardController dashboardController] isAuthorized]; 63 62 method = [[_logMethodMatrix selectedCell] tag]; 64 63 … … 253 252 254 253 - (BOOL)_writeToFile:(NSString *)path { 255 NSString *temp; 256 WCAuthorization *authorization; 257 BOOL status; 254 NSString *temp; 255 WCDashboardController *controller; 258 256 259 257 // --- config … … 330 328 [_config setString:[_groupPopUpButton titleOfSelectedItem] forKey:@"group"]; 331 329 332 authorization = [WCAuthorization authorization]; 333 temp = [NSFileManager temporaryPathWithPrefix:@"config" suffix:@"conf"]; 334 status = [_config writeToFile:temp]; 335 336 if(status) 337 status = [authorization movePath:temp toPath:path]; 338 339 if(status) { 340 status = [authorization changeOwnerOfPath:[WCSettings objectForKey:WCPrefixPath] 341 toOwner:[_config stringForKey:@"user"] 342 group:[_config stringForKey:@"group"]]; 343 } 344 345 if(status) 346 _touched = NO; 347 348 return status; 330 controller = [WCDashboardController dashboardController]; 331 temp = [NSFileManager temporaryPathWithPrefix:@"config" suffix:@"conf"]; 332 333 if([_config writeToFile:temp]) { 334 if([controller movePath:temp toPath:path]) { 335 if([controller changeOwnerOfPath:[WCSettings objectForKey:WCPrefixPath] 336 toOwner:[_config stringForKey:@"user"] 337 group:[_config stringForKey:@"group"]]) { 338 _touched = NO; 339 340 return YES; 341 } 342 } 343 } 344 345 return NO; 349 346 } 350 347 … … 352 349 353 350 - (BOOL)_writeFlagsToFile:(NSString *)path { 354 WCAuthorization *authorization; 355 NSString *string, *temp; 356 BOOL status; 357 358 authorization = [WCAuthorization authorization]; 359 string = [[_dashboardController launchArguments] componentsJoinedByString:@" "]; 360 temp = [NSFileManager temporaryPathWithPrefix:@"wired" suffix:@"flags"]; 361 status = [string writeToFile:temp atomically:YES]; 362 363 if(status) 364 status = [authorization movePath:temp toPath:path]; 365 366 if(status) { 367 status = [authorization changeOwnerOfPath:path 368 toOwner:[_config stringForKey:@"user"] 369 group:[_config stringForKey:@"group"]]; 370 } 371 372 return status; 351 NSString *string, *temp; 352 WCDashboardController *controller; 353 354 controller = [WCDashboardController dashboardController]; 355 string = [[controller launchArguments] componentsJoinedByString:@" "]; 356 temp = [NSFileManager temporaryPathWithPrefix:@"wired" suffix:@"flags"]; 357 358 if([string writeToFile:temp atomically:YES]) { 359 if([controller movePath:temp toPath:path]) { 360 if([controller changeOwnerOfPath:path 361 toOwner:[_config stringForKey:@"user"] 362 group:[_config stringForKey:@"group"]]) 363 return YES; 364 } 365 } 366 367 return NO; 373 368 } 374 369 … … 378 373 379 374 - (void)_setLaunchesAtBoot:(BOOL)value { 380 WCAuthorization *authorization;381 NSString *path;382 383 path = WCExpandWiredPath(@"etc/wired.startup");384 authorization = [WCAuthorization authorization];375 NSString *path; 376 WCDashboardController *controller; 377 378 path = WCExpandWiredPath(@"etc/wired.startup"); 379 controller = [WCDashboardController dashboardController]; 385 380 386 381 if(value) { 387 if([ authorizationcreateFileAtPath:path]) {388 [ authorizationchangeOwnerOfPath:path389 toOwner:[_config stringForKey:@"user"]390 group:[_config stringForKey:@"group"]];382 if([controller createFileAtPath:path]) { 383 [controller changeOwnerOfPath:path 384 toOwner:[_config stringForKey:@"user"] 385 group:[_config stringForKey:@"group"]]; 391 386 } 392 387 } else { 393 [ authorizationremoveFileAtPath:path];388 [controller removeFileAtPath:path]; 394 389 } 395 390 } … … 500 495 501 496 - (BOOL)saveFromController { 502 BOOL status = YES;503 504 497 if(_touched) { 505 status = [self _writeToFile:WCExpandWiredPath(@"etc/wired.conf")]; 506 507 if(status) { 508 [[NSNotificationCenter defaultCenter] 509 postNotificationName:WCConfigDidChange 510 object:NULL]; 498 if([self _writeToFile:WCExpandWiredPath(@"etc/wired.conf")]) { 499 [[NSNotificationCenter defaultCenter] postNotificationName:WCConfigDidChange]; 511 500 512 501 if(_logTouched) { 513 [[NSNotificationCenter defaultCenter] 514 postNotificationName:WCLogConfigDidChange 515 object:NULL]; 502 [[NSNotificationCenter defaultCenter] postNotificationName:WCLogConfigDidChange]; 516 503 517 504 _logTouched = YES; … … 520 507 [self _writeFlagsToFile:WCExpandWiredPath(@"etc/wired.flags")]; 521 508 [self _setLaunchesAtBoot:[_launchAtBootButton state]]; 509 510 return YES; 522 511 } 523 } 524 525 return status; 512 513 return NO; 514 } 515 516 return YES; 526 517 } 527 518 … … 621 612 #pragma mark - 622 613 623 - (void)setRequiresAuthorization:(BOOL)value {624 _requiresAuthorization = value;625 }626 627 628 629 - (BOOL)requiresAuthorization {630 return _requiresAuthorization;631 }632 633 634 635 #pragma mark -636 637 614 - (IBAction)touch:(id)sender { 638 615 [self _update]; … … 647 624 648 625 - (IBAction)setBanner:(id)sender { 649 NSImage *image, *banner; 650 NSBitmapImageRep *imageRep; 651 NSData *data; 652 NSString *path, *temp; 653 WCAuthorization *authorization; 654 NSSize size; 655 BOOL status; 626 NSImage *image, *banner; 627 NSBitmapImageRep *imageRep; 628 NSData *data; 629 NSString *path, *temp; 630 WCDashboardController *controller; 631 NSSize size; 656 632 657 633 image = [_bannerImageView image]; … … 682 658 } 683 659 684 imageRep = [NSBitmapImageRep imageRepWithData:[[_bannerImageView image] TIFFRepresentation]]; 685 data = [imageRep representationUsingType:NSPNGFileType properties:NULL]; 686 path = WCExpandWiredPath(@"banner.png"); 687 authorization = [WCAuthorization authorization]; 688 temp = [NSFileManager temporaryPathWithPrefix:@"banner" suffix:@"png"]; 689 status = [data writeToFile:temp atomically:YES]; 690 691 if(status) 692 status = [authorization movePath:temp toPath:path]; 693 694 if(status) { 695 status = [authorization changeOwnerOfPath:path 696 toOwner:[_config stringForKey:@"user"] 697 group:[_config stringForKey:@"group"]]; 698 } 699 700 if(status) { 701 [_config setString:path forKey:@"banner"]; 702 _touched = YES; 660 imageRep = [NSBitmapImageRep imageRepWithData:[[_bannerImageView image] TIFFRepresentation]]; 661 data = [imageRep representationUsingType:NSPNGFileType properties:NULL]; 662 path = WCExpandWiredPath(@"banner.png"); 663 controller = [WCDashboardController dashboardController]; 664 temp = [NSFileManager temporaryPathWithPrefix:@"banner" suffix:@"png"]; 665 666 if([data writeToFile:temp atomically:YES]) { 667 if([controller movePath:temp toPath:path]) { 668 if([controller changeOwnerOfPath:path 669 toOwner:[_config stringForKey:@"user"] 670 group:[_config stringForKey:@"group"]]) { 671 [_config setString:path forKey:@"banner"]; 672 _touched = YES; 673 } 674 } 703 675 } 704 676 } … … 752 724 753 725 - (IBAction)createCertificate:(id)sender { 754 NSArray *arguments; 755 NSString *path, *temp; 756 WCAuthorization *authorization; 757 BOOL status; 726 NSArray *arguments; 727 NSString *path, *temp; 728 WCDashboardController *controller; 758 729 759 730 [_certificateProgressIndicator startAnimation:self]; … … 765 736 contextInfo:NULL]; 766 737 767 authorization = [WCAuthorization authorization]; 768 path = WCExpandWiredPath(@"etc/certificate.pem"); 769 temp = [NSFileManager temporaryPathWithPrefix:@"certificate" suffix:@"pem"]; 770 arguments = [NSArray arrayWithObjects: 738 controller = [WCDashboardController dashboardController]; 739 path = WCExpandWiredPath(@"etc/certificate.pem"); 740 temp = [NSFileManager temporaryPathWithPrefix:@"certificate" suffix:@"pem"]; 741 742 arguments = [NSArray arrayWithObjects: 771 743 @"req", 772 744 @"-x509", … … 784 756 NULL]; 785 757 786 status = [authorization launchTaskWithPath:@"/usr/bin/openssl" arguments:arguments]; 787 788 if(status) 789 status = [authorization movePath:temp toPath:path]; 790 791 if(status) { 792 status = [authorization changeOwnerOfPath:path 793 toOwner:[_config stringForKey:@"user"] 794 group:[_config stringForKey:@"group"]]; 795 } 796 797 if(status) { 798 [_config setString:WCExpandWiredPath(@"etc/certificate.pem") forKey:@"certificate"]; 799 _touched = YES; 800 } 801 758 if([controller launchTaskWithPath:@"/usr/bin/openssl" arguments:arguments]) { 759 if([controller movePath:temp toPath:path]) { 760 if([controller changeOwnerOfPath:path 761 toOwner:[_config stringForKey:@"user"] 762 group:[_config stringForKey:@"group"]]) { 763 [_config setString:WCExpandWiredPath(@"etc/certificate.pem") forKey:@"certificate"]; 764 _touched = YES; 765 } 766 } 767 } 768 802 769 [self _updateCertificate]; 803 770 … … 939 906 BOOL enabled; 940 907 941 enabled = [ self requiresAuthorization] ? _authorized : YES;908 enabled = [[WCDashboardController dashboardController] isAuthorized]; 942 909 [cell setEnabled:enabled]; 943 910 [cell setEditable:enabled]; WiredServer/trunk/WCDashboardController.h
r3675 r3946 30 30 31 31 @interface WCDashboardController : NSObject { 32 IBOutlet WCStatusController *_statusController;32 IBOutlet WCStatusController *_statusController; 33 33 34 IBOutlet NSButton *_startButton;35 IBOutlet NSButton *_restartButton;36 IBOutlet NSButton *_reloadButton;37 IBOutlet NSButton *_registerButton;38 IBOutlet NSButton
