summaryrefslogtreecommitdiff
path: root/source4/utils/net
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-09-25 12:26:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:53 -0500
commit5a522b31003d50cf476ead83fb322abeb1525957 (patch)
tree8390edcfa3bf191138e6225a8fa39d525293bcae /source4/utils/net
parent2fe7c3a34a922b5a590ed3b7ebdd17759b4af6b2 (diff)
downloadsamba-5a522b31003d50cf476ead83fb322abeb1525957.tar.gz
samba-5a522b31003d50cf476ead83fb322abeb1525957.tar.bz2
samba-5a522b31003d50cf476ead83fb322abeb1525957.zip
r10486: This is a merge of Brad Henry's 'net join' rework, to better perform
an ADS join, particularly as a DC. This represents the bulk of his Google SOC work, and I'm very pleased to intergrate it into the tree. (Metze will intergrate the DRSUAPI work later). Both metze and myself have also put a lot of time into this patch, and in mentoring Brad in general. In return, Brad has been a very good student, and has taken the comments well. Since it's last appearance on samba-technical@, I have made correctness and valgrind fixups, as well as adding a new 'BINDING' mode to the libnet_rpc routines. This allows the exact binding string to be passed down from the torture code, including options and exact target host. Andrew Bartlett (This used to be commit d6fa105fdabbeb83a9b0e50dad49d1649afdb2a4)
Diffstat (limited to 'source4/utils/net')
-rw-r--r--source4/utils/net/net_join.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/source4/utils/net/net_join.c b/source4/utils/net/net_join.c
index a1455ef036..cb2ed3006b 100644
--- a/source4/utils/net/net_join.c
+++ b/source4/utils/net/net_join.c
@@ -29,7 +29,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv)
{
NTSTATUS status;
struct libnet_context *libnetctx;
- struct libnet_Join r;
+ struct libnet_Join *r;
char *tmp;
const char *domain_name;
enum netr_SchannelType secure_channel_type = SEC_CHAN_WKSTA;
@@ -62,23 +62,29 @@ int net_join(struct net_context *ctx, int argc, const char **argv)
return -1;
}
libnetctx->cred = ctx->credentials;
-
+ r = talloc(ctx->mem_ctx, struct libnet_Join);
+ if (!r) {
+ return -1;
+ }
/* prepare password change */
- r.in.domain_name = domain_name;
- r.in.secure_channel_type = secure_channel_type;
- r.out.error_string = NULL;
+ r->in.netbios_name = lp_netbios_name();
+ r->in.domain_name = domain_name;
+ r->in.secure_channel_type = secure_channel_type;
+ r->in.level = LIBNET_JOIN_AUTOMATIC;
+ r->out.error_string = NULL;
/* do the domain join */
- status = libnet_Join(libnetctx, ctx->mem_ctx, &r);
+ status = libnet_Join(libnetctx, r, r);
+
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("libnet_Join returned %s: %s\n",
nt_errstr(status),
- r.out.error_string));
+ r->out.error_string));
+ talloc_free(r);
+ talloc_free(libnetctx);
return -1;
}
-
talloc_free(libnetctx);
-
return 0;
}