aboutsummaryrefslogtreecommitdiff
path: root/gacopyz
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2006-12-03 09:26:25 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2006-12-03 09:26:25 +0000
commit4c07ed89e9dd649f049203feb2f5eb43146df6fe (patch)
treed4bf1ceb08aee321eb52dd4644fb133f21875d1e /gacopyz
parent7caeb004b8575fb7c83cb6532c2bcde4f1ec8c7e (diff)
downloadmailfromd-4c07ed89e9dd649f049203feb2f5eb43146df6fe.tar.gz
mailfromd-4c07ed89e9dd649f049203feb2f5eb43146df6fe.tar.bz2
(MI_TIMEOUT): Rename to GACOPYZ_TIMEOUT
(mi_uint32_t): Rename to gacopyz_uint32_t Set gacopyz_uint32_t based on the result of a configure check (MILTER_OPTLEN): Rename to GACOPYZ_OPTLEN git-svn-id: file:///svnroot/mailfromd/trunk@1019 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'gacopyz')
-rw-r--r--gacopyz/gacopyz.c32
-rw-r--r--gacopyz/gacopyz_priv.h11
2 files changed, 24 insertions, 19 deletions
diff --git a/gacopyz/gacopyz.c b/gacopyz/gacopyz.c
index adb64115..ae337941 100644
--- a/gacopyz/gacopyz.c
+++ b/gacopyz/gacopyz.c
@@ -48,7 +48,7 @@ gacopyz_init(gacopyz_conn_t *pconn, struct smfiDesc *desc)
conn->master_timeout.tv_usec = 0;
conn->master_timeout.tv_sec = 5;
conn->ctx_timeout.tv_usec = 0;
- conn->ctx_timeout.tv_sec = MI_TIMEOUT;
+ conn->ctx_timeout.tv_sec = GACOPYZ_TIMEOUT;
conn->logmask = SMI_DEFAULT_LOG_MASK;
conn->desc = *desc;
conn->desc.xxfi_name = (char*)(conn + 1);
@@ -558,7 +558,7 @@ ctx_write(SMFICTX *ctx, char *buf, size_t size)
union header {
struct {
- mi_uint32_t size;
+ gacopyz_uint32_t size;
unsigned char cmd;
} hdr;
char buf[5];
@@ -638,7 +638,7 @@ send_reply(SMFICTX *ctx, unsigned char cmd)
case SMFIC_OPTNEG:
{
- mi_uint32_t v[3];
+ gacopyz_uint32_t v[3];
v[0] = htonl(ctx->conn->desc.xxfi_version);
v[1] = htonl(ctx->conn->desc.xxfi_flags);
v[2] = htonl(ctx->flags);
@@ -693,7 +693,7 @@ union state_arg {
size_t len;
} string;
char *strings[2];
- mi_uint32_t ints[3];
+ gacopyz_uint32_t ints[3];
struct {
char cmd;
char **v;
@@ -944,7 +944,7 @@ shan_mail(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd)
static state_ret_type
shan_optneg(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd)
{
- mi_uint32_t val;
+ gacopyz_uint32_t val;
if (arg->ints[0] < ctx->conn->desc.xxfi_version) {
gacopyz_log(ctx->conn, SMI_LOG_ERR,
@@ -1103,12 +1103,12 @@ parse_state_arg(union state_arg *arg, enum state_arg_type type,
case arg_ints: /* three integers */
{
- if (size < MILTER_OPTLEN)
+ if (size < GACOPYZ_OPTLEN)
return MI_FAILURE;
- arg->ints[0] = ntohl(((mi_uint32_t*)buffer)[0]);
- arg->ints[1] = ntohl(((mi_uint32_t*)buffer)[1]);
- arg->ints[2] = ntohl(((mi_uint32_t*)buffer)[2]);
+ arg->ints[0] = ntohl(((gacopyz_uint32_t*)buffer)[0]);
+ arg->ints[1] = ntohl(((gacopyz_uint32_t*)buffer)[1]);
+ arg->ints[2] = ntohl(((gacopyz_uint32_t*)buffer)[2]);
return MI_SUCCESS;
}
@@ -1435,15 +1435,15 @@ gacopyz_header_command(SMFICTX *ctx, unsigned char cmd,
lenv = strlen(headerv) + 1;
bufsize = lenf + lenv;
if (idx >= 0)
- bufsize += sizeof(mi_uint32_t);
+ bufsize += sizeof(gacopyz_uint32_t);
buf = malloc(sizeof hptr->buf + bufsize);
if (!buf)
return MI_FAILURE;
hptr = (union header *) buf;
cptr = buf + sizeof hptr->buf;
if (idx >= 0) {
- *(mi_uint32_t*)cptr = htonl(idx);
- cptr += sizeof(mi_uint32_t);
+ *(gacopyz_uint32_t*)cptr = htonl(idx);
+ cptr += sizeof(gacopyz_uint32_t);
}
memcpy(cptr, headerf, lenf);
cptr += lenf;
@@ -1536,13 +1536,13 @@ gacopyz_del_rcpt(SMFICTX *ctx, const char *rcpt)
return gacopyz_rcpt_command(ctx, SMFIR_DELRCPT, rcpt);
}
-#define MILTER_CHUNK_SIZE 65535
+#define GACOPYZ_CHUNK_SIZE 65535
int
gacopyz_replace_body(SMFICTX *ctx, unsigned char *bodyp, size_t bodylen)
{
union header *hptr;
- char buf[sizeof hptr->buf + MILTER_CHUNK_SIZE];
+ char buf[sizeof hptr->buf + GACOPYZ_CHUNK_SIZE];
if (bodylen < 0 || (!bodyp && bodylen > 0))
return MI_FAILURE;
@@ -1552,8 +1552,8 @@ gacopyz_replace_body(SMFICTX *ctx, unsigned char *bodyp, size_t bodylen)
hptr = (union header *)buf;
hptr->hdr.cmd = SMFIR_REPLBODY;
while (bodylen) {
- size_t size = (bodylen >= MILTER_CHUNK_SIZE)
- ? MILTER_CHUNK_SIZE : bodylen;
+ size_t size = (bodylen >= GACOPYZ_CHUNK_SIZE)
+ ? GACOPYZ_CHUNK_SIZE : bodylen;
hptr->hdr.size = htonl(size + 1);
memcpy(buf + sizeof hptr->buf, bodyp, size);
if (ctx_write(ctx, buf, sizeof hptr->buf + size))
diff --git a/gacopyz/gacopyz_priv.h b/gacopyz/gacopyz_priv.h
index 57f2baad..52bc057c 100644
--- a/gacopyz/gacopyz_priv.h
+++ b/gacopyz/gacopyz_priv.h
@@ -59,8 +59,13 @@ struct gacopyz_conn {
struct smfiDesc desc;
};
-#define MI_TIMEOUT 7210
+#define GACOPYZ_TIMEOUT 7210
-typedef unsigned long mi_uint32_t; /* FIXME: must be 4 bytes long, autoconf */
+#ifdef GACOPYZ_UINT32_T
+typedef GACOPYZ_UINT32_T gacopyz_uint32_t;
+#else
+# warning "assuming 32-bit unsigned long"
+typedef unsigned long gacopyz_uint32_t;
+#endif
-#define MILTER_OPTLEN (sizeof(mi_uint32_t) * 3) /* length of options */
+#define GACOPYZ_OPTLEN (sizeof(gacopyz_uint32_t) * 3) /* length of options */

Return to:

Send suggestions and report system problems to the System administrator.