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 | fdacad185c4f78958d56bccbd69a0f2628f1b792 (patch) | |
tree | cb25df4cb0ec08135d09dfd0de471faa74b0467d | |
parent | 2e5e4c10d2377493913554e7dab79d97a4d16d87 (diff) | |
download | samba-fdacad185c4f78958d56bccbd69a0f2628f1b792.tar.gz samba-fdacad185c4f78958d56bccbd69a0f2628f1b792.tar.xz samba-fdacad185c4f78958d56bccbd69a0f2628f1b792.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
-rw-r--r-- | source/utils/net_groupmap.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/source/utils/net_groupmap.c b/source/utils/net_groupmap.c index 63e69fa7cff..2b88183f22d 100644 --- a/source/utils/net_groupmap.c +++ b/source/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 */ |