diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-11-11 09:44:37 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-11-11 09:44:37 +0000 |
commit | f633a067d2120cca67fd1b2782688424cadde9d4 (patch) | |
tree | 613f7364482c73e12b626da99897470cbb9687ed /Source/SPStringAdditions.m | |
parent | db80c9b84be4326d2e2d36839c532159fb9d61fd (diff) | |
download | sequelpro-f633a067d2120cca67fd1b2782688424cadde9d4.tar.gz sequelpro-f633a067d2120cca67fd1b2782688424cadde9d4.tar.bz2 sequelpro-f633a067d2120cca67fd1b2782688424cadde9d4.zip |
• some improvements for sequelpro://process_id/command/param1/param2 url scheme support
- introduced an unique process ID for each called bash command which will be set for the current SPDatabaseDocument and passed as environment shell variable SP_PROCESS_ID to ensure that such a scheme command will be executed by the correct SPDatabaseDocument, to avoid security issues ie one can authenticate such a sheme command, to enable url scheme process communication based on file shake-hands etc.
Diffstat (limited to 'Source/SPStringAdditions.m')
-rw-r--r-- | Source/SPStringAdditions.m | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m index 9d9d1779..c57ccacb 100644 --- a/Source/SPStringAdditions.m +++ b/Source/SPStringAdditions.m @@ -419,8 +419,17 @@ NSTask *bashTask = [[NSTask alloc] init]; [bashTask setLaunchPath: @"/bin/bash"]; + NSMutableDictionary *theEnv = [NSMutableDictionary dictionary]; + [theEnv setDictionary:shellEnvironment]; + + // Create and set an unique process ID for each SPDatabaseDocument which has to passed + // for each sequelpro:// scheme command as user to be able to identify the url scheme command. + // Furthermore this id is used to communicate with the called command as file name. + NSString *processID = [NSString stringWithNewUUID]; + [theEnv setObject:processID forKey:@"SP_PROCESS_ID"]; + [[[[NSApp mainWindow] delegate] selectedTableDocument] setProcessID:processID]; if(shellEnvironment != nil && [shellEnvironment isKindOfClass:[NSDictionary class]] && [shellEnvironment count]) - [bashTask setEnvironment:shellEnvironment]; + [bashTask setEnvironment:theEnv]; if(path != nil) [bashTask setCurrentDirectoryPath:path]; |