summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c5
-rw-r--r--source3/libsmb/clidfs.c18
-rw-r--r--source3/libsmb/libsmb_server.c29
-rw-r--r--source3/libsmb/passchange.c2
-rw-r--r--source3/libsmb/proto.h2
5 files changed, 32 insertions, 24 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index e3e2bc4e0b..58cf7a8e58 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2846,7 +2846,7 @@ fail:
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;
@@ -2854,7 +2854,6 @@ NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss
int fd = -1;
char *desthost;
char *p;
- int flags = 0;
desthost = talloc_strdup(talloc_tos(), host);
if (desthost == NULL) {
@@ -2905,7 +2904,7 @@ NTSTATUS cli_start_connection(struct cli_state **output_cli,
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)));
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index a40ef896e8..68a6724d24 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -95,6 +95,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
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);
@@ -118,9 +119,20 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
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",
@@ -133,10 +145,6 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
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"));
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 6446252022..005f2cdf8e 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -253,6 +253,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
const char *username_used;
NTSTATUS status;
char *newserver, *newshare;
+ int flags = 0;
ZERO_STRUCT(c);
*in_cache = false;
@@ -401,13 +402,25 @@ SMBC_server_internal(TALLOC_CTX *ctx,
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)) {
@@ -416,7 +429,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
*/
status = cli_connect_nb(server_n, NULL, 0, 0x20,
smbc_getNetbiosName(context),
- Undefined, &c);
+ Undefined, flags, &c);
}
if (!NT_STATUS_IS_OK(status)) {
@@ -424,18 +437,6 @@ SMBC_server_internal(TALLOC_CTX *ctx,
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);
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index bf2103db68..e5c336f882 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -56,7 +56,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
*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",
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 8ff0a1b2d6..83da457b53 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -74,7 +74,7 @@ struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
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,