summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-01-16 12:00:00 +0100
committerJeremy Allison <jra@samba.org>2013-01-18 09:16:58 -0800
commit3e830e44d3eb23325fbda6f2053e58926ee2136e (patch)
tree4540a64da96a89225dbd607a5f937751f66ac954 /source3
parent4f9cffbae6a60268140eba5e457ac7e86cac6246 (diff)
downloadsamba-3e830e44d3eb23325fbda6f2053e58926ee2136e.tar.gz
samba-3e830e44d3eb23325fbda6f2053e58926ee2136e.tar.bz2
samba-3e830e44d3eb23325fbda6f2053e58926ee2136e.zip
winbind: Use standard tevent_context_init
This makes winbind use epoll instead of poll Reviewed by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/winbindd/winbindd.c38
-rw-r--r--source3/winbindd/winbindd.h2
-rw-r--r--source3/winbindd/winbindd_proto.h1
3 files changed, 34 insertions, 7 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 698c96cd53..ebaa080bc0 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -49,14 +49,42 @@ static bool interactive = False;
extern bool override_logfile;
+struct tevent_context *winbind_event_context(void)
+{
+ static struct tevent_context *ev = NULL;
+
+ if (ev != NULL) {
+ return ev;
+ }
+
+ /*
+ * Note we MUST use the NULL context here, not the autofree context,
+ * to avoid side effects in forked children exiting.
+ */
+ ev = tevent_context_init(NULL);
+ if (ev == NULL) {
+ smb_panic("Could not init winbindd's messaging context.\n");
+ }
+ return ev;
+}
+
struct messaging_context *winbind_messaging_context(void)
{
- struct messaging_context *msg_ctx = server_messaging_context();
- if (likely(msg_ctx != NULL)) {
- return msg_ctx;
+ static struct messaging_context *msg = NULL;
+
+ if (msg != NULL) {
+ return msg;
+ }
+
+ /*
+ * Note we MUST use the NULL context here, not the autofree context,
+ * to avoid side effects in forked children exiting.
+ */
+ msg = messaging_init(NULL, winbind_event_context());
+ if (msg == NULL) {
+ smb_panic("Could not init winbindd's messaging context.\n");
}
- smb_panic("Could not init winbindd's messaging context.\n");
- return NULL;
+ return msg;
}
/* Reload configuration */
diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h
index 33c7bbe5c6..c01cac7ab3 100644
--- a/source3/winbindd/winbindd.h
+++ b/source3/winbindd/winbindd.h
@@ -396,6 +396,4 @@ struct WINBINDD_CCACHE_ENTRY {
#define WINBINDD_PAM_AUTH_KRB5_RENEW_TIME 2592000 /* one month */
#define DOM_SEQUENCE_NONE ((uint32)-1)
-#define winbind_event_context server_event_context
-
#endif /* _WINBINDD_H */
diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h
index 44693d71dc..33b0f01f3d 100644
--- a/source3/winbindd/winbindd_proto.h
+++ b/source3/winbindd/winbindd_proto.h
@@ -34,6 +34,7 @@ bool winbindd_use_idmap_cache(void);
bool winbindd_use_cache(void);
const char *get_winbind_pipe_dir(void);
char *get_winbind_priv_pipe_dir(void);
+struct tevent_context *winbind_event_context(void);
int main(int argc, char **argv, char **envp);
/* The following definitions come from winbindd/winbindd_ads.c */