Browse code

add --stream

git-svn: trunk@4801

aCaB authored on 2009/02/17 09:08:17
Showing 5 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Feb 17 01:36:36 CET 2009 (acab)
2
+-----------------------------------
3
+ * clamd: add --stream option to force streaming even to the localhost
4
+	  via unix socket
5
+
1 6
 Mon Feb 16 23:56:34 EET 2009 (edwin)
2 7
 ------------------------------------
3 8
  * clamd/clamd.c, clamd/server-th.c, unit_tests/check_clamd.c,
... ...
@@ -176,7 +176,8 @@ void help(void)
176 176
     mprintf("    --infected            -i           Only print infected files\n");
177 177
     mprintf("    --no-summary                       Disable summary at end of scanning\n");
178 178
     mprintf("    --reload                           Request clamd to reload virus database\n");
179
-    mprintf("    --fdpass                           pass filedescriptor to clamd (useful if clamd is running as a different user)\n");
179
+    mprintf("    --fdpass                           Pass filedescriptor to clamd (useful if clamd is running as a different user)\n");
180
+    mprintf("    --stream                           Force streaming files to clamd (for debugging and unit testing)\n");
180 181
     mprintf("\n");
181 182
 
182 183
     exit(0);
... ...
@@ -223,8 +223,7 @@ int client(const struct optstruct *opts, int *infected)
223 223
     }
224 224
 
225 225
     scandash = (opts->filename && opts->filename[0] && !strcmp(opts->filename[0], "-") && !opts->filename[1]);
226
-    remote = isremote(opts);
227
-    /* remote = 1; */
226
+    remote = isremote(opts) | optget(opts, "stream")->enabled;
228 227
 #ifdef HAVE_FD_PASSING
229 228
     if(!remote && optget(clamdopts, "LocalSocket")->enabled && (optget(opts, "fdpass")->enabled || scandash)) {
230 229
 	scantype = FILDES;
... ...
@@ -53,6 +53,9 @@ Request clamd to reload virus database.
53 53
 \fB\-\-fdpass\fR
54 54
 Pass the file descriptor permissions to clamd. This is useful if clamd is running as a different user as it is faster than streaming the file to clamd.
55 55
 Only available if connected to clamd via local(unix) socket.
56
+.TP
57
+\fB\-\-stream\fR
58
+Forces file streaming to clamd. This is generally not needed as clamdscan detects automatically if streaming is required. This option only exists for debugging and testing purposes, in all other cases \-\-fdpass is preferred.
56 59
 .SH "EXAMPLES"
57 60
 .LP 
58 61
 .TP 
... ...
@@ -78,6 +78,7 @@ const struct clam_option clam_options[] = {
78 78
     { NULL, "reload", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMDSCAN, "", "" },
79 79
     { NULL, "multiscan", 'm', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMDSCAN, "", "" },
80 80
     { NULL, "fdpass", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMDSCAN, "", "" },
81
+    { NULL, "stream", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMDSCAN, "", "" },
81 82
     { NULL, "database", 'd', TYPE_STRING, NULL, -1, DATADIR, FLAG_REQUIRED, OPT_CLAMSCAN, "", "" }, /* merge it with DatabaseDirectory (and fix conflict with --datadir */
82 83
     { NULL, "recursive", 'r', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMSCAN, "", "" },
83 84
     { NULL, "bell", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMSCAN, "", "" },