[asterisk-commits] russell: branch group/security_events r213246 - in /team/group/security_event...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 20 08:26:26 CDT 2009
Author: russell
Date: Thu Aug 20 08:26:22 2009
New Revision: 213246
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213246
Log:
resolve, reset
Modified:
team/group/security_events/ (props changed)
team/group/security_events/apps/app_mixmonitor.c
team/group/security_events/channels/chan_dahdi.c
team/group/security_events/channels/chan_sip.c
team/group/security_events/configs/sip.conf.sample
team/group/security_events/main/alaw.c
team/group/security_events/main/ulaw.c
Propchange: team/group/security_events/
------------------------------------------------------------------------------
automerge = *
Propchange: team/group/security_events/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/group/security_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Aug 20 08:26:22 2009
@@ -1,1 +1,1 @@
-/trunk:1-213062
+/trunk:1-213245
Modified: team/group/security_events/apps/app_mixmonitor.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/apps/app_mixmonitor.c?view=diff&rev=213246&r1=213245&r2=213246
==============================================================================
--- team/group/security_events/apps/app_mixmonitor.c (original)
+++ team/group/security_events/apps/app_mixmonitor.c Thu Aug 20 08:26:22 2009
@@ -404,7 +404,7 @@
/* Setup the actual spy before creating our thread */
if (ast_audiohook_init(&mixmonitor->audiohook, AST_AUDIOHOOK_TYPE_SPY, mixmonitor_spy_type)) {
- ast_free(mixmonitor);
+ mixmonitor_free(mixmonitor);
return;
}
@@ -419,7 +419,7 @@
ast_log(LOG_WARNING, "Unable to add '%s' spy to channel '%s'\n",
mixmonitor_spy_type, chan->name);
ast_audiohook_destroy(&mixmonitor->audiohook);
- ast_free(mixmonitor);
+ mixmonitor_free(mixmonitor);
return;
}
Modified: team/group/security_events/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/channels/chan_dahdi.c?view=diff&rev=213246&r1=213245&r2=213246
==============================================================================
--- team/group/security_events/channels/chan_dahdi.c (original)
+++ team/group/security_events/channels/chan_dahdi.c Thu Aug 20 08:26:22 2009
@@ -4619,6 +4619,7 @@
if (p->mfcr2) {
openr2_calling_party_category_t chancat;
int callres = 0;
+ char *c, *l;
c = strchr(dest, '/');
if (c) {
@@ -5255,7 +5256,7 @@
}
#endif
#ifdef HAVE_OPENR2
- if (p->mfcr2) {
+ if (p->mfcr2 && p->mfcr2call && openr2_chan_get_direction(p->r2chan) != OR2_DIR_STOPPED) {
ast_log(LOG_DEBUG, "disconnecting MFC/R2 call on chan %d\n", p->channel);
/* If it's an incoming call, check the mfcr2_forced_release setting */
if (openr2_chan_get_direction(p->r2chan) == OR2_DIR_BACKWARD && p->mfcr2_forced_release) {
@@ -5268,6 +5269,9 @@
openr2_chan_disconnect_call(p->r2chan, r2cause);
}
dahdi_r2_update_monitor_count(p->mfcr2, 1);
+ } else if (p->mfcr2call) {
+ ast_log(LOG_DEBUG, "Clearing call request on channel %d\n", p->channel);
+ p->mfcr2call = 0;
}
#endif
switch (p->sig) {
@@ -11510,6 +11514,9 @@
tmp->cdrflags |= AST_CDR_CALLWAIT;
break;
}
+#ifdef HAVE_OPENR2
+next:
+#endif
if (backwards) {
p = p->prev;
if (!p)
Modified: team/group/security_events/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/channels/chan_sip.c?view=diff&rev=213246&r1=213245&r2=213246
==============================================================================
--- team/group/security_events/channels/chan_sip.c (original)
+++ team/group/security_events/channels/chan_sip.c Thu Aug 20 08:26:22 2009
@@ -274,6 +274,7 @@
#include "asterisk/stun.h"
#include "asterisk/cel.h"
#include "asterisk/security_events.h"
+#include "asterisk/strings.h"
/*** DOCUMENTATION
<application name="SIPDtmfMode" language="en_US">
@@ -7354,67 +7355,134 @@
enum sip_transport transport = SIP_TRANSPORT_UDP;
char buf[256] = "";
char *username = NULL;
- char *hostname=NULL, *secret=NULL, *authuser=NULL, *expire=NULL, *tmp=NULL;
- char *callback=NULL, *peername=NULL, *regdomain=NULL;
+ char *tmp = NULL, *transport_str = NULL;
+ char *peername = NULL;
+ /* register => [peer?][transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry] */
+ AST_DECLARE_APP_ARGS(parts,
+ AST_APP_ARG(userpart);
+ AST_APP_ARG(hostpart);
+ );
+ AST_DECLARE_APP_ARGS(user1,
+ AST_APP_ARG(userpart);
+ AST_APP_ARG(secret);
+ AST_APP_ARG(authuser);
+ );
+ AST_DECLARE_APP_ARGS(host1,
+ AST_APP_ARG(hostpart);
+ AST_APP_ARG(expiry);
+ );
+ AST_DECLARE_APP_ARGS(host2,
+ AST_APP_ARG(hostpart);
+ AST_APP_ARG(extension);
+ );
+ AST_DECLARE_APP_ARGS(host3,
+ AST_APP_ARG(host);
+ AST_APP_ARG(port);
+ );
+ AST_DECLARE_APP_ARGS(user2,
+ AST_APP_ARG(userpart);
+ AST_APP_ARG(domain);
+ );
if (!value)
return -1;
ast_copy_string(buf, value, sizeof(buf));
- tmp = strrchr(buf, '@');
-
- /* split [/extension][~expiry] */
- expire = strchr(tmp, '~');
- if (expire)
- *expire++ = '\0';
- callback = strrchr(tmp, '/');
- if (callback)
- *callback++ = '\0';
- if (ast_strlen_zero(callback))
- callback = "s";
-
- /* split [peername?][transport://] */
- tmp = strchr(buf, '?');
- if (tmp) {
- *tmp++ = '\0';
- peername = buf;
+
+ /*! register => [peer?][transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry]
+ * becomes
+ * parts.userpart => [peer?][transport://]user[@domain][:secret[:authuser]]
+ * parts.hostpart => host[:port][/extension][~expiry]
+ */
+ AST_NONSTANDARD_RAW_ARGS(parts, buf, '@');
+ /*!
+ * user1.userpart => [peer?][transport://]user[@domain]
+ * user1.secret => secret
+ * user1.authuser => authuser
+ * parts.hostpart => host[:port][/extension][~expiry]
+ */
+ AST_NONSTANDARD_RAW_ARGS(user1, parts.userpart, ':');
+
+ /*!
+ * user1.userpart => [peer?][transport://]user[@domain]
+ * user1.secret => secret
+ * user1.authuser => authuser
+ * host1.hostpart => host[:port][/extension]
+ * host1.expiry => [expiry]
+ */
+ AST_NONSTANDARD_RAW_ARGS(host1, parts.hostpart, '~');
+
+ /*!
+ * user1.userpart => [peer?][transport://]user[@domain]
+ * user1.secret => secret
+ * user1.authuser => authuser
+ * host2.hostpart => host[:port]
+ * host2.extension => [extension]
+ * host1.expiry => [expiry]
+ */
+ AST_NONSTANDARD_RAW_ARGS(host2, parts.hostpart, '/');
+
+ /*!
+ * user1.userpart => [peer?][transport://]user[@domain]
+ * user1.secret => secret
+ * user1.authuser => authuser
+ * host3.host => host
+ * host3.port => port
+ * host2.extension => extension
+ * host1.expiry => expiry
+ */
+ AST_NONSTANDARD_RAW_ARGS(host3, parts.hostpart, ':');
+
+ /*!
+ * user2.userpart => [peer?][transport://]user
+ * user2.domain => domain (regdomain)
+ * user1.secret => secret
+ * user1.authuser => authuser
+ * host3.host => host
+ * host3.port => port
+ * host2.extension => extension (callback)
+ * host1.expiry => expiry
+ */
+ AST_NONSTANDARD_RAW_ARGS(user2, user1.userpart, ':');
+
+ if ((tmp = strchr(user2.userpart, '?'))) {
+ *tmp = '\0';
+ peername = user2.userpart;
+ user2.userpart = tmp + 1;
+ }
+
+ if ((tmp = strstr(user2.userpart, "://"))) {
+ *tmp = '\0';
+ transport_str = user2.userpart;
+ username = tmp + 3;
} else {
- tmp = buf;
- }
- /* tmp is set at the beginning of [transport://] */
- sip_parse_host(tmp, lineno, &username, &portnum, &transport);
-
- /* First split around the last '@' then parse the two components. */
- hostname = strrchr(username, '@'); /* allow @ in the first part */
- if (hostname)
- *hostname++ = '\0';
- if (ast_strlen_zero(username) || ast_strlen_zero(hostname)) {
- ast_log(LOG_WARNING, "Format for registration is [transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry] at line %d\n", lineno);
- return -1;
- }
-
- /* split user[:secret[:authuser]] from the end to allow : character in user portion*/
- authuser = strrchr(username, ':');
- if (authuser) {
- *authuser++ = '\0';
- secret = strrchr(username, ':');
- if (secret)
- *secret++ = '\0';
- else {
- secret = authuser;
- authuser = NULL;
- }
- }
- if ((authuser) && (ast_strlen_zero(authuser)))
- authuser = NULL;
- if ((secret) && (ast_strlen_zero(secret)))
- secret = NULL;
-
- /* The user portion may be of the form username at regdomain so split off any regdomain */
- regdomain = strchr(username, '@');
- if (regdomain) {
- *regdomain++ = '\0';
- }
-
+ username = user2.userpart;
+ }
+
+ if (host3.port) {
+ if (sscanf(host3.port, "%5u", &portnum) != 1 || portnum > 65535) {
+ ast_log(LOG_NOTICE, "'%s' is not a valid port number on line %d of sip.conf. using default.\n", host3.port, lineno);
+ portnum = -1;
+ }
+ }
+
+ if (!transport_str) {
+ transport = SIP_TRANSPORT_UDP;
+ } else if (!strncasecmp(transport_str, "tcp", 3)) {
+ transport = SIP_TRANSPORT_TCP;
+ } else if (!strncasecmp(transport_str, "tls", 3)) {
+ transport = SIP_TRANSPORT_TLS;
+ if (portnum < 0) {
+ portnum = STANDARD_TLS_PORT;
+ }
+ } else if (!strncasecmp(transport_str, "udp", 3)) {
+ transport = SIP_TRANSPORT_UDP;
+ } else {
+ ast_log(LOG_NOTICE, "'%.3s' is not a valid transport type on line %d of sip.conf. defaulting to udp.\n", transport_str, lineno);
+ }
+
+ if (portnum < 0) {
+ portnum = STANDARD_SIP_PORT;
+ }
if (!(reg = ast_calloc(1, sizeof(*reg)))) {
ast_log(LOG_ERROR, "Out of memory. Can't allocate SIP registry entry\n");
@@ -7429,27 +7497,17 @@
ast_atomic_fetchadd_int(®objs, 1);
ASTOBJ_INIT(reg);
- ast_string_field_set(reg, callback, callback);
- if (!ast_strlen_zero(username))
- ast_string_field_set(reg, username, username);
- if (hostname)
- ast_string_field_set(reg, hostname, hostname);
- ast_string_field_set(reg, regdomain, hostname);
- if (regdomain)
- ast_string_field_set(reg, regdomain, regdomain);
- if (authuser)
- ast_string_field_set(reg, authuser, authuser);
- if (secret)
- ast_string_field_set(reg, secret, secret);
- if (peername) {
- ast_string_field_set(reg, peername, peername);
- }
+ ast_string_field_set(reg, callback, ast_strip_quoted(S_OR(host2.extension, ""), "\"", "\""));
+ ast_string_field_set(reg, username, ast_strip_quoted(S_OR(username, ""), "\"", "\""));
+ ast_string_field_set(reg, hostname, ast_strip_quoted(S_OR(host3.host, ""), "\"", "\""));
+ ast_string_field_set(reg, regdomain, ast_strip_quoted(S_OR(user2.domain, S_OR(host3.host, "")), "\"", "\""));
+ ast_string_field_set(reg, authuser, ast_strip_quoted(S_OR(user1.authuser, ""), "\"", "\""));
+ ast_string_field_set(reg, secret, ast_strip_quoted(S_OR(user1.secret, ""), "\"", "\""));
+ ast_string_field_set(reg, peername, ast_strip_quoted(S_OR(peername, ""), "\"", "\""));
+
reg->transport = transport;
- reg->expire = -1;
- reg->configured_expiry = (expire ? atoi(expire) : default_expiry);
- reg->expiry = reg->configured_expiry;
- reg->timeout = -1;
- reg->refresh = reg->expiry;
+ reg->timeout = reg->expire = -1;
+ reg->refresh = reg->expiry = reg->configured_expiry = (host1.expiry ? atoi(ast_strip_quoted(host1.expiry, "\"", "\"")) : default_expiry);
reg->portno = portnum;
reg->callid_valid = FALSE;
reg->ocseq = INITIAL_CSEQ;
@@ -24588,7 +24646,7 @@
char *cat, *stringp, *context, *oldregcontext;
char newcontexts[AST_MAX_CONTEXT], oldcontexts[AST_MAX_CONTEXT];
struct ast_flags dummy[2];
- struct ast_flags config_flags = { reason == CHANNEL_MODULE_LOAD ? 0 : CONFIG_FLAG_FILEUNCHANGED };
+ struct ast_flags config_flags = { reason == CHANNEL_MODULE_LOAD ? 0 : ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS) ? 0 : CONFIG_FLAG_FILEUNCHANGED };
int auto_sip_domains = FALSE;
struct sockaddr_in old_bindaddr = bindaddr;
int registry_count = 0, peer_count = 0;
Modified: team/group/security_events/configs/sip.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/configs/sip.conf.sample?view=diff&rev=213246&r1=213245&r2=213246
==============================================================================
--- team/group/security_events/configs/sip.conf.sample (original)
+++ team/group/security_events/configs/sip.conf.sample Thu Aug 20 08:26:22 2009
@@ -505,7 +505,7 @@
;----------------------------------------- OUTBOUND SIP REGISTRATIONS ------------------------
; Asterisk can register as a SIP user agent to a SIP proxy (provider)
; Format for the register statement is:
-; register => [transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry]
+; register => [peer?][transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry]
;
;
;
Modified: team/group/security_events/main/alaw.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/main/alaw.c?view=diff&rev=213246&r1=213245&r2=213246
==============================================================================
--- team/group/security_events/main/alaw.c (original)
+++ team/group/security_events/main/alaw.c Thu Aug 20 08:26:22 2009
@@ -28,6 +28,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/alaw.h"
+#include "asterisk/logger.h"
#ifndef G711_NEW_ALGORITHM
#define AMI_MASK 0x55
Modified: team/group/security_events/main/ulaw.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/main/ulaw.c?view=diff&rev=213246&r1=213245&r2=213246
==============================================================================
--- team/group/security_events/main/ulaw.c (original)
+++ team/group/security_events/main/ulaw.c Thu Aug 20 08:26:22 2009
@@ -28,6 +28,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/ulaw.h"
+#include "asterisk/logger.h"
#if 0
/* ZEROTRAP is the military recommendation to improve the encryption
More information about the asterisk-commits
mailing list