diff options
author | Simo Sorce <idra@samba.org> | 2006-05-16 17:40:28 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:17:05 -0500 |
commit | 5e8221d9091320414bd168f8166e189c50f95a87 (patch) | |
tree | e659ae9b51f5b51d7ffb971711dd1a9283024776 /source3/utils | |
parent | 5255388e958573feb9121bd5ed934739a1f43306 (diff) | |
download | samba-5e8221d9091320414bd168f8166e189c50f95a87.tar.gz |
r15646: Implement an setdomainsid command as well
(This used to be commit 51df47c772f8bdd5a2c3a1e9814e625406e79b5f)
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 4c7a6280f46..27b64aa96e5 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 79062345ab6..40892ab0911 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"\ |