View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001197 | SOGo | Backend General | public | 2011-03-20 21:15 | 2011-03-24 14:13 |
Reporter | mra | Assigned To | francis | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Product Version | 1.3.5 | ||||
Fixed in Version | 1.3.6 | ||||
Summary | 0001197: [1.3.6] Patch for feature "password change" with SQLSource | ||||
Description | Attached a little patch file for applying to SoObjects/SOGo/SQLSource.m, which enables the change password function in SQL sources. | ||||
Tags | No tags attached. | ||||
2011-03-20 21:15
|
SQLSource.m.patch (2,801 bytes)
--- SOGo/SoObjects/SOGo/SQLSource.m 2011-03-20 21:31:59.000000000 +0100 +++ SOGo.orig/SoObjects/SOGo/SQLSource.m 2011-03-20 21:42:14.000000000 +0100 @@ -157,31 +157,6 @@ return NO; } -// Method for encrypt a password, based on _isPassword -- (NSString *) _encryptPassword: (NSString *) plainPassword -{ - if ([_userPasswordAlgorithm caseInsensitiveCompare: @"none"] == NSOrderedSame) - { - return plainPassword; - } - else if ([_userPasswordAlgorithm caseInsensitiveCompare: @"crypt"] == NSOrderedSame) - { - return [plainPassword asCryptStringUsingSalt: [plainPassword asMD5String]]; - } - else if ([_userPasswordAlgorithm caseInsensitiveCompare: @"md5"] == NSOrderedSame) - { - return [plainPassword asMD5String]; - } - else if ([_userPasswordAlgorithm caseInsensitiveCompare: @"sha"] == NSOrderedSame) - { - return [plainPassword asSHA1String]; - } - - [self errorWithFormat: @"Unsupported user-password algorithm: %@", _userPasswordAlgorithm]; - - return plainPassword; -} - // // SQL sources don't support right now all the password policy // stuff supported by OpenLDAP (and others). If we want to support @@ -237,60 +212,14 @@ return rc; } - -// Method for changing passwords with SQL, code fragments from other methods in this code - (BOOL) changePasswordForLogin: (NSString *) login oldPassword: (NSString *) oldPassword newPassword: (NSString *) newPassword perr: (SOGoPasswordPolicyError *) perr { - EOAdaptorChannel *channel; - GCSChannelManager *cm; - NSException *ex; - NSString *sqlstr; - BOOL didChange; - BOOL isOldPwdOk; - - isOldPwdOk = NO; - didChange = NO; - - // Now set Password with configured password encryption - isOldPwdOk = [self checkLogin:login password:oldPassword perr:perr expire:0 grace:0]; - - if(isOldPwdOk) - { - // encrypt new password - NSString *encryptedPassword = [self _encryptPassword: newPassword]; - - // save new password - login = [login stringByReplacingString: @"'" withString: @"''"]; - cm = [GCSChannelManager defaultChannelManager]; - channel = [cm acquireOpenChannelForURL: _viewURL]; - if (channel) - { - // first, create sql-command - sqlstr = [NSString stringWithFormat: (@"UPDATE %@" - @" SET c_password = '%@'" - @" WHERE c_uid = '%@'"), - [_viewURL gcsTableName], encryptedPassword, login]; - - ex = [channel evaluateExpressionX: sqlstr]; - if (!ex) - { - didChange = YES; - } - else - { - [self errorWithFormat: @"could not run SQL '%@': %@", sqlstr, ex]; - } - [cm releaseChannel: channel]; - } - } - - return didChange; + return NO; } - - (NSString *) _whereClauseFromArray: (NSArray *) theArray value: (NSString *) theValue exact: (BOOL) theBOOL |
Committed in revision 380b86e5c0d4f7e3c452e904f2a11e814e95ee59. Thanks! |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2011-03-20 21:15 | mra | New Issue | |
2011-03-20 21:15 | mra | File Added: SQLSource.m.patch | |
2011-03-24 14:13 | francis | Note Added: 0002293 | |
2011-03-24 14:13 | francis | Status | new => resolved |
2011-03-24 14:13 | francis | Fixed in Version | => 1.3.6 |
2011-03-24 14:13 | francis | Resolution | open => fixed |
2011-03-24 14:13 | francis | Assigned To | => francis |