|
@@ -217,12 +217,12 @@
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
// E2EE
|
|
|
|
|
|
-- (NSError *)markEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl token:(NSString **)token
|
|
|
+- (NSError *)markEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl
|
|
|
{
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
__block NSError *returnError = nil;
|
|
|
- __block NSString *returnToken = *token;
|
|
|
+ __block NSString *token = [[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl];
|
|
|
|
|
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
|
|
|
@@ -240,10 +240,9 @@
|
|
|
}
|
|
|
|
|
|
// LOCK
|
|
|
- [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:returnToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
+ [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
|
|
|
|
|
- returnToken = token;
|
|
|
- [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:returnToken];
|
|
|
+ [[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:token];
|
|
|
|
|
|
// REMOVE METADATA
|
|
|
[communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
@@ -256,9 +255,8 @@
|
|
|
[communication markEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
|
|
|
// UNLOCK
|
|
|
- [communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:returnToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
+ [communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
|
|
|
- returnToken = nil;
|
|
|
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:@""];
|
|
|
dispatch_semaphore_signal(semaphore);
|
|
|
|
|
@@ -290,7 +288,6 @@
|
|
|
while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER))
|
|
|
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
|
|
|
|
|
|
- *token = returnToken;
|
|
|
return returnError;
|
|
|
}
|
|
|
|