diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/utils/net_groupmap.c | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2 samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'source3/utils/net_groupmap.c')
-rw-r--r-- | source3/utils/net_groupmap.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c index 818905e122..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"), @@ -100,17 +100,17 @@ 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")) ) { + 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")); @@ -130,7 +130,7 @@ static int net_groupmap_list(struct net_context *c, int argc, const char **argv) GROUP_MAP map; if ( sid_string[0] ) - fstrcpy( ntgroup, sid_string); + strlcpy(ntgroup, sid_string, sizeof(ntgroup)); if (!get_sid_from_input(&sid, ntgroup)) { return -1; @@ -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': @@ -324,7 +324,7 @@ static int net_groupmap_add(struct net_context *c, int argc, const char **argv) } if (!ntgroup[0] ) - fstrcpy( ntgroup, unixgrp ); + strlcpy(ntgroup, unixgrp, sizeof(ntgroup)); if (!NT_STATUS_IS_OK(add_initial_entry(gid, string_sid, sid_type, ntgroup, ntcomment))) { d_fprintf(stderr, _("adding entry for group %s failed!\n"), ntgroup); @@ -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': @@ -457,10 +457,10 @@ static int net_groupmap_modify(struct net_context *c, int argc, const char **arg /* Change comment if new one */ if ( ntcomment[0] ) - fstrcpy( map.comment, ntcomment ); + strlcpy(map.comment, ntcomment, sizeof(map.comment)); if ( ntgroup[0] ) - fstrcpy( map.nt_name, ntgroup ); + strlcpy(map.nt_name, ntgroup, sizeof(map.nt_name)); if ( unixgrp[0] ) { gid = nametogid( unixgrp ); @@ -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")); @@ -528,7 +528,7 @@ static int net_groupmap_delete(struct net_context *c, int argc, const char **arg /* give preference to the SID if we have that */ if ( sid_string[0] ) - fstrcpy( ntgroup, sid_string ); + strlcpy(ntgroup, sid_string, sizeof(ntgroup)); if ( !get_sid_from_input(&sid, ntgroup) ) { d_fprintf(stderr, _("Unable to resolve group %s to a SID\n"), |