mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-14 09:48:51 +00:00
if there is no password file for specific user, try to read global password file
This way we can have a master password for imap access
This commit is contained in:
committed by
Julio García
parent
c6b8be742d
commit
3b2174eeec
@@ -100,16 +100,12 @@ static NSMapTable *contextsTable = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *) _readUserPassword: (NSString *) newUsername
|
||||
- (NSString *) _readPasswordFile: (NSString *) path
|
||||
{
|
||||
NSString *password, *path;
|
||||
NSString *password;
|
||||
NSData *content;
|
||||
|
||||
password = nil;
|
||||
|
||||
path = [NSString stringWithFormat: SAMBA_PRIVATE_DIR
|
||||
@"/mapistore/%@/password", newUsername];
|
||||
|
||||
password = nil;
|
||||
content = [NSData dataWithContentsOfFile: path];
|
||||
|
||||
if (content)
|
||||
@@ -124,6 +120,24 @@ static NSMapTable *contextsTable = nil;
|
||||
return password;
|
||||
}
|
||||
|
||||
- (NSString *) _readUserPassword: (NSString *) newUsername
|
||||
{
|
||||
NSString *password, *path;
|
||||
|
||||
path = [NSString stringWithFormat: SAMBA_PRIVATE_DIR
|
||||
@"/mapistore/%@/password", newUsername];
|
||||
|
||||
password = [self _readPasswordFile: path];
|
||||
if (password == nil)
|
||||
{
|
||||
// Try to get master password
|
||||
path = [NSString stringWithFormat: SAMBA_PRIVATE_DIR @"/mapistore/master.password"];
|
||||
password = [self _readPasswordFile: path];
|
||||
}
|
||||
|
||||
return password;
|
||||
}
|
||||
|
||||
- (id) initWithUsername: (NSString *) newUsername
|
||||
andTDBIndexing: (struct indexing_context *) indexing
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user