summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/auth/auth_domain.c2
-rw-r--r--source4/client/client.c83
-rw-r--r--source4/client/smbspool.c4
-rw-r--r--source4/libcli/cliconnect.c35
-rw-r--r--source4/libcli/raw/clisession.c4
-rw-r--r--source4/libcli/raw/clitransport.c61
-rw-r--r--source4/libcli/raw/clitree.c14
-rw-r--r--source4/libcli/raw/rawnegotiate.c36
-rw-r--r--source4/librpc/rpc/dcerpc_util.c13
-rw-r--r--source4/rpc_server/dcerpc_server.c2
-rw-r--r--source4/torture/gentest.c11
-rw-r--r--source4/torture/locktest.c9
-rw-r--r--source4/torture/locktest2.c6
-rw-r--r--source4/torture/masktest.c9
-rw-r--r--source4/torture/rpc/xplogin.c2
-rw-r--r--source4/torture/torture.c52
16 files changed, 152 insertions, 191 deletions
diff --git a/source4/auth/auth_domain.c b/source4/auth/auth_domain.c
index 2452f8f65d..a1868e1b13 100644
--- a/source4/auth/auth_domain.c
+++ b/source4/auth/auth_domain.c
@@ -170,7 +170,7 @@ static NTSTATUS connect_to_domain_password_server(struct smbcli_state **cli,
/* Attempt connection */
result = smbcli_full_connection(NULL, cli, lp_netbios_name(), remote_machine,
- &dest_ip, 0, "IPC$", "IPC", "", "", "",0, retry);
+ 0, "IPC$", NULL, "", "", "");
if (!NT_STATUS_IS_OK(result)) {
release_server_mutex();
diff --git a/source4/client/client.c b/source4/client/client.c
index b2255fc7b8..6449781b3f 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -3045,86 +3045,21 @@ return a connection to a server
static struct smbcli_state *do_connect(const char *server, const char *share)
{
struct smbcli_state *c;
- struct nmb_name called, calling;
- const char *server_n;
- fstring servicename;
- char *sharename;
NTSTATUS status;
-
- /* make a copy so we don't modify the global string 'service' */
- fstrcpy(servicename, share);
- sharename = servicename;
- if (*sharename == '\\') {
- server = sharename+2;
- sharename = strchr_m(server,'\\');
- if (!sharename) return NULL;
- *sharename = 0;
- sharename++;
- }
-
- asprintf(&sharename, "\\\\%s\\%s", server, sharename);
- server_n = dest_ip?dest_ip:server;
-
- make_nmb_name(&calling, lp_netbios_name(), 0x0);
- choose_called_name(&called, server, name_type);
-
- again:
- /* have to open a new connection */
- if (!(c=smbcli_state_init(NULL)) || !smbcli_socket_connect(c, server_n)) {
- d_printf("Connection to %s failed\n", server_n);
- return NULL;
- }
-
- if (!smbcli_transport_establish(c, &calling, &called)) {
- char *p;
- d_printf("session request to %s failed\n",
- called.name);
- smbcli_shutdown(c);
- if ((p=strchr_m(called.name, '.'))) {
- *p = 0;
- goto again;
- }
- if (strcmp(called.name, "*SMBSERVER")) {
- make_nmb_name(&called , "*SMBSERVER", 0x20);
- goto again;
- }
- return NULL;
+ if (strncmp(share, "\\\\", 2) == 0 ||
+ strncmp(share, "//", 2) == 0) {
+ smbcli_parse_unc(share, NULL, &server, &share);
}
-
- DEBUG(4,(" session request ok\n"));
-
- if (NT_STATUS_IS_ERR(smbcli_negprot(c))) {
- d_printf("protocol negotiation failed\n");
- smbcli_shutdown(c);
- return NULL;
- }
-
- status = smbcli_session_setup(c, username, password, domain);
- if (NT_STATUS_IS_ERR(status)) {
- d_printf("authenticated session setup failed: %s\n", nt_errstr(status));
- /* if a password was not supplied then try again with a null username */
- if (password[0] || !username[0]) {
- status = smbcli_session_setup(c, "", "", lp_workgroup());
- }
- if (NT_STATUS_IS_ERR(status)) {
- d_printf("session setup failed: %s\n", nt_errstr(status));
- smbcli_shutdown(c);
- return NULL;
- }
- d_printf("Anonymous login successful\n");
- }
-
- DEBUG(4,(" session setup ok\n"));
-
- if (NT_STATUS_IS_ERR(smbcli_send_tconX(c, sharename, "?????", password))) {
- d_printf("tree connect failed: %s\n", smbcli_errstr(c->tree));
- smbcli_shutdown(c);
+
+ status = smbcli_full_connection(NULL, &c, lp_netbios_name(), server,
+ share, NULL, username, domain, password);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("Connection to \\\\%s\\%s failed - %s\n",
+ server, share, nt_errstr(status));
return NULL;
}
- DEBUG(4,(" tconx ok\n"));
-
return c;
}
diff --git a/source4/client/smbspool.c b/source4/client/smbspool.c
index e81453a23b..620e4b301c 100644
--- a/source4/client/smbspool.c
+++ b/source4/client/smbspool.c
@@ -279,8 +279,8 @@ smb_connect(const char *workgroup, /* I - Workgroup */
myname = get_myname();
- nt_status = smbcli_full_connection(NULL, &c, myname, server, NULL, 0, share, "?????",
- username, workgroup, password, 0, NULL);
+ nt_status = smbcli_full_connection(NULL, &c, myname, server, 0, share, NULL,
+ username, workgroup, password);
free(myname);
if (!NT_STATUS_IS_OK(nt_status)) {
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index a0ba5ae0a1..4d46d1d23c 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -57,7 +57,7 @@ BOOL smbcli_transport_establish(struct smbcli_state *cli,
/* wrapper around smb_raw_negotiate() */
NTSTATUS smbcli_negprot(struct smbcli_state *cli)
{
- return smb_raw_negotiate(cli->transport);
+ return smb_raw_negotiate(cli->transport, lp_maxprotocol());
}
/* wrapper around smb_raw_session_setup() */
@@ -155,14 +155,11 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
struct smbcli_state **ret_cli,
const char *myname,
const char *host,
- struct ipv4_addr *ip,
const char *sharename,
const char *devtype,
const char *username,
const char *domain,
- const char *password,
- uint_t flags,
- BOOL *retry)
+ const char *password)
{
struct smbcli_tree *tree;
NTSTATUS status;
@@ -231,3 +228,31 @@ void smbcli_shutdown(struct smbcli_state *cli)
{
talloc_free(cli);
}
+
+/*
+ parse a //server/share type UNC name
+*/
+BOOL smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx,
+ const char **hostname, const char **sharename)
+{
+ char *p;
+
+ if (strncmp(unc_name, "\\\\", 2) &&
+ strncmp(unc_name, "//", 2)) {
+ return False;
+ }
+
+ *hostname = talloc_strdup(mem_ctx, &unc_name[2]);
+ p = strchr_m(&(*hostname)[2],'/');
+ if (!p) {
+ p = strchr_m(&(*hostname)[2],'\\');
+ if (!p) return False;
+ }
+ *p = 0;
+ *sharename = talloc_strdup(mem_ctx, p+1);
+
+ return True;
+}
+
+
+
diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c
index dcc0c8adbe..322d27688e 100644
--- a/source4/libcli/raw/clisession.c
+++ b/source4/libcli/raw/clisession.c
@@ -38,16 +38,14 @@ struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport)
uint16_t flags2;
uint32_t capabilities;
- session = talloc_p(transport, struct smbcli_session);
+ session = talloc_zero(transport, struct smbcli_session);
if (!session) {
return NULL;
}
- ZERO_STRUCTP(session);
session->transport = talloc_reference(session, transport);
session->pid = (uint16_t)getpid();
session->vuid = UID_FIELD_INVALID;
-
capabilities = transport->negotiate.capabilities;
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index 855543d670..fc9de577ee 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -140,12 +140,12 @@ static void smbcli_transport_write_disable(struct smbcli_transport *transport)
transport->socket->event.fde->flags &= ~EVENT_FD_WRITE;
}
-/****************************************************************************
-send a session request (if appropriate)
-****************************************************************************/
-BOOL smbcli_transport_connect(struct smbcli_transport *transport,
- struct nmb_name *calling,
- struct nmb_name *called)
+/*
+ send a session request
+*/
+struct smbcli_request *smbcli_transport_connect_send(struct smbcli_transport *transport,
+ struct nmb_name *calling,
+ struct nmb_name *called)
{
uint8_t *p;
int len = NBT_HDR_SIZE;
@@ -155,13 +155,10 @@ BOOL smbcli_transport_connect(struct smbcli_transport *transport,
transport->called = *called;
}
- /* 445 doesn't have session request */
- if (transport->socket->port == 445) {
- return True;
- }
-
/* allocate output buffer */
- req = smbcli_request_setup_nonsmb(transport, NBT_HDR_SIZE + 2*nbt_mangled_name_len());
+ req = smbcli_request_setup_nonsmb(transport,
+ NBT_HDR_SIZE + 2*nbt_mangled_name_len());
+ if (req == NULL) return NULL;
/* put in the destination name */
p = req->out.buffer + NBT_HDR_SIZE;
@@ -176,15 +173,27 @@ BOOL smbcli_transport_connect(struct smbcli_transport *transport,
_smb_setlen(req->out.buffer,len-4);
SCVAL(req->out.buffer,0,0x81);
- if (!smbcli_request_send(req) ||
- !smbcli_request_receive(req)) {
+ if (!smbcli_request_send(req)) {
+ smbcli_request_destroy(req);
+ return NULL;
+ }
+
+ return req;
+}
+
+/*
+ finish a smbcli_transport_connect()
+*/
+BOOL smbcli_transport_connect_recv(struct smbcli_request *req)
+{
+ if (!smbcli_request_receive(req)) {
smbcli_request_destroy(req);
return False;
}
-
+
if (CVAL(req->in.buffer,0) != 0x82) {
- transport->error.etype = ETYPE_NBT;
- transport->error.e.nbt_error = CVAL(req->in.buffer,4);
+ req->transport->error.etype = ETYPE_NBT;
+ req->transport->error.e.nbt_error = CVAL(req->in.buffer,4);
smbcli_request_destroy(req);
return False;
}
@@ -194,6 +203,24 @@ BOOL smbcli_transport_connect(struct smbcli_transport *transport,
}
+/*
+ send a session request (if needed)
+*/
+BOOL smbcli_transport_connect(struct smbcli_transport *transport,
+ struct nmb_name *calling,
+ struct nmb_name *called)
+{
+ struct smbcli_request *req;
+
+ if (transport->socket->port == 445) {
+ return True;
+ }
+
+ req = smbcli_transport_connect_send(transport,
+ calling, called);
+ return smbcli_transport_connect_recv(req);
+}
+
/****************************************************************************
get next mid in sequence
****************************************************************************/
diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c
index 0f56c0fe2e..cc7fefd084 100644
--- a/source4/libcli/raw/clitree.c
+++ b/source4/libcli/raw/clitree.c
@@ -34,12 +34,11 @@ struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session)
{
struct smbcli_tree *tree;
- tree = talloc_p(session, struct smbcli_tree);
+ tree = talloc_zero(session, struct smbcli_tree);
if (!tree) {
return NULL;
}
- ZERO_STRUCTP(tree);
tree->session = talloc_reference(tree, session);
return tree;
@@ -48,7 +47,8 @@ struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session)
/****************************************************************************
Send a tconX (async send)
****************************************************************************/
-struct smbcli_request *smb_tree_connect_send(struct smbcli_tree *tree, union smb_tcon *parms)
+struct smbcli_request *smb_tree_connect_send(struct smbcli_tree *tree,
+ union smb_tcon *parms)
{
struct smbcli_request *req = NULL;
@@ -83,7 +83,8 @@ struct smbcli_request *smb_tree_connect_send(struct smbcli_tree *tree, union smb
/****************************************************************************
Send a tconX (async recv)
****************************************************************************/
-NTSTATUS smb_tree_connect_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_tcon *parms)
+NTSTATUS smb_tree_connect_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
+ union smb_tcon *parms)
{
uint8_t *p;
@@ -124,7 +125,8 @@ failed:
/****************************************************************************
Send a tconX (sync interface)
****************************************************************************/
-NTSTATUS smb_tree_connect(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_tcon *parms)
+NTSTATUS smb_tree_connect(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx,
+ union smb_tcon *parms)
{
struct smbcli_request *req = smb_tree_connect_send(tree, parms);
return smb_tree_connect_recv(req, mem_ctx, parms);
@@ -203,7 +205,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
/* negotiate protocol options with the server */
- status = smb_raw_negotiate(transport);
+ status = smb_raw_negotiate(transport, lp_maxprotocol());
if (!NT_STATUS_IS_OK(status)) {
talloc_free(transport);
return status;
diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c
index a8cf603d46..d2d6b66d59 100644
--- a/source4/libcli/raw/rawnegotiate.c
+++ b/source4/libcli/raw/rawnegotiate.c
@@ -1,7 +1,9 @@
/*
Unix SMB/CIFS implementation.
+
SMB client negotiate context management functions
- Copyright (C) Andrew Tridgell 1994-1998
+
+ Copyright (C) Andrew Tridgell 1994-2005
Copyright (C) James Myers 2003 <myersjj@samba.org>
This program is free software; you can redistribute it and/or modify
@@ -40,10 +42,11 @@ static const struct {
{PROTOCOL_NT1,"NT LM 0.12"},
};
-/****************************************************************************
- Send a negprot command.
-****************************************************************************/
-struct smbcli_request *smb_negprot_send(struct smbcli_transport *transport, int maxprotocol)
+/*
+ Send a negprot command.
+*/
+struct smbcli_request *smb_raw_negotiate_send(struct smbcli_transport *transport,
+ int maxprotocol)
{
struct smbcli_request *req;
int i;
@@ -82,19 +85,14 @@ struct smbcli_request *smb_negprot_send(struct smbcli_transport *transport, int
return req;
}
-/****************************************************************************
+/*
Send a negprot command.
-****************************************************************************/
-NTSTATUS smb_raw_negotiate(struct smbcli_transport *transport)
+*/
+NTSTATUS smb_raw_negotiate_recv(struct smbcli_request *req)
{
- struct smbcli_request *req;
+ struct smbcli_transport *transport = req->transport;
int protocol;
- req = smb_negprot_send(transport, lp_maxprotocol());
- if (!req) {
- return NT_STATUS_UNSUCCESSFUL;
- }
-
if (!smbcli_request_receive(req) ||
smbcli_request_is_error(req)) {
return smbcli_request_destroy(req);
@@ -183,3 +181,13 @@ NTSTATUS smb_raw_negotiate(struct smbcli_transport *transport)
failed:
return smbcli_request_destroy(req);
}
+
+
+/*
+ Send a negprot command (sync interface)
+*/
+NTSTATUS smb_raw_negotiate(struct smbcli_transport *transport, int maxprotocol)
+{
+ struct smbcli_request *req = smb_raw_negotiate_send(transport, maxprotocol);
+ return smb_raw_negotiate_recv(req);
+}
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index b815f5317d..8b974df0fd 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -827,7 +827,6 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **pp,
{
struct dcerpc_pipe *p;
NTSTATUS status;
- BOOL retry;
struct smbcli_state *cli;
const char *pipe_name = NULL;
TALLOC_CTX *tmp_ctx;
@@ -866,15 +865,15 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **pp,
if (!username || !username[0] ||
(binding->flags & DCERPC_SCHANNEL_ANY)) {
status = smbcli_full_connection(p->conn, &cli, lp_netbios_name(),
- binding->host, NULL,
- "ipc$", "?????",
- "", "", NULL, 0, &retry);
+ binding->host,
+ "ipc$", NULL,
+ "", "", NULL);
} else {
status = smbcli_full_connection(p->conn, &cli, lp_netbios_name(),
- binding->host, NULL,
- "ipc$", "?????",
+ binding->host,
+ "ipc$", NULL,
username, domain,
- password, 0, &retry);
+ password);
}
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to connect to %s - %s\n", binding->host, nt_errstr(status)));
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c
index 1fcd9a3261..40335e4246 100644
--- a/source4/rpc_server/dcerpc_server.c
+++ b/source4/rpc_server/dcerpc_server.c
@@ -1172,8 +1172,6 @@ static NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx, const char **endpoint_s
struct dcesrv_context *dce_ctx;
int i;
- DEBUG(1,("dcesrv_init\n"));
-
if (!endpoint_servers) {
DEBUG(0,("dcesrv_init_context: no endpoint servers configured\n"));
return NT_STATUS_INTERNAL_ERROR;
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 81e2a59f34..46514a6a43 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -177,11 +177,12 @@ static BOOL connect_servers(void)
servers[i].server_name, servers[i].share_name,
servers[i].username, j);
status = smbcli_full_connection(NULL, &servers[i].cli[j],
- "gentest",
- servers[i].server_name, NULL,
- servers[i].share_name, "?????",
- servers[i].username, lp_workgroup(),
- servers[i].password, 0, NULL);
+ "gentest",
+ servers[i].server_name,
+ servers[i].share_name, NULL,
+ servers[i].username,
+ lp_workgroup(),
+ servers[i].password);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to \\\\%s\\%s - %s\n",
servers[i].server_name, servers[i].share_name,
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index 9c7c363259..161f51e1da 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -108,7 +108,6 @@ static struct smbcli_state *connect_one(char *share, int snum)
{
struct smbcli_state *c;
fstring server, myname;
- uint_t flags = 0;
NTSTATUS status;
int retries = 10;
@@ -122,10 +121,10 @@ static struct smbcli_state *connect_one(char *share, int snum)
do {
status = smbcli_full_connection(NULL, &c, myname,
- server, NULL,
- share, "?????",
- servers[snum].username, lp_workgroup(),
- servers[snum].password, flags, NULL);
+ server,
+ share, NULL,
+ servers[snum].username, lp_workgroup(),
+ servers[snum].password);
if (!NT_STATUS_IS_OK(status)) {
sleep(2);
}
diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c
index 46254ad5e3..3eb3398bd1 100644
--- a/source4/torture/locktest2.c
+++ b/source4/torture/locktest2.c
@@ -164,10 +164,8 @@ static struct smbcli_state *connect_one(char *share)
slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
nt_status = smbcli_full_connection(NULL,
- &c, myname, server_n, NULL, 0, share, "?????",
- username, lp_workgroup(), password, 0,
- NULL);
-
+ &c, myname, server_n, 0, share, NULL,
+ username, lp_workgroup(), password);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
return NULL;
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index ee15f92d80..a560c19f44 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -69,7 +69,6 @@ static struct smbcli_state *connect_one(char *share)
{
struct smbcli_state *c;
fstring server;
- uint_t flags = 0;
NTSTATUS status;
fstrcpy(server,share+2);
@@ -79,10 +78,10 @@ static struct smbcli_state *connect_one(char *share)
share++;
status = smbcli_full_connection(NULL, &c, "masktest",
- server, NULL,
- share, "?????",
- username, lp_workgroup(),
- password, flags, NULL);
+ server,
+ share, NULL,
+ username, lp_workgroup(),
+ password);
if (!NT_STATUS_IS_OK(status)) {
return NULL;
diff --git a/source4/torture/rpc/xplogin.c b/source4/torture/rpc/xplogin.c
index ce16cf2b1d..d8a8a4e2e9 100644
--- a/source4/torture/rpc/xplogin.c
+++ b/source4/torture/rpc/xplogin.c
@@ -75,7 +75,7 @@ static NTSTATUS after_negprot(struct smbcli_transport **dst_transport,
}
/* negotiate protocol options with the server */
- status = smb_raw_negotiate(transport);
+ status = smb_raw_negotiate(transport, lp_maxprotocol());
if (!NT_STATUS_IS_OK(status)) {
talloc_free(transport);
return NT_STATUS_UNSUCCESSFUL;
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index d50bb9366a..f9faf21957 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -89,8 +89,6 @@ BOOL torture_open_connection_share(struct smbcli_state **c,
const char *hostname,
const char *sharename)
{
- BOOL retry;
- int flags = 0;
NTSTATUS status;
const char *username = lp_parm_string(-1, "torture", "username");
const char *userdomain = lp_parm_string(-1, "torture", "userdomain");
@@ -98,10 +96,10 @@ BOOL torture_open_connection_share(struct smbcli_state **c,
status = smbcli_full_connection(NULL,
c, lp_netbios_name(),
- hostname, NULL,
- sharename, "?????",
+ hostname,
+ sharename, NULL,
username, username[0]?userdomain:"",
- password, flags, &retry);
+ password);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open connection - %s\n", nt_errstr(status));
return False;
@@ -745,8 +743,6 @@ static BOOL tcon_devtest(struct smbcli_state *cli,
static BOOL run_tcon_devtype_test(void)
{
struct smbcli_state *cli1 = NULL;
- BOOL retry;
- int flags = 0;
NTSTATUS status;
BOOL ret = True;
const char *host = lp_parm_string(-1, "torture", "host");
@@ -757,10 +753,10 @@ static BOOL run_tcon_devtype_test(void)
status = smbcli_full_connection(NULL,
&cli1, lp_netbios_name(),
- host, NULL,
- share, "?????",
+ host,
+ share, NULL,
username, userdomain,
- password, flags, &retry);
+ password);
if (!NT_STATUS_IS_OK(status)) {
printf("could not open connection\n");
@@ -1054,7 +1050,7 @@ static BOOL run_negprot_nowait(void)
for (i=0;i<10000;i++) {
struct smbcli_request *req;
time_t t1 = time(NULL);
- req = smb_negprot_send(cli->transport, PROTOCOL_NT1);
+ req = smb_raw_negotiate_send(cli->transport, PROTOCOL_NT1);
while (req->state == SMBCLI_REQUEST_SEND && time(NULL) < t1+5) {
smbcli_transport_process(cli->transport);
}
@@ -2155,30 +2151,6 @@ BOOL torture_chkpath_test(void)
}
-/*
- parse a //server/share type UNC name
-*/
-static BOOL parse_unc(const char *unc_name, char **hostname, char **sharename)
-{
- char *p;
-
- if (strncmp(unc_name, "//", 2)) {
- return False;
- }
-
- *hostname = strdup(&unc_name[2]);
- p = strchr_m(&(*hostname)[2],'/');
- if (!p) {
- return False;
- }
- *p = 0;
- *sharename = strdup(p+1);
-
- return True;
-}
-
-
-
static void sigcont(int sig)
{
}
@@ -2234,7 +2206,7 @@ double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result
procnum = i;
if (fork() == 0) {
char *myname;
- char *hostname=NULL, *sharename;
+ const char *hostname=NULL, *sharename;
pid_t mypid = getpid();
sys_srandom(((int)mypid) ^ ((int)time(NULL)));
@@ -2245,8 +2217,8 @@ double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result
if (unc_list) {
- if (!parse_unc(unc_list[i % num_unc_names],
- &hostname, &sharename)) {
+ if (!smbcli_parse_unc(unc_list[i % num_unc_names],
+ NULL, &hostname, &sharename)) {
printf("Failed to parse UNC name %s\n",
unc_list[i % num_unc_names]);
exit(1);
@@ -2746,9 +2718,9 @@ static BOOL is_binding_string(const char *binding_string)
lp_set_cmdline("torture:binding", argv_new[1]);
} else {
char *binding = NULL;
- char *host = NULL, *share = NULL;
+ const char *host = NULL, *share = NULL;
- if (!parse_unc(argv_new[1], &host, &share)) {
+ if (!smbcli_parse_unc(argv_new[1], NULL, &host, &share)) {
d_printf("Invalid option: %s is not a valid torture target (share or binding string)\n\n", argv_new[1]);
usage(pc);
}