diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-05-13 20:23:36 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-05-18 16:12:08 +0200 |
commit | da662b82b87cdbe07762974b1f9e825ef15951bd (patch) | |
tree | f29813bc62f28b9bb73f835828c7f6d3ecbcc872 /source3/utils | |
parent | c615ebed6e3d273a682806b952d543e834e5630d (diff) | |
download | samba-da662b82b87cdbe07762974b1f9e825ef15951bd.tar.gz samba-da662b82b87cdbe07762974b1f9e825ef15951bd.tar.bz2 samba-da662b82b87cdbe07762974b1f9e825ef15951bd.zip |
s3-lib Replace StrnCaseCmp() with strncasecmp_m()
strncasecmp_m() never needs to call to talloc, and via next_codepoint()
still has an ASCII fast-path bypassing iconv() calls.
Andrew Bartlett
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_ads.c | 8 | ||||
-rw-r--r-- | source3/utils/net_groupmap.c | 32 | ||||
-rw-r--r-- | source3/utils/net_rpc.c | 2 | ||||
-rw-r--r-- | source3/utils/net_rpc_samsync.c | 18 | ||||
-rw-r--r-- | source3/utils/ntlm_auth.c | 2 |
5 files changed, 31 insertions, 31 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index e279c9d2bb..f712ddf220 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -1349,25 +1349,25 @@ int net_ads_join(struct net_context *c, int argc, const char **argv) /* process additional command line args */ for ( i=0; i<argc; i++ ) { - if ( !StrnCaseCmp(argv[i], "createupn", strlen("createupn")) ) { + if ( !strncasecmp_m(argv[i], "createupn", strlen("createupn")) ) { createupn = true; machineupn = get_string_param(argv[i]); } - else if ( !StrnCaseCmp(argv[i], "createcomputer", strlen("createcomputer")) ) { + else if ( !strncasecmp_m(argv[i], "createcomputer", strlen("createcomputer")) ) { if ( (create_in_ou = get_string_param(argv[i])) == NULL ) { d_fprintf(stderr, _("Please supply a valid OU path.\n")); werr = WERR_INVALID_PARAM; goto fail; } } - else if ( !StrnCaseCmp(argv[i], "osName", strlen("osName")) ) { + else if ( !strncasecmp_m(argv[i], "osName", strlen("osName")) ) { if ( (os_name = get_string_param(argv[i])) == NULL ) { d_fprintf(stderr, _("Please supply a operating system name.\n")); werr = WERR_INVALID_PARAM; goto fail; } } - else if ( !StrnCaseCmp(argv[i], "osVer", strlen("osVer")) ) { + else if ( !strncasecmp_m(argv[i], "osVer", strlen("osVer")) ) { if ( (os_version = get_string_param(argv[i])) == NULL ) { d_fprintf(stderr, _("Please supply a valid operating system version.\n")); werr = WERR_INVALID_PARAM; diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c index ca4c607166..09f4bfd33a 100644 --- a/source3/utils/net_groupmap.c +++ b/source3/utils/net_groupmap.c @@ -35,7 +35,7 @@ static bool get_sid_from_input(struct dom_sid *sid, char *input) { GROUP_MAP map; - if (StrnCaseCmp( input, "S-", 2)) { + if (strncasecmp_m( input, "S-", 2)) { /* Perhaps its the NT group name? */ if (!pdb_getgrnam(&map, input)) { printf(_("NT Group %s doesn't exist in mapping DB\n"), @@ -103,14 +103,14 @@ static int net_groupmap_list(struct net_context *c, int argc, const char **argv) if ( !strcasecmp_m(argv[i], "verbose")) { long_list = true; } - else if ( !StrnCaseCmp(argv[i], "ntgroup", strlen("ntgroup")) ) { + else if ( !strncasecmp_m(argv[i], "ntgroup", strlen("ntgroup")) ) { fstrcpy( ntgroup, get_string_param( argv[i] ) ); if ( !ntgroup[0] ) { d_fprintf(stderr, _("must supply a name\n")); return -1; } } - else if ( !StrnCaseCmp(argv[i], "sid", strlen("sid")) ) { + else if ( !strncasecmp_m(argv[i], "sid", strlen("sid")) ) { fstrcpy( sid_string, get_string_param( argv[i] ) ); if ( !sid_string[0] ) { d_fprintf(stderr, _("must supply a SID\n")); @@ -201,7 +201,7 @@ static int net_groupmap_add(struct net_context *c, int argc, const char **argv) /* get the options */ for ( i=0; i<argc; i++ ) { - if ( !StrnCaseCmp(argv[i], "rid", strlen("rid")) ) { + if ( !strncasecmp_m(argv[i], "rid", strlen("rid")) ) { rid = get_int_param(argv[i]); if ( rid < DOMAIN_RID_ADMINS ) { d_fprintf(stderr, @@ -210,28 +210,28 @@ static int net_groupmap_add(struct net_context *c, int argc, const char **argv) return -1; } } - else if ( !StrnCaseCmp(argv[i], "unixgroup", strlen("unixgroup")) ) { + else if ( !strncasecmp_m(argv[i], "unixgroup", strlen("unixgroup")) ) { fstrcpy( unixgrp, get_string_param( argv[i] ) ); if ( !unixgrp[0] ) { d_fprintf(stderr,_( "must supply a name\n")); return -1; } } - else if ( !StrnCaseCmp(argv[i], "ntgroup", strlen("ntgroup")) ) { + else if ( !strncasecmp_m(argv[i], "ntgroup", strlen("ntgroup")) ) { fstrcpy( ntgroup, get_string_param( argv[i] ) ); if ( !ntgroup[0] ) { d_fprintf(stderr, _("must supply a name\n")); return -1; } } - else if ( !StrnCaseCmp(argv[i], "sid", strlen("sid")) ) { + else if ( !strncasecmp_m(argv[i], "sid", strlen("sid")) ) { fstrcpy( string_sid, get_string_param( argv[i] ) ); if ( !string_sid[0] ) { d_fprintf(stderr, _("must supply a SID\n")); return -1; } } - else if ( !StrnCaseCmp(argv[i], "comment", strlen("comment")) ) { + else if ( !strncasecmp_m(argv[i], "comment", strlen("comment")) ) { fstrcpy( ntcomment, get_string_param( argv[i] ) ); if ( !ntcomment[0] ) { d_fprintf(stderr, @@ -239,7 +239,7 @@ static int net_groupmap_add(struct net_context *c, int argc, const char **argv) return -1; } } - else if ( !StrnCaseCmp(argv[i], "type", strlen("type")) ) { + else if ( !strncasecmp_m(argv[i], "type", strlen("type")) ) { fstrcpy( type, get_string_param( argv[i] ) ); switch ( type[0] ) { case 'b': @@ -361,21 +361,21 @@ static int net_groupmap_modify(struct net_context *c, int argc, const char **arg /* get the options */ for ( i=0; i<argc; i++ ) { - if ( !StrnCaseCmp(argv[i], "ntgroup", strlen("ntgroup")) ) { + if ( !strncasecmp_m(argv[i], "ntgroup", strlen("ntgroup")) ) { fstrcpy( ntgroup, get_string_param( argv[i] ) ); if ( !ntgroup[0] ) { d_fprintf(stderr, _("must supply a name\n")); return -1; } } - else if ( !StrnCaseCmp(argv[i], "sid", strlen("sid")) ) { + else if ( !strncasecmp_m(argv[i], "sid", strlen("sid")) ) { fstrcpy( sid_string, get_string_param( argv[i] ) ); if ( !sid_string[0] ) { d_fprintf(stderr, _("must supply a name\n")); return -1; } } - else if ( !StrnCaseCmp(argv[i], "comment", strlen("comment")) ) { + else if ( !strncasecmp_m(argv[i], "comment", strlen("comment")) ) { fstrcpy( ntcomment, get_string_param( argv[i] ) ); if ( !ntcomment[0] ) { d_fprintf(stderr, @@ -383,7 +383,7 @@ static int net_groupmap_modify(struct net_context *c, int argc, const char **arg return -1; } } - else if ( !StrnCaseCmp(argv[i], "unixgroup", strlen("unixgroup")) ) { + else if ( !strncasecmp_m(argv[i], "unixgroup", strlen("unixgroup")) ) { fstrcpy( unixgrp, get_string_param( argv[i] ) ); if ( !unixgrp[0] ) { d_fprintf(stderr, @@ -391,7 +391,7 @@ static int net_groupmap_modify(struct net_context *c, int argc, const char **arg return -1; } } - else if ( !StrnCaseCmp(argv[i], "type", strlen("type")) ) { + else if ( !strncasecmp_m(argv[i], "type", strlen("type")) ) { fstrcpy( type, get_string_param( argv[i] ) ); switch ( type[0] ) { case 'd': @@ -500,14 +500,14 @@ static int net_groupmap_delete(struct net_context *c, int argc, const char **arg /* get the options */ for ( i=0; i<argc; i++ ) { - if ( !StrnCaseCmp(argv[i], "ntgroup", strlen("ntgroup")) ) { + if ( !strncasecmp_m(argv[i], "ntgroup", strlen("ntgroup")) ) { fstrcpy( ntgroup, get_string_param( argv[i] ) ); if ( !ntgroup[0] ) { d_fprintf(stderr, _("must supply a name\n")); return -1; } } - else if ( !StrnCaseCmp(argv[i], "sid", strlen("sid")) ) { + else if ( !strncasecmp_m(argv[i], "sid", strlen("sid")) ) { fstrcpy( sid_string, get_string_param( argv[i] ) ); if ( !sid_string[0] ) { d_fprintf(stderr, _("must supply a SID\n")); diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 2c35ae974b..b705f6af97 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -1977,7 +1977,7 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli, TALLOC_FREE(pipe_hnd); } - if (!NT_STATUS_IS_OK(status) && (StrnCaseCmp(name, "S-", 2) == 0)) { + if (!NT_STATUS_IS_OK(status) && (strncasecmp_m(name, "S-", 2) == 0)) { /* Try as S-1-5-whatever */ diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c index 861f429559..04aefbb13f 100644 --- a/source3/utils/net_rpc_samsync.c +++ b/source3/utils/net_rpc_samsync.c @@ -51,50 +51,50 @@ static void parse_samsync_partial_replication_objects(TALLOC_CTX *mem_ctx, ZERO_STRUCT(o); - if (!StrnCaseCmp(argv[i], "user_rid=", strlen("user_rid="))) { + if (!strncasecmp_m(argv[i], "user_rid=", strlen("user_rid="))) { o.object_identifier.rid = get_int_param(argv[i]); o.object_type = NETR_DELTA_USER; o.database_id = SAM_DATABASE_DOMAIN; } - if (!StrnCaseCmp(argv[i], "group_rid=", strlen("group_rid="))) { + if (!strncasecmp_m(argv[i], "group_rid=", strlen("group_rid="))) { o.object_identifier.rid = get_int_param(argv[i]); o.object_type = NETR_DELTA_GROUP; o.database_id = SAM_DATABASE_DOMAIN; } - if (!StrnCaseCmp(argv[i], "group_member_rid=", strlen("group_member_rid="))) { + if (!strncasecmp_m(argv[i], "group_member_rid=", strlen("group_member_rid="))) { o.object_identifier.rid = get_int_param(argv[i]); o.object_type = NETR_DELTA_GROUP_MEMBER; o.database_id = SAM_DATABASE_DOMAIN; } - if (!StrnCaseCmp(argv[i], "alias_rid=", strlen("alias_rid="))) { + if (!strncasecmp_m(argv[i], "alias_rid=", strlen("alias_rid="))) { o.object_identifier.rid = get_int_param(argv[i]); o.object_type = NETR_DELTA_ALIAS; o.database_id = SAM_DATABASE_BUILTIN; } - if (!StrnCaseCmp(argv[i], "alias_member_rid=", strlen("alias_member_rid="))) { + if (!strncasecmp_m(argv[i], "alias_member_rid=", strlen("alias_member_rid="))) { o.object_identifier.rid = get_int_param(argv[i]); o.object_type = NETR_DELTA_ALIAS_MEMBER; o.database_id = SAM_DATABASE_BUILTIN; } - if (!StrnCaseCmp(argv[i], "account_sid=", strlen("account_sid="))) { + if (!strncasecmp_m(argv[i], "account_sid=", strlen("account_sid="))) { const char *sid_str = get_string_param(argv[i]); string_to_sid(&o.object_identifier.sid, sid_str); o.object_type = NETR_DELTA_ACCOUNT; o.database_id = SAM_DATABASE_PRIVS; } - if (!StrnCaseCmp(argv[i], "policy_sid=", strlen("policy_sid="))) { + if (!strncasecmp_m(argv[i], "policy_sid=", strlen("policy_sid="))) { const char *sid_str = get_string_param(argv[i]); string_to_sid(&o.object_identifier.sid, sid_str); o.object_type = NETR_DELTA_POLICY; o.database_id = SAM_DATABASE_PRIVS; } - if (!StrnCaseCmp(argv[i], "trustdom_sid=", strlen("trustdom_sid="))) { + if (!strncasecmp_m(argv[i], "trustdom_sid=", strlen("trustdom_sid="))) { const char *sid_str = get_string_param(argv[i]); string_to_sid(&o.object_identifier.sid, sid_str); o.object_type = NETR_DELTA_TRUSTED_DOMAIN; o.database_id = SAM_DATABASE_PRIVS; } - if (!StrnCaseCmp(argv[i], "secret_name=", strlen("secret_name="))) { + if (!strncasecmp_m(argv[i], "secret_name=", strlen("secret_name="))) { o.object_identifier.name = get_string_param(argv[i]); o.object_type = NETR_DELTA_SECRET; o.database_id = SAM_DATABASE_PRIVS; diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 72d4c053e0..3a5ba223da 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -2680,7 +2680,7 @@ enum { break; case OPT_REQUIRE_MEMBERSHIP: - if (StrnCaseCmp("S-", require_membership_of, 2) == 0) { + if (strncasecmp_m("S-", require_membership_of, 2) == 0) { require_membership_of_sid = require_membership_of; } break; |