summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2004-01-16 15:09:20 +0000
committerJim McDonough <jmcd@samba.org>2004-01-16 15:09:20 +0000
commit8001e0e84c174cd4bc184d9daaa49c03fef085c5 (patch)
treef97c416f39531dfc9c0838e4f20c6ee05f0991d1 /source3
parent91dd593ad14801bc5d5e31d3b14b4989264b95fc (diff)
downloadsamba-8001e0e84c174cd4bc184d9daaa49c03fef085c5.tar.gz
samba-8001e0e84c174cd4bc184d9daaa49c03fef085c5.tar.bz2
samba-8001e0e84c174cd4bc184d9daaa49c03fef085c5.zip
Fix another join problem. Don't use a TALLOC_CTX before it has been
initialized. Also split out the oldstyle join into a new fn, allowing us to call it with no failure message from net rpc join, but displaying a failure message when used with net rpc oldjoin. (This used to be commit cab0a4c4d5c7bf9d89697bf1d351eafbd00d7fd2)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_rpc.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 9f0f64edec..93c13bf1f5 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -118,8 +118,6 @@ static int run_rpc_command(struct cli_state *cli_arg, const int pipe_idx, int co
return -1;
}
- domain_sid = net_get_remote_domain_sid(cli, mem_ctx);
-
/* Create mem_ctx */
if (!(mem_ctx = talloc_init("run_rpc_command"))) {
@@ -128,6 +126,8 @@ static int run_rpc_command(struct cli_state *cli_arg, const int pipe_idx, int co
return -1;
}
+ domain_sid = net_get_remote_domain_sid(cli, mem_ctx);
+
if (!cli_nt_session_open(cli, pipe_idx)) {
DEBUG(0, ("Could not initialise pipe\n"));
}
@@ -276,7 +276,7 @@ static NTSTATUS rpc_oldjoin_internals(const DOM_SID *domain_sid, struct cli_stat
* @return A shell status integer (0 for success)
**/
-static int net_rpc_oldjoin(int argc, const char **argv)
+static int net_rpc_perform_oldjoin(int argc, const char **argv)
{
return run_rpc_command(NULL, PI_NETLOGON,
NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC,
@@ -285,6 +285,27 @@ static int net_rpc_oldjoin(int argc, const char **argv)
}
/**
+ * Join a domain, the old way. This function exists to allow
+ * the message to be displayed when oldjoin was explicitly
+ * requested, but not when it was implied by "net rpc join"
+ *
+ * @param argc Standard main() style argc
+ * @param argc Standard main() style argv. Initial components are already
+ * stripped
+ *
+ * @return A shell status integer (0 for success)
+ **/
+
+static int net_rpc_oldjoin(int argc, const char **argv)
+{
+ int rc = net_rpc_perform_oldjoin(argc, argv);
+
+ if (rc) {
+ d_printf("Failed to join domain\n");
+ }
+}
+
+/**
* Basic usage function for 'net rpc join'
* @param argc Standard main() style argc
* @param argc Standard main() style argv. Initial components are already
@@ -319,7 +340,7 @@ static int rpc_join_usage(int argc, const char **argv)
int net_rpc_join(int argc, const char **argv)
{
- if ((net_rpc_oldjoin(argc, argv) == 0))
+ if ((net_rpc_perform_oldjoin(argc, argv) == 0))
return 0;
return net_rpc_join_newstyle(argc, argv);