summaryrefslogtreecommitdiff
path: root/source4/utils
diff options
context:
space:
mode:
Diffstat (limited to 'source4/utils')
-rw-r--r--source4/utils/config.mk17
-rw-r--r--source4/utils/net/config.mk7
-rw-r--r--source4/utils/net/net.c2
-rw-r--r--source4/utils/net/net.h1
-rw-r--r--source4/utils/net/net_join.c2
-rw-r--r--source4/utils/net/net_password.c4
-rw-r--r--source4/utils/net/net_time.c2
-rw-r--r--source4/utils/net/net_user.c4
-rw-r--r--source4/utils/net/net_vampire.c6
-rw-r--r--source4/utils/nmblookup.c14
-rw-r--r--source4/utils/ntlm_auth.c11
11 files changed, 40 insertions, 30 deletions
diff --git a/source4/utils/config.mk b/source4/utils/config.mk
index a7d82684e4..d47b36ea7c 100644
--- a/source4/utils/config.mk
+++ b/source4/utils/config.mk
@@ -13,14 +13,15 @@ PRIVATE_DEPENDENCIES = \
gensec \
LIBCLI_RESOLVE \
auth \
+ ntlm_check \
MESSAGING \
LIBEVENTS
# End BINARY ntlm_auth
#################################
-ntlm_auth_OBJ_FILES = utils/ntlm_auth.o
+ntlm_auth_OBJ_FILES = $(utilssrcdir)/ntlm_auth.o
-MANPAGES += utils/man/ntlm_auth.1
+MANPAGES += $(utilssrcdir)/man/ntlm_auth.1
#################################
# Start BINARY getntacl
@@ -33,12 +34,12 @@ PRIVATE_DEPENDENCIES = \
WRAP_XATTR \
LIBSAMBA-ERRORS
-getntacl_OBJ_FILES = utils/getntacl.o
+getntacl_OBJ_FILES = $(utilssrcdir)/getntacl.o
# End BINARY getntacl
#################################
-MANPAGES += utils/man/getntacl.1
+MANPAGES += $(utilssrcdir)/man/getntacl.1
#################################
# Start BINARY setntacl
@@ -48,7 +49,7 @@ MANPAGES += utils/man/getntacl.1
# End BINARY setntacl
#################################
-setntacl_OBJ_FILES = utils/setntacl.o
+setntacl_OBJ_FILES = $(utilssrcdir)/setntacl.o
#################################
# Start BINARY setnttoken
@@ -58,7 +59,7 @@ PRIVATE_DEPENDENCIES =
# End BINARY setnttoken
#################################
-setnttoken_OBJ_FILES = utils/setnttoken.o
+setnttoken_OBJ_FILES = $(utilssrcdir)/setnttoken.o
#################################
# Start BINARY nmblookup
@@ -75,7 +76,7 @@ PRIVATE_DEPENDENCIES = \
# End BINARY nmblookup
#################################
-nmblookup_OBJ_FILES = utils/nmblookup.o
+nmblookup_OBJ_FILES = $(utilssrcdir)/nmblookup.o
#################################
# Start BINARY testparm
@@ -92,4 +93,4 @@ PRIVATE_DEPENDENCIES = \
# End BINARY testparm
#################################
-testparm_OBJ_FILES = utils/testparm.o
+testparm_OBJ_FILES = $(utilssrcdir)/testparm.o
diff --git a/source4/utils/net/config.mk b/source4/utils/net/config.mk
index 4423c44c15..93b51e1e28 100644
--- a/source4/utils/net/config.mk
+++ b/source4/utils/net/config.mk
@@ -1,10 +1,9 @@
-# utils/net subsystem
+# $(utilssrcdir)/net subsystem
#################################
# Start BINARY net
[BINARY::net]
INSTALLDIR = BINDIR
-PRIVATE_PROTO_HEADER = net_proto.h
PRIVATE_DEPENDENCIES = \
LIBSAMBA-HOSTCONFIG \
LIBSAMBA-UTIL \
@@ -15,7 +14,7 @@ PRIVATE_DEPENDENCIES = \
# End BINARY net
#################################
-net_OBJ_FILES = $(addprefix utils/net/, \
+net_OBJ_FILES = $(addprefix $(utilssrcdir)/net/, \
net.o \
net_password.o \
net_time.o \
@@ -23,3 +22,5 @@ net_OBJ_FILES = $(addprefix utils/net/, \
net_vampire.o \
net_user.o)
+
+$(eval $(call proto_header_template,$(utilssrcdir)/net/net_proto.h,$(net_OBJ_FILES:.o=.c)))
diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c
index 6086a4ce32..a87b266568 100644
--- a/source4/utils/net/net.c
+++ b/source4/utils/net/net.c
@@ -199,7 +199,7 @@ static int binary_net(int argc, const char **argv)
ZERO_STRUCTP(ctx);
ctx->lp_ctx = cmdline_lp_ctx;
ctx->credentials = cmdline_credentials;
- cli_credentials_set_event_context(ctx->credentials, ev);
+ ctx->event_ctx = ev;
rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable, net_usage);
diff --git a/source4/utils/net/net.h b/source4/utils/net/net.h
index 17388079dd..309bee277c 100644
--- a/source4/utils/net/net.h
+++ b/source4/utils/net/net.h
@@ -24,6 +24,7 @@
struct net_context {
struct cli_credentials *credentials;
struct loadparm_context *lp_ctx;
+ struct event_context *event_ctx;
};
struct net_functable {
diff --git a/source4/utils/net/net_join.c b/source4/utils/net/net_join.c
index 37b3c21fcf..ad63340089 100644
--- a/source4/utils/net/net_join.c
+++ b/source4/utils/net/net_join.c
@@ -58,7 +58,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv)
domain_name = tmp;
- libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
+ libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!libnetctx) {
return -1;
}
diff --git a/source4/utils/net/net_password.c b/source4/utils/net/net_password.c
index 97bb467fac..55f7c3c31d 100644
--- a/source4/utils/net/net_password.c
+++ b/source4/utils/net/net_password.c
@@ -53,7 +53,7 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a
new_password = getpass(password_prompt);
}
- libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
+ libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!libnetctx) {
return -1;
}
@@ -128,7 +128,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv
new_password = getpass(password_prompt);
}
- libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
+ libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!libnetctx) {
return -1;
}
diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c
index 12a8132cea..92e6e77481 100644
--- a/source4/utils/net/net_time.c
+++ b/source4/utils/net/net_time.c
@@ -43,7 +43,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv)
return net_time_usage(ctx, argc, argv);
}
- libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
+ libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!libnetctx) {
return -1;
}
diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c
index 57cef6b383..c4b8ecb0c2 100644
--- a/source4/utils/net/net_user.c
+++ b/source4/utils/net/net_user.c
@@ -44,7 +44,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv)
}
/* libnet context init and its params */
- lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
+ lnet_ctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!lnet_ctx) return -1;
lnet_ctx->cred = ctx->credentials;
@@ -84,7 +84,7 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv)
}
/* libnet context init and its params */
- lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
+ lnet_ctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!lnet_ctx) return -1;
lnet_ctx->cred = ctx->credentials;
diff --git a/source4/utils/net/net_vampire.c b/source4/utils/net/net_vampire.c
index 38f05353ed..14f6a07e4b 100644
--- a/source4/utils/net/net_vampire.c
+++ b/source4/utils/net/net_vampire.c
@@ -54,7 +54,7 @@ static int net_samdump_keytab(struct net_context *ctx, int argc, const char **ar
break;
}
- libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
+ libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!libnetctx) {
return -1;
}
@@ -100,7 +100,7 @@ int net_samdump(struct net_context *ctx, int argc, const char **argv)
return rc;
}
- libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
+ libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!libnetctx) {
return -1;
}
@@ -142,7 +142,7 @@ int net_samsync_ldb(struct net_context *ctx, int argc, const char **argv)
struct libnet_context *libnetctx;
struct libnet_samsync_ldb r;
- libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
+ libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx);
if (!libnetctx) {
return -1;
}
diff --git a/source4/utils/nmblookup.c b/source4/utils/nmblookup.c
index fe03e0dbbe..980e06602d 100644
--- a/source4/utils/nmblookup.c
+++ b/source4/utils/nmblookup.c
@@ -24,6 +24,7 @@
#include "includes.h"
#include "lib/cmdline/popt_common.h"
#include "lib/socket/socket.h"
+#include "lib/events/events.h"
#include "system/network.h"
#include "system/locale.h"
#include "lib/socket/netif.h"
@@ -180,7 +181,7 @@ static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock,
}
-static bool process_one(struct loadparm_context *lp_ctx,
+static bool process_one(struct loadparm_context *lp_ctx, struct event_context *ev,
struct interface *ifaces, const char *name, int nbt_port)
{
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
@@ -211,7 +212,7 @@ static bool process_one(struct loadparm_context *lp_ctx,
node_name = talloc_strdup(tmp_ctx, name);
}
- nbtsock = nbt_name_socket_init(tmp_ctx, NULL, lp_iconv_convenience(lp_ctx));
+ nbtsock = nbt_name_socket_init(tmp_ctx, ev, lp_iconv_convenience(lp_ctx));
if (options.root_port) {
all_zero_addr = socket_address_from_strings(tmp_ctx, nbtsock->sock->backend_name,
@@ -271,6 +272,7 @@ int main(int argc, const char *argv[])
{
bool ret = true;
struct interface *ifaces;
+ struct event_context *ev;
poptContext pc;
int opt;
enum {
@@ -356,13 +358,17 @@ int main(int argc, const char *argv[])
}
load_interfaces(NULL, lp_interfaces(cmdline_lp_ctx), &ifaces);
-
+
+ ev = event_context_init(talloc_autofree_context());
+
while (poptPeekArg(pc)) {
const char *name = poptGetArg(pc);
- ret &= process_one(cmdline_lp_ctx, ifaces, name, lp_nbt_port(cmdline_lp_ctx));
+ ret &= process_one(cmdline_lp_ctx, ev, ifaces, name, lp_nbt_port(cmdline_lp_ctx));
}
+ talloc_free(ev);
+
talloc_free(ifaces);
poptFreeContext(pc);
diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c
index 0c9a41fd70..95029deffa 100644
--- a/source4/utils/ntlm_auth.c
+++ b/source4/utils/ntlm_auth.c
@@ -30,6 +30,7 @@
#include "auth/auth.h"
#include "librpc/gen_ndr/ndr_netlogon.h"
#include "auth/auth_sam.h"
+#include "auth/ntlm/ntlm_check.h"
#include "pstring.h"
#include "libcli/auth/libcli_auth.h"
#include "libcli/security/security.h"
@@ -461,6 +462,10 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
return;
}
+ ev = event_context_init(state);
+ if (!ev) {
+ exit(1);
+ }
/* setup gensec */
if (!(state->gensec_state)) {
switch (stdio_helper_mode) {
@@ -468,7 +473,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
case NTLMSSP_CLIENT_1:
/* setup the client side */
- nt_status = gensec_client_start(NULL, &state->gensec_state, NULL, lp_ctx);
+ nt_status = gensec_client_start(NULL, &state->gensec_state, ev, lp_ctx);
if (!NT_STATUS_IS_OK(nt_status)) {
exit(1);
}
@@ -476,10 +481,6 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
break;
case GSS_SPNEGO_SERVER:
case SQUID_2_5_NTLMSSP:
- ev = event_context_init(state);
- if (!ev) {
- exit(1);
- }
msg = messaging_client_init(state, lp_messaging_path(state, lp_ctx),
lp_iconv_convenience(lp_ctx), ev);
if (!msg) {