summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-04-08 03:45:06 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-04-08 03:45:06 +0200
commitb5d84a74d146cfe0d2e0c336a88bd269ad61cded (patch)
tree8acad6b634cfe312144f92f8a0fb6ab44b47cd19 /source4/libcli
parent237f1cca028881a57f961884f427673907c1535a (diff)
parent1f474f4a545752f7ac0ad402d01d1e768b973dbe (diff)
downloadsamba-b5d84a74d146cfe0d2e0c336a88bd269ad61cded.tar.gz
samba-b5d84a74d146cfe0d2e0c336a88bd269ad61cded.tar.bz2
samba-b5d84a74d146cfe0d2e0c336a88bd269ad61cded.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake3
Conflicts: source/auth/credentials/config.mk source/auth/gensec/config.mk source/build/smb_build/makefile.pm source/heimdal_build/config.mk source/lib/events/config.mk source/lib/nss_wrapper/config.mk source/lib/policy/config.mk source/lib/registry/config.mk source/lib/socket_wrapper/config.mk source/lib/tdb/config.mk source/lib/tls/config.mk source/lib/util/config.mk source/libcli/config.mk source/libcli/ldap/config.mk source/libnet/config.mk source/librpc/config.mk source/param/config.mk source/rpc_server/config.mk source/scripting/ejs/config.mk source/smbd/process_model.mk (This used to be commit 760378e0294dd0cd4523a83448328478632d7e3d)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/auth/config.mk2
-rw-r--r--source4/libcli/auth/smbencrypt.c4
-rw-r--r--source4/libcli/cliconnect.c1
-rw-r--r--source4/libcli/clilist.c1
-rw-r--r--source4/libcli/climessage.c1
-rw-r--r--source4/libcli/clireadwrite.c1
-rw-r--r--source4/libcli/composite/composite.h37
-rw-r--r--source4/libcli/config.mk11
-rw-r--r--source4/libcli/ldap/config.mk3
-rw-r--r--source4/libcli/ldap/ldap.c5
-rw-r--r--source4/libcli/ldap/ldap.h4
-rw-r--r--source4/libcli/ldap/ldap_bind.c7
-rw-r--r--source4/libcli/ldap/ldap_client.c23
-rw-r--r--source4/libcli/ldap/ldap_client.h44
-rw-r--r--source4/libcli/ldap/ldap_ildap.c6
-rw-r--r--source4/libcli/ldap/ldap_msg.c2
-rw-r--r--source4/libcli/ldap/ldap_ndr.h10
-rw-r--r--source4/libcli/nbt/libnbt.h75
-rw-r--r--source4/libcli/nbt/namequery.c1
-rw-r--r--source4/libcli/nbt/namerefresh.c11
-rw-r--r--source4/libcli/nbt/nameregister.c15
-rw-r--r--source4/libcli/nbt/namerelease.c7
-rw-r--r--source4/libcli/nbt/nbtname.c2
-rw-r--r--source4/libcli/nbt/nbtsocket.c6
-rw-r--r--source4/libcli/raw/clierror.c4
-rw-r--r--source4/libcli/raw/clioplock.c1
-rw-r--r--source4/libcli/raw/clisession.c3
-rw-r--r--source4/libcli/raw/clisocket.c4
-rw-r--r--source4/libcli/raw/clitransport.c8
-rw-r--r--source4/libcli/raw/clitree.c7
-rw-r--r--source4/libcli/raw/libcliraw.h76
-rw-r--r--source4/libcli/raw/rawacl.c1
-rw-r--r--source4/libcli/raw/rawfile.c25
-rw-r--r--source4/libcli/raw/rawfileinfo.c9
-rw-r--r--source4/libcli/raw/rawfsinfo.c3
-rw-r--r--source4/libcli/raw/rawioctl.c3
-rw-r--r--source4/libcli/raw/rawnegotiate.c1
-rw-r--r--source4/libcli/raw/rawnotify.c5
-rw-r--r--source4/libcli/raw/rawreadwrite.c11
-rw-r--r--source4/libcli/raw/rawrequest.c7
-rw-r--r--source4/libcli/raw/rawsearch.c3
-rw-r--r--source4/libcli/raw/rawsetfileinfo.c7
-rw-r--r--source4/libcli/raw/rawshadow.c1
-rw-r--r--source4/libcli/raw/rawtrans.c9
-rw-r--r--source4/libcli/raw/smb_signing.c1
-rw-r--r--source4/libcli/security/security.h2
-rw-r--r--source4/libcli/smb2/close.c1
-rw-r--r--source4/libcli/smb2/connect.c1
-rw-r--r--source4/libcli/smb2/create.c1
-rw-r--r--source4/libcli/smb2/find.c1
-rw-r--r--source4/libcli/smb2/getinfo.c1
-rw-r--r--source4/libcli/smb2/negprot.c2
-rw-r--r--source4/libcli/smb2/notify.c1
-rw-r--r--source4/libcli/smb2/setinfo.c1
-rw-r--r--source4/libcli/smb2/transport.c1
-rw-r--r--source4/libcli/smb_composite/appendacl.c1
-rw-r--r--source4/libcli/smb_composite/connect.c1
-rw-r--r--source4/libcli/smb_composite/fsinfo.c1
-rw-r--r--source4/libcli/smb_composite/savefile.c1
-rw-r--r--source4/libcli/smb_composite/sesssetup.c2
-rw-r--r--source4/libcli/util/error.h3
-rw-r--r--source4/libcli/util/errormap.c1
-rw-r--r--source4/libcli/wbclient/config.mk4
-rw-r--r--source4/libcli/wbclient/wbclient.c210
-rw-r--r--source4/libcli/wbclient/wbclient.h50
65 files changed, 654 insertions, 100 deletions
diff --git a/source4/libcli/auth/config.mk b/source4/libcli/auth/config.mk
index f180844d84..85fc4ab527 100644
--- a/source4/libcli/auth/config.mk
+++ b/source4/libcli/auth/config.mk
@@ -4,7 +4,7 @@
PRIVATE_PROTO_HEADER = proto.h
PUBLIC_DEPENDENCIES = \
MSRPC_PARSE \
- LIBSAMBA-CONFIG
+ LIBSAMBA-HOSTCONFIG
# End SUBSYSTEM LIBCLI_AUTH
#################################
diff --git a/source4/libcli/auth/smbencrypt.c b/source4/libcli/auth/smbencrypt.c
index cefb55e205..7de9627302 100644
--- a/source4/libcli/auth/smbencrypt.c
+++ b/source4/libcli/auth/smbencrypt.c
@@ -63,7 +63,7 @@ bool SMBencrypt(const char *passwd, const uint8_t *c8, uint8_t p24[24])
* @param p16 return password hashed with md4, caller allocated 16 byte buffer
*/
-_PUBLIC_ bool E_md4hash(const char *passwd, uint8_t p16[16])
+bool E_md4hash(const char *passwd, uint8_t p16[16])
{
int len;
void *wpwd;
@@ -91,7 +91,7 @@ _PUBLIC_ bool E_md4hash(const char *passwd, uint8_t p16[16])
* @note p16 is filled in regardless
*/
-_PUBLIC_ bool E_deshash(const char *passwd, uint8_t p16[16])
+bool E_deshash(const char *passwd, uint8_t p16[16])
{
bool ret = true;
fstring dospwd;
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index 666dfe8446..4858a96110 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "libcli/libcli.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/auth/libcli_auth.h"
#include "libcli/smb_composite/smb_composite.h"
#include "param/param.h"
diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c
index 07393a3491..5d43606c61 100644
--- a/source4/libcli/clilist.c
+++ b/source4/libcli/clilist.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/libcli.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
struct search_private {
struct clilist_file_info *dirlist;
diff --git a/source4/libcli/climessage.c b/source4/libcli/climessage.c
index 6002ccfc59..5ed0e8e3cd 100644
--- a/source4/libcli/climessage.c
+++ b/source4/libcli/climessage.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/libcli.h"
diff --git a/source4/libcli/clireadwrite.c b/source4/libcli/clireadwrite.c
index f5ba799bbc..ae2367918c 100644
--- a/source4/libcli/clireadwrite.c
+++ b/source4/libcli/clireadwrite.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/libcli.h"
/****************************************************************************
diff --git a/source4/libcli/composite/composite.h b/source4/libcli/composite/composite.h
index db0ecf9af6..f1bed20361 100644
--- a/source4/libcli/composite/composite.h
+++ b/source4/libcli/composite/composite.h
@@ -19,6 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef __COMPOSITE_H__
+#define __COMPOSITE_H__
+
#include "libcli/raw/interfaces.h"
/*
@@ -68,4 +71,36 @@ struct smb2_request;
struct rpc_request;
struct nbt_name_request;
-#include "libcli/composite/proto.h"
+struct composite_context *composite_create(TALLOC_CTX *mem_ctx, struct event_context *ev);
+bool composite_nomem(const void *p, struct composite_context *ctx);
+void composite_continue(struct composite_context *ctx,
+ struct composite_context *new_ctx,
+ void (*continuation)(struct composite_context *),
+ void *private_data);
+void composite_continue_rpc(struct composite_context *ctx,
+ struct rpc_request *new_req,
+ void (*continuation)(struct rpc_request *),
+ void *private_data);
+void composite_continue_irpc(struct composite_context *ctx,
+ struct irpc_request *new_req,
+ void (*continuation)(struct irpc_request *),
+ void *private_data);
+void composite_continue_smb(struct composite_context *ctx,
+ struct smbcli_request *new_req,
+ void (*continuation)(struct smbcli_request *),
+ void *private_data);
+void composite_continue_smb2(struct composite_context *ctx,
+ struct smb2_request *new_req,
+ void (*continuation)(struct smb2_request *),
+ void *private_data);
+void composite_continue_nbt(struct composite_context *ctx,
+ struct nbt_name_request *new_req,
+ void (*continuation)(struct nbt_name_request *),
+ void *private_data);
+bool composite_is_ok(struct composite_context *ctx);
+void composite_done(struct composite_context *ctx);
+void composite_error(struct composite_context *ctx, NTSTATUS status);
+NTSTATUS composite_wait(struct composite_context *c);
+
+
+#endif /* __COMPOSITE_H__ */
diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk
index 79b16bfd74..95b45003be 100644
--- a/source4/libcli/config.mk
+++ b/source4/libcli/config.mk
@@ -1,6 +1,7 @@
mkinclude auth/config.mk
mkinclude ldap/config.mk
mkinclude security/config.mk
+mkinclude wbclient/config.mk
[SUBSYSTEM::LIBSAMBA-ERRORS]
@@ -54,13 +55,13 @@ LIBCLI_NBT_OBJ_FILES = $(addprefix libcli/nbt/, \
[PYTHON::python_libcli_nbt]
SWIG_FILE = swig/libcli_nbt.i
-PUBLIC_DEPENDENCIES = LIBCLI_NBT DYNCONFIG LIBSAMBA-CONFIG
+PUBLIC_DEPENDENCIES = LIBCLI_NBT DYNCONFIG LIBSAMBA-HOSTCONFIG
python_libcli_nbt_OBJ_FILES = libcli/swig/libcli_nbt_wrap.o
[PYTHON::python_libcli_smb]
SWIG_FILE = swig/libcli_smb.i
-PUBLIC_DEPENDENCIES = LIBCLI_SMB DYNCONFIG LIBSAMBA-CONFIG
+PUBLIC_DEPENDENCIES = LIBCLI_SMB DYNCONFIG LIBSAMBA-HOSTCONFIG
python_libcli_smb_OBJ_FILES = libcli/swig/libcli_smb_wrap.o
@@ -79,7 +80,7 @@ PUBLIC_DEPENDENCIES = LIBCLI_LDAP
PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBLDB
LIBCLI_CLDAP_OBJ_FILES = libcli/cldap/cldap.o
-PUBLIC_HEADERS += libcli/cldap/cldap.h
+# PUBLIC_HEADERS += libcli/cldap/cldap.h
[SUBSYSTEM::LIBCLI_WREPL]
PRIVATE_PROTO_HEADER = wrepl/winsrepl_proto.h
@@ -96,7 +97,7 @@ LIBCLI_RESOLVE_OBJ_FILES = libcli/resolve/resolve.o
[SUBSYSTEM::LP_RESOLVE]
PRIVATE_PROTO_HEADER = resolve/lp_proto.h
-PRIVATE_DEPENDENCIES = LIBCLI_NBT LIBSAMBA-CONFIG LIBNETIF
+PRIVATE_DEPENDENCIES = LIBCLI_NBT LIBSAMBA-HOSTCONFIG LIBNETIF
LP_RESOLVE_OBJ_FILES = $(addprefix libcli/resolve/, \
bcast.o nbtlist.o wins.o \
@@ -123,7 +124,7 @@ LIBCLI_SMB_OBJ_FILES = $(addprefix libcli/, \
climessage.o \
clideltree.o)
-PUBLIC_HEADERS += libcli/libcli.h
+# PUBLIC_HEADERS += libcli/libcli.h
[SUBSYSTEM::LIBCLI_RAW]
PRIVATE_PROTO_HEADER = raw/raw_proto.h
diff --git a/source4/libcli/ldap/config.mk b/source4/libcli/ldap/config.mk
index cc38796ac3..33e32c7417 100644
--- a/source4/libcli/ldap/config.mk
+++ b/source4/libcli/ldap/config.mk
@@ -9,10 +9,9 @@ LIBCLI_LDAP_OBJ_FILES = $(addprefix libcli/ldap/, \
ldap_msg.o ldap_ildap.o ldap_controls.o)
-PUBLIC_HEADERS += libcli/ldap/ldap.h
+PUBLIC_HEADERS += libcli/ldap/ldap.h libcli/ldap/ldap_ndr.h
[SUBSYSTEM::LDAP_ENCODE]
-PRIVATE_PROTO_HEADER = ldap_ndr.h
# FIXME PRIVATE_DEPENDENCIES = LIBLDB
LDAP_ENCODE_OBJ_FILES = libcli/ldap/ldap_ndr.o
diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c
index 00a0631753..fc6de7993e 100644
--- a/source4/libcli/ldap/ldap.c
+++ b/source4/libcli/ldap/ldap.c
@@ -25,6 +25,7 @@
#include "includes.h"
#include "lib/util/asn1.h"
#include "libcli/ldap/ldap.h"
+#include "libcli/ldap/ldap_proto.h"
static bool ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree)
@@ -187,7 +188,7 @@ static void ldap_encode_response(struct asn1_data *data, struct ldap_Result *res
}
}
-bool ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ctx)
+_PUBLIC_ bool ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ctx)
{
struct asn1_data *data = asn1_init(mem_ctx);
int i, j;
@@ -927,7 +928,7 @@ static void ldap_decode_attribs(TALLOC_CTX *mem_ctx, struct asn1_data *data,
/* This routine returns LDAP status codes */
-NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg)
+_PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg)
{
uint8_t tag;
diff --git a/source4/libcli/ldap/ldap.h b/source4/libcli/ldap/ldap.h
index 6f5e86744e..a336a7ad85 100644
--- a/source4/libcli/ldap/ldap.h
+++ b/source4/libcli/ldap/ldap.h
@@ -254,6 +254,8 @@ struct cli_credentials;
struct dom_sid;
struct asn1_data;
-#include "libcli/ldap/ldap_proto.h"
+struct ldap_message *new_ldap_message(TALLOC_CTX *mem_ctx);
+NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg);
+bool ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ctx);
#endif
diff --git a/source4/libcli/ldap/ldap_bind.c b/source4/libcli/ldap/ldap_bind.c
index fd15ff2fc7..2c04edf950 100644
--- a/source4/libcli/ldap/ldap_bind.c
+++ b/source4/libcli/ldap/ldap_bind.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "libcli/ldap/ldap.h"
+#include "libcli/ldap/ldap_proto.h"
#include "libcli/ldap/ldap_client.h"
#include "lib/tls/tls.h"
#include "auth/gensec/gensec.h"
@@ -35,7 +36,7 @@ struct ldap_simple_creds {
const char *pw;
};
-NTSTATUS ldap_rebind(struct ldap_connection *conn)
+_PUBLIC_ NTSTATUS ldap_rebind(struct ldap_connection *conn)
{
NTSTATUS status;
struct ldap_simple_creds *creds;
@@ -88,7 +89,7 @@ static struct ldap_message *new_ldap_simple_bind_msg(struct ldap_connection *con
/*
perform a simple username/password bind
*/
-NTSTATUS ldap_bind_simple(struct ldap_connection *conn,
+_PUBLIC_ NTSTATUS ldap_bind_simple(struct ldap_connection *conn,
const char *userdn, const char *password)
{
struct ldap_request *req;
@@ -199,7 +200,7 @@ static struct ldap_message *new_ldap_sasl_bind_msg(struct ldap_connection *conn,
/*
perform a sasl bind using the given credentials
*/
-NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
+_PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
struct cli_credentials *creds,
struct loadparm_context *lp_ctx)
{
diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c
index d99851ee15..296a7b11f2 100644
--- a/source4/libcli/ldap/ldap_client.c
+++ b/source4/libcli/ldap/ldap_client.c
@@ -28,6 +28,7 @@
#include "lib/events/events.h"
#include "lib/socket/socket.h"
#include "libcli/ldap/ldap.h"
+#include "libcli/ldap/ldap_proto.h"
#include "libcli/ldap/ldap_client.h"
#include "libcli/composite/composite.h"
#include "lib/stream/packet.h"
@@ -41,7 +42,7 @@
/**
create a new ldap_connection stucture. The event context is optional
*/
-struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx,
+_PUBLIC_ struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx,
struct event_context *ev)
{
@@ -293,7 +294,7 @@ struct ldap_connect_state {
static void ldap_connect_recv_unix_conn(struct composite_context *ctx);
static void ldap_connect_recv_tcp_conn(struct composite_context *ctx);
-struct composite_context *ldap_connect_send(struct ldap_connection *conn,
+_PUBLIC_ struct composite_context *ldap_connect_send(struct ldap_connection *conn,
const char *url)
{
struct composite_context *result, *ctx;
@@ -476,7 +477,7 @@ _PUBLIC_ NTSTATUS ldap_connect_recv(struct composite_context *ctx)
return status;
}
-NTSTATUS ldap_connect(struct ldap_connection *conn, const char *url)
+_PUBLIC_ NTSTATUS ldap_connect(struct ldap_connection *conn, const char *url)
{
struct composite_context *ctx = ldap_connect_send(conn, url);
return ldap_connect_recv(ctx);
@@ -484,7 +485,7 @@ NTSTATUS ldap_connect(struct ldap_connection *conn, const char *url)
/* set reconnect parameters */
-void ldap_set_reconn_params(struct ldap_connection *conn, int max_retries)
+_PUBLIC_ void ldap_set_reconn_params(struct ldap_connection *conn, int max_retries)
{
if (conn) {
conn->reconnect.max_retries = max_retries;
@@ -569,7 +570,7 @@ static void ldap_request_complete(struct event_context *ev, struct timed_event *
/*
send a ldap message - async interface
*/
-struct ldap_request *ldap_request_send(struct ldap_connection *conn,
+_PUBLIC_ struct ldap_request *ldap_request_send(struct ldap_connection *conn,
struct ldap_message *msg)
{
struct ldap_request *req;
@@ -645,7 +646,7 @@ failed:
wait for a request to complete
note that this does not destroy the request
*/
-NTSTATUS ldap_request_wait(struct ldap_request *req)
+_PUBLIC_ NTSTATUS ldap_request_wait(struct ldap_request *req)
{
while (req->state < LDAP_REQUEST_DONE) {
if (event_loop_once(req->conn->event.event_ctx) != 0) {
@@ -709,7 +710,7 @@ static const struct {
/*
used to setup the status code from a ldap response
*/
-NTSTATUS ldap_check_response(struct ldap_connection *conn, struct ldap_Result *r)
+_PUBLIC_ NTSTATUS ldap_check_response(struct ldap_connection *conn, struct ldap_Result *r)
{
int i;
const char *codename = "unknown";
@@ -742,7 +743,7 @@ NTSTATUS ldap_check_response(struct ldap_connection *conn, struct ldap_Result *r
/*
return error string representing the last error
*/
-const char *ldap_errstr(struct ldap_connection *conn,
+_PUBLIC_ const char *ldap_errstr(struct ldap_connection *conn,
TALLOC_CTX *mem_ctx,
NTSTATUS status)
{
@@ -756,7 +757,7 @@ const char *ldap_errstr(struct ldap_connection *conn,
/*
return the Nth result message, waiting if necessary
*/
-NTSTATUS ldap_result_n(struct ldap_request *req, int n, struct ldap_message **msg)
+_PUBLIC_ NTSTATUS ldap_result_n(struct ldap_request *req, int n, struct ldap_message **msg)
{
*msg = NULL;
@@ -784,7 +785,7 @@ NTSTATUS ldap_result_n(struct ldap_request *req, int n, struct ldap_message **ms
/*
return a single result message, checking if it is of the expected LDAP type
*/
-NTSTATUS ldap_result_one(struct ldap_request *req, struct ldap_message **msg, int type)
+_PUBLIC_ NTSTATUS ldap_result_one(struct ldap_request *req, struct ldap_message **msg, int type)
{
NTSTATUS status;
status = ldap_result_n(req, 0, msg);
@@ -802,7 +803,7 @@ NTSTATUS ldap_result_one(struct ldap_request *req, struct ldap_message **msg, in
a simple ldap transaction, for single result requests that only need a status code
this relies on single valued requests having the response type == request type + 1
*/
-NTSTATUS ldap_transaction(struct ldap_connection *conn, struct ldap_message *msg)
+_PUBLIC_ NTSTATUS ldap_transaction(struct ldap_connection *conn, struct ldap_message *msg)
{
struct ldap_request *req = ldap_request_send(conn, msg);
struct ldap_message *res;
diff --git a/source4/libcli/ldap/ldap_client.h b/source4/libcli/ldap/ldap_client.h
index d5ff441aff..13b0bf725c 100644
--- a/source4/libcli/ldap/ldap_client.h
+++ b/source4/libcli/ldap/ldap_client.h
@@ -94,3 +94,47 @@ struct ldap_connection {
struct packet_context *packet;
};
+
+struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
+ struct event_context *ev);
+
+NTSTATUS ldap_connect(struct ldap_connection *conn, const char *url);
+struct composite_context *ldap_connect_send(struct ldap_connection *conn,
+ const char *url);
+
+NTSTATUS ldap_rebind(struct ldap_connection *conn);
+NTSTATUS ldap_bind_simple(struct ldap_connection *conn,
+ const char *userdn, const char *password);
+NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
+ struct cli_credentials *creds,
+ struct loadparm_context *lp_ctx);
+struct ldap_request *ldap_request_send(struct ldap_connection *conn,
+ struct ldap_message *msg);
+NTSTATUS ldap_request_wait(struct ldap_request *req);
+struct composite_context;
+NTSTATUS ldap_connect_recv(struct composite_context *ctx);
+NTSTATUS ldap_result_n(struct ldap_request *req, int n, struct ldap_message **msg);
+NTSTATUS ldap_result_one(struct ldap_request *req, struct ldap_message **msg, int type);
+NTSTATUS ldap_transaction(struct ldap_connection *conn, struct ldap_message *msg);
+const char *ldap_errstr(struct ldap_connection *conn,
+ TALLOC_CTX *mem_ctx,
+ NTSTATUS status);
+NTSTATUS ldap_check_response(struct ldap_connection *conn, struct ldap_Result *r);
+void ldap_set_reconn_params(struct ldap_connection *conn, int max_retries);
+int ildap_count_entries(struct ldap_connection *conn, struct ldap_message **res);
+NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn,
+ int scope, struct ldb_parse_tree *tree,
+ const char * const *attrs, bool attributesonly,
+ struct ldb_control **control_req,
+ struct ldb_control ***control_res,
+ struct ldap_message ***results);
+NTSTATUS ildap_search(struct ldap_connection *conn, const char *basedn,
+ int scope, const char *expression,
+ const char * const *attrs, bool attributesonly,
+ struct ldb_control **control_req,
+ struct ldb_control ***control_res,
+ struct ldap_message ***results);
+
+
+
diff --git a/source4/libcli/ldap/ldap_ildap.c b/source4/libcli/ldap/ldap_ildap.c
index 7b592c65ae..8f21af0690 100644
--- a/source4/libcli/ldap/ldap_ildap.c
+++ b/source4/libcli/ldap/ldap_ildap.c
@@ -28,7 +28,7 @@
/*
count the returned search entries
*/
-int ildap_count_entries(struct ldap_connection *conn, struct ldap_message **res)
+_PUBLIC_ int ildap_count_entries(struct ldap_connection *conn, struct ldap_message **res)
{
int i;
for (i=0;res && res[i];i++) /* noop */ ;
@@ -39,7 +39,7 @@ int ildap_count_entries(struct ldap_connection *conn, struct ldap_message **res)
/*
perform a synchronous ldap search
*/
-NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn,
+_PUBLIC_ NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn,
int scope, struct ldb_parse_tree *tree,
const char * const *attrs, bool attributesonly,
struct ldb_control **control_req,
@@ -112,7 +112,7 @@ NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn,
/*
perform a ldap search
*/
-NTSTATUS ildap_search(struct ldap_connection *conn, const char *basedn,
+_PUBLIC_ NTSTATUS ildap_search(struct ldap_connection *conn, const char *basedn,
int scope, const char *expression,
const char * const *attrs, bool attributesonly,
struct ldb_control **control_req,
diff --git a/source4/libcli/ldap/ldap_msg.c b/source4/libcli/ldap/ldap_msg.c
index 12832b8ec4..c712e1e654 100644
--- a/source4/libcli/ldap/ldap_msg.c
+++ b/source4/libcli/ldap/ldap_msg.c
@@ -26,7 +26,7 @@
#include "libcli/ldap/ldap_client.h"
-struct ldap_message *new_ldap_message(TALLOC_CTX *mem_ctx)
+_PUBLIC_ struct ldap_message *new_ldap_message(TALLOC_CTX *mem_ctx)
{
return talloc_zero(mem_ctx, struct ldap_message);
}
diff --git a/source4/libcli/ldap/ldap_ndr.h b/source4/libcli/ldap/ldap_ndr.h
new file mode 100644
index 0000000000..dfbb723c36
--- /dev/null
+++ b/source4/libcli/ldap/ldap_ndr.h
@@ -0,0 +1,10 @@
+#ifndef __LIBCLI_LDAP_LDAP_NDR_H__
+#define __LIBCLI_LDAP_LDAP_NDR_H__
+
+char *ldap_encode_ndr_uint32(TALLOC_CTX *mem_ctx, uint32_t value);
+char *ldap_encode_ndr_dom_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
+char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, struct GUID *guid);
+NTSTATUS ldap_decode_ndr_GUID(TALLOC_CTX *mem_ctx, struct ldb_val val, struct GUID *guid);
+
+#endif /* __LIBCLI_LDAP_LDAP_NDR_H__ */
+
diff --git a/source4/libcli/nbt/libnbt.h b/source4/libcli/nbt/libnbt.h
index bc85d87b89..14cec3a024 100644
--- a/source4/libcli/nbt/libnbt.h
+++ b/source4/libcli/nbt/libnbt.h
@@ -23,6 +23,7 @@
#define __LIBNBT_H__
#include "librpc/gen_ndr/nbt.h"
+#include "librpc/ndr/libndr.h"
/*
possible states for pending requests
@@ -273,6 +274,78 @@ struct nbt_name_release {
} out;
};
-#include "libcli/nbt/nbt_proto.h"
+struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
+ struct event_context *event_ctx,
+ struct smb_iconv_convenience *iconv_convenience);
+struct nbt_name_request *nbt_name_query_send(struct nbt_name_socket *nbtsock,
+ struct nbt_name_query *io);
+NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
+ TALLOC_CTX *mem_ctx, struct nbt_name_query *io);
+NTSTATUS nbt_name_query(struct nbt_name_socket *nbtsock,
+ TALLOC_CTX *mem_ctx, struct nbt_name_query *io);
+struct nbt_name_request *nbt_name_status_send(struct nbt_name_socket *nbtsock,
+ struct nbt_name_status *io);
+NTSTATUS nbt_name_status_recv(struct nbt_name_request *req,
+ TALLOC_CTX *mem_ctx, struct nbt_name_status *io);
+NTSTATUS nbt_name_status(struct nbt_name_socket *nbtsock,
+ TALLOC_CTX *mem_ctx, struct nbt_name_status *io);
+
+NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname);
+NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, DATA_BLOB *blob, struct nbt_name *name);
+NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name);
+void nbt_choose_called_name(TALLOC_CTX *mem_ctx, struct nbt_name *n, const char *name, int type);
+char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name);
+NTSTATUS nbt_name_register(struct nbt_name_socket *nbtsock,
+ TALLOC_CTX *mem_ctx, struct nbt_name_register *io);
+NTSTATUS nbt_name_refresh(struct nbt_name_socket *nbtsock,
+ TALLOC_CTX *mem_ctx, struct nbt_name_refresh *io);
+NTSTATUS nbt_name_release(struct nbt_name_socket *nbtsock,
+ TALLOC_CTX *mem_ctx, struct nbt_name_release *io);
+NTSTATUS nbt_name_register_wins(struct nbt_name_socket *nbtsock,
+ TALLOC_CTX *mem_ctx,
+ struct nbt_name_register_wins *io);
+NTSTATUS nbt_name_refresh_wins(struct nbt_name_socket *nbtsock,
+ TALLOC_CTX *mem_ctx,
+ struct nbt_name_refresh_wins *io);
+NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
+ TALLOC_CTX *mem_ctx, struct nbt_name_register *io);
+struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock,
+ struct nbt_name_register *io);
+NTSTATUS nbt_name_release_recv(struct nbt_name_request *req,
+ TALLOC_CTX *mem_ctx, struct nbt_name_release *io);
+
+struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *nbtsock,
+ struct nbt_name_release *io);
+
+NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
+ TALLOC_CTX *mem_ctx, struct nbt_name_refresh *io);
+
+NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
+ void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
+ struct socket_address *),
+ void *private);
+NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
+ struct socket_address *dest,
+ struct nbt_name_packet *request);
+
+
+NDR_SCALAR_PROTO(wrepl_nbt_name, const struct nbt_name *)
+NDR_SCALAR_PROTO(nbt_string, const char *);
+NDR_BUFFER_PROTO(nbt_name, struct nbt_name)
+NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode);
+
+struct composite_context;
+struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock,
+ struct nbt_name_register_bcast *io);
+NTSTATUS nbt_name_register_bcast_recv(struct composite_context *c);
+struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nbtsock,
+ struct nbt_name_register_wins *io);
+NTSTATUS nbt_name_refresh_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
+ struct nbt_name_refresh_wins *io);
+struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbtsock,
+ struct nbt_name_refresh_wins *io);
+NTSTATUS nbt_name_register_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
+ struct nbt_name_register_wins *io);
+
#endif /* __LIBNBT_H__ */
diff --git a/source4/libcli/nbt/namequery.c b/source4/libcli/nbt/namequery.c
index e3432bfda1..2e1bcd818b 100644
--- a/source4/libcli/nbt/namequery.c
+++ b/source4/libcli/nbt/namequery.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/nbt/libnbt.h"
+#include "libcli/nbt/nbt_proto.h"
#include "lib/socket/socket.h"
#include "param/param.h"
diff --git a/source4/libcli/nbt/namerefresh.c b/source4/libcli/nbt/namerefresh.c
index 1157c110a1..b372e4a3f3 100644
--- a/source4/libcli/nbt/namerefresh.c
+++ b/source4/libcli/nbt/namerefresh.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/nbt/libnbt.h"
+#include "libcli/nbt/nbt_proto.h"
#include "libcli/composite/composite.h"
#include "lib/socket/socket.h"
#include "param/param.h"
@@ -86,7 +87,7 @@ failed:
/*
wait for a refresh reply
*/
-NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
+_PUBLIC_ NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
TALLOC_CTX *mem_ctx, struct nbt_name_refresh *io)
{
NTSTATUS status;
@@ -128,7 +129,7 @@ NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
/*
synchronous name refresh request
*/
-NTSTATUS nbt_name_refresh(struct nbt_name_socket *nbtsock,
+_PUBLIC_ NTSTATUS nbt_name_refresh(struct nbt_name_socket *nbtsock,
TALLOC_CTX *mem_ctx, struct nbt_name_refresh *io)
{
struct nbt_name_request *req = nbt_name_refresh_send(nbtsock, io);
@@ -217,7 +218,7 @@ done:
/**
the async send call for a multi-server WINS refresh
*/
-struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbtsock,
+_PUBLIC_ struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbtsock,
struct nbt_name_refresh_wins *io)
{
struct composite_context *c;
@@ -274,7 +275,7 @@ failed:
/*
multi-homed WINS name refresh - recv side
*/
-NTSTATUS nbt_name_refresh_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
+_PUBLIC_ NTSTATUS nbt_name_refresh_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
struct nbt_name_refresh_wins *io)
{
NTSTATUS status;
@@ -292,7 +293,7 @@ NTSTATUS nbt_name_refresh_wins_recv(struct composite_context *c, TALLOC_CTX *mem
/*
multi-homed WINS refresh - sync interface
*/
-NTSTATUS nbt_name_refresh_wins(struct nbt_name_socket *nbtsock,
+_PUBLIC_ NTSTATUS nbt_name_refresh_wins(struct nbt_name_socket *nbtsock,
TALLOC_CTX *mem_ctx,
struct nbt_name_refresh_wins *io)
{
diff --git a/source4/libcli/nbt/nameregister.c b/source4/libcli/nbt/nameregister.c
index 6667564664..9c5ae43d40 100644
--- a/source4/libcli/nbt/nameregister.c
+++ b/source4/libcli/nbt/nameregister.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/nbt/libnbt.h"
+#include "libcli/nbt/nbt_proto.h"
#include "libcli/composite/composite.h"
#include "lib/socket/socket.h"
#include "librpc/gen_ndr/ndr_nbt.h"
@@ -94,7 +95,7 @@ failed:
/*
wait for a registration reply
*/
-NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
+_PUBLIC_ NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
TALLOC_CTX *mem_ctx, struct nbt_name_register *io)
{
NTSTATUS status;
@@ -136,7 +137,7 @@ NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
/*
synchronous name registration request
*/
-NTSTATUS nbt_name_register(struct nbt_name_socket *nbtsock,
+_PUBLIC_ NTSTATUS nbt_name_register(struct nbt_name_socket *nbtsock,
TALLOC_CTX *mem_ctx, struct nbt_name_register *io)
{
struct nbt_name_request *req = nbt_name_register_send(nbtsock, io);
@@ -207,7 +208,7 @@ done:
/*
the async send call for a 4 stage name registration
*/
-struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock,
+_PUBLIC_ struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock,
struct nbt_name_register_bcast *io)
{
struct composite_context *c;
@@ -256,7 +257,7 @@ failed:
/*
broadcast 4 part name register - recv
*/
-NTSTATUS nbt_name_register_bcast_recv(struct composite_context *c)
+_PUBLIC_ NTSTATUS nbt_name_register_bcast_recv(struct composite_context *c)
{
NTSTATUS status;
status = composite_wait(c);
@@ -355,7 +356,7 @@ done:
/*
the async send call for a multi-server WINS register
*/
-struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nbtsock,
+_PUBLIC_ struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nbtsock,
struct nbt_name_register_wins *io)
{
struct composite_context *c;
@@ -414,7 +415,7 @@ failed:
/*
multi-homed WINS name register - recv side
*/
-NTSTATUS nbt_name_register_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
+_PUBLIC_ NTSTATUS nbt_name_register_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
struct nbt_name_register_wins *io)
{
NTSTATUS status;
@@ -432,7 +433,7 @@ NTSTATUS nbt_name_register_wins_recv(struct composite_context *c, TALLOC_CTX *me
/*
multi-homed WINS register - sync interface
*/
-NTSTATUS nbt_name_register_wins(struct nbt_name_socket *nbtsock,
+_PUBLIC_ NTSTATUS nbt_name_register_wins(struct nbt_name_socket *nbtsock,
TALLOC_CTX *mem_ctx,
struct nbt_name_register_wins *io)
{
diff --git a/source4/libcli/nbt/namerelease.c b/source4/libcli/nbt/namerelease.c
index d735892516..ba3af41752 100644
--- a/source4/libcli/nbt/namerelease.c
+++ b/source4/libcli/nbt/namerelease.c
@@ -21,13 +21,14 @@
#include "includes.h"
#include "libcli/nbt/libnbt.h"
+#include "libcli/nbt/nbt_proto.h"
#include "lib/socket/socket.h"
#include "param/param.h"
/*
send a nbt name release request
*/
-struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *nbtsock,
+_PUBLIC_ struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *nbtsock,
struct nbt_name_release *io)
{
struct nbt_name_request *req;
@@ -84,7 +85,7 @@ failed:
/*
wait for a release reply
*/
-NTSTATUS nbt_name_release_recv(struct nbt_name_request *req,
+_PUBLIC_ NTSTATUS nbt_name_release_recv(struct nbt_name_request *req,
TALLOC_CTX *mem_ctx, struct nbt_name_release *io)
{
NTSTATUS status;
@@ -126,7 +127,7 @@ NTSTATUS nbt_name_release_recv(struct nbt_name_request *req,
/*
synchronous name release request
*/
-NTSTATUS nbt_name_release(struct nbt_name_socket *nbtsock,
+_PUBLIC_ NTSTATUS nbt_name_release(struct nbt_name_socket *nbtsock,
TALLOC_CTX *mem_ctx, struct nbt_name_release *io)
{
struct nbt_name_request *req = nbt_name_release_send(nbtsock, io);
diff --git a/source4/libcli/nbt/nbtname.c b/source4/libcli/nbt/nbtname.c
index ae9f3f6b05..0d9073ccbb 100644
--- a/source4/libcli/nbt/nbtname.c
+++ b/source4/libcli/nbt/nbtname.c
@@ -500,7 +500,7 @@ _PUBLIC_ char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name)
/**
pull a nbt name, WINS Replication uses another on wire format for nbt name
*/
-_PUBLIC_ enum ndr_err_code ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name **_r)
+_PUBLIC_ enum ndr_err_code ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, const struct nbt_name **_r)
{
struct nbt_name *r;
uint8_t *namebuf;
diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c
index 95a1643efc..747127980a 100644
--- a/source4/libcli/nbt/nbtsocket.c
+++ b/source4/libcli/nbt/nbtsocket.c
@@ -423,7 +423,7 @@ failed:
/*
send off a nbt name reply
*/
-NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
+_PUBLIC_ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
struct socket_address *dest,
struct nbt_name_packet *request)
{
@@ -486,7 +486,7 @@ NTSTATUS nbt_name_request_recv(struct nbt_name_request *req)
/*
setup a handler for incoming requests
*/
-NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
+_PUBLIC_ NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
struct socket_address *),
void *private)
@@ -501,7 +501,7 @@ NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
/*
turn a NBT rcode into a NTSTATUS
*/
-NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode)
+_PUBLIC_ NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode)
{
int i;
struct {
diff --git a/source4/libcli/raw/clierror.c b/source4/libcli/raw/clierror.c
index c515259ee7..157bd847d4 100644
--- a/source4/libcli/raw/clierror.c
+++ b/source4/libcli/raw/clierror.c
@@ -25,7 +25,7 @@
/***************************************************************************
Return an error message from the last response
****************************************************************************/
-const char *smbcli_errstr(struct smbcli_tree *tree)
+_PUBLIC_ const char *smbcli_errstr(struct smbcli_tree *tree)
{
switch (tree->session->transport->error.etype) {
case ETYPE_SMB:
@@ -45,7 +45,7 @@ const char *smbcli_errstr(struct smbcli_tree *tree)
/* Return the 32-bit NT status code from the last packet */
-NTSTATUS smbcli_nt_error(struct smbcli_tree *tree)
+_PUBLIC_ NTSTATUS smbcli_nt_error(struct smbcli_tree *tree)
{
switch (tree->session->transport->error.etype) {
case ETYPE_SMB:
diff --git a/source4/libcli/raw/clioplock.c b/source4/libcli/raw/clioplock.c
index ae4e58ae01..47ffb6dd31 100644
--- a/source4/libcli/raw/clioplock.c
+++ b/source4/libcli/raw/clioplock.c
@@ -19,6 +19,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
/****************************************************************************
send an ack for an oplock break request
diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c
index 5a33d9cffc..ad4ca7b471 100644
--- a/source4/libcli/raw/clisession.c
+++ b/source4/libcli/raw/clisession.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "system/filesys.h"
#include "param/param.h"
@@ -291,7 +292,7 @@ struct smbcli_request *smb_raw_exit_send(struct smbcli_session *session)
/****************************************************************************
Send a exit (sync interface)
*****************************************************************************/
-NTSTATUS smb_raw_exit(struct smbcli_session *session)
+_PUBLIC_ NTSTATUS smb_raw_exit(struct smbcli_session *session)
{
struct smbcli_request *req = smb_raw_exit_send(session);
return smbcli_request_simple_recv(req);
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index eaa02e1047..1dcf2d1c53 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -170,7 +170,7 @@ NTSTATUS smbcli_sock_connect(TALLOC_CTX *mem_ctx,
/****************************************************************************
mark the socket as dead
****************************************************************************/
-void smbcli_sock_dead(struct smbcli_socket *sock)
+_PUBLIC_ void smbcli_sock_dead(struct smbcli_socket *sock)
{
talloc_free(sock->event.fde);
sock->event.fde = NULL;
@@ -189,7 +189,7 @@ void smbcli_sock_set_options(struct smbcli_socket *sock, const char *options)
/****************************************************************************
resolve a hostname and connect
****************************************************************************/
-struct smbcli_socket *smbcli_sock_connect_byname(const char *host, const char **ports,
+_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)
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index 5c14e9f9b8..34fb96230d 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -21,12 +21,14 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "lib/socket/socket.h"
#include "lib/util/dlinklist.h"
#include "lib/events/events.h"
#include "lib/stream/packet.h"
#include "librpc/gen_ndr/ndr_nbt.h"
#include "param/param.h"
+#include "libcli/nbt/libnbt.h"
/*
@@ -322,7 +324,7 @@ static void idle_handler(struct event_context *ev,
setup the idle handler for a transport
the period is in microseconds
*/
-void smbcli_transport_idle_handler(struct smbcli_transport *transport,
+_PUBLIC_ void smbcli_transport_idle_handler(struct smbcli_transport *transport,
void (*idle_func)(struct smbcli_transport *, void *),
uint64_t period,
void *private)
@@ -502,7 +504,7 @@ error:
process some read/write requests that are pending
return false if the socket is dead
*/
-bool smbcli_transport_process(struct smbcli_transport *transport)
+_PUBLIC_ bool smbcli_transport_process(struct smbcli_transport *transport)
{
NTSTATUS status;
size_t npending;
@@ -599,7 +601,7 @@ void smbcli_transport_send(struct smbcli_request *req)
/****************************************************************************
Send an SMBecho (async send)
*****************************************************************************/
-struct smbcli_request *smb_raw_echo_send(struct smbcli_transport *transport,
+_PUBLIC_ struct smbcli_request *smb_raw_echo_send(struct smbcli_transport *transport,
struct smb_echo *p)
{
struct smbcli_request *req;
diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c
index 507bde999a..d5075f9271 100644
--- a/source4/libcli/raw/clitree.c
+++ b/source4/libcli/raw/clitree.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/smb_composite/smb_composite.h"
#include "param/param.h"
@@ -33,7 +34,7 @@
/****************************************************************************
Initialize the tree context
****************************************************************************/
-struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session,
+_PUBLIC_ struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session,
TALLOC_CTX *parent_ctx, bool primary)
{
struct smbcli_tree *tree;
@@ -141,7 +142,7 @@ failed:
/****************************************************************************
Send a tconX (sync interface)
****************************************************************************/
-NTSTATUS smb_raw_tcon(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx,
+_PUBLIC_ NTSTATUS smb_raw_tcon(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx,
union smb_tcon *parms)
{
struct smbcli_request *req = smb_raw_tcon_send(tree, parms);
@@ -152,7 +153,7 @@ NTSTATUS smb_raw_tcon(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx,
/****************************************************************************
Send a tree disconnect.
****************************************************************************/
-NTSTATUS smb_tree_disconnect(struct smbcli_tree *tree)
+_PUBLIC_ NTSTATUS smb_tree_disconnect(struct smbcli_tree *tree)
{
struct smbcli_request *req;
diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h
index 0578a9eab1..16a98ad66e 100644
--- a/source4/libcli/raw/libcliraw.h
+++ b/source4/libcli/raw/libcliraw.h
@@ -286,6 +286,80 @@ struct smbcli_request {
}
#include "libcli/raw/interfaces.h"
-#include "libcli/raw/raw_proto.h"
+
+NTSTATUS smb_raw_read_recv(struct smbcli_request *req, union smb_read *parms);
+struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_read *parms);
+NTSTATUS smb_raw_trans_recv(struct smbcli_request *req,
+ TALLOC_CTX *mem_ctx,
+ struct smb_trans2 *parms);
+size_t smb_raw_max_trans_data(struct smbcli_tree *tree, size_t param_size);
+struct smbcli_request *smb_raw_trans_send(struct smbcli_tree *tree, struct smb_trans2 *parms);
+NTSTATUS smbcli_request_destroy(struct smbcli_request *req);
+struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_write *parms);
+struct smbcli_request *smb_raw_close_send(struct smbcli_tree *tree, union smb_close *parms);
+NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms);
+struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_open *parms);
+
+bool smbcli_transport_process(struct smbcli_transport *transport);
+const char *smbcli_errstr(struct smbcli_tree *tree);
+NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fsinfo *fsinfo);
+NTSTATUS smb_raw_pathinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms);
+NTSTATUS smb_raw_shadow_data(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, struct smb_shadow_copy *info);
+NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms);
+struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session, TALLOC_CTX *parent_ctx, bool primary);
+NTSTATUS smb_raw_tcon(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_tcon *parms);
+void smbcli_oplock_handler(struct smbcli_transport *transport,
+ bool (*handler)(struct smbcli_transport *, uint16_t, uint16_t, uint8_t, void *),
+ void *private);
+void smbcli_transport_idle_handler(struct smbcli_transport *transport,
+ void (*idle_func)(struct smbcli_transport *, void *),
+ uint64_t period,
+ void *private);
+NTSTATUS smbcli_request_simple_recv(struct smbcli_request *req);
+bool smbcli_oplock_ack(struct smbcli_tree *tree, uint16_t fnum, uint16_t ack_level);
+NTSTATUS smb_raw_open(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_open *parms);
+NTSTATUS smb_raw_close(struct smbcli_tree *tree, union smb_close *parms);
+NTSTATUS smb_raw_unlink(struct smbcli_tree *tree, union smb_unlink *parms);
+NTSTATUS smb_raw_chkpath(struct smbcli_tree *tree, union smb_chkpath *parms);
+NTSTATUS smb_raw_mkdir(struct smbcli_tree *tree, union smb_mkdir *parms);
+NTSTATUS smb_raw_rmdir(struct smbcli_tree *tree, struct smb_rmdir *parms);
+NTSTATUS smb_raw_rename(struct smbcli_tree *tree, union smb_rename *parms);
+NTSTATUS smb_raw_seek(struct smbcli_tree *tree, union smb_seek *parms);
+NTSTATUS smb_raw_read(struct smbcli_tree *tree, union smb_read *parms);
+NTSTATUS smb_raw_write(struct smbcli_tree *tree, union smb_write *parms);
+NTSTATUS smb_raw_lock(struct smbcli_tree *tree, union smb_lock *parms);
+NTSTATUS smb_raw_setpathinfo(struct smbcli_tree *tree, union smb_setfileinfo *parms);
+NTSTATUS smb_raw_setfileinfo(struct smbcli_tree *tree, union smb_setfileinfo *parms);
+
+struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, union smb_notify *parms);
+NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_notify *parms);
+
+NTSTATUS smb_tree_disconnect(struct smbcli_tree *tree);
+NTSTATUS smbcli_nt_error(struct smbcli_tree *tree);
+NTSTATUS smb_raw_exit(struct smbcli_session *session);
+NTSTATUS smb_raw_pathinfo_recv(struct smbcli_request *req,
+ TALLOC_CTX *mem_ctx,
+ union smb_fileinfo *parms);
+struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree,
+ union smb_fileinfo *parms);
+struct smbcli_request *smb_raw_setpathinfo_send(struct smbcli_tree *tree,
+ union smb_setfileinfo *parms);
+struct smbcli_request *smb_raw_echo_send(struct smbcli_transport *transport,
+ struct smb_echo *p);
+NTSTATUS smb_raw_search_first(struct smbcli_tree *tree,
+ TALLOC_CTX *mem_ctx,
+ union smb_search_first *io, void *private,
+ smbcli_search_callback callback);
+NTSTATUS smb_raw_flush(struct smbcli_tree *tree, union smb_flush *parms);
+
+NTSTATUS smb_raw_trans(struct smbcli_tree *tree,
+ TALLOC_CTX *mem_ctx,
+ struct smb_trans2 *parms);
+
+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);
+void smbcli_sock_dead(struct smbcli_socket *sock);
#endif /* __LIBCLI_RAW__H__ */
diff --git a/source4/libcli/raw/rawacl.c b/source4/libcli/raw/rawacl.c
index 847d133173..466b94f4a9 100644
--- a/source4/libcli/raw/rawacl.c
+++ b/source4/libcli/raw/rawacl.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "param/param.h"
diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c
index 725034c3a9..3c5c1b742b 100644
--- a/source4/libcli/raw/rawfile.c
+++ b/source4/libcli/raw/rawfile.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "smb.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "librpc/gen_ndr/ndr_security.h"
#define SETUP_REQUEST(cmd, wct, buflen) do { \
@@ -92,7 +93,7 @@ struct smbcli_request *smb_raw_rename_send(struct smbcli_tree *tree,
/****************************************************************************
Rename a file - sync interface
****************************************************************************/
-NTSTATUS smb_raw_rename(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_rename(struct smbcli_tree *tree,
union smb_rename *parms)
{
struct smbcli_request *req = smb_raw_rename_send(tree, parms);
@@ -123,7 +124,7 @@ struct smbcli_request *smb_raw_unlink_send(struct smbcli_tree *tree,
/*
delete a file - sync interface
*/
-NTSTATUS smb_raw_unlink(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_unlink(struct smbcli_tree *tree,
union smb_unlink *parms)
{
struct smbcli_request *req = smb_raw_unlink_send(tree, parms);
@@ -201,7 +202,7 @@ struct smbcli_request *smb_raw_mkdir_send(struct smbcli_tree *tree,
/****************************************************************************
Create a directory - sync interface
****************************************************************************/
-NTSTATUS smb_raw_mkdir(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_mkdir(struct smbcli_tree *tree,
union smb_mkdir *parms)
{
struct smbcli_request *req = smb_raw_mkdir_send(tree, parms);
@@ -231,7 +232,7 @@ struct smbcli_request *smb_raw_rmdir_send(struct smbcli_tree *tree,
/****************************************************************************
Remove a directory - sync interface
****************************************************************************/
-NTSTATUS smb_raw_rmdir(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_rmdir(struct smbcli_tree *tree,
struct smb_rmdir *parms)
{
struct smbcli_request *req = smb_raw_rmdir_send(tree, parms);
@@ -448,7 +449,7 @@ static NTSTATUS smb_raw_t2open_recv(struct smbcli_request *req, TALLOC_CTX *mem_
/****************************************************************************
Open a file - async send
****************************************************************************/
-struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_open *parms)
+_PUBLIC_ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_open *parms)
{
int len;
struct smbcli_request *req = NULL;
@@ -585,7 +586,7 @@ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_ope
/****************************************************************************
Open a file - async recv
****************************************************************************/
-NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms)
+_PUBLIC_ NTSTATUS smb_raw_open_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_open *parms)
{
NTSTATUS status;
@@ -720,7 +721,7 @@ failed:
/****************************************************************************
Open a file - sync interface
****************************************************************************/
-NTSTATUS smb_raw_open(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_open *parms)
+_PUBLIC_ NTSTATUS smb_raw_open(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_open *parms)
{
struct smbcli_request *req = smb_raw_open_send(tree, parms);
return smb_raw_open_recv(req, mem_ctx, parms);
@@ -730,7 +731,7 @@ NTSTATUS smb_raw_open(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_o
/****************************************************************************
Close a file - async send
****************************************************************************/
-struct smbcli_request *smb_raw_close_send(struct smbcli_tree *tree, union smb_close *parms)
+_PUBLIC_ struct smbcli_request *smb_raw_close_send(struct smbcli_tree *tree, union smb_close *parms)
{
struct smbcli_request *req = NULL;
@@ -766,7 +767,7 @@ struct smbcli_request *smb_raw_close_send(struct smbcli_tree *tree, union smb_cl
/****************************************************************************
Close a file - sync interface
****************************************************************************/
-NTSTATUS smb_raw_close(struct smbcli_tree *tree, union smb_close *parms)
+_PUBLIC_ NTSTATUS smb_raw_close(struct smbcli_tree *tree, union smb_close *parms)
{
struct smbcli_request *req = smb_raw_close_send(tree, parms);
return smbcli_request_simple_recv(req);
@@ -843,7 +844,7 @@ struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_loc
/****************************************************************************
Locking calls - sync interface
****************************************************************************/
-NTSTATUS smb_raw_lock(struct smbcli_tree *tree, union smb_lock *parms)
+_PUBLIC_ NTSTATUS smb_raw_lock(struct smbcli_tree *tree, union smb_lock *parms)
{
struct smbcli_request *req = smb_raw_lock_send(tree, parms);
return smbcli_request_simple_recv(req);
@@ -913,7 +914,7 @@ struct smbcli_request *smb_raw_flush_send(struct smbcli_tree *tree, union smb_fl
/****************************************************************************
flush a file - sync interface
****************************************************************************/
-NTSTATUS smb_raw_flush(struct smbcli_tree *tree, union smb_flush *parms)
+_PUBLIC_ NTSTATUS smb_raw_flush(struct smbcli_tree *tree, union smb_flush *parms)
{
struct smbcli_request *req = smb_raw_flush_send(tree, parms);
return smbcli_request_simple_recv(req);
@@ -962,7 +963,7 @@ failed:
/*
seek a file - sync interface
*/
-NTSTATUS smb_raw_seek(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_seek(struct smbcli_tree *tree,
union smb_seek *parms)
{
struct smbcli_request *req = smb_raw_seek_send(tree, parms);
diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c
index ed5475e926..71900be49c 100644
--- a/source4/libcli/raw/rawfileinfo.c
+++ b/source4/libcli/raw/rawfileinfo.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "param/param.h"
@@ -711,7 +712,7 @@ NTSTATUS smb_raw_fileinfo_recv(struct smbcli_request *req,
/****************************************************************************
Query file info (sync interface)
****************************************************************************/
-NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
union smb_fileinfo *parms)
{
@@ -722,7 +723,7 @@ NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree,
/****************************************************************************
Query path info (async send)
****************************************************************************/
-struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree,
+_PUBLIC_ struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree,
union smb_fileinfo *parms)
{
DATA_BLOB data;
@@ -756,7 +757,7 @@ struct smbcli_request *smb_raw_pathinfo_send(struct smbcli_tree *tree,
/****************************************************************************
Query path info (async recv)
****************************************************************************/
-NTSTATUS smb_raw_pathinfo_recv(struct smbcli_request *req,
+_PUBLIC_ NTSTATUS smb_raw_pathinfo_recv(struct smbcli_request *req,
TALLOC_CTX *mem_ctx,
union smb_fileinfo *parms)
{
@@ -767,7 +768,7 @@ NTSTATUS smb_raw_pathinfo_recv(struct smbcli_request *req,
/****************************************************************************
Query path info (sync interface)
****************************************************************************/
-NTSTATUS smb_raw_pathinfo(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_pathinfo(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
union smb_fileinfo *parms)
{
diff --git a/source4/libcli/raw/rawfsinfo.c b/source4/libcli/raw/rawfsinfo.c
index bfb5db828e..43a0919e38 100644
--- a/source4/libcli/raw/rawfsinfo.c
+++ b/source4/libcli/raw/rawfsinfo.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "librpc/gen_ndr/ndr_misc.h"
/****************************************************************************
@@ -326,7 +327,7 @@ failed:
/****************************************************************************
Query FSInfo raw interface (sync interface)
****************************************************************************/
-NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
union smb_fsinfo *fsinfo)
{
diff --git a/source4/libcli/raw/rawioctl.c b/source4/libcli/raw/rawioctl.c
index 957e554c6b..77c7b03f15 100644
--- a/source4/libcli/raw/rawioctl.c
+++ b/source4/libcli/raw/rawioctl.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#define SETUP_REQUEST(cmd, wct, buflen) do { \
req = smbcli_request_setup(tree, cmd, wct, buflen); \
@@ -163,7 +164,7 @@ NTSTATUS smb_raw_ioctl_recv(struct smbcli_request *req,
/*
send a raw ioctl - sync interface
*/
-_PUBLIC_ NTSTATUS smb_raw_ioctl(struct smbcli_tree *tree,
+NTSTATUS smb_raw_ioctl(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx, union smb_ioctl *parms)
{
struct smbcli_request *req;
diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c
index 6c16935f21..f0de4b48bd 100644
--- a/source4/libcli/raw/rawnegotiate.c
+++ b/source4/libcli/raw/rawnegotiate.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "system/time.h"
#include "param/param.h"
diff --git a/source4/libcli/raw/rawnotify.c b/source4/libcli/raw/rawnotify.c
index 91a12a8618..bf7578d7fc 100644
--- a/source4/libcli/raw/rawnotify.c
+++ b/source4/libcli/raw/rawnotify.c
@@ -19,12 +19,13 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "lib/util/dlinklist.h"
/****************************************************************************
change notify (async send)
****************************************************************************/
-struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, union smb_notify *parms)
+_PUBLIC_ struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, union smb_notify *parms)
{
struct smb_nttrans nt;
uint8_t setup[8];
@@ -51,7 +52,7 @@ struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, union
/****************************************************************************
change notify (async recv)
****************************************************************************/
-NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req,
+_PUBLIC_ NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req,
TALLOC_CTX *mem_ctx, union smb_notify *parms)
{
struct smb_nttrans nt;
diff --git a/source4/libcli/raw/rawreadwrite.c b/source4/libcli/raw/rawreadwrite.c
index 9e4edaf99c..a8c7996310 100644
--- a/source4/libcli/raw/rawreadwrite.c
+++ b/source4/libcli/raw/rawreadwrite.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#define SETUP_REQUEST(cmd, wct, buflen) do { \
req = smbcli_request_setup(tree, cmd, wct, buflen); \
@@ -29,7 +30,7 @@
/****************************************************************************
low level read operation (async send)
****************************************************************************/
-struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_read *parms)
+_PUBLIC_ struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_read *parms)
{
bool bigoffset = false;
struct smbcli_request *req = NULL;
@@ -115,7 +116,7 @@ struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_rea
/****************************************************************************
low level read operation (async recv)
****************************************************************************/
-NTSTATUS smb_raw_read_recv(struct smbcli_request *req, union smb_read *parms)
+_PUBLIC_ NTSTATUS smb_raw_read_recv(struct smbcli_request *req, union smb_read *parms)
{
if (!smbcli_request_receive(req) ||
smbcli_request_is_error(req)) {
@@ -197,7 +198,7 @@ failed:
/****************************************************************************
low level read operation (sync interface)
****************************************************************************/
-NTSTATUS smb_raw_read(struct smbcli_tree *tree, union smb_read *parms)
+_PUBLIC_ NTSTATUS smb_raw_read(struct smbcli_tree *tree, union smb_read *parms)
{
struct smbcli_request *req = smb_raw_read_send(tree, parms);
return smb_raw_read_recv(req, parms);
@@ -207,7 +208,7 @@ NTSTATUS smb_raw_read(struct smbcli_tree *tree, union smb_read *parms)
/****************************************************************************
raw write interface (async send)
****************************************************************************/
-struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_write *parms)
+_PUBLIC_ struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_write *parms)
{
bool bigoffset = false;
struct smbcli_request *req = NULL;
@@ -341,7 +342,7 @@ failed:
/****************************************************************************
raw write interface (sync interface)
****************************************************************************/
-NTSTATUS smb_raw_write(struct smbcli_tree *tree, union smb_write *parms)
+_PUBLIC_ NTSTATUS smb_raw_write(struct smbcli_tree *tree, union smb_write *parms)
{
struct smbcli_request *req = smb_raw_write_send(tree, parms);
return smb_raw_write_recv(req, parms);
diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c
index 355d092583..a42c710547 100644
--- a/source4/libcli/raw/rawrequest.c
+++ b/source4/libcli/raw/rawrequest.c
@@ -24,9 +24,12 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "lib/util/dlinklist.h"
#include "lib/events/events.h"
#include "param/param.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/ndr_misc.h"
/* we over allocate the data buffer to prevent too many realloc calls */
#define REQ_OVER_ALLOCATION 0
@@ -49,7 +52,7 @@ void smb_setup_bufinfo(struct smbcli_request *req)
/* destroy a request structure and return final status */
-NTSTATUS smbcli_request_destroy(struct smbcli_request *req)
+_PUBLIC_ NTSTATUS smbcli_request_destroy(struct smbcli_request *req)
{
NTSTATUS status;
@@ -405,7 +408,7 @@ bool smbcli_handle_oplock_break(struct smbcli_transport *transport, uint_t len,
wait for a reply to be received for a packet that just returns an error
code and nothing more
*/
-NTSTATUS smbcli_request_simple_recv(struct smbcli_request *req)
+_PUBLIC_ NTSTATUS smbcli_request_simple_recv(struct smbcli_request *req)
{
(void) smbcli_request_receive(req);
return smbcli_request_destroy(req);
diff --git a/source4/libcli/raw/rawsearch.c b/source4/libcli/raw/rawsearch.c
index fb2b09467c..99141574e2 100644
--- a/source4/libcli/raw/rawsearch.c
+++ b/source4/libcli/raw/rawsearch.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
/****************************************************************************
Old style search backend - process output.
@@ -718,7 +719,7 @@ static NTSTATUS smb_raw_t2search_backend(struct smbcli_tree *tree,
/* Implements trans2findfirst2 and old search
*/
-NTSTATUS smb_raw_search_first(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_search_first(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
union smb_search_first *io, void *private,
smbcli_search_callback callback)
diff --git a/source4/libcli/raw/rawsetfileinfo.c b/source4/libcli/raw/rawsetfileinfo.c
index f1e4ee3686..16052e8708 100644
--- a/source4/libcli/raw/rawsetfileinfo.c
+++ b/source4/libcli/raw/rawsetfileinfo.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "librpc/gen_ndr/ndr_security.h"
@@ -409,7 +410,7 @@ struct smbcli_request *smb_raw_setfileinfo_send(struct smbcli_tree *tree,
/****************************************************************************
Set file info (async send)
****************************************************************************/
-NTSTATUS smb_raw_setfileinfo(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_setfileinfo(struct smbcli_tree *tree,
union smb_setfileinfo *parms)
{
struct smbcli_request *req = smb_raw_setfileinfo_send(tree, parms);
@@ -420,7 +421,7 @@ NTSTATUS smb_raw_setfileinfo(struct smbcli_tree *tree,
/****************************************************************************
Set path info (async send)
****************************************************************************/
-struct smbcli_request *smb_raw_setpathinfo_send(struct smbcli_tree *tree,
+_PUBLIC_ struct smbcli_request *smb_raw_setpathinfo_send(struct smbcli_tree *tree,
union smb_setfileinfo *parms)
{
DATA_BLOB blob;
@@ -456,7 +457,7 @@ struct smbcli_request *smb_raw_setpathinfo_send(struct smbcli_tree *tree,
/****************************************************************************
Set path info (sync interface)
****************************************************************************/
-NTSTATUS smb_raw_setpathinfo(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_setpathinfo(struct smbcli_tree *tree,
union smb_setfileinfo *parms)
{
struct smbcli_request *req = smb_raw_setpathinfo_send(tree, parms);
diff --git a/source4/libcli/raw/rawshadow.c b/source4/libcli/raw/rawshadow.c
index 4c58c91383..b318c3e025 100644
--- a/source4/libcli/raw/rawshadow.c
+++ b/source4/libcli/raw/rawshadow.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/raw/ioctl.h"
/*
diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c
index 53670d22a3..29881afd2b 100644
--- a/source4/libcli/raw/rawtrans.c
+++ b/source4/libcli/raw/rawtrans.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "lib/util/dlinklist.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#define TORTURE_TRANS_DATA 0
@@ -192,7 +193,7 @@ failed:
return smbcli_request_destroy(req);
}
-NTSTATUS smb_raw_trans_recv(struct smbcli_request *req,
+_PUBLIC_ NTSTATUS smb_raw_trans_recv(struct smbcli_request *req,
TALLOC_CTX *mem_ctx,
struct smb_trans2 *parms)
{
@@ -365,7 +366,7 @@ struct smbcli_request *smb_raw_trans_send_backend(struct smbcli_tree *tree,
trans/trans2 raw async interface - only BLOBs used in this interface.
note that this doesn't yet support multi-part requests
*/
-struct smbcli_request *smb_raw_trans_send(struct smbcli_tree *tree,
+_PUBLIC_ struct smbcli_request *smb_raw_trans_send(struct smbcli_tree *tree,
struct smb_trans2 *parms)
{
return smb_raw_trans_send_backend(tree, parms, SMBtrans);
@@ -394,7 +395,7 @@ NTSTATUS smb_raw_trans2(struct smbcli_tree *tree,
/*
trans synchronous blob interface
*/
-NTSTATUS smb_raw_trans(struct smbcli_tree *tree,
+_PUBLIC_ NTSTATUS smb_raw_trans(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
struct smb_trans2 *parms)
{
@@ -631,7 +632,7 @@ NTSTATUS smb_raw_nttrans(struct smbcli_tree *tree,
TODO: we only need to avoid multi-part replies because the
multi-part trans receive code is broken.
*/
-size_t smb_raw_max_trans_data(struct smbcli_tree *tree, size_t param_size)
+_PUBLIC_ size_t smb_raw_max_trans_data(struct smbcli_tree *tree, size_t param_size)
{
return tree->session->transport->negotiate.max_xmit - (70 + param_size);
}
diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c
index 4acfb9d16d..97bb688d1a 100644
--- a/source4/libcli/raw/smb_signing.c
+++ b/source4/libcli/raw/smb_signing.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "smb.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "lib/crypto/crypto.h"
#include "param/param.h"
diff --git a/source4/libcli/security/security.h b/source4/libcli/security/security.h
index c7f2a09311..46ef6186b8 100644
--- a/source4/libcli/security/security.h
+++ b/source4/libcli/security/security.h
@@ -26,4 +26,6 @@ enum security_user_level {
SECURITY_SYSTEM
};
+struct auth_session_info;
+
#include "libcli/security/proto.h"
diff --git a/source4/libcli/smb2/close.c b/source4/libcli/smb2/close.c
index 04c0c85499..4e6f33095f 100644
--- a/source4/libcli/smb2/close.c
+++ b/source4/libcli/smb2/close.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index 85ddafc031..d68b85ad54 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
#include "libcli/composite/composite.h"
diff --git a/source4/libcli/smb2/create.c b/source4/libcli/smb2/create.c
index cca83a040c..999c10ab08 100644
--- a/source4/libcli/smb2/create.c
+++ b/source4/libcli/smb2/create.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
diff --git a/source4/libcli/smb2/find.c b/source4/libcli/smb2/find.c
index 6d0a9c8072..6b4902a026 100644
--- a/source4/libcli/smb2/find.c
+++ b/source4/libcli/smb2/find.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
diff --git a/source4/libcli/smb2/getinfo.c b/source4/libcli/smb2/getinfo.c
index e9f47140f5..b462bab1de 100644
--- a/source4/libcli/smb2/getinfo.c
+++ b/source4/libcli/smb2/getinfo.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
diff --git a/source4/libcli/smb2/negprot.c b/source4/libcli/smb2/negprot.c
index 6b879e2add..c1f0cf0b24 100644
--- a/source4/libcli/smb2/negprot.c
+++ b/source4/libcli/smb2/negprot.c
@@ -21,8 +21,10 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
+#include "librpc/ndr/libndr.h"
/*
send a negprot request
diff --git a/source4/libcli/smb2/notify.c b/source4/libcli/smb2/notify.c
index e7c38a27f9..096d790a31 100644
--- a/source4/libcli/smb2/notify.c
+++ b/source4/libcli/smb2/notify.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
diff --git a/source4/libcli/smb2/setinfo.c b/source4/libcli/smb2/setinfo.c
index a6e22d9a68..69c0f45b63 100644
--- a/source4/libcli/smb2/setinfo.c
+++ b/source4/libcli/smb2/setinfo.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c
index 1d601fdbfe..af19fcb0a9 100644
--- a/source4/libcli/smb2/transport.c
+++ b/source4/libcli/smb2/transport.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
#include "lib/socket/socket.h"
diff --git a/source4/libcli/smb_composite/appendacl.c b/source4/libcli/smb_composite/appendacl.c
index 0fda8c4d65..1f06b96e75 100644
--- a/source4/libcli/smb_composite/appendacl.c
+++ b/source4/libcli/smb_composite/appendacl.c
@@ -1,5 +1,6 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/composite/composite.h"
#include "libcli/security/security.h"
#include "libcli/smb_composite/smb_composite.h"
diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c
index 22573442a2..c44c62f868 100644
--- a/source4/libcli/smb_composite/connect.c
+++ b/source4/libcli/smb_composite/connect.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/composite/composite.h"
#include "libcli/smb_composite/smb_composite.h"
#include "lib/events/events.h"
diff --git a/source4/libcli/smb_composite/fsinfo.c b/source4/libcli/smb_composite/fsinfo.c
index e4dd4436ba..2ec13df9b6 100644
--- a/source4/libcli/smb_composite/fsinfo.c
+++ b/source4/libcli/smb_composite/fsinfo.c
@@ -4,6 +4,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/composite/composite.h"
#include "libcli/smb_composite/smb_composite.h"
#include "param/param.h"
diff --git a/source4/libcli/smb_composite/savefile.c b/source4/libcli/smb_composite/savefile.c
index b94be9e9b1..f02ca46f06 100644
--- a/source4/libcli/smb_composite/savefile.c
+++ b/source4/libcli/smb_composite/savefile.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/composite/composite.h"
#include "libcli/smb_composite/smb_composite.h"
diff --git a/source4/libcli/smb_composite/sesssetup.c b/source4/libcli/smb_composite/sesssetup.c
index 75a2a579a2..1427fe525b 100644
--- a/source4/libcli/smb_composite/sesssetup.c
+++ b/source4/libcli/smb_composite/sesssetup.c
@@ -22,8 +22,10 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
#include "libcli/composite/composite.h"
#include "libcli/smb_composite/smb_composite.h"
+#include "libcli/smb_composite/proto.h"
#include "libcli/auth/libcli_auth.h"
#include "auth/auth.h"
#include "auth/gensec/gensec.h"
diff --git a/source4/libcli/util/error.h b/source4/libcli/util/error.h
index e054948fbe..84255448a0 100644
--- a/source4/libcli/util/error.h
+++ b/source4/libcli/util/error.h
@@ -22,7 +22,6 @@
#include "libcli/util/werror.h"
#include "libcli/util/doserr.h"
#include "libcli/util/ntstatus.h"
-#include "librpc/ndr/libndr.h"
/** NT error on DOS connection! (NT_STATUS_OK) */
bool ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2);
@@ -47,6 +46,8 @@ WERROR ntstatus_to_werror(NTSTATUS error);
*********************************************************************/
NTSTATUS map_nt_error_from_unix(int unix_error);
+enum ndr_err_code;
+
/*********************************************************************
Map an NT error code from a NDR error code.
*********************************************************************/
diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c
index b8458d4bf3..2257955c76 100644
--- a/source4/libcli/util/errormap.c
+++ b/source4/libcli/util/errormap.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "param/param.h"
+#include "librpc/ndr/libndr.h"
/* This map was extracted by the ERRMAPEXTRACT smbtorture command.
The setup was a Samba HEAD (2002-01-03) PDC and an Win2k member
diff --git a/source4/libcli/wbclient/config.mk b/source4/libcli/wbclient/config.mk
new file mode 100644
index 0000000000..9384a172ff
--- /dev/null
+++ b/source4/libcli/wbclient/config.mk
@@ -0,0 +1,4 @@
+[SUBSYSTEM::LIBWBCLIENT]
+OBJ_FILES = wbclient.o
+PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBEVENTS
+PRIVATE_DEPENDENCIES = NDR_WINBIND MESSAGING
diff --git a/source4/libcli/wbclient/wbclient.c b/source4/libcli/wbclient/wbclient.c
new file mode 100644
index 0000000000..1b2d314824
--- /dev/null
+++ b/source4/libcli/wbclient/wbclient.c
@@ -0,0 +1,210 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Winbind client library.
+
+ Copyright (C) 2008 Kai Blin <kai@samba.org>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "libcli/wbclient/wbclient.h"
+
+/**
+ * Get the server_id of the winbind task.
+ *
+ * \param[in] msg_ctx message context to use
+ * \param[in] mem_ctx talloc context to use
+ * \param[out] ids array of server_id structs containing the winbind id
+ * \return NT_STATUS_OK on success, NT_STATUS_INTERNAL_ERROR on failure
+ */
+static NTSTATUS get_server_id(struct messaging_context *msg_ctx,
+ TALLOC_CTX *mem_ctx, struct server_id **ids)
+{
+ *ids = irpc_servers_byname(msg_ctx, mem_ctx, "winbind_server");
+ if (*ids == NULL || (*ids)[0].id == 0) {
+ DEBUG(0, ("Geting the winbind server ID failed.\n"));
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ return NT_STATUS_OK;
+}
+
+/**
+ * Initialize the wbclient context, talloc_free() when done.
+ *
+ * \param mem_ctx talloc context to allocate memory from
+ * \param msg_ctx message context to use
+ * \param
+ */
+struct wbc_context *wbc_init(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
+ struct event_context *event_ctx)
+{
+ struct wbc_context *ctx;
+ NTSTATUS status;
+
+ ctx = talloc(mem_ctx, struct wbc_context);
+ if (ctx == NULL) return NULL;
+
+ status = get_server_id(msg_ctx, mem_ctx, &ctx->ids);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(ctx);
+ return NULL;
+ }
+
+ ctx->msg_ctx = msg_ctx;
+ ctx->event_ctx = event_ctx;
+
+ return ctx;
+}
+
+struct wbc_idmap_state {
+ struct composite_context *ctx;
+ struct winbind_get_idmap *req;
+ struct irpc_request *irpc_req;
+ struct id_mapping *ids;
+};
+
+static void sids_to_xids_recv_ids(struct irpc_request *req);
+
+struct composite_context *wbc_sids_to_xids_send(struct wbc_context *wbc_ctx,
+ TALLOC_CTX *mem_ctx,
+ uint32_t count,
+ struct id_mapping *ids)
+{
+ struct composite_context *ctx;
+ struct wbc_idmap_state *state;
+
+ DEBUG(5, ("wbc_sids_to_xids called\n"));
+
+ ctx = composite_create(mem_ctx, wbc_ctx->event_ctx);
+ if (ctx == NULL) return NULL;
+
+ state = talloc(ctx, struct wbc_idmap_state);
+ if (composite_nomem(state, ctx)) return ctx;
+ ctx->private_data = state;
+
+ state->req = talloc(state, struct winbind_get_idmap);
+ if (composite_nomem(state->req, ctx)) return ctx;
+
+ state->req->in.count = count;
+ state->req->in.level = WINBIND_IDMAP_LEVEL_SIDS_TO_XIDS;
+ state->req->in.ids = ids;
+ state->ctx = ctx;
+
+ state->irpc_req = IRPC_CALL_SEND(wbc_ctx->msg_ctx, wbc_ctx->ids[0],
+ winbind, WINBIND_GET_IDMAP, state->req,
+ state);
+ if (composite_nomem(state->irpc_req, ctx)) return ctx;
+
+ composite_continue_irpc(ctx, state->irpc_req, sids_to_xids_recv_ids,
+ state);
+ return ctx;
+}
+
+static void sids_to_xids_recv_ids(struct irpc_request *req)
+{
+ struct wbc_idmap_state *state = talloc_get_type_abort(
+ req->async.private,
+ struct wbc_idmap_state);
+
+ state->ctx->status = irpc_call_recv(state->irpc_req);
+ if (!composite_is_ok(state->ctx)) return;
+
+ state->ids = state->req->out.ids;
+ composite_done(state->ctx);
+}
+
+NTSTATUS wbc_sids_to_xids_recv(struct composite_context *ctx,
+ struct id_mapping **ids)
+{
+ NTSTATUS status = composite_wait(ctx);
+ DEBUG(5, ("wbc_sids_to_xids_recv called\n"));
+ if (NT_STATUS_IS_OK(status)) {
+ struct wbc_idmap_state *state = talloc_get_type_abort(
+ ctx->private_data,
+ struct wbc_idmap_state);
+ *ids = state->ids;
+ }
+
+ return status;
+}
+
+static void xids_to_sids_recv_ids(struct irpc_request *req);
+
+struct composite_context *wbc_xids_to_sids_send(struct wbc_context *wbc_ctx,
+ TALLOC_CTX *mem_ctx,
+ uint32_t count,
+ struct id_mapping *ids)
+{
+ struct composite_context *ctx;
+ struct wbc_idmap_state *state;
+
+ DEBUG(5, ("wbc_xids_to_sids called\n"));
+
+ ctx = composite_create(mem_ctx, wbc_ctx->event_ctx);
+ if (ctx == NULL) return NULL;
+
+ state = talloc(ctx, struct wbc_idmap_state);
+ if (composite_nomem(state, ctx)) return ctx;
+ ctx->private_data = state;
+
+ state->req = talloc(state, struct winbind_get_idmap);
+ if (composite_nomem(state->req, ctx)) return ctx;
+
+ state->req->in.count = count;
+ state->req->in.level = WINBIND_IDMAP_LEVEL_XIDS_TO_SIDS;
+ state->req->in.ids = ids;
+ state->ctx = ctx;
+
+ state->irpc_req = IRPC_CALL_SEND(wbc_ctx->msg_ctx, wbc_ctx->ids[0],
+ winbind, WINBIND_GET_IDMAP, state->req,
+ state);
+ if (composite_nomem(state->irpc_req, ctx)) return ctx;
+
+ composite_continue_irpc(ctx, state->irpc_req, xids_to_sids_recv_ids,
+ state);
+
+ return ctx;
+}
+
+static void xids_to_sids_recv_ids(struct irpc_request *req)
+{
+ struct wbc_idmap_state *state = talloc_get_type_abort(
+ req->async.private,
+ struct wbc_idmap_state);
+
+ state->ctx->status = irpc_call_recv(state->irpc_req);
+ if (!composite_is_ok(state->ctx)) return;
+
+ state->ids = state->req->out.ids;
+ composite_done(state->ctx);
+}
+
+NTSTATUS wbc_xids_to_sids_recv(struct composite_context *ctx,
+ struct id_mapping **ids)
+{
+ NTSTATUS status = composite_wait(ctx);
+ DEBUG(5, ("wbc_xids_to_sids_recv called\n"));
+ if (NT_STATUS_IS_OK(status)) {
+ struct wbc_idmap_state *state = talloc_get_type_abort(
+ ctx->private_data,
+ struct wbc_idmap_state);
+ *ids = state->ids;
+ }
+
+ return status;
+}
+
diff --git a/source4/libcli/wbclient/wbclient.h b/source4/libcli/wbclient/wbclient.h
new file mode 100644
index 0000000000..099abaa511
--- /dev/null
+++ b/source4/libcli/wbclient/wbclient.h
@@ -0,0 +1,50 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Winbind client library.
+
+ Copyright (C) 2008 Kai Blin <kai@samba.org>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 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, see <http://www.gnu.org/licenses/>.
+*/
+#include "lib/messaging/irpc.h"
+#include "libcli/composite/composite.h"
+#include "librpc/gen_ndr/ndr_winbind.h"
+
+struct wbc_context {
+ struct messaging_context *msg_ctx;
+ struct event_context *event_ctx;
+ struct server_id *ids;
+};
+
+struct wbc_context *wbc_init(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
+ struct event_context *event_ctx);
+
+struct composite_context *wbc_sids_to_xids_send(struct wbc_context *wbc_ctx,
+ TALLOC_CTX *mem_ctx,
+ uint32_t count,
+ struct id_mapping *ids);
+
+NTSTATUS wbc_sids_to_xids_recv(struct composite_context *ctx,
+ struct id_mapping **ids);
+
+struct composite_context *wbc_xids_to_sids_send(struct wbc_context *wbc_ctx,
+ TALLOC_CTX *mem_ctx,
+ uint32_t count,
+ struct id_mapping *ids);
+
+NTSTATUS wbc_xids_to_sids_recv(struct composite_context *ctx,
+ struct id_mapping **ids);
+