[asterisk-dev] Asterisk crunches ACLs and umask by default, suggested fix

Ben Klang ben at alkaloid.net
Thu Feb 16 10:32:19 MST 2006

Hello List,

At the suggestion of kpfleming I am writing the list to propose the changes 
detailed in bug 6334.  The problem is that most calls to open() within 
Asterisk use inconsistent and sometimes wacky file mode flags when specifying 
O_CREAT.  The most noticeable result of this are voicemail files that are 
marked 0700 and cannot be overridden with umask or default ACL settings.  As 
this prevents the system administrator from exercising the control normally 
afforded I created this patch.  

This patch adds two defines to include/asterisk.h (AST_FILE_MODE and 
AST_FILE_MODE_EXEC which map to 0666 and 0777 respectively.  These defines 
are called on every open() call I found that specified O_CREAT.  According to 
the manpage the mode is ignored on all open calls that do not flag O_CREAT.  
I considered naming the second AST_DIR_MODE but I felt that the name I gave 
it was more descriptive.    The result of this patch is that newly created 
files respect the umask and ACL settings configured by the systems 

As Kevin rightly pointed out this touches a number of locations within 
Asterisk and should be properly considered.  This patch is running on 3 of my 
systems with no problems.  I welcome any feedback and comments on this patch.

Ben Klang
Alkaloid Networks
ben at alkaloid.net

More information about the asterisk-dev mailing list