source: trunk/include/sh_extern.h@ 130

Last change on this file since 130 was 22, checked in by rainer, 19 years ago

Minor code revisions.

File size: 2.4 KB
Line 
1#ifndef SH_EXTERN_H
2#define SH_EXTERN_H
3
4typedef struct
5{
6 char * command;
7 int argc;
8 char * argv[32];
9 int envc;
10 char * envv[32];
11 char checksum[KEY_LEN + 1];
12
13 uid_t trusted_users[32];
14 uid_t run_user_uid;
15 gid_t run_user_gid;
16 int privileged;
17
18 int pipeFD;
19 SL_TICKET pipeTI;
20 pid_t pid;
21 FILE * pipe;
22 char rw;
23 int exit_status;
24 int fork_twice;
25
26 int com_fd;
27 SL_TICKET com_ti;
28
29} sh_tas_t;
30
31
32/*
33 * -- generic safe popen; returns 0 on success, -1 otherwise
34 */
35int sh_ext_popen (sh_tas_t * task);
36
37/*
38 * -- close the pipe, clear and return task->exit_status
39 */
40int sh_ext_pclose (sh_tas_t * task);
41
42/*
43 * -- add CL argument, return # of arguments
44 */
45int sh_ext_tas_add_argv(sh_tas_t * tas, const char * val);
46/*
47 * -- remove last CL argument
48 */
49int sh_ext_tas_rm_argv(sh_tas_t * tas);
50/*
51 * -- add environment variable, return # of variables
52 */
53int sh_ext_tas_add_envv(sh_tas_t * tas, const char * key, const char * val);
54/*
55 * -- set command
56 */
57void sh_ext_tas_command(sh_tas_t * tas, const char * command);
58/*
59 * -- initialize task structure
60 */
61void sh_ext_tas_init (sh_tas_t * tas);
62/*
63 * -- free task structure
64 */
65void sh_ext_tas_free(sh_tas_t * tas);
66
67
68#if defined(WITH_EXTERNAL)
69
70/*
71 * -- start a new external command, and add it to the list
72 */
73int sh_ext_setcommand(const char * cmd);
74
75/*
76 * -- clean up the command list
77 */
78int sh_ext_cleanup(void);
79
80/*
81 * -- set deadtime
82 */
83int sh_ext_deadtime (const char * str);
84
85/*
86 * -- add keywords to the OR filter
87 */
88int sh_ext_add_or (const char * str);
89
90/*
91 * -- add keywords to the AND filter
92 */
93int sh_ext_add_and (const char * str);
94
95/*
96 * -- add keywords to the NOT filter
97 */
98int sh_ext_add_not (const char * str);
99
100/*
101 * -- add keywords to the CL argument list
102 */
103int sh_ext_add_argv (const char * str);
104
105/*
106 * -- add a path to the environment
107 */
108int sh_ext_add_default (const char * str);
109
110/*
111 * -- add an environment variable
112 */
113int sh_ext_add_environ (const char * str);
114
115/*
116 * -- define type
117 */
118int sh_ext_type (const char * str);
119
120/*
121 * -- define checksum
122 */
123int sh_ext_checksum (const char * str);
124
125/*
126 * -- choose privileges
127 */
128int sh_ext_priv (const char * c);
129
130/*
131 * -- execute external script/program
132 */
133int sh_ext_execute (char t1, char t2, char t3, /*@null@*/char * message,
134 size_t msg_siz);
135
136#endif
137
138#endif
Note: See TracBrowser for help on using the repository browser.