From 8a987daf3b64ab00dbfd08cdae48907966b8d22a Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 15 Dec 2004 23:05:28 +0000 Subject: [PATCH] don't allow '#' as a voicemail password (bug #3066) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4465 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_voicemail.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index c5c06ca690..ae2726aa6a 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -3124,19 +3124,24 @@ 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 = ast_readstring(chan,newpassword2 + strlen(newpassword2),sizeof(newpassword2)-1,2000,10000,"#"))) { - 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 (strcmp(newpassword, newpassword2)) { ast_log(LOG_NOTICE,"Password mismatch for user %s (%s != %s)\n", vms->username, newpassword, newpassword2); cmd = ast_play_and_wait(chan, "vm-mismatch"); -- 2.47.2