#include "includes.h"
#include "libnet/libnet.h"
-#include "librpc/gen_ndr/ndr_drsuapi.h"
+#include "librpc/gen_ndr/ndr_drsuapi_c.h"
#include "lib/ldb/include/ldb.h"
#include "lib/ldb/include/ldb_errors.h"
#include "passdb/secrets.h"
#include "dsdb/samdb/samdb.h"
+#include "db_wrap.h"
+#include "libcli/security/security.h"
+#include "auth/credentials/credentials.h"
+#include "librpc/gen_ndr/ndr_samr_c.h"
/*
* complete a domain join, when joining to a AD domain:
if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
r->out.error_string
= talloc_asprintf(r,
- "dcerpc_drsuapi_DsBind for [%s\\%s] failed - %s\n",
- r->in.domain_name, r->in.account_name,
+ "dcerpc_drsuapi_DsBind failed - %s\n",
dcerpc_errstr(tmp_ctx, drsuapi_pipe->last_fault_code));
talloc_free(tmp_ctx);
return status;
} else {
r->out.error_string
= talloc_asprintf(r,
- "dcerpc_drsuapi_DsBind for [%s\\%s] failed - %s\n",
- r->in.domain_name, r->in.account_name,
+ "dcerpc_drsuapi_DsBind failed - %s\n",
nt_errstr(status));
talloc_free(tmp_ctx);
return status;
NTSTATUS status, cu_status;
- struct libnet_RpcConnectDCInfo *connect_with_info;
+ struct libnet_RpcConnect *connect_with_info;
struct dcerpc_pipe *samr_pipe;
struct samr_Connect sc;
return NT_STATUS_NO_MEMORY;
}
- connect_with_info = talloc(tmp_ctx, struct libnet_RpcConnectDCInfo);
+ connect_with_info = talloc(tmp_ctx, struct libnet_RpcConnect);
if (!connect_with_info) {
r->out.error_string = NULL;
talloc_free(tmp_ctx);
/* prepare connect to the LSA pipe of PDC */
if (r->in.level == LIBNET_JOINDOMAIN_AUTOMATIC) {
- connect_with_info->level = LIBNET_RPC_CONNECT_PDC;
connect_with_info->in.name = r->in.domain_name;
} else {
- connect_with_info->level = LIBNET_RPC_CONNECT_BINDING;
connect_with_info->in.binding = r->in.binding;
}
+ connect_with_info->level = LIBNET_RPC_CONNECT_DC_INFO;
connect_with_info->in.dcerpc_iface = &dcerpc_table_samr;
+
/*
establish a SAMR connection, on the same CIFS transport
*/
-
- status = libnet_RpcConnectDCInfo(ctx, connect_with_info);
+ status = libnet_RpcConnect(ctx, tmp_ctx, connect_with_info);
if (!NT_STATUS_IS_OK(status)) {
if (r->in.binding) {
r->out.error_string = talloc_asprintf(mem_ctx,
return status;
}
- samr_pipe = connect_with_info->out.dcerpc_pipe,
+ samr_pipe = connect_with_info->out.dcerpc_pipe;
- status = dcerpc_pipe_auth(samr_pipe,
+ status = dcerpc_pipe_auth(tmp_ctx, &samr_pipe,
connect_with_info->out.dcerpc_pipe->binding,
&dcerpc_table_samr, ctx->cred);
if (!NT_STATUS_IS_OK(status)) {
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"samr_CreateUser2 (recreate) for [%s] failed: %s\n",
- r->in.domain_name, nt_errstr(status));
+ r->in.account_name, nt_errstr(status));
talloc_free(tmp_ctx);
return status;
}
} else if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_asprintf(mem_ctx,
"samr_CreateUser2 for [%s] failed: %s\n",
- r->in.domain_name, nt_errstr(status));
+ r->in.account_name, nt_errstr(status));
talloc_free(tmp_ctx);
return status;
}