Author: oej
Date: Mon Nov 17 10:40:50 2014
New Revision: 428143

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=428143
Log:
Resolving conflict, resetting automerge

Added:
    team/oej/darjeeling-prack-1.8/contrib/Makefile
      - copied unchanged from r427380, branches/1.8/contrib/Makefile
Modified:
    team/oej/darjeeling-prack-1.8/   (props changed)
    team/oej/darjeeling-prack-1.8/Makefile
    team/oej/darjeeling-prack-1.8/apps/app_voicemail.c
    team/oej/darjeeling-prack-1.8/channels/chan_sip.c
    team/oej/darjeeling-prack-1.8/channels/sip/include/reqresp_parser.h
    team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c
    team/oej/darjeeling-prack-1.8/include/asterisk/stringfields.h
    team/oej/darjeeling-prack-1.8/main/app.c
    team/oej/darjeeling-prack-1.8/main/utils.c

Propchange: team/oej/darjeeling-prack-1.8/
------------------------------------------------------------------------------
    automerge = Is-there-life-off-net?

Propchange: team/oej/darjeeling-prack-1.8/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Nov 17 10:40:50 2014
@@ -1,1 +1,1 @@
-/branches/1.8:1-426494
+/branches/1.8:1-428142

Modified: team/oej/darjeeling-prack-1.8/Makefile
URL: 
http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/Makefile?view=diff&rev=428143&r1=428142&r2=428143
==============================================================================
--- team/oej/darjeeling-prack-1.8/Makefile (original)
+++ team/oej/darjeeling-prack-1.8/Makefile Mon Nov 17 10:40:50 2014
@@ -216,7 +216,7 @@
 _ASTCFLAGS+=$(OPTIONS)
 
 MOD_SUBDIRS:=channels pbx apps codecs formats cdr cel bridges funcs tests main 
res addons $(LOCAL_MOD_SUBDIRS)
-OTHER_SUBDIRS:=utils agi
+OTHER_SUBDIRS:=utils agi contrib
 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
@@ -685,7 +685,7 @@
        rm -f contrib/scripts/asterisk.logrotate.tmp
 
 config:
-       @if [ "${OSARCH}" = "linux-gnu" ]; then \
+       @if [ "${OSARCH}" = "linux-gnu" -o "${OSARCH}" = "kfreebsd-gnu" ]; then 
\
                if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
                        cat contrib/init.d/rc.redhat.asterisk | sed 
's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;'
 > contrib/init.d/rc.asterisk.tmp ; \
                        $(INSTALL) -m 755 contrib/init.d/rc.asterisk.tmp 
"$(DESTDIR)/etc/rc.d/init.d/asterisk" ; \

Modified: team/oej/darjeeling-prack-1.8/apps/app_voicemail.c
URL: 
http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/apps/app_voicemail.c?view=diff&rev=428143&r1=428142&r2=428143
==============================================================================
--- team/oej/darjeeling-prack-1.8/apps/app_voicemail.c (original)
+++ team/oej/darjeeling-prack-1.8/apps/app_voicemail.c Mon Nov 17 10:40:50 2014
@@ -706,7 +706,8 @@
 #ifdef IMAP_STORAGE
        ast_mutex_t lock;
        int updated;                         /*!< decremented on each mail 
check until 1 -allows delay */
-       long msgArray[VMSTATE_MAX_MSG_ARRAY];
+       long *msgArray;
+       unsigned msg_array_max;
        MAILSTREAM *mailstream;
        int vmArrayIndex;
        char imapuser[80];                   /*!< IMAP server login */
@@ -2115,6 +2116,7 @@
                free_user(vmu);
                return -1;
        }
+       ast_assert(msgnum < vms->msg_array_max);
 
        /* check if someone is accessing this box right now... */
        vms_p = get_vm_state_by_imapuser(vmu->imapuser, 1);
