summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-02-25 16:40:17 -0500
committerSimo Sorce <ssorce@redhat.com>2009-02-26 09:13:20 -0500
commitc9f6d2795fde2f9bf80277d425df2b44bc860226 (patch)
tree301e1217eb5fda73351e9c7fb2f73048853942df
parent03fa4034a6a74a326e5340dae42d85eea4516b3c (diff)
downloadsssd-c9f6d2795fde2f9bf80277d425df2b44bc860226.tar.gz
sssd-c9f6d2795fde2f9bf80277d425df2b44bc860226.tar.xz
sssd-c9f6d2795fde2f9bf80277d425df2b44bc860226.zip
Rebase the code to use talloc, tdb, tevent, ldb as external
dependencies based on the latest samba code. Convert all references to the old events library to use the renamed tevent library.
-rw-r--r--server/Makefile.in8
-rw-r--r--server/confdb/confdb.c5
-rw-r--r--server/confdb/confdb.h6
-rw-r--r--server/configure.ac2
-rw-r--r--server/db/sysdb.c16
-rw-r--r--server/db/sysdb.h16
-rw-r--r--server/external/libevents.m47
-rw-r--r--server/external/libtevent.m47
-rw-r--r--server/infopipe/infopipe.c2
-rw-r--r--server/infopipe/infopipe_private.h2
-rw-r--r--server/infopipe/sysbus.c2
-rw-r--r--server/infopipe/sysbus.h2
-rw-r--r--server/ldb_modules/ldb_module.h111
-rw-r--r--server/ldb_modules/memberof.c7
-rw-r--r--server/monitor/monitor.c36
-rw-r--r--server/monitor/monitor.h2
-rw-r--r--server/polkit/sssd_polkit.c4
-rw-r--r--server/providers/data_provider.c4
-rw-r--r--server/providers/data_provider_be.c11
-rw-r--r--server/providers/dp_backend.h2
-rw-r--r--server/providers/dp_sbus.c4
-rw-r--r--server/providers/ldap_be.c20
-rw-r--r--server/providers/providers.h2
-rw-r--r--server/providers/proxy.c1
-rw-r--r--server/responder/common/responder_cmd.c2
-rw-r--r--server/responder/common/responder_cmd.h4
-rw-r--r--server/responder/common/responder_common.c32
-rw-r--r--server/responder/common/responder_common.h4
-rw-r--r--server/responder/common/responder_dp.c12
-rw-r--r--server/responder/nss/nsssrv.c32
-rw-r--r--server/responder/nss/nsssrv.h10
-rw-r--r--server/responder/nss/nsssrv_cmd.c2
-rw-r--r--server/responder/nss/nsssrv_dp.c20
-rw-r--r--server/sbus/sbus_client.c2
-rw-r--r--server/sbus/sbus_client.h4
-rw-r--r--server/sbus/sssd_dbus.h6
-rw-r--r--server/sbus/sssd_dbus_common.c8
-rw-r--r--server/sbus/sssd_dbus_connection.c47
-rw-r--r--server/sbus/sssd_dbus_server.c34
-rw-r--r--server/tests/sysdb-tests.c4
-rw-r--r--server/util/btreemap.c1
-rw-r--r--server/util/memory.c1
-rw-r--r--server/util/server.c21
-rw-r--r--server/util/signal.c1
-rw-r--r--server/util/util.h10
45 files changed, 213 insertions, 323 deletions
diff --git a/server/Makefile.in b/server/Makefile.in
index 7acb2764d..11542dea2 100644
--- a/server/Makefile.in
+++ b/server/Makefile.in
@@ -28,8 +28,8 @@ TALLOC_CFLAGS = @TALLOC_CFLAGS@
TDB_LIBS = @TDB_LIBS@
TDB_CFLAGS = @TDB_CFLAGS@
-EVENTS_LIBS = @EVENTS_LIBS@
-EVENTS_CFLAGS = @EVENTS_CFLAGS@
+TEVENT_LIBS = @TEVENT_LIBS@
+TEVENT_CFLAGS = @TEVENT_CFLAGS@
POPT_LIBS = @POPT_LIBS@
POPT_CFLAGS = @POPT_CFLAGS@
@@ -63,11 +63,11 @@ SHLD_FLAGS = @SHLD_FLAGS@
SONAMEFLAG = @SONAMEFLAG@
LDFLAGS += @LDFLAGS@ -L$(srcdir)/lib
-LIBS = @LIBS@ $(TALLOC_LIBS) $(TDB_LIBS) $(EVENTS_LIBS) $(POPT_LIBS) $(LDB_LIBS) $(DBUS_LIBS)
+LIBS = @LIBS@ $(TALLOC_LIBS) $(TDB_LIBS) $(TEVENT_LIBS) $(POPT_LIBS) $(LDB_LIBS) $(DBUS_LIBS)
PICFLAG = @PICFLAG@
CFLAGS += -g -I$(srcdir)/include -Iinclude -I$(srcdir) -I$(srcdir)/.. \
- $(POPT_CFLAGS) $(TALLOC_CFLAGS) $(TDB_CFLAGS) $(EVENTS_CFLAGS) $(LDB_CFLAGS) $(DBUS_CFLAGS) $(CHECK_CFLAGS)\
+ $(POPT_CFLAGS) $(TALLOC_CFLAGS) $(TDB_CFLAGS) $(TEVENT_CFLAGS) $(LDB_CFLAGS) $(DBUS_CFLAGS) $(CHECK_CFLAGS)\
-DLIBDIR=\"$(libdir)\" -DSHLIBEXT=\"$(SHLIBEXT)\" -DSSSD_LIBEXEC_PATH=\"$(SSSD_LIBEXEC_PATH)\" -DSSSD_INTROSPECT_PATH=\"$(SSSD_INTROSPECT_PATH)\"\
-DUSE_MMAP=1 @CFLAGS@
diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c
index 743ce2778..0435191be 100644
--- a/server/confdb/confdb.c
+++ b/server/confdb/confdb.c
@@ -20,9 +20,6 @@
*/
#define _GNU_SOURCE
-#include "config.h"
-#include <string.h>
-#include <errno.h>
#include "ldb.h"
#include "ldb_errors.h"
#include "util/util.h"
@@ -566,7 +563,7 @@ done:
}
int confdb_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx **cdb_ctx,
char *confdb_location)
{
diff --git a/server/confdb/confdb.h b/server/confdb/confdb.h
index 57da19675..a1d808559 100644
--- a/server/confdb/confdb.h
+++ b/server/confdb/confdb.h
@@ -19,6 +19,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdbool.h>
+#include "talloc.h"
+#include "tevent.h"
+
#define CONFDB_FILE "config.ldb"
struct confdb_ctx;
@@ -49,7 +53,7 @@ int confdb_get_bool(struct confdb_ctx *cdb, TALLOC_CTX *ctx,
bool defval, bool *result);
int confdb_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx **cdb_ctx,
char *confdb_location);
diff --git a/server/configure.ac b/server/configure.ac
index a06dfdab9..8921c7871 100644
--- a/server/configure.ac
+++ b/server/configure.ac
@@ -48,7 +48,7 @@ m4_include(pkg.m4)
m4_include(libpopt.m4)
m4_include(libtalloc.m4)
m4_include(libtdb.m4)
-m4_include(libevents.m4)
+m4_include(libtevent.m4)
m4_include(libldb.m4)
m4_include(pam.m4)
m4_include(ldap.m4)
diff --git a/server/db/sysdb.c b/server/db/sysdb.c
index c4b040b63..ddd7fbe48 100644
--- a/server/db/sysdb.c
+++ b/server/db/sysdb.c
@@ -180,7 +180,7 @@ static int pwd_search(struct sysdb_search_ctx *sctx,
}
int sysdb_getpwnam(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
const char *name,
@@ -209,7 +209,7 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx,
}
int sysdb_getpwuid(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
uid_t uid,
@@ -239,7 +239,7 @@ int sysdb_getpwuid(TALLOC_CTX *mem_ctx,
}
int sysdb_enumpwent(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
bool legacy,
@@ -492,7 +492,7 @@ static int grp_search(struct sysdb_search_ctx *sctx,
}
int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
const char *name,
@@ -521,7 +521,7 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
}
int sysdb_getgrgid(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
gid_t gid,
@@ -551,7 +551,7 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx,
}
int sysdb_enumgrent(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
bool legacy,
@@ -691,7 +691,7 @@ static void sysdb_initgr_search(void *ptr, int status,
}
int sysdb_initgroups(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
const char *name,
@@ -893,7 +893,7 @@ done:
}
int sysdb_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx *cdb,
const char *alt_db_path,
struct sysdb_ctx **dbctx)
diff --git a/server/db/sysdb.h b/server/db/sysdb.h
index e0dd33496..c6cc4deb7 100644
--- a/server/db/sysdb.h
+++ b/server/db/sysdb.h
@@ -87,13 +87,13 @@ struct confdb_ctx;
typedef void (*sysdb_callback_t)(void *, int, struct ldb_result *);
int sysdb_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx *cdb,
const char *alt_db_path,
struct sysdb_ctx **dbctx);
int sysdb_getpwnam(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
const char *name,
@@ -101,7 +101,7 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx,
sysdb_callback_t fn, void *ptr);
int sysdb_getpwuid(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
uid_t uid,
@@ -109,14 +109,14 @@ int sysdb_getpwuid(TALLOC_CTX *mem_ctx,
sysdb_callback_t fn, void *ptr);
int sysdb_enumpwent(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
bool legacy,
sysdb_callback_t fn, void *ptr);
int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
const char *name,
@@ -124,7 +124,7 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
sysdb_callback_t fn, void *ptr);
int sysdb_getgrgid(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
gid_t gid,
@@ -132,14 +132,14 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx,
sysdb_callback_t fn, void *ptr);
int sysdb_enumgrent(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
bool legacy,
sysdb_callback_t fn, void *ptr);
int sysdb_initgroups(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct sysdb_ctx *ctx,
const char *domain,
const char *name,
diff --git a/server/external/libevents.m4 b/server/external/libevents.m4
deleted file mode 100644
index 2aabb06d5..000000000
--- a/server/external/libevents.m4
+++ /dev/null
@@ -1,7 +0,0 @@
-AC_SUBST(EVENTS_OBJ)
-AC_SUBST(EVENTS_CFLAGS)
-AC_SUBST(EVENTS_LIBS)
-
-AC_CHECK_HEADER(tevent.h,
- [AC_CHECK_LIB(tevent, event_context_init, [EVENTS_LIBS="-ltevent"]) ],
- [PKG_CHECK_MODULES(EVENTS, tevent)])
diff --git a/server/external/libtevent.m4 b/server/external/libtevent.m4
new file mode 100644
index 000000000..6a0e36af8
--- /dev/null
+++ b/server/external/libtevent.m4
@@ -0,0 +1,7 @@
+AC_SUBST(TEVENT_OBJ)
+AC_SUBST(TEVENT_CFLAGS)
+AC_SUBST(TEVENT_LIBS)
+
+AC_CHECK_HEADER(tevent.h,
+ [AC_CHECK_LIB(tevent, tevent_context_init, [TEVENT_LIBS="-ltevent"]) ],
+ [PKG_CHECK_MODULES(TEVENT, tevent)])
diff --git a/server/infopipe/infopipe.c b/server/infopipe/infopipe.c
index fbc031467..4b1eb9204 100644
--- a/server/infopipe/infopipe.c
+++ b/server/infopipe/infopipe.c
@@ -246,7 +246,7 @@ done:
}
static int infp_process_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx *cdb)
{
struct infp_ctx *infp_ctx;
diff --git a/server/infopipe/infopipe_private.h b/server/infopipe/infopipe_private.h
index 1ceb426f0..8ea2586bf 100644
--- a/server/infopipe/infopipe_private.h
+++ b/server/infopipe/infopipe_private.h
@@ -23,7 +23,7 @@
#define INFOPIPE_PRIVATE_H_
struct infp_ctx {
- struct event_context *ev;
+ struct tevent_context *ev;
struct confdb_ctx *cdb;
struct service_sbus_ctx *ss_ctx;
struct sysbus_ctx *sysbus;
diff --git a/server/infopipe/sysbus.c b/server/infopipe/sysbus.c
index 5c272e664..6ba1bb72d 100644
--- a/server/infopipe/sysbus.c
+++ b/server/infopipe/sysbus.c
@@ -88,7 +88,7 @@ done:
}
int sysbus_init(TALLOC_CTX *mem_ctx, struct sysbus_ctx **sysbus,
- struct event_context *ev, const char *dbus_name,
+ struct tevent_context *ev, const char *dbus_name,
const char *interface, const char *path,
struct sbus_method *methods,
sbus_msg_handler_fn introspect_method)
diff --git a/server/infopipe/sysbus.h b/server/infopipe/sysbus.h
index f591365eb..2bed23a4e 100644
--- a/server/infopipe/sysbus.h
+++ b/server/infopipe/sysbus.h
@@ -25,7 +25,7 @@
struct sysbus_ctx;
int sysbus_init(TALLOC_CTX *mem_ctx, struct sysbus_ctx **sysbus,
- struct event_context *ev, const char *dbus_name,
+ struct tevent_context *ev, const char *dbus_name,
const char *interface, const char *path,
struct sbus_method *methods,
sbus_msg_handler_fn introspect_method);
diff --git a/server/ldb_modules/ldb_module.h b/server/ldb_modules/ldb_module.h
deleted file mode 100644
index f41941da8..000000000
--- a/server/ldb_modules/ldb_module.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- ldb database library
-
- Copyright (C) Simo Sorce 2008
-
- ** NOTE! The following LGPL license applies to the ldb
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
- * Name: ldb
- *
- * Component: ldb module header
- *
- * Description: defines ldb modules structures and helpers
- *
- */
-
-#ifndef _LDB_MODULE_H_
-#define _LDB_MODULE_H_
-
-struct ldb_context;
-struct ldb_module;
-
-/*
- these function pointers define the operations that a ldb module can intercept
-*/
-struct ldb_module_ops {
- const char *name;
- int (*init_context) (struct ldb_module *);
- int (*search)(struct ldb_module *, struct ldb_request *); /* search */
- int (*add)(struct ldb_module *, struct ldb_request *); /* add */
- int (*modify)(struct ldb_module *, struct ldb_request *); /* modify */
- int (*del)(struct ldb_module *, struct ldb_request *); /* delete */
- int (*rename)(struct ldb_module *, struct ldb_request *); /* rename */
- int (*request)(struct ldb_module *, struct ldb_request *); /* match any other operation */
- int (*extended)(struct ldb_module *, struct ldb_request *); /* extended operations */
- int (*start_transaction)(struct ldb_module *);
- int (*end_transaction)(struct ldb_module *);
- int (*del_transaction)(struct ldb_module *);
- int (*sequence_number)(struct ldb_module *, struct ldb_request *);
- void *private_data;
-};
-
-
-/* MODULES specific headers -- SSS */
-
-/* The following definitions come from lib/ldb/common/ldb_modules.c */
-
-struct ldb_context *ldb_module_get_ctx(struct ldb_module *module);
-
-int ldb_next_request(struct ldb_module *module, struct ldb_request *request);
-int ldb_next_start_trans(struct ldb_module *module);
-int ldb_next_end_trans(struct ldb_module *module);
-int ldb_next_del_trans(struct ldb_module *module);
-int ldb_next_init(struct ldb_module *module);
-
-void ldb_set_errstring(struct ldb_context *ldb, const char *err_string);
-void ldb_asprintf_errstring(struct ldb_context *ldb, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
-void ldb_reset_err_string(struct ldb_context *ldb);
-
-const char *ldb_default_modules_dir(void);
-
-int ldb_register_module(const struct ldb_module_ops *);
-
-typedef int (*ldb_connect_fn)(struct ldb_context *ldb, const char *url,
- unsigned int flags, const char *options[],
- struct ldb_module **module);
-
-struct ldb_backend_ops {
- const char *name;
- ldb_connect_fn connect_fn;
-};
-
-const char *ldb_default_modules_dir(void);
-
-int ldb_register_backend(const char *url_prefix, ldb_connect_fn);
-
-void *ldb_dso_load_symbol(struct ldb_context *ldb, const char *name,
- const char *symbol);
-
-struct ldb_handle *ldb_handle_new(TALLOC_CTX *mem_ctx, struct ldb_context *ldb);
-
-int ldb_module_send_entry(struct ldb_request *req,
- struct ldb_message *msg);
-
-int ldb_module_send_referral(struct ldb_request *req,
- char *ref);
-
-int ldb_module_done(struct ldb_request *req,
- struct ldb_control **ctrls,
- struct ldb_extended *response,
- int error);
-
-int ldb_mod_register_control(struct ldb_module *module, const char *oid);
-
-#endif
diff --git a/server/ldb_modules/memberof.c b/server/ldb_modules/memberof.c
index 956245bd5..8b61549a9 100644
--- a/server/ldb_modules/memberof.c
+++ b/server/ldb_modules/memberof.c
@@ -17,11 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "replace.h"
-#include "talloc.h"
-#include "ldb.h"
-#include "ldb_errors.h"
-#include "ldb_modules/ldb_module.h"
+#include <string.h>
+#include "ldb_module.h"
#ifndef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c
index 759a6881c..ff88b293c 100644
--- a/server/monitor/monitor.c
+++ b/server/monitor/monitor.c
@@ -20,15 +20,13 @@
*/
#define _GNU_SOURCE
-#include <stdio.h>
-#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <time.h>
+#include "util/util.h"
#include "popt.h"
#include "tevent.h"
-#include "util/util.h"
#include "confdb/confdb.h"
#include "monitor/monitor.h"
#include "dbus/dbus.h"
@@ -63,7 +61,7 @@ struct mt_svc {
};
struct mt_ctx {
- struct event_context *ev;
+ struct tevent_context *ev;
struct confdb_ctx *cdb;
char **services;
struct mt_svc *svc_list;
@@ -199,8 +197,8 @@ static void svc_try_restart(struct mt_svc *svc, time_t now)
return;
}
-static void tasks_check_handler(struct event_context *ev,
- struct timed_event *te,
+static void tasks_check_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *ptr)
{
struct mt_svc *svc = talloc_get_type(ptr, struct mt_svc);
@@ -269,13 +267,13 @@ static void tasks_check_handler(struct event_context *ev,
static void set_tasks_checker(struct mt_svc *svc)
{
- struct timed_event *te = NULL;
+ struct tevent_timer *te = NULL;
struct timeval tv;
gettimeofday(&tv, NULL);
tv.tv_sec += svc->ping_time;
tv.tv_usec = 0;
- te = event_add_timed(svc->mt_ctx->ev, svc, tv, tasks_check_handler, svc);
+ te = tevent_add_timer(svc->mt_ctx->ev, svc, tv, tasks_check_handler, svc);
if (te == NULL) {
DEBUG(0, ("failed to add event, monitor offline for [%s]!\n",
svc->name));
@@ -283,8 +281,8 @@ static void set_tasks_checker(struct mt_svc *svc)
}
}
-static void global_checks_handler(struct event_context *ev,
- struct timed_event *te,
+static void global_checks_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *ptr)
{
struct mt_ctx *ctx = talloc_get_type(ptr, struct mt_ctx);
@@ -323,13 +321,13 @@ done:
static void set_global_checker(struct mt_ctx *ctx)
{
- struct timed_event *te = NULL;
+ struct tevent_timer *te = NULL;
struct timeval tv;
gettimeofday(&tv, NULL);
tv.tv_sec += 1; /* once a second */
tv.tv_usec = 0;
- te = event_add_timed(ctx->ev, ctx, tv, global_checks_handler, ctx);
+ te = tevent_add_timer(ctx->ev, ctx, tv, global_checks_handler, ctx);
if (te == NULL) {
DEBUG(0, ("failed to add global checker event! PANIC TIME!\n"));
/* FIXME: is this right ? shoulkd we try to clean up first ?*/
@@ -361,7 +359,7 @@ int get_monitor_config(struct mt_ctx *ctx)
}
int monitor_process_init(TALLOC_CTX *mem_ctx,
- struct event_context *event_ctx,
+ struct tevent_context *event_ctx,
struct confdb_ctx *cdb)
{
struct mt_ctx *ctx;
@@ -937,13 +935,13 @@ fail:
return NULL;
}
-static void service_startup_handler(struct event_context *ev,
- struct timed_event *te,
+static void service_startup_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *ptr);
static int start_service(struct mt_svc *svc)
{
- struct timed_event *te;
+ struct tevent_timer *te;
struct timeval tv;
DEBUG(4,("Queueing service %s for startup\n", svc->name));
@@ -955,7 +953,7 @@ static int start_service(struct mt_svc *svc)
* the monitor is serving it.
*/
gettimeofday(&tv, NULL);
- te = event_add_timed(svc->mt_ctx->ev, svc, tv,
+ te = tevent_add_timer(svc->mt_ctx->ev, svc, tv,
service_startup_handler, svc);
if (te == NULL) {
DEBUG(0, ("Unable to queue service %s for startup\n", svc->name));
@@ -964,8 +962,8 @@ static int start_service(struct mt_svc *svc)
return EOK;
}
-static void service_startup_handler(struct event_context *ev,
- struct timed_event *te,
+static void service_startup_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *ptr)
{
struct mt_svc *mt_svc;
diff --git a/server/monitor/monitor.h b/server/monitor/monitor.h
index 8899c51a4..77b6e781d 100644
--- a/server/monitor/monitor.h
+++ b/server/monitor/monitor.h
@@ -23,7 +23,7 @@
#define _MONITOR_H_
int monitor_process_init(TALLOC_CTX *mem_ctx,
- struct event_context *event_ctx,
+ struct tevent_context *event_ctx,
struct confdb_ctx *cdb);
#endif /* _MONITOR_H */
diff --git a/server/polkit/sssd_polkit.c b/server/polkit/sssd_polkit.c
index 03436472d..511a293c4 100644
--- a/server/polkit/sssd_polkit.c
+++ b/server/polkit/sssd_polkit.c
@@ -29,7 +29,7 @@
#include "monitor/monitor_interfaces.h"
struct spk_ctx {
- struct event_context *ev;
+ struct tevent_context *ev;
struct confdb_ctx *cdb;
struct service_sbus_ctx *ss_ctx;
struct sbus_srv_ctx *sbus_srv;
@@ -141,7 +141,7 @@ static int spk_monitor_init(struct spk_ctx *spk_ctx)
}
static int spk_process_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx *cdb)
{
struct spk_ctx *spk_ctx;
diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c
index a0e3b08d2..85a824e47 100644
--- a/server/providers/data_provider.c
+++ b/server/providers/data_provider.c
@@ -47,7 +47,7 @@ struct dp_backend;
struct dp_frontend;
struct dp_ctx {
- struct event_context *ev;
+ struct tevent_context *ev;
struct confdb_ctx *cdb;
struct service_sbus_ctx *ss_ctx;
struct sbus_srv_ctx *sbus_srv;
@@ -1081,7 +1081,7 @@ done:
}
static int dp_process_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx *cdb)
{
struct dp_ctx *dpctx;
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c
index 9ed3d2ce6..c9faff954 100644
--- a/server/providers/data_provider_be.c
+++ b/server/providers/data_provider_be.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <sys/time.h>
#include <errno.h>
+#include <dlfcn.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
@@ -168,8 +169,8 @@ struct be_async_req {
struct be_req *req;
};
-static void be_async_req_handler(struct event_context *ev,
- struct timed_event *te,
+static void be_async_req_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval tv, void *pvt)
{
struct be_async_req *async_req;
@@ -184,7 +185,7 @@ static int be_file_request(struct be_ctx *ctx,
struct be_req *req)
{
struct be_async_req *areq;
- struct timed_event *te;
+ struct tevent_timer *te;
struct timeval tv;
areq = talloc(req, struct be_async_req);
@@ -198,7 +199,7 @@ static int be_file_request(struct be_ctx *ctx,
tv.tv_sec = 0;
tv.tv_usec = 0;
- te = event_add_timed(ctx->ev, req, tv, be_async_req_handler, areq);
+ te = tevent_add_timer(ctx->ev, req, tv, be_async_req_handler, areq);
if (te == NULL) {
return EIO;
}
@@ -769,7 +770,7 @@ done:
int be_process_init(TALLOC_CTX *mem_ctx,
const char *be_name,
const char *be_domain,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx *cdb)
{
struct be_ctx *ctx;
diff --git a/server/providers/dp_backend.h b/server/providers/dp_backend.h
index cdd2c51b7..df09544fc 100644
--- a/server/providers/dp_backend.h
+++ b/server/providers/dp_backend.h
@@ -29,7 +29,7 @@
struct be_mod_ops;
struct be_ctx {
- struct event_context *ev;
+ struct tevent_context *ev;
struct confdb_ctx *cdb;
struct sysdb_ctx *sysdb;
struct service_sbus_ctx *ss_ctx;
diff --git a/server/providers/dp_sbus.c b/server/providers/dp_sbus.c
index f6fc12ffe..22be6c843 100644
--- a/server/providers/dp_sbus.c
+++ b/server/providers/dp_sbus.c
@@ -19,7 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "util/util.h"
+#include "config.h"
+#include "talloc.h"
+#include "tevent.h"
#include "confdb/confdb.h"
#include "sbus/sssd_dbus.h"
#include "providers/data_provider.h"
diff --git a/server/providers/ldap_be.c b/server/providers/ldap_be.c
index b13224c5b..e5c317306 100644
--- a/server/providers/ldap_be.c
+++ b/server/providers/ldap_be.c
@@ -68,16 +68,16 @@ struct ldap_req {
LDAP *ldap;
struct ldap_ops *ops;
char *user_dn;
- event_fd_handler_t next_task;
+ tevent_fd_handler_t next_task;
enum ldap_be_ops next_op;
int msgid;
};
static int schedule_next_task(struct ldap_req *lr, struct timeval tv,
- event_timed_handler_t task)
+ tevent_timer_handler_t task)
{
int ret;
- struct timed_event *te;
+ struct tevent_timer *te;
struct timeval timeout;
ret = gettimeofday(&timeout, NULL);
@@ -89,7 +89,7 @@ static int schedule_next_task(struct ldap_req *lr, struct timeval tv,
timeout.tv_usec += tv.tv_usec;
- te = event_add_timed(lr->req->be_ctx->ev, lr, timeout, task, lr);
+ te = tevent_add_timer(lr->req->be_ctx->ev, lr, timeout, task, lr);
if (te == NULL) {
return EIO;
}
@@ -101,7 +101,7 @@ static int wait_for_fd(struct ldap_req *lr)
{
int ret;
int fd;
- struct fd_event *fde;
+ struct tevent_fd *fde;
ret = ldap_get_option(lr->ldap, LDAP_OPT_DESC, &fd);
if (ret != LDAP_OPT_SUCCESS) {
@@ -109,7 +109,7 @@ static int wait_for_fd(struct ldap_req *lr)
return ret;
}
- fde = event_add_fd(lr->req->be_ctx->ev, lr, fd, EVENT_FD_READ, lr->next_task, lr);
+ fde = tevent_add_fd(lr->req->be_ctx->ev, lr, fd, TEVENT_FD_READ, lr->next_task, lr);
if (fde == NULL) {
return EIO;
}
@@ -257,8 +257,8 @@ static int ldap_be_bind(struct ldap_req *lr)
return LDAP_SUCCESS;
}
-static void ldap_be_loop(struct event_context *ev, struct fd_event *te,
- uint16_t fd, void *pvt)
+static void ldap_be_loop(struct tevent_context *ev, struct tevent_fd *te,
+ uint16_t fd, void *pvt)
{
int ret;
int pam_status=PAM_SUCCESS;
@@ -534,8 +534,8 @@ done:
req->fn(req, pam_status, NULL);
}
-static void ldap_start(struct event_context *ev, struct timed_event *te,
- struct timeval tv, void *pvt)
+static void ldap_start(struct tevent_context *ev, struct tevent_timer *te,
+ struct timeval tv, void *pvt)
{
int ret;
int pam_status;
diff --git a/server/providers/providers.h b/server/providers/providers.h
index 19eab827c..44e7028ab 100644
--- a/server/providers/providers.h
+++ b/server/providers/providers.h
@@ -20,5 +20,5 @@
*/
int dp_process_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx *cdb);
diff --git a/server/providers/proxy.c b/server/providers/proxy.c
index e072ec3c7..3c39c8f87 100644
--- a/server/providers/proxy.c
+++ b/server/providers/proxy.c
@@ -23,6 +23,7 @@
#include <errno.h>
#include <pwd.h>
#include <grp.h>
+#include <dlfcn.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
diff --git a/server/responder/common/responder_cmd.c b/server/responder/common/responder_cmd.c
index 83d55e651..f3fbf4794 100644
--- a/server/responder/common/responder_cmd.c
+++ b/server/responder/common/responder_cmd.c
@@ -28,7 +28,7 @@ void sss_cmd_done(struct sss_cmd_ctx *nctx)
{
/* now that the packet is in place, unlock queue
* making the event writable */
- EVENT_FD_WRITEABLE(nctx->cctx->cfde);
+ TEVENT_FD_WRITEABLE(nctx->cctx->cfde);
/* free all request related data through the talloc hierarchy */
talloc_free(nctx);
diff --git a/server/responder/common/responder_cmd.h b/server/responder/common/responder_cmd.h
index ee094ad3b..98a4b34e4 100644
--- a/server/responder/common/responder_cmd.h
+++ b/server/responder/common/responder_cmd.h
@@ -41,10 +41,10 @@ struct cli_request {
};
struct cli_ctx {
- struct event_context *ev;
+ struct tevent_context *ev;
struct nss_ctx *nctx;
int cfd;
- struct fd_event *cfde;
+ struct tevent_fd *cfde;
struct sockaddr_un addr;
struct cli_request *creq;
struct getent_ctx *gctx;
diff --git a/server/responder/common/responder_common.c b/server/responder/common/responder_common.c
index b5db7d1e2..74e03215c 100644
--- a/server/responder/common/responder_common.c
+++ b/server/responder/common/responder_common.c
@@ -65,7 +65,7 @@ static int client_destructor(struct cli_ctx *ctx)
return 0;
}
-static void client_send(struct event_context *ev, struct cli_ctx *cctx)
+static void client_send(struct tevent_context *ev, struct cli_ctx *cctx)
{
int ret;
@@ -81,14 +81,14 @@ static void client_send(struct event_context *ev, struct cli_ctx *cctx)
}
/* ok all sent */
- EVENT_FD_NOT_WRITEABLE(cctx->cfde);
- EVENT_FD_READABLE(cctx->cfde);
+ TEVENT_FD_NOT_WRITEABLE(cctx->cfde);
+ TEVENT_FD_READABLE(cctx->cfde);
talloc_free(cctx->creq);
cctx->creq = NULL;
return;
}
-static void client_recv(struct event_context *ev, struct cli_ctx *cctx)
+static void client_recv(struct tevent_context *ev, struct cli_ctx *cctx)
{
int ret;
@@ -115,7 +115,7 @@ static void client_recv(struct event_context *ev, struct cli_ctx *cctx)
switch (ret) {
case EOK:
/* do not read anymore */
- EVENT_FD_NOT_READABLE(cctx->cfde);
+ TEVENT_FD_NOT_READABLE(cctx->cfde);
/* execute command */
ret = sss_cmd_execute(cctx, cctx->nctx->sss_cmds);
if (ret != EOK) {
@@ -148,24 +148,24 @@ static void client_recv(struct event_context *ev, struct cli_ctx *cctx)
return;
}
-static void client_fd_handler(struct event_context *ev,
- struct fd_event *fde,
+static void client_fd_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
uint16_t flags, void *ptr)
{
struct cli_ctx *cctx = talloc_get_type(ptr, struct cli_ctx);
- if (flags & EVENT_FD_READ) {
+ if (flags & TEVENT_FD_READ) {
client_recv(ev, cctx);
return;
}
- if (flags & EVENT_FD_WRITE) {
+ if (flags & TEVENT_FD_WRITE) {
client_send(ev, cctx);
return;
}
}
-static void accept_fd_handler(struct event_context *ev,
- struct fd_event *fde,
+static void accept_fd_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
uint16_t flags, void *ptr)
{
/* accept and attach new event handler */
@@ -197,8 +197,8 @@ static void accept_fd_handler(struct event_context *ev,
return;
}
- cctx->cfde = event_add_fd(ev, cctx, cctx->cfd,
- EVENT_FD_READ, client_fd_handler, cctx);
+ cctx->cfde = tevent_add_fd(ev, cctx, cctx->cfd,
+ TEVENT_FD_READ, client_fd_handler, cctx);
if (!cctx->cfde) {
close(cctx->cfd);
talloc_free(cctx);
@@ -303,8 +303,8 @@ static int set_unix_socket(struct nss_ctx *nctx)
goto failed;
}
- nctx->lfde = event_add_fd(nctx->ev, nctx, nctx->lfd,
- EVENT_FD_READ, accept_fd_handler, nctx);
+ nctx->lfde = tevent_add_fd(nctx->ev, nctx, nctx->lfd,
+ TEVENT_FD_READ, accept_fd_handler, nctx);
/* we want default permissions on created files to be very strict,
so set our umask to 0177 */
@@ -422,7 +422,7 @@ done:
}
int sss_process_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx *cdb,
struct sbus_method sss_sbus_methods[],
struct sss_cmd_table sss_cmds[],
diff --git a/server/responder/common/responder_common.h b/server/responder/common/responder_common.h
index 433b242e2..381807052 100644
--- a/server/responder/common/responder_common.h
+++ b/server/responder/common/responder_common.h
@@ -1,16 +1,16 @@
+#include "config.h"
#include "sbus/sssd_dbus.h"
#include "responder/common/responder_cmd.h"
#include "util/btreemap.h"
/* SSS_DOMAIN_DELIM can be specified in config.h */
-#include "config.h"
#ifndef SSS_DOMAIN_DELIM
#define SSS_DOMAIN_DELIM '@'
#endif
int sss_process_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx *cdb,
struct sbus_method sss_sbus_methods[],
struct sss_cmd_table sss_cmds[],
diff --git a/server/responder/common/responder_dp.c b/server/responder/common/responder_dp.c
index a024674b3..a3dace451 100644
--- a/server/responder/common/responder_dp.c
+++ b/server/responder/common/responder_dp.c
@@ -17,14 +17,14 @@ struct sss_dp_pvt_ctx {
};
static int sss_dp_conn_destructor(void *data);
-static void sss_dp_reconnect(struct event_context *ev,
- struct timed_event *te,
+static void sss_dp_reconnect(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval tv, void *data);
static void sss_dp_conn_reconnect(struct sss_dp_pvt_ctx *pvt)
{
struct nss_ctx *nctx;
- struct timed_event *te;
+ struct tevent_timer *te;
struct timeval tv;
struct sbus_method_ctx *sm_ctx;
char *sbus_address;
@@ -66,7 +66,7 @@ static void sss_dp_conn_reconnect(struct sss_dp_pvt_ctx *pvt)
tv.tv_sec = now +5;
tv.tv_usec = 0;
- te = event_add_timed(nctx->ev, nctx, tv, sss_dp_reconnect, pvt);
+ te = tevent_add_timer(nctx->ev, nctx, tv, sss_dp_reconnect, pvt);
if (te == NULL) {
DEBUG(4, ("Failed to add timed event! Giving up\n"));
} else {
@@ -75,8 +75,8 @@ static void sss_dp_conn_reconnect(struct sss_dp_pvt_ctx *pvt)
}
}
-static void sss_dp_reconnect(struct event_context *ev,
- struct timed_event *te,
+static void sss_dp_reconnect(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval tv, void *data)
{
struct sss_dp_pvt_ctx *pvt;
diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c
index 93490c46d..0c5fd4ccb 100644
--- a/server/responder/nss/nsssrv.c
+++ b/server/responder/nss/nsssrv.c
@@ -78,7 +78,7 @@ static int client_destructor(struct cli_ctx *ctx)
return 0;
}
-static void client_send(struct event_context *ev, struct cli_ctx *cctx)
+static void client_send(struct tevent_context *ev, struct cli_ctx *cctx)
{
int ret;
@@ -94,14 +94,14 @@ static void client_send(struct event_context *ev, struct cli_ctx *cctx)
}
/* ok all sent */
- EVENT_FD_NOT_WRITEABLE(cctx->cfde);
- EVENT_FD_READABLE(cctx->cfde);
+ TEVENT_FD_NOT_WRITEABLE(cctx->cfde);
+ TEVENT_FD_READABLE(cctx->cfde);
talloc_free(cctx->creq);
cctx->creq = NULL;
return;
}
-static void client_recv(struct event_context *ev, struct cli_ctx *cctx)
+static void client_recv(struct tevent_context *ev, struct cli_ctx *cctx)
{
int ret;
@@ -128,7 +128,7 @@ static void client_recv(struct event_context *ev, struct cli_ctx *cctx)
switch (ret) {
case EOK:
/* do not read anymore */
- EVENT_FD_NOT_READABLE(cctx->cfde);
+ TEVENT_FD_NOT_READABLE(cctx->cfde);
/* execute command */
ret = nss_cmd_execute(cctx);
if (ret != EOK) {
@@ -161,24 +161,24 @@ static void client_recv(struct event_context *ev, struct cli_ctx *cctx)
return;
}
-static void client_fd_handler(struct event_context *ev,
- struct fd_event *fde,
+static void client_fd_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
uint16_t flags, void *ptr)
{
struct cli_ctx *cctx = talloc_get_type(ptr, struct cli_ctx);
- if (flags & EVENT_FD_READ) {
+ if (flags & TEVENT_FD_READ) {
client_recv(ev, cctx);
return;
}
- if (flags & EVENT_FD_WRITE) {
+ if (flags & TEVENT_FD_WRITE) {
client_send(ev, cctx);
return;
}
}
-static void accept_fd_handler(struct event_context *ev,
- struct fd_event *fde,
+static void accept_fd_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
uint16_t flags, void *ptr)
{
/* accept and attach new event handler */
@@ -210,8 +210,8 @@ static void accept_fd_handler(struct event_context *ev,
return;
}
- cctx->cfde = event_add_fd(ev, cctx, cctx->cfd,
- EVENT_FD_READ, client_fd_handler, cctx);
+ cctx->cfde = tevent_add_fd(ev, cctx, cctx->cfd,
+ TEVENT_FD_READ, client_fd_handler, cctx);
if (!cctx->cfde) {
close(cctx->cfd);
talloc_free(cctx);
@@ -376,8 +376,8 @@ static int set_unix_socket(struct nss_ctx *nctx)
goto failed;
}
- nctx->lfde = event_add_fd(nctx->ev, nctx, nctx->lfd,
- EVENT_FD_READ, accept_fd_handler, nctx);
+ nctx->lfde = tevent_add_fd(nctx->ev, nctx, nctx->lfd,
+ TEVENT_FD_READ, accept_fd_handler, nctx);
/* we want default permissions on created files to be very strict,
so set our umask to 0177 */
@@ -495,7 +495,7 @@ done:
}
int nss_process_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
struct confdb_ctx *cdb)
{
struct nss_ctx *nctx;
diff --git a/server/responder/nss/nsssrv.h b/server/responder/nss/nsssrv.h
index 03dc35af2..333e42815 100644
--- a/server/responder/nss/nsssrv.h
+++ b/server/responder/nss/nsssrv.h
@@ -24,6 +24,7 @@
#include <stdint.h>
#include <sys/un.h>
+#include "config.h"
#include "talloc.h"
#include "tevent.h"
#include "ldb.h"
@@ -38,7 +39,6 @@
#define NSS_PACKET_MAX_RECV_SIZE 1024
/* NSS_DOMAIN_DELIM can be specified in config.h */
-#include "config.h"
#ifndef NSS_DOMAIN_DELIM
#define NSS_DOMAIN_DELIM '@'
#endif
@@ -51,8 +51,8 @@ struct sysdb_ctx;
struct getent_ctx;
struct nss_ctx {
- struct event_context *ev;
- struct fd_event *lfde;
+ struct tevent_context *ev;
+ struct tevent_fd *lfde;
int lfd;
struct sysdb_ctx *sysdb;
struct confdb_ctx *cdb;
@@ -72,10 +72,10 @@ struct nss_ctx {
};
struct cli_ctx {
- struct event_context *ev;
+ struct tevent_context *ev;
struct nss_ctx *nctx;
int cfd;
- struct fd_event *cfde;
+ struct tevent_fd *cfde;
struct sockaddr_un addr;
struct cli_request *creq;
struct getent_ctx *gctx;
diff --git a/server/responder/nss/nsssrv_cmd.c b/server/responder/nss/nsssrv_cmd.c
index 338de0ead..c61eb4f2d 100644
--- a/server/responder/nss/nsssrv_cmd.c
+++ b/server/responder/nss/nsssrv_cmd.c
@@ -59,7 +59,7 @@ static void nss_cmd_done(struct nss_cmd_ctx *cmdctx)
{
/* now that the packet is in place, unlock queue
* making the event writable */
- EVENT_FD_WRITEABLE(cmdctx->cctx->cfde);
+ TEVENT_FD_WRITEABLE(cmdctx->cctx->cfde);
/* free all request related data through the talloc hierarchy */
talloc_free(cmdctx);
diff --git a/server/responder/nss/nsssrv_dp.c b/server/responder/nss/nsssrv_dp.c
index 46e218014..d4406e403 100644
--- a/server/responder/nss/nsssrv_dp.c
+++ b/server/responder/nss/nsssrv_dp.c
@@ -31,7 +31,7 @@
struct nss_dp_req {
nss_dp_callback_t callback;
void *callback_ctx;
- struct timed_event *te;
+ struct tevent_timer *te;
DBusPendingCall *pending_reply;
};
@@ -46,8 +46,8 @@ static int nss_dp_req_destructor(void *ptr)
return 0;
}
-static void nss_dp_send_acct_timeout(struct event_context *ev,
- struct timed_event *te,
+static void nss_dp_send_acct_timeout(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *data)
{
struct nss_dp_req *ndp_req;
@@ -198,7 +198,7 @@ int nss_dp_send_acct_req(struct nss_ctx *nctx, TALLOC_CTX *memctx,
gettimeofday(&tv, NULL);
tv.tv_sec += timeout/1000;
tv.tv_usec += (timeout%1000) * 1000;
- ndp_req->te = event_add_timed(nctx->ev, memctx, tv,
+ ndp_req->te = tevent_add_timer(nctx->ev, memctx, tv,
nss_dp_send_acct_timeout, ndp_req);
/* Set up the reply handler */
@@ -327,14 +327,14 @@ struct nss_dp_pvt_ctx {
};
static int nss_dp_conn_destructor(void *data);
-static void nss_dp_reconnect(struct event_context *ev,
- struct timed_event *te,
+static void nss_dp_reconnect(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval tv, void *data);
static void nss_dp_conn_reconnect(struct nss_dp_pvt_ctx *pvt)
{
struct nss_ctx *nctx;
- struct timed_event *te;
+ struct tevent_timer *te;
struct timeval tv;
struct sbus_method_ctx *sm_ctx;
char *sbus_address;
@@ -376,7 +376,7 @@ static void nss_dp_conn_reconnect(struct nss_dp_pvt_ctx *pvt)
tv.tv_sec = now +5;
tv.tv_usec = 0;
- te = event_add_timed(nctx->ev, nctx, tv, nss_dp_reconnect, pvt);
+ te = tevent_add_timer(nctx->ev, nctx, tv, nss_dp_reconnect, pvt);
if (te == NULL) {
DEBUG(4, ("Failed to add timed event! Giving up\n"));
} else {
@@ -385,8 +385,8 @@ static void nss_dp_conn_reconnect(struct nss_dp_pvt_ctx *pvt)
}
}
-static void nss_dp_reconnect(struct event_context *ev,
- struct timed_event *te,
+static void nss_dp_reconnect(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval tv, void *data)
{
struct nss_dp_pvt_ctx *pvt;
diff --git a/server/sbus/sbus_client.c b/server/sbus/sbus_client.c
index 9b05b22a7..25c56d853 100644
--- a/server/sbus/sbus_client.c
+++ b/server/sbus/sbus_client.c
@@ -24,7 +24,7 @@
#include "sbus_client.h"
int sbus_client_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
const char *server_address,
struct sbus_method_ctx *sm_ctx,
void *conn_pvt_data,
diff --git a/server/sbus/sbus_client.h b/server/sbus/sbus_client.h
index ec61cb0f1..12c70401d 100644
--- a/server/sbus/sbus_client.h
+++ b/server/sbus/sbus_client.h
@@ -26,13 +26,13 @@
#include "sbus/sssd_dbus.h"
struct service_sbus_ctx {
- struct event_context *ev;
+ struct tevent_context *ev;
struct sbus_conn_ctx *scon_ctx;
struct sbus_method_ctx *sm_ctx;
};
int sbus_client_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
const char *server_address,
struct sbus_method_ctx *sm_ctx,
void *conn_pvt_data,
diff --git a/server/sbus/sssd_dbus.h b/server/sbus/sssd_dbus.h
index a05d229a1..43519b3e1 100644
--- a/server/sbus/sssd_dbus.h
+++ b/server/sbus/sssd_dbus.h
@@ -68,7 +68,7 @@ struct sbus_method_ctx {
/* Server Functions */
int sbus_new_server(TALLOC_CTX *mem_ctx,
- struct event_context *ev, struct sbus_method_ctx *ctx,
+ struct tevent_context *ev, struct sbus_method_ctx *ctx,
struct sbus_srv_ctx **server_ctx, const char *address,
sbus_server_conn_init_fn init_fn, void *init_pvt_data);
@@ -81,7 +81,7 @@ int sbus_new_server(TALLOC_CTX *mem_ctx,
* call sbus_add_connection to integrate with the main
* loop.
*/
-int sbus_new_connection(TALLOC_CTX *ctx, struct event_context *ev,
+int sbus_new_connection(TALLOC_CTX *ctx, struct tevent_context *ev,
const char *address,
struct sbus_conn_ctx **conn_ctx,
sbus_conn_destructor_fn destructor);
@@ -99,7 +99,7 @@ int sbus_new_connection(TALLOC_CTX *ctx, struct event_context *ev,
* dbus_bus_get
*/
int sbus_add_connection(TALLOC_CTX *ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
DBusConnection *dbus_conn,
struct sbus_conn_ctx **dct_ctx,
int connection_type);
diff --git a/server/sbus/sssd_dbus_common.c b/server/sbus/sssd_dbus_common.c
index 465e920f2..a9e0d816f 100644
--- a/server/sbus/sssd_dbus_common.c
+++ b/server/sbus/sssd_dbus_common.c
@@ -20,10 +20,10 @@ struct timeval _dbus_timeout_get_interval_tv(int interval) {
* from the libevents mainloop
*/
void sbus_remove_watch(DBusWatch *watch, void *data) {
- struct fd_event *fde;
+ struct tevent_fd *fde;
DEBUG(5, ("%lX\n", watch));
- fde = talloc_get_type(dbus_watch_get_data(watch), struct fd_event);
+ fde = talloc_get_type(dbus_watch_get_data(watch), struct tevent_fd);
/* Freeing the event object will remove it from the event loop */
talloc_free(fde);
@@ -36,8 +36,8 @@ void sbus_remove_watch(DBusWatch *watch, void *data) {
* Hook for D-BUS to remove time-based events from the mainloop
*/
void sbus_remove_timeout(DBusTimeout *timeout, void *data) {
- struct timed_event *te;
- te = talloc_get_type(dbus_timeout_get_data(timeout), struct timed_event);
+ struct tevent_timer *te;
+ te = talloc_get_type(dbus_timeout_get_data(timeout), struct tevent_timer);
/* Freeing the event object will remove it from the event loop */
talloc_free(te);
diff --git a/server/sbus/sssd_dbus_connection.c b/server/sbus/sssd_dbus_connection.c
index 9b3da9cc1..51a1f75c6 100644
--- a/server/sbus/sssd_dbus_connection.c
+++ b/server/sbus/sssd_dbus_connection.c
@@ -1,5 +1,4 @@
#include <sys/time.h>
-#include "tevent.h"
#include "util/util.h"
#include "dbus/dbus.h"
#include "sbus/sssd_dbus.h"
@@ -10,7 +9,7 @@ struct dbus_ctx_list;
struct sbus_conn_ctx {
DBusConnection *conn;
- struct event_context *ev;
+ struct tevent_context *ev;
int connection_type;
int disconnect;
struct sbus_method_ctx *method_ctx_list;
@@ -26,13 +25,13 @@ struct sbus_message_handler_ctx {
struct sbus_conn_watch_ctx {
DBusWatch *watch;
int fd;
- struct fd_event *fde;
+ struct tevent_fd *fde;
struct sbus_conn_ctx *top;
};
struct sbus_conn_timeout_ctx {
DBusTimeout *timeout;
- struct timed_event *te;
+ struct tevent_timer *te;
struct sbus_conn_ctx *top;
};
@@ -40,11 +39,11 @@ static int _method_list_contains_path(struct sbus_method_ctx *list,
struct sbus_method_ctx *method);
static void sbus_unreg_object_paths(struct sbus_conn_ctx *dct_ctx);
-static void sbus_dispatch(struct event_context *ev,
- struct timed_event *te,
+static void sbus_dispatch(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval tv, void *data)
{
- struct timed_event *new_event;
+ struct tevent_timer *new_event;
struct sbus_conn_ctx *dct_ctx;
DBusConnection *conn;
int ret;
@@ -81,7 +80,7 @@ static void sbus_dispatch(struct event_context *ev,
*/
ret = dbus_connection_get_dispatch_status(conn);
if (ret != DBUS_DISPATCH_COMPLETE) {
- new_event = event_add_timed(ev, dct_ctx, tv, sbus_dispatch, dct_ctx);
+ new_event = tevent_add_timer(ev, dct_ctx, tv, sbus_dispatch, dct_ctx);
if (new_event == NULL) {
DEBUG(2,("Could not add dispatch event!\n"));
@@ -95,19 +94,19 @@ static void sbus_dispatch(struct event_context *ev,
* dbus_connection_read_write_handler
* Callback for D-BUS to handle messages on a file-descriptor
*/
-static void sbus_conn_read_write_handler(struct event_context *ev,
- struct fd_event *fde,
- uint16_t flags, void *data)
+static void sbus_conn_read_write_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ uint16_t flags, void *data)
{
struct sbus_conn_watch_ctx *conn_w_ctx;
conn_w_ctx = talloc_get_type(data, struct sbus_conn_watch_ctx);
DEBUG(6,("Connection is open for read/write.\n"));
dbus_connection_ref(conn_w_ctx->top->conn);
- if (flags & EVENT_FD_READ) {
+ if (flags & TEVENT_FD_READ) {
dbus_watch_handle(conn_w_ctx->watch, DBUS_WATCH_READABLE);
}
- if (flags & EVENT_FD_WRITE) {
+ if (flags & TEVENT_FD_WRITE) {
dbus_watch_handle(conn_w_ctx->watch, DBUS_WATCH_WRITABLE);
}
dbus_connection_unref(conn_w_ctx->top->conn);
@@ -141,20 +140,20 @@ static dbus_bool_t sbus_add_conn_watch(DBusWatch *watch, void *data)
event_flags = 0;
if (flags & DBUS_WATCH_READABLE)
- event_flags |= EVENT_FD_READ;
+ event_flags |= TEVENT_FD_READ;
if (flags & DBUS_WATCH_WRITABLE)
- event_flags |= EVENT_FD_WRITE;
+ event_flags |= TEVENT_FD_WRITE;
if (event_flags == 0)
return FALSE;
DEBUG(5,("%lX: %d, %d=%s\n",
watch, conn_w_ctx->fd, event_flags,
- event_flags==EVENT_FD_READ?"READ":"WRITE"));
+ event_flags==TEVENT_FD_READ?"READ":"WRITE"));
/* Add the file descriptor to the event loop */
- conn_w_ctx->fde = event_add_fd(conn_w_ctx->top->ev, conn_w_ctx,
+ conn_w_ctx->fde = tevent_add_fd(conn_w_ctx->top->ev, conn_w_ctx,
conn_w_ctx->fd, event_flags,
sbus_conn_read_write_handler,
conn_w_ctx);
@@ -183,8 +182,8 @@ static void sbus_toggle_conn_watch(DBusWatch *watch, void *data)
* dbus_connection_timeout_handler
* Callback for D-BUS to handle timed events
*/
-static void sbus_conn_timeout_handler(struct event_context *ev,
- struct timed_event *te,
+static void sbus_conn_timeout_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
struct timeval t, void *data)
{
struct sbus_conn_timeout_ctx *conn_t_ctx;
@@ -218,7 +217,7 @@ static dbus_bool_t sbus_add_conn_timeout(DBusTimeout *timeout, void *data)
struct timeval rightnow;
gettimeofday(&rightnow, NULL);
- conn_t_ctx->te = event_add_timed(conn_t_ctx->top->ev, conn_t_ctx, tv,
+ conn_t_ctx->te = tevent_add_timer(conn_t_ctx->top->ev, conn_t_ctx, tv,
sbus_conn_timeout_handler, conn_t_ctx);
/* Save the event to the watch object so it can be removed later */
@@ -252,13 +251,13 @@ static void sbus_conn_wakeup_main(void *data)
{
struct sbus_conn_ctx *dct_ctx;
struct timeval tv;
- struct timed_event *te;
+ struct tevent_timer *te;
dct_ctx = talloc_get_type(data, struct sbus_conn_ctx);
gettimeofday(&tv, NULL);
/* D-BUS calls this function when it is time to do a dispatch */
- te = event_add_timed(dct_ctx->ev, dct_ctx,
+ te = tevent_add_timer(dct_ctx->ev, dct_ctx,
tv, sbus_dispatch, dct_ctx);
if (te == NULL) {
DEBUG(2,("Could not add dispatch event!\n"));
@@ -273,7 +272,7 @@ static void sbus_conn_wakeup_main(void *data)
* for handling file descriptor and timed events
*/
int sbus_add_connection(TALLOC_CTX *ctx,
- struct event_context *ev,
+ struct tevent_context *ev,
DBusConnection *dbus_conn,
struct sbus_conn_ctx **dct_ctx,
int connection_type)
@@ -343,7 +342,7 @@ int sbus_add_connection(TALLOC_CTX *ctx,
/*int sbus_new_connection(struct sbus_method_ctx *ctx, const char *address,
DBusConnection **connection,
sbus_conn_destructor_fn destructor)*/
-int sbus_new_connection(TALLOC_CTX *ctx, struct event_context *ev,
+int sbus_new_connection(TALLOC_CTX *ctx, struct tevent_context *ev,
const char *address,
struct sbus_conn_ctx **dct_ctx,
sbus_conn_destructor_fn destructor)
diff --git a/server/sbus/sssd_dbus_server.c b/server/sbus/sssd_dbus_server.c
index eae1ce67c..e30f9abfb 100644
--- a/server/sbus/sssd_dbus_server.c
+++ b/server/sbus/sssd_dbus_server.c
@@ -37,7 +37,7 @@ struct sbus_srv_ctx {
* There should only be one global object path (for
* simplicity's sake)
*/
- struct event_context *ev;
+ struct tevent_context *ev;
struct sbus_method_ctx *sd_ctx;
sbus_server_conn_init_fn init_fn;
void *init_pvt_data;
@@ -46,13 +46,13 @@ struct sbus_srv_ctx {
struct sbus_srv_watch_ctx {
DBusWatch *watch;
int fd;
- struct fd_event *fde;
+ struct tevent_fd *fde;
struct sbus_srv_ctx *top;
};
struct dbus_srv_timeout_ctx {
DBusTimeout *timeout;
- struct timed_event *te;
+ struct tevent_timer *te;
struct sbus_srv_ctx *top;
};
@@ -62,18 +62,18 @@ static int sbus_server_destructor(void *ctx);
* dbus_server_read_write_handler
* Callback for D-BUS to handle messages on a file-descriptor
*/
-static void sbus_srv_read_write_handler(struct event_context *ev,
- struct fd_event *fde,
- uint16_t flags, void *data)
+static void sbus_srv_read_write_handler(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ uint16_t flags, void *data)
{
struct sbus_srv_watch_ctx *svw_ctx;
svw_ctx = talloc_get_type(data, struct sbus_srv_watch_ctx);
dbus_server_ref(svw_ctx->top->server);
- if (flags & EVENT_FD_READ) {
+ if (flags & TEVENT_FD_READ) {
dbus_watch_handle(svw_ctx->watch, DBUS_WATCH_READABLE);
}
- if (flags & EVENT_FD_WRITE) {
+ if (flags & TEVENT_FD_WRITE) {
dbus_watch_handle(svw_ctx->watch, DBUS_WATCH_WRITABLE);
}
dbus_server_unref(svw_ctx->top->server);
@@ -107,15 +107,15 @@ static dbus_bool_t sbus_add_srv_watch(DBusWatch *watch, void *data)
event_flags = 0;
if (flags & DBUS_WATCH_READABLE) {
- event_flags |= EVENT_FD_READ;
+ event_flags |= TEVENT_FD_READ;
}
if (flags & DBUS_WATCH_WRITABLE) {
- event_flags |= EVENT_FD_WRITE;
+ event_flags |= TEVENT_FD_WRITE;
}
- DEBUG(5,("%lX: %d, %d=%s\n", watch, svw_ctx->fd, event_flags, event_flags==EVENT_FD_READ?"READ":"WRITE"));
+ DEBUG(5,("%lX: %d, %d=%s\n", watch, svw_ctx->fd, event_flags, event_flags==TEVENT_FD_READ?"READ":"WRITE"));
- svw_ctx->fde = event_add_fd(dt_ctx->ev, svw_ctx, svw_ctx->fd,
+ svw_ctx->fde = tevent_add_fd(dt_ctx->ev, svw_ctx, svw_ctx->fd,
event_flags, sbus_srv_read_write_handler,
svw_ctx);
@@ -139,9 +139,9 @@ static void sbus_toggle_srv_watch(DBusWatch *watch, void *data)
}
}
-static void sbus_srv_timeout_handler(struct event_context *ev,
- struct timed_event *te,
- struct timeval t, void *data)
+static void sbus_srv_timeout_handler(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *data)
{
struct dbus_srv_timeout_ctx *svt_ctx;
svt_ctx = talloc_get_type(data, struct dbus_srv_timeout_ctx);
@@ -169,7 +169,7 @@ static dbus_bool_t sbus_add_srv_timeout(DBusTimeout *timeout, void *data)
tv = _dbus_timeout_get_interval_tv(dbus_timeout_get_interval(timeout));
- svt_ctx->te = event_add_timed(dt_ctx->ev, svt_ctx, tv,
+ svt_ctx->te = tevent_add_timer(dt_ctx->ev, svt_ctx, tv,
sbus_srv_timeout_handler, svt_ctx);
/* Save the event to the watch object so it can be removed later */
@@ -254,7 +254,7 @@ static void sbus_server_init_new_connection(DBusServer *server,
* for handling file descriptor and timed events
*/
int sbus_new_server(TALLOC_CTX *mem_ctx,
- struct event_context *ev, struct sbus_method_ctx *ctx,
+ struct tevent_context *ev, struct sbus_method_ctx *ctx,
struct sbus_srv_ctx **server_ctx, const char *address,
sbus_server_conn_init_fn init_fn, void *init_pvt_data)
{
diff --git a/server/tests/sysdb-tests.c b/server/tests/sysdb-tests.c
index f809f5542..cd3579859 100644
--- a/server/tests/sysdb-tests.c
+++ b/server/tests/sysdb-tests.c
@@ -33,7 +33,7 @@
struct sysdb_test_ctx {
struct sysdb_ctx *sysdb;
struct confdb_ctx *confdb;
- struct event_context *ev;
+ struct tevent_context *ev;
};
static int setup_sysdb_tests(struct sysdb_test_ctx **ctx)
@@ -51,7 +51,7 @@ static int setup_sysdb_tests(struct sysdb_test_ctx **ctx)
/* Create an event context
* It will not be used except in confdb_init and sysdb_init
*/
- test_ctx->ev = event_context_init(test_ctx);
+ test_ctx->ev = tevent_context_init(test_ctx);
if (test_ctx->ev == NULL) {
fail("Could not create event context");
talloc_free(test_ctx);
diff --git a/server/util/btreemap.c b/server/util/btreemap.c
index 9eed2eb1f..c9289f521 100644
--- a/server/util/btreemap.c
+++ b/server/util/btreemap.c
@@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <errno.h>
#include "talloc.h"
#include "util/btreemap.h"
#include "util/util.h"
diff --git a/server/util/memory.c b/server/util/memory.c
index a25aa7872..87fefd2f2 100644
--- a/server/util/memory.c
+++ b/server/util/memory.c
@@ -1,4 +1,3 @@
-#include "replace.h"
#include "talloc.h"
/*
diff --git a/server/util/server.c b/server/util/server.c
index 35e72fa04..86854cb72 100644
--- a/server/util/server.c
+++ b/server/util/server.c
@@ -24,16 +24,12 @@
*/
#define _GNU_SOURCE
-#include <stdio.h>
-#include <stdbool.h>
-#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include "tevent.h"
+#include "util/util.h"
#include "ldb.h"
#include "confdb/confdb.h"
-#include "util/util.h"
/*******************************************************************
Close the low 3 fd's and open dev/null in their place.
@@ -215,8 +211,9 @@ static void setup_signals(void)
/*
handle io on stdin
*/
-static void server_stdin_handler(struct event_context *event_ctx, struct fd_event *fde,
- uint16_t flags, void *private)
+static void server_stdin_handler(struct tevent_context *event_ctx,
+ struct tevent_fd *fde,
+ uint16_t flags, void *private)
{
const char *binary_name = (const char *)private;
uint8_t c;
@@ -237,7 +234,7 @@ static void server_stdin_handler(struct event_context *event_ctx, struct fd_even
int server_setup(const char *name, int flags,
struct main_context **main_ctx)
{
- struct event_context *event_ctx;
+ struct tevent_context *event_ctx;
struct main_context *ctx;
uint16_t stdin_event_flags;
char *conf_db;
@@ -271,7 +268,7 @@ int server_setup(const char *name, int flags,
/* the event context is the top level structure.
* Everything else should hang off that */
- event_ctx = event_context_init(talloc_autofree_context());
+ event_ctx = tevent_context_init(talloc_autofree_context());
if (event_ctx == NULL) {
DEBUG(0,("The event context initialiaziton failed\n"));
return 1;
@@ -300,7 +297,7 @@ int server_setup(const char *name, int flags,
if (flags & FLAGS_INTERACTIVE) {
/* terminate when stdin goes away */
- stdin_event_flags = EVENT_FD_READ;
+ stdin_event_flags = TEVENT_FD_READ;
} else {
/* stay alive forever */
stdin_event_flags = 0;
@@ -310,7 +307,7 @@ int server_setup(const char *name, int flags,
#ifdef SIGTTIN
signal(SIGTTIN, SIG_IGN);
#endif
- event_add_fd(event_ctx, event_ctx, 0, stdin_event_flags,
+ tevent_add_fd(event_ctx, event_ctx, 0, stdin_event_flags,
server_stdin_handler, discard_const(name));
*main_ctx = ctx;
@@ -321,7 +318,7 @@ void server_loop(struct main_context *main_ctx)
{
/* wait for events - this is where the server sits for most of its
life */
- event_loop_wait(main_ctx->event_ctx);
+ tevent_loop_wait(main_ctx->event_ctx);
/* as everything hangs off this event context, freeing it
should initiate a clean shutdown of all services */
diff --git a/server/util/signal.c b/server/util/signal.c
index 5d036a370..e4a782da9 100644
--- a/server/util/signal.c
+++ b/server/util/signal.c
@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
#include "util/util.h"
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/server/util/util.h b/server/util/util.h
index 7388febd6..c784bf58a 100644
--- a/server/util/util.h
+++ b/server/util/util.h
@@ -2,9 +2,15 @@
#define __SSSD_UTIL_H__
#include <stdio.h>
+#include <stdint.h>
#include <stdbool.h>
-#include "replace.h"
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <limits.h>
+#include "config.h"
#include "talloc.h"
+#include "tevent.h"
extern const char *debug_prg_name;
extern int debug_level;
@@ -42,7 +48,7 @@ void debug_fn(const char *format, ...);
#define FLAGS_PID_FILE 0x0004
struct main_context {
- struct event_context *event_ctx;
+ struct tevent_context *event_ctx;
struct confdb_ctx *confdb_ctx;
};