~ubuntu-branches/ubuntu/natty/clamav/natty-updates

« back to all changes in this revision

Viewing changes to freshclam/manager.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2008-11-11 22:24:38 UTC
  • mfrom: (0.35.2 sid)
  • Revision ID: james.westby@ubuntu.com-20081111222438-ezhpc4lldn62u9cg
Tags: 0.94.dfsg.1-1ubuntu1
* Merge from Debian Unstable (LP: #296704).  Remaining Ubuntu changes:
  - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6 for
    clamav-daemon and clamav-freshclam
  - add debian/usr.bin.freshclam and debian/usr.sbin.clamd
  - debian/clamav-(daemon|freshclam).dirs: add etc/apparmor.d/force-complain
  - debian/clamav-(daemon|freshclam).install: install profiles
  - debian/clamav-(daemon|freshclam).preinst: create symlink for
    force-complain/ on pre-feisty upgrades, upgrades where apparmor-profiles
    profile is unchanged (ie non-enforcing) and upgrades where the profile
    doesn't exist.
  - debian/clamav-(daemon|freshclam).postrm: remove symlink in
    force-complain/ on purge.
  - debian/clamav-(daemon|freshclam).postinst.in: reload apparmor
  - update README.Debian with note on Apparmor
* Update apparmor profile for clamd to work with TCP sockets (LP: #288942)

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
{
125
125
        int socketfd = -1;
126
126
 
 
127
#ifdef SUPPORT_IPv6
127
128
    if(prot == AF_INET6)
128
129
        socketfd = socket(AF_INET6, SOCK_STREAM, 0);
129
130
    else
 
131
#endif
130
132
        socketfd = socket(AF_INET, SOCK_STREAM, 0);
131
133
    if(socketfd < 0) {
132
134
        logg("!Can't create new socket\n");
151
153
            } else {
152
154
                    void *addr;
153
155
 
 
156
#ifdef SUPPORT_IPv6
154
157
                if(res->ai_family == AF_INET6)
155
158
                    addr = &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr;
156
159
                else
 
160
#endif
157
161
                    addr = &((struct sockaddr_in *) res->ai_addr)->sin_addr;
158
162
 
159
163
                if(inet_ntop(res->ai_family, addr, ipaddr, sizeof(ipaddr)))
253
257
            void *addr;
254
258
 
255
259
        ips++;
 
260
#ifdef SUPPORT_IPv6
256
261
        if(rp->ai_family == AF_INET6)
257
262
            addr = &((struct sockaddr_in6 *) rp->ai_addr)->sin6_addr;
258
263
        else
 
264
#endif
259
265
            addr = &((struct sockaddr_in *) rp->ai_addr)->sin_addr;
260
266
 
261
267
        if(!inet_ntop(rp->ai_family, addr, ipaddr, sizeof(ipaddr))) {
469
475
        char buff[512], statsdat[512], newstatsdat[512], uastr[128];
470
476
        char logfile[256], fbuff[FILEBUFF];
471
477
        char *pt, *pt2;
472
 
        const char *line;
 
478
        const char *line, *country = NULL;
473
479
        struct cfgstruct *clamdopt;
474
480
        const struct cfgstruct *cpt;
475
481
        struct stat sb;
478
484
        unsigned int qcnt, entries, submitted = 0, permfail = 0;
479
485
 
480
486
 
 
487
    if((cpt = cfgopt(copt, "DetectionStatsCountry"))->enabled) {
 
488
        if(strlen(cpt->strarg) != 2 || !isalpha(cpt->strarg[0]) || !isalpha(cpt->strarg[1])) {
 
489
            logg("!SubmitDetectionStats: DetectionStatsCountry requires a two-letter country code\n");
 
490
            return 56;
 
491
        }
 
492
        country = cpt->strarg;
 
493
    }
 
494
 
481
495
    if(!(clamdopt = getcfg(clamdcfg, 1))) {
482
496
        logg("!SubmitDetectionStats: Can't open or parse configuration file %s\n", clamdcfg);
483
497
        return 56;
541
555
    if((cpt = cfgopt(copt, "HTTPUserAgent"))->enabled)
542
556
        strncpy(uastr, cpt->strarg, sizeof(uastr));
543
557
    else
544
 
        snprintf(uastr, sizeof(uastr), PACKAGE"/%s (OS: "TARGET_OS_TYPE", ARCH: "TARGET_ARCH_TYPE", CPU: "TARGET_CPU_TYPE")", get_version());
 
558
        snprintf(uastr, sizeof(uastr), PACKAGE"/%s (OS: "TARGET_OS_TYPE", ARCH: "TARGET_ARCH_TYPE", CPU: "TARGET_CPU_TYPE")%s%s", get_version(), country ? ":" : "", country ? country : "");
545
559
    uastr[sizeof(uastr) - 1] = 0;
546
560
 
547
561
    ret = 0;