summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-04-23 00:34:59 +0000
committerGerald Carter <jerry@samba.org>2003-04-23 00:34:59 +0000
commit1da530956da685c85997f34cbdea29a58a7756b3 (patch)
tree3435d44c9a085b299f8d3e1b13798697a2dd3b24
parentc057f9faff14614f24165290bfbf53965063199d (diff)
downloadsamba-1da530956da685c85997f34cbdea29a58a7756b3.tar.gz
samba-1da530956da685c85997f34cbdea29a58a7756b3.tar.bz2
samba-1da530956da685c85997f34cbdea29a58a7756b3.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 039e77e1d5b6e68cf85bdcc71ff309ebe6528728)
-rw-r--r--source3/utils/net_groupmap.c22
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 */