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

« back to all changes in this revision

Viewing changes to libclamav/others_common.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:
52
52
#include <malloc.h>
53
53
#endif
54
54
 
 
55
#include <openssl/ssl.h>
 
56
#include <openssl/err.h>
 
57
#include "libclamav/crypto.h"
 
58
 
55
59
#include "clamav.h"
56
60
#include "others.h"
57
 
#include "md5.h"
58
61
#include "cltypes.h"
59
62
#include "regex/regex.h"
60
63
#include "ltdl.h"
61
64
#include "matcher-ac.h"
62
 
#include "md5.h"
63
65
 
64
66
static unsigned char name_salt[16] = { 16, 38, 97, 12, 8, 4, 72, 196, 217, 144, 33, 124, 18, 11, 17, 253 };
65
67
 
823
825
{
824
826
        unsigned char digest[16];
825
827
        char *md5str, *pt;
826
 
        cli_md5_ctx ctx;
827
828
        int i;
828
829
 
829
 
 
830
 
    cli_md5_init(&ctx);
831
 
    cli_md5_update(&ctx, buffer, len);
832
 
    cli_md5_final(digest, &ctx);
 
830
    cl_hash_data("md5", buffer, len, digest, NULL);
833
831
 
834
832
    if(dig)
835
833
        memcpy(dig, digest, 16);
903
901
 
904
902
int cli_gentempfd(const char *dir, char **name, int *fd)
905
903
{
906
 
 
907
904
    *name = cli_gentemp(dir);
908
905
    if(!*name)
909
906
        return CL_EMEM;
913
910
     * EEXIST is almost impossible to occur, so we just treat it as other
914
911
     * errors
915
912
     */
916
 
   if(*fd == -1) {
917
 
        cli_errmsg("cli_gentempfd: Can't create temporary file %s: %s\n", *name, strerror(errno));
918
 
        free(*name);
919
 
        return CL_ECREAT;
 
913
    if(*fd == -1) {
 
914
        cli_errmsg("cli_gentempfd: Can't create temporary file %s: %s\n", *name, strerror(errno));
 
915
        free(*name);
 
916
        *name = NULL;
 
917
        return CL_ECREAT;
920
918
    }
921
919
 
922
920
    return CL_SUCCESS;