Commit c5126828 authored by Pierre SAGASPE's avatar Pierre SAGASPE

ftp: loginInformation returns the username and password if the account exist

parent a46cd3a7
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#import "VLCLocalNetworkServiceBrowserFTP.h" #import "VLCLocalNetworkServiceBrowserFTP.h"
#import "VLCNetworkServerLoginInformation.h" #import "VLCNetworkServerLoginInformation.h"
#import "SSKeychain.h"
@implementation VLCLocalNetworkServiceBrowserFTP @implementation VLCLocalNetworkServiceBrowserFTP
- (instancetype)init { - (instancetype)init {
...@@ -42,7 +42,21 @@ NSString *const VLCNetworkServerProtocolIdentifierFTP = @"ftp"; ...@@ -42,7 +42,21 @@ NSString *const VLCNetworkServerProtocolIdentifierFTP = @"ftp";
{ {
VLCNetworkServerLoginInformation *login = [[VLCNetworkServerLoginInformation alloc] init]; VLCNetworkServerLoginInformation *login = [[VLCNetworkServerLoginInformation alloc] init];
login.address = self.netService.hostName; login.address = self.netService.hostName;
login.port = [NSNumber numberWithInteger:self.netService.port];
login.protocolIdentifier = VLCNetworkServerProtocolIdentifierFTP; login.protocolIdentifier = VLCNetworkServerProtocolIdentifierFTP;
NSString *serviceString = [NSString stringWithFormat:@"ftp://%@", login.address];
NSArray *accounts = [SSKeychain accountsForService:serviceString];
if (!accounts) {
login.username = login.password = @"";
return login;
}
NSDictionary *account = [accounts firstObject];
NSString *username = [account objectForKey:@"acct"];
login.username = username;
login.password = [SSKeychain passwordForService:serviceString account:username];
return login; return login;
} }
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment