git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@193 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/01/20 19:37:54... | ... |
@@ -1,3 +1,9 @@ |
1 |
+Tue Jan 20 11:34:38 CET 2004 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * clamd: new commands: SESSION, END: SESSION starts a clamd session and |
|
4 |
+ allows to do multiple commands per TCP session. END closes the |
|
5 |
+ session. Requested by Jim Ramsay <i.am*jimramsay.com>. |
|
6 |
+ |
|
1 | 7 |
Fri Jan 16 07:39:55 CET 2004 (tk) |
2 | 8 |
--------------------------------- |
3 | 9 |
* freshclam: removed -c for --config-file (conflicted with -c for --checks). |
... | ... |
@@ -2,6 +2,52 @@ Note: This README/NEWS file refers to the source tarball. Some things described |
2 | 2 |
here may not be available in binary packages. |
3 | 3 |
-- |
4 | 4 |
|
5 |
+0.66 |
|
6 |
+---- |
|
7 |
+ |
|
8 |
+ |
|
9 |
+ |
|
10 |
+Noteworthy changes in this version: |
|
11 |
+ |
|
12 |
+-) clamd: |
|
13 |
+ + fixed a database timestamp handling (and a double reload problem reported |
|
14 |
+ by Alex Pleiner and Ole Stanstrup) |
|
15 |
+ + UseProcesses (use processes instead of threads, warning: untested code) |
|
16 |
+ Also please check James Stevens' nclamd (based on a similar architecture |
|
17 |
+ to Apache) if you prefer processes over threads. |
|
18 |
+ + new directive ArchiveMaxCompressionRatio |
|
19 |
+ + fixed a segmentation fault after database update in on-access scanner |
|
20 | ||
21 |
+ |
|
22 |
+-) clamav-milter: (Nigel Horne) |
|
23 |
+ + added support for AllowSupplementaryGroups and ThreadTimeout |
|
24 |
+ + added --quarantine-dir (thanks to Michael Dankov) |
|
25 |
+ + added --sign option |
|
26 |
+ |
|
27 |
+-) libclamav: |
|
28 |
+ + prevent buffer overflow in broken uuencoded files (Nigel) |
|
29 |
+ + scan multipart alternatives that have no boundaries (Nigel) |
|
30 |
+ + better handling of encapsulated messages (Nigel) |
|
31 |
+ + locate uuencoded viruses hidden in text portions of multipart/mixed |
|
32 |
+ mime messages (Nigel) |
|
33 |
+ + initial support for BinHex (Nigel) |
|
34 |
+ + fixed a mail recursion loop (problem reported by Alex Kah and Kristof |
|
35 |
+ Petr) |
|
36 |
+ + fixed bzip2 memory limit (improper call suggested by the buggy libbz2 |
|
37 |
+ documentation, problem reported by Tomasz Klim) |
|
38 |
+ + fixed on error descriptor leak in CVD unpacker (Thomas Lamy) |
|
39 |
+ + fixed memory leak in digital signature verification code (Thomas Lamy) |
|
40 |
+ + added maximal compression ratio limit (cl_limits->maxratio) |
|
41 |
+ |
|
42 |
+-) clamscan: |
|
43 |
+ + support for multiple arguments on command line (Thomas Lamy) |
|
44 |
+ + fixed a buffer overflow in --move (Denis De Messemacker) |
|
45 |
+ + removed support for sendfile() under Linux |
|
46 |
+ + added --bell |
|
47 |
+ |
|
48 |
+-) freshclam: |
|
49 |
+ + support for freshclam.conf |
|
50 |
+ |
|
5 | 51 |
0.65 |
6 | 52 |
---- |
7 | 53 |
IMPORTANT NOTE: The project has been moved into SourceForge. The only official |
... | ... |
@@ -128,6 +128,8 @@ install_sh = @install_sh@ |
128 | 128 |
@BUILD_CLAMD_TRUE@ tcpserver.h \ |
129 | 129 |
@BUILD_CLAMD_TRUE@ localserver.c \ |
130 | 130 |
@BUILD_CLAMD_TRUE@ localserver.h \ |
131 |
+@BUILD_CLAMD_TRUE@ session.c \ |
|
132 |
+@BUILD_CLAMD_TRUE@ session.h \ |
|
131 | 133 |
@BUILD_CLAMD_TRUE@ server-proc.c \ |
132 | 134 |
@BUILD_CLAMD_TRUE@ server-th.c \ |
133 | 135 |
@BUILD_CLAMD_TRUE@ server.h \ |
... | ... |
@@ -158,10 +160,11 @@ PROGRAMS = $(sbin_PROGRAMS) |
158 | 158 |
|
159 | 159 |
@BUILD_CLAMD_TRUE@am_clamd_OBJECTS = options.$(OBJEXT) cfgfile.$(OBJEXT) \ |
160 | 160 |
@BUILD_CLAMD_TRUE@ clamd.$(OBJEXT) tcpserver.$(OBJEXT) \ |
161 |
-@BUILD_CLAMD_TRUE@ localserver.$(OBJEXT) server-proc.$(OBJEXT) \ |
|
162 |
-@BUILD_CLAMD_TRUE@ server-th.$(OBJEXT) scanner.$(OBJEXT) \ |
|
163 |
-@BUILD_CLAMD_TRUE@ others.$(OBJEXT) clamuko.$(OBJEXT) \ |
|
164 |
-@BUILD_CLAMD_TRUE@ dazukoio.$(OBJEXT) tests.$(OBJEXT) |
|
161 |
+@BUILD_CLAMD_TRUE@ localserver.$(OBJEXT) session.$(OBJEXT) \ |
|
162 |
+@BUILD_CLAMD_TRUE@ server-proc.$(OBJEXT) server-th.$(OBJEXT) \ |
|
163 |
+@BUILD_CLAMD_TRUE@ scanner.$(OBJEXT) others.$(OBJEXT) \ |
|
164 |
+@BUILD_CLAMD_TRUE@ clamuko.$(OBJEXT) dazukoio.$(OBJEXT) \ |
|
165 |
+@BUILD_CLAMD_TRUE@ tests.$(OBJEXT) |
|
165 | 166 |
clamd_OBJECTS = $(am_clamd_OBJECTS) |
166 | 167 |
@BUILD_CLAMD_TRUE@clamd_DEPENDENCIES = ../clamscan/getopt.o |
167 | 168 |
@BUILD_CLAMD_FALSE@clamd_DEPENDENCIES = |
... | ... |
@@ -176,7 +179,8 @@ am__depfiles_maybe = depfiles |
176 | 176 |
@AMDEP_TRUE@ ./$(DEPDIR)/localserver.Po ./$(DEPDIR)/options.Po \ |
177 | 177 |
@AMDEP_TRUE@ ./$(DEPDIR)/others.Po ./$(DEPDIR)/scanner.Po \ |
178 | 178 |
@AMDEP_TRUE@ ./$(DEPDIR)/server-proc.Po ./$(DEPDIR)/server-th.Po \ |
179 |
-@AMDEP_TRUE@ ./$(DEPDIR)/tcpserver.Po ./$(DEPDIR)/tests.Po |
|
179 |
+@AMDEP_TRUE@ ./$(DEPDIR)/session.Po ./$(DEPDIR)/tcpserver.Po \ |
|
180 |
+@AMDEP_TRUE@ ./$(DEPDIR)/tests.Po |
|
180 | 181 |
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ |
181 | 182 |
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
182 | 183 |
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ |
... | ... |
@@ -245,6 +249,7 @@ distclean-compile: |
245 | 245 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanner.Po@am__quote@ |
246 | 246 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server-proc.Po@am__quote@ |
247 | 247 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server-th.Po@am__quote@ |
248 |
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/session.Po@am__quote@ |
|
248 | 249 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpserver.Po@am__quote@ |
249 | 250 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tests.Po@am__quote@ |
250 | 251 |
|
... | ... |
@@ -207,10 +207,10 @@ void clamd(struct optstruct *opt) |
207 | 207 |
else |
208 | 208 |
ret = localserver(opt, copt, root); |
209 | 209 |
|
210 |
- cli_dbgmsg("*server ended; result=%d\n", ret); |
|
210 |
+ printf("server ended; result=%d\n", ret); |
|
211 | 211 |
logg_close(); |
212 | 212 |
freecfg(copt); |
213 |
- cli_dbgmsg("*free() copt\n"); |
|
213 |
+ printf("free() copt\n"); |
|
214 | 214 |
|
215 | 215 |
} |
216 | 216 |
|
... | ... |
@@ -219,7 +219,7 @@ void help(void) |
219 | 219 |
|
220 | 220 |
printf("\n"); |
221 | 221 |
printf(" Clam AntiVirus Daemon "VERSION"\n"); |
222 |
- printf(" (c) 2002, 2003 Tomasz Kojm <tkojm@clamav.net>\n\n"); |
|
222 |
+ printf(" (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net>\n\n"); |
|
223 | 223 |
|
224 | 224 |
printf(" --help -h Show this help.\n"); |
225 | 225 |
printf(" --version -V Show version number.\n"); |
... | ... |
@@ -43,8 +43,6 @@ |
43 | 43 |
#define CMD6 "CONTSCAN" |
44 | 44 |
#define CMD7 "VERSION" |
45 | 45 |
#define CMD8 "STREAM" |
46 |
-#define CMD9 "STREAM2" |
|
47 |
- |
|
48 | 46 |
|
49 | 47 |
int procscan(const char *name, const struct cl_node *root, const struct cl_limits *limits, int options, const struct cfgstruct *copt, int odesc, short contscan) |
50 | 48 |
{ |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
/* |
2 |
- * Copyright (C) 2002, 2003 Tomasz Kojm <zolw@konarski.edu.pl> |
|
2 |
+ * Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net> |
|
3 | 3 |
* |
4 | 4 |
* This program is free software; you can redistribute it and/or modify |
5 | 5 |
* it under the terms of the GNU General Public License as published by |
... | ... |
@@ -33,85 +33,41 @@ |
33 | 33 |
#include "server.h" |
34 | 34 |
#include "clamuko.h" |
35 | 35 |
#include "tests.h" |
36 |
- |
|
37 |
-#define THREXIT \ |
|
38 |
- close(ths[tharg->sid].desc); \ |
|
39 |
- ths[tharg->sid].active = 0; \ |
|
40 |
- /* this mutex is rather useless */ \ |
|
41 |
- /* pthread_mutex_unlock(&ths[tharg->sid].mutex); */ \ |
|
42 |
- free(tharg); \ |
|
43 |
- return NULL |
|
44 |
- |
|
45 |
-#define CMD1 "SCAN" |
|
46 |
-#define CMD2 "RAWSCAN" |
|
47 |
-#define CMD3 "QUIT" |
|
48 |
-#define CMD4 "RELOAD" |
|
49 |
-#define CMD5 "PING" |
|
50 |
-#define CMD6 "CONTSCAN" |
|
51 |
-#define CMD7 "VERSION" |
|
52 |
-#define CMD8 "STREAM" |
|
53 |
-#define CMD9 "STREAM2" |
|
36 |
+#include "session.h" |
|
54 | 37 |
|
55 | 38 |
#ifdef CLAMUKO |
56 | 39 |
pthread_t clamukoid; |
57 | 40 |
#endif |
58 | 41 |
|
42 |
+ |
|
59 | 43 |
void *threadscanner(void *arg) |
60 | 44 |
{ |
61 | 45 |
struct thrarg *tharg = (struct thrarg *) arg; |
62 |
- char buff[32769]; |
|
63 | 46 |
sigset_t sigset; |
64 |
- int bread, options; |
|
65 |
- |
|
47 |
+ int ret; |
|
66 | 48 |
|
67 | 49 |
/* ignore all signals */ |
68 | 50 |
sigfillset(&sigset); |
69 | 51 |
pthread_sigmask(SIG_SETMASK, &sigset, NULL); |
70 | 52 |
|
71 |
- if((bread = read(ths[tharg->sid].desc, buff, 1024)) == -1) { |
|
72 |
- logg("!Session(%d): read() failed.\n", tharg->sid); |
|
73 |
- THREXIT; |
|
74 |
- } |
|
75 |
- |
|
76 |
- buff[bread] = 0; |
|
77 |
- chomp(buff); |
|
78 |
- |
|
79 |
- if(!strncmp(buff, CMD1, strlen(CMD1))) { /* SCAN */ |
|
80 |
- scan(buff + strlen(CMD1) + 1, NULL, tharg->root, tharg->limits, tharg->options, tharg->copt, ths[tharg->sid].desc, 0); |
|
81 |
- |
|
82 |
- } else if(!strncmp(buff, CMD2, strlen(CMD2))) { /* RAWSCAN */ |
|
83 |
- options = tharg->options & ~CL_ARCHIVE; |
|
84 |
- scan(buff + strlen(CMD2) + 1, NULL, tharg->root, NULL, options, tharg->copt, ths[tharg->sid].desc, 0); |
|
85 |
- |
|
86 |
- } else if(!strncmp(buff, CMD3, strlen(CMD3))) { /* QUIT */ |
|
87 |
- if(!progexit) { |
|
88 |
- /* was: kill(progpid, SIGTERM); |
|
89 |
- * Now we break out of the loop to clean up resources |
|
90 |
- * thomas@in-online.net 20031201 */ |
|
91 |
- progexit=1; |
|
92 |
- } |
|
93 |
- |
|
94 |
- } else if(!strncmp(buff, CMD4, strlen(CMD4))) { /* RELOAD */ |
|
95 |
- mdprintf(ths[tharg->sid].desc, "RELOADING\n"); |
|
96 |
- reload = 1; |
|
97 |
- |
|
98 |
- } else if(!strncmp(buff, CMD5, strlen(CMD5))) { /* PING */ |
|
99 |
- mdprintf(ths[tharg->sid].desc, "PONG\n"); |
|
100 |
- |
|
101 |
- } else if(!strncmp(buff, CMD6, strlen(CMD6))) { /* CONTSCAN */ |
|
102 |
- scan(buff + strlen(CMD6) + 1, NULL, tharg->root, tharg->limits, tharg->options, tharg->copt, ths[tharg->sid].desc, 1); |
|
53 |
+ ret = command(ths[tharg->sid].desc, tharg->root, tharg->limits, tharg->options, tharg->copt); |
|
103 | 54 |
|
104 |
- } else if(!strncmp(buff, CMD7, strlen(CMD7))) { /* VERSION */ |
|
105 |
- mdprintf(ths[tharg->sid].desc, "clamd / ClamAV version "VERSION"\n"); |
|
55 |
+ switch(ret) { |
|
56 |
+ case COMMAND_QUIT: |
|
57 |
+ progexit = 1; |
|
58 |
+ break; |
|
106 | 59 |
|
107 |
- } else if(!strncmp(buff, CMD8, strlen(CMD8))) { /* STREAM */ |
|
108 |
- scanstream(ths[tharg->sid].desc, NULL, tharg->root, tharg->limits, tharg->options, tharg->copt); |
|
60 |
+ case COMMAND_RELOAD: |
|
61 |
+ reload = 1; |
|
62 |
+ break; |
|
109 | 63 |
} |
110 |
- /* else if(!strncmp(buff, CMD9, strlen(CMD9))) { |
|
111 |
- scanstream2(ths[tharg->sid].desc, NULL, tharg->root, tharg->limits, tharg->options, tharg->copt); |
|
112 |
- }*/ |
|
113 | 64 |
|
114 |
- THREXIT; |
|
65 |
+ close(ths[tharg->sid].desc); |
|
66 |
+ ths[tharg->sid].active = 0; |
|
67 |
+ /* this mutex is rather useless */ |
|
68 |
+ /* pthread_mutex_unlock(&ths[tharg->sid].mutex); */ |
|
69 |
+ free(tharg); |
|
70 |
+ return NULL; |
|
115 | 71 |
} |
116 | 72 |
|
117 | 73 |
/* this function takes care for threads, exit and various checks */ |
... | ... |
@@ -186,7 +142,7 @@ void *threadwatcher(void *arg) |
186 | 186 |
close(ths[i].desc); |
187 | 187 |
logg("Session %d stopped due to timeout.\n", i); |
188 | 188 |
ths[i].active = 0; |
189 |
-// pthread_mutex_unlock(&ths[i].mutex); |
|
189 |
+ /* pthread_mutex_unlock(&ths[i].mutex); */ |
|
190 | 190 |
} |
191 | 191 |
|
192 | 192 |
/* cancel all threads in case of quit */ |
... | ... |
@@ -212,7 +168,7 @@ void *threadwatcher(void *arg) |
212 | 212 |
mdprintf(ths[j].desc, "Session(%d): Stopped (exiting)\n", j); |
213 | 213 |
close(ths[j].desc); |
214 | 214 |
logg("Session %d stopped (exiting).\n", j); |
215 |
-// pthread_mutex_unlock(&ths[j].mutex); |
|
215 |
+ /* pthread_mutex_unlock(&ths[j].mutex); */ |
|
216 | 216 |
} |
217 | 217 |
#ifndef C_BSD |
218 | 218 |
logg("*Freeing trie structure.\n"); |
219 | 219 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,129 @@ |
0 |
+/* |
|
1 |
+ * Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net> |
|
2 |
+ * |
|
3 |
+ * This program is free software; you can redistribute it and/or modify |
|
4 |
+ * it under the terms of the GNU General Public License as published by |
|
5 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
6 |
+ * (at your option) any later version. |
|
7 |
+ * |
|
8 |
+ * This program is distributed in the hope that it will be useful, |
|
9 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 |
+ * GNU General Public License for more details. |
|
12 |
+ * |
|
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 |
|
15 |
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
16 |
+ */ |
|
17 |
+ |
|
18 |
+#include <stdio.h> |
|
19 |
+#include <stdlib.h> |
|
20 |
+#include <string.h> |
|
21 |
+#include <unistd.h> |
|
22 |
+#include <sys/types.h> |
|
23 |
+#include <sys/socket.h> |
|
24 |
+#include <pthread.h> |
|
25 |
+#include <time.h> |
|
26 |
+#include <signal.h> |
|
27 |
+ |
|
28 |
+#include "cfgfile.h" |
|
29 |
+#include "others.h" |
|
30 |
+#include "defaults.h" |
|
31 |
+#include "scanner.h" |
|
32 |
+#include "server.h" |
|
33 |
+#include "clamuko.h" |
|
34 |
+#include "tests.h" |
|
35 |
+#include "session.h" |
|
36 |
+ |
|
37 |
+#define CMD1 "SCAN" |
|
38 |
+#define CMD2 "RAWSCAN" |
|
39 |
+#define CMD3 "QUIT" /* deprecated */ |
|
40 |
+#define CMD4 "RELOAD" |
|
41 |
+#define CMD5 "PING" |
|
42 |
+#define CMD6 "CONTSCAN" |
|
43 |
+#define CMD7 "VERSION" |
|
44 |
+#define CMD8 "STREAM" |
|
45 |
+#define CMD9 "SESSION" |
|
46 |
+#define CMD10 "END" |
|
47 |
+#define CMD11 "SHUTDOWN" |
|
48 |
+ |
|
49 |
+ |
|
50 |
+int command(int desc, const struct cl_node *root, const struct cl_limits *limits, int options, const struct cfgstruct *copt) |
|
51 |
+{ |
|
52 |
+ char buff[1025]; |
|
53 |
+ int bread, opt, ret; |
|
54 |
+ |
|
55 |
+ |
|
56 |
+ if((bread = read(desc, buff, 1024)) == -1) { |
|
57 |
+ logg("!Command parser: read() failed.\n"); |
|
58 |
+ /* at least try to display this error message */ |
|
59 |
+ mdprintf(desc, "ERROR: Command parser: read() failed.\n"); |
|
60 |
+ return -1; |
|
61 |
+ } |
|
62 |
+ |
|
63 |
+ buff[bread] = 0; |
|
64 |
+ chomp(buff); |
|
65 |
+ |
|
66 |
+ if(!strncmp(buff, CMD1, strlen(CMD1))) { /* SCAN */ |
|
67 |
+ scan(buff + strlen(CMD1) + 1, NULL, root, limits, options, copt, desc, 0); |
|
68 |
+ |
|
69 |
+ } else if(!strncmp(buff, CMD2, strlen(CMD2))) { /* RAWSCAN */ |
|
70 |
+ opt = options & ~CL_ARCHIVE; |
|
71 |
+ scan(buff + strlen(CMD2) + 1, NULL, root, NULL, opt, copt, desc, 0); |
|
72 |
+ |
|
73 |
+ } else if(!strncmp(buff, CMD3, strlen(CMD3))) { /* QUIT */ |
|
74 |
+ return COMMAND_QUIT; |
|
75 |
+ |
|
76 |
+ } else if(!strncmp(buff, CMD4, strlen(CMD4))) { /* RELOAD */ |
|
77 |
+ mdprintf(desc, "RELOADING\n"); |
|
78 |
+ return COMMAND_RELOAD; |
|
79 |
+ |
|
80 |
+ } else if(!strncmp(buff, CMD5, strlen(CMD5))) { /* PING */ |
|
81 |
+ mdprintf(desc, "PONG\n"); |
|
82 |
+ |
|
83 |
+ } else if(!strncmp(buff, CMD6, strlen(CMD6))) { /* CONTSCAN */ |
|
84 |
+ scan(buff + strlen(CMD6) + 1, NULL, root, limits, options, copt, desc, 1); |
|
85 |
+ |
|
86 |
+ } else if(!strncmp(buff, CMD7, strlen(CMD7))) { /* VERSION */ |
|
87 |
+ mdprintf(desc, "clamd / ClamAV version "VERSION"\n"); |
|
88 |
+ |
|
89 |
+ } else if(!strncmp(buff, CMD8, strlen(CMD8))) { /* STREAM */ |
|
90 |
+ scanstream(desc, NULL, root, limits, options, copt); |
|
91 |
+ |
|
92 |
+ } else if(!strncmp(buff, CMD9, strlen(CMD9))) { /* SESSION */ |
|
93 |
+ do { |
|
94 |
+ ret = command(desc, root, limits, options, copt); |
|
95 |
+ } while(!ret); |
|
96 |
+ |
|
97 |
+ switch(ret) { |
|
98 |
+ case COMMAND_QUIT: |
|
99 |
+ mdprintf(desc, "SESSION TERMINATED (SHUTDOWN)\n"); |
|
100 |
+ break; |
|
101 |
+ |
|
102 |
+ case COMMAND_RELOAD: |
|
103 |
+ mdprintf(desc, "SESSION TERMINATED (DATABASE RELOADING)\n"); |
|
104 |
+ break; |
|
105 |
+ |
|
106 |
+ case COMMAND_END: |
|
107 |
+ mdprintf(desc, "BYE\n"); |
|
108 |
+ break; |
|
109 |
+ |
|
110 |
+ default: |
|
111 |
+ mdprintf(desc, "SESSION TERMINATED (INTERNAL ERROR)\n"); |
|
112 |
+ break; |
|
113 |
+ } |
|
114 |
+ |
|
115 |
+ return ret; |
|
116 |
+ |
|
117 |
+ } else if(!strncmp(buff, CMD10, strlen(CMD10))) { /* END */ |
|
118 |
+ return COMMAND_END; |
|
119 |
+ |
|
120 |
+ } else if(!strncmp(buff, CMD11, strlen(CMD11))) { /* SHUTDOWN */ |
|
121 |
+ return COMMAND_QUIT; |
|
122 |
+ |
|
123 |
+ } else { |
|
124 |
+ mdprintf(desc, "UNKNOWN COMMAND\n"); |
|
125 |
+ } |
|
126 |
+ |
|
127 |
+ return 0; /* no error and no 'special' command executed */ |
|
128 |
+} |
0 | 129 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,31 @@ |
0 |
+/* |
|
1 |
+ * Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net> |
|
2 |
+ * |
|
3 |
+ * This program is free software; you can redistribute it and/or modify |
|
4 |
+ * it under the terms of the GNU General Public License as published by |
|
5 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
6 |
+ * (at your option) any later version. |
|
7 |
+ * |
|
8 |
+ * This program is distributed in the hope that it will be useful, |
|
9 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 |
+ * GNU General Public License for more details. |
|
12 |
+ * |
|
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 |
|
15 |
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
16 |
+ */ |
|
17 |
+ |
|
18 |
+#ifndef __SESSION_H |
|
19 |
+#define __SESSION_H |
|
20 |
+ |
|
21 |
+#define COMMAND_QUIT 1 |
|
22 |
+#define COMMAND_RELOAD 2 |
|
23 |
+#define COMMAND_END 3 |
|
24 |
+ |
|
25 |
+#include <clamav.h> |
|
26 |
+#include "cfgfile.h" |
|
27 |
+ |
|
28 |
+int command(int desc, const struct cl_node *root, const struct cl_limits *limits, int options, const struct cfgstruct *copt); |
|
29 |
+ |
|
30 |
+#endif |