Fix some small voicemail password bugs (bug #2373)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
f83715ce9c
commit
e94fa076cb
|
@ -589,6 +589,7 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
|
||||||
char tmpin[AST_CONFIG_MAX_PATH];
|
char tmpin[AST_CONFIG_MAX_PATH];
|
||||||
char tmpout[AST_CONFIG_MAX_PATH];
|
char tmpout[AST_CONFIG_MAX_PATH];
|
||||||
char *user, *pass, *rest, *trim, *tempcontext;
|
char *user, *pass, *rest, *trim, *tempcontext;
|
||||||
|
struct stat statbuf;
|
||||||
tempcontext = NULL;
|
tempcontext = NULL;
|
||||||
snprintf(tmpin, sizeof(tmpin), "%s/voicemail.conf", ast_config_AST_CONFIG_DIR);
|
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);
|
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 */
|
/* Compare user, pass AND context */
|
||||||
if (user && *user && !strcmp(user, vmu->mailbox) &&
|
if (user && *user && !strcmp(user, vmu->mailbox) &&
|
||||||
pass && *pass && !strcmp(pass, vmu->password) &&
|
pass && !strcmp(pass, vmu->password) &&
|
||||||
currcontext && *currcontext && !strcmp(currcontext, vmu->context)) {
|
currcontext && *currcontext && !strcmp(currcontext, vmu->context)) {
|
||||||
/* This is the line */
|
/* This is the line */
|
||||||
if (rest) {
|
if (rest) {
|
||||||
|
@ -680,6 +681,9 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
|
||||||
fclose(configin);
|
fclose(configin);
|
||||||
fclose(configout);
|
fclose(configout);
|
||||||
|
|
||||||
|
stat((char *)tmpin, &statbuf);
|
||||||
|
chmod((char *)tmpout, statbuf.st_mode);
|
||||||
|
chown((char *)tmpout, statbuf.st_uid, statbuf.st_gid);
|
||||||
unlink((char *)tmpin);
|
unlink((char *)tmpin);
|
||||||
rename((char *)tmpout,(char *)tmpin);
|
rename((char *)tmpout,(char *)tmpin);
|
||||||
reset_user_pw(vmu->context, vmu->mailbox, newpassword);
|
reset_user_pw(vmu->context, vmu->mailbox, newpassword);
|
||||||
|
|
Loading…
Reference in New Issue