From 56d66987e3843db97d1bc4b5825bee063042d55a Mon Sep 17 00:00:00 2001 From: deraadt Date: Wed, 14 Oct 2015 17:06:58 +0000 Subject: [PATCH] pledge "stdio rpath" is good enough for these mainline BSD auth login programs. (I am very surprised pledge ended up working for programs like this) ok semarie millert --- libexec/login_passwd/login_passwd.c | 6 +++++- libexec/login_reject/login_reject.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libexec/login_passwd/login_passwd.c b/libexec/login_passwd/login_passwd.c index d769bdc0735..d6ada58b1da 100644 --- a/libexec/login_passwd/login_passwd.c +++ b/libexec/login_passwd/login_passwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login_passwd.c,v 1.11 2015/10/05 17:31:17 millert Exp $ */ +/* $OpenBSD: login_passwd.c,v 1.12 2015/10/14 17:06:58 deraadt Exp $ */ /*- * Copyright (c) 2001 Hans Insulander . @@ -51,6 +51,10 @@ pwd_login(char *username, char *password, char *wheel, int lastchance, goodhash = pwd->pw_passwd; setpriority(PRIO_PROCESS, 0, -4); + + if (pledge("stdio rpath", NULL) == -1) + err(1, "pledge"); + if (crypt_checkpass(password, goodhash) == 0) passok = 1; plen = strlen(password); diff --git a/libexec/login_reject/login_reject.c b/libexec/login_reject/login_reject.c index 167bd952a10..a609c51a594 100644 --- a/libexec/login_reject/login_reject.c +++ b/libexec/login_reject/login_reject.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login_reject.c,v 1.10 2014/11/03 16:50:20 tedu Exp $ */ +/* $OpenBSD: login_reject.c,v 1.11 2015/10/14 17:06:58 deraadt Exp $ */ /*- * Copyright (c) 1995 Berkeley Software Design, Inc. All rights reserved. @@ -65,6 +65,9 @@ main(int argc, char *argv[]) (void)setpriority(PRIO_PROCESS, 0, 0); + if (pledge("stdio rpath", NULL) == -1) + err(1, "pledge"); + openlog("login", LOG_ODELAY, LOG_AUTH); while ((c = getopt(argc, argv, "v:s:")) != -1) -- 2.20.1