aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-05 19:38:17 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-05 19:38:17 +0000
commitbb4aa74eb5917636575752de11bb55bd38052540 (patch)
treee08f3be5fa953bbe24ad7973a470f3c2e29c4237
parent03776ef875c9280cf1d9e92934d4bf2fea4e2c44 (diff)
Don't prompt for password if one is not needed (bug #2385)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3728 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xapps/app_voicemail.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 7a80aa82f..cf03307b3 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3617,13 +3617,20 @@ static int vm_execmain(struct ast_channel *chan, void *data)
}
if (useadsi)
adsi_password(chan);
- if (ast_streamfile(chan, "vm-password", chan->language)) {
- ast_log(LOG_WARNING, "Unable to stream password file\n");
- goto out;
- }
- if (ast_readstring(chan, password, sizeof(password) - 1, 2000, 10000, "#") < 0) {
- ast_log(LOG_WARNING, "Unable to read password\n");
- goto out;
+ if (!skipuser)
+ vmu = find_user(&vmus, context, vms.username);
+ if (vmu && vmu->password[0] == '\0') {
+ /* saved password is blank, so don't bother asking */
+ password[0] = '\0';
+ } else {
+ if (ast_streamfile(chan, "vm-password", chan->language)) {
+ ast_log(LOG_WARNING, "Unable to stream password file\n");
+ goto out;
+ }
+ if (ast_readstring(chan, password, sizeof(password) - 1, 2000, 10000, "#") < 0) {
+ ast_log(LOG_WARNING, "Unable to read password\n");
+ goto out;
+ }
}
if (prefix) {
char fullusername[80] = "";
@@ -3631,8 +3638,6 @@ static int vm_execmain(struct ast_channel *chan, void *data)
strncat(fullusername, vms.username, sizeof(fullusername) - 1);
strncpy(vms.username, fullusername, sizeof(vms.username) - 1);
}
- if (!skipuser)
- vmu = find_user(&vmus, context, vms.username);
if (vmu && !strcmp(vmu->password, password))
valid++;
else {