#include "msdfs.h"
#include "trans2.h"
#include "libsmb/nmblib.h"
+#include "../libcli/smb/smbXcli_base.h"
/********************************************************************
Important point.
const char *username;
const char *password;
NTSTATUS status;
+ int flags = 0;
/* make a copy so we don't modify the global string 'service' */
servicename = talloc_strdup(ctx,share);
return NT_STATUS_INVALID_PARAMETER;
}
+ if (get_cmdline_auth_info_use_kerberos(auth_info)) {
+ flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+ }
+ if (get_cmdline_auth_info_fallback_after_kerberos(auth_info)) {
+ flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
+ }
+ if (get_cmdline_auth_info_use_ccache(auth_info)) {
+ flags |= CLI_FULL_CONNECTION_USE_CCACHE;
+ }
+ if (get_cmdline_auth_info_use_pw_nt_hash(auth_info)) {
+ flags |= CLI_FULL_CONNECTION_USE_NT_HASH;
+ }
+
status = cli_connect_nb(
server, NULL, port, name_type, NULL,
- get_cmdline_auth_info_signing_state(auth_info), &c);
+ get_cmdline_auth_info_signing_state(auth_info),
+ flags, &c);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to %s failed (Error %s)\n",
if (max_protocol == 0) {
max_protocol = PROTOCOL_NT1;
}
- c->protocol = max_protocol;
- c->use_kerberos = get_cmdline_auth_info_use_kerberos(auth_info);
- c->fallback_after_kerberos =
- get_cmdline_auth_info_fallback_after_kerberos(auth_info);
- c->use_ccache = get_cmdline_auth_info_use_ccache(auth_info);
-
DEBUG(4,(" session request ok\n"));
- status = cli_negprot(c);
+ status = smbXcli_negprot(c->conn, c->timeout, PROTOCOL_CORE,
+ max_protocol);
if (!NT_STATUS_IS_OK(status)) {
d_printf("protocol negotiation failed: %s\n",
lp_workgroup()))) {
d_printf("session setup failed: %s\n",
nt_errstr(status));
- if (NT_STATUS_V(cli_nt_error(c)) ==
- NT_STATUS_V(NT_STATUS_MORE_PROCESSING_REQUIRED))
+ if (NT_STATUS_EQUAL(status,
+ NT_STATUS_MORE_PROCESSING_REQUIRED))
d_printf("did you forget to run kinit?\n");
cli_shutdown(c);
return status;
here before trying to connect to the original share.
cli_check_msdfs_proxy() will fail if it is a normal share. */
- if ((c->capabilities & CAP_DFS) &&
+ if (smbXcli_conn_dfs_supported(c->conn) &&
cli_check_msdfs_proxy(ctx, c, sharename,
&newserver, &newshare,
force_encrypt,
/* must be a normal share */
- status = cli_tcon_andx(c, sharename, "?????",
- password, strlen(password)+1);
+ status = cli_tree_connect(c, sharename, "?????",
+ password, strlen(password)+1);
if (!NT_STATUS_IS_OK(status)) {
d_printf("tree connect failed: %s\n", nt_errstr(status));
cli_shutdown(c);
/* Search to the start of the list. */
for (p = cli; p; p = DLIST_PREV(p)) {
const char *remote_name =
- cli_state_remote_name(p);
+ smbXcli_conn_remote_name(p->conn);
if (strequal(server, remote_name) &&
strequal(share,p->share)) {
/* Search to the end of the list. */
for (p = cli->next; p; p = p->next) {
const char *remote_name =
- cli_state_remote_name(p);
+ smbXcli_conn_remote_name(p->conn);
if (strequal(server, remote_name) &&
strequal(share,p->share)) {
for (i=0; cli; cli = cli->next,i++ ) {
d_printf("%d:\tserver=%s, share=%s\n",
- i, cli_state_remote_name(cli), cli->share);
+ i, smbXcli_conn_remote_name(cli->conn), cli->share);
}
}
}
return talloc_asprintf(ctx, "%c%s%c%s%c%s",
path_sep,
- cli_state_remote_name(cli),
+ smbXcli_conn_remote_name(cli->conn),
path_sep,
cli->share,
path_sep,
{
/* only deal with DS when we negotiated NT_STATUS codes and UNICODE */
- if (!(cli->capabilities & CAP_UNICODE)) {
+ if (!(smbXcli_conn_use_unicode(cli->conn))) {
return false;
}
- if (!(cli->capabilities & CAP_STATUS32)) {
+ if (!(smbXcli_conn_use_status32(cli->conn))) {
return false;
}
if (NT_STATUS_EQUAL(status, expected)) {
}
SSVAL(param, 0, 0x03); /* max referral level */
- param = trans2_bytes_push_str(param, cli_ucs2(cli),
+ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
path, strlen(path)+1,
NULL);
if (!param) {
NULL, 0xffff, 0, 0,
setup, 1, 0,
param, param_len, 2,
- NULL, 0, cli->max_xmit,
+ NULL, 0, CLI_BUFFER_SIZE,
&recv_flags2,
NULL, 0, NULL, /* rsetup */
NULL, 0, NULL,
status = cli_cm_open(ctx,
rootcli,
- cli_state_remote_name(rootcli),
+ smbXcli_conn_remote_name(rootcli->conn),
"IPC$",
dfs_auth_info,
false,
- (rootcli->trans_enc_state != NULL),
- rootcli->protocol,
+ smb1cli_conn_encryption_on(rootcli->conn),
+ smbXcli_conn_protocol(rootcli->conn),
0,
0x20,
&cli_ipc);
share,
dfs_auth_info,
false,
- (rootcli->trans_enc_state != NULL),
- rootcli->protocol,
+ smb1cli_conn_encryption_on(rootcli->conn),
+ smbXcli_conn_protocol(rootcli->conn),
0,
0x20,
targetcli);
return false;
}
- remote_name = cli_state_remote_name(cli);
+ remote_name = smbXcli_conn_remote_name(cli->conn);
cnum = cli_state_get_tid(cli);
/* special case. never check for a referral on the IPC$ share */
/* check for the referral */
- if (!NT_STATUS_IS_OK(cli_tcon_andx(cli, "IPC$", "IPC", NULL, 0))) {
+ if (!NT_STATUS_IS_OK(cli_tree_connect(cli, "IPC$", "IPC", NULL, 0))) {
return false;
}