summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-10-22 23:38:20 +0000
committerJeremy Allison <jra@samba.org>2003-10-22 23:38:20 +0000
commitbb0598faf58679a7ad26a1caab8eadb154a07ae2 (patch)
treebeee6b610df4ad7660cb174c86773bd9c747682c /source3/lib
parent3531647574ba61ce69969c501fbc82937a4d4dfa (diff)
downloadsamba-bb0598faf58679a7ad26a1caab8eadb154a07ae2.tar.gz
samba-bb0598faf58679a7ad26a1caab8eadb154a07ae2.tar.bz2
samba-bb0598faf58679a7ad26a1caab8eadb154a07ae2.zip
Put strcasecmp/strncasecmp on the banned list (except for needed calls
in iconv.c and nsswitch/). Using them means you're not thinking about multibyte at all and I really want to discourage that. Jeremy. (This used to be commit d7e35dfb9283d560d0ed2ab231f36ed92767dace)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/access.c20
-rw-r--r--source3/lib/charcnv.c2
-rw-r--r--source3/lib/iconv.c6
-rw-r--r--source3/lib/smbldap.c4
-rw-r--r--source3/lib/substitute.c4
-rw-r--r--source3/lib/util_sock.c4
6 files changed, 23 insertions, 17 deletions
diff --git a/source3/lib/access.c b/source3/lib/access.c
index a874c8b1e2..62414726fb 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -71,7 +71,7 @@ static BOOL string_match(const char *tok,const char *s, char *invalid_char)
if (tok[0] == '.') { /* domain: match last fields */
if ((str_len = strlen(s)) > (tok_len = strlen(tok))
- && strcasecmp(tok, s + str_len - tok_len) == 0)
+ && strequal(tok, s + str_len - tok_len))
return (True);
} else if (tok[0] == '@') { /* netgroup: look it up */
#ifdef HAVE_NETGROUP
@@ -107,14 +107,14 @@ static BOOL string_match(const char *tok,const char *s, char *invalid_char)
DEBUG(0,("access: netgroup support is not configured\n"));
return (False);
#endif
- } else if (strcasecmp(tok, "ALL") == 0) { /* all: match any */
+ } else if (strequal(tok, "ALL")) { /* all: match any */
return (True);
- } else if (strcasecmp(tok, "FAIL") == 0) { /* fail: match any */
+ } else if (strequal(tok, "FAIL")) { /* fail: match any */
return (FAIL);
- } else if (strcasecmp(tok, "LOCAL") == 0) { /* local: no dots */
- if (strchr_m(s, '.') == 0 && strcasecmp(s, "unknown") != 0)
+ } else if (strequal(tok, "LOCAL")) { /* local: no dots */
+ if (strchr_m(s, '.') == 0 && !strequal(s, "unknown"))
return (True);
- } else if (!strcasecmp(tok, s)) { /* match host name or address */
+ } else if (!strequal(tok, s)) { /* match host name or address */
return (True);
} else if (tok[(tok_len = strlen(tok)) - 1] == '.') { /* network */
if (strncmp(tok, s, tok_len) == 0)
@@ -175,7 +175,7 @@ static BOOL list_match(const char **list,const char *item,
*/
for (; *list ; list++) {
- if (strcasecmp(*list, "EXCEPT") == 0) /* EXCEPT: give up */
+ if (strequal(*list, "EXCEPT")) /* EXCEPT: give up */
break;
if ((match = (*match_fn) (*list, item))) /* True or FAIL */
break;
@@ -183,7 +183,7 @@ static BOOL list_match(const char **list,const char *item,
/* Process exceptions to True or FAIL matches. */
if (match != False) {
- while (*list && strcasecmp(*list, "EXCEPT"))
+ while (*list && !strequal(*list, "EXCEPT"))
list++;
for (; *list; list++) {
@@ -275,8 +275,8 @@ static BOOL only_ipaddrs_in_list(const char** list)
for (; *list ; list++) {
/* factor out the special strings */
- if (!strcasecmp(*list, "ALL") || !strcasecmp(*list, "FAIL") ||
- !strcasecmp(*list, "EXCEPT")) {
+ if (strequal(*list, "ALL") || strequal(*list, "FAIL") ||
+ strequal(*list, "EXCEPT")) {
continue;
}
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index dafc88fb77..9d15c6daa0 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -56,7 +56,7 @@ static const char *charset_name(charset_t ch)
else if (ch == CH_UTF8) ret = "UTF8";
#if defined(HAVE_NL_LANGINFO) && defined(CODESET)
- if (ret && strcasecmp(ret, "LOCALE") == 0) {
+ if (ret && !strcmp(ret, "LOCALE")) {
const char *ln = NULL;
#ifdef HAVE_SETLOCALE
diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c
index 0326ca7061..9f6db79ee2 100644
--- a/source3/lib/iconv.c
+++ b/source3/lib/iconv.c
@@ -21,6 +21,12 @@
#include "includes.h"
+/*
+ * We have to use strcasecmp here as the character conversions
+ * haven't been initialised yet. JRA.
+ */
+
+#undef strcasecmp
/**
* @file
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index 781e6b976c..8f58e80dde 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -350,7 +350,7 @@ BOOL fetch_ldap_pw(char **dn, char** pw)
}
for (i = 0; mods[i] != NULL; ++i) {
- if (mods[i]->mod_op == modop && !strcasecmp(mods[i]->mod_type, attribute))
+ if (mods[i]->mod_op == modop && strequal(mods[i]->mod_type, attribute))
break;
}
@@ -542,7 +542,7 @@ static int smbldap_open_connection (struct smbldap_state *ldap_state)
SMB_ASSERT(sizeof(protocol)>10 && sizeof(host)>254);
/* skip leading "URL:" (if any) */
- if ( strncasecmp( p, "URL:", 4 ) == 0 ) {
+ if ( strnequal( p, "URL:", 4 ) ) {
p += 4;
}
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index 28466e43f2..6e546bc161 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -45,10 +45,10 @@ void set_local_machine_name(const char* local_name, BOOL perm)
* arrggg!!!
*/
- if (strcasecmp(local_name, "*SMBSERVER")==0)
+ if (strequal(local_name, "*SMBSERVER"))
return;
- if (strcasecmp(local_name, "*SMBSERV")==0)
+ if (strequal(local_name, "*SMBSERV"))
return;
if (already_perm)
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 5a1f631ba4..eb19caa31b 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -837,8 +837,8 @@ static BOOL matchname(char *remotehost,struct in_addr addr)
* DNS is perverted). We always check the address list, though.
*/
- if (strcasecmp(remotehost, hp->h_name)
- && strcasecmp(remotehost, "localhost")) {
+ if (!strequal(remotehost, hp->h_name)
+ && !strequal(remotehost, "localhost")) {
DEBUG(0,("host name/name mismatch: %s != %s\n",
remotehost, hp->h_name));
return False;