[Asterisk-cvs] asterisk/apps app_voicemail.c,1.145,1.146

markster at lists.digium.com markster at lists.digium.com
Mon Sep 6 02:16:28 CDT 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv16097/apps

Modified Files:
	app_voicemail.c 
Log Message:
Allow "-" in password to make it unchangable (bug #2386)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- app_voicemail.c	5 Sep 2004 19:38:17 -0000	1.145
+++ app_voicemail.c	6 Sep 2004 06:19:17 -0000	1.146
@@ -3411,6 +3411,10 @@
 			cmd = play_record_review(chan,"vm-rec-name",prefile, maxgreet, fmtc, 0, vmu, &duration);
 			break;
 		case '4':
+			if (vmu->password[0] == '-') {
+				cmd = play_and_wait(chan, "vm-no");
+				break;
+			}
 			newpassword[1] = '\0';
 			newpassword[0] = cmd = play_and_wait(chan,"vm-newpassword");
 			if (cmd < 0)
@@ -3540,6 +3544,7 @@
 	char *context=NULL;
 	int silentexit = 0;
 	char cid[256]="";
+	char *passptr;
 
 	LOCAL_USER_ADD(u);
 	memset(&vms, 0, sizeof(vms));
@@ -3619,7 +3624,7 @@
 			adsi_password(chan);
 		if (!skipuser)
 			vmu = find_user(&vmus, context, vms.username);
-		if (vmu && vmu->password[0] == '\0') {
+		if (vmu && (vmu->password[0] == '\0' || (vmu->password[0] == '-' && vmu->password[1] == '\0'))) {
 			/* saved password is blank, so don't bother asking */
 			password[0] = '\0';
 		} else {
@@ -3638,7 +3643,11 @@
 			strncat(fullusername, vms.username, sizeof(fullusername) - 1);
 			strncpy(vms.username, fullusername, sizeof(vms.username) - 1);
 		}
-		if (vmu && !strcmp(vmu->password, password)) 
+		if (vmu) {
+			passptr = vmu->password;
+			if (passptr[0] == '-') passptr++;
+		}
+		if (vmu && !strcmp(passptr, password))
 			valid++;
 		else {
 			if (option_verbose > 2)




More information about the svn-commits mailing list