mail/raysfilter: fix build for FreeBSD-14

This commit is contained in:
Dirk Meyer
2023-02-12 15:14:35 +01:00
parent 126b8e54a0
commit e69242b2a3
2 changed files with 81 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
PORTNAME= raysfilter
PORTVERSION= 1.14
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= mail
MASTER_SITES= LOCAL/dinoex
DISTNAME= rays-filter-${PORTVERSION}
@@ -13,7 +13,7 @@ LICENSE_FILE= ${WRKSRC}/GNU-public-licence.txt
USES= shebangfix
CTARGETS+= rays-filter
CFLAGS+= -Wall
CFLAGS+= -Wall -Wno-pointer-sign
LIBS+= -lpthread -lmilter
SHEBANG_FILES= mf-analyze
ETCFILES= header-list.conf mail-filter.conf string-list.conf

View File

@@ -1,5 +1,5 @@
--- rays-filter.c.orig Thu Mar 8 13:41:20 2001
+++ rays-filter.c Wed Oct 27 15:38:15 2004
--- rays-filter.c.orig 2001-03-08 12:41:20 UTC
+++ rays-filter.c
@@ -65,8 +65,8 @@
#include <sys/types.h>
#include <unistd.h>
@@ -21,7 +21,7 @@
/* Data Structures
**
@@ -326,6 +328,7 @@
@@ -326,6 +328,7 @@ static int open_log_file(struct mlfiPriv *priv)
syslog(LOG_INFO, "Cannot allocate memory for log file name\n");
else
{
@@ -29,15 +29,87 @@
if (mktemp(priv->mlfi_fname) == NULL)
syslog(LOG_INFO, "Cannot make name for log file\n");
else
@@ -334,6 +337,11 @@
@@ -334,6 +337,18 @@ static int open_log_file(struct mlfiPriv *priv)
if (priv->mlfi_fname == NULL)
syslog(LOG_INFO, "Cannot open log file\n");
}
+#else
+ priv->mlfi_fp = mkstemp(priv->mlfi_fname);
+ if ( priv->mlfi_fp < 0 )
+ syslog(LOG_INFO, "Cannot open new log file\n");
+ int handle;
+ handle = mkstemp(priv->mlfi_fname);
+ if (handle < 0)
+ syslog(LOG_INFO, "Cannot make name for log file\n");
+ else
+ {
+ priv->mlfi_fp = fdopen(handle, "w");
+ if ( priv->mlfi_fp == NULL )
+ syslog(LOG_INFO, "Cannot open log file\n");
+ }
+#endif
}
return 0;
@@ -489,7 +504,6 @@ sfsistat mlfi_header(SMFICTX *ctx, char *headerf, char
*/
char *headerf_uc = NULL;
- int i = 0;
if (MLFIPRIV->mlfi_fp != NULL)
fprintf(MLFIPRIV->mlfi_fp, "%s: %s\r\n", headerf, headerv);
@@ -683,7 +697,7 @@ static int scan_header_block(SMFICTX *ctx, u_char *sta
** found, checks the header contents against the 'bad_string_list'
*/
- char *header, *end_of_header, *header_body;
+ char *header, *header_body;
char header_name[HEADER_NAME_SIZE] = "\0";
size_t header_length = 0, name_length = 0, copy_length = 0;
int status = 0, is_end_of_headers = 0;
@@ -732,8 +746,6 @@ static int scan_buffer(SMFICTX *ctx)
u_char *header_block;
u_char *buffer = MLFIPRIV->buffer;
char *boundary = MLFIPRIV->boundary;
- size_t i = 0;
- size_t used_buffer_length;
int status = 0;
/* used_buffer_length = strlen(buffer);
@@ -742,7 +754,7 @@ static int scan_buffer(SMFICTX *ctx)
*/
header_block = buffer;
- while (header_block = (u_char *)strstr(header_block, boundary))
+ while ((header_block = (u_char *)strstr(header_block, boundary)))
{
status |= scan_header_block(ctx, header_block);
header_block++;
@@ -776,9 +788,9 @@ static int overlap_chunk(SMFICTX *ctx, u_char *bodyp,
}
if (MLFIPRIV->mlfi_fp != NULL)
{
- fprintf(MLFIPRIV->mlfi_fp, "Overlap from previous: %7d\n",
+ fprintf(MLFIPRIV->mlfi_fp, "Overlap from previous: %7zu\n",
overlap_size);
- fprintf(MLFIPRIV->mlfi_fp, "Buffer contains: %7d\n",
+ fprintf(MLFIPRIV->mlfi_fp, "Buffer contains: %7zu\n",
strlen(MLFIPRIV->buffer));
}
@@ -802,7 +814,7 @@ static int store_overlap(SMFICTX *ctx, u_char *bodyp,
if (MLFIPRIV->mlfi_fp != NULL)
{
fprintf(MLFIPRIV->mlfi_fp,
- "Overlap to next chunk: %7d\n"
+ "Overlap to next chunk: %7zu\n"
"=====================================================\n",
strlen(MLFIPRIV->overlap));
}
@@ -831,7 +843,7 @@ sfsistat mlfi_body(SMFICTX *ctx, u_char *bodyp, size_t
"\n=====================================================\n"
"Note inserted by " FILTER_SIGNATURE
"\n-----------------------------------------------------\n"
- "This chunk (bodylen): %7d\n", bodylen);
+ "This chunk (bodylen): %7zu\n", bodylen);
}
}