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);
/* 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) {
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);