[Asterisk-code-review] pjproject: Configurable setting for cnonce to include hyphens or not (...asterisk[master])

Dan Cropp asteriskteam at digium.com
Wed Aug 21 10:58:04 CDT 2019


Dan Cropp has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/12763


Change subject: pjproject: Configurable setting for cnonce to include hyphens or not
......................................................................

pjproject: Configurable setting for cnonce to include hyphens or not

NEC SIP Station interface with authenticated registration only supports cnonce
up to 32 characters.  In Linux, PJSIP would generate 36 character cnonce
which included hyphens.  Teluu developed this patch adding a compile time
setting to default to not include the hyphens.  They felt it best to still
generate the UUID and strip the hyphens.
They have indicated it will be part of PJSIP 2.10.

ASTERISK-28509
Reported-by: Dan Cropp

Change-Id: Ibdfcf845d4f8c0a14df09fd983b11f2d72c5f470
---
A third-party/pjproject/patches/0020-patch_cnonce_only_digits_option.patch
1 file changed, 53 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/63/12763/1

diff --git a/third-party/pjproject/patches/0020-patch_cnonce_only_digits_option.patch b/third-party/pjproject/patches/0020-patch_cnonce_only_digits_option.patch
new file mode 100644
index 0000000..ecf6c94
--- /dev/null
+++ b/third-party/pjproject/patches/0020-patch_cnonce_only_digits_option.patch
@@ -0,0 +1,53 @@
+Index: pjsip/include/pjsip/sip_config.h
+===================================================================
+--- a/pjsip/include/pjsip/sip_config.h	(revision 6050)
++++ b/pjsip/include/pjsip/sip_config.h	(working copy)
+@@ -1190,6 +1190,20 @@
+ #   define PJSIP_AUTH_CACHED_POOL_MAX_SIZE	(20 * 1024)
+ #endif
+ 
++
++/**
++ * Specify whether the cnonce used for SIP authentication contain digits only.
++ * The "cnonce" value is setup using GUID generator, i.e:
++ * pj_create_unique_string(), and the GUID string may contain hyphen character
++ * ("-"). Some SIP servers do not like this GUID format, so this option will
++ * strip any hyphens from the GUID string.
++ *
++ * Default is 1 (cnonce will only contain digit characters).
++ */
++#ifndef PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY
++#   define PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY	1
++#endif
++
+ /*****************************************************************************
+  *  SIP Event framework and presence settings.
+  */
+Index: pjsip/src/pjsip/sip_auth_client.c
+===================================================================
+--- a/pjsip/src/pjsip/sip_auth_client.c	(revision 6050)
++++ b/pjsip/src/pjsip/sip_auth_client.c	(working copy)
+@@ -396,7 +396,23 @@
+ 
+ 	/* Create cnonce */
+ 	pj_create_unique_string( cached_auth->pool, &cached_auth->cnonce );
++#if defined(PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY) && \
++    PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY!=0
++	if (pj_strchr(&cached_auth->cnonce, '-')) {
++	    /* remove hyphen character. */
++	    int w, r, len = pj_strlen(&cached_auth->cnonce);
++	    char *s = cached_auth->cnonce.ptr;
+ 
++	    w = r = 0;
++	    for (; r < len; r++) {
++		if (s[r] != '-')
++		    s[w++] = s[r];
++	    }
++	    s[w] = '\0';
++	    cached_auth->cnonce.slen = w;
++	}
++#endif
++
+ 	/* Initialize nonce-count */
+ 	cached_auth->nc = 1;
+ 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12763
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ibdfcf845d4f8c0a14df09fd983b11f2d72c5f470
Gerrit-Change-Number: 12763
Gerrit-PatchSet: 1
Gerrit-Owner: Dan Cropp <dan at amtelco.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190821/e51b6d61/attachment-0001.html>


More information about the asterisk-code-review mailing list