summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-12-14 09:11:44 +0100
committerStefan Metzmacher <metze@samba.org>2011-12-14 12:00:06 +0100
commitef45279f5e2e78e448c96ae63b9c35302132306f (patch)
treeb7509bfab19e1b56b516c7f712741695c1ab8c70
parent2e0bc74a6e88a2689e281e2767627c8773b380e4 (diff)
downloadsamba-ef45279f5e2e78e448c96ae63b9c35302132306f.tar.gz
samba-ef45279f5e2e78e448c96ae63b9c35302132306f.tar.bz2
samba-ef45279f5e2e78e448c96ae63b9c35302132306f.zip
s3:web/swat: use short term event and message contexts
swat doesn't have a central event loop. metze
-rw-r--r--source3/web/swat.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 1ecaa5795d..3d6aaf4ca7 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -37,6 +37,7 @@
#include "intl/lang_tdb.h"
#include "../lib/crypto/md5.h"
#include "lib/param/loadparm.h"
+#include "messages.h"
static int demo_mode = False;
static int passwd_only = False;
@@ -588,8 +589,23 @@ static int save_reload(int snum)
}
iNumNonAutoPrintServices = lp_numservices();
if (pcap_cache_loaded()) {
- load_printers(server_event_context(),
- server_messaging_context());
+ struct tevent_context *ev_ctx;
+ struct messaging_context *msg_ctx;
+
+ ev_ctx = s3_tevent_context_init(NULL);
+ if (ev_ctx == NULL) {
+ printf("s3_tevent_context_init() failed\n");
+ return 0;
+ }
+ msg_ctx = messaging_init(ev_ctx, ev_ctx);
+ if (msg_ctx == NULL) {
+ printf("messaging_init() failed\n");
+ return 0;
+ }
+
+ load_printers(ev_ctx, msg_ctx);
+
+ talloc_free(ev_ctx);
}
return 1;
@@ -1574,8 +1590,23 @@ const char *lang_msg_rotate(TALLOC_CTX *ctx, const char *msgid)
load_interfaces();
iNumNonAutoPrintServices = lp_numservices();
if (pcap_cache_loaded()) {
- load_printers(server_event_context(),
- server_messaging_context());
+ struct tevent_context *ev_ctx;
+ struct messaging_context *msg_ctx;
+
+ ev_ctx = s3_tevent_context_init(NULL);
+ if (ev_ctx == NULL) {
+ printf("s3_tevent_context_init() failed\n");
+ return 0;
+ }
+ msg_ctx = messaging_init(ev_ctx, ev_ctx);
+ if (msg_ctx == NULL) {
+ printf("messaging_init() failed\n");
+ return 0;
+ }
+
+ load_printers(ev_ctx, msg_ctx);
+
+ talloc_free(ev_ctx);
}
cgi_setup(get_dyn_SWATDIR(), !demo_mode);