-/* $OpenBSD: aliases.c,v 1.74 2018/12/26 14:15:12 eric Exp $ */
+/* $OpenBSD: aliases.c,v 1.75 2018/12/26 20:13:43 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
/* first, check if entry has a user-part tag */
pbuf = strchr(buf, *env->sc_subaddressing_delim);
if (pbuf) {
- ret = table_lookup(mapping, buf, K_ALIAS, &lk);
+ ret = table_lookup(mapping, K_ALIAS, buf, &lk);
if (ret < 0)
return (-1);
if (ret)
}
/* no user-part tag, try looking up user */
- ret = table_lookup(mapping, buf, K_ALIAS, &lk);
+ ret = table_lookup(mapping, K_ALIAS, buf, &lk);
if (ret <= 0)
return ret;
if (!bsnprintf(buf, sizeof(buf), "%s%c%s@%s",
user, *env->sc_subaddressing_delim, tag, domain))
return 0;
- ret = table_lookup(mapping, buf, K_ALIAS, &lk);
+ ret = table_lookup(mapping, K_ALIAS, buf, &lk);
if (ret < 0)
return (-1);
if (ret)
/* then, check if entry exists without user-part tag */
if (!bsnprintf(buf, sizeof(buf), "%s@%s", user, domain))
return 0;
- ret = table_lookup(mapping, buf, K_ALIAS, &lk);
+ ret = table_lookup(mapping, K_ALIAS, buf, &lk);
if (ret < 0)
return (-1);
if (ret)
if (!bsnprintf(buf, sizeof(buf), "%s%c%s",
user, *env->sc_subaddressing_delim, tag))
return 0;
- ret = table_lookup(mapping, buf, K_ALIAS, &lk);
+ ret = table_lookup(mapping, K_ALIAS, buf, &lk);
if (ret < 0)
return (-1);
if (ret)
/* Failed ? We lookup for username only */
if (!bsnprintf(buf, sizeof(buf), "%s", user))
return 0;
- ret = table_lookup(mapping, buf, K_ALIAS, &lk);
+ ret = table_lookup(mapping, K_ALIAS, buf, &lk);
if (ret < 0)
return (-1);
if (ret)
if (!bsnprintf(buf, sizeof(buf), "@%s", domain))
return 0;
/* Failed ? We lookup for catch all for virtual domain */
- ret = table_lookup(mapping, buf, K_ALIAS, &lk);
+ ret = table_lookup(mapping, K_ALIAS, buf, &lk);
if (ret < 0)
return (-1);
if (ret)
goto expand;
/* Failed ? We lookup for a *global* catch all */
- ret = table_lookup(mapping, "@", K_ALIAS, &lk);
+ ret = table_lookup(mapping, K_ALIAS, "@", &lk);
if (ret <= 0)
return (ret);
-/* $OpenBSD: lka.c,v 1.230 2018/12/26 14:15:12 eric Exp $ */
+/* $OpenBSD: lka.c,v 1.231 2018/12/26 20:13:43 eric Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
return (LKA_TEMPFAIL);
}
- switch (table_lookup(table, user, K_CREDENTIALS, &lk)) {
+ switch (table_lookup(table, K_CREDENTIALS, user, &lk)) {
case -1:
log_warnx("warn: user credentials lookup fail for %s:%s",
tablename, user);
dst[0] = '\0';
- switch (table_lookup(table, label, K_CREDENTIALS, &lk)) {
+ switch (table_lookup(table, K_CREDENTIALS, label, &lk)) {
case -1:
log_warnx("warn: credentials lookup fail for %s:%s",
tablename, label);
return (LKA_TEMPFAIL);
}
- switch (table_lookup(table, username, K_USERINFO, &lk)) {
+ switch (table_lookup(table, K_USERINFO, username, &lk)) {
case -1:
log_warnx("warn: failure during userinfo lookup %s:%s",
tablename, username);
return (LKA_TEMPFAIL);
}
- switch (table_lookup(table, source, K_ADDRNAME, &lk)) {
+ switch (table_lookup(table, K_ADDRNAME, source, &lk)) {
case -1:
log_warnx("warn: failure during helo lookup %s:%s",
tablename, source);
return (LKA_TEMPFAIL);
}
- switch (table_lookup(table, username, K_MAILADDRMAP, &lk)) {
+ switch (table_lookup(table, K_MAILADDRMAP, username, &lk)) {
case -1:
log_warnx("warn: failure during mailaddrmap lookup %s:%s",
tablename, username);
-/* $OpenBSD: lka_session.c,v 1.89 2018/12/26 14:15:12 eric Exp $ */
+/* $OpenBSD: lka_session.c,v 1.90 2018/12/26 20:13:43 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
*tag++ = '\0';
userbase = table_find(env, dsp->u.local.table_userbase, NULL);
- r = table_lookup(userbase, xn->u.user, K_USERINFO, &lk);
+ r = table_lookup(userbase, K_USERINFO, xn->u.user, &lk);
if (r == -1) {
log_trace(TRACE_EXPAND, "expand: lka_expand: "
"backend error while searching user");
-/* $OpenBSD: smtpd.h,v 1.606 2018/12/26 15:55:09 eric Exp $ */
+/* $OpenBSD: smtpd.h,v 1.607 2018/12/26 20:13:43 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
void *(*open)(struct table *);
int (*update)(struct table *);
void (*close)(void *);
- int (*lookup)(void *, const char *, enum table_service, char **);
+ int (*lookup)(void *, enum table_service, const char *, char **);
int (*fetch)(void *, enum table_service, char **);
};
int table_check_type(struct table *, uint32_t);
int table_check_service(struct table *, uint32_t);
int table_match(struct table *, enum table_service, const char *);
-int table_lookup(struct table *, const char *, enum table_service,
+int table_lookup(struct table *, enum table_service, const char *,
union lookup *);
int table_fetch(struct table *, enum table_service, union lookup *);
void table_destroy(struct smtpd *, struct table *);
-/* $OpenBSD: table.c,v 1.37 2018/12/26 15:55:09 eric Exp $ */
+/* $OpenBSD: table.c,v 1.38 2018/12/26 20:13:43 eric Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
int
table_match(struct table *table, enum table_service kind, const char *key)
{
- return table_lookup(table, key, kind, NULL);
+ return table_lookup(table, kind, key, NULL);
}
int
-table_lookup(struct table *table, const char *key, enum table_service kind,
+table_lookup(struct table *table, enum table_service kind, const char *key,
union lookup *lk)
{
int r;
return -1;
}
- r = table->t_backend->lookup(table->t_handle, lkey, kind, lk ? &buf : NULL);
+ r = table->t_backend->lookup(table->t_handle, kind, lkey, lk ? &buf : NULL);
if (r == 1) {
log_trace(TRACE_LOOKUP, "lookup: %s \"%s\" as %s in table %s:%s -> %s%s%s",
-/* $OpenBSD: table_db.c,v 1.13 2018/12/26 14:15:13 eric Exp $ */
+/* $OpenBSD: table_db.c,v 1.14 2018/12/26 20:13:43 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
static int table_db_config(struct table *);
static int table_db_update(struct table *);
static void *table_db_open(struct table *);
-static int table_db_lookup(void *, const char *, enum table_service, char **);
+static int table_db_lookup(void *, enum table_service, const char *, char **);
static int table_db_fetch(void *, enum table_service, char **);
static void table_db_close(void *);
}
static int
-table_db_lookup(void *hdl, const char *key, enum table_service service,
+table_db_lookup(void *hdl, enum table_service service, const char *key,
char **dst)
{
struct dbhandle *handle = hdl;
-/* $OpenBSD: table_getpwnam.c,v 1.7 2018/12/26 14:15:13 eric Exp $ */
+/* $OpenBSD: table_getpwnam.c,v 1.8 2018/12/26 20:13:43 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 void *table_getpwnam_open(struct table *);
-static int table_getpwnam_lookup(void *, const char *, enum table_service,
+static int table_getpwnam_lookup(void *, enum table_service, const char *,
char **);
static void table_getpwnam_close(void *);
}
static int
-table_getpwnam_lookup(void *hdl, const char *key, enum table_service kind,
+table_getpwnam_lookup(void *hdl, enum table_service kind, const char *key,
char **dst)
{
struct passwd *pw;
-/* $OpenBSD: table_proc.c,v 1.10 2018/12/26 14:15:13 eric Exp $ */
+/* $OpenBSD: table_proc.c,v 1.11 2018/12/26 20:13:43 eric Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
}
static int
-table_proc_lookup(void *arg, const char *k, enum table_service s, char **dst)
+table_proc_lookup(void *arg, enum table_service s, const char *k, char **dst)
{
struct table_proc_priv *priv = arg;
struct ibuf *buf;
-/* $OpenBSD: table_static.c,v 1.23 2018/12/26 14:15:13 eric Exp $ */
+/* $OpenBSD: table_static.c,v 1.24 2018/12/26 20:13:43 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 void *table_static_open(struct table *);
-static int table_static_lookup(void *, const char *, enum table_service,
+static int table_static_lookup(void *, enum table_service, const char *,
char **);
static int table_static_fetch(void *, enum table_service, char **);
static void table_static_close(void *);
}
static int
-table_static_lookup(void *hdl, const char *key,
- enum table_service service, char **dst)
+table_static_lookup(void *hdl, enum table_service service, const char *key,
+ char **dst)
{
struct table *m = hdl;
char *line;