source: trunk/include/sh_extern.h@ 284

Last change on this file since 284 was 275, checked in by katerina, 15 years ago

Fix for ticket #195 (broken immediate mailing of highest priority messages).

File size: 2.7 KB
RevLine 
[1]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];
[169]12#if 0
[1]13 uid_t trusted_users[32];
[169]14#endif
[1]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/*
[275]39 * -- generic simple safe popen; returns 0 on success, -1 otherwise,
40 * executes shell command
41 */
42int sh_ext_popen_init (sh_tas_t * task, char * command);
43
44/*
[211]45 * -- Execute command, return first line of output
46 */
47char * sh_ext_popen_str (char * command);
48
49/*
[1]50 * -- close the pipe, clear and return task->exit_status
51 */
52int sh_ext_pclose (sh_tas_t * task);
53
54/*
55 * -- add CL argument, return # of arguments
56 */
[22]57int sh_ext_tas_add_argv(sh_tas_t * tas, const char * val);
[1]58/*
59 * -- remove last CL argument
60 */
61int sh_ext_tas_rm_argv(sh_tas_t * tas);
62/*
63 * -- add environment variable, return # of variables
64 */
[22]65int sh_ext_tas_add_envv(sh_tas_t * tas, const char * key, const char * val);
[1]66/*
67 * -- set command
68 */
[22]69void sh_ext_tas_command(sh_tas_t * tas, const char * command);
[1]70/*
71 * -- initialize task structure
72 */
73void sh_ext_tas_init (sh_tas_t * tas);
74/*
75 * -- free task structure
76 */
77void sh_ext_tas_free(sh_tas_t * tas);
78
79
80#if defined(WITH_EXTERNAL)
81
82/*
83 * -- start a new external command, and add it to the list
84 */
[22]85int sh_ext_setcommand(const char * cmd);
[1]86
[164]87/*
88 * -- explicitely close a command
89 */
90int sh_ext_close_command (const char * str);
91
[1]92/*
93 * -- clean up the command list
94 */
95int sh_ext_cleanup(void);
96
97/*
98 * -- set deadtime
99 */
[22]100int sh_ext_deadtime (const char * str);
[1]101
102/*
103 * -- add keywords to the OR filter
104 */
[22]105int sh_ext_add_or (const char * str);
[1]106
107/*
108 * -- add keywords to the AND filter
109 */
[22]110int sh_ext_add_and (const char * str);
[1]111
112/*
113 * -- add keywords to the NOT filter
114 */
[22]115int sh_ext_add_not (const char * str);
[1]116
117/*
118 * -- add keywords to the CL argument list
119 */
[22]120int sh_ext_add_argv (const char * str);
[1]121
122/*
123 * -- add a path to the environment
124 */
[22]125int sh_ext_add_default (const char * str);
[1]126
127/*
128 * -- add an environment variable
129 */
[22]130int sh_ext_add_environ (const char * str);
[1]131
132/*
133 * -- define type
134 */
[22]135int sh_ext_type (const char * str);
[1]136
137/*
138 * -- define checksum
139 */
[22]140int sh_ext_checksum (const char * str);
[1]141
142/*
143 * -- choose privileges
144 */
[22]145int sh_ext_priv (const char * c);
[1]146
147/*
148 * -- execute external script/program
149 */
150int sh_ext_execute (char t1, char t2, char t3, /*@null@*/char * message,
151 size_t msg_siz);
152
153#endif
154
155#endif
Note: See TracBrowser for help on using the repository browser.