mirror of
https://github.com/samba-team/samba.git
synced 2025-01-24 02:04:21 +03:00
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)
This commit is contained in:
parent
30418a47c6
commit
cfe53bd066
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user