2 * Copyright (c) 1989 - 1994, Julianne Frances Haugh
3 * Copyright (c) 1996 - 2000, Marek Michałkiewicz
4 * Copyright (c) 2000 - 2006, Tomasz Kłoczko
5 * Copyright (c) 2007 - 2009, Nicolas François
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the copyright holders or contributors may not be used to
17 * endorse or promote products derived from this software without
18 * specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 /* Some parts substantially derived from an ancestor of:
34 su for GNU. Run a shell with substitute user and group IDs.
36 Copyright (C) 1992-2003 Free Software Foundation, Inc.
38 This program is free software; you can redistribute it and/or modify
39 it under the terms of the GNU General Public License as published by
40 the Free Software Foundation; either version 2, or (at your option)
43 This program is distributed in the hope that it will be useful,
44 but WITHOUT ANY WARRANTY; without even the implied warranty of
45 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46 GNU General Public License for more details.
48 You should have received a copy of the GNU General Public License
49 along with this program; if not, write to the Free Software
50 Foundation, Inc., 51 Franklin Street, Fifth Floor,
51 Boston, MA 02110-1301, USA. */
63 #include <sys/types.h>
64 #include "prototypes.h"
72 #include "exitcodes.h"
75 * Assorted #defines to control su's behavior
82 /* not needed by sulog.c anymore */
83 static char name[BUFSIZ];
84 static char oldname[BUFSIZ];
86 /* If nonzero, change some environment vars to indicate the user su'd to. */
87 static bool change_environment;
90 static pam_handle_t *pamh = NULL;
91 static bool caught = false;
94 extern struct passwd pwent;
97 * External identifiers
100 extern char **newenvp;
101 extern char **environ;
102 extern size_t newenvc;
104 /* local function prototypes */
108 static RETSIGTYPE die (int);
109 static int iswheel (const char *);
112 * die - set or reset termio modes.
114 * die() is called before processing begins. signal() is then called
115 * with die() as the signal handler. If signal later calls die() with a
116 * signal number, the terminal modes are then reset.
118 static RETSIGTYPE die (int killed)
133 static int iswheel (const char *username)
137 grp = getgrnam ("wheel"); /* !USE_PAM, no need for xgetgrnam */
139 || (NULL == grp->gr_mem)) {
142 return is_on_list (grp->gr_mem, username);
144 #endif /* !USE_PAM */
146 /* borrowed from GNU sh-utils' "su.c" */
147 static bool restricted_shell (const char *shellstr)
152 while ((line = getusershell ()) != NULL) {
153 if (('#' != *line) && (strcmp (line, shellstr) == 0)) {
162 static void su_failure (const char *tty)
164 sulog (tty, false, oldname, name); /* log failed attempt */
166 if (getdef_bool ("SYSLOG_SU_ENAB")) {
167 SYSLOG (((0 != pwent.pw_uid) ? LOG_INFO : LOG_NOTICE,
169 ('\0' != oldname[0]) ? oldname : "???",
170 ('\0' != name[0]) ? name : "???"));
178 * execve_shell - Execute a shell with execve, or interpret it with
181 void execve_shell (const char *shellstr, char *args[], char *const envp[])
184 (void) execve (shellstr, (char **) args, envp);
187 if (access (shellstr, R_OK|X_OK) == 0) {
189 * Assume this is a shell script (with no shebang).
190 * Interpret it with /bin/sh
194 while (NULL != args[n_args]) {
197 targs = (char **) xmalloc ((n_args + 2) * sizeof (args[0]));
199 targs[1] = xstrdup (shellstr);
200 targs[n_args+1] = NULL;
201 while (1 != n_args) {
202 targs[n_args] = args[n_args - 1];
206 (void) execve (SHELL, targs, envp);
213 /* Signal handler for parent process later */
214 static void catch_signals (unused int sig)
219 /* This I ripped out of su.c from sh-utils after the Mandrake pam patch
220 * have been applied. Some work was needed to get it integrated into
223 static void run_shell (const char *shellstr, char *args[], bool doshell,
232 if (child == 0) { /* child shell */
234 * PAM_DATA_SILENT is not supported by some modules, and
235 * there is no strong need to clean up the process space's
236 * memory since we will either call exec or exit.
237 pam_end (pamh, PAM_SUCCESS | PAM_DATA_SILENT);
241 (void) shell (shellstr, (char *) args[0], envp);
243 execve_shell (shellstr, (char **) args, envp);
246 exit (errno == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
247 } else if ((pid_t)-1 == child) {
248 (void) fprintf (stderr, "%s: Cannot fork user shell\n", Prog);
249 SYSLOG ((LOG_WARN, "Cannot execute %s", shellstr));
254 sigfillset (&ourset);
255 if (sigprocmask (SIG_BLOCK, &ourset, NULL) != 0) {
256 (void) fprintf (stderr, "%s: signal malfunction\n", Prog);
260 struct sigaction action;
262 action.sa_handler = catch_signals;
263 sigemptyset (&action.sa_mask);
265 sigemptyset (&ourset);
267 if ( (sigaddset (&ourset, SIGTERM) != 0)
268 || (sigaddset (&ourset, SIGALRM) != 0)
269 || (sigaction (SIGTERM, &action, NULL) != 0)
270 || (sigprocmask (SIG_UNBLOCK, &ourset, NULL) != 0)
273 "%s: signal masking malfunction\n", Prog);
282 pid = waitpid (-1, &status, WUNTRACED);
284 if (((pid_t)-1 != pid) && (0 != WIFSTOPPED (status))) {
285 /* The child (shell) was suspended.
287 kill (getpid (), WSTOPSIG(status));
288 /* wake child when resumed */
291 } while (0 != WIFSTOPPED (status));
295 fprintf (stderr, "\nSession terminated, killing shell...");
296 kill (child, SIGTERM);
299 ret = pam_close_session (pamh, 0);
300 if (PAM_SUCCESS != ret) {
301 SYSLOG ((LOG_ERR, "pam_close_session: %s",
302 pam_strerror (pamh, ret)));
303 fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret));
304 (void) pam_end (pamh, ret);
308 ret = pam_end (pamh, PAM_SUCCESS);
312 kill (child, SIGKILL);
313 fprintf (stderr, " ...killed.\n");
317 exit ((0 != WIFEXITED (status)) ? WEXITSTATUS (status)
318 : WTERMSIG (status) + 128);
323 * usage - print command line syntax and exit
325 static void usage (void)
327 fputs (_("Usage: su [options] [LOGIN]\n"
330 " -c, --command COMMAND pass COMMAND to the invoked shell\n"
331 " -h, --help display this help message and exit\n"
332 " -, -l, --login make the shell a login shell\n"
334 " --preserve-environment do not reset environment variables, and\n"
335 " keep the same shell\n"
336 " -s, --shell SHELL use SHELL instead of the default in passwd\n"
342 * su - switch user id
344 * su changes the user's ids to the values for the specified user. if
345 * no new user name is specified, "root" or UID 0 is used by default.
347 * Any additional arguments are passed to the user's shell. In
348 * particular, the argument "-c" will cause the next argument to be
349 * interpreted as a command by the common shell programs.
351 int main (int argc, char **argv)
354 const char *tty = NULL; /* Name of tty SU is run from */
355 bool doshell = false;
356 bool fakelogin = false;
359 struct passwd *pw = NULL;
360 char **envp = environ;
361 char *shellstr = NULL;
362 char *command = NULL;
370 RETSIGTYPE (*oldsig) (int);
373 struct spwd *spwd = 0;
378 #endif /* !USE_PAM */
382 (void) setlocale (LC_ALL, "");
383 (void) bindtextdomain (PACKAGE, LOCALEDIR);
384 (void) textdomain (PACKAGE);
386 change_environment = true;
389 * Get the program name. The program name is used as a prefix to
390 * most error messages.
392 Prog = Basename (argv[0]);
397 * Process the command line arguments.
402 * Parse the command line options.
404 int option_index = 0;
406 static struct option long_options[] = {
407 {"command", required_argument, NULL, 'c'},
408 {"help", no_argument, NULL, 'h'},
409 {"login", no_argument, NULL, 'l'},
410 {"preserve-environment", no_argument, NULL, 'p'},
411 {"shell", required_argument, NULL, 's'},
412 {NULL, 0, NULL, '\0'}
416 getopt_long (argc, argv, "c:hlmps:", long_options,
417 &option_index)) != -1) {
430 /* This will only have an effect if the target
431 * user do not have a restricted shell, or if
432 * su is called by root.
434 change_environment = false;
440 usage (); /* NOT REACHED */
444 if ((optind < argc) && (strcmp (argv[optind], "-") == 0)) {
448 && (strcmp (argv[optind], "--") == 0)) {
457 amroot = (my_uid == 0);
460 * Get the tty name. Entries will be logged indicating that the user
461 * tried to change to the named new user from the current terminal.
464 if ((isatty (0) != 0) && (NULL != tty)) {
466 is_console = console (tty);
470 * Be more paranoid, like su from SimplePAMApps. --marekm
474 _("%s: must be run from a terminal\n"), Prog);
481 * The next argument must be either a user ID, or some flag to a
482 * subshell. Pretty sticky since you can't have an argument which
483 * doesn't start with a "-" unless you specify the new user name.
484 * Any remaining arguments will be passed to the user's login shell.
486 if ((optind < argc) && ('-' != argv[optind][0])) {
487 STRFCPY (name, argv[optind++]); /* use this login id */
488 if ((optind < argc) && (strcmp (argv[optind], "--") == 0)) {
492 if ('\0' == name[0]) { /* use default user */
493 struct passwd *root_pw = getpwnam ("root");
494 if ((NULL != root_pw) && (0 == root_pw->pw_uid)) {
495 (void) strcpy (name, "root");
497 root_pw = getpwuid (0);
498 if (NULL == root_pw) {
499 SYSLOG ((LOG_CRIT, "There is no UID 0 user."));
502 (void) strcpy (name, root_pw->pw_name);
506 doshell = (argc == optind); /* any arguments remaining? */
507 if (NULL != command) {
512 * Get the user's real name. The current UID is used to determine
513 * who has executed su. That user ID must exist.
515 pw = get_my_pwent ();
517 fprintf (stderr, _("%s: Cannot determine your user name.\n"),
519 SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
520 (unsigned long) my_uid));
523 STRFCPY (oldname, pw->pw_name);
528 * Sort out the password of user calling su, in case needed later
531 spwd = getspnam (oldname); /* !USE_PAM, no need for xgetspnam */
533 pw->pw_passwd = spwd->sp_pwdp;
535 oldpass = xstrdup (pw->pw_passwd);
536 #endif /* SU_ACCESS */
539 ret = pam_start ("su", name, &conv, &pamh);
540 if (PAM_SUCCESS != ret) {
541 SYSLOG ((LOG_ERR, "pam_start: error %d", ret);
542 fprintf (stderr, _("%s: pam_start: error %d\n"),
547 ret = pam_set_item (pamh, PAM_TTY, (const void *) tty);
548 if (PAM_SUCCESS == ret) {
549 ret = pam_set_item (pamh, PAM_RUSER, (const void *) oldname);
551 if (PAM_SUCCESS != ret) {
552 SYSLOG ((LOG_ERR, "pam_set_item: %s",
553 pam_strerror (pamh, ret)));
554 fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret));
562 * This is the common point for validating a user whose name is
563 * known. It will be reached either by normal processing, or if the
564 * user is to be logged into a subsystem root.
566 * The password file entries for the user is gotten and the account
569 pw = xgetpwnam (name);
571 (void) fprintf (stderr, _("Unknown id: %s\n"), name);
577 if (strcmp (pw->pw_passwd, SHADOW_PASSWD_STRING) == 0) {
578 spwd = getspnam (name); /* !USE_PAM, no need for xgetspnam */
580 pw->pw_passwd = spwd->sp_pwdp;
583 #endif /* !USE_PAM */
586 /* If su is not called by root, and the target user has a restricted
587 * shell, the environment must be changed.
589 change_environment |= (restricted_shell (pwent.pw_shell) && !amroot);
592 * If a new login is being set up, the old environment will be
593 * ignored and a new one created later on.
594 * (note: in the case of a subsystem, the shell will be restricted,
595 * and this won't be executed on the first pass)
597 if (change_environment && fakelogin) {
599 * The terminal type will be left alone if it is present in
600 * the environment already.
602 cp = getenv ("TERM");
608 * For some terminals COLORTERM seems to be the only way
609 * for checking for that specific terminal. For instance,
610 * gnome-terminal sets its TERM as "xterm" but its
611 * COLORTERM as "gnome-terminal". The COLORTERM variable
612 * is also of use when running GNU screen since it sets
613 * TERM to "screen" but doesn't touch COLORTERM.
615 cp = getenv ("COLORTERM");
617 addenv ("COLORTERM", cp);
621 cp = getdef_str ("ENV_TZ");
623 addenv (('/' == *cp) ? tz (cp) : cp, NULL);
627 * The clock frequency will be reset to the login value if required
629 cp = getdef_str ("ENV_HZ");
631 addenv (cp, NULL); /* set the default $HZ, if one */
633 #endif /* !USE_PAM */
636 * Also leave DISPLAY and XAUTHORITY if present, else
637 * pam_xauth will not work.
639 cp = getenv ("DISPLAY");
641 addenv ("DISPLAY", cp);
643 cp = getenv ("XAUTHORITY");
645 addenv ("XAUTHORITY", cp);
648 while (NULL != *envp) {
649 addenv (*envp, NULL);
656 * BSD systems only allow "wheel" to SU to root. USG systems don't,
657 * so we make this a configurable option.
660 /* The original Shadow 3.3.2 did this differently. Do it like BSD:
662 * - check for UID 0 instead of name "root" - there are systems with
663 * several root accounts under different names,
665 * - check the contents of /etc/group instead of the current group
666 * set (you must be listed as a member, GID 0 is not sufficient).
668 * In addition to this traditional feature, we now have complete su
669 * access control (allow, deny, no password, own password). Thanks
670 * to Chris Evans <lady0110@sable.ox.ac.uk>.
674 if ( (0 == pwent.pw_uid)
675 && getdef_bool ("SU_WHEEL_ONLY")
676 && !iswheel (oldname)) {
678 _("You are not authorized to su %s\n"), name);
682 switch (check_su_auth (oldname, name)) {
683 case 0: /* normal su, require target user's password */
685 case 1: /* require no password */
686 pwent.pw_passwd = ""; /* XXX warning: const */
688 case 2: /* require own password */
689 puts (_("(Enter your own password)"));
690 pwent.pw_passwd = oldpass;
692 default: /* access denied (-1) or unexpected value */
694 _("You are not authorized to su %s\n"), name);
697 #endif /* SU_ACCESS */
699 #endif /* !USE_PAM */
701 /* If the user do not want to change the environment,
702 * use the current SHELL.
703 * (unless another shell is required by the command line)
705 if ((NULL == shellstr) && !change_environment) {
706 shellstr = getenv ("SHELL");
708 /* For users with non null UID, if this user has a restricted
709 * shell, the shell must be the one specified in /etc/passwd
711 if ( (NULL != shellstr)
713 && restricted_shell (pwent.pw_shell)) {
716 /* If the shell is not set at this time, use the shell specified
719 if (NULL == shellstr) {
720 shellstr = (char *) strdup (pwent.pw_shell);
724 * Set the default shell.
726 if ((NULL == shellstr) || ('\0' == shellstr[0])) {
730 (void) signal (SIGINT, SIG_IGN);
731 (void) signal (SIGQUIT, SIG_IGN);
733 ret = pam_authenticate (pamh, 0);
734 if (PAM_SUCCESS != ret) {
735 SYSLOG ((LOG_ERR, "pam_authenticate: %s",
736 pam_strerror (pamh, ret)));
737 fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret));
738 (void) pam_end (pamh, ret);
742 ret = pam_acct_mgmt (pamh, 0);
743 if (PAM_SUCCESS != ret) {
745 fprintf (stderr, _("%s: %s\n(Ignored)\n"), Prog,
746 pam_strerror (pamh, ret));
747 } else if (PAM_NEW_AUTHTOK_REQD == ret) {
748 ret = pam_chauthtok (pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
749 if (PAM_SUCCESS != ret) {
750 SYSLOG ((LOG_ERR, "pam_chauthtok: %s",
751 pam_strerror (pamh, ret)));
752 fprintf (stderr, _("%s: %s\n"), Prog,
753 pam_strerror (pamh, ret));
754 (void) pam_end (pamh, ret);
758 SYSLOG ((LOG_ERR, "pam_acct_mgmt: %s",
759 pam_strerror (pamh, ret)));
760 fprintf (stderr, _("%s: %s\n"), Prog,
761 pam_strerror (pamh, ret));
762 (void) pam_end (pamh, ret);
768 * Set up a signal handler in case the user types QUIT.
771 oldsig = signal (SIGQUIT, die);
774 * See if the system defined authentication method is being used.
775 * The first character of an administrator defined method is an '@'
778 if (!amroot && pw_auth (pwent.pw_passwd, name, PW_SU, (char *) 0)) {
779 SYSLOG ((pwent.pw_uid ? LOG_NOTICE : LOG_WARN,
780 "Authentication failed for %s", name));
781 fprintf(stderr, _("%s: Authentication failure\n"), Prog);
784 (void) signal (SIGQUIT, oldsig);
787 * Check to see if the account is expired. root gets to ignore any
788 * expired accounts, but normal users can't become a user with an
793 spwd = pwd_to_spwd (&pwent);
796 if (expire (&pwent, spwd)) {
797 /* !USE_PAM, no need for xgetpwnam */
798 struct passwd *pwd = getpwnam (name);
800 /* !USE_PAM, no need for xgetspnam */
801 spwd = getspnam (name);
809 * Check to see if the account permits "su". root gets to ignore any
810 * restricted accounts, but normal users can't become a user if
811 * there is a "SU" entry in the /etc/porttime file denying access to
815 if (!isttytime (pwent.pw_name, "SU", time ((time_t *) 0))) {
816 SYSLOG (((0 != pwent.pw_uid) ? LOG_WARN : LOG_CRIT,
817 "SU by %s to restricted account %s",
820 _("%s: You are not authorized to su at that time\n"), Prog);
824 #endif /* !USE_PAM */
826 (void) signal (SIGINT, SIG_DFL);
827 (void) signal (SIGQUIT, SIG_DFL);
829 cp = getdef_str ((pwent.pw_uid == 0) ? "ENV_SUPATH" : "ENV_PATH");
831 addenv ("PATH=/bin:/usr/bin", NULL);
832 } else if (strchr (cp, '=') != NULL) {
838 if (getenv ("IFS") != NULL) { /* don't export user IFS ... */
839 addenv ("IFS= \t\n", NULL); /* ... instead, set a safe IFS */
843 * Even if --shell is specified, the subsystem login test is based on
844 * the shell specified in /etc/passwd (not the one specified with
845 * --shell, which will be the one executed in the chroot later).
847 if ('*' == pwent.pw_shell[0]) { /* subsystem root required */
848 pwent.pw_shell++; /* skip the '*' */
849 subsystem (&pwent); /* figure out what to execute */
855 sulog (tty, true, oldname, name); /* save SU information */
859 if (getdef_bool ("SYSLOG_SU_ENAB")) {
860 SYSLOG ((LOG_INFO, "+ %s %s:%s", tty,
861 ('\0' != oldname[0]) ? oldname : "???",
862 ('\0' != name[0]) ? name : "???"));
867 /* set primary group id and supplementary groups */
868 if (setup_groups (&pwent) != 0) {
869 pam_end (pamh, PAM_ABORT);
874 * pam_setcred() may do things like resource limits, console groups,
875 * and much more, depending on the configured modules
877 ret = pam_setcred (pamh, PAM_ESTABLISH_CRED);
878 if (PAM_SUCCESS != ret) {
879 SYSLOG ((LOG_ERR, "pam_setcred: %s", pam_strerror (pamh, ret)));
880 fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret));
881 (void) pam_end (pamh, ret);
885 ret = pam_open_session (pamh, 0);
886 if (PAM_SUCCESS != ret) {
887 SYSLOG ((LOG_ERR, "pam_open_session: %s",
888 pam_strerror (pamh, ret)));
889 fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret));
890 pam_setcred (pamh, PAM_DELETE_CRED);
891 (void) pam_end (pamh, ret);
895 if (change_environment) {
896 /* we need to setup the environment *after* pam_open_session(),
897 * else the UID is changed before stuff like pam_xauth could
898 * run, and we cannot access /etc/shadow and co
900 environ = newenvp; /* make new environment active */
902 /* update environment with all pam set variables */
903 envcp = pam_getenvlist (pamh);
905 while (NULL != *envcp) {
906 addenv (*envcp, NULL);
912 /* become the new user */
913 if (change_uid (&pwent) != 0) {
914 pam_close_session (pamh, 0);
915 pam_setcred (pamh, PAM_DELETE_CRED);
916 (void) pam_end (pamh, PAM_ABORT);
920 environ = newenvp; /* make new environment active */
922 /* no limits if su from root (unless su must fake login's behavior) */
923 if (!amroot || fakelogin) {
924 setup_limits (&pwent);
927 if (setup_uid_gid (&pwent, is_console) != 0) {
930 #endif /* !USE_PAM */
932 if (change_environment) {
934 pwent.pw_shell = shellstr;
937 addenv ("HOME", pwent.pw_dir);
938 addenv ("USER", pwent.pw_name);
939 addenv ("LOGNAME", pwent.pw_name);
940 addenv ("SHELL", shellstr);
945 * This is a workaround for Linux libc bug/feature (?) - the
946 * /dev/log file descriptor is open without the close-on-exec flag
947 * and used to be passed to the new shell. There is "fcntl(LogFile,
948 * F_SETFD, 1)" in libc/misc/syslog.c, but it is commented out (at
949 * least in 5.4.33). Why? --marekm
954 * See if the user has extra arguments on the command line. In that
955 * case they will be provided to the new user's shell as arguments.
960 cp = getdef_str ("SU_NAME");
962 cp = Basename (shellstr);
965 arg0 = xmalloc (strlen (cp) + 2);
967 strcpy (arg0 + 1, cp);
970 cp = Basename (shellstr);
974 /* Position argv to the remaining arguments */
976 if (NULL != command) {
982 * Use the shell and create an argv
983 * with the rest of the command line included.
987 execve_shell (shellstr, &argv[-1], environ);
989 (void) fputs (_("No shell\n"), stderr);
990 SYSLOG ((LOG_WARN, "Cannot execute %s", shellstr));
992 exit ((ENOENT == err) ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
994 run_shell (shellstr, &argv[-1], false, environ); /* no return */
998 err = shell (shellstr, cp, environ);
999 exit ((ENOENT == err) ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
1001 run_shell (shellstr, &cp, true, environ);