From: eric Date: Wed, 26 Dec 2018 20:13:43 +0000 (+0000) Subject: reorder parameters for consistency X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=93cc0b04457832aef0debca4d2529434caf7da55;p=openbsd reorder parameters for consistency --- diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c index 9fff15a5e8f..634aa68857e 100644 --- a/usr.sbin/smtpd/aliases.c +++ b/usr.sbin/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $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 @@ -58,7 +58,7 @@ aliases_get(struct expand *expand, const char *username) /* 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) @@ -67,7 +67,7 @@ aliases_get(struct expand *expand, const char *username) } /* 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; @@ -131,7 +131,7 @@ aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr) 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) @@ -141,7 +141,7 @@ aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr) /* 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) @@ -152,7 +152,7 @@ aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr) 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) @@ -162,7 +162,7 @@ aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr) /* 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) @@ -171,14 +171,14 @@ aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr) 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); diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index 67f87dfdcd2..7a6df074baa 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $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 @@ -689,7 +689,7 @@ lka_authenticate(const char *tablename, const char *user, const char *password) 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); @@ -719,7 +719,7 @@ lka_credentials(const char *tablename, const char *label, char *dst, size_t sz) 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); @@ -760,7 +760,7 @@ lka_userinfo(const char *tablename, const char *username, struct userinfo *res) 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); @@ -790,7 +790,7 @@ lka_addrname(const char *tablename, const struct sockaddr *sa, 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); @@ -818,7 +818,7 @@ lka_mailaddrmap(const char *tablename, const char *username, const struct mailad 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); diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c index 906dd747ea4..987a54dbc52 100644 --- a/usr.sbin/smtpd/lka_session.c +++ b/usr.sbin/smtpd/lka_session.c @@ -1,4 +1,4 @@ -/* $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 @@ -377,7 +377,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) *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"); diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index b57f3812c79..a3febed00ab 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $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 @@ -368,7 +368,7 @@ struct table_backend { 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 **); }; @@ -1605,7 +1605,7 @@ int table_check_use(struct table *, uint32_t, uint32_t); 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 *); diff --git a/usr.sbin/smtpd/table.c b/usr.sbin/smtpd/table.c index 81f72f0db5c..8231c09a8f9 100644 --- a/usr.sbin/smtpd/table.c +++ b/usr.sbin/smtpd/table.c @@ -1,4 +1,4 @@ -/* $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 @@ -118,11 +118,11 @@ table_find(struct smtpd *conf, const char *name, const char *tag) 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; @@ -136,7 +136,7 @@ table_lookup(struct table *table, const char *key, enum table_service kind, 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", diff --git a/usr.sbin/smtpd/table_db.c b/usr.sbin/smtpd/table_db.c index 5d031f2d407..c8940616a6c 100644 --- a/usr.sbin/smtpd/table_db.c +++ b/usr.sbin/smtpd/table_db.c @@ -1,4 +1,4 @@ -/* $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 @@ -43,7 +43,7 @@ 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 *); @@ -143,7 +143,7 @@ table_db_close(void *hdl) } 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; diff --git a/usr.sbin/smtpd/table_getpwnam.c b/usr.sbin/smtpd/table_getpwnam.c index 98d2e640253..1907da1545f 100644 --- a/usr.sbin/smtpd/table_getpwnam.c +++ b/usr.sbin/smtpd/table_getpwnam.c @@ -1,4 +1,4 @@ -/* $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 @@ -41,7 +41,7 @@ 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 *); @@ -83,7 +83,7 @@ table_getpwnam_close(void *hdl) } 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; diff --git a/usr.sbin/smtpd/table_proc.c b/usr.sbin/smtpd/table_proc.c index 9d7b2fe5fb1..e8d915bff36 100644 --- a/usr.sbin/smtpd/table_proc.c +++ b/usr.sbin/smtpd/table_proc.c @@ -1,4 +1,4 @@ -/* $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 @@ -178,7 +178,7 @@ imsg_add_params(struct ibuf *buf) } 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; diff --git a/usr.sbin/smtpd/table_static.c b/usr.sbin/smtpd/table_static.c index e18840bad63..196713b5918 100644 --- a/usr.sbin/smtpd/table_static.c +++ b/usr.sbin/smtpd/table_static.c @@ -1,4 +1,4 @@ -/* $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 @@ -42,7 +42,7 @@ 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 *); @@ -215,8 +215,8 @@ table_static_close(void *hdl) } 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;