[asterisk-commits] tilghman: branch 1.6.0 r218732 - in /branches/1.6.0: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 15 17:39:32 CDT 2009


Author: tilghman
Date: Tue Sep 15 17:39:28 2009
New Revision: 218732

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=218732
Log:
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)
  ........
................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_voicemail.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.0/apps/app_voicemail.c?view=diff&rev=218732&r1=218731&r2=218732
==============================================================================
--- branches/1.6.0/apps/app_voicemail.c (original)
+++ branches/1.6.0/apps/app_voicemail.c Tue Sep 15 17:39:28 2009
@@ -810,18 +810,17 @@
 
 static int change_password_realtime(struct ast_vm_user *vmu, const char *password)
 {
-	int res;
-	if (!ast_strlen_zero(vmu->uniqueid)) {
-		res = ast_update_realtime("voicemail", "uniqueid", vmu->uniqueid, "password", password, NULL);
-		if (res > 0) {
+	int res = -1;
+	if (!strcmp(vmu->password, password)) {
+		/* No change (but an update would return 0 rows updated, so we opt out here) */
+		return 0;
+	} else if (!ast_strlen_zero(vmu->uniqueid)) {
+		if (ast_update_realtime("voicemail", "uniqueid", vmu->uniqueid, "password", password, NULL) > 0) {
 			ast_copy_string(vmu->password, password, sizeof(vmu->password));
 			res = 0;
-		} else if (!res) {
-			res = -1;
-		}
-		return res;
-	}
-	return -1;
+		}
+	}
+	return res;
 }
 
 static void apply_options(struct ast_vm_user *vmu, const char *options)




More information about the asterisk-commits mailing list