Multiple revisions 368721,368739,368760,368808

........
  r368721 | kmoore | 2012-06-11 09:11:14 -0500 (Mon, 11 Jun 2012) | 8 lines
  
  Fix compilation in dev-mode
  
  Backport a compilation fix in md5.c from trunk that only showed up in
  dev-mode under certain compiler versions.
  ........
  
  Merged revisions 368719 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r368739 | kmoore | 2012-06-11 10:15:07 -0500 (Mon, 11 Jun 2012) | 10 lines
  
  Fix coverity UNUSED_VALUE findings in core support level files
  
  Most of these were just saving returned values without using them and
  in some cases the variable being saved to could be removed as well.
  
  (issue ASTERISK-19672)
  ........
  
  Merged revisions 368738 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r368760 | rmudgett | 2012-06-11 12:08:50 -0500 (Mon, 11 Jun 2012) | 17 lines
  
  Fix deadlock potential with ast_set_hangupsource() calls.
  
  Calling ast_set_hangupsource() with the channel lock held can result in a
  deadlock because the function also locks the bridged channel.
  
  (issue ASTERISK-19537)
  
  (closes issue AST-891)
  Reported by: Guenther Kelleter
  Tested by: Guenther Kelleter
  
  (closes issue ASTERISK-19801)
  Reported by: Alec Davis
  ........
  
  Merged revisions 368759 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r368808 | mmichelson | 2012-06-12 10:37:38 -0500 (Tue, 12 Jun 2012) | 15 lines
  
  Set the Caller ID "tag" on peers even if remote party information is present.
  
  On incoming calls, we were setting the cid_tag on the dialog only if there was
  no remote party information (Remote-Party-ID or P-Asserted-Identity) present.
  The Caller ID tag is an invented parameter, though, and should be set no matter
  the circumstance.
  
  (closes issue ASTERISK-19859)
  Reported by Thomas Arimont
  (closes issue AST-884)
  Reported by Trey Blancher
  ........
  
  Merged revisions 368807 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 368721,368739,368760,368808 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10-digiumphones@368823 65c4cc65-6c06-0410-ace0-fbb531ad65f3
10-digiumphones
Jason Parker 14 years ago
parent 717f248612
commit cfef0ba38d

