pg_strcasecmp in fe-connect.c

Started by Magnus Haganderover 19 years ago4 messages
#1Magnus Hagander
mha@sollentuna.net
1 attachment(s)

This patch fixes a couple of cases where we use strcasecmp() instead of
pg_strcasecmp() in fe_connect.c, coming from the LDAP client pathc.

//Magnu <<libpq_strcmp.diff>> s

Attachments:

libpq_strcmp.diffapplication/octet-stream; name=libpq_strcmp.diffDownload
Index: src\interfaces\libpq/fe-connect.c
===================================================================
RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/interfaces/libpq/fe-connect.c,v
retrieving revision 1.334
diff -c -r1.334 fe-connect.c
*** src\interfaces\libpq/fe-connect.c	27 Jul 2006 13:20:24 -0000	1.334
--- src\interfaces\libpq/fe-connect.c	13 Sep 2006 21:29:19 -0000
***************
*** 2411,2417 ****
  	 *	at each component.
  	 */
  
! 	if (strncasecmp(url, LDAP_URL, strlen(LDAP_URL)) != 0)
  	{
  		printfPQExpBuffer(errorMessage,
  		libpq_gettext("bad LDAP URL \"%s\": scheme must be ldap://\n"), purl);
--- 2411,2417 ----
  	 *	at each component.
  	 */
  
! 	if (pg_strncasecmp(url, LDAP_URL, strlen(LDAP_URL)) != 0)
  	{
  		printfPQExpBuffer(errorMessage,
  		libpq_gettext("bad LDAP URL \"%s\": scheme must be ldap://\n"), purl);
***************
*** 2500,2510 ****
  	}
  
  	/* set scope */
! 	if (strcasecmp(scopestr, "base") == 0)
  		scope = LDAP_SCOPE_BASE;
! 	else if (strcasecmp(scopestr, "one") == 0)
  		scope = LDAP_SCOPE_ONELEVEL;
! 	else if (strcasecmp(scopestr, "sub") == 0)
  		scope = LDAP_SCOPE_SUBTREE;
  	else
  	{
--- 2500,2510 ----
  	}
  
  	/* set scope */
! 	if (pg_strcasecmp(scopestr, "base") == 0)
  		scope = LDAP_SCOPE_BASE;
! 	else if (pg_strcasecmp(scopestr, "one") == 0)
  		scope = LDAP_SCOPE_ONELEVEL;
! 	else if (pg_strcasecmp(scopestr, "sub") == 0)
  		scope = LDAP_SCOPE_SUBTREE;
  	else
  	{
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: pg_strcasecmp in fe-connect.c

"Magnus Hagander" <mha@sollentuna.net> writes:

This patch fixes a couple of cases where we use strcasecmp() instead of
pg_strcasecmp() in fe_connect.c, coming from the LDAP client pathc.

Applied. I found another instance in contrib/hstore, too. There are
also some occurrences in pgbench.c, but I'm unsure that we need be
paranoid about changing those.

regards, tom lane

#3Magnus Hagander
mha@sollentuna.net
In reply to: Tom Lane (#2)
Re: [PATCHES] pg_strcasecmp in fe-connect.c

This patch fixes a couple of cases where we use

strcasecmp() instead

of
pg_strcasecmp() in fe_connect.c, coming from the LDAP client pathc.

Applied. I found another instance in contrib/hstore, too.

Ah. msvc builds don't currently build /contrib, that's why I missed that
one.

There are also some occurrences in pgbench.c, but I'm unsure
that we need be paranoid about changing those.

If we ever want to be able to compile it on a platform that doesn't have
strcasecmp() (such as MSVC++), we would, no?

//Magnus

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#3)
Re: [PATCHES] pg_strcasecmp in fe-connect.c

"Magnus Hagander" <mha@sollentuna.net> writes:

There are also some occurrences in pgbench.c, but I'm unsure
that we need be paranoid about changing those.

If we ever want to be able to compile it on a platform that doesn't have
strcasecmp() (such as MSVC++), we would, no?

OK, replaced 'em all.

regards, tom lane