diff options
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net.c | 21 | ||||
-rw-r--r-- | source3/utils/net_help.c | 3 |
2 files changed, 23 insertions, 1 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c index 4c7a6280f4..27b64aa96e 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -596,6 +596,26 @@ static int net_setlocalsid(int argc, const char **argv) return 0; } +static int net_setdomainsid(int argc, const char **argv) +{ + DOM_SID sid; + + if ( (argc != 1) + || (strncmp(argv[0], "S-1-5-21-", strlen("S-1-5-21-")) != 0) + || (!string_to_sid(&sid, argv[0])) + || (sid.num_auths != 4)) { + d_printf("usage: net setdomainsid S-1-5-21-x-y-z\n"); + return 1; + } + + if (!secrets_store_domain_sid(lp_workgroup(), &sid)) { + DEBUG(0,("Can't store domain SID.\n")); + return 1; + } + + return 0; +} + static int net_getdomainsid(int argc, const char **argv) { DOM_SID domain_sid; @@ -793,6 +813,7 @@ static struct functable net_func[] = { {"CACHE", net_cache}, {"GETLOCALSID", net_getlocalsid}, {"SETLOCALSID", net_setlocalsid}, + {"SETDOMAINSID", net_setdomainsid}, {"GETDOMAINSID", net_getdomainsid}, {"MAXRID", net_maxrid}, {"IDMAP", net_idmap}, diff --git a/source3/utils/net_help.c b/source3/utils/net_help.c index 79062345ab..40892ab091 100644 --- a/source3/utils/net_help.c +++ b/source3/utils/net_help.c @@ -61,7 +61,7 @@ static int help_usage(int argc, const char **argv) "Valid functions are:\n"\ " RPC RAP ADS FILE SHARE SESSION SERVER DOMAIN PRINTQ USER GROUP VALIDATE\n"\ " GROUPMEMBER ADMIN SERVICE PASSWORD TIME LOOKUP GETLOCALSID SETLOCALSID\n"\ -" CHANGESCRETPW LOOKUP SAM\n"); +" SETDOMAINSID CHANGESCRETPW LOOKUP SAM\n"); return -1; } @@ -230,6 +230,7 @@ static int net_usage(int argc, const char **argv) " net cache\t\tto operate on cache tdb file\n"\ " net getlocalsid [NAME]\tto get the SID for local name\n"\ " net setlocalsid SID\tto set the local domain SID\n"\ + " net setdomainsid SID\tto set the domain SID on member servers\n"\ " net changesecretpw\tto change the machine password in the local secrets database only\n"\ " \tthis requires the -f flag as a safety barrier\n"\ " net status\t\tShow server status\n"\ |