1: /*
2: * Copyright (c) 2010-2013 Todd C. Miller <Todd.Miller@courtesan.com>
3: *
4: * Permission to use, copy, modify, and distribute this software for any
5: * purpose with or without fee is hereby granted, provided that the above
6: * copyright notice and this permission notice appear in all copies.
7: *
8: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15: */
16:
17: #ifndef _SUDO_EXEC_H
18: #define _SUDO_EXEC_H
19:
20: /*
21: * Older systems may not support MSG_WAITALL but it shouldn't really be needed.
22: */
23: #ifndef MSG_WAITALL
24: # define MSG_WAITALL 0
25: #endif
26:
27: /*
28: * Special values to indicate whether continuing in foreground or background.
29: */
30: #define SIGCONT_FG -2
31: #define SIGCONT_BG -3
32:
33: /*
34: * Positions in saved_signals[]
35: */
36: #define SAVED_SIGALRM 0
37: #define SAVED_SIGCHLD 1
38: #define SAVED_SIGCONT 2
39: #define SAVED_SIGHUP 3
40: #define SAVED_SIGINT 4
41: #define SAVED_SIGPIPE 5
42: #define SAVED_SIGQUIT 6
43: #define SAVED_SIGTERM 7
44: #define SAVED_SIGTSTP 8
45: #define SAVED_SIGTTIN 9
46: #define SAVED_SIGTTOU 10
47: #define SAVED_SIGUSR1 11
48: #define SAVED_SIGUSR2 12
49:
50: /*
51: * Symbols shared between exec.c and exec_pty.c
52: */
53:
54: /* exec.c */
55: struct sudo_event_base;
56: int sudo_execve(const char *path, char *const argv[], char *const envp[], bool noexec);
57: extern volatile pid_t cmnd_pid;
58:
59: /* exec_pty.c */
60: struct command_details;
61: struct command_status;
62: int fork_pty(struct command_details *details, int sv[], sigset_t *omask);
63: int suspend_parent(int signo);
64: void exec_cmnd(struct command_details *details, struct command_status *cstat,
65: int errfd);
66: void add_io_events(struct sudo_event_base *evbase);
67: #ifdef SA_SIGINFO
68: void handler(int s, siginfo_t *info, void *context);
69: #else
70: void handler(int s);
71: #endif
72: void pty_close(struct command_status *cstat);
73: void pty_setup(uid_t uid, const char *tty, const char *utmp_user);
74: void terminate_command(pid_t pid, bool use_pgrp);
75:
76: /* utmp.c */
77: bool utmp_login(const char *from_line, const char *to_line, int ttyfd,
78: const char *user);
79: bool utmp_logout(const char *line, int status);
80:
81: #endif /* _SUDO_EXEC_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>