git-svn: trunk@2048
Tomasz Kojm authored on 2006/06/27 23:04:07... | ... |
@@ -69,7 +69,7 @@ static int hexdump(void) |
69 | 69 |
while((bytes = read(0, buffer, FILEBUFF)) > 0) { |
70 | 70 |
pt = cli_str2hex(buffer, bytes); |
71 | 71 |
if(write(1, pt, 2 * bytes) == -1) { |
72 |
- logg("!hexdump: Can't write to stdout\n"); |
|
72 |
+ mprintf("!hexdump: Can't write to stdout\n"); |
|
73 | 73 |
free(pt); |
74 | 74 |
return -1; |
75 | 75 |
} |
... | ... |
@@ -92,17 +92,17 @@ static int md5sig(struct optstruct *opt) |
92 | 92 |
if(opt->filename) { |
93 | 93 |
for(i = 0; (filename = cli_strtok(opt->filename, i, "\t")); i++) { |
94 | 94 |
if(stat(filename, &sb) == -1) { |
95 |
- logg("!md5sig: Can't access file %s\n", filename); |
|
95 |
+ mprintf("!md5sig: Can't access file %s\n", filename); |
|
96 | 96 |
perror("md5sig"); |
97 | 97 |
free(filename); |
98 | 98 |
return -1; |
99 | 99 |
} else { |
100 | 100 |
if((sb.st_mode & S_IFMT) == S_IFREG) { |
101 | 101 |
if((md5 = cli_md5file(filename))) { |
102 |
- logg("%s:%d:%s\n", md5, sb.st_size, filename); |
|
102 |
+ mprintf("%s:%d:%s\n", md5, sb.st_size, filename); |
|
103 | 103 |
free(md5); |
104 | 104 |
} else { |
105 |
- logg("!md5sig: Can't generate MD5 checksum for %s\n", filename); |
|
105 |
+ mprintf("!md5sig: Can't generate MD5 checksum for %s\n", filename); |
|
106 | 106 |
free(filename); |
107 | 107 |
return -1; |
108 | 108 |
} |
... | ... |
@@ -115,10 +115,10 @@ static int md5sig(struct optstruct *opt) |
115 | 115 |
} else { /* stream */ |
116 | 116 |
md5 = cli_md5stream(stdin, NULL); |
117 | 117 |
if(!md5) { |
118 |
- logg("!md5sig: Can't generate MD5 checksum for input stream\n"); |
|
118 |
+ mprintf("!md5sig: Can't generate MD5 checksum for input stream\n"); |
|
119 | 119 |
return -1; |
120 | 120 |
} |
121 |
- logg("%s\n", md5); |
|
121 |
+ mprintf("%s\n", md5); |
|
122 | 122 |
free(md5); |
123 | 123 |
} |
124 | 124 |
|
... | ... |
@@ -131,7 +131,7 @@ static int htmlnorm(struct optstruct *opt) |
131 | 131 |
|
132 | 132 |
|
133 | 133 |
if((fd = open(opt_arg(opt, "html-normalise"), O_RDONLY)) == -1) { |
134 |
- logg("!htmlnorm: Can't open file %s\n", opt_arg(opt, "html-normalise")); |
|
134 |
+ mprintf("!htmlnorm: Can't open file %s\n", opt_arg(opt, "html-normalise")); |
|
135 | 135 |
return -1; |
136 | 136 |
} |
137 | 137 |
|
... | ... |
@@ -176,7 +176,7 @@ static char *getdsig(const char *host, const char *user, const char *data) |
176 | 176 |
if((sockd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { |
177 | 177 |
#endif |
178 | 178 |
perror("socket()"); |
179 |
- logg("!getdsig: Can't create socket\n"); |
|
179 |
+ mprintf("!getdsig: Can't create socket\n"); |
|
180 | 180 |
return NULL; |
181 | 181 |
} |
182 | 182 |
|
... | ... |
@@ -187,7 +187,7 @@ static char *getdsig(const char *host, const char *user, const char *data) |
187 | 187 |
if(connect(sockd, (struct sockaddr *) &server, sizeof(struct sockaddr_in)) < 0) { |
188 | 188 |
close(sockd); |
189 | 189 |
perror("connect()"); |
190 |
- logg("!getdsig: Can't connect to ClamAV Signing Service at %s\n", host); |
|
190 |
+ mprintf("!getdsig: Can't connect to ClamAV Signing Service at %s\n", host); |
|
191 | 191 |
return NULL; |
192 | 192 |
} |
193 | 193 |
|
... | ... |
@@ -198,14 +198,14 @@ static char *getdsig(const char *host, const char *user, const char *data) |
198 | 198 |
|
199 | 199 |
#ifdef HAVE_TERMIOS_H |
200 | 200 |
if(tcgetattr(0, &old)) { |
201 |
- logg("!getdsig: tcgetattr() failed\n", host); |
|
201 |
+ mprintf("!getdsig: tcgetattr() failed\n", host); |
|
202 | 202 |
close(sockd); |
203 | 203 |
return NULL; |
204 | 204 |
} |
205 | 205 |
new = old; |
206 | 206 |
new.c_lflag &= ~ECHO; |
207 | 207 |
if(tcsetattr(0, TCSAFLUSH, &new)) { |
208 |
- logg("!getdsig: tcsetattr() failed\n", host); |
|
208 |
+ mprintf("!getdsig: tcsetattr() failed\n", host); |
|
209 | 209 |
close(sockd); |
210 | 210 |
return NULL; |
211 | 211 |
} |
... | ... |
@@ -214,14 +214,14 @@ static char *getdsig(const char *host, const char *user, const char *data) |
214 | 214 |
if(fgets(pass, sizeof(pass), stdin)) { |
215 | 215 |
cli_chomp(pass); |
216 | 216 |
} else { |
217 |
- logg("!getdsig: Can't get password\n"); |
|
217 |
+ mprintf("!getdsig: Can't get password\n"); |
|
218 | 218 |
close(sockd); |
219 | 219 |
return NULL; |
220 | 220 |
} |
221 | 221 |
|
222 | 222 |
#ifdef HAVE_TERMIOS_H |
223 | 223 |
if(tcsetattr(0, TCSAFLUSH, &old)) { |
224 |
- logg("!getdsig: tcsetattr() failed\n", host); |
|
224 |
+ mprintf("!getdsig: tcsetattr() failed\n", host); |
|
225 | 225 |
close(sockd); |
226 | 226 |
return NULL; |
227 | 227 |
} |
... | ... |
@@ -235,7 +235,7 @@ static char *getdsig(const char *host, const char *user, const char *data) |
235 | 235 |
len += 16; |
236 | 236 |
|
237 | 237 |
if(write(sockd, cmd, len) < 0) { |
238 |
- logg("!getdsig: Can't write to socket\n"); |
|
238 |
+ mprintf("!getdsig: Can't write to socket\n"); |
|
239 | 239 |
close(sockd); |
240 | 240 |
memset(cmd, 0, len); |
241 | 241 |
memset(pass, 0, strlen(pass)); |
... | ... |
@@ -248,12 +248,12 @@ static char *getdsig(const char *host, const char *user, const char *data) |
248 | 248 |
|
249 | 249 |
if((bread = read(sockd, buff, sizeof(buff))) > 0) { |
250 | 250 |
if(!strstr(buff, "Signature:")) { |
251 |
- logg("!getdsig: Error generating digital signature\n"); |
|
252 |
- logg("!getdsig: Answer from remote server: %s\n", buff); |
|
251 |
+ mprintf("!getdsig: Error generating digital signature\n"); |
|
252 |
+ mprintf("!getdsig: Answer from remote server: %s\n", buff); |
|
253 | 253 |
close(sockd); |
254 | 254 |
return NULL; |
255 | 255 |
} else { |
256 |
- logg("Signature received (length = %d)\n", strlen(buff) - 10); |
|
256 |
+ mprintf("Signature received (length = %d)\n", strlen(buff) - 10); |
|
257 | 257 |
} |
258 | 258 |
} |
259 | 259 |
|
... | ... |
@@ -275,18 +275,18 @@ static int writeinfo(const char *db, unsigned int ver) |
275 | 275 |
snprintf(file, sizeof(file), "%s.info", db); |
276 | 276 |
if(stat(file, &sb) != -1) { |
277 | 277 |
if(unlink(file) == -1) { |
278 |
- logg("!writeinfo: Can't unlink %s\n", file); |
|
278 |
+ mprintf("!writeinfo: Can't unlink %s\n", file); |
|
279 | 279 |
return -1; |
280 | 280 |
} |
281 | 281 |
} |
282 | 282 |
|
283 | 283 |
if(!(fh = fopen(file, "w"))) { |
284 |
- logg("!writeinfo: Can't create file %s\n", file); |
|
284 |
+ mprintf("!writeinfo: Can't create file %s\n", file); |
|
285 | 285 |
return -1; |
286 | 286 |
} |
287 | 287 |
|
288 | 288 |
if(fprintf(fh, "%s:%u\n", db, ver) < 0) { |
289 |
- logg("!writeinfo: Can't write to info file\n"); |
|
289 |
+ mprintf("!writeinfo: Can't write to info file\n"); |
|
290 | 290 |
fclose(fh); |
291 | 291 |
return -1; |
292 | 292 |
} |
... | ... |
@@ -295,12 +295,12 @@ static int writeinfo(const char *db, unsigned int ver) |
295 | 295 |
snprintf(file, sizeof(file), "%s.%s", db, extlist[i]); |
296 | 296 |
if(stat(file, &sb) != -1) { |
297 | 297 |
if(!(md5 = cli_md5file(file))) { |
298 |
- logg("!writeinfo: Can't generate MD5 checksum for %s\n", file); |
|
298 |
+ mprintf("!writeinfo: Can't generate MD5 checksum for %s\n", file); |
|
299 | 299 |
fclose(fh); |
300 | 300 |
return -1; |
301 | 301 |
} |
302 | 302 |
if(fprintf(fh, "%s.%s:%s\n", db, extlist[i], md5) < 0) { |
303 |
- logg("!writeinfo: Can't write to info file\n"); |
|
303 |
+ mprintf("!writeinfo: Can't write to info file\n"); |
|
304 | 304 |
fclose(fh); |
305 | 305 |
free(md5); |
306 | 306 |
return -1; |
... | ... |
@@ -330,12 +330,12 @@ static int build(struct optstruct *opt) |
330 | 330 |
|
331 | 331 |
|
332 | 332 |
if(!opt_check(opt, "server")) { |
333 |
- logg("!build: --server is required for --build\n"); |
|
333 |
+ mprintf("!build: --server is required for --build\n"); |
|
334 | 334 |
return -1; |
335 | 335 |
} |
336 | 336 |
|
337 | 337 |
if(stat("COPYING", &foo) == -1) { |
338 |
- logg("!build: COPYING file not found in current working directory.\n"); |
|
338 |
+ mprintf("!build: COPYING file not found in current working directory.\n"); |
|
339 | 339 |
return -1; |
340 | 340 |
} |
341 | 341 |
|
... | ... |
@@ -346,23 +346,23 @@ static int build(struct optstruct *opt) |
346 | 346 |
stat("main.zmd", &foo) == -1 && stat("daily.zmd", &foo) == -1 && |
347 | 347 |
stat("main.rmd", &foo) == -1 && stat("daily.rmd", &foo) == -1) |
348 | 348 |
{ |
349 |
- logg("!build: No virus database file found in current directory\n"); |
|
349 |
+ mprintf("!build: No virus database file found in current directory\n"); |
|
350 | 350 |
return -1; |
351 | 351 |
} |
352 | 352 |
|
353 | 353 |
cl_debug(); /* enable debug messages in libclamav */ |
354 | 354 |
|
355 | 355 |
if((ret = cl_loaddbdir(".", &root, &sigs))) { |
356 |
- logg("!build: Can't load database: %s\n", cl_strerror(ret)); |
|
356 |
+ mprintf("!build: Can't load database: %s\n", cl_strerror(ret)); |
|
357 | 357 |
return -1; |
358 | 358 |
} else { |
359 | 359 |
cl_free(root); |
360 | 360 |
} |
361 | 361 |
|
362 | 362 |
if(!sigs) { |
363 |
- logg("!build: There are no signatures in database files\n"); |
|
363 |
+ mprintf("!build: There are no signatures in database files\n"); |
|
364 | 364 |
} else { |
365 |
- logg("Signatures: %d\n", sigs); |
|
365 |
+ mprintf("Signatures: %d\n", sigs); |
|
366 | 366 |
lines = countlines("main.db") + countlines("daily.db") + |
367 | 367 |
countlines("main.hdb") + countlines("daily.hdb") + |
368 | 368 |
countlines("main.ndb") + countlines("daily.ndb") + |
... | ... |
@@ -372,9 +372,9 @@ static int build(struct optstruct *opt) |
372 | 372 |
countlines("main.fp") + countlines("daily.fp"); |
373 | 373 |
|
374 | 374 |
if(lines != sigs) { |
375 |
- logg("!build: Signatures in database: %d, loaded by libclamav: %d\n", lines, sigs); |
|
376 |
- logg("!build: Please check the current directory and remove unnecessary databases\n"); |
|
377 |
- logg("!build: or install the latest ClamAV version.\n"); |
|
375 |
+ mprintf("!build: Signatures in database: %d, loaded by libclamav: %d\n", lines, sigs); |
|
376 |
+ mprintf("!build: Please check the current directory and remove unnecessary databases\n"); |
|
377 |
+ mprintf("!build: or install the latest ClamAV version.\n"); |
|
378 | 378 |
return -1; |
379 | 379 |
} |
380 | 380 |
} |
... | ... |
@@ -384,7 +384,7 @@ static int build(struct optstruct *opt) |
384 | 384 |
snprintf(buffer, sizeof(buffer), "%s/%s", dbdir, opt_arg(opt, "build")); |
385 | 385 |
free(dbdir); |
386 | 386 |
if(!(oldcvd = cl_cvdhead(buffer))) { |
387 |
- logg("^build: CAN'T READ CVD HEADER OF CURRENT DATABASE %s\n", buffer); |
|
387 |
+ mprintf("^build: CAN'T READ CVD HEADER OF CURRENT DATABASE %s\n", buffer); |
|
388 | 388 |
sleep(3); |
389 | 389 |
} |
390 | 390 |
|
... | ... |
@@ -393,7 +393,7 @@ static int build(struct optstruct *opt) |
393 | 393 |
cl_cvdfree(oldcvd); |
394 | 394 |
} else { |
395 | 395 |
fflush(stdin); |
396 |
- logg("Version number: "); |
|
396 |
+ mprintf("Version number: "); |
|
397 | 397 |
scanf("%u", &version); |
398 | 398 |
} |
399 | 399 |
|
... | ... |
@@ -404,18 +404,18 @@ static int build(struct optstruct *opt) |
404 | 404 |
pt = "daily"; |
405 | 405 |
|
406 | 406 |
if(writeinfo(pt, version) == -1) { |
407 |
- logg("!build: Can't generate info file\n"); |
|
407 |
+ mprintf("!build: Can't generate info file\n"); |
|
408 | 408 |
return -1; |
409 | 409 |
} |
410 | 410 |
|
411 | 411 |
if(!(tarfile = cli_gentemp("."))) { |
412 |
- logg("!build: Can't generate temporary name for tarfile\n"); |
|
412 |
+ mprintf("!build: Can't generate temporary name for tarfile\n"); |
|
413 | 413 |
return -1; |
414 | 414 |
} |
415 | 415 |
|
416 | 416 |
switch(fork()) { |
417 | 417 |
case -1: |
418 |
- logg("!build: Can't fork.\n"); |
|
418 |
+ mprintf("!build: Can't fork.\n"); |
|
419 | 419 |
free(tarfile); |
420 | 420 |
return -1; |
421 | 421 |
case 0: |
... | ... |
@@ -428,7 +428,7 @@ static int build(struct optstruct *opt) |
428 | 428 |
"daily.fp", "daily.info", "main.info", NULL }; |
429 | 429 |
args[2] = tarfile; |
430 | 430 |
execv("/bin/tar", args); |
431 |
- logg("!build: Can't execute tar\n"); |
|
431 |
+ mprintf("!build: Can't execute tar\n"); |
|
432 | 432 |
perror("tar"); |
433 | 433 |
free(tarfile); |
434 | 434 |
return -1; |
... | ... |
@@ -438,26 +438,26 @@ static int build(struct optstruct *opt) |
438 | 438 |
} |
439 | 439 |
|
440 | 440 |
if(stat(tarfile, &foo) == -1) { |
441 |
- logg("!build: Tar archive was not created\n"); |
|
441 |
+ mprintf("!build: Tar archive was not created\n"); |
|
442 | 442 |
free(tarfile); |
443 | 443 |
return -1; |
444 | 444 |
} |
445 | 445 |
|
446 | 446 |
if((tar = fopen(tarfile, "rb")) == NULL) { |
447 |
- logg("!build: Can't open file %s\n", tarfile); |
|
447 |
+ mprintf("!build: Can't open file %s\n", tarfile); |
|
448 | 448 |
free(tarfile); |
449 | 449 |
return -1; |
450 | 450 |
} |
451 | 451 |
|
452 | 452 |
if(!(gzfile = cli_gentemp("."))) { |
453 |
- logg("!build: Can't generate temporary name for gzfile\n"); |
|
453 |
+ mprintf("!build: Can't generate temporary name for gzfile\n"); |
|
454 | 454 |
free(tarfile); |
455 | 455 |
fclose(tar); |
456 | 456 |
return -1; |
457 | 457 |
} |
458 | 458 |
|
459 | 459 |
if((gz = gzopen(gzfile, "wb")) == NULL) { |
460 |
- logg("!build: Can't open file %s to write.\n", gzfile); |
|
460 |
+ mprintf("!build: Can't open file %s to write.\n", gzfile); |
|
461 | 461 |
free(tarfile); |
462 | 462 |
fclose(tar); |
463 | 463 |
free(gzfile); |
... | ... |
@@ -466,7 +466,7 @@ static int build(struct optstruct *opt) |
466 | 466 |
|
467 | 467 |
while((bytes = fread(buffer, 1, FILEBUFF, tar)) > 0) { |
468 | 468 |
if(!gzwrite(gz, buffer, bytes)) { |
469 |
- logg("!build: Can't gzwrite to %s\n", gzfile); |
|
469 |
+ mprintf("!build: Can't gzwrite to %s\n", gzfile); |
|
470 | 470 |
fclose(tar); |
471 | 471 |
gzclose(gz); |
472 | 472 |
free(tarfile); |
... | ... |
@@ -504,7 +504,7 @@ static int build(struct optstruct *opt) |
504 | 504 |
|
505 | 505 |
/* MD5 */ |
506 | 506 |
if(!(pt = cli_md5file(gzfile))) { |
507 |
- logg("!build: Can't generate MD5 checksum for gzfile\n"); |
|
507 |
+ mprintf("!build: Can't generate MD5 checksum for gzfile\n"); |
|
508 | 508 |
unlink(gzfile); |
509 | 509 |
free(gzfile); |
510 | 510 |
return -1; |
... | ... |
@@ -515,11 +515,11 @@ static int build(struct optstruct *opt) |
515 | 515 |
|
516 | 516 |
/* ask for builder name */ |
517 | 517 |
fflush(stdin); |
518 |
- logg("Builder name: "); |
|
518 |
+ mprintf("Builder name: "); |
|
519 | 519 |
if(fgets(smbuff, sizeof(smbuff), stdin)) { |
520 | 520 |
cli_chomp(smbuff); |
521 | 521 |
} else { |
522 |
- logg("!build: Can't get builder name\n"); |
|
522 |
+ mprintf("!build: Can't get builder name\n"); |
|
523 | 523 |
unlink(gzfile); |
524 | 524 |
free(gzfile); |
525 | 525 |
return -1; |
... | ... |
@@ -527,14 +527,14 @@ static int build(struct optstruct *opt) |
527 | 527 |
|
528 | 528 |
/* digital signature */ |
529 | 529 |
if(!(tar = fopen(gzfile, "rb"))) { |
530 |
- logg("!build: Can't open file %s for reading\n", gzfile); |
|
530 |
+ mprintf("!build: Can't open file %s for reading\n", gzfile); |
|
531 | 531 |
unlink(gzfile); |
532 | 532 |
free(gzfile); |
533 | 533 |
return -1; |
534 | 534 |
} |
535 | 535 |
|
536 | 536 |
if(!(pt = cli_md5stream(tar, (unsigned char *) buffer))) { |
537 |
- logg("!build: Can't generate MD5 checksum for %s\n", gzfile); |
|
537 |
+ mprintf("!build: Can't generate MD5 checksum for %s\n", gzfile); |
|
538 | 538 |
unlink(gzfile); |
539 | 539 |
free(gzfile); |
540 | 540 |
return -1; |
... | ... |
@@ -543,7 +543,7 @@ static int build(struct optstruct *opt) |
543 | 543 |
rewind(tar); |
544 | 544 |
|
545 | 545 |
if(!(pt = getdsig(opt_arg(opt, "server"), smbuff, buffer))) { |
546 |
- logg("!build: Can't get digital signature from remote server\n"); |
|
546 |
+ mprintf("!build: Can't get digital signature from remote server\n"); |
|
547 | 547 |
unlink(gzfile); |
548 | 548 |
free(gzfile); |
549 | 549 |
fclose(tar); |
... | ... |
@@ -566,7 +566,7 @@ static int build(struct optstruct *opt) |
566 | 566 |
/* build the final database */ |
567 | 567 |
pt = opt_arg(opt, "build"); |
568 | 568 |
if(!(cvd = fopen(pt, "wb"))) { |
569 |
- logg("!build: Can't create final database %s\n", pt); |
|
569 |
+ mprintf("!build: Can't create final database %s\n", pt); |
|
570 | 570 |
unlink(gzfile); |
571 | 571 |
free(gzfile); |
572 | 572 |
fclose(tar); |
... | ... |
@@ -574,7 +574,7 @@ static int build(struct optstruct *opt) |
574 | 574 |
} |
575 | 575 |
|
576 | 576 |
if(fwrite(header, 1, 512, cvd) != 512) { |
577 |
- logg("!build: Can't write to %s\n", pt); |
|
577 |
+ mprintf("!build: Can't write to %s\n", pt); |
|
578 | 578 |
fclose(cvd); |
579 | 579 |
fclose(tar); |
580 | 580 |
unlink(pt); |
... | ... |
@@ -588,7 +588,7 @@ static int build(struct optstruct *opt) |
588 | 588 |
fclose(tar); |
589 | 589 |
fclose(cvd); |
590 | 590 |
unlink(pt); |
591 |
- logg("!build: Can't write to %s\n", gzfile); |
|
591 |
+ mprintf("!build: Can't write to %s\n", gzfile); |
|
592 | 592 |
unlink(gzfile); |
593 | 593 |
free(gzfile); |
594 | 594 |
return -1; |
... | ... |
@@ -598,12 +598,12 @@ static int build(struct optstruct *opt) |
598 | 598 |
fclose(tar); |
599 | 599 |
fclose(cvd); |
600 | 600 |
if(unlink(gzfile) == -1) { |
601 |
- logg("^build: Can't unlink %s\n", gzfile); |
|
601 |
+ mprintf("^build: Can't unlink %s\n", gzfile); |
|
602 | 602 |
return -1; |
603 | 603 |
} |
604 | 604 |
free(gzfile); |
605 | 605 |
|
606 |
- logg("Database %s created\n", pt); |
|
606 |
+ mprintf("Database %s created\n", pt); |
|
607 | 607 |
|
608 | 608 |
return 0; |
609 | 609 |
} |
... | ... |
@@ -622,7 +622,7 @@ static int unpack(struct optstruct *opt) |
622 | 622 |
name = strdup(opt_arg(opt, "unpack")); |
623 | 623 |
|
624 | 624 |
if(cvd_unpack(name, ".") == -1) { |
625 |
- logg("!unpack: Can't unpack CVD file %s\n", name); |
|
625 |
+ mprintf("!unpack: Can't unpack CVD file %s\n", name); |
|
626 | 626 |
free(name); |
627 | 627 |
return -1; |
628 | 628 |
} |
... | ... |
@@ -640,29 +640,29 @@ static int cvdinfo(struct optstruct *opt) |
640 | 640 |
|
641 | 641 |
pt = opt_arg(opt, "info"); |
642 | 642 |
if((cvd = cl_cvdhead(pt)) == NULL) { |
643 |
- logg("!cvdinfo: Can't read/parse CVD header of %s\n", pt); |
|
643 |
+ mprintf("!cvdinfo: Can't read/parse CVD header of %s\n", pt); |
|
644 | 644 |
return -1; |
645 | 645 |
} |
646 | 646 |
|
647 | 647 |
pt = strchr(cvd->time, '-'); |
648 | 648 |
*pt = ':'; |
649 |
- logg("Build time: %s\n", cvd->time); |
|
650 |
- logg("Version: %d\n", cvd->version); |
|
651 |
- logg("Signatures: %d\n", cvd->sigs); |
|
652 |
- logg("Functionality level: %d\n", cvd->fl); |
|
653 |
- logg("Builder: %s\n", cvd->builder); |
|
654 |
- logg("MD5: %s\n", cvd->md5); |
|
655 |
- logg("Digital signature: %s\n", cvd->dsig); |
|
649 |
+ mprintf("Build time: %s\n", cvd->time); |
|
650 |
+ mprintf("Version: %d\n", cvd->version); |
|
651 |
+ mprintf("Signatures: %d\n", cvd->sigs); |
|
652 |
+ mprintf("Functionality level: %d\n", cvd->fl); |
|
653 |
+ mprintf("Builder: %s\n", cvd->builder); |
|
654 |
+ mprintf("MD5: %s\n", cvd->md5); |
|
655 |
+ mprintf("Digital signature: %s\n", cvd->dsig); |
|
656 | 656 |
|
657 | 657 |
#ifndef HAVE_GMP |
658 |
- logg("^Digital signature support not compiled in.\n"); |
|
658 |
+ mprintf("^Digital signature support not compiled in.\n"); |
|
659 | 659 |
#endif |
660 | 660 |
|
661 | 661 |
pt = opt_arg(opt, "info"); |
662 | 662 |
if((ret = cl_cvdverify(pt))) |
663 |
- logg("!cvdinfo: Verification: %s\n", cl_strerror(ret)); |
|
663 |
+ mprintf("!cvdinfo: Verification: %s\n", cl_strerror(ret)); |
|
664 | 664 |
else |
665 |
- logg("Verification OK.\n"); |
|
665 |
+ mprintf("Verification OK.\n"); |
|
666 | 666 |
|
667 | 667 |
cl_cvdfree(cvd); |
668 | 668 |
return 0; |
... | ... |
@@ -678,7 +678,7 @@ static int listdir(const char *dirname) |
678 | 678 |
|
679 | 679 |
|
680 | 680 |
if((dd = opendir(dirname)) == NULL) { |
681 |
- logg("!listdir: Can't open directory %s\n", dirname); |
|
681 |
+ mprintf("!listdir: Can't open directory %s\n", dirname); |
|
682 | 682 |
return -1; |
683 | 683 |
} |
684 | 684 |
|
... | ... |
@@ -699,14 +699,14 @@ static int listdir(const char *dirname) |
699 | 699 |
dbfile = (char *) mcalloc(strlen(dent->d_name) + strlen(dirname) + 2, sizeof(char)); |
700 | 700 |
|
701 | 701 |
if(!dbfile) { |
702 |
- logg("!listdir: Can't allocate memory for dbfile\n"); |
|
702 |
+ mprintf("!listdir: Can't allocate memory for dbfile\n"); |
|
703 | 703 |
closedir(dd); |
704 | 704 |
return -1; |
705 | 705 |
} |
706 | 706 |
sprintf(dbfile, "%s/%s", dirname, dent->d_name); |
707 | 707 |
|
708 | 708 |
if(listdb(dbfile) == -1) { |
709 |
- logg("!listdb: Error listing database %s\n", dbfile); |
|
709 |
+ mprintf("!listdb: Error listing database %s\n", dbfile); |
|
710 | 710 |
free(dbfile); |
711 | 711 |
closedir(dd); |
712 | 712 |
return -1; |
... | ... |
@@ -729,12 +729,12 @@ static int listdb(const char *filename) |
729 | 729 |
|
730 | 730 |
|
731 | 731 |
if((fd = fopen(filename, "rb")) == NULL) { |
732 |
- logg("!listdb: Can't open file %s\n", filename); |
|
732 |
+ mprintf("!listdb: Can't open file %s\n", filename); |
|
733 | 733 |
return -1; |
734 | 734 |
} |
735 | 735 |
|
736 | 736 |
if(!(buffer = (char *) mcalloc(FILEBUFF, 1))) { |
737 |
- logg("!listdb: Can't allocate memory for buffer\n"); |
|
737 |
+ mprintf("!listdb: Can't allocate memory for buffer\n"); |
|
738 | 738 |
fclose(fd); |
739 | 739 |
return -1; |
740 | 740 |
} |
... | ... |
@@ -756,18 +756,18 @@ static int listdb(const char *filename) |
756 | 756 |
#endif |
757 | 757 |
|
758 | 758 |
if(!(dir = cli_gentemp(tmpdir))) { |
759 |
- logg("!listdb: Can't generate temporary name\n"); |
|
759 |
+ mprintf("!listdb: Can't generate temporary name\n"); |
|
760 | 760 |
return -1; |
761 | 761 |
} |
762 | 762 |
|
763 | 763 |
if(mkdir(dir, 0700)) { |
764 |
- logg("!listdb: Can't create temporary directory %s\n", dir); |
|
764 |
+ mprintf("!listdb: Can't create temporary directory %s\n", dir); |
|
765 | 765 |
free(dir); |
766 | 766 |
return -1; |
767 | 767 |
} |
768 | 768 |
|
769 | 769 |
if(cvd_unpack(filename, dir) == -1) { |
770 |
- logg("!listdb: Can't unpack CVD file %s\n", filename); |
|
770 |
+ mprintf("!listdb: Can't unpack CVD file %s\n", filename); |
|
771 | 771 |
rmdirs(dir); |
772 | 772 |
free(dir); |
773 | 773 |
return -1; |
... | ... |
@@ -775,7 +775,7 @@ static int listdb(const char *filename) |
775 | 775 |
|
776 | 776 |
/* list extracted directory */ |
777 | 777 |
if(listdir(dir) == -1) { |
778 |
- logg("!listdb: Can't unpack CVD file %s\n", filename); |
|
778 |
+ mprintf("!listdb: Can't unpack CVD file %s\n", filename); |
|
779 | 779 |
rmdirs(dir); |
780 | 780 |
free(dir); |
781 | 781 |
return -1; |
... | ... |
@@ -793,7 +793,7 @@ static int listdb(const char *filename) |
793 | 793 |
line++; |
794 | 794 |
pt = strchr(buffer, '='); |
795 | 795 |
if(!pt) { |
796 |
- logg("!listdb: Malformed pattern line %d (file %s)\n", line, filename); |
|
796 |
+ mprintf("!listdb: Malformed pattern line %d (file %s)\n", line, filename); |
|
797 | 797 |
fclose(fd); |
798 | 798 |
free(buffer); |
799 | 799 |
return -1; |
... | ... |
@@ -805,7 +805,7 @@ static int listdb(const char *filename) |
805 | 805 |
if((pt = strstr(start, " (Clam)"))) |
806 | 806 |
*pt = 0; |
807 | 807 |
|
808 |
- logg("%s\n", start); |
|
808 |
+ mprintf("%s\n", start); |
|
809 | 809 |
} |
810 | 810 |
|
811 | 811 |
} else if(cli_strbcasestr(filename, ".hdb")) { /* hash database */ |
... | ... |
@@ -816,7 +816,7 @@ static int listdb(const char *filename) |
816 | 816 |
start = cli_strtok(buffer, 2, ":"); |
817 | 817 |
|
818 | 818 |
if(!start) { |
819 |
- logg("!listdb: Malformed pattern line %d (file %s)\n", line, filename); |
|
819 |
+ mprintf("!listdb: Malformed pattern line %d (file %s)\n", line, filename); |
|
820 | 820 |
fclose(fd); |
821 | 821 |
free(buffer); |
822 | 822 |
return -1; |
... | ... |
@@ -825,7 +825,7 @@ static int listdb(const char *filename) |
825 | 825 |
if((pt = strstr(start, " (Clam)"))) |
826 | 826 |
*pt = 0; |
827 | 827 |
|
828 |
- logg("%s\n", start); |
|
828 |
+ mprintf("%s\n", start); |
|
829 | 829 |
free(start); |
830 | 830 |
} |
831 | 831 |
|
... | ... |
@@ -837,7 +837,7 @@ static int listdb(const char *filename) |
837 | 837 |
start = cli_strtok(buffer, 0, ":"); |
838 | 838 |
|
839 | 839 |
if(!start) { |
840 |
- logg("!listdb: Malformed pattern line %d (file %s)\n", line, filename); |
|
840 |
+ mprintf("!listdb: Malformed pattern line %d (file %s)\n", line, filename); |
|
841 | 841 |
fclose(fd); |
842 | 842 |
free(buffer); |
843 | 843 |
return -1; |
... | ... |
@@ -846,7 +846,7 @@ static int listdb(const char *filename) |
846 | 846 |
if((pt = strstr(start, " (Clam)"))) |
847 | 847 |
*pt = 0; |
848 | 848 |
|
849 |
- logg("%s\n", start); |
|
849 |
+ mprintf("%s\n", start); |
|
850 | 850 |
free(start); |
851 | 851 |
} |
852 | 852 |
} |
... | ... |
@@ -887,7 +887,7 @@ static int vbadump(struct optstruct *opt) |
887 | 887 |
|
888 | 888 |
if((fd = open(opt_arg(opt, "vba"), O_RDONLY)) == -1) { |
889 | 889 |
if((fd = open(opt_arg(opt, "vba-hex"), O_RDONLY)) == -1) { |
890 |
- logg("!vbadump: Can't open file %s\n", opt_arg(opt, "vba")); |
|
890 |
+ mprintf("!vbadump: Can't open file %s\n", opt_arg(opt, "vba")); |
|
891 | 891 |
return -1; |
892 | 892 |
} |
893 | 893 |
} |
... | ... |
@@ -895,7 +895,7 @@ static int vbadump(struct optstruct *opt) |
895 | 895 |
/* generate the temporary directory */ |
896 | 896 |
dir = cli_gentemp(NULL); |
897 | 897 |
if(mkdir(dir, 0700)) { |
898 |
- logg("!vbadump: Can't create temporary directory %s\n", dir); |
|
898 |
+ mprintf("!vbadump: Can't create temporary directory %s\n", dir); |
|
899 | 899 |
free(dir); |
900 | 900 |
close(fd); |
901 | 901 |
return -1; |