- HTTP_VERSION_LEN macrodef. typo fix
... | ... |
@@ -860,7 +860,7 @@ int do_action(struct action* a, struct sip_msg* msg) |
860 | 860 |
|
861 | 861 |
/* If the action is assign then remove the old avp value |
862 | 862 |
* before adding new ones */ |
863 |
-// if ((unsigned char)a->type == ASSIGN_T) delete_avp(flags, name); |
|
863 |
+/* if ((unsigned char)a->type == ASSIGN_T) delete_avp(flags, name); */ |
|
864 | 864 |
if (add_avp(flags & ~AVP_INDEX_ALL, name, value) < 0) { |
865 | 865 |
LOG(L_CRIT, "ERROR: Failed to assign value to attribute\n"); |
866 | 866 |
ret=E_UNSPEC; |
... | ... |
@@ -745,6 +745,8 @@ inline static int comp_avp(int op, avp_spec_t* spec, int rtype, union exp_op* r, |
745 | 745 |
{ |
746 | 746 |
avp_t* avp; |
747 | 747 |
int_str val; |
748 |
+ union exp_op num_val; |
|
749 |
+ str tmp; |
|
748 | 750 |
|
749 | 751 |
if (spec->type & AVP_INDEX_ALL) { |
750 | 752 |
avp = search_first_avp(spec->type & ~AVP_INDEX_ALL, spec->name, NULL, NULL); |
... | ... |
@@ -774,7 +776,30 @@ inline static int comp_avp(int op, avp_spec_t* spec, int rtype, union exp_op* r, |
774 | 776 |
if (avp->flags & AVP_VAL_STR) { |
775 | 777 |
return comp_str(op, &val.s, rtype, r, msg); |
776 | 778 |
} else { |
777 |
- return comp_num(op, val.n, rtype, r); |
|
779 |
+ switch(rtype){ |
|
780 |
+ case NUMBER_ST: |
|
781 |
+ return comp_num(op, val.n, rtype, r); |
|
782 |
+ case STRING_ST: |
|
783 |
+ tmp.s=r->string; |
|
784 |
+ tmp.len=strlen(r->string); |
|
785 |
+ if (str2int(&tmp, (unsigned int*)&num_val.intval)<0){ |
|
786 |
+ LOG(L_ERR, "ERROR: comp_avp: cannot convert string value" |
|
787 |
+ " to int (%s)\n", ZSW(r->string)); |
|
788 |
+ return -1; |
|
789 |
+ } |
|
790 |
+ return comp_num(op, val.n, NUMBER_ST, &num_val); |
|
791 |
+ case STR_ST: |
|
792 |
+ if (str2int(&r->str, (unsigned int*)&num_val.intval)<0){ |
|
793 |
+ LOG(L_ERR, "ERROR: comp_avp: cannot convert str value" |
|
794 |
+ " to int (%.*s)\n", r->str.len, ZSW(r->str.s)); |
|
795 |
+ return -1; |
|
796 |
+ } |
|
797 |
+ return comp_num(op, val.n, NUMBER_ST, &num_val); |
|
798 |
+ default: |
|
799 |
+ LOG(L_CRIT, "BUG: comp_avp: invalid type for numeric avp " |
|
800 |
+ "comparison (%d)\n", rtype); |
|
801 |
+ return -1; |
|
802 |
+ } |
|
778 | 803 |
} |
779 | 804 |
} |
780 | 805 |
|
... | ... |
@@ -795,7 +795,7 @@ int parse_avp_ident( str *name, avp_ident_t* attr) |
795 | 795 |
|
796 | 796 |
attr->index = 0; |
797 | 797 |
DBG("Parsing '%.*s'\n", name->len, name->s); |
798 |
- if (name->len>=2 && name->s[1]==':') { // old fashion i: or s: |
|
798 |
+ if (name->len>=2 && name->s[1]==':') { /* old fashion i: or s: */ |
|
799 | 799 |
WARN("i: and s: avp name syntax is deprecated!\n"); |
800 | 800 |
c = name->s[0]; |
801 | 801 |
name->s += 2; |
... | ... |
@@ -874,7 +874,7 @@ int parse_avp_ident( str *name, avp_ident_t* attr) |
874 | 874 |
goto error; |
875 | 875 |
} |
876 | 876 |
s.s=p+1; |
877 |
- s.len=name->len-(p-name->s)-2; // [ and ] |
|
877 |
+ s.len=name->len-(p-name->s)-2; /* [ and ] */ |
|
878 | 878 |
if (s.len == 0) { |
879 | 879 |
attr->flags |= AVP_INDEX_ALL; |
880 | 880 |
} else { |