Changeset 4011

Show
Ignore:
Timestamp:
04/02/06 14:21:33 (2 years ago)
Author:
morris
Message:

Don't chown all of /Library/Wired, just the contents, so we don't alter the user's files

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredServer/trunk/WCAccountsController.m

    r3950 r4011  
    271271                if([controller movePath:temp toPath:path]) { 
    272272                        if([controller changeOwnerOfPath:path 
    273                                                                          toOwner:[config stringForKey:@"user"] 
     273                                                                          toUser:[config stringForKey:@"user"] 
    274274                                                                           group:[config stringForKey:@"group"]]) { 
    275275                                _touched = NO; 
     
    300300                if([controller movePath:temp toPath:path]) { 
    301301                        if([controller changeOwnerOfPath:path 
    302                                                                          toOwner:[config stringForKey:@"user"] 
     302                                                                          toUser:[config stringForKey:@"user"] 
    303303                                                                           group:[config stringForKey:@"group"]]) { 
    304304                                _touched = NO; 
  • WiredServer/trunk/WCConfigController.m

    r3950 r4011  
    4949 
    5050- (void)_setLaunchesAtBoot:(BOOL)value; 
     51- (void)_changeOwnerOfPrefixPathToUser:(NSString *)user group:(NSString *)group; 
    5152 
    5253@end 
     
    252253 
    253254- (BOOL)_writeToFile:(NSString *)path { 
    254         NSString                                *temp
     255        NSString                                *temp, *owner
    255256        WCDashboardController   *controller; 
    256257 
     
    333334        if([_config writeToFile:temp]) { 
    334335                if([controller movePath:temp toPath:path]) { 
    335                         if([controller changeOwnerOfPath:[WCSettings objectForKey:WCPrefixPath] 
    336                                                                          toOwner:[_config stringForKey:@"user"] 
     336                        if([controller changeOwnerOfPath:path 
     337                                                                          toUser:[_config stringForKey:@"user"] 
    337338                                                                           group:[_config stringForKey:@"group"]]) { 
     339                                owner = [[NSFileManager defaultManager] ownerAtPath:[WCSettings objectForKey:WCPrefixPath]]; 
     340 
     341                                if(![owner isEqualToString:[_config stringForKey:@"user"]]) 
     342                                        [self _changeOwnerOfPrefixPathToUser:[_config stringForKey:@"user"] group:[_config stringForKey:@"group"]]; 
     343                                 
    338344                                _touched = NO; 
    339345                                 
     
    359365                if([controller movePath:temp toPath:path]) { 
    360366                        if([controller changeOwnerOfPath:path 
    361                                                                          toOwner:[_config stringForKey:@"user"] 
     367                                                                          toUser:[_config stringForKey:@"user"] 
    362368                                                                           group:[_config stringForKey:@"group"]]) 
    363369                                return YES; 
     
    382388                if([controller createFileAtPath:path]) { 
    383389                        [controller changeOwnerOfPath:path 
    384                                                                   toOwner:[_config stringForKey:@"user"] 
     390                                                                  toUser:[_config stringForKey:@"user"] 
    385391                                                                        group:[_config stringForKey:@"group"]]; 
    386392                } 
    387393        } else { 
    388394                [controller removeFileAtPath:path]; 
     395        } 
     396} 
     397 
     398 
     399 
     400- (void)_changeOwnerOfPrefixPathToUser:(NSString *)user group:(NSString *)group { 
     401        NSEnumerator                    *enumerator; 
     402        NSString                                *path, *file; 
     403        WCDashboardController   *controller; 
     404         
     405        controller      = [WCDashboardController dashboardController]; 
     406        path            = [WCSettings objectForKey:WCPrefixPath]; 
     407         
     408        if(![controller changeOwnerOfPath:path toUser:user group:group]) 
     409                return; 
     410         
     411        enumerator = [[[NSFileManager defaultManager] directoryContentsAtPath:path] objectEnumerator]; 
     412         
     413        while((file = [enumerator nextObject])) { 
     414                if(![controller changeOwnerOfPath:[path stringByAppendingPathComponent:file] toUser:user group:group]) 
     415                        return; 
    389416        } 
    390417} 
     
    667694                if([controller movePath:temp toPath:path]) { 
    668695                        if([controller changeOwnerOfPath:path 
    669                                                                          toOwner:[_config stringForKey:@"user"] 
     696                                                                          toUser:[_config stringForKey:@"user"] 
    670697                                                                           group:[_config stringForKey:@"group"]]) { 
    671698                                [_config setString:path forKey:@"banner"]; 
     
    759786                if([controller movePath:temp toPath:path]) { 
    760787                        if([controller changeOwnerOfPath:path 
    761                                                                          toOwner:[_config stringForKey:@"user"] 
     788                                                                          toUser:[_config stringForKey:@"user"] 
    762789                                                                           group:[_config stringForKey:@"group"]]) { 
    763790                                [_config setString:WCExpandWiredPath(@"etc/certificate.pem") forKey:@"certificate"]; 
  • WiredServer/trunk/WCDashboardController.h

    r3950 r4011  
    5858- (BOOL)movePath:(NSString *)fromPath toPath:(NSString *)toPath; 
    5959- (BOOL)removeFileAtPath:(NSString *)path; 
    60 - (BOOL)changeOwnerOfPath:(NSString *)path toOwner:(NSString *)user group:(NSString *)group; 
     60- (BOOL)changeOwnerOfPath:(NSString *)path toUser:(NSString *)user group:(NSString *)group; 
    6161 
    6262- (IBAction)start:(id)sender; 
  • WiredServer/trunk/WCDashboardController.m

    r3950 r4011  
    291291 
    292292 
    293 - (BOOL)changeOwnerOfPath:(NSString *)path toOwner:(NSString *)user group:(NSString *)group { 
     293- (BOOL)changeOwnerOfPath:(NSString *)path toUser:(NSString *)user group:(NSString *)group { 
    294294        NSArray         *arguments; 
    295295         
    296296        arguments = [NSArray arrayWithObjects: 
    297                 @"-Rh", 
     297                @"-h", 
    298298                [NSSWF:@"%@:%@", user, group], 
    299299                path, 
  • WiredServer/trunk/wired.sh

    r3989 r4011  
    9292 
    9393lipo -create $HL2WIRED_BINARIES -output run/hl2wired || exit 1 
    94 lipo -create $WIRED_BINARIES -output run/wired || exit 1        
     94lipo -create $WIRED_BINARIES -output run/wired || exit 1 
    9595 
    9696# Install wired into /Library/Wired