[asterisk-bugs] [JIRA] (ASTERISK-24786) [patch] - Asterisk terminates when playing a voicemail stored in LDAP

Graham Barnett (JIRA) noreply at issues.asterisk.org
Fri Feb 20 14:25:34 CST 2015


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

Graham Barnett commented on ASTERISK-24786:
-------------------------------------------

That would potentially solve the problem ... but is very hard to know if it will work in all cases, as the retrieve expects to be iterating the passed 'dir'
as in static int imap_retrieve_file (const char *dir, const int msgnum, const char *mailbox, const char *context);

What you really want to do is init the mailbox to the IMAP folder that corresponds with dir. Otherwise you are relying on other code in a non-obvious manner.

You could split dir into rootPath and relative path (and update vm_state in this way for all 4 folders moving to one root path and 4 relative paths).

What do you think would be safer and better coding?


> [patch] - Asterisk terminates when playing a voicemail stored in LDAP
> ---------------------------------------------------------------------
>
>                 Key: ASTERISK-24786
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24786
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Applications/app_voicemail/IMAP
>    Affects Versions: 13.1.0, 13.2.0
>            Reporter: Graham Barnett
>            Assignee: Graham Barnett
>            Severity: Critical
>         Attachments: app_voicemail.c.patch_terminate
>
>
> Symptom
> # If user has no greetings and user opens mailbox (*97) and tries to play a message, asterisk terminates
> # If user has at least one greeting, playing back a message gives:
> {noformat}
> [14626][C-0000002c]: app_voicemail.c:8677 play_message: No origtime?!
> {noformat}
> Why?
> {code}
> vms_x = get_vm_state_by_imapuser(user, x)
> {code}
> caches existing states by user.
> The states are looked up my imap version, user name, interactive=2 || interactive matches.
> Why does this matter?
> {code}
> int fold = 0;
> vms_p = get_vm_state_by_imapuser(vmu->imapuser, 0);
> if (!vms_p) {
> 		vms_p = get_vm_state_by_mailbox(mailbox, context, 1);
> 	}
> ret = init_mailstream(vms_p, fold);
> {code}
> vs
> {code}
> if (!(vmu = find_user(NULL, context, mailbox))) {
>     RETRIEVE(tempfile, -1, vmu->mailbox, vmu->context);
>     res = imap_retrieve_greeting(dir, msgnum, vmu);
>     if (!(vms_p = get_vm_state_by_mailbox(vmu->mailbox, vmu->context, 1)) && 
>     if (init_mailstream(vms_p, GREETINGS_FOLDER) || !vms_p->mailstream) {
> {code}
> i.e. the mailstream can be left pointed at the GREETINGS and not the Inbox
> And why does that matter?
> {code}
> imap_retrieve_file
> if (!(vms = get_vm_state_by_mailbox(vmu->mailbox, vmu->context, 1)) && !(vms = get_vm_state_by_mailbox(vmu->mailbox, vmu->context, 0))) {
> {code}
> *CAN BE WRONG MAILSTREAM !!!!!*
> {code}
> header_content = mail_fetchheader (vms->mailstream, vms->msgArray[msgnum]);
> {code}
> What is the fix?
> We need to init the mailstream in imap_retrieve_file after getting the vm_state_by_mailbox
> \[Edit: inline patch removed\]
> Will post patch file later.



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



More information about the asterisk-bugs mailing list