aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-23 22:41:27 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-23 22:41:27 +0000
commit8dbeff2dab6d8db8af8cc8ec6a1e200a53e797ac (patch)
treea1a986fcadfa86b636d91046070731d175ebddd9 /apps/app_voicemail.c
parentc29e2a2152f4656c474e00bbce986fb0006b48f5 (diff)
Merged revisions 76708 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r76708 | tilghman | 2007-07-23 17:38:06 -0500 (Mon, 23 Jul 2007) | 4 lines It was our stated intention for 1.4 that files created in app_voicemail should depend upon the umask. Unfortunately, mkstemp() creates files with mode 0600, regardless of the umask. This corrects that deficiency. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@76709 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index de3b72dc5..83c0323bd 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -455,6 +455,8 @@ static char VM_SPOOL_DIR[PATH_MAX];
static char ext_pass_cmd[128];
+int my_umask;
+
#define PWDCHANGE_INTERNAL (1 << 1)
#define PWDCHANGE_EXTERNAL (1 << 2)
static int pwdchange = PWDCHANGE_INTERNAL;
@@ -1988,6 +1990,7 @@ static FILE *vm_mkftemp(char *template)
{
FILE *p = NULL;
int pfd = mkstemp(template);
+ chmod(template, VOICEMAIL_FILE_MODE & ~my_umask);
if (pfd > -1) {
p = fdopen(pfd, "w+");
if (!p) {
@@ -2147,6 +2150,7 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp");
snprintf(newtmp, sizeof(newtmp), "%s/XXXXXX", tmpdir);
tmpfd = mkstemp(newtmp);
+ chmod(newtmp, VOICEMAIL_FILE_MODE & ~my_umask);
ast_debug(3, "newtmp: %s\n", newtmp);
if (tmpfd > -1) {
snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %.4f %s.%s %s.%s", vmu->volgain, attach, format, newtmp, format);
@@ -3227,6 +3231,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
#endif
snprintf(tmptxtfile, sizeof(tmptxtfile), "%s/XXXXXX", tmpdir);
txtdes = mkstemp(tmptxtfile);
+ chmod(tmptxtfile, VOICEMAIL_FILE_MODE & ~my_umask);
if (txtdes < 0) {
res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
if (!res)
@@ -8488,6 +8493,8 @@ static int unload_module(void)
static int load_module(void)
{
int res;
+ my_umask = umask(0);
+ umask(my_umask);
/* compute the location of the voicemail spool directory */
snprintf(VM_SPOOL_DIR, sizeof(VM_SPOOL_DIR), "%s/voicemail/", ast_config_AST_SPOOL_DIR);