#include "libsmb/libsmb.h"
#include "rpc_client/cli_pipe.h"
#include "../libcli/smb/smbXcli_base.h"
-#include "auth/gensec/gensec.h"
/********************************************************************
********************************************************************/
struct client_ipc_connection **pp)
{
struct libnetapi_private_ctx *priv_ctx;
- struct user_auth_info *auth_info = NULL;
struct cli_state *cli_ipc = NULL;
struct client_ipc_connection *p;
NTSTATUS status;
- struct cli_credentials *creds = NULL;
const char *username = NULL;
const char *password = NULL;
NET_API_STATUS rc;
enum credentials_use_kerberos krb5_state;
- uint32_t gensec_features;
if (!ctx || !pp || !server_name) {
return WERR_INVALID_PARAMETER;
return WERR_OK;
}
- auth_info = user_auth_info_init(ctx);
- if (!auth_info) {
- return WERR_NOT_ENOUGH_MEMORY;
- }
-
rc = libnetapi_get_username(ctx, &username);
if (rc != 0) {
- TALLOC_FREE(auth_info);
return WERR_INTERNAL_ERROR;
}
rc = libnetapi_get_password(ctx, &password);
if (rc != 0) {
- TALLOC_FREE(auth_info);
return WERR_INTERNAL_ERROR;
}
- krb5_state = cli_credentials_get_kerberos_state(ctx->creds);
- gensec_features = cli_credentials_get_gensec_features(ctx->creds);
-
- set_cmdline_auth_info_signing_state_raw(auth_info, SMB_SIGNING_IPC_DEFAULT);
- set_cmdline_auth_info_use_kerberos(auth_info, krb5_state == CRED_USE_KERBEROS_REQUIRED);
- set_cmdline_auth_info_username(auth_info, username);
- if (password != NULL) {
- set_cmdline_auth_info_password(auth_info, password);
- } else {
- set_cmdline_auth_info_getpass(auth_info);
+ if (password == NULL) {
+ cli_credentials_set_cmdline_callbacks(ctx->creds);
}
- if (username && username[0] &&
- password && password[0] &&
- krb5_state == CRED_USE_KERBEROS_REQUIRED) {
- set_cmdline_auth_info_fallback_after_kerberos(auth_info, true);
- }
+ krb5_state = cli_credentials_get_kerberos_state(ctx->creds);
- if (gensec_features & GENSEC_FEATURE_NTLM_CCACHE) {
- set_cmdline_auth_info_use_ccache(auth_info, true);
+ if (username != NULL && username[0] != '\0' &&
+ password != NULL && password[0] != '\0' &&
+ krb5_state == CRED_USE_KERBEROS_REQUIRED) {
+ cli_credentials_set_kerberos_state(ctx->creds, CRED_USE_KERBEROS_DESIRED);
}
- creds = get_cmdline_auth_info_creds(auth_info);
status = cli_cm_open(ctx, NULL,
server_name, "IPC$",
- creds,
+ ctx->creds,
NULL, 0, 0x20, &cli_ipc);
if (!NT_STATUS_IS_OK(status)) {
cli_ipc = NULL;
}
- TALLOC_FREE(auth_info);
if (!cli_ipc) {
libnetapi_set_error_string(ctx,