- (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
parent 95ca7e9f1f
commit f095a85882
6 changed files with 80 additions and 58 deletions

View File

@ -43,6 +43,8 @@
- deraadt@cvs.openbsd.org 2002/02/19 02:50:59 - deraadt@cvs.openbsd.org 2002/02/19 02:50:59
[sshd_config] [sshd_config]
stategy is not an english word 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 20020218
- (tim) newer config.guess from ftp://ftp.gnu.org/gnu/config/config.guess - (tim) newer config.guess from ftp://ftp.gnu.org/gnu/config/config.guess
@ -7640,4 +7642,4 @@
- Wrote replacements for strlcpy and mkdtemp - Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1 - 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 $

View File

@ -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@ sysconfdir=@sysconfdir@
piddir=@piddir@ 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 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: .c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
@ -27,9 +29,10 @@ all: libopenbsd-compat.a
$(COMPAT): ../config.h $(COMPAT): ../config.h
$(OPENBSD): ../config.h $(OPENBSD): ../config.h
$(PORTS): ../config.h
libopenbsd-compat.a: $(COMPAT) $(OPENBSD) libopenbsd-compat.a: $(COMPAT) $(OPENBSD) $(PORTS)
$(AR) rv $@ $(COMPAT) $(OPENBSD) $(AR) rv $@ $(COMPAT) $(OPENBSD) $(PORTS)
$(RANLIB) $@ $(RANLIB) $@
clean: clean:

View File

@ -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 #ifndef _OPENBSD_H
#define _OPENBSD_H #define _OPENBSD_H
@ -40,5 +40,6 @@
/* Routines for a single OS platform */ /* Routines for a single OS platform */
#include "bsd-cray.h" #include "bsd-cray.h"
#include "port-irix.h"
#endif /* _OPENBSD_H */ #endif /* _OPENBSD_H */

View File

@ -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) */

View File

@ -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) */

View File

@ -57,16 +57,6 @@ RCSID("$OpenBSD: session.c,v 1.126 2002/02/14 23:28:00 markus Exp $");
#include "canohost.h" #include "canohost.h"
#include "session.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) #if defined(HAVE_USERSEC_H)
#include <usersec.h> #include <usersec.h>
#endif #endif
@ -1006,16 +996,6 @@ do_child(Session *s, const char *command)
struct stat st; struct stat st;
char *argv[10]; char *argv[10];
int do_xauth; 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 = do_xauth =
s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL; 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); do_pam_setcred(0);
# endif /* USE_PAM */ # endif /* USE_PAM */
# ifdef WITH_IRIX_JOBS # if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive"); irix_setusercontext(pw);
if (jid == -1) { # endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */
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 */
#ifdef _AIX #ifdef _AIX
/* /*
* AIX has a "usrinfo" area where logname and * AIX has a "usrinfo" area where logname and