summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-11-01 22:13:47 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-11-01 22:13:47 +0100
commit57a60f0920e77e26a3ce7f5d43540904ee4cbd8e (patch)
treee7b6e5c410c93c334c3c7eaa1866e47e856e5cfe /source4/libcli
parent3a6b88f9f91c74785444741e8a002bc901055f66 (diff)
downloadsamba-57a60f0920e77e26a3ce7f5d43540904ee4cbd8e.tar.gz
samba-57a60f0920e77e26a3ce7f5d43540904ee4cbd8e.tar.bz2
samba-57a60f0920e77e26a3ce7f5d43540904ee4cbd8e.zip
Move lp_*() calls a bit higher up the calls tack.
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/cliconnect.c6
-rw-r--r--source4/libcli/raw/clisocket.c14
-rw-r--r--source4/libcli/raw/libcliraw.h3
-rw-r--r--source4/libcli/smb2/connect.c3
-rw-r--r--source4/libcli/smb_composite/connect.c4
-rw-r--r--source4/libcli/swig/libcli_smb.i3
-rw-r--r--source4/libcli/swig/libcli_smb_wrap.c20
7 files changed, 38 insertions, 15 deletions
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index e1f5e9ab50..6f58cfa8a7 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -35,12 +35,14 @@ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server,
struct event_context *ev_ctx,
struct resolve_context *resolve_ctx,
struct smbcli_options *options,
- struct smb_iconv_convenience *iconv_convenience)
+ struct smb_iconv_convenience *iconv_convenience,
+ const char *socket_options)
{
struct smbcli_socket *sock;
sock = smbcli_sock_connect_byname(server, ports, NULL,
- resolve_ctx, ev_ctx);
+ resolve_ctx, ev_ctx,
+ socket_options);
if (sock == NULL) return false;
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index d51ffbaa74..1fbbfe3581 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -50,7 +50,8 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
const char **ports,
const char *host_name,
struct resolve_context *resolve_ctx,
- struct event_context *event_ctx)
+ struct event_context *event_ctx,
+ const char *socket_options)
{
struct composite_context *result, *ctx;
struct sock_connect_state *state;
@@ -77,7 +78,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
for (i=0;ports[i];i++) {
state->ports[i] = atoi(ports[i]);
}
- state->socket_options = lp_socket_options(global_loadparm);
+ state->socket_options = talloc_reference(state, socket_options);
ctx = socket_connect_multi_send(state, host_addr,
state->num_ports, state->ports,
@@ -153,12 +154,13 @@ NTSTATUS smbcli_sock_connect(TALLOC_CTX *mem_ctx,
const char *host_name,
struct resolve_context *resolve_ctx,
struct event_context *event_ctx,
+ const char *socket_options,
struct smbcli_socket **result)
{
struct composite_context *c =
smbcli_sock_connect_send(mem_ctx, host_addr, ports, host_name,
resolve_ctx,
- event_ctx);
+ event_ctx, socket_options);
return smbcli_sock_connect_recv(c, mem_ctx, result);
}
@@ -188,7 +190,8 @@ resolve a hostname and connect
_PUBLIC_ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, const char **ports,
TALLOC_CTX *mem_ctx,
struct resolve_context *resolve_ctx,
- struct event_context *event_ctx)
+ struct event_context *event_ctx,
+ const char *socket_options)
{
int name_type = NBT_NAME_SERVER;
const char *address;
@@ -230,7 +233,8 @@ _PUBLIC_ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, cons
}
status = smbcli_sock_connect(mem_ctx, address, ports, name, resolve_ctx,
- event_ctx, &result);
+ event_ctx,
+ socket_options, &result);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(9, ("smbcli_sock_connect failed: %s\n",
diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h
index 98f18b1ed5..ccd8681fa0 100644
--- a/source4/libcli/raw/libcliraw.h
+++ b/source4/libcli/raw/libcliraw.h
@@ -376,7 +376,8 @@ NTSTATUS smb_raw_trans(struct smbcli_tree *tree,
struct smbcli_socket *smbcli_sock_connect_byname(const char *host, const char **ports,
TALLOC_CTX *mem_ctx,
struct resolve_context *resolve_ctx,
- struct event_context *event_ctx);
+ struct event_context *event_ctx,
+ const char *socket_options);
void smbcli_sock_dead(struct smbcli_socket *sock);
#endif /* __LIBCLI_RAW__H__ */
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index bbfcf010ae..67d98cfeaf 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -137,7 +137,6 @@ static void continue_negprot(struct smb2_request *req)
}
break;
}
-
state->session = smb2_session_init(transport, global_loadparm, state, true);
if (composite_nomem(state->session, c)) return;
@@ -217,7 +216,7 @@ static void continue_resolve(struct composite_context *creq)
c->status = resolve_name_recv(creq, state, &addr);
if (!composite_is_ok(c)) return;
- creq = smbcli_sock_connect_send(state, addr, ports, state->host, state->resolve_ctx, c->event_ctx);
+ creq = smbcli_sock_connect_send(state, addr, ports, state->host, state->resolve_ctx, c->event_ctx, lp_socket_options(global_loadparm));
composite_continue(c, creq, continue_socket, c);
}
diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c
index 0d97a6c54b..4a73acfd57 100644
--- a/source4/libcli/smb_composite/connect.c
+++ b/source4/libcli/smb_composite/connect.c
@@ -29,6 +29,7 @@
#include "libcli/resolve/resolve.h"
#include "auth/credentials/credentials.h"
#include "librpc/gen_ndr/ndr_nbt.h"
+#include "param/param.h"
/* the stages of this call */
enum connect_stage {CONNECT_RESOLVE,
@@ -375,7 +376,8 @@ static NTSTATUS connect_resolve(struct composite_context *c,
state->creq = smbcli_sock_connect_send(state, address,
io->in.dest_ports,
io->in.dest_host,
- NULL, c->event_ctx);
+ NULL, c->event_ctx,
+ lp_socket_options(global_loadparm));
NT_STATUS_HAVE_NO_MEMORY(state->creq);
state->stage = CONNECT_SOCKET;
diff --git a/source4/libcli/swig/libcli_smb.i b/source4/libcli/swig/libcli_smb.i
index 0162b7b66a..0f9116d7f9 100644
--- a/source4/libcli/swig/libcli_smb.i
+++ b/source4/libcli/swig/libcli_smb.i
@@ -12,6 +12,7 @@
struct smbcli_socket *smbcli_sock_connect_byname(const char *host, const char **ports,
TALLOC_CTX *mem_ctx,
struct resolve_context *resolve_ctx,
- struct event_context *event_ctx);
+ struct event_context *event_ctx,
+ const char *socket_options);
void smbcli_sock_dead(struct smbcli_socket *sock);
diff --git a/source4/libcli/swig/libcli_smb_wrap.c b/source4/libcli/swig/libcli_smb_wrap.c
index 99bbdc7f96..a4e4db726e 100644
--- a/source4/libcli/swig/libcli_smb_wrap.c
+++ b/source4/libcli/swig/libcli_smb_wrap.c
@@ -2609,6 +2609,7 @@ SWIGINTERN PyObject *_wrap_smbcli_sock_connect_byname(PyObject *SWIGUNUSEDPARM(s
TALLOC_CTX *arg3 = (TALLOC_CTX *) 0 ;
struct resolve_context *arg4 = (struct resolve_context *) 0 ;
struct event_context *arg5 = (struct event_context *) 0 ;
+ char *arg6 = (char *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
@@ -2618,18 +2619,22 @@ SWIGINTERN PyObject *_wrap_smbcli_sock_connect_byname(PyObject *SWIGUNUSEDPARM(s
int res4 = 0 ;
void *argp5 = 0 ;
int res5 = 0 ;
+ int res6 ;
+ char *buf6 = 0 ;
+ int alloc6 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
+ PyObject * obj4 = 0 ;
char * kwnames[] = {
- (char *) "host",(char *) "ports",(char *) "resolve_ctx",(char *) "event_ctx", NULL
+ (char *) "host",(char *) "ports",(char *) "resolve_ctx",(char *) "event_ctx",(char *) "socket_options", NULL
};
struct smbcli_socket *result = 0 ;
arg5 = event_context_init(NULL);
arg3 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:smbcli_sock_connect_byname",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+ if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|OO:smbcli_sock_connect_byname",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "smbcli_sock_connect_byname" "', argument " "1"" of type '" "char const *""'");
@@ -2652,12 +2657,21 @@ SWIGINTERN PyObject *_wrap_smbcli_sock_connect_byname(PyObject *SWIGUNUSEDPARM(s
}
arg5 = (struct event_context *)(argp5);
}
- result = (struct smbcli_socket *)smbcli_sock_connect_byname((char const *)arg1,(char const **)arg2,arg3,arg4,arg5);
+ if (obj4) {
+ res6 = SWIG_AsCharPtrAndSize(obj4, &buf6, NULL, &alloc6);
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "smbcli_sock_connect_byname" "', argument " "6"" of type '" "char const *""'");
+ }
+ arg6 = (char *)(buf6);
+ }
+ result = (struct smbcli_socket *)smbcli_sock_connect_byname((char const *)arg1,(char const **)arg2,arg3,arg4,arg5,(char const *)arg6);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_smbcli_socket, 0 | 0 );
if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+ if (alloc6 == SWIG_NEWOBJ) free((char*)buf6);
return resultobj;
fail:
if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+ if (alloc6 == SWIG_NEWOBJ) free((char*)buf6);
return NULL;
}