The privacy parser is case sensitive, only accepting lowercase privacy  
values which causes problems for headers such as:

"Privacy: Id"
or
"Privacy: ID"

only
"Privacy: id"
would be accepted.

I've attached a diff that fixes this for trunk.

Also see that in the parser strncmp is used in msg_parser and  
parse_uri at the following locations:

parser # grep strncmp *
msg_parser.h:   if ((len+2<=msg->len) && (strncmp(CRLF,msg- 
 >unparsed,CRLF_LEN)==0) )
parse_uri.c:                            (strncmp(uri->user_param_val.s, 
"phone", 5) == 0)) {
parse_uri.c:                            (strncmp(uri->user_param_val.s, 
"phone", 5) == 0)) {

I think this should be changed to strncasecmp as well. The diff  
doesn't included that.

--
Bayan Towfiq
www.flowroute.com

-- ../../openser-trunk/parser/parse_privacy.c   2008-06-23  
16:11:50.000000000 -0700
+++ parse_privacy.c     2008-07-11 01:24:54.000000000 -0700
@@ -49,9 +49,10 @@
      switch (start[0]) {

      case 'c':
+    case 'C':
        if(max_len < 8)
            return 0;
-       if (strncmp(start, "critical", 8) == 0) {
+       if (strncasecmp(start, "critical", 8) == 0) {
            *value = PRIVACY_CRITICAL;
            len = 8;
            break;
@@ -60,16 +61,17 @@
        }

      case 'h':
+    case 'H':
        if (max_len < 6)
            return 0;
-       if (strncmp(start, "header", 6) == 0) {
+       if (strncasecmp(start, "header", 6) == 0) {
            *value = PRIVACY_HEADER;
            len = 6;
            break;
        }
        if (max_len < 7)
            return 0;
-       if (strncmp(start, "history", 7) == 0) {
+       if (strncasecmp(start, "history", 7) == 0) {
            *value = PRIVACY_HISTORY;
            len = 7;
            break;
@@ -78,9 +80,10 @@
        }

      case 'i':
+    case 'I':
        if(max_len < 2)
            return 0;
-       if (start[1] == 'd') {
+       if (start[1] == 'd' || start[1] == 'D') {
            *value = PRIVACY_ID;
            len = 2;
            break;
@@ -89,9 +92,10 @@
        }

      case 'n':
+    case 'N':
        if(max_len < 4)
            return 0;
-       if (strncmp(start, "none", 4) == 0) {
+       if (strncasecmp(start, "none", 4) == 0) {
            *value = PRIVACY_NONE;
            len = 4;
            break;
@@ -100,9 +104,10 @@
        }

      case 's':
+    case 'S':
        if(max_len < 7)
            return 0;
-       if (strncmp(start, "session", 7) == 0) {
+       if (strncasecmp(start, "session", 7) == 0) {
            *value = PRIVACY_SESSION;
            len = 7;
            break;
@@ -111,9 +116,10 @@
        }

      case 'u':
+    case 'U':
        if(max_len < 4)
            return 0;
-       if (strncmp(start, "user", 4) == 0) {
+       if (strncasecmp(start, "user", 4) == 0) {
            *value = PRIVACY_USER;
            len = 4;
            break;


_______________________________________________
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel

Reply via email to