Commit c55f151d authored by Pierre SAGASPE's avatar Pierre SAGASPE Committed by Felix Paul Kühne

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

(cherry picked from commit c5126828)
Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent ba3e7975
......@@ -12,7 +12,7 @@
#import "VLCLocalNetworkServiceBrowserFTP.h"
#import "VLCNetworkServerLoginInformation.h"
#import "SSKeychain.h"
@implementation VLCLocalNetworkServiceBrowserFTP
- (instancetype)init {
......@@ -42,7 +42,21 @@ NSString *const VLCNetworkServerProtocolIdentifierFTP = @"ftp";
{
VLCNetworkServerLoginInformation *login = [[VLCNetworkServerLoginInformation alloc] init];
login.address = self.netService.hostName;
login.port = [NSNumber numberWithInteger:self.netService.port];
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;
}
@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