@ -475,7 +475,8 @@ static struct ast_config *realtime_directory(char *context)
const char *context = ast_variable_retrieve(rtdata, mailbox, "context");
fullname = ast_variable_retrieve(rtdata, mailbox, "fullname");
if (ast_true((hidefromdir = ast_variable_retrieve(rtdata, mailbox, "hidefromdir")))) {
hidefromdir = ast_variable_retrieve(rtdata, mailbox, "hidefromdir");
if (ast_true(hidefromdir)) {
/* Skip hidden */
continue;
}

@ -2334,7 +2334,7 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
memset(tmpbuf, 0, sizeof(tmpbuf));
for (v = queue_vars; v; v = v->next) {
/* Convert to dashes `-' from underscores `_' as the latter are more SQL friendly. */
if ((tmp = strchr(v->name, '_'))) {
if (strchr(v->name, '_')) {
ast_copy_string(tmpbuf, v->name, sizeof(tmpbuf));
tmp_name = tmpbuf;
tmp = tmpbuf;
@ -4907,10 +4907,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
/* Begin Monitoring */
if (qe->parent->monfmt && *qe->parent->monfmt) {
if (!qe->parent->montype) {
const char *monexec, *monargs;
const char *monexec;
ast_debug(1, "Starting Monitor as requested.\n");
ast_channel_lock(qe->chan);
if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || (monargs = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS"))) {
if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS")) {
which = qe->chan;
monexec = monexec ? ast_strdupa(monexec) : NULL;
}

@ -1629,7 +1629,7 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
for (category = ast_category_browse(cfg, NULL); category; category = ast_category_browse(cfg, category)) {
ast_debug(4, "users.conf: %s\n", category);
if (!strcasecmp(category, vmu->mailbox)) {
if (!(tmp = ast_variable_retrieve(cfg, category, "vmsecret"))) {
if (!ast_variable_retrieve(cfg, category, "vmsecret")) {
ast_debug(3, "looks like we need to make vmsecret!\n");
var = ast_variable_new("vmsecret", newpassword, "");
} else {

@ -8953,13 +8953,18 @@ static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
f = &p->subs[idx].f;
return f;
}
f = dahdi_handle_event(ast);
if (!f) {
const char *name = ast_strdupa(ast->name);
/* tell the cdr this zap device hung up */
if (f == NULL) {
ast_set_hangupsource(ast, ast->name, 0);
/* Tell the CDR this DAHDI device hung up */
ast_mutex_unlock(&p->lock);
ast_channel_unlock(ast);
ast_set_hangupsource(ast, name, 0);
ast_channel_lock(ast);
ast_mutex_lock(&p->lock);
}
return f;
}
@ -14459,14 +14464,13 @@ static char *handle_pri_service_generic(struct ast_cli_entry *e, int cmd, struct
int trunkgroup;
int x, y, fd = a->fd;
int interfaceid = 0;
char *c;
char db_chan_name[20], db_answer[5];
struct dahdi_pvt *tmp;
struct dahdi_pri *pri;
if (a->argc < 5 || a->argc > 6)
return CLI_SHOWUSAGE;
if ((c = strchr(a->argv[4], ':'))) {
if (strchr(a->argv[4], ':')) {
if (sscanf(a->argv[4], "%30d:%30d", &trunkgroup, &channel) != 2)
return CLI_SHOWUSAGE;
if ((trunkgroup < 1) || (channel < 1))

@ -9993,11 +9993,20 @@ static void set_hangup_source_and_cause(int callno, unsigned char causecode)
{
iax2_lock_owner(callno);
if (iaxs[callno] && iaxs[callno]->owner) {
struct ast_channel *owner;
const char *name;
owner = iaxs[callno]->owner;
if (causecode) {
iaxs[callno]->owner->hangupcause = causecode;
owner->hangupcause = causecode;
}
ast_set_hangupsource(iaxs[callno]->owner, iaxs[callno]->owner->name, 0);
ast_channel_unlock(iaxs[callno]->owner);
name = ast_strdupa(owner->name);
ast_channel_ref(owner);
ast_channel_unlock(owner);
ast_mutex_unlock(&iaxsl[callno]);
ast_set_hangupsource(owner, name, 0);
ast_channel_unref(owner);
ast_mutex_lock(&iaxsl[callno]);
}
}

@ -14043,7 +14043,7 @@ static int transmit_refer(struct sip_pvt *p, const char *dest)
ast_log(LOG_NOTICE, "From address missing 'sip(s):', assuming sip:\n");
}
/* Get just the username part */
if ((c = strchr(dest, '@'))) {
if (strchr(dest, '@')) {
c = NULL;
} else if ((c = strchr(of, '@'))) {
*c++ = '\0';
@ -16651,11 +16651,12 @@ static enum check_auth_result check_peer_ok(struct sip_pvt *p, char *of,
}
if (!ast_strlen_zero(peer->cid_name))
ast_string_field_set(p, cid_name, peer->cid_name);
if (!ast_strlen_zero(peer->cid_tag))
ast_string_field_set(p, cid_tag, peer->cid_tag);
if (peer->callingpres)
p->callingpres = peer->callingpres;
}
if (!ast_strlen_zero(peer->cid_tag)) {
ast_string_field_set(p, cid_tag, peer->cid_tag);
}
ast_string_field_set(p, fullcontact, peer->fullcontact);
if (!ast_strlen_zero(peer->context)) {
ast_string_field_set(p, context, peer->context);
@ -20765,6 +20766,41 @@ static void handle_response_publish(struct sip_pvt *p, int resp, const char *res
}
}
/*!
* \internal
* \brief Set hangup source and cause.
*
* \param p SIP private.
* \param cause Hangup cause to queue. Zero if no cause.
*
* \pre p and p->owner are locked.
*
* \return Nothing
*/
static void sip_queue_hangup_cause(struct sip_pvt *p, int cause)
{
struct ast_channel *owner = p->owner;
const char *name = ast_strdupa(owner->name);
/* Cannot hold any channel/private locks when calling. */
ast_channel_ref(owner);
ast_channel_unlock(owner);
sip_pvt_unlock(p);
ast_set_hangupsource(owner, name, 0);
if (cause) {
ast_queue_hangup_with_cause(owner, cause);
} else {
ast_queue_hangup(owner);
}
ast_channel_unref(owner);
/* Relock things. */
owner = sip_pvt_lock_full(p);
if (owner) {
ast_channel_unref(owner);
}
}
/*! \brief Handle SIP response to INVITE dialogue */
static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno)
{
@ -21114,16 +21150,14 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest
xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
ast_log(LOG_WARNING, "Received response: \"Forbidden\" from '%s'\n", sip_get_header(&p->initreq, "From"));
if (!req->ignore && p->owner) {
ast_set_hangupsource(p->owner, p->owner->name, 0);
ast_queue_hangup_with_cause(p->owner, hangup_sip2cause(resp));
sip_queue_hangup_cause(p, hangup_sip2cause(resp));
}
break;
case 404: /* Not found */
xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
if (p->owner && !req->ignore) {
ast_set_hangupsource(p->owner, p->owner->name, 0);
ast_queue_hangup_with_cause(p->owner, hangup_sip2cause(resp));
sip_queue_hangup_cause(p, hangup_sip2cause(resp));
}
break;
@ -24655,11 +24689,10 @@ static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req)
stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */
if (p->owner) {
ast_set_hangupsource(p->owner, p->owner->name, 0);
ast_queue_hangup(p->owner);
}
else
sip_queue_hangup_cause(p, 0);
} else {
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
}
if (ast_str_strlen(p->initreq.data) > 0) {
struct sip_pkt *pkt, *prev_pkt;
/* If the CANCEL we are receiving is a retransmission, and we already have scheduled
@ -24813,8 +24846,7 @@ static int handle_request_bye(struct sip_pvt *p, struct sip_request *req)
ast_queue_hangup_with_cause(p->owner, AST_CAUSE_PROTOCOL_ERROR);
}
} else if (p->owner) {
ast_set_hangupsource(p->owner, p->owner->name, 0);
ast_queue_hangup(p->owner);
sip_queue_hangup_cause(p, 0);
sip_scheddestroy_final(p, DEFAULT_TRANS_TIMEOUT);
ast_debug(3, "Received bye, issuing owner hangup\n");
} else {

@ -3623,7 +3623,18 @@ struct ast_frame *analog_exception(struct analog_pvt *p, struct ast_channel *ast
f = &p->subs[idx].f;
return f;
}
f = __analog_handle_event(p, ast);
if (!f) {
const char *name = ast_strdupa(ast->name);
/* Tell the CDR this DAHDI device hung up */
analog_unlock_private(p);
ast_channel_unlock(ast);
ast_set_hangupsource(ast, name, 0);
ast_channel_lock(ast);
analog_lock_private(p);
}
return f;
}

@ -153,9 +153,9 @@ int sip_acf_channel_read(struct ast_channel *chan, const char *funcname, char *p
}
if (ast_strlen_zero(args.field) || !strcasecmp(args.field, "all")) {
char quality_buf[AST_MAX_USER_FIELD], *quality;
char quality_buf[AST_MAX_USER_FIELD];
if (!(quality = ast_rtp_instance_get_quality(rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
if (!ast_rtp_instance_get_quality(rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf))) {
return -1;
}

@ -1079,7 +1079,7 @@ AST_TEST_DEFINE(get_in_brackets_test)
}
/* Test 6, NULL input */
if ((uri = get_in_brackets(NULL))) {
if (get_in_brackets(NULL)) {
ast_test_status_update(test, "Test 6, NULL input failed.\n");
res = AST_TEST_FAIL;
}

@ -52,9 +52,7 @@ static int set_crypto_policy(struct ast_srtp_policy *policy, int suite_val, cons
static struct sdp_crypto *sdp_crypto_alloc(void)
{
struct sdp_crypto *crypto;
return crypto = ast_calloc(1, sizeof(*crypto));
return ast_calloc(1, sizeof(struct sdp_crypto));
}
void sdp_crypto_destroy(struct sdp_crypto *crypto)

@ -584,7 +584,6 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
AST_APP_ARG(delimiter);
AST_APP_ARG(fieldvalue);
);
const char *ptr;
struct ast_str *orig_list = ast_str_thread_get(&tmp_buf, 16);
const char *begin, *cur, *next;
int dlen, flen, first = 1;
@ -624,7 +623,7 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
}
/* If the string isn't there, just copy out the string and be done with it. */
if (!(ptr = strstr(ast_str_buffer(orig_list), args.fieldvalue))) {
if (!strstr(ast_str_buffer(orig_list), args.fieldvalue)) {
if (buf) {
ast_copy_string(buf, ast_str_buffer(orig_list), len);
} else {

@ -1474,6 +1474,8 @@ void ast_channel_clear_softhangup(struct ast_channel *chan, int flag);
* \param source a string describing the source of the hangup for this channel
* \param force
*
* \note Absolutely _NO_ channel locks should be held before calling this function.
*
* \since 1.8
*
* Hangupsource is generally the channel name that caused the bridge to be

@ -2773,12 +2773,18 @@ void ast_set_hangupsource(struct ast_channel *chan, const char *source, int forc
ast_string_field_set(chan, hangupsource, source);
}
bridge = ast_bridged_channel(chan);
if (bridge) {
ast_channel_ref(bridge);
}
ast_channel_unlock(chan);
if (bridge && (force || ast_strlen_zero(bridge->hangupsource))) {
if (bridge) {
ast_channel_lock(bridge);
ast_string_field_set(chan, hangupsource, source);
if (force || ast_strlen_zero(bridge->hangupsource)) {
ast_string_field_set(bridge, hangupsource, source);
}
ast_channel_unlock(bridge);
ast_channel_unref(bridge);
}
}

@ -1072,13 +1072,13 @@ int load_modules(unsigned int preload_only)
if (mod->flags.running)
continue;
order = add_to_load_order(mod->resource, &load_order, 0);
add_to_load_order(mod->resource, &load_order, 0);
}
#ifdef LOADABLE_MODULES
/* if we are allowed to load dynamic modules, scan the directory for
for all available modules and add them as well */
if ((dir = opendir(ast_config_AST_MODULE_DIR))) {
if ((dir = opendir(ast_config_AST_MODULE_DIR))) {
while ((dirent = readdir(dir))) {
int ld = strlen(dirent->d_name);

@ -123,6 +123,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
{
unsigned count;
unsigned char *p;
uint32_t *in_buf;
/* Compute number of bytes mod 64 */
count = (ctx->bits[0] >> 3) & 0x3F;
@ -151,8 +152,9 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
((uint32_t *) ctx->in)[14] = ctx->bits[0];
((uint32_t *) ctx->in)[15] = ctx->bits[1];
in_buf = (uint32_t *) ctx->in;
in_buf[14] = ctx->bits[0];
in_buf[15] = ctx->bits[1];
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);

@ -1913,7 +1913,7 @@ static void powiedz(struct ast_channel *chan, const char *language, int audiofd,
char *b = buf;
b = pl_append(b, odm->dziesiatki[m100 / 10]);
b = pl_append(b, odm->separator_dziesiatek);
b = pl_append(b, odm->cyfry2[m100 % 10]);
pl_append(b, odm->cyfry2[m100 % 10]);
pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, buf);
}
}

@ -1358,10 +1358,10 @@ static void __ast_udptl_reload(int reload)
ast_log(LOG_WARNING, "Disabling UDPTL checksums is not supported on this operating system!\n");
#endif
}
if ((s = ast_variable_retrieve(cfg, "general", "T38FaxUdpEC"))) {
if (ast_variable_retrieve(cfg, "general", "T38FaxUdpEC")) {
ast_log(LOG_WARNING, "T38FaxUdpEC in udptl.conf is no longer supported; use the t38pt_udptl configuration option in sip.conf instead.\n");
}
if ((s = ast_variable_retrieve(cfg, "general", "T38FaxMaxDatagram"))) {
if (ast_variable_retrieve(cfg, "general", "T38FaxMaxDatagram")) {
ast_log(LOG_WARNING, "T38FaxMaxDatagram in udptl.conf is no longer supported; value is now supplied by T.38 applications.\n");
}
if ((s = ast_variable_retrieve(cfg, "general", "UDPTLFECEntries"))) {

@ -1481,7 +1481,7 @@ static int pbx_load_config(const char *config_file)
}
} else if (!strcasecmp(v->name, "exten")) {
int ipri;
char *plus, *firstp;
char *plus;
char *pri, *appl, *data, *cidmatch;
if (!(stringp = tc = ast_strdup(v->value))) {
@ -1551,7 +1551,7 @@ process_extension:
}
appl = S_OR(stringp, "");
/* Find the first occurrence of '(' */
if (!(firstp = strchr(appl, '('))) {
if (!strchr(appl, '(')) {
/* No arguments */
data = "";
} else {

@ -518,7 +518,7 @@ static int update_odbc(const char *database, const char *table, const char *keyf
}
va_arg(aq, const char *);
if (tableptr && !(column = ast_odbc_find_column(tableptr, newparam))) {
if (tableptr && !ast_odbc_find_column(tableptr, newparam)) {
ast_log(LOG_WARNING, "Key field '%s' does not exist in table '%s@%s'. Update will fail\n", newparam, table, database);
}
@ -587,7 +587,6 @@ static SQLHSTMT update2_prepare(struct odbc_obj *obj, void *data)
SQLHSTMT stmt;
va_list ap;
struct odbc_cache_tables *tableptr = ast_odbc_find_table(ups->database, ups->table);
struct odbc_cache_columns *column;
if (!sql) {
if (tableptr) {
@ -619,7 +618,7 @@ static SQLHSTMT update2_prepare(struct odbc_obj *obj, void *data)
while ((newparam = va_arg(ap, const char *))) {
newval = va_arg(ap, const char *);
if ((column = ast_odbc_find_column(tableptr, newparam))) {
if (ast_odbc_find_column(tableptr, newparam)) {
ast_str_append(&sql, 0, "%s%s=? ", first ? "" : ", ", newparam);
SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(newval), 0, (void *)newval, 0, NULL);
first = 0;
@ -637,7 +636,7 @@ static SQLHSTMT update2_prepare(struct odbc_obj *obj, void *data)
while ((newparam = va_arg(ap, const char *))) {
newval = va_arg(ap, const char *);
if (!(column = ast_odbc_find_column(tableptr, newparam))) {
if (!ast_odbc_find_column(tableptr, newparam)) {
va_end(ap);
ast_log(LOG_ERROR, "One or more of the criteria columns '%s' on '%s@%s' for this update does not exist!\n", newparam, ups->table, ups->database);
ast_odbc_release_table(tableptr);

@ -555,7 +555,7 @@ static int update_modem_bits(enum ast_fax_modems *bits, const char *value)
char *m[5], *tok, *v = (char *)value;
int i = 0, j;
if (!(tok = strchr(v, ','))) {
if (!strchr(v, ',')) {
m[i++] = v;
m[i] = NULL;
} else {

@ -1632,7 +1632,7 @@ static int acf_transaction_write(struct ast_channel *chan, const char *cmd, char
pbx_builtin_setvar_helper(chan, "ODBC_RESULT", "INVALID_DB");
return -1;
}
if (!(tx = find_transaction(chan, obj, value, 0))) {
if (!find_transaction(chan, obj, value, 0)) {
pbx_builtin_setvar_helper(chan, "ODBC_RESULT", "FAILED_TO_CREATE");
return -1;
}

@ -276,7 +276,6 @@ int ast_speech_change_results_type(struct ast_speech *speech, enum ast_speech_re
/*! \brief Register a speech recognition engine */
int ast_speech_register(struct ast_speech_engine *engine)
{
struct ast_speech_engine *existing_engine = NULL;
int res = 0;
/* Confirm the engine meets the minimum API requirements */
@ -286,7 +285,7 @@ int ast_speech_register(struct ast_speech_engine *engine)
}
/* If an engine is already loaded with this name, error out */
if ((existing_engine = find_engine(engine->name))) {
if (find_engine(engine->name)) {
ast_log(LOG_WARNING, "Speech recognition engine '%s' already exists.\n", engine->name);
return -1;
}

Loading…
Cancel
Save