summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-03-15 22:09:18 +0000
committerJim McDonough <jmcd@samba.org>2002-03-15 22:09:18 +0000
commit8dfc79b4126a2012b0ef2433887508eb4be9aeb3 (patch)
treec6136b8daeedbb4d922db003fad5347fb8bfd72a
parent04845c4cc0b99cba6ce8ceb65d6ec356d9c513d8 (diff)
downloadsamba-8dfc79b4126a2012b0ef2433887508eb4be9aeb3.tar.gz
samba-8dfc79b4126a2012b0ef2433887508eb4be9aeb3.tar.bz2
samba-8dfc79b4126a2012b0ef2433887508eb4be9aeb3.zip
Change net rpc join several ways: \n\t1) expose \n\t2) eliminate oldstyle subcommand \n\t3) try oldstyle first, then more secure method\n to allow for autodetect between ads and rpc on net join
(This used to be commit c8a4a09b5648af2f1669a5a30acdf0a088077af9)
-rw-r--r--source3/utils/net_rpc.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 2ea3142dd5..7a3a049b11 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -248,7 +248,7 @@ static NTSTATUS rpc_join_oldstyle_internals(const DOM_SID *domain_sid, struct cl
* @return A shell status integer (0 for success)
**/
-static int rpc_join_oldstyle(int argc, const char **argv)
+static int net_rpc_join_oldstyle(int argc, const char **argv)
{
return run_rpc_command(PIPE_NETLOGON, NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC, rpc_join_oldstyle_internals,
argc, argv);
@@ -263,8 +263,13 @@ static int rpc_join_oldstyle(int argc, const char **argv)
static int rpc_join_usage(int argc, const char **argv)
{
- d_printf(" net rpc join \t to join a domain with admin username & password\n");
- d_printf(" net rpc join oldstyle \t to join a domain created in server manager\n");
+ d_printf("net rpc join -U <username>[%%password] [options]\n"\
+ "\t to join a domain with admin username & password\n"\
+ "\t\t password will be prompted if none is specified\n");
+ d_printf("net rpc join [options except -U]\n"\
+ "\t to join a domain created in server manager\n\n\n");
+
+ net_common_flags_usage(argc, argv);
return -1;
}
@@ -276,20 +281,16 @@ static int rpc_join_usage(int argc, const char **argv)
*
* Main 'net_rpc_join()' (where the admain username/password is used) is
* in net_rpc_join.c
+ * Assume if a -U is specified, it's the new style, otherwise it's the
+ * old style
**/
-static int rpc_join(int argc, const char **argv)
+int net_rpc_join(int argc, const char **argv)
{
- struct functable func[] = {
- {"oldstyle", rpc_join_oldstyle},
- {NULL, NULL}
- };
+ if ((net_rpc_join_oldstyle(argc, argv) == 0))
+ return 0;
- if (argc == 0) {
- return net_rpc_join(argc, argv);
- }
-
- return net_run_function(argc, argv, func, rpc_join_usage);
+ return net_rpc_join_newstyle(argc, argv);
}
@@ -963,7 +964,7 @@ int net_rpc_usage(int argc, const char **argv)
* stripped
**/
-int rpc_help(int argc, const char **argv)
+int net_rpc_help(int argc, const char **argv)
{
struct functable func[] = {
{"join", rpc_join_usage},
@@ -994,13 +995,13 @@ int rpc_help(int argc, const char **argv)
int net_rpc(int argc, const char **argv)
{
struct functable func[] = {
- {"join", rpc_join},
+ {"join", net_rpc_join},
{"user", rpc_user},
{"changetrustpw", rpc_changetrustpw},
{"trustdom", rpc_trustdom},
{"abortshutdown", rpc_shutdown_abort},
{"shutdown", rpc_shutdown},
- {"help", rpc_help},
+ {"help", net_rpc_help},
{NULL, NULL}
};
return net_run_function(argc, argv, func, net_rpc_usage);