From 674979e6e2c36377d7709e934896555cb6777ea5 Mon Sep 17 00:00:00 2001 From: markster Date: Wed, 15 Dec 2004 22:49:37 +0000 Subject: Don't let you change your password to '#' (bug #3066) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4463 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_voicemail.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'apps/app_voicemail.c') diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 263388546..5eccd6d40 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -3930,6 +3930,8 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct so they won't get here again */ newpassword[1] = '\0'; newpassword[0] = cmd = ast_play_and_wait(chan,"vm-newpassword"); + if (cmd == '#') + newpassword[0] = '\0'; if (cmd < 0 || cmd == 't' || cmd == '#') return cmd; cmd = ast_readstring(chan,newpassword + strlen(newpassword),sizeof(newpassword)-1,2000,10000,"#"); @@ -3937,6 +3939,8 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct return cmd; newpassword2[1] = '\0'; newpassword2[0] = cmd = ast_play_and_wait(chan,"vm-reenterpassword"); + if (cmd == '#') + newpassword2[0] = '\0'; if (cmd < 0 || cmd == 't' || cmd == '#') return cmd; cmd = ast_readstring(chan,newpassword2 + strlen(newpassword2),sizeof(newpassword2)-1,2000,10000,"#"); @@ -4022,18 +4026,26 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct } newpassword[1] = '\0'; newpassword[0] = cmd = ast_play_and_wait(chan,"vm-newpassword"); - if (cmd < 0) - break; - if ((cmd = ast_readstring(chan,newpassword + strlen(newpassword),sizeof(newpassword)-1,2000,10000,"#")) < 0) { - break; + if (cmd == '#') + newpassword[0] = '\0'; + else { + if (cmd < 0) + break; + if ((cmd = ast_readstring(chan,newpassword + strlen(newpassword),sizeof(newpassword)-1,2000,10000,"#")) < 0) { + break; + } } newpassword2[1] = '\0'; newpassword2[0] = cmd = ast_play_and_wait(chan,"vm-reenterpassword"); - if (cmd < 0) - break; + if (cmd == '#') + newpassword2[0] = '\0'; + else { + if (cmd < 0) + break; - if ((cmd = ast_readstring(chan,newpassword2 + strlen(newpassword2),sizeof(newpassword2)-1,2000,10000,"#"))) { - break; + if ((cmd = ast_readstring(chan,newpassword2 + strlen(newpassword2),sizeof(newpassword2)-1,2000,10000,"#"))) { + break; + } } if (strcmp(newpassword, newpassword2)) { ast_log(LOG_NOTICE,"Password mismatch for user %s (%s != %s)\n", vms->username, newpassword, newpassword2); -- cgit v1.2.3