- Fix OSF SIA support displaying too much information for quiet
   logins and logins where access was denied by SIA. Patch from Chris Adams
   <cmadams@hiwaay.net>
diff --git a/ChangeLog b/ChangeLog
index 611e001..60a7bc0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,9 @@
      [session.c]
      Split motd and hushlogin checks into seperate functions, helps for 
      portable. From Chris Adams <cmadams@hiwaay.net>; ok markus@
+ - Fix OSF SIA support displaying too much information for quiet 
+   logins and logins where access was denied by SIA. Patch from Chris Adams 
+   <cmadams@hiwaay.net>
 
 20010415
  - OpenBSD CVS Sync
@@ -5119,4 +5122,4 @@
  - Wrote replacements for strlcpy and mkdtemp
  - Released 1.0pre1
 
-$Id: ChangeLog,v 1.1127 2001/04/16 08:29:15 djm Exp $
+$Id: ChangeLog,v 1.1128 2001/04/16 08:37:05 djm Exp $
diff --git a/auth-sia.c b/auth-sia.c
index 6fece55..4e947cd 100644
--- a/auth-sia.c
+++ b/auth-sia.c
@@ -61,35 +61,46 @@
 	host = get_canonical_hostname (options.reverse_mapping_check);
 
 	if (sia_ses_init(&ent, saved_argc, saved_argv, host, user, tty, 0,
-	    NULL) != SIASUCCESS)
-		fatal("sia_ses_init failed");
+	    NULL) != SIASUCCESS) {
+		error("sia_ses_init failed");
+		exit(1);
+	}
 
 	if ((pw = getpwnam(user)) == NULL) {
 		sia_ses_release(&ent);
-		fatal("getpwnam(%s) failed: %s", user, strerror(errno));
+		error("getpwnam(%s) failed: %s", user, strerror(errno));
+		exit(1);
 	}
 	if (sia_make_entity_pwd(pw, ent) != SIASUCCESS) {
 		sia_ses_release(&ent);
-		fatal("sia_make_entity_pwd failed");
+		error("sia_make_entity_pwd failed");
+		exit(1);
 	}
 
 	ent->authtype = SIA_A_NONE;
-	if (sia_ses_estab(sia_collect_trm, ent) != SIASUCCESS)
-		fatal("couldn't establish session for %s from %s", user,
+	if (sia_ses_estab(sia_collect_trm, ent) != SIASUCCESS) {
+		error("couldn't establish session for %s from %s", user,
 		    host);
+		exit(1);
+	}
 
 	if (setpriority(PRIO_PROCESS, 0, 0) == -1) {
 		sia_ses_release(&ent);
-		fatal("setpriority failed: %s", strerror (errno));
+		error("setpriority failed: %s", strerror (errno));
+		exit(1);
 	}
 
-	if (sia_ses_launch(sia_collect_trm, ent) != SIASUCCESS)
-		fatal("couldn't launch session for %s from %s", user, host);
+	if (sia_ses_launch(sia_collect_trm, ent) != SIASUCCESS) {
+		error("couldn't launch session for %s from %s", user, host);
+		exit(1);
+	}
 	
 	sia_ses_release(&ent);
 
-	if (setreuid(geteuid(), geteuid()) < 0)
-		fatal("setreuid failed: %s", strerror (errno));
+	if (setreuid(geteuid(), geteuid()) < 0) {
+		error("setreuid failed: %s", strerror (errno));
+		exit(1);
+	}
 }
 
 #endif /* HAVE_OSF_SIA */
diff --git a/session.c b/session.c
index 77e1198..4580c30 100644
--- a/session.c
+++ b/session.c
@@ -635,8 +635,10 @@
 		close(ttyfd);
 
 		/* record login, etc. similar to login(1) */
+#ifndef HAVE_OSF_SIA
 		if (!(options.use_login && command == NULL))
 			do_login(s, command);
+#endif
 
 		/* Do common processing for the child, such as execing the command. */
 		do_child(s, command);
@@ -1052,7 +1054,7 @@
 	if (options.use_login && command != NULL)
 		options.use_login = 0;
 
-#ifndef USE_PAM /* pam_nologin handles this */
+#if !defined(USE_PAM) && !defined(HAVE_OSF_SIA)
 	if (!options.use_login) {
 # ifdef HAVE_LOGIN_CAP
 		if (!login_getcapbool(lc, "ignorenologin", 0) && pw->pw_uid)
@@ -1070,7 +1072,7 @@
 			exit(254);
 		}
 	}
-#endif /* USE_PAM */
+#endif /* USE_PAM || HAVE_OSF_SIA */
 
 	/* Set login name, uid, gid, and groups. */
 	/* Login(1) does this as well, and it needs uid 0 for the "-h"
@@ -1078,6 +1080,8 @@
 	if (!options.use_login) {
 #ifdef HAVE_OSF_SIA
 		session_setup_sia(pw->pw_name, s->ttyfd == -1 ? NULL : s->tty);
+		if (!check_quietlogin(s, command))
+			do_motd();
 #else /* HAVE_OSF_SIA */
 #ifdef HAVE_CYGWIN
 		if (is_winnt) {