This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "lib/appweb/ejs/ejs.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/composite/composite.h"
-#include "clilist.h"
+#include "libcli/smb_composite/smb_composite.h"
+#include "libcli/libcli.h"
+#include "libcli/resolve/resolve.h"
+#include "auth/credentials/credentials.h"
+#include "param/param.h"
#if 0
return -1;
}
- transport = smbcli_transport_init(sock, sock, False);
+ transport = smbcli_transport_init(sock, sock, false);
if (!transport) {
ejsSetErrorMsg(eid, "transport init failed");
/* Do session setup */
- session = smbcli_session_init(transport, transport, False);
+ session = smbcli_session_init(transport, transport, false);
if (!session) {
ejsSetErrorMsg(eid, "session init failed");
}
session = argv[0]->ptr;
- tree = smbcli_tree_init(session, session, False);
+ tree = smbcli_tree_init(session, session, false);
if (!tree) {
ejsSetErrorMsg(eid, "tree init failed");
static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv)
{
struct cli_credentials *creds;
+ struct smb_composite_connect io;
struct smbcli_tree *tree;
- const char *hostname, *sharename;
+ char *hostname, *sharename;
NTSTATUS result;
TALLOC_CTX *mem_ctx;
/* Set up credentials */
creds = cli_credentials_init(NULL);
- cli_credentials_set_conf(creds);
+ cli_credentials_set_conf(creds, mprLpCtx());
cli_credentials_parse_string(creds, argv[1], CRED_SPECIFIED);
/* Do connect */
- result = smbcli_tree_full_connection(NULL, &tree, hostname, 0,
- sharename, "?????", creds, NULL);
+ io.in.dest_host = hostname;
+ io.in.dest_ports = lp_smb_ports(mprLpCtx());
+ io.in.called_name = strupper_talloc(mem_ctx, hostname);
+ io.in.service = sharename;
+ io.in.service_type = "?????";
+ io.in.credentials = creds;
+ io.in.fallback_to_anonymous = false;
+ io.in.workgroup = lp_workgroup(mprLpCtx());
+ lp_smbcli_options(mprLpCtx(), &io.in.options);
+
+ result = smb_composite_connect(&io, mem_ctx,
+ lp_resolve_context(mprLpCtx()),
+ NULL);
+ tree = io.out.tree;
talloc_free(mem_ctx);
return -1;
}
- tree = talloc_check_name(argv[0]->ptr, "struct smbcli_tree");
+ tree = talloc_get_type(argv[0]->ptr, struct smbcli_tree);
result = smb_tree_disconnect(tree);
return -1;
}
- tree = argv[0]->ptr;
+ tree = (struct smbcli_tree *)argv[0]->ptr;
if (!mprVarIsString(argv[1]->type)) {
ejsSetErrorMsg(eid, "arg 2 must be a string");
return -1;
}
- tree = argv[0]->ptr;
+ tree = (struct smbcli_tree *)argv[0]->ptr;
if (!mprVarIsString(argv[1]->type)) {
ejsSetErrorMsg(eid, "arg 2 must be a string");
return -1;
}
- tree = argv[0]->ptr;
+ tree = (struct smbcli_tree *)argv[0]->ptr;
if (!mprVarIsString(argv[1]->type)) {
ejsSetErrorMsg(eid, "arg 2 must be a string");
return -1;
}
- tree = argv[0]->ptr;
+ tree = (struct smbcli_tree *)argv[0]->ptr;
if (!mprVarIsString(argv[1]->type)) {
ejsSetErrorMsg(eid, "arg 2 must be a string");
return -1;
}
- tree = argv[0]->ptr;
+ tree = (struct smbcli_tree *)argv[0]->ptr;
if (!mprVarIsString(argv[1]->type)) {
ejsSetErrorMsg(eid, "arg 2 must be a string");