From 364a9bd9ce0fa0c357e55306df56e47883a591f9 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 16 Apr 2001 18:37:05 +1000 Subject: [PATCH] - Fix OSF SIA support displaying too much information for quiet logins and logins where access was denied by SIA. Patch from Chris Adams --- ChangeLog | 5 ++++- auth-sia.c | 33 ++++++++++++++++++++++----------- session.c | 8 ++++++-- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 611e001d8..60a7bc0a0 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 ; 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 + 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 6fece555d..4e947cd4e 100644 --- a/auth-sia.c +++ b/auth-sia.c @@ -61,35 +61,46 @@ session_setup_sia(char *user, char *tty) 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 77e11987e..4580c3025 100644 --- a/session.c +++ b/session.c @@ -635,8 +635,10 @@ do_exec_pty(Session *s, const char *command) 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 @@ do_child(Session *s, const char *command) 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 @@ do_child(Session *s, const char *command) 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 @@ do_child(Session *s, const char *command) 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) {