service.c revision db397771158a0b9b33b5ab2dee8593e03ee5e994
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * CDDL HEADER START
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * The contents of this file are subject to the terms of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Common Development and Distribution License, Version 1.0 only
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * (the "License"). You may not use this file except in compliance
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * with the License.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * See the License for the specific language governing permissions
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * and limitations under the License.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * When distributing Covered Code, include this CDDL HEADER in each
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * If applicable, add the following below this CDDL HEADER, with the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * fields enclosed by brackets "[]" replaced with your own identifying
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * information: Portions Copyright [yyyy] [name of copyright owner]
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * CDDL HEADER END
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Use is subject to license terms.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/* All Rights Reserved */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#pragma ident "%Z%%M% %I% %E% SMI"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * UNIX shell
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic unsigned char *execs();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic void gsort();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic int split();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncextern const char *sysmsg[];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncextern short topfd;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * service routines for `execute'
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *ion;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * pushed in tmpfil() --
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * bug fix for problem with
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * in-line scripts
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync } else if (((iof & IOPUT) == 0) && ((iof & IORDW) == 0))
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncunsigned char *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncunsigned char *s;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *sname;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync while (1) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncunsigned char *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *s;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return ((unsigned char *)nullstr);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return ((unsigned char *)defpath);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /* Add extra ':' if PATH variable ends in ':' */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync } while ((f = open((char *)curstak(), 0)) < 0 && path);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return (f);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncunsigned char *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * leaves result on top of stack
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncunsigned char *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic const char *xecmsg;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic unsigned char **xecenv;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *path;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char **t = at;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic unsigned char *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *p, *prefix;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *savptr;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Need to save the stack information, or the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * first memory allocation in secpolicy_profile_lookup()
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * will clobber it.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync (char **)t, (const char **)xecenv);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync execve((const char *)p, (char *const *)&t[0],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync (char *const *)xecenv);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync clearup(); /* remove open files and for loop junk */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * set up new args
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *last;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *current;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char c;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync while (c = *current) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /* remove \ and quoted nulls */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/* Same as trim, but only removes backlashes before slashes */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncunsigned char *at;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *last;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *current;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char c;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync while (c = *current) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /* remove \ and quoted nulls */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (!(c = *current)) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (c == '/') {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncunsigned char *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncunsigned char *s;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *t = macro(s);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return (t);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncunsigned char **
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync comargn = (unsigned char **)getstak(BYTESPERWORD * argn + BYTESPERWORD);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync int k, m, n;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for (j = 0; j < k; j++)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for (i = j; i >= 0; i -= m)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char **fromi;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *s;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Argument list generation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncunsigned char *s;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *argp;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync while (c = *s) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync wc = (unsigned char)*s;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /* get rest of multibyte character */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync wc = (unsigned char)*s;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync while (--length > 0) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /* skip to next character position */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync while (--length > 0) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * file name generation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic int shaccton; /* 0 implies do not write record on exit */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /* 1 implies write acct record on exit */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * suspend accounting until turned on by preacct()
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync unsigned char *simple();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync movstrn(simple(cmdadr), sabuf.ac_comm, sizeof (sabuf.ac_comm));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sabuf.ac_utime = compress(buffer.tms_utime + buffer.tms_cutime);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sabuf.ac_stime = compress(buffer.tms_stime + buffer.tms_cstime);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Produce a pseudo-floating point representation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * with 3 bits base-8 exponent, 13 bits fraction
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync while (t >= 8192) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (t >= 8192) {