@@ -2739,6 +2741,17 @@
        }
 
        ast_debug(3, "saving mailbox message number %lu as message %d. 
Interactive set to %d\n", number, vms->vmArrayIndex, vms->interactive);
+
+       /* Ensure we have room for the next message. */
+       if (vms->vmArrayIndex >= vms->msg_array_max) {
+               long *new_mem = ast_realloc(vms->msgArray, 2 * 
vms->msg_array_max * sizeof(long));
+               if (!new_mem) {
+                       return;
+               }
+               vms->msgArray = new_mem;
+               vms->msg_array_max *= 2;
+       }
+
        vms->msgArray[vms->vmArrayIndex++] = number;
 }
 
@@ -3016,6 +3029,7 @@
        }
        if (option_debug > 4)
                ast_log(AST_LOG_DEBUG, "Adding new vmstate for %s\n", 
vmu->imapuser);
+       /* XXX: Is this correctly freed always? */
        if (!(vms_p = ast_calloc(1, sizeof(*vms_p))))
                return NULL;
        ast_copy_string(vms_p->imapuser, vmu->imapuser, 
sizeof(vms_p->imapuser));
@@ -3128,6 +3142,7 @@
                        vms->newmessages = altvms->newmessages;
                        vms->oldmessages = altvms->oldmessages;
                        vms->vmArrayIndex = altvms->vmArrayIndex;
+                       /* XXX: no msgArray copying? */
                        vms->lastmsg = altvms->lastmsg;
                        vms->curmsg = altvms->curmsg;
                        /* get a pointer to the persistent store */
@@ -3186,10 +3201,14 @@
        
        if (vc) {
                ast_mutex_destroy(&vc->vms->lock);
+               ast_free(vc->vms->msgArray);
+               vc->vms->msgArray = NULL;
+               vc->vms->msg_array_max = 0;
+               /* XXX: is no one supposed to free vms itself? */
                ast_free(vc);
-       }
-       else
+       } else {
                ast_log(AST_LOG_ERROR, "No vmstate found for user:%s, mailbox 
%s\n", vms->imapuser, vms->username);
+       }
 }
 
 static void set_update(MAILSTREAM * stream) 
@@ -3211,11 +3230,13 @@
 
 static void init_vm_state(struct vm_state *vms) 
 {
-       int x;
+       vms->msg_array_max = VMSTATE_MAX_MSG_ARRAY;
+       vms->msgArray = ast_calloc(vms->msg_array_max, sizeof(long));
+       if (!vms->msgArray) {
+               /* Out of mem? This can't be good. */
+               vms->msg_array_max = 0;
+       }
        vms->vmArrayIndex = 0;
-       for (x = 0; x < VMSTATE_MAX_MSG_ARRAY; x++) {
-               vms->msgArray[x] = 0;
-       }
        ast_mutex_init(&vms->lock);
 }
 

Modified: team/oej/darjeeling-prack-1.8/channels/chan_sip.c
URL: 
http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/chan_sip.c?view=diff&rev=428143&r1=428142&r2=428143
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/chan_sip.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/chan_sip.c Mon Nov 17 10:40:50 2014
@@ -21267,6 +21267,8 @@
                }
                break;
 
+       case 414: /* Bad request URI */
+       case 493: /* Undecipherable */
        case 404: /* Not found */
                xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 
FALSE);
                if (p->owner && !req->ignore) {
@@ -21489,12 +21491,16 @@
                ASTOBJ_UNREF(p->mwi, sip_subscribe_mwi_destroy);
                pvt_set_needdestroy(p, "received 481 response");
                break;
+
+       case 400: /* Bad Request */
+       case 414: /* Request URI too long */
+       case 493: /* Undecipherable */
        case 500:
        case 501:
                ast_log(LOG_WARNING, "Subscription failed for MWI. The remote 
side may have suffered a heart attack.\n");
                p->mwi->call = NULL;
                ASTOBJ_UNREF(p->mwi, sip_subscribe_mwi_destroy);
-               pvt_set_needdestroy(p, "received 500/501 response");
+               pvt_set_needdestroy(p, "received serious error 
(500/501/493/414/400) response");
                break;
        }
 }
@@ -21668,11 +21674,14 @@
                }
                manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: 
