From 5b8a640a40f4633fcabf65d0778d09c362bd9a50 Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Wed, 13 Feb 2013 14:34:44 +0000 Subject: - when declaring a static table for userinfo, do not make username part of the value as it confuses users { gilles => gilles:10:100:/home } becomes { gilles => 10:100:/home } ok eric, we'll discuss changes under the hood post-release --- usr.sbin/smtpd/table_db.c | 10 +++++++--- usr.sbin/smtpd/table_static.c | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/smtpd/table_db.c b/usr.sbin/smtpd/table_db.c index 732faf7a2d7..fe8647916ee 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.2 2013/01/31 18:34:43 eric Exp $ */ +/* $OpenBSD: table_db.c,v 1.3 2013/02/13 14:34:43 gilles Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -375,10 +375,14 @@ error: static int table_db_userinfo(const char *key, char *line, size_t len, void **retp) { - struct userinfo *userinfo; + struct userinfo *userinfo = NULL; + char buffer[1024]; + + if (! bsnprintf(buffer, sizeof buffer, "%s:%s", key, line)) + goto error; userinfo = xcalloc(1, sizeof *userinfo, "table_db_userinfo"); - if (! text_to_userinfo(userinfo, line)) + if (! text_to_userinfo(userinfo, buffer)) goto error; *retp = userinfo; return 1; diff --git a/usr.sbin/smtpd/table_static.c b/usr.sbin/smtpd/table_static.c index c3bca6889fb..b4e9767d1b3 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.2 2013/02/05 15:23:40 gilles Exp $ */ +/* $OpenBSD: table_static.c,v 1.3 2013/02/13 14:34:43 gilles Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -351,10 +351,14 @@ error: static int table_static_userinfo(const char *key, char *line, size_t len, void **retp) { - struct userinfo *userinfo; + struct userinfo *userinfo = NULL; + char buffer[1024]; + + if (! bsnprintf(buffer, sizeof buffer, "%s:%s", key, line)) + goto error; userinfo = xcalloc(1, sizeof *userinfo, "table_static_userinfo"); - if (! text_to_userinfo(userinfo, line)) + if (! text_to_userinfo(userinfo, buffer)) goto error; *retp = userinfo; return 1; -- cgit v1.2.3