From 66c1357eec26da6ec811d45450e1155f8e0745f9 Mon Sep 17 00:00:00 2001 From: glebius Date: Wed, 21 Mar 2012 07:05:29 +0000 Subject: [PATCH] Merge 226690 and 226725 from head: Protect NIS client with madvise(2) since this daemon is required for succesful authentication of users. Protect NIS server with madvise(2) since this daemon is required for succesful authentication of users. git-svn-id: svn://svn.freebsd.org/base/stable/9@233259 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/ypbind/ypbind.c | 4 ++++ usr.sbin/ypserv/yp_main.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c index 0083cf866..700365f55 100644 --- a/usr.sbin/ypbind/ypbind.c +++ b/usr.sbin/ypbind/ypbind.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -465,6 +466,9 @@ main(int argc, char *argv[]) openlog(argv[0], LOG_PID, LOG_DAEMON); + if (madvise(NULL, 0, MADV_PROTECT) != 0) + syslog(LOG_WARNING, "madvise(): %m"); + /* Kick off the default domain */ broadcast(ypbindlist); diff --git a/usr.sbin/ypserv/yp_main.c b/usr.sbin/ypserv/yp_main.c index 6b5a7adac..69dae295c 100644 --- a/usr.sbin/ypserv/yp_main.c +++ b/usr.sbin/ypserv/yp_main.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); */ #include +#include #include #include #include @@ -526,6 +527,9 @@ main(int argc, char *argv[]) unregister(); } + if (madvise(NULL, 0, MADV_PROTECT) != 0) + _msgout("madvise(): %s", strerror(errno)); + /* * Create RPC service for each transport. */ -- 2.45.0