[asterisk-dev] bug in app_voicemail.c
Jim Capp
jcapp at anteil.com
Thu Apr 16 09:59:43 CDT 2009
Folks,
There is a bug in app_voicemail.c that causes weird things to happen
with file permissions. I have submitted complete information, as well
as a patch, in bugs.digium.com, ID 0014912. This affects all versions
of Asterisk and has a very simple fix.
See attached.
Cheers,
Jim
The voicemail application has a bug where, depending on how it is
compiled, it doesn't retain the umask value that is read upon module
load. This is the real source of the problem related to issues 0009231
and 0007504.
The problem is that since my_umask is not declared static, compilers are
not required to persist its value. As such, some highly optimized
compilers will assign it a cpu register rather than variable space on
the stack. Since my_umask is only set during module load, subsequent
uses of my_umask are unreliable as the register will surely have been
overwritten prior to its next use.
What made this difficult to diagnose was that the values seemed
reasonably close to real umask values, as the functions prior to its use
were related to the loading of the mask constant VOICEMAIL_FILE_MODE 0666.
The solution is simply to make my_umask static in app_voicemail.c
From what I can tell, this applies to ALL versions of app_voicemail.c
including the latest 1.4 and 1.6 branches.
Here is an appropriate patch:
--- app_voicemail-orig.c 2009-04-16 10:27:43.000000000 -0400
+++ app_voicemail.c 2009-04-16 10:28:19.000000000 -0400
@@ -661,7 +661,7 @@
static char ext_pass_cmd[128];
static char ext_pass_check_cmd[128];
-int my_umask;
+static int my_umask;
#define PWDCHANGE_INTERNAL (1 << 1)
#define PWDCHANGE_EXTERNAL (1 << 2)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20090416/b632cfe9/attachment.htm
More information about the asterisk-dev
mailing list