-/* $OpenBSD: smtpd.h,v 1.609 2018/12/27 08:57:03 eric Exp $ */
+/* $OpenBSD: smtpd.h,v 1.610 2018/12/27 09:30:29 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
int (*open)(struct table *);
int (*update)(struct table *);
void (*close)(struct table *);
- int (*lookup)(void *, enum table_service, const char *, char **);
- int (*fetch)(void *, enum table_service, char **);
+ int (*lookup)(struct table *, enum table_service, const char *, char **);
+ int (*fetch)(struct table *, enum table_service, char **);
};
-/* $OpenBSD: table.c,v 1.40 2018/12/27 08:57:03 eric Exp $ */
+/* $OpenBSD: table.c,v 1.41 2018/12/27 09:30:29 eric Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
return -1;
}
- r = table->t_backend->lookup(table->t_handle, kind, lkey, lk ? &buf : NULL);
+ r = table->t_backend->lookup(table, kind, lkey, lk ? &buf : NULL);
if (r == 1) {
log_trace(TRACE_LOOKUP, "lookup: %s \"%s\" as %s in table %s:%s -> %s%s%s",
if (table->t_backend->fetch == NULL)
return (-1);
- r = table->t_backend->fetch(table->t_handle, kind, lk ? &buf : NULL);
+ r = table->t_backend->fetch(table, kind, lk ? &buf : NULL);
if (r == 1) {
log_trace(TRACE_LOOKUP, "lookup: fetch %s from table %s:%s -> %s%s%s",
-/* $OpenBSD: table_db.c,v 1.16 2018/12/27 08:57:03 eric Exp $ */
+/* $OpenBSD: table_db.c,v 1.17 2018/12/27 09:30:29 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
static int table_db_update(struct table *);
static int table_db_open(struct table *);
static void *table_db_open2(struct table *);
-static int table_db_lookup(void *, enum table_service, const char *, char **);
-static int table_db_fetch(void *, enum table_service, char **);
+static int table_db_lookup(struct table *, enum table_service, const char *, char **);
+static int table_db_fetch(struct table *, enum table_service, char **);
static void table_db_close(struct table *);
static void table_db_close2(void *);
DB *db;
char pathname[PATH_MAX];
time_t mtime;
- struct table *table;
};
static int
handle->db = dbopen(table->t_config, O_RDONLY, 0600, DB_HASH, NULL);
if (handle->db == NULL)
goto error;
- handle->table = table;
return handle;
}
static int
-table_db_lookup(void *hdl, enum table_service service, const char *key,
+table_db_lookup(struct table *table, enum table_service service, const char *key,
char **dst)
{
- struct dbhandle *handle = hdl;
- struct table *table = NULL;
+ struct dbhandle *handle = table->t_handle;
char *line;
size_t len = 0;
int ret;
/* DB has changed, close and reopen */
if (sb.st_mtime != handle->mtime) {
- table = handle->table;
- table_db_update(handle->table);
+ table_db_update(table);
handle = table->t_handle;
}
}
static int
-table_db_fetch(void *hdl, enum table_service service, char **dst)
+table_db_fetch(struct table *table, enum table_service service, char **dst)
{
- struct dbhandle *handle = hdl;
- struct table *table = handle->table;
+ struct dbhandle *handle = table->t_handle;
DBT dbk;
DBT dbd;
int r;
-/* $OpenBSD: table_getpwnam.c,v 1.10 2018/12/27 08:57:03 eric Exp $ */
+/* $OpenBSD: table_getpwnam.c,v 1.11 2018/12/27 09:30:29 eric Exp $ */
/*
* Copyright (c) 2012 Gilles Chehade <gilles@poolp.org>
static int table_getpwnam_config(struct table *);
static int table_getpwnam_update(struct table *);
static int table_getpwnam_open(struct table *);
-static int table_getpwnam_lookup(void *, enum table_service, const char *,
+static int table_getpwnam_lookup(struct table *, enum table_service, const char *,
char **);
static void table_getpwnam_close(struct table *);
}
static int
-table_getpwnam_lookup(void *hdl, enum table_service kind, const char *key,
+table_getpwnam_lookup(struct table *table, enum table_service kind, const char *key,
char **dst)
{
struct passwd *pw;
-/* $OpenBSD: table_proc.c,v 1.13 2018/12/27 08:57:03 eric Exp $ */
+/* $OpenBSD: table_proc.c,v 1.14 2018/12/27 09:30:29 eric Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
}
static int
-table_proc_lookup(void *arg, enum table_service s, const char *k, char **dst)
+table_proc_lookup(struct table *table, enum table_service s, const char *k, char **dst)
{
- struct table_proc_priv *priv = arg;
+ struct table_proc_priv *priv = table->t_handle;
struct ibuf *buf;
int r;
}
static int
-table_proc_fetch(void *arg, enum table_service s, char **dst)
+table_proc_fetch(struct table *table, enum table_service s, char **dst)
{
- struct table_proc_priv *priv = arg;
+ struct table_proc_priv *priv = table->t_handle;
struct ibuf *buf;
int r;
-/* $OpenBSD: table_static.c,v 1.26 2018/12/27 08:57:03 eric Exp $ */
+/* $OpenBSD: table_static.c,v 1.27 2018/12/27 09:30:29 eric Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
static int table_static_config(struct table *);
static int table_static_update(struct table *);
static int table_static_open(struct table *);
-static int table_static_lookup(void *, enum table_service, const char *,
+static int table_static_lookup(struct table *, enum table_service, const char *,
char **);
-static int table_static_fetch(void *, enum table_service, char **);
+static int table_static_fetch(struct table *, enum table_service, char **);
static void table_static_close(struct table *);
struct table_backend table_backend_static = {
}
static int
-table_static_lookup(void *hdl, enum table_service service, const char *key,
+table_static_lookup(struct table *m, enum table_service service, const char *key,
char **dst)
{
- struct table *m = hdl;
char *line;
int ret;
int (*match)(const char *, const char *) = NULL;
}
static int
-table_static_fetch(void *hdl, enum table_service service, char **dst)
+table_static_fetch(struct table *t, enum table_service service, char **dst)
{
- struct table *t = hdl;
const char *k;
if (!dict_iter(&t->t_dict, &t->t_iter, &k, (void **)NULL)) {