source: trunk/include/sh_extern.h@ 172

Last change on this file since 172 was 169, checked in by katerina, 17 years ago

Fixes for tickes #93 to #104 (yes, big commit, bad, bad,...).

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