diff options
Diffstat (limited to 'source4/libcli/raw')
-rw-r--r-- | source4/libcli/raw/clisession.c | 7 | ||||
-rw-r--r-- | source4/libcli/raw/clisocket.c | 11 |
2 files changed, 17 insertions, 1 deletions
diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c index 5aaceb103a..e31cf07bf8 100644 --- a/source4/libcli/raw/clisession.c +++ b/source4/libcli/raw/clisession.c @@ -424,6 +424,13 @@ static NTSTATUS smb_raw_session_setup_generic_spnego(struct cli_session *session goto done; } + status = gensec_set_target_hostname(session->gensec, session->transport->socket->hostname); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("Failed to start set GENSEC target hostname: %s\n", + nt_errstr(status))); + goto done; + } + status = gensec_start_mech_by_oid(session->gensec, OID_SPNEGO); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("Failed to start set GENSEC client SPNEGO mechanism: %s\n", diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index 4dae7d517d..5cd6f33689 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -45,6 +45,8 @@ struct cli_socket *cli_sock_init(void) /* 20 second default timeout */ sock->timeout = 20000; + sock->hostname = NULL; + return sock; } @@ -140,6 +142,7 @@ BOOL cli_sock_connect_byname(struct cli_socket *sock, const char *host, int port struct in_addr ip; TALLOC_CTX *mem_ctx; char *name, *p; + BOOL ret; if (getenv("LIBSMB_PROG")) { sock->fd = sock_exec(getenv("LIBSMB_PROG")); @@ -162,7 +165,13 @@ BOOL cli_sock_connect_byname(struct cli_socket *sock, const char *host, int port return False; } + ret = cli_sock_connect(sock, &ip, port); + + if (ret) { + sock->hostname = talloc_steal(mem_ctx, sock->mem_ctx, name); + } + talloc_destroy(mem_ctx); - return cli_sock_connect(sock, &ip, port); + return ret; } |