merge of '0b23ad3fb301bde775ba3ffc847fd611bdfc26ea'

and '63de63b9d1691f5af7ec1b790f5201ae73cfa036'

Monotone-Parent: 0b23ad3fb301bde775ba3ffc847fd611bdfc26ea
Monotone-Parent: 63de63b9d1691f5af7ec1b790f5201ae73cfa036
Monotone-Revision: 8062273942a9de3fcd13c9bb3307488c9a67ec68

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-07-24T20:57:39
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2012-07-24 20:57:39 +00:00
5 changed files with 55 additions and 3 deletions

View File

@@ -1,3 +1,12 @@
2012-07-24 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreUserContext.m
(-initWithUsername:andTDBIndexing:): attempt to read the user
password from a property list.
* OpenChange/samba-get-config.py: new utility taking a samba
configuration variable and prints the value on stdout
2012-07-24 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/UIxPreferences.js (savePreferences):

View File

@@ -26,6 +26,8 @@ BUNDLE_INSTALL_DIR = $(SOGO_LIBDIR)
UNRTF_DIR = unrtf-$(UNRTF_VERSION)
SAMBA_PRIVATE_DIR = $(shell ./samba-get-config.py "private dir")
$(SOGOBACKEND)_SUBPROJECTS += $(UNRTF_DIR)/src
$(SOGOBACKEND)_PRINCIPAL_CLASS = MAPIApplication
@@ -190,6 +192,7 @@ $(SOGOBACKEND)_LIB_DIRS += \
ADDITIONAL_INCLUDE_DIRS += \
-Werror -Wall \
-DSAMBA_PRIVATE_DIR=@"\"$(SAMBA_PRIVATE_DIR)\"" \
$(LIBMAPI_CFLAGS) \
$(LIBMAPISTORE_CFLAGS) \
-I$(UNRTF_DIR)/src \

View File

@@ -20,8 +20,10 @@
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSData.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSMapTable.h>
#import <Foundation/NSPropertyList.h>
#import <Foundation/NSThread.h>
#import <Foundation/NSURL.h>
@@ -95,9 +97,37 @@ static NSMapTable *contextsTable = nil;
return self;
}
- (NSString *) _readUserPassword: (NSString *) newUsername
{
NSString *password;
NSData *content;
id plist;
NSPropertyListFormat plistFormat;
NSString *error;
password = nil;
content = [NSData dataWithContentsOfFile: SAMBA_PRIVATE_DIR
@"/mapistore/SOGo/userpwds.plist"];
if (content)
{
plist = [NSPropertyListSerialization
propertyListFromData: content
mutabilityOption: NSPropertyListImmutable
format: &plistFormat
errorDescription: &error];
if ([plist respondsToSelector: @selector (objectForKey:)])
password = [plist objectForKey: newUsername];
}
return password;
}
- (id) initWithUsername: (NSString *) newUsername
andTDBIndexing: (struct tdb_wrap *) indexingTdb
{
NSString *userPassword;
if ((self = [self init]))
{
/* "username" will be retained by table */
@@ -109,7 +139,10 @@ static NSMapTable *contextsTable = nil;
authenticator = [MAPIStoreAuthenticator new];
[authenticator setUsername: username];
/* TODO: very hackish (IMAP access) */
[authenticator setPassword: username];
userPassword = [self _readUserPassword: newUsername];
if ([userPassword length] == 0)
userPassword = username;
[authenticator setPassword: userPassword];
}
return self;

View File

@@ -169,8 +169,7 @@
[self setTimeStampAsDate: value];
/* SUMMARY */
value = [properties
objectForKey: MAPIPropertyKey (PR_NORMALIZED_SUBJECT_UNICODE)];
value = [properties objectForKey: MAPIPropertyKey (PidTagNormalizedSubject)];
if (value)
[self setSummary: value];

8
OpenChange/samba-get-config.py Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/python
import sys
import samba.param
a = samba.param.LoadParm()
a.load_default()
print a.get(sys.argv[1])