summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-11-02 02:05:48 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-11-02 02:05:48 +0100
commitb034c519f53cffbac21c3db79ee24cdd8f1ce4a2 (patch)
treed27a5e0010bdaf1f9f47174cb244b90f3feb96a6 /source4/libcli
parent9265cb02d00843f43ba07d28093f959adf0738fe (diff)
downloadsamba-b034c519f53cffbac21c3db79ee24cdd8f1ce4a2.tar.gz
samba-b034c519f53cffbac21c3db79ee24cdd8f1ce4a2.tar.bz2
samba-b034c519f53cffbac21c3db79ee24cdd8f1ce4a2.zip
Add gensec_settings structure. This wraps loadparm_context for now, but
should in the future only contain some settings required for gensec.
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/cliconnect.c6
-rw-r--r--source4/libcli/ldap/ldap_bind.c3
-rw-r--r--source4/libcli/libcli.h1
-rw-r--r--source4/libcli/smb2/connect.c3
-rw-r--r--source4/libcli/smb2/session.c5
-rw-r--r--source4/libcli/smb2/smb2_calls.h1
-rw-r--r--source4/libcli/smb_composite/connect.c1
-rw-r--r--source4/libcli/smb_composite/sesssetup.c2
-rw-r--r--source4/libcli/smb_composite/smb_composite.h1
9 files changed, 16 insertions, 7 deletions
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index 6f58cfa8a7..402387f5b5 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -73,7 +73,8 @@ NTSTATUS smbcli_negprot(struct smbcli_state *cli, bool unicode, int maxprotocol)
NTSTATUS smbcli_session_setup(struct smbcli_state *cli,
struct cli_credentials *credentials,
const char *workgroup,
- struct smbcli_session_options options)
+ struct smbcli_session_options options,
+ struct gensec_settings *gensec_settings)
{
struct smb_composite_sesssetup setup;
NTSTATUS status;
@@ -86,6 +87,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli,
setup.in.capabilities = cli->transport->negotiate.capabilities;
setup.in.credentials = credentials;
setup.in.workgroup = workgroup;
+ setup.in.gensec_settings = gensec_settings;
status = smb_composite_sesssetup(cli->session, &setup);
@@ -146,6 +148,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
const char **ports,
const char *sharename,
const char *devtype,
+ const char *socket_options,
struct cli_credentials *credentials,
struct resolve_context *resolve_ctx,
struct event_context *ev,
@@ -161,6 +164,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
status = smbcli_tree_full_connection(parent_ctx,
&tree, host, ports,
sharename, devtype,
+ socket_options,
credentials, resolve_ctx, ev,
options,
session_options,
diff --git a/source4/libcli/ldap/ldap_bind.c b/source4/libcli/ldap/ldap_bind.c
index b66232c02e..a12f7652a5 100644
--- a/source4/libcli/ldap/ldap_bind.c
+++ b/source4/libcli/ldap/ldap_bind.c
@@ -224,7 +224,8 @@ _PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
gensec_init(lp_ctx);
status = gensec_client_start(conn, &conn->gensec,
- conn->event.event_ctx, lp_ctx);
+ conn->event.event_ctx,
+ lp_gensec_settings(conn, lp_ctx));
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to start GENSEC engine (%s)\n", nt_errstr(status)));
goto failed;
diff --git a/source4/libcli/libcli.h b/source4/libcli/libcli.h
index 163852d90a..a4bd727f4c 100644
--- a/source4/libcli/libcli.h
+++ b/source4/libcli/libcli.h
@@ -64,6 +64,7 @@ enum brl_type {
#include "libcli/raw/libcliraw.h"
+struct gensec_settings;
#include "libcli/libcli_proto.h"
#endif /* __LIBCLI_H__ */
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index 61ee994484..27c78fbce0 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -140,7 +140,7 @@ static void continue_negprot(struct smb2_request *req)
break;
}
- state->session = smb2_session_init(transport, global_loadparm, state, true);
+ state->session = smb2_session_init(transport, lp_gensec_settings(transport, global_loadparm), state, true);
if (composite_nomem(state->session, c)) return;
creq = smb2_session_setup_spnego_send(state->session, state->credentials);
@@ -239,6 +239,7 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx,
const char *socket_options)
{
struct composite_context *c;
+ const char *default_ports[] = { "445", NULL };
struct smb2_connect_state *state;
struct nbt_name name;
struct composite_context *creq;
diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c
index 31b3e942e9..127bb9bcae 100644
--- a/source4/libcli/smb2/session.c
+++ b/source4/libcli/smb2/session.c
@@ -25,13 +25,12 @@
#include "libcli/smb2/smb2_calls.h"
#include "libcli/composite/composite.h"
#include "auth/gensec/gensec.h"
-#include "param/param.h"
/**
initialise a smb2_session structure
*/
struct smb2_session *smb2_session_init(struct smb2_transport *transport,
- struct loadparm_context *lp_ctx,
+ struct gensec_settings *settings,
TALLOC_CTX *parent_ctx, bool primary)
{
struct smb2_session *session;
@@ -50,7 +49,7 @@ struct smb2_session *smb2_session_init(struct smb2_transport *transport,
/* prepare a gensec context for later use */
status = gensec_client_start(session, &session->gensec,
session->transport->socket->event.ctx,
- lp_ctx);
+ settings);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(session);
return NULL;
diff --git a/source4/libcli/smb2/smb2_calls.h b/source4/libcli/smb2/smb2_calls.h
index f66236af30..ec246b209d 100644
--- a/source4/libcli/smb2/smb2_calls.h
+++ b/source4/libcli/smb2/smb2_calls.h
@@ -107,4 +107,5 @@ struct smb2_setinfo {
struct cli_credentials;
struct event_context;
struct resolve_context;
+struct gensec_settings;
#include "libcli/smb2/smb2_proto.h"
diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c
index 7508035f48..70df0a19ff 100644
--- a/source4/libcli/smb_composite/connect.c
+++ b/source4/libcli/smb_composite/connect.c
@@ -257,6 +257,7 @@ static NTSTATUS connect_negprot(struct composite_context *c,
state->io_setup->in.capabilities = state->transport->negotiate.capabilities;
state->io_setup->in.credentials = io->in.credentials;
state->io_setup->in.workgroup = io->in.workgroup;
+ state->io_setup->in.gensec_settings = lp_gensec_settings(state->io_setup, global_loadparm);
state->creq = smb_composite_sesssetup_send(state->session, state->io_setup);
NT_STATUS_HAVE_NO_MEMORY(state->creq);
diff --git a/source4/libcli/smb_composite/sesssetup.c b/source4/libcli/smb_composite/sesssetup.c
index 2ca12a5898..10f84a5dba 100644
--- a/source4/libcli/smb_composite/sesssetup.c
+++ b/source4/libcli/smb_composite/sesssetup.c
@@ -408,7 +408,7 @@ static NTSTATUS session_setup_spnego(struct composite_context *c,
smbcli_temp_set_signing(session->transport);
status = gensec_client_start(session, &session->gensec, c->event_ctx,
- global_loadparm);
+ io->in.gensec_settings);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to start GENSEC client mode: %s\n", nt_errstr(status)));
return status;
diff --git a/source4/libcli/smb_composite/smb_composite.h b/source4/libcli/smb_composite/smb_composite.h
index 2b1e368daa..431733d600 100644
--- a/source4/libcli/smb_composite/smb_composite.h
+++ b/source4/libcli/smb_composite/smb_composite.h
@@ -122,6 +122,7 @@ struct smb_composite_sesssetup {
uint32_t capabilities;
struct cli_credentials *credentials;
const char *workgroup;
+ struct gensec_settings *gensec_settings;
} in;
struct {
uint16_t vuid;