introduce htmalloc
This commit is contained in:
parent
ec14ad4e99
commit
ae46b70398
20
smmapdfw/configure
vendored
20
smmapdfw/configure
vendored
@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.59 for smmapdfw 0.91.
|
# Generated by GNU Autoconf 2.59 for smmapdfw 0.92.
|
||||||
#
|
#
|
||||||
# Report bugs to <woho@hottis.de>.
|
# Report bugs to <woho@hottis.de>.
|
||||||
#
|
#
|
||||||
@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='smmapdfw'
|
PACKAGE_NAME='smmapdfw'
|
||||||
PACKAGE_TARNAME='smmapdfw'
|
PACKAGE_TARNAME='smmapdfw'
|
||||||
PACKAGE_VERSION='0.91'
|
PACKAGE_VERSION='0.92'
|
||||||
PACKAGE_STRING='smmapdfw 0.91'
|
PACKAGE_STRING='smmapdfw 0.92'
|
||||||
PACKAGE_BUGREPORT='woho@hottis.de'
|
PACKAGE_BUGREPORT='woho@hottis.de'
|
||||||
|
|
||||||
# Factoring default headers for most tests.
|
# Factoring default headers for most tests.
|
||||||
@ -953,7 +953,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures smmapdfw 0.91 to adapt to many kinds of systems.
|
\`configure' configures smmapdfw 0.92 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@ -1019,7 +1019,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of smmapdfw 0.91:";;
|
short | recursive ) echo "Configuration of smmapdfw 0.92:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@ -1162,7 +1162,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit 0
|
test -n "$ac_init_help" && exit 0
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
smmapdfw configure 0.91
|
smmapdfw configure 0.92
|
||||||
generated by GNU Autoconf 2.59
|
generated by GNU Autoconf 2.59
|
||||||
|
|
||||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||||
@ -1176,7 +1176,7 @@ cat >&5 <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by smmapdfw $as_me 0.91, which was
|
It was created by smmapdfw $as_me 0.92, which was
|
||||||
generated by GNU Autoconf 2.59. Invocation command line was
|
generated by GNU Autoconf 2.59. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
@ -1707,7 +1707,7 @@ fi
|
|||||||
|
|
||||||
PACKAGE=smmapdfw
|
PACKAGE=smmapdfw
|
||||||
|
|
||||||
VERSION=0.91
|
VERSION=0.92
|
||||||
|
|
||||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||||
{ { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
|
{ { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
|
||||||
@ -21715,7 +21715,7 @@ _ASBOX
|
|||||||
} >&5
|
} >&5
|
||||||
cat >&5 <<_CSEOF
|
cat >&5 <<_CSEOF
|
||||||
|
|
||||||
This file was extended by smmapdfw $as_me 0.91, which was
|
This file was extended by smmapdfw $as_me 0.92, which was
|
||||||
generated by GNU Autoconf 2.59. Invocation command line was
|
generated by GNU Autoconf 2.59. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@ -21778,7 +21778,7 @@ _ACEOF
|
|||||||
|
|
||||||
cat >>$CONFIG_STATUS <<_ACEOF
|
cat >>$CONFIG_STATUS <<_ACEOF
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
smmapdfw config.status 0.91
|
smmapdfw config.status 0.92
|
||||||
configured by $0, generated by GNU Autoconf 2.59,
|
configured by $0, generated by GNU Autoconf 2.59,
|
||||||
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
|
|
||||||
AC_INIT(smmapdfw, 0.91, woho@hottis.de)
|
AC_INIT(smmapdfw, 0.92, woho@hottis.de)
|
||||||
AM_INIT_AUTOMAKE(smmapdfw, 0.91)
|
AM_INIT_AUTOMAKE(smmapdfw, 0.92)
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "smtp.h"
|
#include "smtp.h"
|
||||||
#include "htdns.h"
|
#include "htdns.h"
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
#define SMM_LOCAL_PERM_NOK 101
|
#define SMM_LOCAL_PERM_NOK 101
|
||||||
#define SMM_LOCAL_TEMP_NOK 102
|
#define SMM_LOCAL_TEMP_NOK 102
|
||||||
@ -75,7 +76,7 @@ class_descriptor_t cyruscheck = {
|
|||||||
int cyrus_init(cfgl_t *cfg, void **handle) {
|
int cyrus_init(cfgl_t *cfg, void **handle) {
|
||||||
cyrus_container_handle_t *cch;
|
cyrus_container_handle_t *cch;
|
||||||
|
|
||||||
cch = (cyrus_container_handle_t*) malloc(sizeof(cyrus_container_handle_t));
|
cch = (cyrus_container_handle_t*) htmalloc(sizeof(cyrus_container_handle_t));
|
||||||
cch->cfg = cfg;
|
cch->cfg = cfg;
|
||||||
|
|
||||||
cch->timeout = atoi(findcfglx(cch->cfg, "timeout", "5"));
|
cch->timeout = atoi(findcfglx(cch->cfg, "timeout", "5"));
|
||||||
@ -165,7 +166,7 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
|||||||
err = smtp_mailfrom(lmtp, cch->sender_address);
|
err = smtp_mailfrom(lmtp, cch->sender_address);
|
||||||
break;
|
break;
|
||||||
case RCPTTO:
|
case RCPTTO:
|
||||||
tmp_arg = (char*) malloc(sizeof(char) * (strlen(depot_uid)+5));
|
tmp_arg = (char*) htmalloc(sizeof(char) * (strlen(depot_uid)+5));
|
||||||
*tmp_arg = '\0';
|
*tmp_arg = '\0';
|
||||||
strcat(tmp_arg, "<");
|
strcat(tmp_arg, "<");
|
||||||
strcat(tmp_arg, depot_uid);
|
strcat(tmp_arg, depot_uid);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
include_HEADERS=containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h
|
include_HEADERS=containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h htmalloc.h
|
||||||
lib_LTLIBRARIES = libsmmapdfw.la
|
lib_LTLIBRARIES = libsmmapdfw.la
|
||||||
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c
|
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,9 +87,9 @@ RC = @RC@
|
|||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
|
|
||||||
include_HEADERS = containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h
|
include_HEADERS = containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h htmalloc.h
|
||||||
lib_LTLIBRARIES = libsmmapdfw.la
|
lib_LTLIBRARIES = libsmmapdfw.la
|
||||||
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c
|
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
CONFIG_HEADER = ../config.h
|
CONFIG_HEADER = ../config.h
|
||||||
CONFIG_CLEAN_FILES =
|
CONFIG_CLEAN_FILES =
|
||||||
@ -103,7 +103,7 @@ LIBS = @LIBS@
|
|||||||
libsmmapdfw_la_LDFLAGS =
|
libsmmapdfw_la_LDFLAGS =
|
||||||
libsmmapdfw_la_LIBADD =
|
libsmmapdfw_la_LIBADD =
|
||||||
libsmmapdfw_la_OBJECTS = cfg.lo queue.lo count.lo safe_write.lo \
|
libsmmapdfw_la_OBJECTS = cfg.lo queue.lo count.lo safe_write.lo \
|
||||||
config_public.lo htdns.lo smtp.lo
|
config_public.lo htdns.lo smtp.lo htmalloc.lo
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
@ -119,7 +119,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
|||||||
TAR = tar
|
TAR = tar
|
||||||
GZIP_ENV = --best
|
GZIP_ENV = --best
|
||||||
DEP_FILES = .deps/cfg.P .deps/config_public.P .deps/count.P \
|
DEP_FILES = .deps/cfg.P .deps/config_public.P .deps/count.P \
|
||||||
.deps/htdns.P .deps/queue.P .deps/safe_write.P .deps/smtp.P
|
.deps/htdns.P .deps/htmalloc.P .deps/queue.P .deps/safe_write.P \
|
||||||
|
.deps/smtp.P
|
||||||
SOURCES = $(libsmmapdfw_la_SOURCES)
|
SOURCES = $(libsmmapdfw_la_SOURCES)
|
||||||
OBJECTS = $(libsmmapdfw_la_OBJECTS)
|
OBJECTS = $(libsmmapdfw_la_OBJECTS)
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cfg.h"
|
#include "cfg.h"
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
#include "sunos_comp.h"
|
#include "sunos_comp.h"
|
||||||
|
|
||||||
@ -103,9 +104,9 @@ config_section_t *readcfg(char *cfgfile) {
|
|||||||
state = STATE_START;
|
state = STATE_START;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
cs = (config_section_t*) malloc(sizeof(config_section_t));
|
cs = (config_section_t*) htmalloc(sizeof(config_section_t));
|
||||||
cs->next = NULL;
|
cs->next = NULL;
|
||||||
cs->name = (char*) malloc(strlen(buffer)+1);
|
cs->name = (char*) htmalloc(strlen(buffer)+1);
|
||||||
strcpy(cs->name, buffer);
|
strcpy(cs->name, buffer);
|
||||||
cs->item = NULL;
|
cs->item = NULL;
|
||||||
|
|
||||||
@ -135,9 +136,9 @@ config_section_t *readcfg(char *cfgfile) {
|
|||||||
state = STATE_EQUAL;
|
state = STATE_EQUAL;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
ci = (config_item_t*) malloc(sizeof(config_item_t));
|
ci = (config_item_t*) htmalloc(sizeof(config_item_t));
|
||||||
ci->next = NULL;
|
ci->next = NULL;
|
||||||
ci->name = (char*) malloc(strlen(buffer)+1);
|
ci->name = (char*) htmalloc(strlen(buffer)+1);
|
||||||
strcpy(ci->name, buffer);
|
strcpy(ci->name, buffer);
|
||||||
ci->value = NULL;
|
ci->value = NULL;
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ config_section_t *readcfg(char *cfgfile) {
|
|||||||
state = STATE_START;
|
state = STATE_START;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
ci->value = (char*) malloc(strlen(buffer)+1);
|
ci->value = (char*) htmalloc(strlen(buffer)+1);
|
||||||
strcpy(ci->value, buffer);
|
strcpy(ci->value, buffer);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "htdns.h"
|
#include "htdns.h"
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
|
|
||||||
#if ! HAVE_LIBDJBDNS
|
#if ! HAVE_LIBDJBDNS
|
||||||
extern int h_errno;
|
extern int h_errno;
|
||||||
@ -77,7 +79,7 @@ static int get_domain_name(answer_t *answer, int offset, char **name) {
|
|||||||
offset2 = ((len & ~0xC0) << 8) + answer->buf[offset++];
|
offset2 = ((len & ~0xC0) << 8) + answer->buf[offset++];
|
||||||
get_domain_name(answer, offset2, &name_buf2);
|
get_domain_name(answer, offset2, &name_buf2);
|
||||||
remember_name_buf = name_buf;
|
remember_name_buf = name_buf;
|
||||||
name_buf = (char*) realloc(name_buf, ((NULL != name_buf) ? strlen(name_buf) : 0) + strlen(name_buf2) + 1);
|
name_buf = (char*) htrealloc(name_buf, ((NULL != name_buf) ? strlen(name_buf) : 0) + strlen(name_buf2) + 1);
|
||||||
if (NULL == remember_name_buf) {
|
if (NULL == remember_name_buf) {
|
||||||
name_buf[0] = '\0';
|
name_buf[0] = '\0';
|
||||||
}
|
}
|
||||||
@ -93,7 +95,7 @@ static int get_domain_name(answer_t *answer, int offset, char **name) {
|
|||||||
offset += len;
|
offset += len;
|
||||||
if (NULL != name) {
|
if (NULL != name) {
|
||||||
i = (NULL != name_buf) ? strlen(name_buf) : 0;
|
i = (NULL != name_buf) ? strlen(name_buf) : 0;
|
||||||
name_buf = (char*) realloc(name_buf, i+len+2);
|
name_buf = (char*) htrealloc(name_buf, i+len+2);
|
||||||
strncpy(name_buf + i, answer->buf + start, len);
|
strncpy(name_buf + i, answer->buf + start, len);
|
||||||
name_buf[i+len] = '\0';
|
name_buf[i+len] = '\0';
|
||||||
strcat(name_buf, ".");
|
strcat(name_buf, ".");
|
||||||
@ -108,7 +110,7 @@ static int get_domain_name(answer_t *answer, int offset, char **name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int get_mx_rdata(answer_t *answer, int offset, int len, mx_rdata_t **resp) {
|
static int get_mx_rdata(answer_t *answer, int offset, int len, mx_rdata_t **resp) {
|
||||||
*resp = (mx_rdata_t*) malloc(sizeof(mx_rdata_t));
|
*resp = (mx_rdata_t*) htmalloc(sizeof(mx_rdata_t));
|
||||||
(*resp)->preference = get16(answer->buf, offset);
|
(*resp)->preference = get16(answer->buf, offset);
|
||||||
get_domain_name(answer, offset+2, &(*resp)->exchange);
|
get_domain_name(answer, offset+2, &(*resp)->exchange);
|
||||||
(*resp)->type = T_MX;
|
(*resp)->type = T_MX;
|
||||||
@ -124,7 +126,7 @@ static void free_mx_rdata(mx_rdata_t *resp) {
|
|||||||
|
|
||||||
|
|
||||||
static int get_a_rdata(answer_t *answer, int offset, int len, a_rdata_t **resp) {
|
static int get_a_rdata(answer_t *answer, int offset, int len, a_rdata_t **resp) {
|
||||||
*resp = (a_rdata_t*) malloc(sizeof(a_rdata_t));
|
*resp = (a_rdata_t*) htmalloc(sizeof(a_rdata_t));
|
||||||
(*resp)->address = htonl(get32(answer->buf, offset));
|
(*resp)->address = htonl(get32(answer->buf, offset));
|
||||||
(*resp)->type = T_A;
|
(*resp)->type = T_A;
|
||||||
|
|
||||||
@ -132,7 +134,7 @@ static int get_a_rdata(answer_t *answer, int offset, int len, a_rdata_t **resp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int get_cname_rdata(answer_t *answer, int offset, int len, cname_rdata_t **resp) {
|
static int get_cname_rdata(answer_t *answer, int offset, int len, cname_rdata_t **resp) {
|
||||||
*resp = (cname_rdata_t*) malloc(sizeof(cname_rdata_t));
|
*resp = (cname_rdata_t*) htmalloc(sizeof(cname_rdata_t));
|
||||||
get_domain_name(answer, offset, &(*resp)->cname);
|
get_domain_name(answer, offset, &(*resp)->cname);
|
||||||
(*resp)->type = T_CNAME;
|
(*resp)->type = T_CNAME;
|
||||||
|
|
||||||
@ -317,7 +319,7 @@ static void** get_rrs(char *domain, int qtype) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* answer section */
|
/* answer section */
|
||||||
rdata = (void**)malloc(sizeof(void*) * (ntohs(answer->hdr.ancount)+1));
|
rdata = (void**)htmalloc(sizeof(void*) * (ntohs(answer->hdr.ancount)+1));
|
||||||
for (y = 0; y < ntohs(answer->hdr.ancount); y++) {
|
for (y = 0; y < ntohs(answer->hdr.ancount); y++) {
|
||||||
cnt = get_domain_name(answer, cnt, NULL);
|
cnt = get_domain_name(answer, cnt, NULL);
|
||||||
type = get16(answer->buf, cnt);
|
type = get16(answer->buf, cnt);
|
||||||
@ -401,7 +403,7 @@ mx_rdata_t** get_best_mx_rrs(char *domain) {
|
|||||||
return all_mx_rrs;
|
return all_mx_rrs;
|
||||||
} else {
|
} else {
|
||||||
/* space for the minimum pref rr's */
|
/* space for the minimum pref rr's */
|
||||||
best_mx_rrs = (mx_rdata_t**) malloc(sizeof(mx_rdata_t*) * (best_cnt+1));
|
best_mx_rrs = (mx_rdata_t**) htmalloc(sizeof(mx_rdata_t*) * (best_cnt+1));
|
||||||
for (mx_rdata2 = all_mx_rrs; *mx_rdata2 != NULL; mx_rdata2++) {
|
for (mx_rdata2 = all_mx_rrs; *mx_rdata2 != NULL; mx_rdata2++) {
|
||||||
if ((*mx_rdata2)->preference == min_pref) {
|
if ((*mx_rdata2)->preference == min_pref) {
|
||||||
/* is a minimum one, keep it */
|
/* is a minimum one, keep it */
|
||||||
|
56
smmapdfw/libsmmapdfw/htmalloc.c
Normal file
56
smmapdfw/libsmmapdfw/htmalloc.c
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||||
|
|
||||||
|
This file is part of smmapdfw.
|
||||||
|
|
||||||
|
smmapdfw is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
smmapdfw is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with smmapdfw. If not, write to the Free Software Foundation, 59
|
||||||
|
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
|
|
||||||
|
void *htmalloc(size_t size) {
|
||||||
|
void *p = malloc(size);
|
||||||
|
if (NULL == p) {
|
||||||
|
syslog(LOG_ERR, "htmalloc: out of memory");
|
||||||
|
exit(153);
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *htrealloc(void *ptr, size_t size) {
|
||||||
|
void *p = realloc(ptr, size);
|
||||||
|
if (NULL == p) {
|
||||||
|
syslog(LOG_ERR, "htremalloc: out of memory");
|
||||||
|
exit(153);
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *htstrdup(const char *s) {
|
||||||
|
char *p = htmalloc(strlen(s) + 1);
|
||||||
|
strcpy(p, s);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
34
smmapdfw/libsmmapdfw/htmalloc.h
Normal file
34
smmapdfw/libsmmapdfw/htmalloc.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||||
|
|
||||||
|
This file is part of smmapdfw.
|
||||||
|
|
||||||
|
smmapdfw is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
smmapdfw is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with smmapdfw. If not, write to the Free Software Foundation, 59
|
||||||
|
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HTMALLOC_H_
|
||||||
|
#define _HTMALLOC_H_
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void *htmalloc(size_t size);
|
||||||
|
void *htrealloc(void *ptr, size_t size);
|
||||||
|
char *htstrdup(const char *s);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _HTMALLOC_H_ */
|
||||||
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
#ifdef _TEST_MODE_
|
#ifdef _TEST_MODE_
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -45,7 +46,7 @@ void queue_destroy(ht_queue_t *q) {
|
|||||||
int queue_put(ht_queue_t *q, void *d) {
|
int queue_put(ht_queue_t *q, void *d) {
|
||||||
queue_entry_t *entry;
|
queue_entry_t *entry;
|
||||||
|
|
||||||
entry = (queue_entry_t *) malloc(sizeof(queue_entry_t));
|
entry = (queue_entry_t *) htmalloc(sizeof(queue_entry_t));
|
||||||
if (NULL == entry)
|
if (NULL == entry)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "smtp.h"
|
#include "smtp.h"
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
|
|
||||||
#define BUFSIZE 1024
|
#define BUFSIZE 1024
|
||||||
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
|
|
||||||
smtp_t *smtp_init(unsigned int address, int port, int timeout) {
|
smtp_t *smtp_init(unsigned int address, int port, int timeout) {
|
||||||
smtp_t *handle = (smtp_t*) malloc(sizeof(smtp_t));
|
smtp_t *handle = (smtp_t*) htmalloc(sizeof(smtp_t));
|
||||||
|
|
||||||
handle->address = address;
|
handle->address = address;
|
||||||
handle->port = port;
|
handle->port = port;
|
||||||
@ -52,7 +52,7 @@ smtp_t *smtp_init(unsigned int address, int port, int timeout) {
|
|||||||
handle->response_code = 0;
|
handle->response_code = 0;
|
||||||
handle->got_timeout = 0;
|
handle->got_timeout = 0;
|
||||||
|
|
||||||
handle->buffer = (char*) malloc(BUFSIZE+5);
|
handle->buffer = (char*) htmalloc(BUFSIZE+5);
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "containers_public.h"
|
#include "containers_public.h"
|
||||||
#include "smmapd.h"
|
#include "smmapd.h"
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
|
|
||||||
#define CFG_LUALIB_NAMES "load"
|
#define CFG_LUALIB_NAMES "load"
|
||||||
@ -87,7 +88,7 @@ int lua_init(cfgl_t *cfg, void **handle) {
|
|||||||
const luaL_reg *lualib;
|
const luaL_reg *lualib;
|
||||||
cfgl_t *cfgl_iter;
|
cfgl_t *cfgl_iter;
|
||||||
|
|
||||||
lch = (lua_container_handle_t*) malloc(sizeof(lua_container_handle_t));
|
lch = (lua_container_handle_t*) htmalloc(sizeof(lua_container_handle_t));
|
||||||
lch->cfg = cfg;
|
lch->cfg = cfg;
|
||||||
|
|
||||||
lua_filename = findcfgl(lch->cfg, CFG_LUA_FILENAME);
|
lua_filename = findcfgl(lch->cfg, CFG_LUA_FILENAME);
|
||||||
@ -165,7 +166,7 @@ int lua_destroy(void *handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int lua_work_setup(void *handle, void **work_handle) {
|
int lua_work_setup(void *handle, void **work_handle) {
|
||||||
lua_worker_handle_t *lwh = (lua_worker_handle_t*)malloc(sizeof(lua_worker_handle_t));
|
lua_worker_handle_t *lwh = (lua_worker_handle_t*)htmalloc(sizeof(lua_worker_handle_t));
|
||||||
lwh->lch = (lua_container_handle_t*) handle;
|
lwh->lch = (lua_container_handle_t*) handle;
|
||||||
|
|
||||||
lwh->l = lua_newthread(lwh->lch->l);
|
lwh->l = lua_newthread(lwh->lch->l);
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "containers.h"
|
#include "containers.h"
|
||||||
#include "cfg.h"
|
#include "cfg.h"
|
||||||
#include "smmapd.h"
|
#include "smmapd.h"
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
|
|
||||||
#define CFG_SECTION_GLOBAL "global"
|
#define CFG_SECTION_GLOBAL "global"
|
||||||
@ -59,7 +60,7 @@ classes_t *classes_head = &classes_root;
|
|||||||
|
|
||||||
|
|
||||||
int containers_setup(container_handle_t **ch) {
|
int containers_setup(container_handle_t **ch) {
|
||||||
*ch = (container_handle_t*)malloc(sizeof(container_handle_t));
|
*ch = (container_handle_t*)htmalloc(sizeof(container_handle_t));
|
||||||
(*ch)->worker_handle_root.next = NULL;
|
(*ch)->worker_handle_root.next = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -130,7 +131,7 @@ int containers_dispatcher(container_handle_t *ch, char *input, char *output) {
|
|||||||
|
|
||||||
if ((NULL == wh_last->next) && (NULL == wh2)) {
|
if ((NULL == wh_last->next) && (NULL == wh2)) {
|
||||||
syslog(LOG_DEBUG, "dispatcher: we haven't one, we create one");
|
syslog(LOG_DEBUG, "dispatcher: we haven't one, we create one");
|
||||||
wh2 = (worker_handle_t*)malloc(sizeof(worker_handle_t));
|
wh2 = (worker_handle_t*)htmalloc(sizeof(worker_handle_t));
|
||||||
wh2->id = classes->id;
|
wh2->id = classes->id;
|
||||||
if (NULL != classes->descr->work_setup_function) {
|
if (NULL != classes->descr->work_setup_function) {
|
||||||
err = (*classes->descr->work_setup_function)(classes->handle, &(wh2->handle));
|
err = (*classes->descr->work_setup_function)(classes->handle, &(wh2->handle));
|
||||||
@ -170,7 +171,7 @@ static int register_class(int id, class_descriptor_t *class_descriptor) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = (classes_t *) malloc(sizeof(classes_t));
|
w = (classes_t *) htmalloc(sizeof(classes_t));
|
||||||
if (NULL == w) {
|
if (NULL == w) {
|
||||||
syslog(LOG_ERR, "register_class: unable to alloc memory");
|
syslog(LOG_ERR, "register_class: unable to alloc memory");
|
||||||
return -2;
|
return -2;
|
||||||
@ -254,7 +255,7 @@ int register_all() {
|
|||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_name = (char*) malloc(((cfg_plugin_dir == NULL) ? 0 : strlen(cfg_plugin_dir)) + strlen(cfg_obj) + 5);
|
obj_name = (char*) htmalloc(((cfg_plugin_dir == NULL) ? 0 : strlen(cfg_plugin_dir)) + strlen(cfg_obj) + 5);
|
||||||
obj_name[0] = '\0';
|
obj_name[0] = '\0';
|
||||||
if (cfg_plugin_dir != NULL) {
|
if (cfg_plugin_dir != NULL) {
|
||||||
strcat(obj_name, cfg_plugin_dir);
|
strcat(obj_name, cfg_plugin_dir);
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
#include "containers.h"
|
#include "containers.h"
|
||||||
#include "cfg.h"
|
#include "cfg.h"
|
||||||
#include "safe_write.h"
|
#include "safe_write.h"
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
#define _SMMAPD_C_
|
#define _SMMAPD_C_
|
||||||
#include "smmapd.h"
|
#include "smmapd.h"
|
||||||
@ -279,7 +280,7 @@ int server() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
thread = (networkerThread_t *) malloc(sizeof(networkerThread_t)+10);
|
thread = (networkerThread_t *) htmalloc(sizeof(networkerThread_t)+10);
|
||||||
if (NULL == thread) {
|
if (NULL == thread) {
|
||||||
syslog(LOG_ERR, "server: unable to alloc memory for networker");
|
syslog(LOG_ERR, "server: unable to alloc memory for networker");
|
||||||
continue;
|
continue;
|
||||||
@ -325,10 +326,10 @@ int main(int argc, char **argv) {
|
|||||||
foreground = 1;
|
foreground = 1;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
cfg_file = strdup(optarg);
|
cfg_file = htstrdup(optarg);
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
pid_file = strdup(optarg);
|
pid_file = htstrdup(optarg);
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("\nsmmapd - Wolfgang Hottgenroth <woho@hottis.de>\n");
|
printf("\nsmmapd - Wolfgang Hottgenroth <woho@hottis.de>\n");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[Global]
|
[Global]
|
||||||
Host: ddev1.eng.emea.uu.net
|
Host: localhost
|
||||||
Port: 110
|
Port: 8887
|
||||||
Threads: 20
|
Threads: 20
|
||||||
|
|
||||||
[Verifier]
|
[Verifier]
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include "containers_public.h"
|
#include "containers_public.h"
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
|
|
||||||
int test_worker1_init(cfgl_t *cfg, void **handle);
|
int test_worker1_init(cfgl_t *cfg, void **handle);
|
||||||
int test_worker1_setup(void *handle, void **work_handle);
|
int test_worker1_setup(void *handle, void **work_handle);
|
||||||
@ -63,7 +65,7 @@ int test_worker1_init(cfgl_t *cfg, void **handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int test_worker1_setup(void *handle, void **work_handle) {
|
int test_worker1_setup(void *handle, void **work_handle) {
|
||||||
test_worker1_handle_t *twh = (test_worker1_handle_t*)malloc(sizeof(test_worker1_handle_t));
|
test_worker1_handle_t *twh = (test_worker1_handle_t*)htmalloc(sizeof(test_worker1_handle_t));
|
||||||
twh->counter = 0;
|
twh->counter = 0;
|
||||||
*work_handle = twh;
|
*work_handle = twh;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
#include "htdns.h"
|
#include "htdns.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include "smtp.h"
|
#include "smtp.h"
|
||||||
|
#include "htmalloc.h"
|
||||||
|
|
||||||
|
|
||||||
#define SMM_LOCAL_PERM_NOK 101
|
#define SMM_LOCAL_PERM_NOK 101
|
||||||
@ -160,7 +160,7 @@ class_descriptor_t verifier = {
|
|||||||
int verify_init(cfgl_t *cfg, void **handle) {
|
int verify_init(cfgl_t *cfg, void **handle) {
|
||||||
verify_container_handle_t *vch;
|
verify_container_handle_t *vch;
|
||||||
|
|
||||||
vch = (verify_container_handle_t*) malloc(sizeof(verify_container_handle_t));
|
vch = (verify_container_handle_t*) htmalloc(sizeof(verify_container_handle_t));
|
||||||
vch->cfg = cfg;
|
vch->cfg = cfg;
|
||||||
|
|
||||||
vch->timeout_result = atoi(findcfglx(vch->cfg, "timeout_result", "5"));
|
vch->timeout_result = atoi(findcfglx(vch->cfg, "timeout_result", "5"));
|
||||||
@ -174,7 +174,7 @@ int verify_init(cfgl_t *cfg, void **handle) {
|
|||||||
vch->cache_file = findcfglx(vch->cfg, "cache_file", "verifier_cache");
|
vch->cache_file = findcfglx(vch->cfg, "cache_file", "verifier_cache");
|
||||||
|
|
||||||
if (1 == vch->cache_enabled) {
|
if (1 == vch->cache_enabled) {
|
||||||
vch->cache_mutex = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t));
|
vch->cache_mutex = (pthread_mutex_t*) htmalloc(sizeof(pthread_mutex_t));
|
||||||
pthread_mutex_init(vch->cache_mutex, NULL);
|
pthread_mutex_init(vch->cache_mutex, NULL);
|
||||||
pthread_mutex_unlock(vch->cache_mutex);
|
pthread_mutex_unlock(vch->cache_mutex);
|
||||||
} else {
|
} else {
|
||||||
@ -204,15 +204,15 @@ int verify_destroy(void *handle) {
|
|||||||
int verify_work_setup(void *handle, void **work_handle) {
|
int verify_work_setup(void *handle, void **work_handle) {
|
||||||
verify_work_handle_t *vwh;
|
verify_work_handle_t *vwh;
|
||||||
|
|
||||||
vwh = (verify_work_handle_t*)malloc(sizeof(verify_work_handle_t));
|
vwh = (verify_work_handle_t*)htmalloc(sizeof(verify_work_handle_t));
|
||||||
vwh->id = 0;
|
vwh->id = 0;
|
||||||
vwh->result = (verify_result_t*) malloc(sizeof(verify_result_t));
|
vwh->result = (verify_result_t*) htmalloc(sizeof(verify_result_t));
|
||||||
vwh->result_mutex = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t));
|
vwh->result_mutex = (pthread_mutex_t*) htmalloc(sizeof(pthread_mutex_t));
|
||||||
pthread_mutex_init(vwh->result_mutex, NULL);
|
pthread_mutex_init(vwh->result_mutex, NULL);
|
||||||
pthread_mutex_unlock(vwh->result_mutex);
|
pthread_mutex_unlock(vwh->result_mutex);
|
||||||
vwh->result_cond = (pthread_cond_t*) malloc(sizeof(pthread_cond_t));
|
vwh->result_cond = (pthread_cond_t*) htmalloc(sizeof(pthread_cond_t));
|
||||||
pthread_cond_init(vwh->result_cond, NULL);
|
pthread_cond_init(vwh->result_cond, NULL);
|
||||||
vwh->terminator_queue = (ht_queue_t*) malloc(sizeof(ht_queue_t));
|
vwh->terminator_queue = (ht_queue_t*) htmalloc(sizeof(ht_queue_t));
|
||||||
queue_init(vwh->terminator_queue);
|
queue_init(vwh->terminator_queue);
|
||||||
vwh->vch = (verify_container_handle_t*)handle;
|
vwh->vch = (verify_container_handle_t*)handle;
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ void cache_insert(verify_container_handle_t *vch, const char *address, int resul
|
|||||||
key.dsize = strlen(address) + 1; /* one more for the terminating \0 */
|
key.dsize = strlen(address) + 1; /* one more for the terminating \0 */
|
||||||
key.dptr = (char*) address;
|
key.dptr = (char*) address;
|
||||||
data.dsize = (sizeof(mydata_t) + (sizeof(char) * (strlen(output) + 1)));
|
data.dsize = (sizeof(mydata_t) + (sizeof(char) * (strlen(output) + 1)));
|
||||||
mydata = (mydata_t *) malloc(data.dsize);
|
mydata = (mydata_t *) htmalloc(data.dsize);
|
||||||
mydata->result = result;
|
mydata->result = result;
|
||||||
mydata->timestamp = time(NULL);
|
mydata->timestamp = time(NULL);
|
||||||
strcpy(mydata->output, output);
|
strcpy(mydata->output, output);
|
||||||
@ -345,7 +345,7 @@ int cache_lookup(verify_container_handle_t *vch, const char* address, int *resul
|
|||||||
if ((mydata->timestamp + vch->cache_expiry) > time(NULL)) {
|
if ((mydata->timestamp + vch->cache_expiry) > time(NULL)) {
|
||||||
syslog(LOG_DEBUG, "cache_lookup: not yet expired");
|
syslog(LOG_DEBUG, "cache_lookup: not yet expired");
|
||||||
*result = mydata->result;
|
*result = mydata->result;
|
||||||
*output = (char*) malloc(sizeof(char) * (strlen(mydata->output) + 1));
|
*output = (char*) htmalloc(sizeof(char) * (strlen(mydata->output) + 1));
|
||||||
strcpy(*output, mydata->output);
|
strcpy(*output, mydata->output);
|
||||||
|
|
||||||
/* Berkeley DB frees on its own! */
|
/* Berkeley DB frees on its own! */
|
||||||
@ -429,16 +429,16 @@ int verify_work(void *handle, void *work_handle, char *input, char *output) {
|
|||||||
|
|
||||||
vwh->result->id = vwh->id;
|
vwh->result->id = vwh->id;
|
||||||
|
|
||||||
wt = (worker_thread_t*) malloc(sizeof(worker_thread_t));
|
wt = (worker_thread_t*) htmalloc(sizeof(worker_thread_t));
|
||||||
wt->id = vwh->id;
|
wt->id = vwh->id;
|
||||||
wt->terminator_queue = vwh->terminator_queue;
|
wt->terminator_queue = vwh->terminator_queue;
|
||||||
wt->input = (char*) malloc(sizeof(char) * (strlen(input)+1));
|
wt->input = (char*) htmalloc(sizeof(char) * (strlen(input)+1));
|
||||||
strcpy(wt->input, input);
|
strcpy(wt->input, input);
|
||||||
wt->output = NULL;
|
wt->output = NULL;
|
||||||
wt->mutex = vwh->result_mutex;
|
wt->mutex = vwh->result_mutex;
|
||||||
wt->cond = vwh->result_cond;
|
wt->cond = vwh->result_cond;
|
||||||
wt->result = vwh->result;
|
wt->result = vwh->result;
|
||||||
wt->checker_terminator_queue = (ht_queue_t*) malloc(sizeof(ht_queue_t));
|
wt->checker_terminator_queue = (ht_queue_t*) htmalloc(sizeof(ht_queue_t));
|
||||||
queue_init(wt->checker_terminator_queue);
|
queue_init(wt->checker_terminator_queue);
|
||||||
wt->checker_cnt = 0;
|
wt->checker_cnt = 0;
|
||||||
wt->vwh = work_handle;
|
wt->vwh = work_handle;
|
||||||
@ -486,7 +486,7 @@ static unsigned int *get_mx_ip_addresses(char *domain) {
|
|||||||
a_rdata = get_a_rrs((*mx_rdata2)->exchange);
|
a_rdata = get_a_rrs((*mx_rdata2)->exchange);
|
||||||
if (NULL != a_rdata) {
|
if (NULL != a_rdata) {
|
||||||
for (a_rdata2 = a_rdata; *a_rdata2 != NULL; a_rdata2++) {
|
for (a_rdata2 = a_rdata; *a_rdata2 != NULL; a_rdata2++) {
|
||||||
addresses = (unsigned int*)realloc(addresses, sizeof(unsigned int)*(i+2)); /* 2 since first i==0 and
|
addresses = (unsigned int*)htrealloc(addresses, sizeof(unsigned int)*(i+2)); /* 2 since first i==0 and
|
||||||
we always need one more
|
we always need one more
|
||||||
for the termination */
|
for the termination */
|
||||||
*(addresses+i) = (*a_rdata2)->address;
|
*(addresses+i) = (*a_rdata2)->address;
|
||||||
@ -555,7 +555,7 @@ static void *checker_thread(void *arg) {
|
|||||||
err = smtp_mailfrom(smtp, sender_address);
|
err = smtp_mailfrom(smtp, sender_address);
|
||||||
break;
|
break;
|
||||||
case RCPTTO:
|
case RCPTTO:
|
||||||
tmp_arg = (char*) malloc(sizeof(char) * (strlen(ct->email_address)+5));
|
tmp_arg = (char*) htmalloc(sizeof(char) * (strlen(ct->email_address)+5));
|
||||||
*tmp_arg = '\0';
|
*tmp_arg = '\0';
|
||||||
strcat(tmp_arg, "<");
|
strcat(tmp_arg, "<");
|
||||||
strcat(tmp_arg, ct->email_address);
|
strcat(tmp_arg, ct->email_address);
|
||||||
@ -624,7 +624,7 @@ static void *checker_thread(void *arg) {
|
|||||||
|
|
||||||
smtp_close(smtp);
|
smtp_close(smtp);
|
||||||
|
|
||||||
ct->output = (char*) malloc(sizeof(char) * (strlen(response_text)+1));
|
ct->output = (char*) htmalloc(sizeof(char) * (strlen(response_text)+1));
|
||||||
strcpy(ct->output, response_text);
|
strcpy(ct->output, response_text);
|
||||||
|
|
||||||
smtp_destroy(smtp);
|
smtp_destroy(smtp);
|
||||||
@ -688,7 +688,7 @@ static void *worker_thread(void *arg) {
|
|||||||
(address&0x0000ff00)>>8, (address&0x000000ff),
|
(address&0x0000ff00)>>8, (address&0x000000ff),
|
||||||
wt->input);
|
wt->input);
|
||||||
|
|
||||||
ct = (checker_thread_t*) malloc(sizeof(checker_thread_t));
|
ct = (checker_thread_t*) htmalloc(sizeof(checker_thread_t));
|
||||||
ct->id = i+1; /* id of ct should start with 1, same as id of wt */
|
ct->id = i+1; /* id of ct should start with 1, same as id of wt */
|
||||||
ct->ip_address = address;
|
ct->ip_address = address;
|
||||||
ct->email_address = wt->input;
|
ct->email_address = wt->input;
|
||||||
@ -752,7 +752,7 @@ static void *worker_thread(void *arg) {
|
|||||||
if (wt->result->id == wt->id) {
|
if (wt->result->id == wt->id) {
|
||||||
syslog(LOG_DEBUG, "verify (%p) worker_thread %d returned result", wt->vwh, wt->id);
|
syslog(LOG_DEBUG, "verify (%p) worker_thread %d returned result", wt->vwh, wt->id);
|
||||||
/* we can write the result */
|
/* we can write the result */
|
||||||
wt->result->output = (char*) malloc(sizeof(char) * (strlen(wt->output)+15)); /* enough for the output
|
wt->result->output = (char*) htmalloc(sizeof(char) * (strlen(wt->output)+15)); /* enough for the output
|
||||||
plus <><> and prefix */
|
plus <><> and prefix */
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case SMM_LOCAL_TEMP_NOK:
|
case SMM_LOCAL_TEMP_NOK:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user