summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/auth/auth_builtin.c2
-rw-r--r--source3/include/safe_string.h14
-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
-rw-r--r--source3/libads/ads_struct.c4
-rw-r--r--source3/libads/ldap.c6
-rw-r--r--source3/libsmb/namequery_dc.c2
-rw-r--r--source3/msdfs/msdfs.c6
-rw-r--r--source3/nmbd/nmbd_elections.c2
-rw-r--r--source3/nsswitch/winbindd_rpc.c2
-rw-r--r--source3/nsswitch/winbindd_util.c8
-rw-r--r--source3/param/loadparm.c2
-rw-r--r--source3/passdb/pdb_ldap.c2
-rw-r--r--source3/passdb/pdb_smbpasswd.c2
-rw-r--r--source3/smbd/mangle_hash2.c2
-rw-r--r--source3/smbd/sesssetup.c2
-rw-r--r--source3/smbwrapper/smbw_dir.c4
-rw-r--r--source3/torture/mangle_test.c2
-rw-r--r--source3/utils/net.c8
-rw-r--r--source3/utils/smbcquotas.c14
-rw-r--r--source3/web/cgi.c22
25 files changed, 83 insertions, 63 deletions
diff --git a/source3/auth/auth_builtin.c b/source3/auth/auth_builtin.c
index f7cdfe3fd2..96c2221652 100644
--- a/source3/auth/auth_builtin.c
+++ b/source3/auth/auth_builtin.c
@@ -86,7 +86,7 @@ static NTSTATUS check_name_to_ntstatus_security(const struct auth_context *auth_
long error_num;
fstrcpy(user, user_info->smb_name.str);
- if (strncasecmp("NT_STATUS", user, strlen("NT_STATUS")) == 0) {
+ if (strnequal("NT_STATUS", user, strlen("NT_STATUS"))) {
strupper_m(user);
return nt_status_string_to_code(user);
}
diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h
index 07578b2424..cb3f37c484 100644
--- a/source3/include/safe_string.h
+++ b/source3/include/safe_string.h
@@ -47,6 +47,20 @@
#endif /* sprintf */
#define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
+/*
+ * strcasecmp/strncasecmp aren't an error, but it means you're not thinking about
+ * multibyte. Don't use them. JRA.
+ */
+#ifdef strcasecmp
+#undef strcasecmp
+#endif
+#define strcasecmp __ERROR__XX__NEVER_USE_STRCASECMP__;
+
+#ifdef strncasecmp
+#undef strncasecmp
+#endif
+#define strncasecmp __ERROR__XX__NEVER_USE_STRCASECMP__;
+
#endif /* !_SPLINT_ */
#ifdef DEVELOPER
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;
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
index dd31439d83..9774968e12 100644
--- a/source3/libads/ads_struct.c
+++ b/source3/libads/ads_struct.c
@@ -95,10 +95,10 @@ ADS_STRUCT *ads_init(const char *realm,
ads->server.ldap_server = ldap_server? strdup(ldap_server) : NULL;
/* we need to know if this is a foreign realm */
- if (realm && *realm && strcasecmp(lp_realm(), realm) != 0) {
+ if (realm && *realm && !strequal(lp_realm(), realm)) {
ads->server.foreign = 1;
}
- if (workgroup && *workgroup && strcasecmp(lp_workgroup(), workgroup) != 0) {
+ if (workgroup && *workgroup && !strequal(lp_workgroup(), workgroup)) {
ads->server.foreign = 1;
}
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 8c3185ea5e..b3706cb240 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -972,7 +972,7 @@ ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn)
**/
char *ads_ou_string(const char *org_unit)
{
- if (!org_unit || !*org_unit || strcasecmp(org_unit, "Computers") == 0) {
+ if (!org_unit || !*org_unit || strequal(org_unit, "Computers")) {
return strdup("cn=Computers");
}
@@ -1970,8 +1970,8 @@ ADS_STATUS ads_workgroup_name(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **workg
prefix_length = strlen(prefix);
for (i=0;principles[i]; i++) {
- if (strncasecmp(principles[i], prefix, prefix_length) == 0 &&
- strcasecmp(ads->config.realm, principles[i]+prefix_length) != 0 &&
+ if (strnequal(principles[i], prefix, prefix_length) &&
+ !strequal(ads->config.realm, principles[i]+prefix_length) &&
!strchr(principles[i]+prefix_length, '.')) {
/* found an alternate (short) name for the domain. */
DEBUG(3,("Found alternate name '%s' for realm '%s'\n",
diff --git a/source3/libsmb/namequery_dc.c b/source3/libsmb/namequery_dc.c
index a596f00ddb..df7f856cd7 100644
--- a/source3/libsmb/namequery_dc.c
+++ b/source3/libsmb/namequery_dc.c
@@ -34,7 +34,7 @@ static BOOL ads_dc_name(const char *domain, struct in_addr *dc_ip, fstring srv_n
ADS_STRUCT *ads;
const char *realm = domain;
- if (strcasecmp(realm, lp_workgroup()) == 0)
+ if (strequal(realm, lp_workgroup()))
realm = lp_realm();
ads = ads_init(realm, domain, NULL);
diff --git a/source3/msdfs/msdfs.c b/source3/msdfs/msdfs.c
index f8a97effee..5cc4bf45d6 100644
--- a/source3/msdfs/msdfs.c
+++ b/source3/msdfs/msdfs.c
@@ -314,7 +314,7 @@ BOOL dfs_redirect(char* pathname, connection_struct* conn,
return False;
}
- if (strcasecmp(dp.servicename, lp_servicename(SNUM(conn)) ) != 0)
+ if (!strequal(dp.servicename, lp_servicename(SNUM(conn)) ))
return False;
if (resolve_dfs_path(pathname, &dp, conn, findfirst_flag,
@@ -362,7 +362,7 @@ BOOL get_referred_path(char *pathname, struct junction_map* jn,
parse_dfs_path(pathname, &dp);
/* Verify hostname in path */
- if (local_machine && (strcasecmp(local_machine, dp.hostname) != 0)) {
+ if (local_machine && (!strequal(local_machine, dp.hostname))) {
/* Hostname mismatch, check if one of our IP addresses */
if (!ismyip(*interpret_addr2(dp.hostname))) {
@@ -711,7 +711,7 @@ BOOL create_junction(char* pathname, struct junction_map* jn)
parse_dfs_path(pathname,&dp);
/* check if path is dfs : validate first token */
- if (local_machine && (strcasecmp(local_machine,dp.hostname)!=0)) {
+ if (local_machine && (!strequal(local_machine,dp.hostname))) {
/* Hostname mismatch, check if one of our IP addresses */
if (!ismyip(*interpret_addr2(dp.hostname))) {
diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c
index fabc0eddca..19b00f1f4d 100644
--- a/source3/nmbd/nmbd_elections.c
+++ b/source3/nmbd/nmbd_elections.c
@@ -247,7 +247,7 @@ static BOOL win_election(struct work_record *work, int version,
if (timeup < mytimeup)
return(True);
- if (strcasecmp(global_myname(), server_name) > 0)
+ if (StrCaseCmp(global_myname(), server_name) > 0)
return(False);
return(True);
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c
index 8bd2c66511..ba14a51d24 100644
--- a/source3/nsswitch/winbindd_rpc.c
+++ b/source3/nsswitch/winbindd_rpc.c
@@ -336,7 +336,7 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain,
DEBUG(5,("Mapped sid to [%s]\\[%s]\n", domains[0], *name));
/* Paranoia */
- if (strcasecmp(domain->name, domains[0]) != 0) {
+ if (!strequal(domain->name, domains[0])) {
DEBUG(1, ("domain name from domain param and PDC lookup return differ! (%s vs %s)\n", domain->name, domains[0]));
return NT_STATUS_UNSUCCESSFUL;
}
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c
index 850a0b1a2d..6d1675752f 100644
--- a/source3/nsswitch/winbindd_util.c
+++ b/source3/nsswitch/winbindd_util.c
@@ -92,13 +92,13 @@ static struct winbindd_domain *add_trusted_domain(const char *domain_name, const
/* We can't call domain_list() as this function is called from
init_domain_list() and we'll get stuck in a loop. */
for (domain = _domain_list; domain; domain = domain->next) {
- if (strcasecmp(domain_name, domain->name) == 0 ||
- strcasecmp(domain_name, domain->alt_name) == 0) {
+ if (strequal(domain_name, domain->name) ||
+ strequal(domain_name, domain->alt_name)) {
return domain;
}
if (alternative_name && *alternative_name) {
- if (strcasecmp(alternative_name, domain->name) == 0 ||
- strcasecmp(alternative_name, domain->alt_name) == 0) {
+ if (strequal(alternative_name, domain->name) ||
+ strequal(alternative_name, domain->alt_name)) {
return domain;
}
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 5a5ac4a2cc..55ab4ee3a0 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -2025,7 +2025,7 @@ static int lp_enum(const char *s,const struct enum_list *_enum)
}
for (i=0; _enum[i].name; i++) {
- if (strcasecmp(_enum[i].name,s)==0)
+ if (strequal(_enum[i].name,s))
return _enum[i].value;
}
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 5cf1691f0d..fdc79ae2ab 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -356,7 +356,7 @@ static BOOL get_unix_attributes (struct ldapsam_privates *ldap_state,
}
for (values=ldap_values;*values;values++) {
- if (strcasecmp(*values, LDAP_OBJ_POSIXACCOUNT ) == 0) {
+ if (strequal(*values, LDAP_OBJ_POSIXACCOUNT )) {
break;
}
}
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 8cdbec9b9d..562d50f89e 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -431,7 +431,7 @@ static struct smb_passwd *getsmbfilepwent(struct smbpasswd_privates *smbpasswd_s
continue;
}
- if (!strncasecmp((char *) p, "NO PASSWORD", 11)) {
+ if (strnequal((char *) p, "NO PASSWORD", 11)) {
pw_buf->smb_passwd = NULL;
pw_buf->acct_ctrl |= ACB_PWNOTREQ;
} else {
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index e0efb3e41b..7e7bc8c68c 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -427,7 +427,7 @@ static BOOL is_reserved_name(const char *name)
for (i=0; reserved_names[i]; i++) {
int len = strlen(reserved_names[i]);
/* note that we match on COM1 as well as COM1.foo */
- if (strncasecmp(name, reserved_names[i], len) == 0 &&
+ if (strnequal(name, reserved_names[i], len) &&
(name[len] == '.' || name[len] == 0)) {
return True;
}
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 945855b832..314ffbb4a9 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -186,7 +186,7 @@ static int reply_spnego_kerberos(connection_struct *conn,
}
*p = 0;
- if (strcasecmp(p+1, lp_realm()) != 0) {
+ if (!strequal(p+1, lp_realm())) {
DEBUG(3,("Ticket for foreign realm %s@%s\n", client, p+1));
if (!lp_allow_trusted_domains()) {
data_blob_free(&ap_rep);
diff --git a/source3/smbwrapper/smbw_dir.c b/source3/smbwrapper/smbw_dir.c
index 6d55c1d9da..0a6deede41 100644
--- a/source3/smbwrapper/smbw_dir.c
+++ b/source3/smbwrapper/smbw_dir.c
@@ -216,7 +216,7 @@ int smbw_dir_open(const char *fname)
smbw_NetServerEnum(&srv->cli, srv->server_name, SV_TYPE_ALL,
smbw_server_add, NULL);
*p = '#';
- } else if ((strcmp(srv->cli.dev,"IPC") == 0) || (strcasecmp(share,"IPC$") == 0)) {
+ } else if ((strcmp(srv->cli.dev,"IPC") == 0) || (strequal(share,"IPC$"))) {
DEBUG(4,("doing NetShareEnum\n"));
smbw_share_add(".",0,"", NULL);
smbw_share_add("..",0,"", NULL);
@@ -413,7 +413,7 @@ int smbw_chdir(const char *name)
}
if (strncmp(srv->cli.dev,"IPC",3) &&
- strcasecmp(share, "IPC$") &&
+ !strequal(share, "IPC$") &&
strncmp(srv->cli.dev,"LPT",3) &&
!smbw_getatr(srv, path,
&mode, NULL, NULL, NULL, NULL, NULL)) {
diff --git a/source3/torture/mangle_test.c b/source3/torture/mangle_test.c
index 9a719349b6..f31621b23b 100644
--- a/source3/torture/mangle_test.c
+++ b/source3/torture/mangle_test.c
@@ -85,7 +85,7 @@ static BOOL test_one(struct cli_state *cli, const char *name)
data = tdb_fetch_bystring(tdb, shortname);
if (data.dptr) {
/* maybe its a duplicate long name? */
- if (strcasecmp(name, data.dptr) != 0) {
+ if (!strequal(name, data.dptr)) {
/* we have a collision */
collisions++;
printf("Collision between %s and %s -> %s "
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 42966b4f83..38c144caa8 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -84,14 +84,14 @@ uint32 get_sec_channel_type(const char *param)
if (!(param && *param)) {
return get_default_sec_channel();
} else {
- if (strcasecmp(param, "PDC")==0) {
+ if (strequal(param, "PDC")) {
return SEC_CHAN_BDC;
- } else if (strcasecmp(param, "BDC")==0) {
+ } else if (strequal(param, "BDC")) {
return SEC_CHAN_BDC;
- } else if (strcasecmp(param, "MEMBER")==0) {
+ } else if (strequal(param, "MEMBER")) {
return SEC_CHAN_WKSTA;
#if 0
- } else if (strcasecmp(param, "DOMAIN")==0) {
+ } else if (strequal(param, "DOMAIN")) {
return SEC_CHAN_DOMAIN;
#endif
} else {
diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c
index 64321d5bfc..0bd8755420 100644
--- a/source3/utils/smbcquotas.c
+++ b/source3/utils/smbcquotas.c
@@ -140,7 +140,7 @@ static int parse_quota_set(pstring set_str, pstring username_str, enum SMB_QUOTA
BOOL enable = False;
BOOL deny = False;
- if (strncasecmp(set_str,"UQLIM:",6)==0) {
+ if (strnequal(set_str,"UQLIM:",6)) {
p += 6;
*qtype = SMB_USER_QUOTA_TYPE;
*cmd = QUOTA_SETLIM;
@@ -154,12 +154,12 @@ static int parse_quota_set(pstring set_str, pstring username_str, enum SMB_QUOTA
fstrcpy(username_str,p);
p = p2;
- } else if (strncasecmp(set_str,"FSQLIM:",7)==0) {
+ } else if (strnequal(set_str,"FSQLIM:",7)) {
p +=7;
*qtype = SMB_USER_FS_QUOTA_TYPE;
*cmd = QUOTA_SETLIM;
todo = PARSE_LIM;
- } else if (strncasecmp(set_str,"FSQFLAGS:",9)==0) {
+ } else if (strnequal(set_str,"FSQFLAGS:",9)) {
p +=9;
todo = PARSE_FLAGS;
*qtype = SMB_USER_FS_QUOTA_TYPE;
@@ -189,13 +189,13 @@ static int parse_quota_set(pstring set_str, pstring username_str, enum SMB_QUOTA
p2++;
}
- if (strncasecmp(p,"QUOTA_ENABLED",13)==0) {
+ if (strnequal(p,"QUOTA_ENABLED",13)) {
enable = True;
- } else if (strncasecmp(p,"DENY_DISK",9)==0) {
+ } else if (strnequal(p,"DENY_DISK",9)) {
deny = True;
- } else if (strncasecmp(p,"LOG_SOFTLIMIT",13)==0) {
+ } else if (strnequal(p,"LOG_SOFTLIMIT",13)) {
pqt->qflags |= QUOTAS_LOG_THRESHOLD;
- } else if (strncasecmp(p,"LOG_HARDLIMIT",13)==0) {
+ } else if (strnequal(p,"LOG_HARDLIMIT",13)) {
pqt->qflags |= QUOTAS_LOG_LIMIT;
} else {
return -1;
diff --git a/source3/web/cgi.c b/source3/web/cgi.c
index 8e739cd224..6778e59656 100644
--- a/source3/web/cgi.c
+++ b/source3/web/cgi.c
@@ -114,7 +114,7 @@ void cgi_load_variables(void)
if (len > 0 &&
(request_post ||
((s=getenv("REQUEST_METHOD")) &&
- strcasecmp(s,"POST")==0))) {
+ strequal(s,"POST")))) {
while (len && (line=grab_line(f, &len))) {
p = strchr_m(line,'=');
if (!p) continue;
@@ -224,9 +224,9 @@ static void cgi_setup_error(const char *err, const char *header, const char *inf
/* damn browsers don't like getting cut off before they give a request */
char line[1024];
while (fgets(line, sizeof(line)-1, stdin)) {
- if (strncasecmp(line,"GET ", 4)==0 ||
- strncasecmp(line,"POST ", 5)==0 ||
- strncasecmp(line,"PUT ", 4)==0) {
+ if (strnequal(line,"GET ", 4) ||
+ strnequal(line,"POST ", 5) ||
+ strnequal(line,"PUT ", 4)) {
break;
}
}
@@ -301,7 +301,7 @@ static BOOL cgi_handle_authorization(char *line)
fstring user, user_pass;
struct passwd *pass = NULL;
- if (strncasecmp(line,"Basic ", 6)) {
+ if (!strnequal(line,"Basic ", 6)) {
goto err;
}
line += 6;
@@ -489,22 +489,22 @@ void cgi_setup(const char *rootdir, int auth_required)
and handle authentication etc */
while (fgets(line, sizeof(line)-1, stdin)) {
if (line[0] == '\r' || line[0] == '\n') break;
- if (strncasecmp(line,"GET ", 4)==0) {
+ if (strnequal(line,"GET ", 4)) {
got_request = True;
url = strdup(&line[4]);
- } else if (strncasecmp(line,"POST ", 5)==0) {
+ } else if (strnequal(line,"POST ", 5)) {
got_request = True;
request_post = 1;
url = strdup(&line[5]);
- } else if (strncasecmp(line,"PUT ", 4)==0) {
+ } else if (strnequal(line,"PUT ", 4)) {
got_request = True;
cgi_setup_error("400 Bad Request", "",
"This server does not accept PUT requests");
- } else if (strncasecmp(line,"Authorization: ", 15)==0) {
+ } else if (strnequal(line,"Authorization: ", 15)) {
authenticated = cgi_handle_authorization(&line[15]);
- } else if (strncasecmp(line,"Content-Length: ", 16)==0) {
+ } else if (strnequal(line,"Content-Length: ", 16)) {
content_length = atoi(&line[16]);
- } else if (strncasecmp(line,"Accept-Language: ", 17)==0) {
+ } else if (strnequal(line,"Accept-Language: ", 17)) {
web_set_lang(&line[17]);
}
/* ignore all other requests! */