[asterisk-bugs] [JIRA] (ASTERISK-13966) voicemail umask / permissions bug

Sverre G (JIRA) noreply at issues.asterisk.org
Tue Oct 11 23:37:01 CDT 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-13966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=232655#comment-232655 ] 

Sverre G commented on ASTERISK-13966:
-------------------------------------

I spent ages on the problem in which voicemail messages had permissions I didn't like and came across this thread once I started digging around in the voicemail.c code. What I discovered is that ~my_umask contains the umask that the asterisk process was started with (often 0644), and when joined with VOICEMAIL_FILE_MODE (0666) the result is the more restrictive mode (0644).

The solution is to modify /usr/bin/safe_asterisk, specifically the line #UMASK=022, uncomment it and change it to UMASK=000 or UMASK=011. This will result in ~my_umask having the value 0777 or 0766, which when merged with 0666 results in 0666 and thus all voicemail files will have permissions of -rw-rw-rw which is much more useful (particularly if you have some third party web based system for listening to and deleting voicemails).

I hope this helps someone so far down the track.

> voicemail umask / permissions bug
> ---------------------------------
>
>                 Key: ASTERISK-13966
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-13966
>             Project: Asterisk
>          Issue Type: Bug
>          Components: Applications/app_voicemail
>            Reporter: Jim Capp
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list