diff options
author | Gerald Carter <jerry@samba.org> | 2003-04-23 00:34:31 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-04-23 00:34:31 +0000 |
commit | cfe53bd06623eb3f718b5978b0b3c2a24461e8f4 (patch) | |
tree | 47fe0c7f537fd6f5c4cde0a953a6f88e9753f8ad /source3/utils | |
parent | 30418a47c609fdff286bcab4e29e3fe0b244632e (diff) | |
download | samba-cfe53bd06623eb3f718b5978b0b3c2a24461e8f4.tar.gz samba-cfe53bd06623eb3f718b5978b0b3c2a24461e8f4.tar.bz2 samba-cfe53bd06623eb3f718b5978b0b3c2a24461e8f4.zip |
allow the unix group in a mapping to be changed; doesn't work with LDAP right now but should be ok with tdb's
(This used to be commit fdacad185c4f78958d56bccbd69a0f2628f1b792)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_groupmap.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c index 63e69fa7cf..2b88183f22 100644 --- a/source3/utils/net_groupmap.c +++ b/source3/utils/net_groupmap.c @@ -294,9 +294,11 @@ int net_groupmap_modify(int argc, const char **argv) fstring ntcomment = ""; fstring type = ""; fstring ntgroup = ""; + fstring unixgrp = ""; fstring sid_string = ""; enum SID_NAME_USE sid_type = SID_NAME_UNKNOWN; int i; + gid_t gid; /* get the options */ for ( i=0; i<argc; i++ ) { @@ -321,6 +323,13 @@ int net_groupmap_modify(int argc, const char **argv) return -1; } } + else if ( !StrnCaseCmp(argv[i], "unixgroup", strlen("unixgroup")) ) { + fstrcpy( unixgrp, get_string_param( argv[i] ) ); + if ( !unixgrp[0] ) { + d_printf("must supply a group name\n"); + return -1; + } + } else if ( !StrnCaseCmp(argv[i], "type", strlen("type")) ) { fstrcpy( type, get_string_param( argv[i] ) ); switch ( type[0] ) { @@ -341,7 +350,7 @@ int net_groupmap_modify(int argc, const char **argv) } if ( !ntgroup[0] && !sid_string[0] ) { - d_printf("Usage: net groupmap modify {ntgroup=<string>|sid=<SID>} [comment=<string>] [type=<domain|local>\n"); + d_printf("Usage: net groupmap modify {ntgroup=<string>|sid=<SID>} [comment=<string>] [unixgroup=<string>] [type=<domain|local>]\n"); return -1; } @@ -386,6 +395,17 @@ int net_groupmap_modify(int argc, const char **argv) if ( ntgroup[0] ) fstrcpy( map.nt_name, ntgroup ); + + if ( unixgrp[0] ) { + gid = nametogid( unixgrp ); + if ( gid == -1 ) { + d_printf("Unable to lookup UNIX group %s. Make sure the group exists.\n", + unixgrp); + return -1; + } + + map.gid = gid; + } #if 0 /* Change the privilege if new one */ |