... | ... |
@@ -112,16 +112,19 @@ static void tracehook(struct cli_bc_ctx *ctx, unsigned event) |
112 | 112 |
|
113 | 113 |
static void tracehook_op(struct cli_bc_ctx *ctx, const char *op) |
114 | 114 |
{ |
115 |
+ UNUSEDPARAM(ctx); |
|
115 | 116 |
fprintf(stderr, "[trace] %s\n", op); |
116 | 117 |
} |
117 | 118 |
|
118 | 119 |
static void tracehook_val(struct cli_bc_ctx *ctx, const char *name, uint32_t value) |
119 | 120 |
{ |
121 |
+ UNUSEDPARAM(ctx); |
|
120 | 122 |
fprintf(stderr, "[trace] %s = %u\n", name, value); |
121 | 123 |
} |
122 | 124 |
|
123 | 125 |
static void tracehook_ptr(struct cli_bc_ctx *ctx, const void *ptr) |
124 | 126 |
{ |
127 |
+ UNUSEDPARAM(ctx); |
|
125 | 128 |
fprintf(stderr, "[trace] %p\n", ptr); |
126 | 129 |
} |
127 | 130 |
|
... | ... |
@@ -76,6 +76,7 @@ short foreground = 0; |
76 | 76 |
char hostid[37]; |
77 | 77 |
|
78 | 78 |
char *get_hostid(void *cbdata); |
79 |
+int is_valid_hostid(void); |
|
79 | 80 |
|
80 | 81 |
static void help(void) |
81 | 82 |
{ |
... | ... |
@@ -118,11 +119,12 @@ int main(int argc, char **argv) |
118 | 118 |
time_t currtime; |
119 | 119 |
const char *dbdir, *cfgfile; |
120 | 120 |
char *pua_cats = NULL, *pt; |
121 |
- int ret, tcpsock = 0, localsock = 0, i, min_port, max_port; |
|
121 |
+ int ret, tcpsock = 0, localsock = 0, min_port, max_port; |
|
122 | 122 |
unsigned int sigs = 0; |
123 | 123 |
int *lsockets=NULL; |
124 | 124 |
unsigned int nlsockets = 0; |
125 | 125 |
unsigned int dboptions = 0; |
126 |
+ unsigned int i; |
|
126 | 127 |
#ifdef C_LINUX |
127 | 128 |
STATBUF sb; |
128 | 129 |
#endif |
... | ... |
@@ -576,8 +578,6 @@ int main(int argc, char **argv) |
576 | 576 |
} |
577 | 577 |
|
578 | 578 |
if(tcpsock) { |
579 |
- int *t; |
|
580 |
- |
|
581 | 579 |
opt = optget(opts, "TCPAddr"); |
582 | 580 |
if (opt->enabled) { |
583 | 581 |
int breakout = 0; |
... | ... |
@@ -670,7 +670,7 @@ int main(int argc, char **argv) |
670 | 670 |
if(!optget(opts, "Foreground")->enabled) { |
671 | 671 |
#ifdef C_BSD |
672 | 672 |
/* workaround for OpenBSD bug, see https://wwws.clamav.net/bugzilla/show_bug.cgi?id=885 */ |
673 |
- for(ret=0;ret<nlsockets;ret++) { |
|
673 |
+ for(ret=0;(unsigned int)ret<nlsockets;ret++) { |
|
674 | 674 |
if (fcntl(lsockets[ret], F_SETFL, fcntl(lsockets[ret], F_GETFL) | O_NONBLOCK) == -1) { |
675 | 675 |
logg("!fcntl for lsockets[] failed\n"); |
676 | 676 |
close(lsockets[ret]); |
... | ... |
@@ -688,7 +688,7 @@ int main(int argc, char **argv) |
688 | 688 |
} |
689 | 689 |
gengine = NULL; |
690 | 690 |
#ifdef C_BSD |
691 |
- for(ret=0;ret<nlsockets;ret++) { |
|
691 |
+ for(ret=0;(unsigned int)ret<nlsockets;ret++) { |
|
692 | 692 |
if (fcntl(lsockets[ret], F_SETFL, fcntl(lsockets[ret], F_GETFL) & ~O_NONBLOCK) == -1) { |
693 | 693 |
logg("!fcntl for lsockets[] failed\n"); |
694 | 694 |
close(lsockets[ret]); |
... | ... |
@@ -766,6 +766,8 @@ int is_valid_hostid(void) |
766 | 766 |
|
767 | 767 |
char *get_hostid(void *cbdata) |
768 | 768 |
{ |
769 |
+ UNUSEDPARAM(cbdata); |
|
770 |
+ |
|
769 | 771 |
if (!strcmp(hostid, "none")) |
770 | 772 |
return NULL; |
771 | 773 |
|
... | ... |
@@ -517,6 +517,8 @@ fds_poll_recv (struct fd_data *data, int timeout, int check_signals, |
517 | 517 |
int retval; |
518 | 518 |
time_t now, closest_timeout; |
519 | 519 |
|
520 |
+ UNUSEDPARAM(event); |
|
521 |
+ |
|
520 | 522 |
/* we must have at least one fd, the control fd! */ |
521 | 523 |
fds_cleanup (data); |
522 | 524 |
#ifndef _WIN32 |
... | ... |
@@ -76,6 +76,8 @@ void msg_callback(enum cl_msg severity, const char *fullmsg, const char *msg, vo |
76 | 76 |
struct cb_context *c = ctx; |
77 | 77 |
const char *filename = (c && c->filename) ? c->filename : ""; |
78 | 78 |
|
79 |
+ UNUSEDPARAM(fullmsg); |
|
80 |
+ |
|
79 | 81 |
switch (severity) { |
80 | 82 |
case CL_MSG_ERROR: |
81 | 83 |
logg("^[LibClamAV] %s: %s", filename, msg); |
... | ... |
@@ -95,10 +97,13 @@ void msg_callback(enum cl_msg severity, const char *fullmsg, const char *msg, vo |
95 | 95 |
void hash_callback(int fd, unsigned long long size, const unsigned char *md5, const char *virname, void *ctx) |
96 | 96 |
{ |
97 | 97 |
struct cb_context *c = ctx; |
98 |
+ UNUSEDPARAM(fd); |
|
99 |
+ UNUSEDPARAM(virname); |
|
100 |
+ |
|
98 | 101 |
if (!c) |
99 | 102 |
return; |
100 | 103 |
c->virsize = size; |
101 |
- strncpy(c->virhash, md5, 32); |
|
104 |
+ strncpy(c->virhash, (const char *)md5, 32); |
|
102 | 105 |
c->virhash[32] = '\0'; |
103 | 106 |
} |
104 | 107 |
|
... | ... |
@@ -346,6 +351,8 @@ int scanfd(const client_conn_t *conn, unsigned long int *scanned, |
346 | 346 |
char fdstr[32]; |
347 | 347 |
const char*reply_fdstr; |
348 | 348 |
|
349 |
+ UNUSEDPARAM(odesc); |
|
350 |
+ |
|
349 | 351 |
if (stream) { |
350 | 352 |
struct sockaddr_in sa; |
351 | 353 |
socklen_t salen = sizeof(sa); |
... | ... |
@@ -76,11 +76,12 @@ extern struct optstruct *clamdopts; |
76 | 76 |
static int isremote(const struct optstruct *opts) { |
77 | 77 |
int s, ret; |
78 | 78 |
const struct optstruct *opt; |
79 |
- static struct sockaddr_in testsock; |
|
80 | 79 |
char *ipaddr, port[10]; |
81 | 80 |
struct addrinfo hints, *info, *p; |
82 | 81 |
int res; |
83 | 82 |
|
83 |
+ UNUSEDPARAM(opts); |
|
84 |
+ |
|
84 | 85 |
#ifndef _WIN32 |
85 | 86 |
if((opt = optget(clamdopts, "LocalSocket"))->enabled) { |
86 | 87 |
memset((void *)&nixsock, 0, sizeof(nixsock)); |
... | ... |
@@ -236,6 +236,7 @@ static int chkpath(const char *path) |
236 | 236 |
|
237 | 237 |
static int ftw_chkpath(const char *path, struct cli_ftw_cbdata *data) |
238 | 238 |
{ |
239 |
+ UNUSEDPARAM(data); |
|
239 | 240 |
return chkpath(path); |
240 | 241 |
} |
241 | 242 |
|
... | ... |
@@ -378,6 +379,8 @@ static int serial_callback(STATBUF *sb, char *filename, const char *path, enum c |
378 | 378 |
int sockd, ret; |
379 | 379 |
const char *f = filename; |
380 | 380 |
|
381 |
+ UNUSEDPARAM(sb); |
|
382 |
+ |
|
381 | 383 |
if(chkpath(path)) |
382 | 384 |
return CL_SUCCESS; |
383 | 385 |
c->files++; |
... | ... |
@@ -532,6 +535,8 @@ static int parallel_callback(STATBUF *sb, char *filename, const char *path, enum |
532 | 532 |
struct SCANID *cid; |
533 | 533 |
int res = CL_CLEAN; |
534 | 534 |
|
535 |
+ UNUSEDPARAM(sb); |
|
536 |
+ |
|
535 | 537 |
if(chkpath(path)) |
536 | 538 |
return CL_SUCCESS; |
537 | 539 |
c->files++; |
... | ... |
@@ -57,6 +57,7 @@ |
57 | 57 |
#include <assert.h> |
58 | 58 |
#include <errno.h> |
59 | 59 |
|
60 |
+#include "libclamav/clamav.h" |
|
60 | 61 |
#include "shared/optparser.h" |
61 | 62 |
#include "shared/misc.h" |
62 | 63 |
|
... | ... |
@@ -101,6 +102,9 @@ static void cleanup(void); |
101 | 101 |
static int send_string_noreconn(conn_t *conn, const char *cmd); |
102 | 102 |
static void send_string(conn_t *conn, const char *cmd); |
103 | 103 |
static int read_version(conn_t *conn); |
104 |
+char *get_ip(const char *ip); |
|
105 |
+char *get_port(const char *ip); |
|
106 |
+char *make_ip(const char *host, const char *port); |
|
104 | 107 |
|
105 | 108 |
enum exit_reason { |
106 | 109 |
FAIL_CMDLINE=1, |
... | ... |
@@ -509,7 +513,7 @@ static void print_con_info(conn_t *conn, const char *fmt, ...) |
509 | 509 |
|
510 | 510 |
char *get_ip(const char *ip) |
511 | 511 |
{ |
512 |
- char *dupip, *p1, *p2; |
|
512 |
+ char *dupip, *p1; |
|
513 | 513 |
unsigned int i; |
514 | 514 |
|
515 | 515 |
/* |
... | ... |
@@ -608,7 +612,7 @@ static int make_connection_real(const char *soname, conn_t *conn) |
608 | 608 |
int s; |
609 | 609 |
struct timeval tv; |
610 | 610 |
char *port=NULL; |
611 |
- char *name, *pt = strdup(soname); |
|
611 |
+ char *pt = strdup(soname); |
|
612 | 612 |
const char *host = pt; |
613 | 613 |
struct addrinfo hints, *res=NULL, *p; |
614 | 614 |
int err; |
... | ... |
@@ -1217,6 +1221,7 @@ static int read_version(conn_t *conn) |
1217 | 1217 |
|
1218 | 1218 |
static void sigint(int a) |
1219 | 1219 |
{ |
1220 |
+ UNUSEDPARAM(a); |
|
1220 | 1221 |
EXIT_PROGRAM(SIGINT_REASON); |
1221 | 1222 |
} |
1222 | 1223 |
|
... | ... |
@@ -69,6 +69,7 @@ dev_t procdev; |
69 | 69 |
|
70 | 70 |
char hostid[37]; |
71 | 71 |
|
72 |
+int is_valid_hostid(void); |
|
72 | 73 |
char *get_hostid(void *cbdata); |
73 | 74 |
|
74 | 75 |
#ifdef _WIN32 |
... | ... |
@@ -135,6 +136,8 @@ struct metachain { |
135 | 135 |
static cl_error_t pre(int fd, const char *type, void *context) |
136 | 136 |
{ |
137 | 137 |
struct metachain *c = context; |
138 |
+ UNUSEDPARAM(fd); |
|
139 |
+ |
|
138 | 140 |
if (c) { |
139 | 141 |
c->level++; |
140 | 142 |
} |
... | ... |
@@ -162,9 +165,11 @@ static int print_chain(struct metachain *c, char *str, unsigned len) |
162 | 162 |
static cl_error_t post(int fd, int result, const char *virname, void *context) |
163 | 163 |
{ |
164 | 164 |
struct metachain *c = context; |
165 |
+ UNUSEDPARAM(fd); |
|
166 |
+ UNUSEDPARAM(result); |
|
165 | 167 |
if (c && c->n) { |
166 | 168 |
char str[128]; |
167 |
- int toolong = print_chain(c, str, sizeof(str)); |
|
169 |
+ print_chain(c, str, sizeof(str)); |
|
168 | 170 |
if (c->level == c->lastadd && !virname) |
169 | 171 |
free(c->chains[--c->n]); |
170 | 172 |
if (virname && !c->lastvir) |
... | ... |
@@ -178,7 +183,6 @@ static cl_error_t post(int fd, int result, const char *virname, void *context) |
178 | 178 |
static cl_error_t meta(const char* container_type, unsigned long fsize_container, const char *filename, |
179 | 179 |
unsigned long fsize_real, int is_encrypted, unsigned int filepos_container, void *context) |
180 | 180 |
{ |
181 |
- int na = 0; |
|
182 | 181 |
char prev[128]; |
183 | 182 |
struct metachain *c = context; |
184 | 183 |
const char *type = !strncmp(container_type,"CL_TYPE_",8) ? container_type + 8 : container_type; |
... | ... |
@@ -187,6 +191,11 @@ static cl_error_t meta(const char* container_type, unsigned long fsize_container |
187 | 187 |
char **chains; |
188 | 188 |
int toolong; |
189 | 189 |
|
190 |
+ UNUSEDPARAM(fsize_container); |
|
191 |
+ UNUSEDPARAM(fsize_real); |
|
192 |
+ UNUSEDPARAM(is_encrypted); |
|
193 |
+ UNUSEDPARAM(filepos_container); |
|
194 |
+ |
|
190 | 195 |
if (!c) |
191 | 196 |
return CL_CLEAN; |
192 | 197 |
chain = malloc(n); |
... | ... |
@@ -1063,6 +1072,8 @@ int is_valid_hostid(void) |
1063 | 1063 |
|
1064 | 1064 |
char *get_hostid(void *cbdata) |
1065 | 1065 |
{ |
1066 |
+ UNUSEDPARAM(cbdata); |
|
1067 |
+ |
|
1066 | 1068 |
if (!strcmp(hostid, "none")) |
1067 | 1069 |
return NULL; |
1068 | 1070 |
|
... | ... |
@@ -13,6 +13,8 @@ |
13 | 13 |
#define OPTS "e:p:n:N:H:h?v" |
14 | 14 |
|
15 | 15 |
char *read_stream(void); |
16 |
+void usage(char *name); |
|
17 |
+void version(void); |
|
16 | 18 |
|
17 | 19 |
void usage(char *name) |
18 | 20 |
{ |
... | ... |
@@ -41,9 +43,7 @@ int main(int argc, char *argv[]) |
41 | 41 |
int ch; |
42 | 42 |
struct curl_httppost *post=NULL, *last=NULL; |
43 | 43 |
struct curl_slist *slist = NULL; |
44 |
- char *type; |
|
45 | 44 |
char *name=NULL, *email=NULL, *filename=NULL; |
46 |
- struct cl_engine *engine; |
|
47 | 45 |
int setURL=0, fromStream=0; |
48 | 46 |
|
49 | 47 |
curl_global_init(CURL_GLOBAL_ALL); |
... | ... |
@@ -72,6 +72,7 @@ char hostid[37]; |
72 | 72 |
|
73 | 73 |
void submit_host_info(struct optstruct *opts); |
74 | 74 |
char *get_hostid(void *cbdata); |
75 |
+int is_valid_hostid(void); |
|
75 | 76 |
|
76 | 77 |
static void |
77 | 78 |
sighandler (int sig) |
... | ... |
@@ -262,6 +263,9 @@ static void |
262 | 262 |
msg_callback (enum cl_msg severity, const char *fullmsg, const char *msg, |
263 | 263 |
void *ctx) |
264 | 264 |
{ |
265 |
+ UNUSEDPARAM(fullmsg); |
|
266 |
+ UNUSEDPARAM(ctx); |
|
267 |
+ |
|
265 | 268 |
switch (severity) |
266 | 269 |
{ |
267 | 270 |
case CL_MSG_ERROR: |
... | ... |
@@ -742,7 +746,6 @@ main (int argc, char **argv) |
742 | 742 |
|
743 | 743 |
void submit_host_info(struct optstruct *opts) |
744 | 744 |
{ |
745 |
- struct optstruct *opt; |
|
746 | 745 |
struct cl_engine *engine; |
747 | 746 |
cli_intel_t *intel; |
748 | 747 |
|
... | ... |
@@ -812,6 +815,8 @@ int is_valid_hostid(void) |
812 | 812 |
|
813 | 813 |
char *get_hostid(void *cbdata) |
814 | 814 |
{ |
815 |
+ UNUSEDPARAM(cbdata); |
|
816 |
+ |
|
815 | 817 |
if (!strcmp(hostid, "none")) |
816 | 818 |
return NULL; |
817 | 819 |
|
... | ... |
@@ -881,6 +881,10 @@ getfile_mirman (const char *srcfile, const char *destfile, |
881 | 881 |
char *remotename = NULL, *authorization = NULL, *headerline; |
882 | 882 |
const char *rotation = "|/-\\", *fname; |
883 | 883 |
|
884 |
+ UNUSEDPARAM(localip); |
|
885 |
+ UNUSEDPARAM(port); |
|
886 |
+ UNUSEDPARAM(ctimeout); |
|
887 |
+ UNUSEDPARAM(can_whitelist); |
|
884 | 888 |
|
885 | 889 |
if (proxy) |
886 | 890 |
{ |
... | ... |
@@ -1114,6 +1118,8 @@ getfile (const char *srcfile, const char *destfile, const char *hostname, |
1114 | 1114 |
int ret, sd; |
1115 | 1115 |
char ipaddr[46]; |
1116 | 1116 |
|
1117 |
+ UNUSEDPARAM(opts); |
|
1118 |
+ |
|
1117 | 1119 |
memset (ipaddr, 0, sizeof (ipaddr)); |
1118 | 1120 |
if (ip && ip[0]) /* use ip to connect */ |
1119 | 1121 |
sd = wwwconnect (ip, proxy, port, ipaddr, localip, ctimeout, mdat, |
... | ... |
@@ -178,6 +178,8 @@ static int cdiff_cmd_open(const char *cmdstr, struct cdiff_ctx *ctx, char *lbuf, |
178 | 178 |
char *db; |
179 | 179 |
unsigned int i; |
180 | 180 |
|
181 |
+ UNUSEDPARAM(lbuf); |
|
182 |
+ UNUSEDPARAM(lbuflen); |
|
181 | 183 |
|
182 | 184 |
if(!(db = cdiff_token(cmdstr, 1, 1))) { |
183 | 185 |
logg("!cdiff_cmd_open: Can't get first argument\n"); |
... | ... |
@@ -207,6 +209,8 @@ static int cdiff_cmd_add(const char *cmdstr, struct cdiff_ctx *ctx, char *lbuf, |
207 | 207 |
char *sig; |
208 | 208 |
struct cdiff_node *new; |
209 | 209 |
|
210 |
+ UNUSEDPARAM(lbuf); |
|
211 |
+ UNUSEDPARAM(lbuflen); |
|
210 | 212 |
|
211 | 213 |
if(!(sig = cdiff_token(cmdstr, 1, 1))) { |
212 | 214 |
logg("!cdiff_cmd_add: Can't get first argument\n"); |
... | ... |
@@ -237,6 +241,9 @@ static int cdiff_cmd_del(const char *cmdstr, struct cdiff_ctx *ctx, char *lbuf, |
237 | 237 |
struct cdiff_node *pt, *last, *new; |
238 | 238 |
unsigned int lineno; |
239 | 239 |
|
240 |
+ UNUSEDPARAM(lbuf); |
|
241 |
+ UNUSEDPARAM(lbuflen); |
|
242 |
+ |
|
240 | 243 |
|
241 | 244 |
if(!(arg = cdiff_token(cmdstr, 1, 0))) { |
242 | 245 |
logg("!cdiff_cmd_del: Can't get first argument\n"); |
... | ... |
@@ -294,6 +301,9 @@ static int cdiff_cmd_xchg(const char *cmdstr, struct cdiff_ctx *ctx, char *lbuf, |
294 | 294 |
struct cdiff_node *new; |
295 | 295 |
unsigned int lineno; |
296 | 296 |
|
297 |
+ UNUSEDPARAM(lbuf); |
|
298 |
+ UNUSEDPARAM(lbuflen); |
|
299 |
+ |
|
297 | 300 |
|
298 | 301 |
if(!(arg = cdiff_token(cmdstr, 1, 0))) { |
299 | 302 |
logg("!cdiff_cmd_xchg: Can't get first argument\n"); |
... | ... |
@@ -340,6 +350,8 @@ static int cdiff_cmd_close(const char *cmdstr, struct cdiff_ctx *ctx, char *lbuf |
340 | 340 |
char *tmp; |
341 | 341 |
FILE *fh, *tmpfh; |
342 | 342 |
|
343 |
+ UNUSEDPARAM(cmdstr); |
|
344 |
+ |
|
343 | 345 |
|
344 | 346 |
if(!ctx->open_db) { |
345 | 347 |
logg("!cdiff_cmd_close: No database to close\n"); |
... | ... |
@@ -681,6 +693,8 @@ static int cdiff_cmd_unlink(const char *cmdstr, struct cdiff_ctx *ctx, char *lbu |
681 | 681 |
char *db; |
682 | 682 |
unsigned int i; |
683 | 683 |
|
684 |
+ UNUSEDPARAM(lbuf); |
|
685 |
+ UNUSEDPARAM(lbuflen); |
|
684 | 686 |
|
685 | 687 |
if(ctx->open_db) { |
686 | 688 |
logg("!cdiff_cmd_unlink: Database %s is still open\n", ctx->open_db); |
... | ... |
@@ -303,7 +303,7 @@ static char *getdsig(const char *host, const char *user, const unsigned char *da |
303 | 303 |
return NULL; |
304 | 304 |
} |
305 | 305 |
#endif |
306 |
- if(scanf("%as", &pt) == EOF || !pt) { |
|
306 |
+ if(scanf("%s", &pt) == EOF || !pt) { |
|
307 | 307 |
mprintf("!getdsig: Can't get password\n"); |
308 | 308 |
#ifdef HAVE_TERMIOS_H |
309 | 309 |
tcsetattr(0, TCSAFLUSH, &old); |
... | ... |
@@ -848,7 +848,7 @@ static int build(const struct optstruct *opts) |
848 | 848 |
builder[sizeof(builder)-1]='\0'; |
849 | 849 |
} else { |
850 | 850 |
mprintf("Builder name: "); |
851 |
- if(scanf("%as", &pt) == EOF || !pt) { |
|
851 |
+ if(scanf("%s", &pt) == EOF || !pt) { |
|
852 | 852 |
mprintf("!build: Can't get builder name\n"); |
853 | 853 |
return -1; |
854 | 854 |
} |
... | ... |
@@ -1,6 +1,10 @@ |
1 | 1 |
#include <stdio.h> |
2 |
+#include "../libclamav/clamav.h" |
|
3 |
+ |
|
2 | 4 |
int main(int argc, char **argv) |
3 | 5 |
{ |
6 |
+ UNUSEDPARAM(argc); |
|
7 |
+ UNUSEDPARAM(argv); |
|
4 | 8 |
puts("\n*** Unit tests disabled in this build\n*** Use ./configure --enable-check to enable them\n"); |
5 | 9 |
/* tell automake the test was skipped */ |
6 | 10 |
return 77; |
... | ... |
@@ -18,6 +18,7 @@ |
18 | 18 |
* MA 02110-1301, USA. |
19 | 19 |
*/ |
20 | 20 |
|
21 |
+#include "../libclamav/clamav.h" |
|
21 | 22 |
#include "../libclamav/fpu.h" |
22 | 23 |
|
23 | 24 |
/* Helper command line interface to determinine fpu endianess in unit test scripts. |
... | ... |
@@ -30,5 +31,7 @@ |
30 | 30 |
|
31 | 31 |
int main (int argc, char **argv) |
32 | 32 |
{ |
33 |
+ UNUSEDPARAM(argc); |
|
34 |
+ UNUSEDPARAM(argv); |
|
33 | 35 |
return get_fpu_endian(); |
34 | 36 |
} |