- 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>
This commit is contained in:
Damien Miller 2001-04-16 18:37:05 +10:00
parent 3b12614396
commit 364a9bd9ce
3 changed files with 32 additions and 14 deletions

View File

@ -34,6 +34,9 @@
[session.c] [session.c]
Split motd and hushlogin checks into seperate functions, helps for Split motd and hushlogin checks into seperate functions, helps for
portable. From Chris Adams <cmadams@hiwaay.net>; ok markus@ 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 20010415
- OpenBSD CVS Sync - OpenBSD CVS Sync
@ -5119,4 +5122,4 @@
- Wrote replacements for strlcpy and mkdtemp - Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1 - 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 $

View File

@ -61,35 +61,46 @@ session_setup_sia(char *user, char *tty)
host = get_canonical_hostname (options.reverse_mapping_check); host = get_canonical_hostname (options.reverse_mapping_check);
if (sia_ses_init(&ent, saved_argc, saved_argv, host, user, tty, 0, if (sia_ses_init(&ent, saved_argc, saved_argv, host, user, tty, 0,
NULL) != SIASUCCESS) NULL) != SIASUCCESS) {
fatal("sia_ses_init failed"); error("sia_ses_init failed");
exit(1);
}
if ((pw = getpwnam(user)) == NULL) { if ((pw = getpwnam(user)) == NULL) {
sia_ses_release(&ent); 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) { if (sia_make_entity_pwd(pw, ent) != SIASUCCESS) {
sia_ses_release(&ent); sia_ses_release(&ent);
fatal("sia_make_entity_pwd failed"); error("sia_make_entity_pwd failed");
exit(1);
} }
ent->authtype = SIA_A_NONE; ent->authtype = SIA_A_NONE;
if (sia_ses_estab(sia_collect_trm, ent) != SIASUCCESS) if (sia_ses_estab(sia_collect_trm, ent) != SIASUCCESS) {
fatal("couldn't establish session for %s from %s", user, error("couldn't establish session for %s from %s", user,
host); host);
exit(1);
}
if (setpriority(PRIO_PROCESS, 0, 0) == -1) { if (setpriority(PRIO_PROCESS, 0, 0) == -1) {
sia_ses_release(&ent); 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) if (sia_ses_launch(sia_collect_trm, ent) != SIASUCCESS) {
fatal("couldn't launch session for %s from %s", user, host); error("couldn't launch session for %s from %s", user, host);
exit(1);
}
sia_ses_release(&ent); sia_ses_release(&ent);
if (setreuid(geteuid(), geteuid()) < 0) if (setreuid(geteuid(), geteuid()) < 0) {
fatal("setreuid failed: %s", strerror (errno)); error("setreuid failed: %s", strerror (errno));
exit(1);
}
} }
#endif /* HAVE_OSF_SIA */ #endif /* HAVE_OSF_SIA */

View File

@ -635,8 +635,10 @@ do_exec_pty(Session *s, const char *command)
close(ttyfd); close(ttyfd);
/* record login, etc. similar to login(1) */ /* record login, etc. similar to login(1) */
#ifndef HAVE_OSF_SIA
if (!(options.use_login && command == NULL)) if (!(options.use_login && command == NULL))
do_login(s, command); do_login(s, command);
#endif
/* Do common processing for the child, such as execing the command. */ /* Do common processing for the child, such as execing the command. */
do_child(s, command); do_child(s, command);
@ -1052,7 +1054,7 @@ do_child(Session *s, const char *command)
if (options.use_login && command != NULL) if (options.use_login && command != NULL)
options.use_login = 0; options.use_login = 0;
#ifndef USE_PAM /* pam_nologin handles this */ #if !defined(USE_PAM) && !defined(HAVE_OSF_SIA)
if (!options.use_login) { if (!options.use_login) {
# ifdef HAVE_LOGIN_CAP # ifdef HAVE_LOGIN_CAP
if (!login_getcapbool(lc, "ignorenologin", 0) && pw->pw_uid) if (!login_getcapbool(lc, "ignorenologin", 0) && pw->pw_uid)
@ -1070,7 +1072,7 @@ do_child(Session *s, const char *command)
exit(254); exit(254);
} }
} }
#endif /* USE_PAM */ #endif /* USE_PAM || HAVE_OSF_SIA */
/* Set login name, uid, gid, and groups. */ /* Set login name, uid, gid, and groups. */
/* Login(1) does this as well, and it needs uid 0 for the "-h" /* 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) { if (!options.use_login) {
#ifdef HAVE_OSF_SIA #ifdef HAVE_OSF_SIA
session_setup_sia(pw->pw_name, s->ttyfd == -1 ? NULL : s->tty); session_setup_sia(pw->pw_name, s->ttyfd == -1 ? NULL : s->tty);
if (!check_quietlogin(s, command))
do_motd();
#else /* HAVE_OSF_SIA */ #else /* HAVE_OSF_SIA */
#ifdef HAVE_CYGWIN #ifdef HAVE_CYGWIN
if (is_winnt) { if (is_winnt) {