- Timestamp:
- 03/13/08 17:52:16 (10 months ago)
- Location:
- trunk
- Files:
-
- 27 added
- 7 removed
- 38 modified
-
Images (deleted)
-
MFClient.h (modified) (2 diffs)
-
MFClient.m (modified) (8 diffs)
-
MFClientFS.h (modified) (3 diffs)
-
MFClientFS.m (modified) (6 diffs)
-
MFCommunicationServer.m (modified) (1 diff)
-
MFConstants.h (modified) (2 diffs)
-
MFConstants.m (modified) (1 diff)
-
MFCore-Info.plist (deleted)
-
MFCore.h (added)
-
MFCore.m (added)
-
MFFSDelegateProtocol.h (modified) (2 diffs)
-
MFFilesystem.h (modified) (4 diffs)
-
MFFilesystem.m (modified) (5 diffs)
-
MFFilesystemController.h (modified) (1 diff)
-
MFFilesystemController.m (modified) (7 diffs)
-
MFLoggingController.h (modified) (1 diff)
-
MFLoggingController.m (modified) (3 diffs)
-
MFMainController.h (modified) (1 diff)
-
MFMainController.m (modified) (1 diff)
-
MFNetworkFS.h (added)
-
MFPlugin.h (modified) (1 diff)
-
MFPlugin.m (modified) (2 diffs)
-
MFPluginController.m (modified) (1 diff)
-
MFPreferencesController.h (added)
-
MFPreferencesController.m (added)
-
MFSecurity.h (added)
-
MFSecurity.m (added)
-
MFServerFS.h (modified) (2 diffs)
-
MFServerFS.m (modified) (8 diffs)
-
MFServerFSProtocol.h (modified) (2 diffs)
-
MFServerProtocol.h (modified) (2 diffs)
-
MGSmoothingImageView.h (added)
-
MGSmoothingImageView.m (added)
-
MacFusion2.xcodeproj/project.pbxproj (modified) (58 diffs)
-
MacfusionMain-Info.plist (deleted)
-
MacfusionMenuling-Info.plist (deleted)
-
Menuling/MFMenulingAppDelegate.m (modified) (2 diffs)
-
Menuling/MFQuickMountController.m (modified) (2 diffs)
-
Menuling/MGFadingWindow.h (modified) (1 diff)
-
Menuling/MGFadingWindow.m (modified) (1 diff)
-
Menuling/MainMenu.xib (deleted)
-
Menuling/QuickMount.xib (deleted)
-
Menuling/Resources (added)
-
Menuling/Resources/MacFusion_Menu_Dark.png (added)
-
Menuling/Resources/MacFusion_Menu_Light.png (added)
-
Menuling/Resources/MainMenu.xib (added)
-
Menuling/Resources/QuickMount.xib (added)
-
Resources (added)
-
Resources/Credits.rtf (added)
-
Resources/MFCore-Info.plist (added)
-
Resources/MFPreferences.xib (added)
-
Resources/MacfusionMain-Info.plist (added)
-
Resources/MacfusionMenuling-Info.plist (added)
-
Resources/macfusion.tiff (added)
-
Resources/macfusionAdvancedView.xib (added)
-
Resources/macfusionIcon.icns (added)
-
Resources/topView.xib (added)
-
SSHFS/SSHFSDelegate.m (modified) (14 diffs)
-
SSHFS/new_ssh_askpass.m (added)
-
SSHFS/sshfs-Info.plist (modified) (1 diff)
-
SSHFS/sshfsConfiguration.xib (modified) (33 diffs)
-
SSHFS/sshfs_icon.icns (modified) (previous)
-
Settings/MFFilesystemCell.h (modified) (1 diff)
-
Settings/MFFilesystemCell.m (modified) (7 diffs)
-
Settings/MFFilesystemTableView.h (added)
-
Settings/MFFilesystemTableView.m (added)
-
Settings/MFSettingsController.h (modified) (1 diff)
-
Settings/MFSettingsController.m (modified) (15 diffs)
-
Settings/main.xib (modified) (100 diffs)
-
fuse.plist (deleted)
-
macfusionAgent.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/MFClient.h
r19 r23 21 21 id <MFServerProtocol> server; 22 22 id delegate; 23 bool triedBootstrap; 23 24 } 24 25 … … 32 33 - (MFClientFS*)mountRecent:(MFClientRecent*)recent 33 34 error:(NSError**)error; 35 - (void)deleteFilesystem:(MFClientFS*)fs; 34 36 35 37 // Accessors -
trunk/MFClient.m
r20 r23 12 12 #import "MFConstants.h" 13 13 #import "MFClientRecent.h" 14 #import <Security/Security.h> 15 #import "MFCore.h" 14 16 15 17 #define ORDERING_FILE_PATH @"~/Library/Application Support/Macfusion/Ordering.plist" … … 20 22 - (void)removeFilesystem:(MFClientFS*)fs; 21 23 - (void)loadOrdering; 24 - (void)setupKeychainMonitoring; 25 - (void)writeOrdering; 26 // Security monitoring 22 27 23 28 @property(readwrite, retain) NSMutableArray* persistentFilesystems; … … 100 105 plugins = [NSMutableArray array]; 101 106 recents = [NSMutableArray array]; 107 [self setupKeychainMonitoring]; 108 setStateForAgentLoginItem(YES); 109 triedBootstrap = NO; 102 110 } 103 111 return self; … … 160 168 [self fillInitialStatus]; 161 169 return YES; 170 } 171 else 172 { 173 // Try to start the server process 174 NSAlert* serverStartAlert = [NSAlert new]; 175 [serverStartAlert setMessageText: @"The macfusion agent process is not started"]; 176 [serverStartAlert setInformativeText: @"Would you like to start the agent?\nOtherwise, Macfusion will Quit."]; 177 [serverStartAlert setShowsSuppressionButton: YES]; 178 [serverStartAlert addButtonWithTitle:@"Start"]; 179 [serverStartAlert addButtonWithTitle:@"Quit"]; 180 [[serverStartAlert suppressionButton] setTitle: @"Start agent automatically on login"]; 181 NSInteger returnValue = [serverStartAlert runModal]; 182 // MFLogS(self, @"Return %d supression state %d", returnValue, [[serverStartAlert suppressionButton] state]); 183 184 if ([[serverStartAlert suppressionButton] state]) 185 setStateForAgentLoginItem(YES); 186 187 if (returnValue == NSAlertSecondButtonReturn) 188 { 189 [NSApp terminate: self]; 190 } 191 else if (returnValue == NSAlertFirstButtonReturn) 192 { 193 NSString* agentPath = [[NSBundle bundleWithPath: mainUIBundlePath()] pathForResource:@"macfusionAgent" ofType:nil]; 194 [NSTask launchedTaskWithLaunchPath: agentPath arguments:[NSArray array]]; 195 [[NSRunLoop currentRunLoop] runUntilDate:[[NSDate date] addTimeInterval: 1.5]]; 196 197 if ([self establishCommunication]) 198 { 199 [self fillInitialStatus]; 200 return YES; 201 } 202 else 203 { 204 NSAlert* faliureAlert = [NSAlert alertWithMessageText:@"Could not start or connect to the macfusion agent" 205 defaultButton:@"OK" 206 alternateButton:@"" 207 otherButton:@"" 208 informativeTextWithFormat:@"Macfusion will Quit."]; 209 [faliureAlert setAlertStyle: NSCriticalAlertStyle]; 210 [faliureAlert runModal]; 211 [NSApp terminate: self]; 212 } 213 } 162 214 } 163 215 … … 236 288 } 237 289 290 - (void)deleteFilesystem:(MFClientFS*)fs 291 { 292 NSString* uuid = [fs uuid]; 293 [server deleteFilesystemWithUUID: uuid]; 294 } 295 238 296 #pragma mark Recents 239 297 - (void)handleRecentsUpdatedNotification:(NSNotification*)note … … 260 318 261 319 return nil; 320 } 321 322 #pragma mark Security 323 OSStatus myKeychainCallback ( 324 SecKeychainEvent keychainEvent, 325 SecKeychainCallbackInfo *info, 326 void *context 327 ) 328 { 329 MFClient* self = (MFClient*)context; 330 // MFLogS(self, @"Keychain callback received event is %d", keychainEvent); 331 SecKeychainItemRef itemRef = info -> item; 332 NSString* uuid = (NSString*)uuidForKeychainItemRef(itemRef); 333 MFClientFS* fs = [self filesystemWithUUID:uuid]; 334 if (fs) 335 { 336 // MFLogS(self, @"Updating secrets for fs %@ due to keychain change", fs); 337 [fs updateSecrets]; 338 } 339 return 0; 340 } 341 342 - (void)setupKeychainMonitoring 343 { 344 SecKeychainEventMask eventMask = kSecUpdateEventMask | kSecAddEventMask; 345 SecKeychainAddCallback(myKeychainCallback , eventMask, self); 262 346 } 263 347 … … 375 459 [fs setDisplayOrder: [persistentFilesystems indexOfObject: fs]]; 376 460 } 461 462 [self writeOrdering]; 377 463 } 378 464 … … 407 493 - (void)handleApplicationTerminatingNotification:(NSNotification*)note 408 494 { 409 [self writeOrdering];495 // [self writeOrdering]; 410 496 } 411 497 -
trunk/MFClientFS.h
r19 r23 18 18 MFClientPlugin* plugin; 19 19 NSDictionary* backupParameters; 20 NSDictionary* backupSecrets; 20 21 BOOL isEditing; 21 22 NSInteger displayOrder; … … 32 33 - (void)handleStatusInfoChangedNotification:(NSNotification*)note; 33 34 - (void)handleParametersChangedNotification:(NSNotification*)note; 35 - (void)setPauseTimeout:(BOOL)p; 34 36 35 37 // Editing … … 38 40 - (NSDictionary*)displayDictionary; 39 41 42 // UI 43 - (NSDictionary*)configurationViewControllers; 44 40 45 @property(readwrite, assign) NSInteger displayOrder; 41 46 @property(readwrite, retain) id<MFClientFSDelegateProtocol> clientFSDelegate; 47 @property(readonly) NSImage* iconImage; 42 48 @end -
trunk/MFClientFS.m
r20 r23 11 11 #import "MFClientPlugin.h" 12 12 #import "MFServerFSProtocol.h" 13 #import "MFSecurity.h" 13 14 14 15 @interface MFClientFS (PrivateAPI) … … 54 55 [self registerNotifications]; 55 56 displayOrder = 9999; 57 [self updateSecrets]; 56 58 } 57 59 … … 176 178 backupParameters = [NSDictionary dictionaryWithDictionary: 177 179 [self parameters]]; 180 backupSecrets = [NSDictionary dictionaryWithDictionary: secrets]; 178 181 } 179 182 … … 192 195 if (result) 193 196 { 197 // Validation failed 194 198 return result; 195 199 } 196 200 else 197 201 { 202 // Update secure information 203 if (![secrets isEqualToDictionary: backupSecrets]) 204 { 205 setSecretsDictionaryForFilesystem( secrets, self ); 206 } 198 207 isEditing = NO; 199 208 return nil; … … 204 213 isEditing = NO; 205 214 [self setParameters: [backupParameters mutableCopy] ]; 215 [self setSecrets: [backupSecrets mutableCopy]]; 216 206 217 } 207 218 … … 209 220 } 210 221 211 - (void)willChangeValueForKey:(NSString*)key 212 { 213 if ([key isLike:@"parameters.*"] && !isEditing) 214 { 215 [[NSException exceptionWithName:kMFBadAPIUsageException 216 reason:@"Trying to modify parameters without beginEditing" 217 userInfo:nil] raise]; 218 } 219 220 [super willChangeValueForKey:key]; 222 - (NSImage*)iconImage 223 { 224 return [[NSImage alloc] initWithContentsOfFile: 225 self.iconPath]; 226 } 227 228 - (void)setPauseTimeout:(BOOL)p 229 { 230 [remoteFilesystem setPauseTimeout: p]; 231 } 232 233 # pragma mark UI 234 - (NSDictionary*)configurationViewControllers 235 { 236 NSMutableDictionary* myControllers = [NSMutableDictionary dictionary]; 237 NSViewController* macfusionAdvancedController = [[NSViewController alloc] initWithNibName: @"macfusionAdvancedView" 238 bundle: [NSBundle bundleForClass: [self class]]]; 239 [myControllers setObject: macfusionAdvancedController forKey:kMFUIMacfusionAdvancedViewKey]; 240 NSDictionary* delegateControllers = [delegate configurationViewControllers]; 241 if (!delegateControllers) 242 { 243 MFLogS(self, @"No view controllers specified by delegate"); 244 } 245 246 [myControllers addEntriesFromDictionary: delegateControllers]; 247 return [myControllers copy]; 221 248 } 222 249 -
trunk/MFCommunicationServer.m
r19 r23 219 219 } 220 220 221 - (void)deleteFilesystemWithUUID:(NSString*)uuid 222 { 223 MFServerFS* fs = [[MFFilesystemController sharedController] filesystemWithUUID: uuid]; 224 NSAssert(fs, @"CommunicationServer asked to remove filesystem with bad uuid"); 225 [[MFFilesystemController sharedController] deleteFilesystem: fs]; 226 } 227 228 #pragma mark Security Tokens 229 - (NSString*)tokenForFilesystemWithUUID:(NSString*)uuid 230 { 231 MFServerFS* fs = [[MFFilesystemController sharedController] filesystemWithUUID: uuid]; 232 return [[MFFilesystemController sharedController] tokenForFilesystem: fs]; 233 } 234 235 - (MFServerFS*)filesystemForToken:(NSString*)token 236 { 237 MFServerFS* fs = [[MFFilesystemController sharedController] filesystemForToken: token]; 238 if (fs) 239 [[MFFilesystemController sharedController] invalidateToken: token]; 240 return fs; 241 } 221 242 222 243 #pragma mark Sever Protocol Methods -
trunk/MFConstants.h
r21 r23 66 66 #define kMFFSPersistentParameter @"isPersistent" 67 67 #define kMFFSDescriptionParameter @"description" 68 #define kMFFSVolumeImagePathParameter @"imagePath" 68 69 69 70 // Status keys … … 106 107 extern NSString* kMFUIMainViewKey; 107 108 extern NSString* kMFUIAdvancedViewKey; 109 extern NSString* kMFUIMacfusionAdvancedViewKey; 108 110 -
trunk/MFConstants.m
r21 r23 30 30 */ 31 31 32 NSString* kMFUIMainViewKey=@"main 2";32 NSString* kMFUIMainViewKey=@"main"; 33 33 NSString* kMFUIAdvancedViewKey=@"advanced"; 34 NSString* kMFUIMacfusionAdvancedViewKey=@"macfusion"; -
trunk/MFFSDelegateProtocol.h
r21 r23 1 1 /* 2 * MF ServerProtocol.h2 * MFFSDelegate.h 3 3 * MacFusion2 4 4 * … … 43 43 - (NSError*)errorForParameters:(NSDictionary*)parameters 44 44 output:(NSString*)output; 45 46 // Security 47 - (NSArray*)secretsList; 48 - (NSArray*)secretsClientsList; 45 49 @end -
trunk/MFFilesystem.h
r21 r23 1 1 // 2 2 // MFFilesystem.h 3 // macfusiond3 // MacFusion2 4 4 // 5 5 // Created by Michael Gorbach on 11/5/07. … … 16 16 NSMutableDictionary* statusInfo; 17 17 id <MFFSDelegateProtocol> delegate; 18 NSMutableDictionary* secrets; 18 19 } 19 20 … … 35 36 - (NSMutableDictionary*)fillParametersWithImpliedValues:(NSDictionary*)params; 36 37 - (NSError*)error; 37 38 38 - (id <MFFSDelegateProtocol>)delegate; 39 - (void)updateSecrets; 39 40 40 41 @property(readwrite, assign) NSString* status; … … 44 45 @property(readonly) NSMutableDictionary* parameters; 45 46 @property(readonly) NSDictionary* statusInfo; 47 @property (readwrite, retain) NSMutableDictionary* secrets; 46 48 @property(readonly) NSString* pluginID; 47 49 @property(readonly) NSString* descriptionString; 48 50 @property(readonly) NSString* iconPath; 49 51 @property(readonly) NSString* filePath; 52 @property(readonly) NSString* imagePath; 50 53 51 54 @end -
trunk/MFFilesystem.m
r21 r23 1 1 // 2 2 // MFFilesystem.m 3 // macfusiond3 // MacFusion2 4 4 // 5 5 // Created by Michael Gorbach on 11/5/07. … … 10 10 //#import "MFPluginController.h" 11 11 #import "MFPlugin.h" 12 #import "MFConstants.h" 12 #import "MFConstants.h"] 13 #import "MFSecurity.h" 13 14 14 15 #define FS_DIR_PATH @"~/Library/Application Support/Macfusion/Filesystems" … … 184 185 } 185 186 187 - (void)updateSecrets 188 { 189 NSMutableDictionary* updateSecrets = [getSecretsDictionaryForFilesystem( self ) mutableCopy]; 190 self.secrets = updateSecrets ? updateSecrets : [NSMutableDictionary dictionary]; 191 } 192 186 193 - (NSMutableDictionary*)parametersWithImpliedValues 187 194 { … … 192 199 { 193 200 return [self valueForParameterNamed: kMFFSVolumeIconPathParameter ]; 201 } 202 203 - (NSString*)imagePath 204 { 205 return [self valueForParameterNamed: kMFFSVolumeImagePathParameter ]; 194 206 } 195 207 … … 230 242 } 231 243 244 - (NSString*)description 245 { 246 return [NSString stringWithFormat: @"%@ (%@)", [super description], self.name]; 247 } 248 249 @synthesize secrets; 232 250 @end -
trunk/MFFilesystemController.h
r19 r23 15 15 NSMutableArray* recents; 16 16 NSMutableArray* mountedPaths; 17 NSMutableDictionary* tokens; 17 18 18 19 DASessionRef appearSession; 19 20 DASessionRef disappearSession; 20 21 BOOL firstTimeMounting;22 21 } 23 22 23 // Init 24 24 + (MFFilesystemController*)sharedController; 25 25 - (void)loadFilesystems; 26 - (NSDictionary*)filesystemsDictionary; 27 - (NSMutableArray*)filesystems; 26 27 28 // Action methods 28 29 - (MFServerFS*)newFilesystemWithPlugin:(MFServerPlugin*)plugin; 29 30 - (MFServerFS*)quickMountWithURL:(NSURL*)url 30 31 error:(NSError**)error; 32 - (void)deleteFilesystem:(MFServerFS*)fs; 31 33 32 - (void)storeFilesystem:(MFServerFS*)fs;33 34 - (MFServerFS*)filesystemWithUUID:(NSString*)uuid; 34 35 35 - (void)addMountedPath:(NSString*)path; 36 - (void)removeMountedPath:(NSString*)path; 36 // Security Tokens 37 - (NSString*)tokenForFilesystem:(MFServerFS*)fs; 38 - (void)invalidateToken:(NSString*)token; 39 - (MFServerFS*)filesystemForToken:(NSString*)token; 37 40 38 41 // Accessors 42 - (NSDictionary*)filesystemsDictionary; 39 43 @property(readonly, retain) NSMutableArray* filesystems; 40 44 @property(readonly, retain) NSMutableArray* recents; -
trunk/MFFilesystemController.m
r20 r23 26 26 - (void)recordRecentFilesystem:(MFServerFS*)fs; 27 27 - (NSString*)getUUIDXattrAtPath:(NSString*)path; 28 - (void)addMountedPath:(NSString*)path; 29 - (void)removeMountedPath:(NSString*)path; 30 - (void)storeFilesystem:(MFServerFS*)fs; 31 - (void)removeFilesystem:(MFServerFS*)fs; 28 32 29 33 @property(readwrite, retain) NSMutableArray* filesystems; … … 80 84 mountedPaths = [NSMutableArray array]; 81 85 recents = [NSMutableArray array]; 86 tokens = [NSMutableDictionary dictionary]; 82 87 [self loadRecentFilesystems]; 83 88 [self setUpVolumeMonitoring]; … … 150 155 [[self getUUIDXattrAtPath: mountedPath] isEqualToString: fs.uuid]) 151 156 { 152 MFLogS(self, @"Premounth hit");157 // MFLogS(self, @"Pre-mount condition hit on %@", fs.uuid); 153 158 [fs handleMountNotification]; 154 159 } … … 204 209 [fs performSelector:@selector(mount) withObject:nil afterDelay:0]; 205 210 return fs; 211 } 212 213 - (void)deleteFilesystem:(MFServerFS*)fs 214 { 215 if (fs.filePath) 216 [[NSFileManager defaultManager] removeFileAtPath:fs.filePath handler:nil]; 217 [self removeFilesystem: fs]; 206 218 } 207 219 … … 269 281 if (equal) 270 282 { 271 MFLogS(self, @"Duplicate recents detected, %@ and %@",272 params, recent);283 // MFLogS(self, @"Duplicate recents detected, %@ and %@", 284 // params, recent); 273 285  
