~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to clamav-milter/netcode.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-03-12 11:30:04 UTC
  • mfrom: (0.41.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100312113004-b0fop4bkycszdd0z
Tags: 0.96~rc1+dfsg-0ubuntu1
* New upstream RC - FFE (LP: #537636):
  - Add OfficialDatabaseOnly option to clamav-base.postinst.in
  - Add LocalSocketGroup option to clamav-base.postinst.in
  - Add LocalSocketMode option to clamav-base.postinst.in
  - Add CrossFilesystems option to clamav-base.postinst.in
  - Add ClamukoScannerCount option to clamav-base.postinst.in
  - Add BytecodeSecurity opiton to clamav-base.postinst.in
  - Add DetectionStatsHostID option to clamav-freshclam.postinst.in
  - Add Bytecode option to clamav-freshclam.postinst.in
  - Add MilterSocketGroup option to clamav-milter.postinst.in
  - Add MilterSocketMode option to clamav-milter.postinst.in
  - Add ReportHostname option to clamav-milter.postinst.in
  - Bump libclamav SO version to 6.1.0 in libclamav6.install
  - Drop clamdmon from clamav.examples (no longer shipped by upstream)
  - Drop libclamav.a from libclamav-dev.install (not built by upstream)
  - Update SO version for lintian override for libclamav6
  - Add new Bytecode Testing Tool, usr/bin/clambc, to clamav.install
  - Add build-depends on python and python-setuptools for new test suite
  - Update debian/copyright for the embedded copy of llvm (using the system
    llvm is not currently feasible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
257
257
        }
258
258
        if(res==-1) {
259
259
            char er[256];
 
260
            if (errno == EAGAIN)
 
261
                continue;
260
262
            strerror_print("!recv failed after successful select");
261
263
            close(s);
262
264
            return NULL;
315
317
        unlink(unlinkme);
316
318
        free(unlinkme);
317
319
    } else {
318
 
        char *reply=NULL, *port;
319
 
        int nport;
320
 
        struct CP_ENTRY new_cpe;
321
 
        union {
322
 
            struct sockaddr_in sa4;
323
 
            struct sockaddr_in6 sa6;
324
 
        } sa;
325
 
 
326
 
        if(nc_send(*main, "nSTREAM\n", 8) || !(reply = nc_recv(*main)) || !(port = strstr(reply, "PORT"))) {
 
320
        if(nc_send(*main, "nINSTREAM\n", 10)) {
327
321
            logg("!Failed to communicate with clamd\n");
328
 
            if(reply) {
329
 
                free(reply);
330
 
                close(*main);
331
 
            }
332
 
            return 1;
333
 
        }
334
 
        port+=5;
335
 
        sscanf(port, "%d", &nport);
336
 
        free(reply);
337
 
        if(cpe->server->sa_family == AF_INET && cpe->socklen == sizeof(struct sockaddr_in)) {
338
 
            memcpy(&sa, cpe->server, sizeof(struct sockaddr_in));
339
 
            sa.sa4.sin_port = htons(nport);
340
 
            new_cpe.socklen = sizeof(struct sockaddr_in);
341
 
        } else if(cpe->server->sa_family == AF_INET6 && cpe->socklen == sizeof(struct sockaddr_in6)) {
342
 
            memcpy(&sa, cpe->server, sizeof(struct sockaddr_in6));
343
 
            sa.sa6.sin6_port = htons(nport);
344
 
            new_cpe.socklen = sizeof(struct sockaddr_in6);
345
 
        } else {
346
 
            logg("!WTF WHY AM I DOING HERE???\n");
347
 
            close(*main);
348
 
            return 1;
349
 
        }
350
 
        new_cpe.server = (struct sockaddr *)&sa;
351
 
        if ((*alt = nc_connect_entry(&new_cpe)) == -1) {
352
 
            logg("!Failed to communicate with clamd for streaming\n");
353
322
            close(*main);
354
323
            return 1;
355
324
        }
519
488
        while(opt) {
520
489
            char *lnetname = opt->strarg;
521
490
            struct LOCALNET *l;
522
 
            char *mask = strrchr(lnetname, '/');
 
491
            char *mask = strrchr(lnetname, *PATHSEP);
523
492
 
524
493
            if(mask) {
525
494
                *mask='\0';