Added minimum message length

Signed-off-by: Tyrolyean <tyrolyean@tyrolyean.net>
This commit is contained in:
Tyrolyean 2020-04-30 22:38:33 +02:00
parent da6b92de07
commit 8c5cbe50e9
No known key found for this signature in database
GPG key ID: 81EC9BAC5E9667C6
5 changed files with 25 additions and 1 deletions

11
README
View file

@ -39,6 +39,17 @@ You can specify the following command line options:
webserver!
That WILL BE a security riks!
--other-base64 --only-base64
Decides wether ONLY base64 encoded files should be removed from the
actual mail, or ALL files.
--minfilesize -s
The minimum file size which a file has to have before beeing attached.
Thissize is before base64 decoding if nescessary. Size is in bytes,
ONLY bytes. Do NOT prefix a M or K, it will not be parsed! Defaults to
500Kb. If 0 is specified, all files will be attached. A negative value
effectively disables us.
HOWTO
We essentially are MITM sniffing your email traffic and playing proxy from your

View file

@ -33,5 +33,6 @@ extern int verbose;
extern char* directory;
extern char* url_base;
extern long min_filesize;
#endif /* CONFIG_H */

View file

@ -342,6 +342,10 @@ int replace_base64_files(struct email_t* mail, const char* dirname){
if(mail->file_info.name == NULL){
return 0;
}
if((mail->message_length - mail->body_offset) < (unsigned long)
min_filesize ){
return 0;
}
if(mail->base64_encoded){
if(base64_decode_file(dirname, mail) < 0){

View file

@ -28,3 +28,4 @@ char* directory = NULL;
char* url_base = NULL;
long min_filesize= 1024*512;

View file

@ -36,13 +36,14 @@ int main(int argc, char* argv[]){
{"out-port", required_argument, 0, 'o'},
{"instance-id", required_argument, 0, 'n'},
{"directory", required_argument, 0, 'd'},
{"minfilesize", required_argument, 0, 's'},
{"url", required_argument, 0, 'u'},
{0, 0, 0, 0}
};
/* getopt_long stores the option index here. */
int option_index = 0;
c = getopt_long (argc, argv, "n:i:o:d:u:",
c = getopt_long (argc, argv, "n:i:o:d:u:s:",
long_options, &option_index);
/* Detect the end of the options. */
@ -71,6 +72,9 @@ int main(int argc, char* argv[]){
case 'u':
url_base = optarg;
break;
case 's':
min_filesize = atol(optarg);
break;
case '?':
/* getopt_long already printed an error message. */
@ -120,6 +124,9 @@ int main(int argc, char* argv[]){
printf("Only saving bas64 encoded files: %s\n",
only_base64 ? "true":"false");
printf("Min filesize to store messages: %liB\n",
min_filesize);
printf("Placing files into [%s] linked by [%s]\n", directory,
url_base);