|
|
1.1 root 1: /* run.c
2: Run a program.
3:
4: Copyright (C) 1992 Ian Lance Taylor
5:
6: This file is part of the Taylor UUCP package.
7:
8: This program is free software; you can redistribute it and/or
9: modify it under the terms of the GNU General Public License as
10: published by the Free Software Foundation; either version 2 of the
11: License, or (at your option) any later version.
12:
13: This program is distributed in the hope that it will be useful, but
14: WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: General Public License for more details.
17:
18: You should have received a copy of the GNU General Public License
19: along with this program; if not, write to the Free Software
20: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21:
22: The author of the program may be contacted at [email protected] or
23: c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
24: */
25:
26: #include "uucp.h"
27:
28: #include "uudefs.h"
29: #include "sysdep.h"
30: #include "system.h"
31:
32: #include <errno.h>
33:
34: /* Start up a new program and end the current one. We don't have to
35: worry about SIGHUP because the current process is either not a
36: process group leader (uucp, uux) or it does not have a controlling
37: terminal (uucico). */
38:
39: boolean
40: fsysdep_run (zprogram, zarg1, zarg2)
41: const char *zprogram;
42: const char *zarg1;
43: const char *zarg2;
44: {
45: char *zlib;
46: const char *azargs[4];
47: int aidescs[3];
48: pid_t ipid;
49:
50: zlib = zbufalc (sizeof SBINDIR + sizeof "/" + strlen (zprogram));
51: sprintf (zlib, "%s/%s", SBINDIR, zprogram);
52:
53: azargs[0] = zlib;
54: azargs[1] = zarg1;
55: azargs[2] = zarg2;
56: azargs[3] = NULL;
57:
58: aidescs[0] = SPAWN_NULL;
59: aidescs[1] = SPAWN_NULL;
60: aidescs[2] = SPAWN_NULL;
61:
62: /* We pass fsetuid and fshell as TRUE, which permits uucico and
63: uuxqt to be replaced by (non-setuid) shell scripts. */
64: ipid = ixsspawn (azargs, aidescs, TRUE, FALSE, (const char *) NULL,
65: FALSE, TRUE, (const char *) NULL,
66: (const char *) NULL, (const char *) NULL);
67: ubuffree (zlib);
68: if (ipid < 0)
69: {
70: ulog (LOG_ERROR, "ixsspawn: %s", strerror (errno));
71: return FALSE;
72: }
73:
74: return TRUE;
75: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.