Rev 8155 | Rev 8343 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8155 | Rev 8185 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | * |
12 | * |
13 | * You should have received a copy of the GNU General Public License |
13 | * You should have received a copy of the GNU General Public License |
14 | * along with this program; if not, write to the Free Software |
14 | * along with this program; if not, write to the Free Software |
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | */ |
16 | */ |
- | 17 | ||
17 | /* line input / output / translation routines |
18 | /* line input / output / translation routines |
18 | * and error routines |
19 | * and error routines |
19 | */ |
20 | */ |
- | 21 | #include <utime.h> |
|
- | 22 | #include <sys/socket.h> |
|
- | 23 | #include <sys/un.h> |
|
- | 24 | ||
- | 25 | #include "wims.h" |
|
20 | 26 | ||
21 | int is_class_module=0; |
27 | int is_class_module=0; |
22 | 28 | ||
23 | int trusted_module(void); |
29 | int trusted_module(void); |
24 | void phtml_put_base(char *fname,int cache); |
30 | void phtml_put_base(char *fname,int cache); |
25 | void module_error(char msg[]); |
31 | void module_error(char msg[]); |
26 | void user_error(char msg[]); |
32 | void user_error(char msg[]); |
Line 38... | Line 44... | ||
38 | char lastftest[MAX_FNAME+1]; |
44 | char lastftest[MAX_FNAME+1]; |
39 | int lastftype; |
45 | int lastftype; |
40 | char outbuf[8192]; |
46 | char outbuf[8192]; |
41 | char *outptr; |
47 | char *outptr; |
42 | 48 | ||
43 |
|
49 | /* These modules can execute private programs. |
44 |
|
50 | * adm/ modules are always trusted, so need no definition here. |
- | 51 | */ |
|
45 | char *trusted_modules=""; |
52 | char *trusted_modules=""; |
46 | /* bit 0: module is not trusted. |
53 | /* bit 0: module is not trusted. |
47 | * bit 1: file in wimshome. |
54 | * bit 1: file in wimshome. |
48 | * bit 2: readdef or file in writable directory. |
55 | * bit 2: readdef or file in writable directory. |
49 | */ |
56 | */ |
50 | int untrust=0; /* non-zero if user detrusts the module. */ |
57 | int untrust=0; /* non-zero if user detrusts the module. */ |
51 | 58 | ||
52 | int error_status=0; |
59 | int error_status=0; |
53 | char pidbuf[32]; |
60 | char pidbuf[32]; |
54 | #include <utime.h> |
- | |
55 | 61 | ||
56 | void delete_pid(void); |
62 | void delete_pid(void); |
57 | 63 | ||
58 | /* Internal use only */ |
64 | /* Internal use only */ |
59 | void _debug(char *s,...) |
65 | void _debug(char *s,...) |
Line 148... | Line 154... | ||
148 | snprintf(buf,sizeof(buf),"%s...",p); |
154 | snprintf(buf,sizeof(buf),"%s...",p); |
149 | force_setvar("wims_error_data",buf); |
155 | force_setvar("wims_error_data",buf); |
150 | module_error("file_name_too_long"); |
156 | module_error("file_name_too_long"); |
151 | } |
157 | } |
152 | 158 | ||
153 | enum{is_file, is_dir, is_exec, is_fifo, is_socket, is_unknown}; |
- | |
154 | off_t ftest_size; |
159 | off_t ftest_size; |
155 | 160 | ||
156 | /* A simple front-end of stat(). */ |
161 | /* A simple front-end of stat(). */ |
157 | int ftest(char *fname) |
162 | int ftest(char *fname) |
158 | { |
163 | { |
Line 866... | Line 871... | ||
866 | p=strchr(sbuf,'_'); if(p!=NULL) *p=0; |
871 | p=strchr(sbuf,'_'); if(p!=NULL) *p=0; |
867 | utime(sbuf,&ub); |
872 | utime(sbuf,&ub); |
868 | } |
873 | } |
869 | } |
874 | } |
870 | 875 | ||
871 | struct { |
- | |
872 | char cmd[MAX_EXEC_NAME+1]; |
- | |
873 | unsigned int fd1, fd2; |
- | |
874 | int pipe_stdin[2]; |
- | |
875 | int pipe_stdout[2]; |
- | |
876 | int pipe_stderr[2]; |
- | |
877 |
|
876 | struct mxtab mxtab[MAX_MULTIEXEC]; |
878 | int mxno=0; |
877 | int mxno=0; |
879 | 878 | ||
880 | int execredirected(char *cmdf, char *inf, char *outf, char *errf, char *arg[]) |
879 | int execredirected(char *cmdf, char *inf, char *outf, char *errf, char *arg[]) |
881 | { |
880 | { |
882 | pid_t pid; |
881 | pid_t pid; |