aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-05 18:31:50 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-05 18:31:50 +0000
commit03776ef875c9280cf1d9e92934d4bf2fea4e2c44 (patch)
tree8ebf1a0e6645dab4ecb5fa4853626fd1a42ed599
parent4ccdd569ff02e2ecfab3cc38c0de483c5d238d7b (diff)
Fix some small voicemail password bugs (bug #2373)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3727 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xapps/app_voicemail.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 4684e6fed..7a80aa82f 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -589,6 +589,7 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
char tmpin[AST_CONFIG_MAX_PATH];
char tmpout[AST_CONFIG_MAX_PATH];
char *user, *pass, *rest, *trim, *tempcontext;
+ struct stat statbuf;
tempcontext = NULL;
snprintf(tmpin, sizeof(tmpin), "%s/voicemail.conf", ast_config_AST_CONFIG_DIR);
snprintf(tmpout, sizeof(tmpout), "%s/voicemail.conf.new", ast_config_AST_CONFIG_DIR);
@@ -663,7 +664,7 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
/* Compare user, pass AND context */
if (user && *user && !strcmp(user, vmu->mailbox) &&
- pass && *pass && !strcmp(pass, vmu->password) &&
+ pass && !strcmp(pass, vmu->password) &&
currcontext && *currcontext && !strcmp(currcontext, vmu->context)) {
/* This is the line */
if (rest) {
@@ -680,6 +681,9 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
fclose(configin);
fclose(configout);
+ stat((char *)tmpin, &statbuf);
+ chmod((char *)tmpout, statbuf.st_mode);
+ chown((char *)tmpout, statbuf.st_uid, statbuf.st_gid);
unlink((char *)tmpin);
rename((char *)tmpout,(char *)tmpin);
reset_user_pw(vmu->context, vmu->mailbox, newpassword);