Don't let you change your password to '#' (bug #3066)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4463 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-12-15 22:49:37 +00:00
parent 6e72bad3af
commit d1956e855d

View File

@@ -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);