From b674411eb46c9e45f2740a1f9bac365e9a347e9c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 30 Aug 2005 11:55:05 +0000 Subject: r9792: Rename StrCaseCmp -> strcasecmp_m. All these years I was thinking StrCaseCmp was sys_strcasecmp, while it is in fact strcasecmp_m! (This used to be commit 200a8f6652cb2de7a8037a7a4c2a204b50aee2b1) --- source4/auth/kerberos/clikrb5.c | 2 +- source4/kdc/hdb-ldb.c | 2 +- source4/lib/appweb/mpr/miniMpr.h | 2 +- source4/lib/ms_fnmatch.c | 2 +- source4/lib/samba3/samba3.c | 6 +++--- source4/lib/samba3/secrets.c | 2 +- source4/lib/util_str.c | 6 +++--- source4/libads/ldap.c | 2 +- source4/libads/ldap_printer.c | 2 +- source4/libnet/libnet_samdump.c | 2 +- source4/ntvfs/posix/pvfs_dirlist.c | 6 +++--- source4/ntvfs/posix/pvfs_open.c | 2 +- source4/ntvfs/posix/pvfs_qfileinfo.c | 2 +- source4/ntvfs/posix/pvfs_resolve.c | 6 +++--- source4/ntvfs/posix/pvfs_setfileinfo.c | 2 +- source4/ntvfs/posix/pvfs_streams.c | 6 +++--- source4/rpc_server/lsa/dcesrv_lsa.c | 2 +- source4/torture/nbt/register.c | 2 +- source4/torture/nbt/wins.c | 2 +- source4/torture/raw/search.c | 4 ++-- source4/torture/rpc/samsync.c | 8 ++++---- source4/torture/t_strcmp.c | 4 ++-- source4/torture/torture_util.c | 2 +- source4/utils/net/net.c | 4 ++-- 24 files changed, 40 insertions(+), 40 deletions(-) diff --git a/source4/auth/kerberos/clikrb5.c b/source4/auth/kerberos/clikrb5.c index 3f4f821958..40c1e254f8 100644 --- a/source4/auth/kerberos/clikrb5.c +++ b/source4/auth/kerberos/clikrb5.c @@ -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; } diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c index f138373cc3..ccdd64f40b 100644 --- a/source4/kdc/hdb-ldb.c +++ b/source4/kdc/hdb-ldb.c @@ -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; } diff --git a/source4/lib/appweb/mpr/miniMpr.h b/source4/lib/appweb/mpr/miniMpr.h index 6fc4d50c31..0f668ab1d4 100644 --- a/source4/lib/appweb/mpr/miniMpr.h +++ b/source4/lib/appweb/mpr/miniMpr.h @@ -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 } diff --git a/source4/lib/ms_fnmatch.c b/source4/lib/ms_fnmatch.c index c405d2ff30..699341bede 100644 --- a/source4/lib/ms_fnmatch.c +++ b/source4/lib/ms_fnmatch.c @@ -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) { diff --git a/source4/lib/samba3/samba3.c b/source4/lib/samba3/samba3.c index 4b893c585a..56a7738693 100644 --- a/source4/lib/samba3/samba3.c +++ b/source4/lib/samba3/samba3.c @@ -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; } diff --git a/source4/lib/samba3/secrets.c b/source4/lib/samba3/secrets.c index 43f0a2ec12..0f3cc0c581 100644 --- a/source4/lib/samba3/secrets.c +++ b/source4/lib/samba3/secrets.c @@ -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]; } diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c index a0e9da4160..685cc52c65 100644 --- a/source4/lib/util_str.c +++ b/source4/lib/util_str.c @@ -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); } } diff --git a/source4/libads/ldap.c b/source4/libads/ldap.c index f760843b59..642e31bb96 100644 --- a/source4/libads/ldap.c +++ b/source4/libads/ldap.c @@ -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); diff --git a/source4/libads/ldap_printer.c b/source4/libads/ldap_printer.c index 7ae19219b4..4e79f73a28 100644 --- a/source4/libads/ldap_printer.c +++ b/source4/libads/ldap_printer.c @@ -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 { diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index ecedc0264f..8936407972 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -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, diff --git a/source4/ntvfs/posix/pvfs_dirlist.c b/source4/ntvfs/posix/pvfs_dirlist.c index a055773b51..9838072080 100644 --- a/source4/ntvfs/posix/pvfs_dirlist.c +++ b/source4/ntvfs/posix/pvfs_dirlist.c @@ -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; diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 94749600e1..0e2a85bab1 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -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; } diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c index 4b6afac00a..1f2f86e953 100644 --- a/source4/ntvfs/posix/pvfs_qfileinfo.c +++ b/source4/ntvfs/posix/pvfs_qfileinfo.c @@ -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;jnum_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; diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c index 355e82c301..b8e55c85bf 100644 --- a/source4/ntvfs/posix/pvfs_resolve.c +++ b/source4/ntvfs/posix/pvfs_resolve.c @@ -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; diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c index 31a60fac18..0753ccb40b 100644 --- a/source4/ntvfs/posix/pvfs_setfileinfo.c +++ b/source4/ntvfs/posix/pvfs_setfileinfo.c @@ -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;inum_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; } diff --git a/source4/ntvfs/posix/pvfs_streams.c b/source4/ntvfs/posix/pvfs_streams.c index 2ee5034736..3910baadd0 100644 --- a/source4/ntvfs/posix/pvfs_streams.c +++ b/source4/ntvfs/posix/pvfs_streams.c @@ -97,7 +97,7 @@ NTSTATUS pvfs_stream_info(struct pvfs_state *pvfs, struct pvfs_filename *name, i for (i=0;inum_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;inum_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;inum_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; diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index c81eb99a0e..b976330bee 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -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;jcount;j++) { - if (StrCaseCmp(r2.out.rights->names[j].string, + if (strcasecmp_m(r2.out.rights->names[j].string, rights->names[i].string) == 0) { break; } diff --git a/source4/torture/nbt/register.c b/source4/torture/nbt/register.c index b35808c844..4b5931d341 100644 --- a/source4/torture/nbt/register.c +++ b/source4/torture/nbt/register.c @@ -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; \ diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c index 852147786e..b762c83609 100644 --- a/source4/torture/nbt/wins.c +++ b/source4/torture/nbt/wins.c @@ -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; \ diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c index d1ea290c62..96ceaf0a02 100644 --- a/source4/torture/raw/search.c +++ b/source4/torture/raw/search.c @@ -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"); diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index b15ee98200..9cd30ef019 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -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); diff --git a/source4/torture/t_strcmp.c b/source4/torture/t_strcmp.c index 622769001b..15d000c98f 100644 --- a/source4/torture/t_strcmp.c +++ b/source4/torture/t_strcmp.c @@ -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; } diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c index 42e2608c41..59eef81569 100644 --- a/source4/torture/torture_util.c +++ b/source4/torture/torture_util.c @@ -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); diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index 787f71705b..b6f54a46ce 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -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); } -- cgit