瀏覽代碼

Merge branch 'master' of ssh://git.sip-router.org/sip-router

Jason Penton 11 年之前
父節點
當前提交
3a2b5f5a9f
共有 3 個文件被更改,包括 24 次插入17 次删除
  1. 1 1
      modules/auth_radius/sterman.c
  2. 5 0
      modules/pv/pv_core.c
  3. 18 16
      parser/sdp/sdp_helpr_funcs.c

+ 1 - 1
modules/auth_radius/sterman.c

@@ -409,7 +409,7 @@ int radius_authorize_sterman(struct sip_msg* _msg, dig_cred_t* _cred, str* _meth
                         goto err;
                 }
 #endif 
-		LM_ERR("authorization failed\n");
+		LM_ERR("authorization failed. RC auth returned %d\n", i);
 	}
 
  err:

+ 5 - 0
modules/pv/pv_core.c

@@ -994,6 +994,11 @@ int pv_get_pai(struct sip_msg *msg, pv_param_t *param,
 	}
 
 	pai_body = get_pai(msg);
+	if(pai_body==NULL || pai_body->id==NULL)
+	{
+		LM_DBG("no P-Asserted-Identity header or empty body\n");
+		return pv_get_null(msg, param, res);
+	}
 	pai_uri = &pai_body->id[0];
 	cur_id = 0;
 	i = 0;

+ 18 - 16
parser/sdp/sdp_helpr_funcs.c

@@ -142,6 +142,10 @@ other:
 
 
 
+/**
+ * rfc4566:
+ * a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding parameters>]
+ */
 int extract_rtpmap(str *body,
 	str *rtpmap_payload, str *rtpmap_encoding, str *rtpmap_clockrate, str *rtpmap_parmas)
 {
@@ -179,30 +183,28 @@ int extract_rtpmap(str *body,
 
 	rtpmap_encoding->s = cp;
 	cp1 = (char*)ser_memmem(cp, "/", len, 1);
-	len -= cp1 - cp;
-	if (len <= 0 || cp == cp1) {
-		LM_ERR("invalid encoding in `a=rtpmap'\n");
+	if(cp1==NULL) {
+		LM_ERR("invalid encoding in `a=rtpmap' at [%.*s]\n", len, cp);
 		return -1;
 	}
+	len -= cp1 - cp;
 	rtpmap_encoding->len = cp1 - cp;
 
-	cp = cp1;
+	cp = cp1+1;  /* skip '/' */
+	len--;
+	rtpmap_clockrate->s = cp;
 	cp1 = (char*)ser_memmem(cp, "/", len, 1);
-	len -= cp1 - cp;
-	if (len <= 0) {
-		LM_ERR("invalid encoding in `a=rtpmap:'\n");
-		return -1;
-	}
-
-	rtpmap_clockrate->s = cp + 1; /* skip '/' */
-	rtpmap_clockrate->len = len -1; /* skip '/' */
-	if ( cp == cp1) {
+	if(cp1==NULL) {
+		/* no encoding parameters */
+		rtpmap_clockrate->len = len;
 		rtpmap_parmas->s = NULL;
 		rtpmap_parmas->len = 0;
-	} else {
-		rtpmap_parmas->s = cp1 + 1;
-		rtpmap_parmas->len = cp1 - cp;
+		return 0;
 	}
+	rtpmap_clockrate->len = cp1 - cp;
+	len -= cp1 - cp;
+	rtpmap_parmas->s = cp1 + 1;  /* skip '/' */
+	rtpmap_parmas->len = len - 1;
 	return 0;
 }