Summary:ASTERISK-08964: [Patch] voicemail permissions fixes
Reporter:Patrick Cole (ltd)Labels:
Date Opened:2007-03-07 22:04:12.000-0600Date Closed:2007-07-03 16:27:53
Versions:Frequency of
Environment:Attachments:( 0) ast_1.4.0-fixes.patch
Description:I recently put a voicemail service into production here utilising realtime config lookups from LDAP and SMDI.   In doing so I discovered a few things were needed to make it all work properly.  I've included a patch that you may or may not want to integrate into head.  The patch is against 1.4.0 but mostly applies to 1.4.1 too.

I also had some naggy problems with voicemail file permissions.  ast_play_and_record_full records the message for leave_voicemail, then the files are renamed into the correct folders. The problem here is that  ast_play_and_record doesn't honor VOICEMAIL_FILE_MODE so no matter what I set my umask to, the most I could ever get was the hard coded 0700 permissions used in that function.  

To fix this I changed __ast_play_and_record to accept a file mode parameter.  I also changed ast_play_and_record_full to accept a file mode and made play_record_review pass VOICEMAIL_FILE_MODE to this the mode for this function, hence fixing the problem.   All other wrapper functions that called __ast_play_and_record I changed to pass a new definition called DEFAULT_FILE_MODE.

The other issue is the .txt file saved with voicemail.  It's created using mkstemp() which only creates files with 0600 permissions.  I added a chmod() in there to fix this but I doubt that's the best solution.  It works, anyway.

Comments:By: Patrick Cole (ltd) 2007-03-07 22:58:42.000-0600

I should also note I have been running this patch, so it's tested as best I can.  It's running on my live system.

By: Serge Vecher (serge-v) 2007-03-08 08:32:46.000-0600

Could you please get a disclaimer on file (see bottom of http://bugs.digium.com/main_page.php) and confirm with a note here when done?

By: Patrick Cole (ltd) 2007-03-08 17:17:38.000-0600

I have now faxed the disclaimer in to Digium.

By: Serge Vecher (serge-v) 2007-03-09 08:24:07.000-0600

can you please separate features from the fixes and post "new features" in a separate patch ?

By: Patrick Cole (ltd) 2007-03-09 09:24:05.000-0600

No worries mate I'll do that as soon as I get a chance.  Do you want me to integrate it into HEAD or are 1.4 series patches okay?

By: Patrick Cole (ltd) 2007-03-11 22:36:54

Have added the same patches split into VM fixes and SMDI features.

By: Serge Vecher (serge-v) 2007-03-12 10:03:54

excellent, thank you. Last thing, please post the ast_1.4.0-smdi.patch as a new report. The patch will need to be against trunk. Thanks!

By: Jason Parker (jparker) 2007-07-03 16:27:45

Most of this is already fixed in svn trunk.  The chmod part has not yet been added, and I'll be adding that in a moment.

By: Digium Subversion (svnbot) 2007-07-03 16:27:53

Repository: asterisk
Revision: 73175

r73175 | qwell | 2007-07-03 16:27:52 -0500 (Tue, 03 Jul 2007) | 6 lines

mkstemp doesn't specify a file mode, so we should chmod it to VOICEMAIL_FILE_MODE

Taken from a larger patch by ltd - the rest of which is no longer necessary in trunk.

Closes issue ASTERISK-8964