~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to shared/misc.c

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include <ctype.h>
40
40
#include <errno.h>
41
41
 
 
42
#include <openssl/ssl.h>
 
43
#include <openssl/err.h>
 
44
#include "libclamav/crypto.h"
 
45
 
42
46
#include "shared/optparser.h"
43
47
#include "shared/output.h"
44
48
 
319
323
        return match;
320
324
}
321
325
 
322
 
int cfg_tcpsock(const struct optstruct *opts, struct sockaddr_in *tcpsock, in_addr_t defaultbind)
323
 
{
324
 
    struct hostent *he;
325
 
    const struct optstruct *opt = optget(opts, "TCPSocket");
326
 
 
327
 
    if(opt->numarg > 65535)
328
 
        return -1;
329
 
 
330
 
    memset(tcpsock, 0, sizeof(*tcpsock));
331
 
    tcpsock->sin_family = AF_INET;
332
 
    tcpsock->sin_port = htons(opt->numarg);
333
 
 
334
 
    if(!(opt = optget(opts, "TCPAddr"))->enabled) {
335
 
        tcpsock->sin_addr.s_addr = htonl(defaultbind);
336
 
        return 0;
337
 
    }
338
 
    he = gethostbyname(opt->strarg);
339
 
    if(!he)
340
 
        return -1;
341
 
 
342
 
    tcpsock->sin_addr = *(struct in_addr *) he->h_addr_list[0];
343
 
    return 0;
344
 
}
345
 
 
346
326
int cli_is_abspath(const char *path) {
347
327
#ifdef _WIN32
348
328
    int len = strlen(path);