~ubuntu-branches/ubuntu/quantal/clamav/quantal-updates

« back to all changes in this revision

Viewing changes to clamdscan/proto.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-03-19 15:32:35 UTC
  • mfrom: (121.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130319153235-mob5bwxchg168qhp
Tags: 0.97.7+dfsg-1ubuntu0.12.10.1
* SECURITY UPDATE: Updated to 0.97.7 to fix multiple security issues.
  (LP: #1157385)
  - CVE numbers pending

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
int printinfected;
59
59
extern struct optstruct *clamdopts;
60
60
 
61
 
static const char *scancmd[] = { "CONTSCAN", "MULTISCAN" };
 
61
static const char *scancmd[] = { "CONTSCAN", "MULTISCAN", "INSTREAM", "FILDES", "ALLMATCHSCAN" };
62
62
 
63
63
/* Connects to clamd 
64
64
 * Returns a FD or -1 on error */
202
202
    switch(scantype) {
203
203
    case MULTI:
204
204
    case CONT:
 
205
    case ALLMATCH:
 
206
    if (!filename) {
 
207
        logg("Filename cannot be NULL for MULTISCAN or CONTSCAN.\n");
 
208
        return -1;
 
209
    }
205
210
    len = strlen(filename) + strlen(scancmd[scantype]) + 3;
206
211
    if (!(bol = malloc(len))) {
207
212
        logg("!Cannot allocate a command buffer: %s\n", strerror(errno));
247
252
                colon = strrchr(bol, ':');
248
253
            }
249
254
            if(!colon) {
250
 
                logg("Failed to parse reply\n");
 
255
                char * unkco = "UNKNOWN COMMAND";
 
256
                if (!strncmp(bol, unkco, sizeof(unkco) - 1))
 
257
                    logg("clamd replied \"UNKNOWN COMMAND\". Command was %s\n", 
 
258
                         (scantype < 0 || scantype > MAX_SCANTYPE) ? "unidentified" :
 
259
                                                                     scancmd[scantype]);
 
260
                else
 
261
                    logg("Failed to parse reply: \"%s\"\n", bol);
251
262
                return -1;
252
263
            } else if(!memcmp(eol - 7, " FOUND", 6)) {
253
264
                *(eol - 7) = 0;