summaryrefslogtreecommitdiff
path: root/source3/lib/netapi
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2021-03-18 13:49:27 +0100
committerGünther Deschner <gd@samba.org>2021-03-24 00:55:32 +0000
commit6968a325d9d5c9d68634b10d9ee080004865bcd8 (patch)
tree58ef99d7d5e2fca13a5a7deb0dca04894f799750 /source3/lib/netapi
parent4e82150dc14cb8852a7a20c1d57b0db4a4cf82e1 (diff)
downloadsamba-6968a325d9d5c9d68634b10d9ee080004865bcd8.tar.gz
s3:netapi: Get rid of set_cmdline_auth_info_*()
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r--source3/lib/netapi/cm.c39
1 files changed, 8 insertions, 31 deletions
diff --git a/source3/lib/netapi/cm.c b/source3/lib/netapi/cm.c
index 29b35af7d3d..a2468de4ccc 100644
--- a/source3/lib/netapi/cm.c
+++ b/source3/lib/netapi/cm.c
@@ -25,7 +25,6 @@
#include "libsmb/libsmb.h"
#include "rpc_client/cli_pipe.h"
#include "../libcli/smb/smbXcli_base.h"
-#include "auth/gensec/gensec.h"
/********************************************************************
********************************************************************/
@@ -68,16 +67,13 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
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;
@@ -91,54 +87,35 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
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,