bool connected_ok = False;
struct named_mutex *mutex = NULL;
NTSTATUS status;
+ /* security = server just can't function with spnego */
+ int flags = CLI_FULL_CONNECTION_DONT_SPNEGO;
pserver = talloc_strdup(mem_ctx, lp_passwordserver());
p = pserver;
}
status = cli_connect_nb(desthost, &dest_ss, 0, 0x20,
- lp_netbios_name(), Undefined, &cli);
+ lp_netbios_name(), Undefined, flags, &cli);
if (NT_STATUS_IS_OK(status)) {
DEBUG(3,("connected to password server %s\n",desthost));
connected_ok = True;
return NULL;
}
- /* security = server just can't function with spnego */
- cli->use_spnego = False;
-
DEBUG(3,("got session\n"));
status = cli_negprot(cli);
status = cli_connect_nb(desthost, have_ip ? &dest_ss : NULL,
port ? port : 139, name_type,
- lp_netbios_name(), Undefined, &cli);
+ lp_netbios_name(), Undefined, 0, &cli);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to %s failed. Error %s\n", desthost, nt_errstr(status));
return 1;
NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
uint16_t port, int name_type, const char *myname,
- int signing_state, struct cli_state **pcli)
+ int signing_state, int flags, struct cli_state **pcli)
{
TALLOC_CTX *frame = talloc_stackframe();
struct cli_state *cli;
int fd = -1;
char *desthost;
char *p;
- int flags = 0;
desthost = talloc_strdup(talloc_tos(), host);
if (desthost == NULL) {
struct cli_state *cli;
nt_status = cli_connect_nb(dest_host, dest_ss, port, 0x20, my_name,
- signing_state, &cli);
+ signing_state, flags, &cli);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(10, ("cli_connect_nb failed: %s\n",
nt_errstr(nt_status)));
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;
+ }
+
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",
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"));
const char *username_used;
NTSTATUS status;
char *newserver, *newshare;
+ int flags = 0;
ZERO_STRUCT(c);
*in_cache = false;
status = NT_STATUS_UNSUCCESSFUL;
+ if (smbc_getOptionUseKerberos(context)) {
+ flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+ }
+
+ if (smbc_getOptionFallbackAfterKerberos(context)) {
+ flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
+ }
+
+ if (smbc_getOptionUseCCache(context)) {
+ flags |= CLI_FULL_CONNECTION_USE_CCACHE;
+ }
+
if (share == NULL || *share == '\0' || is_ipc) {
/*
* Try 139 first for IPC$
*/
status = cli_connect_nb(server_n, NULL, 139, 0x20,
smbc_getNetbiosName(context),
- Undefined, &c);
+ Undefined, flags, &c);
}
if (!NT_STATUS_IS_OK(status)) {
*/
status = cli_connect_nb(server_n, NULL, 0, 0x20,
smbc_getNetbiosName(context),
- Undefined, &c);
+ Undefined, flags, &c);
}
if (!NT_STATUS_IS_OK(status)) {
return NULL;
}
- if (smbc_getOptionUseKerberos(context)) {
- c->use_kerberos = True;
- }
-
- if (smbc_getOptionFallbackAfterKerberos(context)) {
- c->fallback_after_kerberos = True;
- }
-
- if (smbc_getOptionUseCCache(context)) {
- c->use_ccache = True;
- }
-
cli_set_timeout(c, smbc_getTimeout(context));
status = cli_negprot(c);
*err_str = NULL;
result = cli_connect_nb(remote_machine, NULL, 0, 0x20, NULL,
- Undefined, &cli);
+ Undefined, 0, &cli);
if (!NT_STATUS_IS_OK(result)) {
if (asprintf(err_str, "Unable to connect to SMB server on "
"machine %s. Error was : %s.\n",
NTSTATUS cli_negprot_recv(struct tevent_req *req);
NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
uint16_t port, int name_type, const char *myname,
- int signing_state, struct cli_state **pcli);
+ int signing_state, int flags, struct cli_state **pcli);
NTSTATUS cli_start_connection(struct cli_state **output_cli,
const char *my_name,
const char *dest_host,
in_addr_to_sockaddr_storage(&ss, ip);
status = cli_connect_nb(name, &ss, 139, nm_type,
- get_local_machine_name(), Undefined,
+ get_local_machine_name(), Undefined, 0,
&cli);
if (!NT_STATUS_IS_OK(status)) {
return;
fstring myname;
static int count;
NTSTATUS status;
+ int flags = 0;
fstrcpy(server,share+2);
share = strchr_m(server,'\\');
/* have to open a new connection */
- status = cli_connect_nb(server_n, NULL, 0, 0x20, myname, Undefined,
- &c);
+ if (use_kerberos) {
+ flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+ }
+ if (use_oplocks) {
+ flags |= CLI_FULL_CONNECTION_OPLOCKS;
+ }
+
+ status = cli_connect_nb(server_n, NULL, 0, 0x20, myname,
+ Undefined, flags, &c);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Connection to %s failed. Error %s\n", server_n,
nt_errstr(status)));
return NULL;
}
- c->use_kerberos = use_kerberos;
-
status = cli_negprot(c);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("protocol negotiation failed: %s\n",
DEBUG(4,(" tconx ok\n"));
- c->use_oplocks = use_oplocks;
-
return c;
}
server_n = server;
- status = cli_connect_nb(server, NULL, 0, 0x20, "masktest", Undefined,
+ status = cli_connect_nb(server, NULL, 0, 0x20, "masktest", Undefined, 0,
&c);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Connection to %s failed. Error %s\n", server_n,
{
struct cli_state *c;
NTSTATUS status;
+ int flags = 0;
+
+ if (use_oplocks) {
+ flags |= CLI_FULL_CONNECTION_OPLOCKS;
+ }
+
+ if (use_level_II_oplocks) {
+ flags |= CLI_FULL_CONNECTION_LEVEL_II_OPLOCKS;
+ }
+
+ if (use_kerberos) {
+ flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+ }
status = cli_connect_nb(host, NULL, port_to_use, 0x20, myname,
- signing_state, &c);
+ signing_state, flags, &c);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect with %s. Error %s\n", host, nt_errstr(status) );
return NULL;
}
- c->use_kerberos = use_kerberos;
-
cli_set_timeout(c, 120000); /* set a really long timeout (2 minutes) */
- if (use_oplocks) c->use_oplocks = True;
- if (use_level_II_oplocks) c->use_level_II_oplocks = True;
return c;
}
return False;
}
- cli1->use_oplocks = True;
- cli1->use_level_II_oplocks = True;
-
if (!torture_open_connection(&cli2, 1)) {
use_level_II_oplocks = False;
use_oplocks = saved_use_oplocks;
return False;
}
- cli2->use_oplocks = True;
- cli2->use_level_II_oplocks = True;
-
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_sockopt(cli1, sockops);
return false;
status = cli_connect_nb(server_name, &server_ss, 0, 0x20,
- lp_netbios_name(), Undefined, &cli);
+ lp_netbios_name(), Undefined, 0, &cli);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
NTSTATUS status;
status = cli_connect_nb(host, dest_ss, 0, 0x20, lp_netbios_name(),
- Undefined, &cli);
+ Undefined, 0, &cli);
if (!NT_STATUS_IS_OK(status)) {
fprintf(stderr, _("Can't contact server %s. Error %s\n"),
host, nt_errstr(status));
in_addr_to_sockaddr_storage(&ss, loopback_ip);
status = cli_connect_nb("localhost", &ss, 0, 0x20, lp_netbios_name(),
- Undefined, &cli);
+ Undefined, 0, &cli);
if (!NT_STATUS_IS_OK(status)) {
return false;
}