[asterisk-commits] tilghman: trunk r76709 - in /trunk: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 23 17:41:28 CDT 2007


Author: tilghman
Date: Mon Jul 23 17:41:27 2007
New Revision: 76709

URL: http://svn.digium.com/view/asterisk?view=rev&rev=76709
Log:
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.

........

Modified:
    trunk/   (props changed)
    trunk/apps/app_voicemail.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=76709&r1=76708&r2=76709
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Mon Jul 23 17:41:27 2007
@@ -454,6 +454,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)
@@ -1988,6 +1990,7 @@
 {
 	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 @@
 			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 @@
 #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 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);




More information about the asterisk-commits mailing list