aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-15 22:46:52 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-15 22:46:52 +0000
commite3ffdb304d36b2ad272a7da5fc73a77d446e80b1 (patch)
treee69ee2b4880fe257ae16ba6e544f35195c7179a8 /apps
parent4a8f22082f972f6dae7935500f0aa6262b8df0b7 (diff)
Merged revisions 218731 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r218731 | tilghman | 2009-09-15 17:33:10 -0500 (Tue, 15 Sep 2009) | 13 lines Merged revisions 218730 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r218730 | tilghman | 2009-09-15 17:27:41 -0500 (Tue, 15 Sep 2009) | 6 lines If the user enters the same password as before, don't signal an error when the change does nothing. (closes issue #15492) Reported by: cbbs70a Patches: 20090713__issue15492.diff.txt uploaded by tilghman (license 14) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@218734 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 79cebade1..641f5ecb3 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -945,28 +945,27 @@ static int check_password(struct ast_vm_user *vmu, char *password)
* \param vmu The voicemail user to change the password for.
* \param password The new value to be set to the password for this user.
*
- * This only works if the voicemail user has a unique id, and if there is a realtime engine configured.
+ * This only works if there is a realtime engine configured.
* This is called from the (top level) vm_change_password.
*
* \return zero on success, -1 on error.
*/
static int change_password_realtime(struct ast_vm_user *vmu, const char *password)
{
- int res;
- if (!ast_strlen_zero(vmu->uniqueid)) {
+ int res = -1;
+ if (!strcmp(vmu->password, password)) {
+ /* No change (but an update would return 0 rows updated, so we opt out here) */
+ res = 0;
+ } else if (!ast_strlen_zero(vmu->uniqueid)) {
if (strlen(password) > 10) {
ast_realtime_require_field("voicemail", "password", RQ_CHAR, strlen(password), SENTINEL);
}
- res = ast_update_realtime("voicemail", "uniqueid", vmu->uniqueid, "password", password, SENTINEL);
- if (res > 0) {
+ if (ast_update_realtime("voicemail", "uniqueid", vmu->uniqueid, "password", password, SENTINEL) > 0) {
ast_copy_string(vmu->password, password, sizeof(vmu->password));
res = 0;
- } else if (!res) {
- res = -1;
}
- return res;
}
- return -1;
+ return res;
}
/*!