[asterisk-commits] twilson: trunk r341381 - in /trunk: ./ channels/ include/asterisk/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Oct 19 02:45:10 CDT 2011
Author: twilson
Date: Wed Oct 19 02:45:06 2011
New Revision: 341381
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=341381
Log:
Don't use is_int() since it doesn't link well on all platforms
Just create an normal API function in strings.h that does the same thing
just to be safe.
........
Merged revisions 341379 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 341380 from http://svn.asterisk.org/svn/asterisk/branches/10
Modified:
trunk/ (props changed)
trunk/channels/chan_sip.c
trunk/include/asterisk/strings.h
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=341381&r1=341380&r2=341381
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Oct 19 02:45:06 2011
@@ -265,7 +265,6 @@
#include "asterisk/data.h"
#include "asterisk/aoc.h"
#include "asterisk/message.h"
-#include "asterisk/pval.h"
#include "sip/include/sip.h"
#include "sip/include/globals.h"
#include "sip/include/config_parser.h"
@@ -5315,7 +5314,7 @@
dialog->relatedpeer = sip_ref_peer(peer, "create_addr: setting dialog's relatedpeer pointer");
sip_unref_peer(peer, "create_addr: unref peer from sip_find_peer hashtab lookup");
return res;
- } else if (is_int(peername)) {
+ } else if (ast_check_digits(peername)) {
/* Although an IPv4 hostname *could* be represented as a 32-bit integer, it is uncommon and
* it makes dialing SIP/${EXTEN} for a peer that isn't defined resolve to an IP that is
* almost certainly not intended. It is much better to just reject purely numeric hostnames */
Modified: trunk/include/asterisk/strings.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/strings.h?view=diff&rev=341381&r1=341380&r2=341381
==============================================================================
--- trunk/include/asterisk/strings.h (original)
+++ trunk/include/asterisk/strings.h Wed Oct 19 02:45:06 2011
@@ -872,6 +872,25 @@
)
/*!
+ * \brief Check if a string is only digits
+ *
+ * \retval 1 The string contains only digits
+ * \retval 0 The string contains non-digit characters
+ */
+AST_INLINE_API(
+int ast_check_digits(char *arg),
+{
+ char *s;
+ for (s=arg; *s; s++) {
+ if (*s < '0' || *s > '9') {
+ return 0;
+ }
+ }
+ return 1;
+}
+)
+
+/*!
* \brief Compute a hash value on a string
*
* This famous hash algorithm was written by Dan Bernstein and is
More information about the asterisk-commits
mailing list