SIP\r\nUsername: %s\r\nDomain: %s\r\nStatus: %s\r\n", r->username, r->hostname, 
regstate2str(r->regstate));
                break;
-       case 479:       /* SER: Not able to process the URI - address is wrong 
in register*/
-               ast_log(LOG_WARNING, "Got error 479 on register to %s@%s, 
giving up (check config)\n", p->registry->username, p->registry->hostname);
-               pvt_set_needdestroy(p, "received 479 response");
+       case 400:       /* Bad request */
+       case 414:       /* Request URI too long */
+       case 493:       /* Undecipherable */
+       case 479:       /* Kamailio/OpenSIPS: Not able to process the URI - 
address is wrong in register*/
+               ast_log(LOG_WARNING, "Got error %d on register to %s@%s, giving 
up (check config)\n", resp, p->registry->username, p->registry->hostname);
+               pvt_set_needdestroy(p, "received 4xx response");
                if (r->call)
-                       r->call = dialog_unref(r->call, "unsetting 
registry->call pointer-- case 479");
+                       r->call = dialog_unref(r->call, "unsetting 
registry->call pointer-- case 4xx");
                r->regstate = REG_STATE_REJECTED;
                AST_SCHED_DEL_UNREF(sched, r->timeout, registry_unref(r, "reg 
ptr unref from handle_response_register 479"));
                break;
@@ -22141,6 +22150,9 @@
                                pvt_set_needdestroy(p, "received 403 response");
                        }
                        break;
+               case 400: /* Bad Request */
+               case 414: /* Request URI too long */
+               case 493: /* Undecipherable */
                case 404: /* Not found */
                        if (p->registry && sipmethod == SIP_REGISTER)
                                handle_response_register(p, resp, rest, req, 
seqno);
@@ -23420,7 +23432,9 @@
        int reinvite = 0;
        struct ast_party_redirecting redirecting;
        struct ast_set_party_redirecting update_redirecting;
-
+       int supported_start = 0;
+       int require_start = 0;
+       char unsupported[256] = { 0, };
        struct {
                char exten[AST_MAX_EXTENSION];
                char context[AST_MAX_CONTEXT];
@@ -23430,11 +23444,9 @@
 
        /* Find out what they support */
        if (!p->sipoptions) {
-               int start = 0;
                const char *supported = NULL;
-
                do {
-                       supported = __get_header(req, "Supported", &start);
+                       supported = __get_header(req, "Supported", 
&supported_start);
                        if (!ast_strlen_zero(supported)) {
                                p->sipoptions |= parse_sip_options(supported, 
NULL, 0);
                        }
@@ -23442,23 +23454,26 @@
        }
 
        /* Find out what they require */
-       required = get_header(req, "Require");
-       if (!ast_strlen_zero(required)) {
-               char unsupported[256] = { 0, };
-               required_profile = parse_sip_options(required, unsupported, 
ARRAY_LEN(unsupported));
-
-               /* If there are any options required that we do not support,
-                * then send a 420 with only those unsupported options listed */
-               if (!ast_strlen_zero(unsupported)) {
-                       transmit_response_with_unsupported(p, "420 Bad 
extension (unsupported)", req, unsupported);
-                       ast_log(LOG_WARNING, "Received SIP INVITE with 
unsupported required extension: required:%s unsupported:%s\n", required, 
unsupported);
-                       p->invitestate = INV_COMPLETED;
-                       if (!p->lastinvite)
-                               sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
-                       res = 0;
-                       goto request_invite_cleanup;
-               }
-       }
+       do {
+               required = __get_header(req, "Require", &require_start);
+               if (!ast_strlen_zero(required)) {
+                       required_profile |= parse_sip_options(required, 
unsupported, ARRAY_LEN(unsupported));
+               }
+       } while (!ast_strlen_zero(required));
+
+       /* If there are any options required that we do not support,
+        * then send a 420 with only those unsupported options listed */
+       if (!ast_strlen_zero(unsupported)) {
+               transmit_response_with_unsupported(p, "420 Bad extension 
(unsupported)", req, unsupported);
+               ast_log(LOG_WARNING, "Received SIP INVITE with unsupported 
required extension: required:%s unsupported:%s\n", required, unsupported);
+               p->invitestate = INV_COMPLETED;
+               if (!p->lastinvite) {
+                       sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
+               }
+               res = -1;
+               goto request_invite_cleanup;
+       }
+
 
        /* The option tags may be present in Supported: or Require: headers.
        Include the Require: option tags for further processing as well */

Modified: team/oej/darjeeling-prack-1.8/channels/sip/include/reqresp_parser.h
URL: 
http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/sip/include/reqresp_parser.h?view=diff&rev=428143&r1=428142&r2=428143
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/sip/include/reqresp_parser.h 
(original)
+++ team/oej/darjeeling-prack-1.8/channels/sip/include/reqresp_parser.h Mon Nov 
17 10:40:50 2014
@@ -152,6 +152,11 @@
  * \param option list
  * \param unsupported out buffer (optional)
  * \param unsupported out buffer length (optional)
+ *
+ * \note Because this function can be called multiple times, it will append
+ * whatever options are specified in \c options to \c unsupported. Callers
+ * of this function should make sure the unsupported buffer is clear before
+ * calling this function.
  */
 unsigned int parse_sip_options(const char *options, char *unsupported, size_t 
unsupported_len);
 

Modified: team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c
URL: 
http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c?view=diff&rev=428143&r1=428142&r2=428143
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c Mon Nov 17 
10:40:50 2014
@@ -1590,17 +1590,12 @@
        size_t outlen = unsupported_len;
        char *cur_out = out;
 
-       if (out && (outlen > 0)) {
-               memset(out, 0, outlen);
-       }
-
        if (ast_strlen_zero(options) )
                return 0;
 
        temp = ast_strdupa(options);
 
        ast_debug(3, "Begin: parsing SIP \"Required:\" or \"Supported: %s\"\n", 
options);
-
        for (next = temp; next; next = sep) {
                found = FALSE;
                supported = FALSE;
@@ -1760,6 +1755,7 @@
 
        /* Test with unsupported char buffer */
        AST_LIST_TRAVERSE(&testdatalist, testdataptr, list) {
+               memset(unsupported, 0, sizeof(unsupported));
                option_profile = parse_sip_options(testdataptr->input_options, 
unsupported, ARRAY_LEN(unsupported));
                if (option_profile != testdataptr->expected_profile ||
                        strcmp(unsupported, testdataptr->expected_unsupported)) 
{

Modified: team/oej/darjeeling-prack-1.8/include/asterisk/stringfields.h
URL: 
http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/include/asterisk/stringfields.h?view=diff&rev=428143&r1=428142&r2=428143
==============================================================================
--- team/oej/darjeeling-prack-1.8/include/asterisk/stringfields.h (original)
+++ team/oej/darjeeling-prack-1.8/include/asterisk/stringfields.h Mon Nov 17 
10:40:50 2014
@@ -319,14 +319,16 @@
        const char *__d__ = (data);                                             
                                        \
        size_t __dlen__ = (__d__) ? strlen(__d__) + 1 : 1;                      
                                        \
        ast_string_field *__p__ = (ast_string_field *) (ptr);                   
                                        \
+       ast_string_field target = *__p__;                                       
                                        \
        if (__dlen__ == 1) {                                                    
                                        \
                __ast_string_field_release_active((x)->__field_mgr_pool, 
*__p__);                                       \
                *__p__ = __ast_string_field_empty;                              
                                        \
        } else if ((__dlen__ <= AST_STRING_FIELD_ALLOCATION(*__p__)) ||         
                                        \
                   (!__ast_string_field_ptr_grow(&(x)->__field_mgr, 
&(x)->__field_mgr_pool, __dlen__, __p__)) ||        \
-                  (*__p__ = __ast_string_field_alloc_space(&(x)->__field_mgr, 
&(x)->__field_mgr_pool, __dlen__))) {    \
-               if (*__p__ != (*ptr)) {                                         
                                        \
-                       
__ast_string_field_release_active((x)->__field_mgr_pool, (*ptr));               
                \
+                  (target = __ast_string_field_alloc_space(&(x)->__field_mgr, 
&(x)->__field_mgr_pool, __dlen__))) {    \
+               if (target != *__p__) {                                         
                                        \
+                       
__ast_string_field_release_active((x)->__field_mgr_pool, *__p__);               
                \
+                       *__p__ = target;                                        
                                        \
                }                                                               
                                        \
                memcpy(* (void **) __p__, __d__, __dlen__);                     
                                        \
        }                                                                       
                                        \

Modified: team/oej/darjeeling-prack-1.8/main/app.c
URL: 
http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/main/app.c?view=diff&rev=428143&r1=428142&r2=428143
==============================================================================
--- team/oej/darjeeling-prack-1.8/main/app.c (original)
+++ team/oej/darjeeling-prack-1.8/main/app.c Mon Nov 17 10:40:50 2014
@@ -1121,17 +1121,19 @@
                        ast_truncstream(others[x]);
                        ast_closestream(others[x]);
                }
-       }
-
-       if (prepend && outmsg) {
+       } else if (outmsg) {
                struct ast_filestream *realfiles[AST_MAX_FORMATS];
                struct ast_frame *fr;
 
                for (x = 0; x < fmtcnt; x++) {
                        snprintf(comment, sizeof(comment), "Opening the real 
file %s.%s\n", recordfile, sfmt[x]);
                        realfiles[x] = ast_readfile(recordfile, sfmt[x], 
comment, O_RDONLY, 0, 0);
-                       if (!others[x] || !realfiles[x]) {
+                       if (!others[x]) {
                                break;
+                       }
+                       if (!realfiles[x]) {
+                               ast_closestream(others[x]);
+                               continue;
                        }
                        /*!\note Same logic as above. */
                        if (dspsilence) {
@@ -1149,7 +1151,15 @@
                        ast_verb(4, "Recording Format: sfmts=%s, prependfile 
%s, recordfile %s\n", sfmt[x], prependfile, recordfile);
                        ast_filedelete(prependfile, sfmt[x]);
                }
-       }
+       } else {
+               for (x = 0; x < fmtcnt; x++) {
+                       if (!others[x]) {
+                               break;
+                       }
+                       ast_closestream(others[x]);
+               }
+       }
+
        if (rfmt && ast_set_read_format(chan, rfmt)) {
                ast_log(LOG_WARNING, "Unable to restore format %s to channel 
'%s'\n", ast_getformatname(rfmt), chan->name);
        }

Modified: team/oej/darjeeling-prack-1.8/main/utils.c
URL: 
http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/main/utils.c?view=diff&rev=428143&r1=428142&r2=428143
==============================================================================
--- team/oej/darjeeling-prack-1.8/main/utils.c (original)
+++ team/oej/darjeeling-prack-1.8/main/utils.c Mon Nov 17 10:40:50 2014
@@ -1919,9 +1919,13 @@
        for (pool = pool_head, prev = NULL; pool; prev = pool, pool = 
pool->prev) {
                if ((ptr >= pool->base) && (ptr <= (pool->base + pool->size))) {
                        pool->active -= AST_STRING_FIELD_ALLOCATION(ptr);
-                       if ((pool->active == 0) && prev) {
-                               prev->prev = pool->prev;
-                               ast_free(pool);
+                       if (pool->active == 0) {
+                               if (prev) {
+                                       prev->prev = pool->prev;
+                                       ast_free(pool);
+                               } else {
+                                       pool->used = 0;
+                               }
                        }
                        break;
                }
@@ -1964,6 +1968,11 @@
        res = vsnprintf(target, available, format, ap1);
        if (res < 0) {
                /* Are we out of memory? */
+               return;
+       }
+       if (res == 0) {
+               __ast_string_field_release_active(*pool_head, *ptr);
+               *ptr = __ast_string_field_empty;
                return;
        }
        needed = (size_t)res + 1; /* NUL byte */


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to