- (bal) Migrate IRIX jobs/projects/audit/etc code to

openbsd-compat/port-irix.[ch] to improve readiblity of do_child()
This commit is contained in:
Ben Lindstrom 2002-02-19 20:02:48 +00:00
Родитель 95ca7e9f1f
Коммит f095a85882
6 изменённых файлов: 80 добавлений и 58 удалений

Просмотреть файл

@ -43,6 +43,8 @@
- deraadt@cvs.openbsd.org 2002/02/19 02:50:59
[sshd_config]
stategy is not an english word
- (bal) Migrate IRIX jobs/projects/audit/etc code to
openbsd-compat/port-irix.[ch] to improve readiblity of do_child()
20020218
- (tim) newer config.guess from ftp://ftp.gnu.org/gnu/config/config.guess
@ -7640,4 +7642,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
$Id: ChangeLog,v 1.1865 2002/02/19 04:29:02 djm Exp $
$Id: ChangeLog,v 1.1866 2002/02/19 20:02:48 mouring Exp $

Просмотреть файл

@ -1,4 +1,4 @@
# $Id: Makefile.in,v 1.19 2001/09/20 02:07:51 mouring Exp $
# $Id: Makefile.in,v 1.20 2002/02/19 20:02:49 mouring Exp $
sysconfdir=@sysconfdir@
piddir=@piddir@
@ -20,6 +20,8 @@ OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getop
COMPAT=bsd-arc4random.o bsd-cray.o bsd-cygwin_util.o bsd-misc.o bsd-nextstep.o bsd-snprintf.o bsd-waitpid.o fake-getaddrinfo.o fake-getnameinfo.o
PORTS=port-irix.o
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
@ -27,9 +29,10 @@ all: libopenbsd-compat.a
$(COMPAT): ../config.h
$(OPENBSD): ../config.h
$(PORTS): ../config.h
libopenbsd-compat.a: $(COMPAT) $(OPENBSD)
$(AR) rv $@ $(COMPAT) $(OPENBSD)
libopenbsd-compat.a: $(COMPAT) $(OPENBSD) $(PORTS)
$(AR) rv $@ $(COMPAT) $(OPENBSD) $(PORTS)
$(RANLIB) $@
clean:

Просмотреть файл

@ -1,4 +1,4 @@
/* $Id: openbsd-compat.h,v 1.14 2001/09/20 02:07:51 mouring Exp $ */
/* $Id: openbsd-compat.h,v 1.15 2002/02/19 20:02:49 mouring Exp $ */
#ifndef _OPENBSD_H
#define _OPENBSD_H
@ -40,5 +40,6 @@
/* Routines for a single OS platform */
#include "bsd-cray.h"
#include "port-irix.h"
#endif /* _OPENBSD_H */

Просмотреть файл

@ -0,0 +1,61 @@
#include "includes.h"
#if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
#ifdef WITH_IRIX_PROJECT
#include <proj.h>
#endif /* WITH_IRIX_PROJECT */
#ifdef WITH_IRIX_JOBS
#include <sys/resource.h>
#endif
#ifdef WITH_IRIX_AUDIT
#include <sat.h>
#endif /* WITH_IRIX_AUDIT */
void
irix_setusercontext(struct passwd *pw)
{
#ifdef WITH_IRIX_PROJECT
prid_t projid;
#endif /* WITH_IRIX_PROJECT */
#ifdef WITH_IRIX_JOBS
jid_t jid = 0;
#else
# ifdef WITH_IRIX_ARRAY
int jid = 0;
# endif /* WITH_IRIX_ARRAY */
#endif /* WITH_IRIX_JOBS */
#ifdef WITH_IRIX_JOBS
jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive");
if (jid == -1)
fatal("Failed to create job container: %.100s",
strerror(errno));
#endif /* WITH_IRIX_JOBS */
#ifdef WITH_IRIX_ARRAY
/* initialize array session */
if (jid == 0 && newarraysess() != 0)
fatal("Failed to set up new array session: %.100s",
strerror(errno));
#endif /* WITH_IRIX_ARRAY */
#ifdef WITH_IRIX_PROJECT
/* initialize irix project info */
if ((projid = getdfltprojuser(pw->pw_name)) == -1) {
debug("Failed to get project id, using projid 0");
projid = 0;
}
if (setprid(projid))
fatal("Failed to initialize project %d for %s: %.100s",
(int)projid, pw->pw_name, strerror(errno));
#endif /* WITH_IRIX_PROJECT */
#ifdef WITH_IRIX_AUDIT
if (sysconf(_SC_AUDIT)) {
debug("Setting sat id to %d", (int) pw->pw_uid);
if (satsetid(pw->pw_uid))
debug("error setting satid: %.100s", strerror(errno));
}
#endif /* WITH_IRIX_AUDIT */
}
#endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */

Просмотреть файл

@ -0,0 +1,5 @@
#if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
void irix_setusercontext(struct passwd *pw);
#endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */

Просмотреть файл

@ -57,16 +57,6 @@ RCSID("$OpenBSD: session.c,v 1.126 2002/02/14 23:28:00 markus Exp $");
#include "canohost.h"
#include "session.h"
#ifdef WITH_IRIX_PROJECT
#include <proj.h>
#endif /* WITH_IRIX_PROJECT */
#ifdef WITH_IRIX_JOBS
#include <sys/resource.h>
#endif
#ifdef WITH_IRIX_AUDIT
#include <sat.h>
#endif /* WITH_IRIX_AUDIT */
#if defined(HAVE_USERSEC_H)
#include <usersec.h>
#endif
@ -1006,16 +996,6 @@ do_child(Session *s, const char *command)
struct stat st;
char *argv[10];
int do_xauth;
#ifdef WITH_IRIX_PROJECT
prid_t projid;
#endif /* WITH_IRIX_PROJECT */
#ifdef WITH_IRIX_JOBS
jid_t jid = 0;
#else
#ifdef WITH_IRIX_ARRAY
int jid = 0;
#endif /* WITH_IRIX_ARRAY */
#endif /* WITH_IRIX_JOBS */
do_xauth =
s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL;
@ -1098,39 +1078,9 @@ do_child(Session *s, const char *command)
*/
do_pam_setcred(0);
# endif /* USE_PAM */
# ifdef WITH_IRIX_JOBS
jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive");
if (jid == -1) {
fatal("Failed to create job container: %.100s",
strerror(errno));
}
# endif /* WITH_IRIX_JOBS */
# ifdef WITH_IRIX_ARRAY
/* initialize array session */
if (jid == 0) {
if (newarraysess() != 0)
fatal("Failed to set up new array session: %.100s",
strerror(errno));
}
# endif /* WITH_IRIX_ARRAY */
# ifdef WITH_IRIX_PROJECT
/* initialize irix project info */
if ((projid = getdfltprojuser(pw->pw_name)) == -1) {
debug("Failed to get project id, using projid 0");
projid = 0;
}
if (setprid(projid))
fatal("Failed to initialize project %d for %s: %.100s",
(int)projid, pw->pw_name, strerror(errno));
# endif /* WITH_IRIX_PROJECT */
#ifdef WITH_IRIX_AUDIT
if (sysconf(_SC_AUDIT)) {
debug("Setting sat id to %d", (int) pw->pw_uid);
if (satsetid(pw->pw_uid))
debug("error setting satid: %.100s", strerror(errno));
}
#endif /* WITH_IRIX_AUDIT */
# if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
irix_setusercontext(pw);
# endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */
#ifdef _AIX
/*
* AIX has a "usrinfo" area where logname and