| 332 | | if([[[NSFileManager defaultManager] ownerAtPath:path] isEqualToString:NSUserName()]) { |
|---|
| 333 | | status = [_config writeToFile:path]; |
|---|
| 334 | | } else { |
|---|
| 335 | | authorization = [WCAuthorization authorization]; |
|---|
| 336 | | |
|---|
| 337 | | if(status) { |
|---|
| 338 | | temp = [NSFileManager temporaryPathWithPrefix:@"config" suffix:@"conf"]; |
|---|
| 339 | | status = [_config writeToFile:temp]; |
|---|
| 340 | | } |
|---|
| | 332 | authorization = [WCAuthorization authorization]; |
|---|
| | 333 | temp = [NSFileManager temporaryPathWithPrefix:@"config" suffix:@"conf"]; |
|---|
| | 334 | status = [_config writeToFile:temp]; |
|---|
| 342 | | if(status) |
|---|
| 343 | | status = [authorization movePath:temp toPath:path]; |
|---|
| 344 | | |
|---|
| 345 | | if(status) { |
|---|
| 346 | | status = [authorization changeOwnerOfPath:[WCSettings objectForKey:WCPrefixPath] |
|---|
| 347 | | toOwner:[_config stringForKey:@"user"] |
|---|
| 348 | | group:[_config stringForKey:@"group"]]; |
|---|
| 349 | | } |
|---|
| | 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"]]; |
|---|
| 362 | | NSString *string, *owner, *temp; |
|---|
| 363 | | BOOL status = YES; |
|---|
| 364 | | |
|---|
| 365 | | string = [[_dashboardController launchArguments] componentsJoinedByString:@" "]; |
|---|
| 366 | | |
|---|
| 367 | | owner = [[NSFileManager defaultManager] ownerAtPath:path]; |
|---|
| 368 | | |
|---|
| 369 | | if(!owner) |
|---|
| 370 | | owner = [[NSFileManager defaultManager] ownerAtPath:[path stringByDeletingLastPathComponent]]; |
|---|
| 371 | | |
|---|
| 372 | | if([[[NSFileManager defaultManager] ownerAtPath:path] isEqualToString:NSUserName()]) { |
|---|
| 373 | | status = [string writeToFile:path atomically:YES]; |
|---|
| 374 | | } else { |
|---|
| 375 | | authorization = [WCAuthorization authorization]; |
|---|
| 376 | | |
|---|
| 377 | | if(status) { |
|---|
| 378 | | temp = [NSFileManager temporaryPathWithPrefix:@"wired" suffix:@"flags"]; |
|---|
| 379 | | status = [string writeToFile:temp atomically:YES]; |
|---|
| 380 | | } |
|---|
| 381 | | |
|---|
| 382 | | if(status) |
|---|
| 383 | | status = [authorization movePath:temp toPath:path]; |
|---|
| 384 | | |
|---|
| 385 | | if(status) { |
|---|
| 386 | | status = [authorization changeOwnerOfPath:path |
|---|
| 387 | | toOwner:[_config stringForKey:@"user"] |
|---|
| 388 | | group:[_config stringForKey:@"group"]]; |
|---|
| 389 | | } |
|---|
| | 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"]]; |
|---|
| 401 | | NSString *path, *owner; |
|---|
| 402 | | |
|---|
| 403 | | path = WCExpandWiredPath(@"etc/wired.startup"); |
|---|
| 404 | | owner = [[NSFileManager defaultManager] ownerAtPath:path]; |
|---|
| 405 | | |
|---|
| 406 | | if(!owner) |
|---|
| 407 | | owner = [[NSFileManager defaultManager] ownerAtPath:[path stringByDeletingLastPathComponent]]; |
|---|
| 408 | | |
|---|
| 409 | | if([[[NSFileManager defaultManager] ownerAtPath:path] isEqualToString:NSUserName()]) { |
|---|
| 410 | | if(value) |
|---|
| 411 | | [[NSFileManager defaultManager] createFileAtPath:path]; |
|---|
| 412 | | else |
|---|
| 413 | | [[NSFileManager defaultManager] removeFileAtPath:path]; |
|---|
| | 381 | NSString *path; |
|---|
| | 382 | |
|---|
| | 383 | path = WCExpandWiredPath(@"etc/wired.startup"); |
|---|
| | 384 | authorization = [WCAuthorization authorization]; |
|---|
| | 385 | |
|---|
| | 386 | if(value) { |
|---|
| | 387 | if([authorization createFileAtPath:path]) { |
|---|
| | 388 | [authorization changeOwnerOfPath:path |
|---|
| | 389 | toOwner:[_config stringForKey:@"user"] |
|---|
| | 390 | group:[_config stringForKey:@"group"]]; |
|---|
| | 391 | } |
|---|
| 711 | | imageRep = [NSBitmapImageRep imageRepWithData:[[_bannerImageView image] TIFFRepresentation]]; |
|---|
| 712 | | data = [imageRep representationUsingType:NSPNGFileType properties:NULL]; |
|---|
| 713 | | |
|---|
| 714 | | path = WCExpandWiredPath(@"banner.png"); |
|---|
| 715 | | owner = [[NSFileManager defaultManager] ownerAtPath:path]; |
|---|
| 716 | | |
|---|
| 717 | | if(!owner) |
|---|
| 718 | | owner = [[NSFileManager defaultManager] ownerAtPath:[path stringByDeletingLastPathComponent]]; |
|---|
| 719 | | |
|---|
| 720 | | if([owner isEqualToString:NSUserName()]) { |
|---|
| 721 | | status = [data writeToFile:path atomically:YES]; |
|---|
| 722 | | } else { |
|---|
| 723 | | authorization = [WCAuthorization authorization]; |
|---|
| 724 | | |
|---|
| 725 | | if(status) { |
|---|
| 726 | | temp = [NSFileManager temporaryPathWithPrefix:@"banner" suffix:@"png"]; |
|---|
| 727 | | status = [data writeToFile:temp atomically:YES]; |
|---|
| 728 | | } |
|---|
| 729 | | |
|---|
| 730 | | if(status) |
|---|
| 731 | | status = [authorization movePath:temp toPath:path]; |
|---|
| 732 | | |
|---|
| 733 | | if(status) { |
|---|
| 734 | | status = [authorization changeOwnerOfPath:path |
|---|
| 735 | | toOwner:[_config stringForKey:@"user"] |
|---|
| 736 | | group:[_config stringForKey:@"group"]]; |
|---|
| 737 | | } |
|---|
| | 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"]]; |
|---|
| 820 | | path = WCExpandWiredPath(@"etc/certificate.pem"); |
|---|
| 821 | | owner = [[NSFileManager defaultManager] ownerAtPath:path]; |
|---|
| 822 | | |
|---|
| 823 | | if(!owner) |
|---|
| 824 | | owner = [[NSFileManager defaultManager] ownerAtPath:[path stringByDeletingLastPathComponent]]; |
|---|
| 825 | | |
|---|
| 826 | | if([owner isEqualToString:NSUserName()]) { |
|---|
| 827 | | [arguments addObjectsFromArray:[NSArray arrayWithObjects: |
|---|
| 828 | | @"-keyout", |
|---|
| 829 | | path, |
|---|
| 830 | | @"-out", |
|---|
| 831 | | path, |
|---|
| 832 | | NULL]]; |
|---|
| 833 | | |
|---|
| 834 | | task = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/openssl" |
|---|
| 835 | | arguments:arguments]; |
|---|
| 836 | | [task waitUntilExit]; |
|---|
| 837 | | status = ([task terminationStatus] == 0); |
|---|
| 838 | | } else { |
|---|
| 839 | | authorization = [WCAuthorization authorization]; |
|---|
| 840 | | |
|---|
| 841 | | temp = [NSFileManager temporaryPathWithPrefix:@"certificate" suffix:@"pem"]; |
|---|
| 842 | | [arguments addObjectsFromArray:[NSArray arrayWithObjects: |
|---|
| 843 | | @"-keyout", |
|---|
| 844 | | temp, |
|---|
| 845 | | @"-out", |
|---|
| 846 | | temp, |
|---|
| 847 | | NULL]]; |
|---|
| 848 | | status = [authorization launchTaskWithPath:@"/usr/bin/openssl" arguments:arguments]; |
|---|
| 849 | | |
|---|
| 850 | | if(status) |
|---|
| 851 | | status = [authorization movePath:temp toPath:path]; |
|---|
| 852 | | |
|---|
| 853 | | if(status) { |
|---|
| 854 | | status = [authorization changeOwnerOfPath:path |
|---|
| 855 | | toOwner:[_config stringForKey:@"user"] |
|---|
| 856 | | group:[_config stringForKey:@"group"]]; |
|---|
| 857 | | } |
|---|
| | 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"]]; |
|---|