Wed, 10 Feb 2010 21:25:01 +0100
Extend uac_auth() of the UAC module to workaround CSEQ problems.
This logic is meant to complement that of changeset 17, which
added rich authentication credentials to the gw table and its
associated logic in the LCR module.
michael@1 | 1 | /* |
michael@1 | 2 | * Copyright (c) 2004 Angelo Laub |
michael@1 | 3 | * |
michael@1 | 4 | * This program is free software; you can redistribute it and/or modify |
michael@1 | 5 | * it under the terms of the GNU General Public License version 2 |
michael@1 | 6 | * as published by the Free Software Foundation. |
michael@1 | 7 | * |
michael@1 | 8 | * This program is distributed in the hope that it will be useful, |
michael@1 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
michael@1 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
michael@1 | 11 | * GNU General Public License for more details. |
michael@1 | 12 | * |
michael@1 | 13 | * You should have received a copy of the GNU General Public License |
michael@1 | 14 | * along with this program (see the file COPYING included with this |
michael@1 | 15 | * distribution); if not, write to the Free Software Foundation, Inc., |
michael@1 | 16 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
michael@1 | 17 | */ |
michael@1 | 18 | |
michael@1 | 19 | #include "installer.h" |
michael@1 | 20 | |
michael@1 | 21 | int main(int argc, char *argv[]) |
michael@1 | 22 | { |
michael@1 | 23 | NSAutoreleasePool *pool = [NSAutoreleasePool new]; |
michael@1 | 24 | NSString *thisBundle = [[NSString stringWithUTF8String:argv[0]] stringByDeletingLastPathComponent]; |
michael@1 | 25 | |
michael@1 | 26 | NSString *tunPath = [thisBundle stringByAppendingPathComponent:@"/tun.kext"]; |
michael@1 | 27 | NSString *tapPath = [thisBundle stringByAppendingPathComponent:@"/tap.kext"]; |
michael@1 | 28 | |
michael@1 | 29 | NSString *tunExecutable = [tunPath stringByAppendingPathComponent:@"/Contents/MacOS/tun"]; |
michael@1 | 30 | NSString *tapExecutable = [tapPath stringByAppendingPathComponent:@"/Contents/MacOS/tap"]; |
michael@1 | 31 | |
michael@1 | 32 | NSString *helperPath = [thisBundle stringByAppendingPathComponent:@"/openvpnstart"]; |
michael@1 | 33 | NSString *openvpnPath = [thisBundle stringByAppendingPathComponent:@"/openvpn"]; |
michael@1 | 34 | |
michael@1 | 35 | runTask( |
michael@1 | 36 | @"/usr/sbin/chown", |
michael@1 | 37 | [NSArray arrayWithObjects:@"-R",@"root:wheel",thisBundle,nil] |
michael@1 | 38 | ); |
michael@1 | 39 | |
michael@1 | 40 | runTask( |
michael@1 | 41 | @"/bin/chmod", |
michael@6 | 42 | [NSArray arrayWithObjects:@"755", |
michael@1 | 43 | tunExecutable, |
michael@1 | 44 | tapExecutable, |
michael@6 | 45 | tunPath, |
michael@6 | 46 | tapPath, |
michael@1 | 47 | openvpnPath, |
michael@1 | 48 | nil] |
michael@1 | 49 | ); |
michael@1 | 50 | runTask( |
michael@1 | 51 | @"/bin/chmod", |
michael@6 | 52 | [NSArray arrayWithObjects:@"4555",helperPath,nil] |
michael@1 | 53 | ); |
michael@1 | 54 | [pool release]; |
michael@1 | 55 | return 0; |
michael@1 | 56 | } |
michael@1 | 57 | |
michael@1 | 58 | void runTask(NSString *launchPath,NSArray *arguments) |
michael@1 | 59 | { |
michael@1 | 60 | NSTask* task = [[[NSTask alloc] init] autorelease]; |
michael@1 | 61 | [task setArguments:arguments]; |
michael@1 | 62 | [task setLaunchPath:launchPath]; |
michael@1 | 63 | |
michael@1 | 64 | NS_DURING { |
michael@1 | 65 | [task launch]; |
michael@1 | 66 | } NS_HANDLER { |
michael@1 | 67 | NSLog(@"Exception raised while executing helper %@: %@",launchPath, localException); |
michael@1 | 68 | exit(EXIT_FAILURE); |
michael@1 | 69 | } |
michael@1 | 70 | NS_ENDHANDLER |
michael@1 | 71 | [task waitUntilExit]; |
michael@1 | 72 | } |