#include "libcli/auth/netlogon_creds_cli.h"
#include "auth/credentials/credentials.h"
#include "krb5_env.h"
+#include "lib/param/param.h"
/****************************************************************
****************************************************************/
struct cli_state *cli)
{
TALLOC_CTX *frame = talloc_stackframe();
+<<<<<<< HEAD
struct rpc_pipe_client *authenticate_pipe = NULL;
struct rpc_pipe_client *passwordset_pipe = NULL;
struct cli_credentials *cli_creds;
size_t len = 0;
bool ok;
DATA_BLOB new_trust_blob = data_blob_null;
+=======
+ struct loadparm_context *lp_ctx;
+ struct rpc_pipe_client *netlogon_pipe = NULL;
+ struct netlogon_creds_cli_context *netlogon_creds = NULL;
+ const char *account_name = NULL;
+ struct cli_credentials *cli_creds = NULL;
+>>>>>>> f2c349b... s3:libnet: create a cli_credential context libnet_join_joindomain_rpc_unsecure()
NTSTATUS status;
+ bool ok;
status = cli_rpc_pipe_open_noauth(cli, &ndr_table_netlogon,
&authenticate_pipe);
}
}
+<<<<<<< HEAD
cli_creds = cli_credentials_init(talloc_tos());
if (cli_creds == NULL) {
TALLOC_FREE(frame);
cli_creds, authenticate_pipe->desthost, r->in.msg_ctx,
frame, &netlogon_creds);
if (!NT_STATUS_IS_OK(status)) {
+=======
+ account_name = talloc_asprintf(frame, "%s$",
+ r->in.machine_name);
+ if (account_name == NULL) {
+>>>>>>> f2c349b... s3:libnet: create a cli_credential context libnet_join_joindomain_rpc_unsecure()
TALLOC_FREE(frame);
return status;
}
+<<<<<<< HEAD
status = rpccli_setup_netlogon_creds(
cli, NCACN_NP, netlogon_creds, true /* force_reauth */,
cli_creds);
+=======
+ lp_ctx = loadparm_init_s3(frame, loadparm_s3_helpers());
+ if (lp_ctx == NULL) {
+ DEBUG(1, ("loadparm_init_s3 failed\n"));
+ TALLOC_FREE(frame);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ cli_creds = cli_credentials_init(frame);
+ if (cli_creds == NULL) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ cli_credentials_set_conf(cli_creds, lp_ctx);
+
+ cli_credentials_set_secure_channel_type(cli_creds,
+ r->in.secure_channel_type);
+
+ ok = cli_credentials_set_domain(cli_creds, r->in.domain_name,
+ CRED_SPECIFIED);
+ if (!ok) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ok = cli_credentials_set_username(cli_creds, account_name,
+ CRED_SPECIFIED);
+ if (!ok) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ /* according to WKSSVC_JOIN_FLAGS_MACHINE_PWD_PASSED */
+ ok = cli_credentials_set_password(cli_creds, r->in.admin_password,
+ CRED_SPECIFIED);
+ if (!ok) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = rpccli_create_netlogon_creds(netlogon_pipe->desthost,
+ r->in.domain_name,
+ account_name,
+ r->in.secure_channel_type,
+ r->in.msg_ctx,
+ frame,
+ &netlogon_creds);
+>>>>>>> f2c349b... s3:libnet: create a cli_credential context libnet_join_joindomain_rpc_unsecure()
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(frame);
return status;
}
+<<<<<<< HEAD
status = netlogon_creds_cli_get(netlogon_creds, frame, &creds);
+=======
+ status = rpccli_setup_netlogon_creds(cli, NCACN_NP,
+ netlogon_creds,
+ true, /* force_reauth */
+ cli_creds);
+>>>>>>> f2c349b... s3:libnet: create a cli_credential context libnet_join_joindomain_rpc_unsecure()
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(frame);
return status;