summaryrefslogtreecommitdiff
path: root/source3/utils/net_groupmap.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-04-22 02:54:41 +0000
committerGerald Carter <jerry@samba.org>2003-04-22 02:54:41 +0000
commit790b852c121e4f167b0f451dd9f34c307f211c0d (patch)
tree613495748bdcf65dacacdd29129d0ddb5e03a7f2 /source3/utils/net_groupmap.c
parentaa00cc19120f7360039a0f5fc1fcc0f6cc2a4473 (diff)
downloadsamba-790b852c121e4f167b0f451dd9f34c307f211c0d.tar.gz
samba-790b852c121e4f167b0f451dd9f34c307f211c0d.tar.bz2
samba-790b852c121e4f167b0f451dd9f34c307f211c0d.zip
merging fixes from SAMBA_3_0
(This used to be commit 8c3be38f6acbc85454f2c9bb74c358c99ee5d22a)
Diffstat (limited to 'source3/utils/net_groupmap.c')
-rw-r--r--source3/utils/net_groupmap.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c
index e248cd84f9..a9f47172fe 100644
--- a/source3/utils/net_groupmap.c
+++ b/source3/utils/net_groupmap.c
@@ -200,6 +200,13 @@ int net_groupmap_add(int argc, const char **argv)
return -1;
}
}
+ else if ( !StrnCaseCmp(argv[i], "sid", strlen("sid")) ) {
+ fstrcpy( string_sid, get_string_param( argv[i] ) );
+ if ( !string_sid[0] ) {
+ d_printf("must supply a SID\n");
+ return -1;
+ }
+ }
else if ( !StrnCaseCmp(argv[i], "comment", strlen("comment")) ) {
fstrcpy( ntcomment, get_string_param( argv[i] ) );
if ( !ntcomment[0] ) {
@@ -230,14 +237,17 @@ int net_groupmap_add(int argc, const char **argv)
}
}
- if ( !ntgroup[0] || !rid || sid_type==SID_NAME_UNKNOWN ) {
- d_printf("Usage: net groupmap add rid=<int> name=<string> type=<domain|local|builtin> [comment=<string>]\n");
+ if ( !ntgroup[0] || (!rid && !string_sid[0]) || sid_type==SID_NAME_UNKNOWN ) {
+ d_printf("Usage: net groupmap add {rid=<int>|sid=<string>} name=<string>| type=<domain|local|builtin> [comment=<string>]\n");
return -1;
}
- sid_copy(&sid, get_global_sam_sid());
- sid_append_rid(&sid, rid);
- sid_to_string(string_sid, &sid);
+ /* append the rid to our own domain/machine SID if we don't have a full SID */
+ if ( !string_sid[0] ) {
+ sid_copy(&sid, get_global_sam_sid());
+ sid_append_rid(&sid, rid);
+ sid_to_string(string_sid, &sid);
+ }
if (ntcomment[0])
fstrcpy(ntcomment, "Local Unix group");