summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/util/dprintf.c2
-rw-r--r--source4/client/client.c9
-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
-rw-r--r--source4/torture/basic/base.c3
10 files changed, 47 insertions, 20 deletions
diff --git a/lib/util/dprintf.c b/lib/util/dprintf.c
index e4f02758eb8..3e6d0e8bca9 100644
--- a/lib/util/dprintf.c
+++ b/lib/util/dprintf.c
@@ -60,7 +60,7 @@ _PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap)
if (ret <= 0) return ret;
- clen = convert_string_talloc_descriptor(NULL, display_cd, p, ret, (void **)&p2);
+ clen = iconv_talloc(NULL, display_cd, p, ret, (void **)&p2);
if (clen == -1) {
/* the string can't be converted - do the best we can,
filling in non-printing chars with '?' */
diff --git a/source4/client/client.c b/source4/client/client.c
index 02f46852b1a..8936a3cf2ff 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -3102,7 +3102,8 @@ static int do_message_op(const char *netbios_name, const char *desthost,
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 nbt_name called, calling;
const char *server_name;
@@ -3117,7 +3118,8 @@ static int do_message_op(const char *netbios_name, const char *desthost,
if (!(cli = smbcli_state_init(NULL)) ||
!smbcli_socket_connect(cli, server_name, destports,
ev_ctx, resolve_ctx, options,
- iconv_convenience)) {
+ iconv_convenience,
+ socket_options)) {
d_printf("Connection to %s failed\n", server_name);
return 1;
}
@@ -3270,7 +3272,8 @@ static int do_message_op(const char *netbios_name, const char *desthost,
lp_smb_ports(cmdline_lp_ctx), dest_ip,
name_type, ev_ctx,
lp_resolve_context(cmdline_lp_ctx),
- &smb_options, lp_iconv_convenience(cmdline_lp_ctx));
+ &smb_options, lp_iconv_convenience(cmdline_lp_ctx),
+ lp_socket_options(cmdline_lp_ctx));
return rc;
}
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index e1f5e9ab50d..6f58cfa8a79 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 d51ffbaa746..1fbbfe35813 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 98f18b1ed58..ccd8681fa04 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 bbfcf010aef..67d98cfeaf2 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 0d97a6c54bc..4a73acfd571 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 0162b7b66a9..0f9116d7f93 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 99bbdc7f96b..a4e4db726e4 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;
}
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index f2b7b9b2251..4725188e8f7 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -57,7 +57,8 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx)
if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), tctx->ev,
lp_resolve_context(tctx->lp_ctx), &options,
- lp_iconv_convenience(tctx->lp_ctx))) {
+ lp_iconv_convenience(tctx->lp_ctx),
+ lp_socket_options(tctx->lp_ctx))) {
torture_comment(tctx, "Failed to connect with %s\n", host);
goto failed;
}