1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-22 05:57:43 +03:00

s3-lib Replace StrCaseCmp() with strcasecmp_m()

strcasecmp_m() never needs to call to talloc, and via next_codepoint()
still has an ASCII fast-path bypassing iconv() calls.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 2011-05-13 20:21:30 +02:00
parent 7a11e5de39
commit c615ebed6e
51 changed files with 179 additions and 263 deletions

View File

@ -180,7 +180,7 @@ int lookup(nsd_file_t *rq)
* response needs to be a string of the following format
* ip_address[ ip_address]*\tname[ alias]*
*/
if (StrCaseCmp(map,"hosts.byaddr") == 0) {
if (strcasecmp_m(map,"hosts.byaddr") == 0) {
if ( status = lookup_byaddr_backend(key, &count)) {
size = strlen(key) + 1;
if (size > len) {
@ -208,7 +208,7 @@ int lookup(nsd_file_t *rq)
response[strlen(response)-1] = '\n';
talloc_free(status);
}
} else if (StrCaseCmp(map,"hosts.byname") == 0) {
} else if (strcasecmp_m(map,"hosts.byname") == 0) {
if (ip_list = lookup_byname_backend(key, &count)) {
for (i = count; i ; i--) {
addr = inet_ntoa(ip_list[i-1]);

View File

@ -849,7 +849,7 @@ static int convert_ldb_record(TDB_CONTEXT *ltdb, TDB_DATA key,
p += len + 1;
num_vals = pull_uint32(p, 0);
if (StrCaseCmp(name, "member") == 0) {
if (strcasecmp_m(name, "member") == 0) {
num_mem = num_vals;
members = talloc_array(tmp_ctx, struct dom_sid, num_mem);
if (members == NULL) {
@ -882,30 +882,30 @@ static int convert_ldb_record(TDB_CONTEXT *ltdb, TDB_DATA key,
/* we ignore unknown or uninteresting attributes
* (objectclass, etc.) */
if (StrCaseCmp(name, "gidNumber") == 0) {
if (strcasecmp_m(name, "gidNumber") == 0) {
map.gid = strtoul(val, &q, 10);
if (*q) {
errno = EIO;
goto failed;
}
} else if (StrCaseCmp(name, "sid") == 0) {
} else if (strcasecmp_m(name, "sid") == 0) {
if (!string_to_sid(&map.sid, val)) {
errno = EIO;
goto failed;
}
} else if (StrCaseCmp(name, "sidNameUse") == 0) {
} else if (strcasecmp_m(name, "sidNameUse") == 0) {
map.sid_name_use = strtoul(val, &q, 10);
if (*q) {
errno = EIO;
goto failed;
}
} else if (StrCaseCmp(name, "ntname") == 0) {
} else if (strcasecmp_m(name, "ntname") == 0) {
strlcpy(map.nt_name, val,
sizeof(map.nt_name));
} else if (StrCaseCmp(name, "comment") == 0) {
} else if (strcasecmp_m(name, "comment") == 0) {
strlcpy(map.comment, val,
sizeof(map.comment));
} else if (StrCaseCmp(name, "member") == 0) {
} else if (strcasecmp_m(name, "member") == 0) {
if (!string_to_sid(&members[j], val)) {
errno = EIO;
goto failed;

View File

@ -871,7 +871,6 @@ ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
/* The following definitions come from lib/util_str.c */
bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
int StrCaseCmp(const char *s, const char *t);
int StrnCaseCmp(const char *s, const char *t, size_t len);
bool strnequal(const char *s1,const char *s2,size_t n);
bool strcsequal(const char *s1,const char *s2);

View File

@ -134,7 +134,7 @@ static struct tree_node *pathtree_birth_child(struct tree_node *node,
/* the strings should never match assuming that we
have called pathtree_find_child() first */
if ( StrCaseCmp( infant->key, node->children[i-1]->key ) > 0 ) {
if ( strcasecmp_m( infant->key, node->children[i-1]->key ) > 0 ) {
DEBUG(11,("pathtree_birth_child: storing infant in i == [%d]\n",
i));
node->children[i] = infant;
@ -183,7 +183,7 @@ static struct tree_node *pathtree_find_child(struct tree_node *node,
DEBUG(11,("pathtree_find_child: child key => [%s]\n",
node->children[i]->key));
result = StrCaseCmp( node->children[i]->key, key );
result = strcasecmp_m( node->children[i]->key, key );
if ( result == 0 )
next = node->children[i];

View File

@ -202,5 +202,5 @@ bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname)
return false;
}
return StrCaseCmp(smb_fname->stream_name, "::$DATA") == 0;
return strcasecmp_m(smb_fname->stream_name, "::$DATA") == 0;
}

View File

@ -166,7 +166,7 @@ int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
if (is_case_sensitive) {
return strcmp(pattern, string);
} else {
return StrCaseCmp(pattern, string);
return strcasecmp_m(pattern, string);
}
}

View File

@ -405,7 +405,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
return NULL;
}
if (StrCaseCmp(tmp, result) < 0) {
if (strcasecmp_m(tmp, result) < 0) {
TALLOC_FREE(result);
result = tmp;
} else {
@ -654,7 +654,7 @@ static void smbldap_make_mod_internal(LDAP *ldap_struct, LDAPMessage *existing,
equal = (newblob && (data_blob_cmp(&oldblob, newblob) == 0));
} else {
/* all of our string attributes are case insensitive */
equal = (newval && (StrCaseCmp(oldval, newval) == 0));
equal = (newval && (strcasecmp_m(oldval, newval) == 0));
}
if (equal) {

View File

@ -300,7 +300,7 @@ static int compare_utf8_blobs(const DATA_BLOB *d1, const DATA_BLOB *d2)
TALLOC_FREE(s1);
return 0;
}
ret = StrCaseCmp(s1, s2);
ret = strcasecmp_m(s1, s2);
TALLOC_FREE(s2);
TALLOC_FREE(s1);
return ret;

View File

@ -1299,7 +1299,7 @@ bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensit
}
} else {
if((case_sensitive && (strcmp(last_component, namelist->name) == 0))||
(!case_sensitive && (StrCaseCmp(last_component, namelist->name) == 0))) {
(!case_sensitive && (strcasecmp_m(last_component, namelist->name) == 0))) {
DEBUG(8,("is_in_path: match succeeded\n"));
return True;
}
@ -2203,7 +2203,7 @@ bool name_to_fqdn(fstring fqdn, const char *name)
}
}
}
if (full && (StrCaseCmp(full, "localhost.localdomain") == 0)) {
if (full && (strcasecmp_m(full, "localhost.localdomain") == 0)) {
DEBUG(1, ("WARNING: your /etc/hosts file may be broken!\n"));
DEBUGADD(1, (" Specifing the machine hostname for address 127.0.0.1 may lead\n"));
DEBUGADD(1, (" to Kerberos authentication problems as localhost.localdomain\n"));

View File

@ -35,89 +35,6 @@ const char toupper_ascii_fast_table[128] = {
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f
};
/**
* Case insensitive string compararison.
*
* iconv does not directly give us a way to compare strings in
* arbitrary unix character sets -- all we can is convert and then
* compare. This is expensive.
*
* As an optimization, we do a first pass that considers only the
* prefix of the strings that is entirely 7-bit. Within this, we
* check whether they have the same value.
*
* Hopefully this will often give the answer without needing to copy.
* In particular it should speed comparisons to literal ascii strings
* or comparisons of strings that are "obviously" different.
*
* If we find a non-ascii character we fall back to converting via
* iconv.
*
* This should never be slower than convering the whole thing, and
* often faster.
*
* A different optimization would be to compare for bitwise equality
* in the binary encoding. (It would be possible thought hairy to do
* both simultaneously.) But in that case if they turn out to be
* different, we'd need to restart the whole thing.
*
* Even better is to implement strcasecmp for each encoding and use a
* function pointer.
**/
int StrCaseCmp(const char *s, const char *t)
{
const char *ps, *pt;
size_t size;
smb_ucs2_t *buffer_s, *buffer_t;
int ret;
for (ps = s, pt = t; ; ps++, pt++) {
char us, ut;
if (!*ps && !*pt)
return 0; /* both ended */
else if (!*ps)
return -1; /* s is a prefix */
else if (!*pt)
return +1; /* t is a prefix */
else if ((*ps & 0x80) || (*pt & 0x80))
/* not ascii anymore, do it the hard way
* from here on in */
break;
us = toupper_ascii_fast(*ps);
ut = toupper_ascii_fast(*pt);
if (us == ut)
continue;
else if (us < ut)
return -1;
else if (us > ut)
return +1;
}
if (!push_ucs2_talloc(talloc_tos(), &buffer_s, ps, &size)) {
return strcmp(ps, pt);
/* Not quite the right answer, but finding the right one
under this failure case is expensive, and it's pretty
close */
}
if (!push_ucs2_talloc(talloc_tos(), &buffer_t, pt, &size)) {
TALLOC_FREE(buffer_s);
return strcmp(ps, pt);
/* Not quite the right answer, but finding the right one
under this failure case is expensive, and it's pretty
close */
}
ret = strcasecmp_w(buffer_s, buffer_t);
TALLOC_FREE(buffer_s);
TALLOC_FREE(buffer_t);
return ret;
}
/**
Case insensitive string compararison, length limited.
**/
@ -360,7 +277,7 @@ bool in_list(const char *s, const char *list, bool casesensitive)
break;
}
} else {
if (StrCaseCmp(tok,s) == 0) {
if (strcasecmp_m(tok,s) == 0) {
ret = true;
break;
}

View File

@ -2228,7 +2228,7 @@ static bool ads_dump_field(ADS_STRUCT *ads, char *field, void **values, void *da
}
for (i=0; handlers[i].name; i++) {
if (StrCaseCmp(handlers[i].name, field) == 0) {
if (strcasecmp_m(handlers[i].name, field) == 0) {
if (!values) /* first time, indicate string or not */
return handlers[i].string;
handlers[i].handler(ads, field, (struct berval **) values);

View File

@ -289,7 +289,7 @@ static void map_regval_to_ads(TALLOC_CTX *ctx, ADS_MODLIST *mods,
int i;
for (i=0; map[i].valname; i++) {
if (StrCaseCmp(map[i].valname, regval_name(value)) == 0) {
if (strcasecmp_m(map[i].valname, regval_name(value)) == 0) {
if (!map[i].fn(ctx, mods, value)) {
DEBUG(5, ("Add of value %s to modlist failed\n", regval_name(value)));
} else {

View File

@ -1771,7 +1771,7 @@ static int libnet_destroy_JoinCtx(struct libnet_JoinCtx *r)
}
krb5_cc_env = getenv(KRB5_ENV_CCNAME);
if (krb5_cc_env && StrCaseCmp(krb5_cc_env, "MEMORY:libnetjoin")) {
if (krb5_cc_env && strcasecmp_m(krb5_cc_env, "MEMORY:libnetjoin")) {
unsetenv(KRB5_ENV_CCNAME);
}
@ -1790,7 +1790,7 @@ static int libnet_destroy_UnjoinCtx(struct libnet_UnjoinCtx *r)
}
krb5_cc_env = getenv(KRB5_ENV_CCNAME);
if (krb5_cc_env && StrCaseCmp(krb5_cc_env, "MEMORY:libnetjoin")) {
if (krb5_cc_env && strcasecmp_m(krb5_cc_env, "MEMORY:libnetjoin")) {
unsetenv(KRB5_ENV_CCNAME);
}

View File

@ -169,7 +169,7 @@ static NTSTATUS ep_register(TALLOC_CTX *mem_ctx,
"rpc_server", "epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0) {
static struct client_address client_id;
strlcpy(client_id.addr, "localhost", sizeof(client_id.addr));
@ -186,7 +186,7 @@ static NTSTATUS ep_register(TALLOC_CTX *mem_ctx,
"epmapper (%s)", nt_errstr(status)));
goto done;
}
} else if (StrCaseCmp(rpcsrv_type, "daemon") == 0) {
} else if (strcasecmp_m(rpcsrv_type, "daemon") == 0) {
/* Connect to the endpoint mapper locally */
ncalrpc_sock = talloc_asprintf(tmp_ctx,
"%s/%s",

View File

@ -822,48 +822,48 @@ cacl_get(SMBCCTX *context,
}
/* Which exclusion name is this? */
if (StrCaseCmp(pExclude,
if (strcasecmp_m(pExclude,
"nt_sec_desc.revision") == 0) {
exclude_nt_revision = True;
}
else if (StrCaseCmp(pExclude,
else if (strcasecmp_m(pExclude,
"nt_sec_desc.owner") == 0) {
exclude_nt_owner = True;
}
else if (StrCaseCmp(pExclude,
else if (strcasecmp_m(pExclude,
"nt_sec_desc.group") == 0) {
exclude_nt_group = True;
}
else if (StrCaseCmp(pExclude,
else if (strcasecmp_m(pExclude,
"nt_sec_desc.acl") == 0) {
exclude_nt_acl = True;
}
else if (StrCaseCmp(pExclude,
else if (strcasecmp_m(pExclude,
"dos_attr.mode") == 0) {
exclude_dos_mode = True;
}
else if (StrCaseCmp(pExclude,
else if (strcasecmp_m(pExclude,
"dos_attr.size") == 0) {
exclude_dos_size = True;
}
else if (excl_attr_strings.create_time_attr != NULL &&
StrCaseCmp(pExclude,
strcasecmp_m(pExclude,
excl_attr_strings.change_time_attr) == 0) {
exclude_dos_create_time = True;
}
else if (StrCaseCmp(pExclude,
else if (strcasecmp_m(pExclude,
excl_attr_strings.access_time_attr) == 0) {
exclude_dos_access_time = True;
}
else if (StrCaseCmp(pExclude,
else if (strcasecmp_m(pExclude,
excl_attr_strings.write_time_attr) == 0) {
exclude_dos_write_time = True;
}
else if (StrCaseCmp(pExclude,
else if (strcasecmp_m(pExclude,
excl_attr_strings.change_time_attr) == 0) {
exclude_dos_change_time = True;
}
else if (StrCaseCmp(pExclude, "dos_attr.inode") == 0) {
else if (strcasecmp_m(pExclude, "dos_attr.inode") == 0) {
exclude_dos_inode = True;
}
else {
@ -933,7 +933,7 @@ cacl_get(SMBCCTX *context,
"REVISION:%d",
sd->revision);
}
} else if (StrCaseCmp(name, "revision") == 0) {
} else if (strcasecmp_m(name, "revision") == 0) {
if (determine_size) {
p = talloc_asprintf(ctx, "%d",
sd->revision);
@ -1086,9 +1086,9 @@ cacl_get(SMBCCTX *context,
ace->access_mask);
}
} else if ((StrnCaseCmp(name, "acl", 3) == 0 &&
StrCaseCmp(name+3, sidstr) == 0) ||
strcasecmp_m(name+3, sidstr) == 0) ||
(StrnCaseCmp(name, "acl+", 4) == 0 &&
StrCaseCmp(name+4, sidstr) == 0)) {
strcasecmp_m(name+4, sidstr) == 0)) {
if (determine_size) {
p = talloc_asprintf(
ctx,
@ -1193,7 +1193,7 @@ cacl_get(SMBCCTX *context,
: ""),
mode);
}
} else if (StrCaseCmp(name, "mode") == 0) {
} else if (strcasecmp_m(name, "mode") == 0) {
if (determine_size) {
p = talloc_asprintf(ctx, "0x%x", mode);
if (!p) {
@ -1234,7 +1234,7 @@ cacl_get(SMBCCTX *context,
",SIZE:%.0f",
(double)size);
}
} else if (StrCaseCmp(name, "size") == 0) {
} else if (strcasecmp_m(name, "size") == 0) {
if (determine_size) {
p = talloc_asprintf(
ctx,
@ -1281,7 +1281,7 @@ cacl_get(SMBCCTX *context,
attr_strings.create_time_attr,
(unsigned long) create_time);
}
} else if (StrCaseCmp(name, attr_strings.create_time_attr) == 0) {
} else if (strcasecmp_m(name, attr_strings.create_time_attr) == 0) {
if (determine_size) {
p = talloc_asprintf(ctx, "%lu", (unsigned long) create_time);
if (!p) {
@ -1323,7 +1323,7 @@ cacl_get(SMBCCTX *context,
attr_strings.access_time_attr,
(unsigned long) access_time);
}
} else if (StrCaseCmp(name, attr_strings.access_time_attr) == 0) {
} else if (strcasecmp_m(name, attr_strings.access_time_attr) == 0) {
if (determine_size) {
p = talloc_asprintf(ctx, "%lu", (unsigned long) access_time);
if (!p) {
@ -1365,7 +1365,7 @@ cacl_get(SMBCCTX *context,
attr_strings.write_time_attr,
(unsigned long) write_time);
}
} else if (StrCaseCmp(name, attr_strings.write_time_attr) == 0) {
} else if (strcasecmp_m(name, attr_strings.write_time_attr) == 0) {
if (determine_size) {
p = talloc_asprintf(ctx, "%lu", (unsigned long) write_time);
if (!p) {
@ -1407,7 +1407,7 @@ cacl_get(SMBCCTX *context,
attr_strings.change_time_attr,
(unsigned long) change_time);
}
} else if (StrCaseCmp(name, attr_strings.change_time_attr) == 0) {
} else if (strcasecmp_m(name, attr_strings.change_time_attr) == 0) {
if (determine_size) {
p = talloc_asprintf(ctx, "%lu", (unsigned long) change_time);
if (!p) {
@ -1448,7 +1448,7 @@ cacl_get(SMBCCTX *context,
",INODE:%.0f",
(double) ino);
}
} else if (StrCaseCmp(name, "inode") == 0) {
} else if (strcasecmp_m(name, "inode") == 0) {
if (determine_size) {
p = talloc_asprintf(
ctx,
@ -1775,8 +1775,8 @@ SMBC_setxattr_ctx(SMBCCTX *context,
/*
* Are they asking to set the entire set of known attributes?
*/
if (StrCaseCmp(name, "system.*") == 0 ||
StrCaseCmp(name, "system.*+") == 0) {
if (strcasecmp_m(name, "system.*") == 0 ||
strcasecmp_m(name, "system.*+") == 0) {
/* Yup. */
char *namevalue =
talloc_asprintf(talloc_tos(), "%s:%s",
@ -1835,9 +1835,9 @@ SMBC_setxattr_ctx(SMBCCTX *context,
* Are they asking to set an access control element or to set
* the entire access control list?
*/
if (StrCaseCmp(name, "system.nt_sec_desc.*") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.*+") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.revision") == 0 ||
if (strcasecmp_m(name, "system.nt_sec_desc.*") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.*+") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.revision") == 0 ||
StrnCaseCmp(name, "system.nt_sec_desc.acl", 22) == 0 ||
StrnCaseCmp(name, "system.nt_sec_desc.acl+", 23) == 0) {
@ -1868,8 +1868,8 @@ SMBC_setxattr_ctx(SMBCCTX *context,
/*
* Are they asking to set the owner?
*/
if (StrCaseCmp(name, "system.nt_sec_desc.owner") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.owner+") == 0) {
if (strcasecmp_m(name, "system.nt_sec_desc.owner") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.owner+") == 0) {
/* Yup. */
char *namevalue =
@ -1894,8 +1894,8 @@ SMBC_setxattr_ctx(SMBCCTX *context,
/*
* Are they asking to set the group?
*/
if (StrCaseCmp(name, "system.nt_sec_desc.group") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.group+") == 0) {
if (strcasecmp_m(name, "system.nt_sec_desc.group") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.group+") == 0) {
/* Yup. */
char *namevalue =
@ -1936,13 +1936,13 @@ SMBC_setxattr_ctx(SMBCCTX *context,
/*
* Are they asking to set a DOS attribute?
*/
if (StrCaseCmp(name, "system.dos_attr.*") == 0 ||
StrCaseCmp(name, "system.dos_attr.mode") == 0 ||
if (strcasecmp_m(name, "system.dos_attr.*") == 0 ||
strcasecmp_m(name, "system.dos_attr.mode") == 0 ||
(attr_strings.create_time_attr != NULL &&
StrCaseCmp(name, attr_strings.create_time_attr) == 0) ||
StrCaseCmp(name, attr_strings.access_time_attr) == 0 ||
StrCaseCmp(name, attr_strings.write_time_attr) == 0 ||
StrCaseCmp(name, attr_strings.change_time_attr) == 0) {
strcasecmp_m(name, attr_strings.create_time_attr) == 0) ||
strcasecmp_m(name, attr_strings.access_time_attr) == 0 ||
strcasecmp_m(name, attr_strings.write_time_attr) == 0 ||
strcasecmp_m(name, attr_strings.change_time_attr) == 0) {
/* get a DOS Attribute Descriptor with current attributes */
dad = dos_attr_query(context, talloc_tos(), path, srv);
@ -2081,31 +2081,31 @@ SMBC_getxattr_ctx(SMBCCTX *context,
}
/* Are they requesting a supported attribute? */
if (StrCaseCmp(name, "system.*") == 0 ||
if (strcasecmp_m(name, "system.*") == 0 ||
StrnCaseCmp(name, "system.*!", 9) == 0 ||
StrCaseCmp(name, "system.*+") == 0 ||
strcasecmp_m(name, "system.*+") == 0 ||
StrnCaseCmp(name, "system.*+!", 10) == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.*") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.*") == 0 ||
StrnCaseCmp(name, "system.nt_sec_desc.*!", 21) == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.*+") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.*+") == 0 ||
StrnCaseCmp(name, "system.nt_sec_desc.*+!", 22) == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.revision") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.owner") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.owner+") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.group") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.group+") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.revision") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.owner") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.owner+") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.group") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.group+") == 0 ||
StrnCaseCmp(name, "system.nt_sec_desc.acl", 22) == 0 ||
StrnCaseCmp(name, "system.nt_sec_desc.acl+", 23) == 0 ||
StrCaseCmp(name, "system.dos_attr.*") == 0 ||
strcasecmp_m(name, "system.dos_attr.*") == 0 ||
StrnCaseCmp(name, "system.dos_attr.*!", 18) == 0 ||
StrCaseCmp(name, "system.dos_attr.mode") == 0 ||
StrCaseCmp(name, "system.dos_attr.size") == 0 ||
strcasecmp_m(name, "system.dos_attr.mode") == 0 ||
strcasecmp_m(name, "system.dos_attr.size") == 0 ||
(attr_strings.create_time_attr != NULL &&
StrCaseCmp(name, attr_strings.create_time_attr) == 0) ||
StrCaseCmp(name, attr_strings.access_time_attr) == 0 ||
StrCaseCmp(name, attr_strings.write_time_attr) == 0 ||
StrCaseCmp(name, attr_strings.change_time_attr) == 0 ||
StrCaseCmp(name, "system.dos_attr.inode") == 0) {
strcasecmp_m(name, attr_strings.create_time_attr) == 0) ||
strcasecmp_m(name, attr_strings.access_time_attr) == 0 ||
strcasecmp_m(name, attr_strings.write_time_attr) == 0 ||
strcasecmp_m(name, attr_strings.change_time_attr) == 0 ||
strcasecmp_m(name, "system.dos_attr.inode") == 0) {
/* Yup. */
const char *filename = name;
@ -2206,8 +2206,8 @@ SMBC_removexattr_ctx(SMBCCTX *context,
}
/* Are they asking to set the entire ACL? */
if (StrCaseCmp(name, "system.nt_sec_desc.*") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.*+") == 0) {
if (strcasecmp_m(name, "system.nt_sec_desc.*") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.*+") == 0) {
/* Yup. */
ret = cacl_set(context, talloc_tos(), srv->cli,
@ -2221,11 +2221,11 @@ SMBC_removexattr_ctx(SMBCCTX *context,
* Are they asking to remove one or more spceific security descriptor
* attributes?
*/
if (StrCaseCmp(name, "system.nt_sec_desc.revision") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.owner") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.owner+") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.group") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.group+") == 0 ||
if (strcasecmp_m(name, "system.nt_sec_desc.revision") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.owner") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.owner+") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.group") == 0 ||
strcasecmp_m(name, "system.nt_sec_desc.group+") == 0 ||
StrnCaseCmp(name, "system.nt_sec_desc.acl", 22) == 0 ||
StrnCaseCmp(name, "system.nt_sec_desc.acl+", 23) == 0) {

View File

@ -56,7 +56,7 @@ NTSTATUS onefs_stream_prep_smb_fname(TALLOC_CTX *ctx,
/* Strip off the :$DATA if one exists. */
str_tmp = strrchr_m(stream_name, ':');
if (str_tmp) {
if (StrCaseCmp(str_tmp, ":$DATA") != 0) {
if (strcasecmp_m(str_tmp, ":$DATA") != 0) {
return NT_STATUS_INVALID_PARAMETER;
}
str_tmp[0] = '\0';

View File

@ -24,7 +24,7 @@
static int compare_dirent (const SMB_STRUCT_DIRENT *da, const SMB_STRUCT_DIRENT *db)
{
return StrCaseCmp(da->d_name, db->d_name);
return strcasecmp_m(da->d_name, db->d_name);
}
struct dirsort_privates {

View File

@ -324,7 +324,7 @@ static NTSTATUS stream_smb_fname(vfs_handle_struct *handle,
stype = strchr_m(smb_fname->stream_name + 1, ':');
if (stype) {
if (StrCaseCmp(stype, ":$DATA") != 0) {
if (strcasecmp_m(stype, ":$DATA") != 0) {
return NT_STATUS_INVALID_PARAMETER;
}
}

View File

@ -614,7 +614,7 @@ static int streams_xattr_rename(vfs_handle_struct *handle,
}
/* Don't rename if the streams are identical. */
if (StrCaseCmp(smb_fname_src->stream_name,
if (strcasecmp_m(smb_fname_src->stream_name,
smb_fname_dst->stream_name) == 0) {
goto done;
}

View File

@ -248,7 +248,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_m(global_myname(), server_name) > 0)
return(False);
return(True);

View File

@ -147,7 +147,7 @@ const char *get_short_archi(const char *long_archi)
do {
i++;
} while ( (archi_table[i].long_archi!=NULL ) &&
StrCaseCmp(long_archi, archi_table[i].long_archi) );
strcasecmp_m(long_archi, archi_table[i].long_archi) );
if (archi_table[i].long_archi==NULL) {
DEBUGADD(10,("Unknown architecture [%s] !\n", long_archi));

View File

@ -1300,7 +1300,7 @@ done:
static int cmp_keynames(char **p1, char **p2)
{
return StrCaseCmp(*p1, *p2);
return strcasecmp_m(*p1, *p2);
}
struct create_sorted_subkeys_context {

View File

@ -308,7 +308,7 @@ int write_bom(FILE* file, const char* charset, charset_t ctype)
DEBUG(0, ("No Byte Order Mark for charset_t: %u\n", (unsigned)ctype));
} else {
for (i=0; BOM[i].name; i++) {
if (StrCaseCmp(BOM[i].name, charset) == 0) {
if (strcasecmp_m(BOM[i].name, charset) == 0) {
return fwrite(BOM[i].seq, 1, BOM[i].len, file);
}
}

View File

@ -1750,7 +1750,7 @@ static bool create_vk_record(REGF_FILE *file, REGF_VK_REC *vk,
static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
{
return StrCaseCmp( h1->fullname, h2->fullname );
return strcasecmp_m( h1->fullname, h2->fullname );
}
/*******************************************************************

View File

@ -3488,7 +3488,7 @@ static int dns_cmp(const char *s1, size_t l1,
int cret;
if (l1 == l2) {
if (StrCaseCmp(s1, s2) == 0) {
if (strcasecmp_m(s1, s2) == 0) {
return DNS_CMP_MATCH;
}
return DNS_CMP_NO_MATCH;
@ -3512,7 +3512,7 @@ static int dns_cmp(const char *s1, size_t l1,
return DNS_CMP_NO_MATCH;
}
if (StrCaseCmp(&p1[t1 - t2], p2) == 0) {
if (strcasecmp_m(&p1[t1 - t2], p2) == 0) {
return cret;
}
@ -3701,7 +3701,7 @@ static NTSTATUS check_ft_info(TALLOC_CTX *mem_ctx,
sid_conflict = true;
}
if (!(trec->flags & LSA_NB_DISABLED_ADMIN) &&
StrCaseCmp(trec->data.info.netbios_name.string,
strcasecmp_m(trec->data.info.netbios_name.string,
nb_name) == 0) {
nb_conflict = true;
}
@ -3876,7 +3876,7 @@ NTSTATUS _lsa_lsaRSetForestTrustInformation(struct pipes_struct *p,
if (domains[i]->domain_name == NULL) {
return NT_STATUS_INVALID_DOMAIN_STATE;
}
if (StrCaseCmp(domains[i]->domain_name,
if (strcasecmp_m(domains[i]->domain_name,
r->in.trusted_domain_name->string) == 0) {
break;
}

View File

@ -423,8 +423,8 @@ static bool winreg_init_cb(void *ptr)
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
bool ok;
@ -471,8 +471,8 @@ static bool srvsvc_init_cb(void *ptr)
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
bool ok;
@ -520,8 +520,8 @@ static bool lsarpc_init_cb(void *ptr)
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
bool ok;
@ -569,8 +569,8 @@ static bool samr_init_cb(void *ptr)
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
bool ok;
@ -618,8 +618,8 @@ static bool netlogon_init_cb(void *ptr)
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
bool ok;
@ -673,8 +673,8 @@ static bool spoolss_init_cb(void *ptr)
return false;
}
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
status =rpc_ep_setup_register(ep_ctx->ev_ctx,
@ -717,8 +717,8 @@ static bool svcctl_init_cb(void *ptr)
/* initialize the control hooks */
init_service_op_table();
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
status = rpc_ep_setup_register(ep_ctx->ev_ctx,
@ -752,8 +752,8 @@ static bool ntsvcs_init_cb(void *ptr)
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
status = rpc_ep_setup_register(ep_ctx->ev_ctx,
@ -786,8 +786,8 @@ static bool eventlog_init_cb(void *ptr)
return false;
}
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
status =rpc_ep_setup_register(ep_ctx->ev_ctx,
@ -814,8 +814,8 @@ static bool initshutdown_init_cb(void *ptr)
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
status = rpc_ep_setup_register(ep_ctx->ev_ctx,
@ -843,8 +843,8 @@ static bool rpcecho_init_cb(void *ptr) {
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
port = _open_sockets(ep_ctx->ev_ctx,
@ -883,8 +883,8 @@ static bool netdfs_init_cb(void *ptr)
"rpc_server",
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
bool ok;
@ -932,8 +932,8 @@ static bool dssetup_init_cb(void *ptr)
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
bool ok;
@ -980,8 +980,8 @@ static bool wkssvc_init_cb(void *ptr)
"rpc_server",
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0 ||
strcasecmp_m(rpcsrv_type, "daemon") == 0) {
NTSTATUS status;
bool ok;
@ -1056,7 +1056,7 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
"rpc_server",
"epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0) {
epmapper_cb.init = epmapper_init_cb;
epmapper_cb.shutdown = epmapper_shutdown_cb;
epmapper_cb.private_data = ep_ctx;
@ -1064,7 +1064,7 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
if (!NT_STATUS_IS_OK(rpc_epmapper_init(&epmapper_cb))) {
return false;
}
} else if (StrCaseCmp(rpcsrv_type, "daemon") == 0) {
} else if (strcasecmp_m(rpcsrv_type, "daemon") == 0) {
if (!NT_STATUS_IS_OK(rpc_epmapper_init(NULL))) {
return false;
}
@ -1110,15 +1110,15 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
"rpc_server",
"spoolss",
"embedded");
if (StrCaseCmp(rpcsrv_type, "embedded") == 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") == 0) {
spoolss_cb.init = spoolss_init_cb;
spoolss_cb.shutdown = spoolss_shutdown_cb;
spoolss_cb.private_data = ep_ctx;
if (!NT_STATUS_IS_OK(rpc_spoolss_init(&spoolss_cb))) {
return false;
}
} else if (StrCaseCmp(rpcsrv_type, "daemon") == 0 ||
StrCaseCmp(rpcsrv_type, "external") == 0) {
} else if (strcasecmp_m(rpcsrv_type, "daemon") == 0 ||
strcasecmp_m(rpcsrv_type, "external") == 0) {
if (!NT_STATUS_IS_OK(rpc_spoolss_init(NULL))) {
return false;
}

View File

@ -895,7 +895,7 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
"rpc_server", pipe_name,
"embedded");
if (StrCaseCmp(server_type, "embedded") == 0) {
if (strcasecmp_m(server_type, "embedded") == 0) {
status = rpc_pipe_open_internal(tmp_ctx,
syntax, session_info,
client_id, msg_ctx,
@ -903,8 +903,8 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
} else if (StrCaseCmp(server_type, "daemon") == 0 ||
StrCaseCmp(server_type, "external") == 0) {
} else if (strcasecmp_m(server_type, "daemon") == 0 ||
strcasecmp_m(server_type, "external") == 0) {
/* It would be nice to just use rpc_pipe_open_ncalrpc() but
* for now we need to use the special proxy setup to connect
* to spoolssd. */

View File

@ -2339,32 +2339,32 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx,
{
DEBUG(8,("getprinterdata_printer_server:%s\n", value));
if (!StrCaseCmp(value, "W3SvcInstalled")) {
if (!strcasecmp_m(value, "W3SvcInstalled")) {
*type = REG_DWORD;
data->value = 0x00;
return WERR_OK;
}
if (!StrCaseCmp(value, "BeepEnabled")) {
if (!strcasecmp_m(value, "BeepEnabled")) {
*type = REG_DWORD;
data->value = 0x00;
return WERR_OK;
}
if (!StrCaseCmp(value, "EventLog")) {
if (!strcasecmp_m(value, "EventLog")) {
*type = REG_DWORD;
/* formally was 0x1b */
data->value = 0x00;
return WERR_OK;
}
if (!StrCaseCmp(value, "NetPopup")) {
if (!strcasecmp_m(value, "NetPopup")) {
*type = REG_DWORD;
data->value = 0x00;
return WERR_OK;
}
if (!StrCaseCmp(value, "MajorVersion")) {
if (!strcasecmp_m(value, "MajorVersion")) {
*type = REG_DWORD;
/* Windows NT 4.0 seems to not allow uploading of drivers
@ -2381,7 +2381,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx,
return WERR_OK;
}
if (!StrCaseCmp(value, "MinorVersion")) {
if (!strcasecmp_m(value, "MinorVersion")) {
*type = REG_DWORD;
data->value = 0x00;
return WERR_OK;
@ -2394,7 +2394,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx,
* uint32_t build = [2195|2600]
* extra unicode string = e.g. "Service Pack 3"
*/
if (!StrCaseCmp(value, "OSVersion")) {
if (!strcasecmp_m(value, "OSVersion")) {
DATA_BLOB blob;
enum ndr_err_code ndr_err;
struct spoolss_OSVersion os;
@ -2417,7 +2417,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx,
}
if (!StrCaseCmp(value, "DefaultSpoolDirectory")) {
if (!strcasecmp_m(value, "DefaultSpoolDirectory")) {
*type = REG_SZ;
data->string = talloc_strdup(mem_ctx, "C:\\PRINTERS");
@ -2426,7 +2426,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx,
return WERR_OK;
}
if (!StrCaseCmp(value, "Architecture")) {
if (!strcasecmp_m(value, "Architecture")) {
*type = REG_SZ;
data->string = talloc_strdup(mem_ctx,
lp_parm_const_string(GLOBAL_SECTION_SNUM, "spoolss", "architecture", SPOOLSS_ARCHITECTURE_NT_X86));
@ -2435,7 +2435,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx,
return WERR_OK;
}
if (!StrCaseCmp(value, "DsPresent")) {
if (!strcasecmp_m(value, "DsPresent")) {
*type = REG_DWORD;
/* only show the publish check box if we are a
@ -2449,7 +2449,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx,
return WERR_OK;
}
if (!StrCaseCmp(value, "DNSMachineName")) {
if (!strcasecmp_m(value, "DNSMachineName")) {
const char *hostname = get_mydnsfullname();
if (!hostname) {

View File

@ -433,7 +433,7 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
"rpc_server", name,
"embedded");
if (StrCaseCmp(rpcsrv_type, "embedded") != 0) {
if (strcasecmp_m(rpcsrv_type, "embedded") != 0) {
external = true;
}

View File

@ -284,14 +284,14 @@ static NTSTATUS get_domain_handle(struct rpc_pipe_client *cli,
struct dcerpc_binding_handle *b = cli->binding_handle;
NTSTATUS status = NT_STATUS_INVALID_PARAMETER, result;
if (StrCaseCmp(sam, "domain") == 0) {
if (strcasecmp_m(sam, "domain") == 0) {
status = dcerpc_samr_OpenDomain(b, mem_ctx,
connect_pol,
access_mask,
_domain_sid,
domain_pol,
&result);
} else if (StrCaseCmp(sam, "builtin") == 0) {
} else if (strcasecmp_m(sam, "builtin") == 0) {
status = dcerpc_samr_OpenDomain(b, mem_ctx,
connect_pol,
access_mask,

View File

@ -83,7 +83,7 @@ static const char *cmd_spoolss_get_short_archi(const char *long_archi)
do {
i++;
} while ( (archi_table[i].long_archi!=NULL ) &&
StrCaseCmp(long_archi, archi_table[i].long_archi) );
strcasecmp_m(long_archi, archi_table[i].long_archi) );
if (archi_table[i].long_archi==NULL) {
DEBUGADD(10,("Unknown architecture [%s] !\n", long_archi));
@ -1616,7 +1616,7 @@ static char *get_driver_3_param(TALLOC_CTX *mem_ctx, char *str,
parameter because two consecutive delimiters
will not return an empty string. See man strtok(3)
for details */
if (ptr && (StrCaseCmp(ptr, "NULL") == 0)) {
if (ptr && (strcasecmp_m(ptr, "NULL") == 0)) {
ptr = NULL;
}

View File

@ -240,7 +240,7 @@ static NTSTATUS cmd_listcommands(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
{
tmp_set = tmp->cmd_set;
if (!StrCaseCmp(argv[1], tmp_set->name))
if (!strcasecmp_m(argv[1], tmp_set->name))
{
printf("Available commands on the %s pipe:\n\n", tmp_set->name);

View File

@ -1427,7 +1427,7 @@ static int fill_srv_info(struct srv_info_struct *service,
static int srv_comp(struct srv_info_struct *s1,struct srv_info_struct *s2)
{
return StrCaseCmp(s1->name,s2->name);
return strcasecmp_m(s1->name,s2->name);
}
/****************************************************************************
@ -1596,7 +1596,7 @@ static int srv_name_match(const char *n1, const char *n2)
* the server will return a list of servers that exist on
* the network greater than or equal to the FirstNameToReturn.
*/
int ret = StrCaseCmp(n1, n2);
int ret = strcasecmp_m(n1, n2);
if (ret <= 0) {
return 0;
@ -1708,7 +1708,7 @@ static bool api_RNetServerEnum3(struct smbd_server_connection *sconn,
*/
for (;first > 0;) {
int ret;
ret = StrCaseCmp(first_name,
ret = strcasecmp_m(first_name,
servers[first-1].name);
if (ret > 0) {
break;

View File

@ -1202,7 +1202,7 @@ extern void build_options(bool screen);
rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
"rpc_server", "epmapper",
"none");
if (StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "daemon") == 0) {
start_epmd(smbd_event_context(),
smbd_server_conn->msg_ctx);
}
@ -1235,7 +1235,7 @@ extern void build_options(bool screen);
rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
"rpc_server", "spoolss",
"embedded");
if (StrCaseCmp(rpcsrv_type, "daemon") == 0) {
if (strcasecmp_m(rpcsrv_type, "daemon") == 0) {
start_spoolssd(smbd_event_context(),
smbd_messaging_context());
}

View File

@ -1219,7 +1219,7 @@ static bool exact_match(bool has_wild,
if (case_sensitive) {
return strcmp(str,mask)==0;
} else {
return StrCaseCmp(str,mask) == 0;
return strcasecmp_m(str,mask) == 0;
}
}

View File

@ -1,7 +1,7 @@
/*
* Copyright (C) 2003 by Martin Pool
*
* Test harness for StrCaseCmp
* Test harness for strcasecmp_m
*/
#include "includes.h"
@ -16,7 +16,7 @@ int main(int argc, char *argv[])
if (argc < 3) {
fprintf(stderr, "usage: %s STRING1 STRING2 [ITERS]\n"
"Compares two strings, prints the results of StrCaseCmp\n",
"Compares two strings, prints the results of strcasecmp_m\n",
argv[0]);
return 2;
}
@ -24,7 +24,7 @@ int main(int argc, char *argv[])
iters = atoi(argv[3]);
for (i = 0; i < iters; i++)
ret = StrCaseCmp(argv[1], argv[2]);
ret = strcasecmp_m(argv[1], argv[2]);
printf("%d\n", ret);

View File

@ -7980,7 +7980,7 @@ static NTSTATUS split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname,
stype = "$DATA";
}
else {
if (StrCaseCmp(stype, ":$DATA") != 0) {
if (strcasecmp_m(stype, ":$DATA") != 0) {
/*
* If there is an explicit stream type, so far we only
* allow $DATA. Is there anything else allowed? -- vl

View File

@ -475,16 +475,16 @@ int main( int argc, char *argv[] )
/* note that the separate command types should call usage if they need to... */
while ( 1 ) {
if ( !StrCaseCmp( opname, "addsource" ) ) {
if ( !strcasecmp_m( opname, "addsource" ) ) {
rc = DoAddSourceCommand( argc, argv, opt_debug,
exename );
break;
}
if ( !StrCaseCmp( opname, "write" ) ) {
if ( !strcasecmp_m( opname, "write" ) ) {
rc = DoWriteCommand( argc, argv, opt_debug, exename );
break;
}
if ( !StrCaseCmp( opname, "dump" ) ) {
if ( !strcasecmp_m( opname, "dump" ) ) {
rc = DoDumpCommand( argc, argv, opt_debug, exename );
break;
}

View File

@ -441,10 +441,10 @@ static bool usergrp_display(ADS_STRUCT *ads, char *field, void **values, void *d
}
if (!values) /* must be new field, indicate string field */
return true;
if (StrCaseCmp(field, "sAMAccountName") == 0) {
if (strcasecmp_m(field, "sAMAccountName") == 0) {
disp_fields[0] = SMB_STRDUP((char *) values[0]);
}
if (StrCaseCmp(field, "description") == 0)
if (strcasecmp_m(field, "description") == 0)
disp_fields[1] = SMB_STRDUP((char *) values[0]);
return true;
}

View File

@ -1183,7 +1183,7 @@ static int net_conf_run_function(struct net_context *c, int argc,
if (argc != 0) {
for (i=0; table[i].funcname; i++) {
if (StrCaseCmp(argv[0], table[i].funcname) == 0)
if (strcasecmp_m(argv[0], table[i].funcname) == 0)
return net_conf_wrap_function(c, table[i].fn,
argc-1,
argv+1);

View File

@ -44,7 +44,7 @@ int net_file(struct net_context *c, int argc, const char **argv)
if (argc < 1)
return net_file_usage(c, argc, argv);
if (StrCaseCmp(argv[0], "HELP") == 0) {
if (strcasecmp_m(argv[0], "HELP") == 0) {
net_file_usage(c, argc, argv);
return 0;
}

View File

@ -55,7 +55,7 @@ int net_group(struct net_context *c, int argc, const char **argv)
if (argc < 1)
return net_group_usage(c, argc, argv);
if (StrCaseCmp(argv[0], "HELP") == 0) {
if (strcasecmp_m(argv[0], "HELP") == 0) {
net_group_usage(c, argc, argv);
return 0;
}

View File

@ -100,7 +100,7 @@ static int net_groupmap_list(struct net_context *c, int argc, const char **argv)
/* get the options */
for ( i=0; i<argc; i++ ) {
if ( !StrCaseCmp(argv[i], "verbose")) {
if ( !strcasecmp_m(argv[i], "verbose")) {
long_list = true;
}
else if ( !StrnCaseCmp(argv[i], "ntgroup", strlen("ntgroup")) ) {

View File

@ -60,7 +60,7 @@ int net_help(struct net_context *c, int argc, const char **argv)
return net_usage(c, argc, argv);
}
if (StrCaseCmp(argv[0], "help") == 0) {
if (strcasecmp_m(argv[0], "help") == 0) {
return net_help_usage(c, argc, argv);
}

View File

@ -34,7 +34,7 @@ int net_join_usage(struct net_context *c, int argc, const char **argv)
int net_join(struct net_context *c, int argc, const char **argv)
{
if ((argc > 0) && (StrCaseCmp(argv[0], "HELP") == 0)) {
if ((argc > 0) && (strcasecmp_m(argv[0], "HELP") == 0)) {
net_join_usage(c, argc, argv);
return 0;
}

View File

@ -457,7 +457,7 @@ int net_lookup(struct net_context *c, int argc, const char **argv)
return net_lookup_usage(c, argc, argv);
}
for (i=0; table[i].funcname; i++) {
if (StrCaseCmp(argv[0], table[i].funcname) == 0)
if (strcasecmp_m(argv[0], table[i].funcname) == 0)
return table[i].fn(c, argc-1, argv+1);
}

View File

@ -6532,7 +6532,7 @@ static int rpc_trustdom_vampire(struct net_context *c, int argc,
* or to remote one given in command line
*/
if (StrCaseCmp(c->opt_workgroup, lp_workgroup())) {
if (strcasecmp_m(c->opt_workgroup, lp_workgroup())) {
domain_name = c->opt_workgroup;
c->opt_target_workgroup = c->opt_workgroup;
} else {
@ -6712,7 +6712,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
* or to remote one given in command line
*/
if (StrCaseCmp(c->opt_workgroup, lp_workgroup())) {
if (strcasecmp_m(c->opt_workgroup, lp_workgroup())) {
domain_name = c->opt_workgroup;
c->opt_target_workgroup = c->opt_workgroup;
} else {

View File

@ -190,7 +190,7 @@ static NTSTATUS check_privilege_for_user(struct rpc_pipe_client *pipe_hnd,
}
for (i = 0; i < rights.count; i++) {
if (StrCaseCmp(rights.names[i].string, right) == 0) {
if (strcasecmp_m(rights.names[i].string, right) == 0) {
return NT_STATUS_OK;
}
}

View File

@ -62,7 +62,7 @@ int net_share_usage(struct net_context *c, int argc, const char **argv)
int net_share(struct net_context *c, int argc, const char **argv)
{
if (argc > 0 && StrCaseCmp(argv[0], "HELP") == 0) {
if (argc > 0 && strcasecmp_m(argv[0], "HELP") == 0) {
net_share_usage(c, argc, argv);
return 0;
}

View File

@ -50,7 +50,7 @@ int net_user(struct net_context *c, int argc, const char **argv)
if (argc < 1)
return net_user_usage(c, argc, argv);
if (StrCaseCmp(argv[0], "HELP") == 0) {
if (strcasecmp_m(argv[0], "HELP") == 0) {
net_user_usage(c, argc, argv);
return 0;
}

View File

@ -586,7 +586,7 @@ int net_run_function(struct net_context *c, int argc, const char **argv,
if (argc != 0) {
for (i=0; table[i].funcname != NULL; i++) {
if (StrCaseCmp(argv[0], table[i].funcname) == 0)
if (strcasecmp_m(argv[0], table[i].funcname) == 0)
return table[i].fn(c, argc-1, argv+1);
}
}