Removed extraneous source file I forgot about.

Fixed a stupid error in the last build which prevented Sparkle from actually, you know, working.
Also, revision 144 is a patch courtesy Cedric Luthi; many thanks to him for a great contribution.
This commit is contained in:
andym committed 2008-04-04 16:00:50 +00:00
1 parent b5d0501bea
commit b010f1aaf0
2 files changed
+1 -64

No files matched your search

+1 -6
View File
@@ -194,19 +194,14 @@ static OSStatus AuthorizationExecuteWithPrivilegesAndWait(
- (BOOL)copyPath:(NSString *)src overPath:(NSString *)dst withAuthentication:(BOOL)useAuthentication
{
NSLog(@"Copying %@ to %@...", dst, [self _temporaryCopyNameForPath:dst]);
if ([[NSFileManager defaultManager] isWritableFileAtPath:dst] && [[NSFileManager defaultManager] isWritableFileAtPath:[dst stringByDeletingLastPathComponent]])
{
NSInteger tag = 0;
BOOL result;
NSString *tmpPath = [self _temporaryCopyNameForPath:dst];
NSLog(@"Performing traditional copy from %@ to %@...", src, dst);
result = [[NSFileManager defaultManager] movePath:dst toPath:tmpPath handler:self];
NSLog(@"Moving %@ to %@...", src, dst);
result &= [[NSFileManager defaultManager] copyPath:src toPath:dst handler:nil];
NSLog(@"Moving %@ to the trash...", tmpPath);
result &= [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:tmpPath destination:@"" files:[NSArray arrayWithObject:[tmpPath lastPathComponent]] tag:&tag];
NSLog(@"Success!");
result &= [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[tmpPath stringByDeletingLastPathComponent] destination:@"" files:[NSArray arrayWithObject:[tmpPath lastPathComponent]] tag:&tag];
// If the currently-running application is trusted, the new
// version should be trusted as well. Remove it from the
-58
View File
@@ -1,58 +0,0 @@
//
// SUUpdater+Authentication.m
// Pixen
//
// Created by Andy Matuschak on 3/9/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "Sparkle.h"
#import "SUUpdater.h"
#import <sys/types.h>
#import <sys/wait.h>
#import <sys/stat.h>
#import <Security/Security.h>
@implementation SUUpdater (SUAuthenticationAdditions)
// Thanks to Allan Odgaard for this!
- (BOOL)moveFileWithAuthenticationFrom:(NSString *)src toNewPath:(NSString *)dst withTempPath:(NSString *)tmp
{
BOOL res = NO;
struct stat sb;
if((stat([src UTF8String], &sb) != 0) || (stat([tmp UTF8String], &sb) == 0) || stat([dst UTF8String], &sb) != 0)
return false;
char* buf = NULL;
asprintf(&buf,
"mv -f \"$DST_PATH\" \"$TMP_PATH\" && "
"mv -f \"$SRC_PATH\" \"$DST_PATH\" && "
"rm -rf \"$TMP_PATH\" && "
"chown -R %d:%d \"$DST_PATH\"",
sb.st_uid, sb.st_gid);
if(!buf)
return false;
AuthorizationRef auth;
if(AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth) == errAuthorizationSuccess)
{
setenv("SRC_PATH", [src UTF8String], 1);
setenv("DST_PATH", [dst UTF8String], 1);
setenv("TMP_PATH", [tmp UTF8String], 1);
char const* arguments[] = { "-c", buf, NULL };
if(AuthorizationExecuteWithPrivileges(auth, "/bin/sh", kAuthorizationFlagDefaults, (char**)arguments, NULL) == errAuthorizationSuccess)
{
int status;
int pid = wait(&status);
if(pid != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
res = YES;
}
}
free(buf);
return res;
}
@end