From e7c72ccc2f1376d4309bd231aa53b5b86ea27ee6 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Mon, 16 Apr 2007 22:43:29 +0000 Subject: [PATCH] * gpgkeys_curl.c, gpgkeys_ldap.c, gpgkeys_hkp.c, ksutil.c: Rename all str(n)casecmp to ascii_str(n)casecmp. We want the locale-independent ones here. --- keyserver/ChangeLog | 6 ++++++ keyserver/gpgkeys_curl.c | 9 +++++---- keyserver/gpgkeys_hkp.c | 9 +++++---- keyserver/gpgkeys_ldap.c | 33 +++++++++++++++++---------------- keyserver/ksutil.c | 29 +++++++++++++++-------------- 5 files changed, 48 insertions(+), 38 deletions(-) diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog index d34b20696..94ee6b6c5 100644 --- a/keyserver/ChangeLog +++ b/keyserver/ChangeLog @@ -1,3 +1,9 @@ +2007-04-16 David Shaw + + * gpgkeys_curl.c, gpgkeys_ldap.c, gpgkeys_hkp.c, ksutil.c: Rename + all str(n)casecmp to ascii_str(n)casecmp. We want the + locale-independent ones here. + 2007-03-13 David Shaw * gpgkeys_curl.c (main): Use curl_version_info to verify that the diff --git a/keyserver/gpgkeys_curl.c b/keyserver/gpgkeys_curl.c index e326df63c..ca1a621c2 100644 --- a/keyserver/gpgkeys_curl.c +++ b/keyserver/gpgkeys_curl.c @@ -44,6 +44,7 @@ #else #include "curl-shim.h" #endif +#include "compat.h" #include "keyserver.h" #include "ksutil.h" @@ -204,13 +205,13 @@ main(int argc,char *argv[]) option[MAX_OPTION]='\0'; - if(strncasecmp(option,"no-",3)==0) + if(ascii_strncasecmp(option,"no-",3)==0) { no=1; start=&option[3]; } - if(strncasecmp(start,"http-proxy",10)==0) + if(ascii_strncasecmp(start,"http-proxy",10)==0) { /* Safe to not check the return code of strdup() here. If it fails, we simply won't use a proxy. */ @@ -228,7 +229,7 @@ main(int argc,char *argv[]) } } } - else if(strncasecmp(start,"follow-redirects",16)==0) + else if(ascii_strncasecmp(start,"follow-redirects",16)==0) { if(no) follow_redirects=0; @@ -275,7 +276,7 @@ main(int argc,char *argv[]) print a nicer error message. */ curldata=curl_version_info(CURLVERSION_NOW); for(i=0;curldata->protocols[i];i++) - if(strcasecmp(curldata->protocols[i],opt->scheme)==0) + if(ascii_strcasecmp(curldata->protocols[i],opt->scheme)==0) break; if(curldata->protocols[i]==NULL) diff --git a/keyserver/gpgkeys_hkp.c b/keyserver/gpgkeys_hkp.c index 4328a2f53..f93676905 100644 --- a/keyserver/gpgkeys_hkp.c +++ b/keyserver/gpgkeys_hkp.c @@ -1,5 +1,5 @@ /* gpgkeys_hkp.c - talk to an HKP keyserver - * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 + * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, * 2007 Free Software Foundation, Inc. * * This file is part of GnuPG. @@ -45,6 +45,7 @@ #else #include "curl-shim.h" #endif +#include "compat.h" #include "keyserver.h" #include "ksutil.h" @@ -597,13 +598,13 @@ main(int argc,char *argv[]) option[MAX_OPTION]='\0'; - if(strncasecmp(option,"no-",3)==0) + if(ascii_strncasecmp(option,"no-",3)==0) { no=1; start=&option[3]; } - if(strncasecmp(start,"http-proxy",10)==0) + if(ascii_strncasecmp(start,"http-proxy",10)==0) { if(no) { @@ -620,7 +621,7 @@ main(int argc,char *argv[]) } } #if 0 - else if(strcasecmp(start,"try-dns-srv")==0) + else if(ascii_strcasecmp(start,"try-dns-srv")==0) { if(no) http_flags&=~HTTP_FLAG_TRY_SRV; diff --git a/keyserver/gpgkeys_ldap.c b/keyserver/gpgkeys_ldap.c index 1f74d7b35..396d28471 100644 --- a/keyserver/gpgkeys_ldap.c +++ b/keyserver/gpgkeys_ldap.c @@ -1,5 +1,6 @@ /* gpgkeys_ldap.c - talk to a LDAP keyserver - * Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2004, 2005, 2006, + * 2007 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -131,7 +132,7 @@ key_in_keylist(const char *key,struct keylist *list) while(keyptr!=NULL) { - if(strcasecmp(key,keyptr->str)==0) + if(ascii_strcasecmp(key,keyptr->str)==0) return 1; keyptr=keyptr->next; @@ -270,7 +271,7 @@ make_one_attr(LDAPMod ***modlist,char *attr,const char *value) /* Search modlist for the attribute we're playing with. */ for(m=*modlist;*m;m++) { - if(strcasecmp((*m)->mod_type,attr)==0) + if(ascii_strcasecmp((*m)->mod_type,attr)==0) { char **ptr=(*m)->mod_values; int numvalues=0; @@ -1478,9 +1479,9 @@ search_key(const char *searchkey) { /* The LDAP server doesn't exactly handle this well. */ - if(strcasecmp(vals[0],"RSA")==0) + if(ascii_strcasecmp(vals[0],"RSA")==0) fprintf(output,"1"); - else if(strcasecmp(vals[0],"DSS/DH")==0) + else if(ascii_strcasecmp(vals[0],"DSS/DH")==0) fprintf(output,"17"); ldap_value_free(vals); } @@ -1561,7 +1562,7 @@ search_key(const char *searchkey) vals=ldap_get_values(ldap,uids,"pgpcertid"); if(vals!=NULL) { - if(strcasecmp(certid[0],vals[0])==0) + if(ascii_strcasecmp(certid[0],vals[0])==0) { char **uidvals; @@ -1863,25 +1864,25 @@ main(int argc,char *argv[]) optionstr[MAX_OPTION]='\0'; - if(strncasecmp(optionstr,"no-",3)==0) + if(ascii_strncasecmp(optionstr,"no-",3)==0) { no=1; start=&optionstr[3]; } - if(strncasecmp(start,"tls",3)==0) + if(ascii_strncasecmp(start,"tls",3)==0) { if(no) use_tls=0; else if(start[3]=='=') { - if(strcasecmp(&start[4],"no")==0) + if(ascii_strcasecmp(&start[4],"no")==0) use_tls=0; - else if(strcasecmp(&start[4],"try")==0) + else if(ascii_strcasecmp(&start[4],"try")==0) use_tls=1; - else if(strcasecmp(&start[4],"warn")==0) + else if(ascii_strcasecmp(&start[4],"warn")==0) use_tls=2; - else if(strcasecmp(&start[4],"require")==0) + else if(ascii_strcasecmp(&start[4],"require")==0) use_tls=3; else use_tls=1; @@ -1889,7 +1890,7 @@ main(int argc,char *argv[]) else if(start[3]=='\0') use_tls=1; } - else if(strncasecmp(start,"basedn",6)==0) + else if(ascii_strncasecmp(start,"basedn",6)==0) { if(no) { @@ -1911,7 +1912,7 @@ main(int argc,char *argv[]) real_ldap=1; } } - else if(strncasecmp(start,"binddn",6)==0) + else if(ascii_strncasecmp(start,"binddn",6)==0) { if(no) { @@ -1933,7 +1934,7 @@ main(int argc,char *argv[]) real_ldap=1; } } - else if(strncasecmp(start,"bindpw",6)==0) + else if(ascii_strncasecmp(start,"bindpw",6)==0) { if(no) { @@ -1967,7 +1968,7 @@ main(int argc,char *argv[]) goto fail; } - if(strcasecmp(opt->scheme,"ldaps")==0) + if(ascii_strcasecmp(opt->scheme,"ldaps")==0) { port=636; use_ssl=1; diff --git a/keyserver/ksutil.c b/keyserver/ksutil.c index 23dbc8f07..8a439f995 100644 --- a/keyserver/ksutil.c +++ b/keyserver/ksutil.c @@ -1,5 +1,5 @@ /* ksutil.c - general keyserver utility functions - * Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + * Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -42,6 +42,7 @@ #else #include "curl-shim.h" #endif +#include "compat.h" #include "keyserver.h" #include "ksutil.h" @@ -149,13 +150,13 @@ parse_ks_options(char *line,struct ks_options *opt) { command[MAX_COMMAND]='\0'; - if(strcasecmp(command,"get")==0) + if(ascii_strcasecmp(command,"get")==0) opt->action=KS_GET; - else if(strcasecmp(command,"getname")==0) + else if(ascii_strcasecmp(command,"getname")==0) opt->action=KS_GETNAME; - else if(strcasecmp(command,"send")==0) + else if(ascii_strcasecmp(command,"send")==0) opt->action=KS_SEND; - else if(strcasecmp(command,"search")==0) + else if(ascii_strcasecmp(command,"search")==0) opt->action=KS_SEARCH; return 0; @@ -236,13 +237,13 @@ parse_ks_options(char *line,struct ks_options *opt) option[MAX_OPTION]='\0'; - if(strncasecmp(option,"no-",3)==0) + if(ascii_strncasecmp(option,"no-",3)==0) { no=1; start=&option[3]; } - if(strncasecmp(start,"verbose",7)==0) + if(ascii_strncasecmp(start,"verbose",7)==0) { if(no) opt->verbose=0; @@ -251,35 +252,35 @@ parse_ks_options(char *line,struct ks_options *opt) else opt->verbose++; } - else if(strcasecmp(start,"include-disabled")==0) + else if(ascii_strcasecmp(start,"include-disabled")==0) { if(no) opt->flags.include_disabled=0; else opt->flags.include_disabled=1; } - else if(strcasecmp(start,"include-revoked")==0) + else if(ascii_strcasecmp(start,"include-revoked")==0) { if(no) opt->flags.include_revoked=0; else opt->flags.include_revoked=1; } - else if(strcasecmp(start,"include-subkeys")==0) + else if(ascii_strcasecmp(start,"include-subkeys")==0) { if(no) opt->flags.include_subkeys=0; else opt->flags.include_subkeys=1; } - else if(strcasecmp(start,"check-cert")==0) + else if(ascii_strcasecmp(start,"check-cert")==0) { if(no) opt->flags.check_cert=0; else opt->flags.check_cert=1; } - else if(strncasecmp(start,"debug",5)==0) + else if(ascii_strncasecmp(start,"debug",5)==0) { if(no) opt->debug=0; @@ -288,7 +289,7 @@ parse_ks_options(char *line,struct ks_options *opt) else if(start[5]=='\0') opt->debug=1; } - else if(strncasecmp(start,"timeout",7)==0) + else if(ascii_strncasecmp(start,"timeout",7)==0) { if(no) opt->timeout=0; @@ -297,7 +298,7 @@ parse_ks_options(char *line,struct ks_options *opt) else if(start[7]=='\0') opt->timeout=DEFAULT_KEYSERVER_TIMEOUT; } - else if(strncasecmp(start,"ca-cert-file",12)==0) + else if(ascii_strncasecmp(start,"ca-cert-file",12)==0) { if(no) {