mirror of
https://github.com/samba-team/samba.git
synced 2025-11-27 08:23:49 +03:00
r9792: Rename StrCaseCmp -> strcasecmp_m. All these years I was thinking
StrCaseCmp was sys_strcasecmp, while it is in fact strcasecmp_m!
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
1d8dae5167
commit
200a8f6652
@@ -253,7 +253,7 @@ static BOOL ads_cleanup_expired_creds(krb5_context context,
|
||||
use memory ccaches, and a FILE one probably means that
|
||||
we're using creds obtained outside of our exectuable
|
||||
*/
|
||||
if (StrCaseCmp(krb5_cc_get_type(context, ccache), "FILE") == 0) {
|
||||
if (strcasecmp_m(krb5_cc_get_type(context, ccache), "FILE") == 0) {
|
||||
DEBUG(5, ("ads_cleanup_expired_creds: We do not remove creds from a FILE ccache\n"));
|
||||
return False;
|
||||
}
|
||||
|
||||
@@ -469,7 +469,7 @@ static krb5_error_code LDB_lookup_principal(krb5_context context, struct ldb_con
|
||||
|
||||
/* Allow host/dns.name/realm@REALM, just convert into host/dns.name@REALM */
|
||||
if (princ.name.name_string.len == 3
|
||||
&& StrCaseCmp(princ.name.name_string.val[2], princ.realm) == 0) {
|
||||
&& strcasecmp_m(princ.name.name_string.val[2], princ.realm) == 0) {
|
||||
princ.name.name_string.len = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ extern int mprMemcpy(char *dest, int destMax, const char *src, int nbytes);
|
||||
extern void mprSetCtx(void *ctx);
|
||||
extern void *mprMemCtx(void);
|
||||
|
||||
#define mprStrCmpAnyCase(s1, s2) StrCaseCmp(s1, s2)
|
||||
#define mprStrCmpAnyCase(s1, s2) strcasecmp_m(s1, s2)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ int ms_fnmatch(const char *pattern, const char *string, enum protocol_types prot
|
||||
if (strpbrk(pattern, "<>*?\"") == NULL) {
|
||||
/* this is not just an optmisation - it is essential
|
||||
for LANMAN1 correctness */
|
||||
return StrCaseCmp(pattern, string);
|
||||
return strcasecmp_m(pattern, string);
|
||||
}
|
||||
|
||||
if (protocol <= PROTOCOL_LANMAN2) {
|
||||
|
||||
@@ -31,7 +31,7 @@ struct samba3_domainsecrets *samba3_find_domainsecrets(struct samba3 *db, const
|
||||
int i;
|
||||
|
||||
for (i = 0; i < db->secrets.domain_count; i++) {
|
||||
if (!StrCaseCmp(db->secrets.domains[i].name, name))
|
||||
if (!strcasecmp_m(db->secrets.domains[i].name, name))
|
||||
return &db->secrets.domains[i];
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ struct samba3_share_info *samba3_find_share(struct samba3 *db, const char *name)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < db->share_count; i++) {
|
||||
if (!StrCaseCmp(db->shares[i].name, name))
|
||||
if (!strcasecmp_m(db->shares[i].name, name))
|
||||
return &db->shares[i];
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ const char *samba3_get_param(struct samba3 *samba3, const char *section, const c
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < share->parameter_count; i++) {
|
||||
if (!StrCaseCmp(share->parameters[i].name, param))
|
||||
if (!strcasecmp_m(share->parameters[i].name, param))
|
||||
return share->parameters[i].value;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ static struct samba3_domainsecrets *secrets_find_domain(TALLOC_CTX *ctx, struct
|
||||
|
||||
for (i = 0; i < db->domain_count; i++)
|
||||
{
|
||||
if (!StrCaseCmp(db->domains[i].name, key))
|
||||
if (!strcasecmp_m(db->domains[i].name, key))
|
||||
return &db->domains[i];
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ BOOL next_token(const char **ptr,char *buff, const char *sep, size_t bufsize)
|
||||
/**
|
||||
Case insensitive string compararison
|
||||
**/
|
||||
int StrCaseCmp(const char *s1, const char *s2)
|
||||
int strcasecmp_m(const char *s1, const char *s2)
|
||||
{
|
||||
codepoint_t c1=0, c2=0;
|
||||
size_t size1, size2;
|
||||
@@ -122,7 +122,7 @@ BOOL strequal(const char *s1, const char *s2)
|
||||
if (!s1 || !s2)
|
||||
return(False);
|
||||
|
||||
return StrCaseCmp(s1,s2) == 0;
|
||||
return strcasecmp_m(s1,s2) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -477,7 +477,7 @@ BOOL in_list(const char *s, const char *list, BOOL casesensitive)
|
||||
if (strcmp(tok,s) == 0)
|
||||
return(True);
|
||||
} else {
|
||||
if (StrCaseCmp(tok,s) == 0)
|
||||
if (strcasecmp_m(tok,s) == 0)
|
||||
return(True);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1206,7 +1206,7 @@ static BOOL ads_dump_field(char *field, void **values, void *data_area)
|
||||
}
|
||||
|
||||
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(field, (struct berval **) values);
|
||||
|
||||
@@ -246,7 +246,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, value->valuename) == 0) {
|
||||
if (strcasecmp_m(map[i].valname, value->valuename) == 0) {
|
||||
if (!map[i].fn(ctx, mods, value)) {
|
||||
DEBUG(5, ("Add of value %s to modlist failed\n", value->valuename));
|
||||
} else {
|
||||
|
||||
@@ -184,7 +184,7 @@ static NTSTATUS libnet_SamDump_netlogon(struct libnet_context *ctx, TALLOC_CTX *
|
||||
for (t=samdump_state->trusted_domains; t; t=t->next) {
|
||||
char *secret_name = talloc_asprintf(mem_ctx, "G$$%s", t->name);
|
||||
for (s=samdump_state->secrets; s; s=s->next) {
|
||||
if (StrCaseCmp(s->name, secret_name) == 0) {
|
||||
if (strcasecmp_m(s->name, secret_name) == 0) {
|
||||
char *secret_string;
|
||||
if (convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX,
|
||||
s->secret.data, s->secret.length,
|
||||
|
||||
@@ -283,14 +283,14 @@ NTSTATUS pvfs_list_seek(struct pvfs_dir *dir, const char *name, uint_t *ofs)
|
||||
|
||||
for (i=dir->name_cache_index;i>=0;i--) {
|
||||
struct name_cache_entry *e = &dir->name_cache[i];
|
||||
if (e->name && StrCaseCmp(name, e->name) == 0) {
|
||||
if (e->name && strcasecmp_m(name, e->name) == 0) {
|
||||
*ofs = e->offset;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
}
|
||||
for (i=NAME_CACHE_SIZE-1;i>dir->name_cache_index;i--) {
|
||||
struct name_cache_entry *e = &dir->name_cache[i];
|
||||
if (e->name && StrCaseCmp(name, e->name) == 0) {
|
||||
if (e->name && strcasecmp_m(name, e->name) == 0) {
|
||||
*ofs = e->offset;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ NTSTATUS pvfs_list_seek(struct pvfs_dir *dir, const char *name, uint_t *ofs)
|
||||
rewinddir(dir->dir);
|
||||
|
||||
while ((de = readdir(dir->dir))) {
|
||||
if (StrCaseCmp(name, de->d_name) == 0) {
|
||||
if (strcasecmp_m(name, de->d_name) == 0) {
|
||||
dir->offset = telldir(dir->dir) + DIR_OFFSET_BASE;
|
||||
*ofs = dir->offset;
|
||||
return NT_STATUS_OK;
|
||||
|
||||
@@ -734,7 +734,7 @@ static NTSTATUS pvfs_open_deny_dos(struct ntvfs_module_context *ntvfs,
|
||||
(NTCREATEX_OPTIONS_PRIVATE_DENY_DOS |
|
||||
NTCREATEX_OPTIONS_PRIVATE_DENY_FCB)) &&
|
||||
(f2->access_mask & SEC_FILE_WRITE_DATA) &&
|
||||
StrCaseCmp(f2->handle->name->original_name,
|
||||
strcasecmp_m(f2->handle->name->original_name,
|
||||
io->generic.in.fname)==0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ NTSTATUS pvfs_query_ea_list(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
|
||||
eas->eas[i].name.s = names[i].name.s;
|
||||
eas->eas[i].value = data_blob(NULL, 0);
|
||||
for (j=0;j<ealist->num_eas;j++) {
|
||||
if (StrCaseCmp(eas->eas[i].name.s,
|
||||
if (strcasecmp_m(eas->eas[i].name.s,
|
||||
ealist->eas[j].name) == 0) {
|
||||
eas->eas[i].value = ealist->eas[j].value;
|
||||
break;
|
||||
|
||||
@@ -38,12 +38,12 @@ static int component_compare(struct pvfs_state *pvfs, const char *comp, const ch
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = StrCaseCmp(comp, name);
|
||||
ret = strcasecmp_m(comp, name);
|
||||
|
||||
if (ret != 0) {
|
||||
char *shortname = pvfs_short_name_component(pvfs, name);
|
||||
if (shortname) {
|
||||
ret = StrCaseCmp(comp, shortname);
|
||||
ret = strcasecmp_m(comp, shortname);
|
||||
talloc_free(shortname);
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ static NTSTATUS parse_stream_name(struct pvfs_filename *name, const char *s)
|
||||
strlen(name->stream_name));
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
if (StrCaseCmp(p, ":$DATA") != 0) {
|
||||
if (strcasecmp_m(p, ":$DATA") != 0) {
|
||||
return NT_STATUS_OBJECT_NAME_INVALID;
|
||||
}
|
||||
*p = 0;
|
||||
|
||||
@@ -186,7 +186,7 @@ NTSTATUS pvfs_setfileinfo_ea_set(struct pvfs_state *pvfs,
|
||||
struct ea_struct *ea = &eas[j];
|
||||
/* see if its already there */
|
||||
for (i=0;i<ealist->num_eas;i++) {
|
||||
if (StrCaseCmp(ealist->eas[i].name, ea->name.s) == 0) {
|
||||
if (strcasecmp_m(ealist->eas[i].name, ea->name.s) == 0) {
|
||||
ealist->eas[i].value = ea->value;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ NTSTATUS pvfs_stream_info(struct pvfs_state *pvfs, struct pvfs_filename *name, i
|
||||
|
||||
for (i=0;i<streams->num_streams;i++) {
|
||||
struct xattr_DosStream *s = &streams->streams[i];
|
||||
if (StrCaseCmp(s->name, name->stream_name) == 0) {
|
||||
if (strcasecmp_m(s->name, name->stream_name) == 0) {
|
||||
name->dos.alloc_size = pvfs_round_alloc_size(pvfs, s->alloc_size);
|
||||
name->st.st_size = s->size;
|
||||
name->stream_exists = True;
|
||||
@@ -138,7 +138,7 @@ static NTSTATUS pvfs_stream_update_size(struct pvfs_state *pvfs, struct pvfs_fil
|
||||
|
||||
for (i=0;i<streams->num_streams;i++) {
|
||||
struct xattr_DosStream *s = &streams->streams[i];
|
||||
if (StrCaseCmp(s->name, name->stream_name) == 0) {
|
||||
if (strcasecmp_m(s->name, name->stream_name) == 0) {
|
||||
s->size = size;
|
||||
s->alloc_size = pvfs_round_alloc_size(pvfs, size);
|
||||
break;
|
||||
@@ -216,7 +216,7 @@ NTSTATUS pvfs_stream_delete(struct pvfs_state *pvfs,
|
||||
|
||||
for (i=0;i<streams->num_streams;i++) {
|
||||
struct xattr_DosStream *s = &streams->streams[i];
|
||||
if (StrCaseCmp(s->name, name->stream_name) == 0) {
|
||||
if (strcasecmp_m(s->name, name->stream_name) == 0) {
|
||||
memmove(s, s+1, (streams->num_streams - (i+1)) * sizeof(*s));
|
||||
streams->num_streams--;
|
||||
break;
|
||||
|
||||
@@ -1499,7 +1499,7 @@ static NTSTATUS lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_call,
|
||||
if (ldb_flag == LDB_FLAG_MOD_ADD) {
|
||||
int j;
|
||||
for (j=0;j<r2.out.rights->count;j++) {
|
||||
if (StrCaseCmp(r2.out.rights->names[j].string,
|
||||
if (strcasecmp_m(r2.out.rights->names[j].string,
|
||||
rights->names[i].string) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
}} while (0)
|
||||
|
||||
#define CHECK_STRING(v, correct) do { \
|
||||
if (StrCaseCmp(v, correct) != 0) { \
|
||||
if (strcasecmp_m(v, correct) != 0) { \
|
||||
printf("(%s) Incorrect value %s='%s' - should be '%s'\n", \
|
||||
__location__, #v, v, correct); \
|
||||
ret = False; \
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#define CHECK_STRING(v, correct) do { \
|
||||
if ((v) != (correct) && \
|
||||
((v)==NULL || (correct)==NULL || StrCaseCmp(v, correct) != 0)) { \
|
||||
((v)==NULL || (correct)==NULL || strcasecmp_m(v, correct) != 0)) { \
|
||||
printf("(%s) Incorrect value %s='%s' - should be '%s'\n", \
|
||||
__location__, #v, v, correct); \
|
||||
ret = False; \
|
||||
|
||||
@@ -554,7 +554,7 @@ static NTSTATUS multiple_search(struct smbcli_state *cli,
|
||||
}} while (0)
|
||||
|
||||
#define CHECK_STRING(v, correct) do { \
|
||||
if (StrCaseCmp(v, correct) != 0) { \
|
||||
if (strcasecmp_m(v, correct) != 0) { \
|
||||
printf("(%s) Incorrect value %s='%s' - should be '%s'\n", \
|
||||
__location__, #v, v, correct); \
|
||||
ret = False; \
|
||||
@@ -900,7 +900,7 @@ static BOOL test_sorted(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
|
||||
const char *name1, *name2;
|
||||
name1 = result.list[i].both_directory_info.name.s;
|
||||
name2 = result.list[i+1].both_directory_info.name.s;
|
||||
if (StrCaseCmp(name1, name2) > 0) {
|
||||
if (strcasecmp_m(name1, name2) > 0) {
|
||||
printf("non-alphabetical order at entry %d '%s' '%s'\n",
|
||||
i, name1, name2);
|
||||
printf("Server does not produce sorted directory listings (not an error)\n");
|
||||
|
||||
@@ -286,7 +286,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam
|
||||
case SAM_DATABASE_DOMAIN:
|
||||
break;
|
||||
case SAM_DATABASE_BUILTIN:
|
||||
if (StrCaseCmp("BUILTIN", domain->domain_name.string) != 0) {
|
||||
if (strcasecmp_m("BUILTIN", domain->domain_name.string) != 0) {
|
||||
printf("BUILTIN domain has different name: %s\n", domain->domain_name.string);
|
||||
}
|
||||
break;
|
||||
@@ -300,7 +300,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam
|
||||
samsync_state->domain_name[database_id] =
|
||||
talloc_reference(samsync_state, domain->domain_name.string);
|
||||
} else {
|
||||
if (StrCaseCmp(samsync_state->domain_name[database_id], domain->domain_name.string) != 0) {
|
||||
if (strcasecmp_m(samsync_state->domain_name[database_id], domain->domain_name.string) != 0) {
|
||||
printf("Domain has name varies!: %s != %s\n", samsync_state->domain_name[database_id],
|
||||
domain->domain_name.string);
|
||||
return False;
|
||||
@@ -371,7 +371,7 @@ static BOOL samsync_handle_policy(TALLOC_CTX *mem_ctx, struct samsync_state *sam
|
||||
samsync_state->domain_name[SAM_DATABASE_DOMAIN] =
|
||||
talloc_reference(samsync_state, policy->primary_domain_name.string);
|
||||
} else {
|
||||
if (StrCaseCmp(samsync_state->domain_name[SAM_DATABASE_DOMAIN], policy->primary_domain_name.string) != 0) {
|
||||
if (strcasecmp_m(samsync_state->domain_name[SAM_DATABASE_DOMAIN], policy->primary_domain_name.string) != 0) {
|
||||
printf("PRIMARY domain has name varies between DOMAIN and POLICY!: %s != %s\n", samsync_state->domain_name[SAM_DATABASE_DOMAIN],
|
||||
policy->primary_domain_name.string);
|
||||
return False;
|
||||
@@ -1194,7 +1194,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state,
|
||||
for (t=samsync_state->trusted_domains; t; t=t->next) {
|
||||
char *secret_name = talloc_asprintf(trustdom_ctx, "G$$%s", t->name);
|
||||
for (s=samsync_state->secrets; s; s=s->next) {
|
||||
if (StrCaseCmp(s->name, secret_name) == 0) {
|
||||
if (strcasecmp_m(s->name, secret_name) == 0) {
|
||||
NTSTATUS nt_status;
|
||||
struct samr_Password nt_hash;
|
||||
mdfour(nt_hash.hash, s->secret.data, s->secret.length);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2003 by Martin Pool
|
||||
*
|
||||
* Test harness for StrCaseCmp
|
||||
* Test harness for strcasecmp_m
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
@@ -14,7 +14,7 @@ int main(int argc, char *argv[])
|
||||
return 2;
|
||||
}
|
||||
|
||||
printf("%d\n", StrCaseCmp(argv[1], argv[2]));
|
||||
printf("%d\n", strcasecmp_m(argv[1], argv[2]));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ NTSTATUS torture_check_ea(struct smbcli_state *cli,
|
||||
return NT_STATUS_EA_CORRUPT_ERROR;
|
||||
}
|
||||
|
||||
if (StrCaseCmp(eaname, info.ea_list.out.eas[0].name.s) != 0) {
|
||||
if (strcasecmp_m(eaname, info.ea_list.out.eas[0].name.s) != 0) {
|
||||
printf("Expected ea '%s' not '%s' in ea_list\n",
|
||||
eaname, info.ea_list.out.eas[0].name.s);
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
@@ -65,7 +65,7 @@ int net_run_function(struct net_context *ctx,
|
||||
}
|
||||
|
||||
for (i=0; functable[i].name; i++) {
|
||||
if (StrCaseCmp(argv[0], functable[i].name) == 0)
|
||||
if (strcasecmp_m(argv[0], functable[i].name) == 0)
|
||||
return functable[i].fn(ctx, argc-1, argv+1);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ int net_run_usage(struct net_context *ctx,
|
||||
}
|
||||
*/
|
||||
for (i=0; functable[i].name; i++) {
|
||||
if (StrCaseCmp(argv[0], functable[i].name) == 0)
|
||||
if (strcasecmp_m(argv[0], functable[i].name) == 0)
|
||||
if (functable[i].usage) {
|
||||
return functable[i].usage(ctx, argc-1, argv+1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user