Clusters and /etc/nologin

Russell Vincent rv at openusenet.org
Tue Jan 29 22:06:49 EST 2002


On Tru64 clusters, a single machine can be marked for nologin
by creating /etc/nologin_HOSTNAME. The attached patch does a check
for this file if /etc/nologin is not found and treats it the same
as /etc/nologin (or wherever nologin happens to be).

Not sure if you wants this within a #ifdef.

 -Russell

diff -cr openssh-3.0.2p1/session.c openssh/session.c
*** openssh-3.0.2p1/session.c	Sat Dec  1 23:37:08 2001
--- openssh/session.c	Tue Jan 29 10:18:54 2002
***************
*** 1068,1073 ****
--- 1068,1084 ----
  # else /* HAVE_LOGIN_CAP */
  		if (pw->pw_uid)
  			f = fopen(_PATH_NOLOGIN, "r");
+ 			if ((f = fopen(_PATH_NOLOGIN, "r")) == NULL) {
+ 				char hname[MAXHOSTNAMELEN];
+ 				if (gethostname(hname, MAXHOSTNAMELEN) == 0) {
+ 					char nologinpath[PATH_MAX];
+ 					snprintf(nologinpath, PATH_MAX, "%s_%s",
+ 						_PATH_NOLOGIN, hname);
+ 					f = fopen(nologinpath, "r");
+ 				} else
+ 					f = NULL;
+ 				
+                         }
  # endif /* HAVE_LOGIN_CAP */
  		if (f) {
  			/* /etc/nologin exists.  Print its contents and exit. */



More information about the openssh-unix-dev mailing list