[asterisk-commits] mmichelson: branch 1.4 r91541 - /branches/1.4/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 6 14:25:12 CST 2007


Author: mmichelson
Date: Thu Dec  6 14:25:11 2007
New Revision: 91541

URL: http://svn.digium.com/view/asterisk?view=rev&rev=91541
Log:
IMAP storage did not honor the maxmsg setting in voicemail.conf, and it also had the possibility
of crashing if a user had more than 256 messages in their voicemail. This patch kills two birds with
one stone by adding maxmsg support and also setting a hard limit on the number of messages at 255 so
that the crashes cannot happen.

(closes issue #11101, reported by Skavin, patched by me)


Modified:
    branches/1.4/apps/app_voicemail.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=91541&r1=91540&r2=91541
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Thu Dec  6 14:25:11 2007
@@ -160,7 +160,11 @@
 #define INTRO "vm-intro"
 
 #define MAXMSG 100
+#ifndef IMAP_STORAGE
 #define MAXMSGLIMIT 9999
+#else
+#define MAXMSGLIMIT 255
+#endif
 
 #define BASEMAXINLINE 256
 #define BASELINELEN 72
@@ -2560,6 +2564,10 @@
 	char dest[256];
 	struct vm_state *sendvms = NULL, *destvms = NULL;
 	char messagestring[10]; /*I guess this could be a problem if someone has more than 999999999 messages...*/
+	if(msgnum >= recip->maxmsg) {
+		ast_log(LOG_WARNING, "Unable to copy mail, mailbox %s is full\n", recip->mailbox);
+		return -1;
+	}
 	if(!(sendvms = get_vm_state_by_imapuser(vmu->imapuser, 2)))
 	{
 		ast_log(LOG_ERROR, "Couldn't get vm_state for originator's mailbox!!\n");
@@ -3003,6 +3011,12 @@
 		if (vms->quota_limit && vms->quota_usage >= vms->quota_limit) {
 			if(option_debug)
 				ast_log(LOG_DEBUG, "*** QUOTA EXCEEDED!! %u >= %u\n", vms->quota_usage, vms->quota_limit);
+			ast_play_and_wait(chan, "vm-mailboxfull");
+			return -1;
+		}
+		/* Check if we have exceeded maxmsg */
+		if (msgnum >= vmu->maxmsg) {
+			ast_log(LOG_WARNING, "Unable to leave message since we will exceed the maximum number of messages allowed (%u > %u)\n", msgnum, vmu->maxmsg);
 			ast_play_and_wait(chan, "vm-mailboxfull");
 			return -1;
 		}




More information about the asterisk-commits mailing list