[Devel] Patch: cpl-c bug fix - case insensitive AOR handling

John Riordan john at junctionnetworks.com
Wed Nov 8 17:30:53 CET 2006


Hi,


Issue:

In CPL, during a location lookup, the lookup fails
for users with an '_' in the user portion of the AOR.
For example, if the AOR is user_1 at domain.com, cpl
registration lookup always fail.

Patch:

Use tolower(c) instead of (0x20)|(c) when building
the interpreters copy of the AOR.


John



-------------- next part --------------
Index: sip-server/modules/cpl-c/cpl.c
===================================================================
RCS file: /cvsroot/openser/sip-server/modules/cpl-c/cpl.c,v
retrieving revision 1.13
diff -u -r1.13 cpl.c
--- sip-server/modules/cpl-c/cpl.c	10 Oct 2006 18:45:56 -0000	1.13
+++ sip-server/modules/cpl-c/cpl.c	8 Nov 2006 16:13:25 -0000
@@ -494,7 +494,7 @@
 		/* do we need to strip realm prefix? */
 		if (cpl_env.realm_prefix.len && cpl_env.realm_prefix.len<domain->len){
 			for( i=cpl_env.realm_prefix.len-1 ; i>=0 ; i-- )
-				if ( cpl_env.realm_prefix.s[i]!=((domain->s[i])|(0x20)) )
+				if ( cpl_env.realm_prefix.s[i]!=tolower(domain->s[i]) )
 					break;
 			if (i==-1)
 				do_strip = 1;
@@ -520,13 +520,13 @@
 		p += username->len;
 	} else {
 		for(i=0;i<username->len;i++)
-			*(p++) = (0x20)|(username->s[i]);
+			*(p++) = tolower(username->s[i]);
 	}
 	if (sip || cpl_env.use_domain) {
 		*(p++) = '@';
 		/* host part in lower cases */
 		for( i=do_strip*cpl_env.realm_prefix.len ; i< domain->len ; i++ )
-			*(p++) = (0x20)|(domain->s[i]);
+			*(p++) = tolower(domain->s[i]);
 	}
 	*(p++) = 0;
 


More information about the Devel mailing list