Import altermime-0.3.10.
alterMIME is a small program which is used to alter your mime-encoded mailpacks as typically received by e.g. amavisd-new. It can: * Insert disclaimers * Insert arbitary X-headers * Modify existing headers * Remove attachments based on filename or content-type * Replace attachments based on filename ok jasper@
This commit is contained in:
parent
e04d6b1937
commit
79cefe7a8c
28
mail/altermime/Makefile
Executable file
28
mail/altermime/Makefile
Executable file
@ -0,0 +1,28 @@
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 2012/05/30 16:47:01 ajacoutot Exp $
|
||||
|
||||
COMMENT= utility for altering mime-encoded mailpacks
|
||||
|
||||
DISTNAME= altermime-0.3.10
|
||||
|
||||
CATEGORIES= mail
|
||||
|
||||
HOMEPAGE= http://www.pldaniels.com/altermime/
|
||||
|
||||
# alterMIME LICENSE
|
||||
# (see share/doc/altermime/LICENCE)
|
||||
PERMIT_PACKAGE_CDROM= may not sell
|
||||
PERMIT_PACKAGE_FTP= Yes
|
||||
PERMIT_DISTFILES_CDROM= may not sell
|
||||
PERMIT_DISTFILES_FTP= Yes
|
||||
|
||||
WANTLIB += c
|
||||
|
||||
MASTER_SITES= ${HOMEPAGE}
|
||||
|
||||
NO_REGRESS= Yes
|
||||
|
||||
post-install:
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/altermime
|
||||
${INSTALL_DATA} ${WRKSRC}/LICENCE ${PREFIX}/share/doc/altermime
|
||||
|
||||
.include <bsd.port.mk>
|
5
mail/altermime/distinfo
Normal file
5
mail/altermime/distinfo
Normal file
@ -0,0 +1,5 @@
|
||||
MD5 (altermime-0.3.10.tar.gz) = qvCtgCmVii3G2jq7TcF4wg==
|
||||
RMD160 (altermime-0.3.10.tar.gz) = 5df3rR8MftAuTPhb2SM/VUPjts8=
|
||||
SHA1 (altermime-0.3.10.tar.gz) = uU2DqGZFtJFuSZnpz0HAlXXkgKs=
|
||||
SHA256 (altermime-0.3.10.tar.gz) = gzTaa1XUoF3+FJI4nf4fKJlTBTohdzhJsGDXyFbdw24=
|
||||
SIZE (altermime-0.3.10.tar.gz) = 85396
|
61
mail/altermime/patches/patch-MIME_headers_c
Normal file
61
mail/altermime/patches/patch-MIME_headers_c
Normal file
@ -0,0 +1,61 @@
|
||||
$OpenBSD: patch-MIME_headers_c,v 1.1.1.1 2012/05/30 16:47:01 ajacoutot Exp $
|
||||
|
||||
http://bugs.debian.org/625307
|
||||
http://bugs.debian.org/602515
|
||||
|
||||
--- MIME_headers.c.orig Sun Nov 16 09:45:45 2008
|
||||
+++ MIME_headers.c Wed May 30 15:45:22 2012
|
||||
@@ -1081,12 +1081,10 @@ int MIMEH_read_headers( struct MIMEH_header_info *hinf
|
||||
int linesize=0;
|
||||
int totalsize_original=0;
|
||||
int result = 0;
|
||||
- int firstline = 1;
|
||||
int search_count=0;
|
||||
char *tmp;
|
||||
char *tmp_original;
|
||||
char *fget_result = NULL;
|
||||
- char *headerline_end;
|
||||
char *p;
|
||||
char *linestart;
|
||||
char *lineend;
|
||||
@@ -1184,7 +1182,6 @@ int MIMEH_read_headers( struct MIMEH_header_info *hinf
|
||||
glb.headerline = tmp;
|
||||
totalsize = linesize;
|
||||
PLD_strncpy(glb.headerline, linestart, (linesize +1));
|
||||
- headerline_end = glb.headerline +totalsize;
|
||||
} // If the global headerline is currently NULL
|
||||
else
|
||||
{
|
||||
@@ -1271,7 +1268,6 @@ int MIMEH_read_headers( struct MIMEH_header_info *hinf
|
||||
FFGET_SDL_MODE = 0;
|
||||
} // FFGET_doubleCR test
|
||||
|
||||
- firstline = 0;
|
||||
} // While reading more headers from the source file.
|
||||
|
||||
|
||||
@@ -2243,7 +2239,7 @@ int MIMEH_parse_contentlocation( char *header_name, ch
|
||||
{
|
||||
if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIME_parse_contentlocation:DEBUG: filename = %s\n", FL, p);
|
||||
snprintf(hinfo->name, sizeof(hinfo->name),"%s",p);
|
||||
- snprintf(hinfo->filename, sizeof(hinfo->name),"%s",p);
|
||||
+ snprintf(hinfo->filename, sizeof(hinfo->filename),"%s",p);
|
||||
FNFILTER_filter(hinfo->filename, _MIMEH_FILENAMELEN_MAX);
|
||||
SS_push(&(hinfo->ss_filenames), hinfo->filename, strlen(hinfo->filename));
|
||||
|
||||
@@ -2724,13 +2720,13 @@ int MIMEH_headers_process( struct MIMEH_header_info *h
|
||||
{
|
||||
/** scan through our headers string looking for information that is
|
||||
** valid **/
|
||||
- char *safeh, *h, *safehl;
|
||||
+ char *h, *safehl;
|
||||
char *current_header_position;
|
||||
int headerlength;
|
||||
|
||||
if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIMEH_parse_headers:DEBUG: Start [hinfo=%p]\n",FL, hinfo);
|
||||
|
||||
- safeh = h = headers;
|
||||
+ h = headers;
|
||||
|
||||
/** Duplicate the headers for processing - this way we don't 'taint' the
|
||||
** original headers during our searching / altering. **/
|
23
mail/altermime/patches/patch-Makefile
Normal file
23
mail/altermime/patches/patch-Makefile
Normal file
@ -0,0 +1,23 @@
|
||||
$OpenBSD: patch-Makefile,v 1.1.1.1 2012/05/30 16:47:01 ajacoutot Exp $
|
||||
--- Makefile.orig Sun Nov 16 09:45:45 2008
|
||||
+++ Makefile Wed May 30 15:27:29 2012
|
||||
@@ -9,7 +9,7 @@
|
||||
# opposite of a disclaimer.
|
||||
#ALTERMIME_OPTIONS=-DALTERMIME_PRETEXT
|
||||
ALTERMIME_OPTIONS=
|
||||
-CFLAGS=-Wall -Werror -g -I. -O2 $(ALTERMIME_OPTIONS)
|
||||
+CFLAGS?=-Wall -Werror -g -I. -O2 $(ALTERMIME_OPTIONS)
|
||||
OBJS= strstack.o mime_alter.o ffget.o pldstr.o filename-filters.o logger.o MIME_headers.o libmime-decoders.o boundary-stack.o qpe.o
|
||||
|
||||
|
||||
@@ -24,9 +24,7 @@ altermime: altermime.c ${OBJS}
|
||||
|
||||
# Build Install
|
||||
install: altermime
|
||||
- strip altermime
|
||||
- cp altermime /usr/local/bin
|
||||
- chmod a+rx /usr/local/bin/altermime
|
||||
+ ${BSD_INSTALL_PROGRAM} altermime ${PREFIX}/bin
|
||||
|
||||
uninstall:
|
||||
rm -f /usr/local/bin/altermime
|
38
mail/altermime/patches/patch-mime_alter_c
Normal file
38
mail/altermime/patches/patch-mime_alter_c
Normal file
@ -0,0 +1,38 @@
|
||||
$OpenBSD: patch-mime_alter_c,v 1.1.1.1 2012/05/30 16:47:01 ajacoutot Exp $
|
||||
|
||||
http://bugs.debian.org/625307
|
||||
|
||||
--- mime_alter.c.orig Sun Nov 16 09:45:45 2008
|
||||
+++ mime_alter.c Wed May 30 15:44:10 2012
|
||||
@@ -2432,7 +2432,6 @@ int AM_add_disclaimer( char *mpackname )
|
||||
char mpackold[AM_1K_BUFFER_SIZE+1]="";
|
||||
struct AM_disclaimer_details dd;
|
||||
int result = 0;
|
||||
- int segment_read = 0;
|
||||
|
||||
/* create our temp filename */
|
||||
snprintf(mpacktmp,AM_1K_BUFFER_SIZE, "%s.tmp",mpackname);
|
||||
@@ -2623,7 +2622,6 @@ int AM_add_disclaimer( char *mpackname )
|
||||
*/
|
||||
|
||||
|
||||
- segment_read = 0;
|
||||
if (FFGET_feof(&f)) break;
|
||||
|
||||
// If we've found a boundary and a text content section...
|
||||
@@ -3698,7 +3696,6 @@ Changes:
|
||||
int AM_attachment_replace_recurse( struct MIMEH_header_info *hinfo, FFGET_FILE *f, FILE *outputfile, regex_t *preg, char *new_attachment_name, int iteration )
|
||||
{
|
||||
int result = 0;
|
||||
- int boundary_exists=0;
|
||||
size_t bc;
|
||||
|
||||
if (AM_DNORMAL) LOGGER_log("%s:%d:AM_attachment_replace_recurse:DEBUG: Starting: iteration=%d",FL, iteration );
|
||||
@@ -3776,7 +3773,6 @@ int AM_attachment_replace_recurse( struct MIMEH_header
|
||||
{
|
||||
if (AM_DNORMAL)LOGGER_log("%s:%d:AM_attachment_replace_recurse:DEBUG: pushing BS='%s'",FL, hinfo->boundary );
|
||||
BS_push( hinfo->boundary );
|
||||
- boundary_exists = 1;
|
||||
}
|
||||
|
||||
// Now, determine if this block/segment is the one which contains our file which we must 'nullify'
|
49
mail/altermime/patches/patch-qpe_c
Normal file
49
mail/altermime/patches/patch-qpe_c
Normal file
@ -0,0 +1,49 @@
|
||||
$OpenBSD: patch-qpe_c,v 1.1.1.1 2012/05/30 16:47:01 ajacoutot Exp $
|
||||
|
||||
warning: format '%d' expects type 'int', but argument 3 has type 'size_t'
|
||||
|
||||
--- qpe.c.orig Sun Nov 16 09:45:45 2008
|
||||
+++ qpe.c Wed May 30 15:24:00 2012
|
||||
@@ -97,7 +97,7 @@ int qp_encode( char *out, size_t out_size, char *in, s
|
||||
op+= strlen(paragraph);// +3; /** jump the output + =\r\n **/
|
||||
out_remaining-= (strlen(paragraph)); // Was +3, updated to fix Outlook problems
|
||||
|
||||
- QPD fprintf(stdout, "Soft break (%d + %d > 76 char) for '%s'\n", current_line_length, charout_size, paragraph);
|
||||
+ QPD fprintf(stdout, "Soft break (%Zd + %d > 76 char) for '%s'\n", current_line_length, charout_size, paragraph);
|
||||
|
||||
/** reinitialize the paragraph **/
|
||||
paragraph[0] = '\0';
|
||||
@@ -108,7 +108,7 @@ int qp_encode( char *out, size_t out_size, char *in, s
|
||||
}
|
||||
|
||||
snprintf(pp, pp_remaining, "%s", charout);
|
||||
- QPD fprintf(stdout,"charout='%s', size=%d, pp_remain=%d result='%s'\n", charout, charout_size, pp_remaining, paragraph);
|
||||
+ QPD fprintf(stdout,"charout='%s', size=%d, pp_remain=%Zd result='%s'\n", charout, charout_size, pp_remaining, paragraph);
|
||||
pp += charout_size;
|
||||
pp_remaining -= charout_size;
|
||||
p++;
|
||||
@@ -149,13 +149,13 @@ int qp_encode_from_file( char *fname )
|
||||
out_size = in_size *3;
|
||||
in_buffer = malloc( sizeof(char) *in_size +1);
|
||||
if (in_buffer == NULL) {
|
||||
- QPD fprintf(stdout,"Error allocating %d bytes for input buffer\n", in_size);
|
||||
+ QPD fprintf(stdout,"Error allocating %Zd bytes for input buffer\n", in_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
out_buffer = malloc( sizeof(char) *out_size *3 +1);
|
||||
if (in_buffer == NULL) {
|
||||
- QPD fprintf(stdout,"Error allocating %d bytes for output buffer\n", out_size);
|
||||
+ QPD fprintf(stdout,"Error allocating %Zd bytes for output buffer\n", out_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ int qp_encode_from_file( char *fname )
|
||||
** we segfault ;) **/
|
||||
*(in_buffer +in_size) = '\0';
|
||||
|
||||
- QPD fprintf(stdout,"file %s is loaded, size = %d\n", fname, in_size);
|
||||
+ QPD fprintf(stdout,"file %s is loaded, size = %Zd\n", fname, in_size);
|
||||
|
||||
qp_encode( out_buffer, out_size, in_buffer, in_size );
|
||||
|
8
mail/altermime/pkg/DESCR
Executable file
8
mail/altermime/pkg/DESCR
Executable file
@ -0,0 +1,8 @@
|
||||
alterMIME is a small program which is used to alter your mime-encoded
|
||||
mailpacks as typically received by e.g. amavisd-new.
|
||||
It can:
|
||||
* Insert disclaimers
|
||||
* Insert arbitary X-headers
|
||||
* Modify existing headers
|
||||
* Remove attachments based on filename or content-type
|
||||
* Replace attachments based on filename
|
4
mail/altermime/pkg/PLIST
Normal file
4
mail/altermime/pkg/PLIST
Normal file
@ -0,0 +1,4 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2012/05/30 16:47:01 ajacoutot Exp $
|
||||
@bin bin/altermime
|
||||
share/doc/altermime/
|
||||
share/doc/altermime/LICENCE
|
Loading…
Reference in New Issue
Block a user