diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2013-02-13 14:34:44 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2013-02-13 14:34:44 +0000 |
commit | 5b8a640a40f4633fcabf65d0778d09c362bd9a50 (patch) | |
tree | 6dd6d35b6f1054539c2a633bb11e3e33c7bacc22 /usr.sbin | |
parent | 7ac3b560e1d456a7fb06625adab54737385809ba (diff) |
- 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
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/table_db.c | 10 | ||||
-rw-r--r-- | usr.sbin/smtpd/table_static.c | 10 |
2 files changed, 14 insertions, 6 deletions
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 <gilles@poolp.org> @@ -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 <gilles@poolp.org> @@ -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; |