mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 00:41:59 +01:00
Merged jsuto/piler into master
This commit is contained in:
commit
1f271d419f
@ -1,3 +1,5 @@
|
||||
- Introduced the archive_address feature, see etc/example.conf for the details
|
||||
|
||||
1.3.12:
|
||||
-------
|
||||
|
||||
|
9
contrib/export-attachments/export-attachments.php
Normal file → Executable file
9
contrib/export-attachments/export-attachments.php
Normal file → Executable file
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
define('LOCK_FILE', '/var/piler/tmp/export-attachments.lock');
|
||||
define('EXPORT_LOCK_FILE', '/var/piler/tmp/export-attachments.lock');
|
||||
|
||||
$webuidir = "";
|
||||
|
||||
@ -52,9 +53,9 @@ Registry::set('auditor_user', 1);
|
||||
|
||||
openlog("export-attachments", LOG_PID, LOG_MAIL);
|
||||
|
||||
$fp = fopen(LOCK_FILE, "w");
|
||||
$fp = fopen(EXPORT_LOCK_FILE, "w");
|
||||
if(!flock($fp, LOCK_EX)) {
|
||||
syslog(LOG_INFO, "WARN: couldn't get a lock on " . LOCK_FILE);
|
||||
syslog(LOG_INFO, "WARN: couldn't get a lock on " . EXPORT_LOCK_FILE);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ $domains = $domain->get_mapped_domains();
|
||||
$last_id = $attachment->get_last_attachment_id();
|
||||
$start_id = $attachment->get_checkpoint();
|
||||
|
||||
syslog(LOG_INFO, "start: $start, limit: $limit");
|
||||
syslog(LOG_INFO, "start: $start_id, limit: $last_id");
|
||||
|
||||
|
||||
for($i=$start_id; $i<$last_id; $i++) {
|
||||
|
@ -238,6 +238,15 @@ mmap_dedup_test=0
|
||||
; clients via an IP-address list is not feasible.
|
||||
security_header=
|
||||
|
||||
; By default the archive accepts any envelope recipient addresses.
|
||||
; If your archive's port 25 is wide open to the Internet (which it
|
||||
; shouldn't be, then spammers may find it, and fill it with spam.
|
||||
;
|
||||
; By setting this variable you may restrict the envelope address
|
||||
; to a single email address, eg. some-random-address-12345@archive.yourdomain.com
|
||||
; Then the archive will reject any other envelope recipients
|
||||
archive_address=
|
||||
|
||||
; whether to enable (1) or not (0) an smtp access list similar to
|
||||
; postfix's postscreen. Valid actions in the acl file are "permit"
|
||||
; and "reject" (without quotes). See smtp.acl.example for more.
|
||||
|
@ -244,7 +244,7 @@ int retrieve_file_from_archive(char *filename, int mode, char **buffer, FILE *de
|
||||
|
||||
|
||||
CLEANUP:
|
||||
if(fd != -1) close(fd);
|
||||
if(fd != -1) close(fd); //-V547
|
||||
if(s) free(s);
|
||||
if(cfg->encrypt_messages == 1)
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
|
@ -39,7 +39,7 @@ struct _parse_rule {
|
||||
|
||||
struct _parse_rule config_parse_rules[] =
|
||||
{
|
||||
|
||||
{ "archive_address", "string", (void*) string_parser, offsetof(struct config, archive_address), "", MAXVAL-1},
|
||||
{ "archive_emails_not_having_message_id", "integer", (void*) int_parser, offsetof(struct config, archive_emails_not_having_message_id), "0", sizeof(int)},
|
||||
{ "archive_only_mydomains", "integer", (void*) int_parser, offsetof(struct config, archive_only_mydomains), "0", sizeof(int)},
|
||||
{ "backlog", "integer", (void*) int_parser, offsetof(struct config, backlog), "20", sizeof(int)},
|
||||
|
@ -67,6 +67,7 @@ struct config {
|
||||
int default_retention_days;
|
||||
|
||||
char security_header[MAXVAL];
|
||||
char archive_address[MAXVAL];
|
||||
|
||||
// mysql stuff
|
||||
|
||||
|
@ -81,8 +81,8 @@ int make_digests(struct session_data *sdata, struct config *cfg){
|
||||
SHA256_Final(md2, &context2);
|
||||
|
||||
for(i=0;i<DIGEST_LENGTH;i++){
|
||||
snprintf(sdata->bodydigest + i*2, 2*DIGEST_LENGTH, "%02x", md[i]);
|
||||
snprintf(sdata->digest + i*2, 2*DIGEST_LENGTH, "%02x", md2[i]);
|
||||
snprintf(sdata->bodydigest + i*2, 3, "%02x", md[i]);
|
||||
snprintf(sdata->digest + i*2, 3, "%02x", md2[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
30
src/imap.c
30
src/imap.c
@ -416,7 +416,7 @@ int list_folders(struct data *data){
|
||||
}
|
||||
|
||||
// trim the "A3 OK LIST completed" trailer off
|
||||
if(p) *p = '\0';
|
||||
if(p) *p = '\0'; //-V547
|
||||
|
||||
memset(attrs, 0, sizeof(attrs));
|
||||
|
||||
@ -449,21 +449,27 @@ int list_folders(struct data *data){
|
||||
} else {
|
||||
|
||||
if(fldrlen) {
|
||||
ruf = malloc(strlen(q) * 2 + 1);
|
||||
memset(ruf, 0, strlen(q) * 2 + 1);
|
||||
memcpy(ruf, q, strlen(q));
|
||||
r = ruf;
|
||||
while(*r != '\0') {
|
||||
if(*r == '\\') {
|
||||
memmove(r + 1, r, strlen(r));
|
||||
int ruflen = strlen(q) * 2;
|
||||
ruf = malloc(ruflen + 1);
|
||||
if(ruf){
|
||||
snprintf(ruf, ruflen, "%s", q);
|
||||
r = ruf;
|
||||
while(*r != '\0') {
|
||||
if(*r == '\\') {
|
||||
memmove(r + 1, r, strlen(r));
|
||||
r++;
|
||||
}
|
||||
r++;
|
||||
}
|
||||
r++;
|
||||
|
||||
snprintf(folder, sizeof(folder)-1, "%s", ruf);
|
||||
|
||||
free(ruf);
|
||||
}
|
||||
else {
|
||||
printf("error: ruf = malloc()\n");
|
||||
}
|
||||
|
||||
snprintf(folder, sizeof(folder)-1, "%s", ruf);
|
||||
|
||||
free(ruf);
|
||||
fldrlen = 0;
|
||||
} else {
|
||||
snprintf(folder, sizeof(folder)-1, "%s", q);
|
||||
|
@ -230,11 +230,8 @@ int extractEmail(char *rawmail, char *email){
|
||||
*/
|
||||
|
||||
void make_random_string(unsigned char *buf, int buflen){
|
||||
int i, len, fd;
|
||||
int urandom=0;
|
||||
static char alphanum[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
len = strlen(alphanum);
|
||||
const char alphanum[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
int i, fd, urandom=0, len = sizeof(alphanum)-1;
|
||||
|
||||
fd = open(RANDOM_POOL, O_RDONLY);
|
||||
if(fd != -1){
|
||||
@ -289,7 +286,7 @@ int get_random_bytes(unsigned char *buf, int len, unsigned char server_id){
|
||||
taia_now(&now);
|
||||
taia_pack(nowpack, &now);
|
||||
|
||||
memcpy(buf, nowpack, 12);
|
||||
memcpy(buf, nowpack, 12); //-V512
|
||||
|
||||
fd = open(RANDOM_POOL, O_RDONLY);
|
||||
if(fd == -1) return ret;
|
||||
|
@ -45,7 +45,7 @@ struct parser_state parse_message(struct session_data *sdata, int take_into_piec
|
||||
|
||||
if(take_into_pieces == 1 && state.writebufpos > 0){
|
||||
if(write(state.mfd, writebuffer, state.writebufpos) == -1) syslog(LOG_PRIORITY, "ERROR: %s: write(), %s, %d, %s", sdata->ttmpfile, __func__, __LINE__, __FILE__);
|
||||
memset(writebuffer, 0, sizeof(writebuffer));
|
||||
memset(writebuffer, 0, sizeof(writebuffer)); //-V597
|
||||
state.writebufpos = 0;
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata
|
||||
sdata->restored_copy = 1;
|
||||
}
|
||||
|
||||
if(cfg->security_header && state->found_security_header == 0 && strstr(buf, cfg->security_header)){
|
||||
if(cfg->security_header[0] && state->found_security_header == 0 && strstr(buf, cfg->security_header)){
|
||||
state->found_security_header = 1;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ void fixupEncodedHeaderLine(char *buf, int buflen);
|
||||
void fixupSoftBreakInQuotedPritableLine(char *buf, struct parser_state *state);
|
||||
void fixupBase64EncodedLine(char *buf, struct parser_state *state);
|
||||
void markHTML(char *buf, struct parser_state *state);
|
||||
int appendHTMLTag(char *buf, char *htmlbuf, int pos, struct parser_state *state);
|
||||
void setStateHTMLStyle(char *htmlbuf, int pos, struct parser_state *state);
|
||||
void translateLine(unsigned char *p, struct parser_state *state);
|
||||
void fix_email_address_for_sphinx(char *s);
|
||||
void split_email_address(char *s);
|
||||
|
@ -263,6 +263,18 @@ time_t parse_date_header(char *datestr){
|
||||
|
||||
ts += get_local_timezone_offset() - offset;
|
||||
|
||||
if(ts < 700000000){
|
||||
// If the Date: field contains some garbage, eg.
|
||||
// "Date: [mail_datw]" or similar, and the date
|
||||
// is before Sat Mar 7 20:26:40 UTC 1992, then
|
||||
// return the current timestamp
|
||||
|
||||
time_t now;
|
||||
time(&now);
|
||||
|
||||
return now;
|
||||
}
|
||||
|
||||
return ts;
|
||||
}
|
||||
|
||||
@ -538,7 +550,7 @@ void markHTML(char *buf, struct parser_state *state){
|
||||
|
||||
if(isspace(*s)){
|
||||
if(j > 0){
|
||||
k += appendHTMLTag(puf, html, pos, state);
|
||||
setStateHTMLStyle(html, pos, state);
|
||||
memset(html, 0, SMALLBUFSIZE); j=0;
|
||||
}
|
||||
pos++;
|
||||
@ -563,7 +575,7 @@ void markHTML(char *buf, struct parser_state *state){
|
||||
|
||||
if(j > 0){
|
||||
strncat(html, " ", SMALLBUFSIZE-1);
|
||||
k += appendHTMLTag(puf, html, pos, state);
|
||||
setStateHTMLStyle(html, pos, state);
|
||||
memset(html, 0, SMALLBUFSIZE); j=0;
|
||||
}
|
||||
}
|
||||
@ -571,47 +583,15 @@ void markHTML(char *buf, struct parser_state *state){
|
||||
}
|
||||
|
||||
//printf("append last in line:*%s*, html=+%s+, j=%d\n", puf, html, j);
|
||||
if(j > 0){ appendHTMLTag(puf, html, pos, state); }
|
||||
if(j > 0){ setStateHTMLStyle(html, pos, state); }
|
||||
|
||||
strcpy(buf, puf);
|
||||
}
|
||||
|
||||
|
||||
int appendHTMLTag(char *buf, char *htmlbuf, int pos, struct parser_state *state){
|
||||
char html[SMALLBUFSIZE];
|
||||
int len;
|
||||
|
||||
void setStateHTMLStyle(char *htmlbuf, int pos, struct parser_state *state){
|
||||
if(pos == 0 && strncmp(htmlbuf, "style ", 6) == 0) state->style = 1;
|
||||
if(pos == 0 && strncmp(htmlbuf, "/style ", 7) == 0) state->style = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
//printf("appendHTML: pos:%d, +%s+\n", pos, htmlbuf);
|
||||
|
||||
if(state->style == 1) return 0;
|
||||
|
||||
if(strlen(htmlbuf) == 0) return 0;
|
||||
|
||||
snprintf(html, SMALLBUFSIZE-1, "HTML*%s", htmlbuf);
|
||||
len = strlen(html);
|
||||
|
||||
if(len > 8 && strchr(html, '=')){
|
||||
char *p = strstr(html, "cid:");
|
||||
if(p){
|
||||
*(p+3) = '\0';
|
||||
strncat(html, " ", SMALLBUFSIZE-1);
|
||||
}
|
||||
|
||||
strncat(buf, html, MAXBUFSIZE-1);
|
||||
return len;
|
||||
}
|
||||
|
||||
if(strstr(html, "http") ){
|
||||
strncat(buf, html+5, MAXBUFSIZE-1);
|
||||
return len-5;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +103,7 @@ void child_sighup_handler(int sig){
|
||||
|
||||
int perform_checks(char *filename, struct session_data *sdata, struct data *data, struct parser_state *parser_state, struct config *cfg){
|
||||
|
||||
if(cfg->security_header && parser_state->found_security_header == 0){
|
||||
if(cfg->security_header[0] && parser_state->found_security_header == 0){
|
||||
syslog(LOG_PRIORITY, "%s: discarding: missing security header", filename);
|
||||
return ERR_DISCARDED;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ extern int optind;
|
||||
int dryrun = 0;
|
||||
int exportall = 0;
|
||||
int verification_status = 0;
|
||||
int rc = 0;
|
||||
int export_to_stdout = 0;
|
||||
char *query=NULL;
|
||||
int verbosity = 0;
|
||||
@ -33,7 +32,7 @@ int max_matches = 1000;
|
||||
char *index_list = "main1,dailydelta1,delta1";
|
||||
regex_t regexp;
|
||||
char *zipfile = NULL;
|
||||
struct zip *z = NULL;
|
||||
struct zip *zip = NULL;
|
||||
uint64 *zip_ids = NULL;
|
||||
int zip_counter = 0;
|
||||
int zip_batch = 2000;
|
||||
@ -165,6 +164,7 @@ uint64 run_query(struct session_data *sdata, struct session_data *sdata2, char *
|
||||
MYSQL_ROW row;
|
||||
uint64 id=0;
|
||||
char s[SMALLBUFSIZE];
|
||||
int rc=0;
|
||||
|
||||
*num = 0;
|
||||
|
||||
@ -194,6 +194,7 @@ uint64 run_query(struct session_data *sdata, struct session_data *sdata2, char *
|
||||
}
|
||||
|
||||
if(!rc) export_emails_matching_to_query(sdata, query, cfg);
|
||||
else printf("error: append_string_to_buffer() in run_query()\n");
|
||||
|
||||
free(query);
|
||||
query = NULL;
|
||||
@ -240,6 +241,7 @@ void export_emails_matching_id_list(struct session_data *sdata, struct session_d
|
||||
|
||||
int build_query_from_args(char *from, char *to, char *fromdomain, char *todomain, int minsize, int maxsize, unsigned long startdate, unsigned long stopdate){
|
||||
char s[SMALLBUFSIZE];
|
||||
int rc=0;
|
||||
|
||||
if(exportall == 1){
|
||||
rc = append_string_to_buffer(&query, "SELECT `id`, `piler_id`, `digest`, `bodydigest` FROM ");
|
||||
@ -328,9 +330,9 @@ int build_query_from_args(char *from, char *to, char *fromdomain, char *todomain
|
||||
|
||||
#if LIBZIP_VERSION_MAJOR >= 1
|
||||
void zip_flush(){
|
||||
zip_close(z);
|
||||
zip_close(zip);
|
||||
|
||||
z = NULL;
|
||||
zip = NULL;
|
||||
zip_counter = 0;
|
||||
|
||||
if(!zip_ids) return;
|
||||
@ -354,7 +356,7 @@ int export_emails_matching_to_query(struct session_data *sdata, char *s, struct
|
||||
char digest[SMALLBUFSIZE], bodydigest[SMALLBUFSIZE];
|
||||
char filename[SMALLBUFSIZE];
|
||||
struct sql sql;
|
||||
int errorp;
|
||||
int errorp, rc=0;
|
||||
|
||||
if(prepare_sql_statement(sdata, &sql, s) == ERR) return ERR;
|
||||
|
||||
@ -410,9 +412,9 @@ int export_emails_matching_to_query(struct session_data *sdata, char *s, struct
|
||||
if(zipfile){
|
||||
#if LIBZIP_VERSION_MAJOR >= 1
|
||||
// Open zip file if handler is NULL
|
||||
if(!z){
|
||||
z = zip_open(zipfile, ZIP_CREATE, &errorp);
|
||||
if(!z){
|
||||
if(!zip){
|
||||
zip = zip_open(zipfile, ZIP_CREATE, &errorp);
|
||||
if(!zip){
|
||||
printf("error: error creating zip file=%s, error code=%d\n", zipfile, errorp);
|
||||
return ERR;
|
||||
}
|
||||
@ -425,12 +427,12 @@ int export_emails_matching_to_query(struct session_data *sdata, char *s, struct
|
||||
return ERR;
|
||||
}
|
||||
|
||||
zip_source_t *zs = zip_source_file(z, filename, 0, 0);
|
||||
if(zs && zip_file_add(z, filename, zs, ZIP_FL_ENC_UTF_8) >= 0){
|
||||
zip_source_t *zs = zip_source_file(zip, filename, 0, 0);
|
||||
if(zs && zip_file_add(zip, filename, zs, ZIP_FL_ENC_UTF_8) >= 0){
|
||||
*(zip_ids+zip_counter) = id;
|
||||
zip_counter++;
|
||||
} else {
|
||||
printf("error adding file %s: %s\n", filename, zip_strerror(z));
|
||||
printf("error adding file %s: %s\n", filename, zip_strerror(zip));
|
||||
return ERR;
|
||||
}
|
||||
|
||||
@ -539,7 +541,10 @@ int main(int argc, char **argv){
|
||||
break;
|
||||
}
|
||||
|
||||
rc = append_email_to_buffer(&from, optarg);
|
||||
if(append_email_to_buffer(&from, optarg)){
|
||||
printf("error: append_email_to_buffer() for from\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -550,7 +555,10 @@ int main(int argc, char **argv){
|
||||
break;
|
||||
}
|
||||
|
||||
rc = append_email_to_buffer(&to, optarg);
|
||||
if(append_email_to_buffer(&to, optarg)){
|
||||
printf("error: append_email_to_buffer() for to\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -561,7 +569,10 @@ int main(int argc, char **argv){
|
||||
break;
|
||||
}
|
||||
|
||||
rc = append_email_to_buffer(&fromdomain, optarg);
|
||||
if(append_email_to_buffer(&fromdomain, optarg)){
|
||||
printf("error: append_email_to_buffer() for fromdomain\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -572,7 +583,10 @@ int main(int argc, char **argv){
|
||||
break;
|
||||
}
|
||||
|
||||
rc = append_email_to_buffer(&todomain, optarg);
|
||||
if(append_email_to_buffer(&todomain, optarg)){
|
||||
printf("error: append_email_to_buffer() for todomain\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
@ -295,7 +295,7 @@ int main(int argc, char **argv){
|
||||
}
|
||||
|
||||
|
||||
if(!mbox[0] && !data.import->mboxdir && !data.import->filename && !directory && !imapserver && !pop3server) usage();
|
||||
if(!mbox[0] && !data.import->mboxdir && !data.import->filename[0] && !directory && !imapserver && !pop3server) usage();
|
||||
|
||||
if(data.import->failed_folder && !can_i_write_directory(data.import->failed_folder)){
|
||||
printf("cannot write failed directory '%s'\n", data.import->failed_folder);
|
||||
|
17
src/rules.c
17
src/rules.c
@ -118,7 +118,6 @@ int append_rule(struct node *xhash[], struct rule_cond *rule_cond){
|
||||
|
||||
struct rule *create_rule_item(struct rule_cond *rule_cond){
|
||||
struct rule *h=NULL;
|
||||
char empty = '\0';
|
||||
int len;
|
||||
|
||||
if(rule_cond == NULL) return NULL;
|
||||
@ -144,16 +143,16 @@ struct rule *create_rule_item(struct rule_cond *rule_cond){
|
||||
h->emptyfrom = h->emptyto = h->emptysubject = h->emptyaname = h->emptyatype = 0;
|
||||
|
||||
|
||||
if(rule_cond->from == NULL || strlen(rule_cond->from) < 1){ rule_cond->from[0] = empty; h->emptyfrom = 1; }
|
||||
if(rule_cond->from[0] == 0){ h->emptyfrom = 1; }
|
||||
if(regcomp(&(h->from), rule_cond->from, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
|
||||
|
||||
if(rule_cond->to == NULL || strlen(rule_cond->to) < 1){ rule_cond->to[0] = empty; h->emptyto = 1; }
|
||||
if(rule_cond->to[0] == 0){ h->emptyto = 1; }
|
||||
if(regcomp(&(h->to), rule_cond->to, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
|
||||
|
||||
if(rule_cond->subject == NULL || strlen(rule_cond->subject) < 1){ rule_cond->subject[0] = empty; h->emptysubject = 1; }
|
||||
if(rule_cond->subject[0] == 0){ h->emptysubject = 1; }
|
||||
if(regcomp(&(h->subject), rule_cond->subject, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
|
||||
|
||||
if(rule_cond->body == NULL || strlen(rule_cond->body) < 1){ rule_cond->body[0] = empty; h->emptybody = 1; }
|
||||
if(rule_cond->body[0] == 0){ h->emptybody = 1; }
|
||||
if(regcomp(&(h->body), rule_cond->body, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
|
||||
|
||||
h->spam = rule_cond->spam;
|
||||
@ -161,20 +160,16 @@ struct rule *create_rule_item(struct rule_cond *rule_cond){
|
||||
h->folder_id = rule_cond->folder_id;
|
||||
|
||||
h->size = rule_cond->size;
|
||||
|
||||
if(rule_cond->_size == NULL) rule_cond->_size[0] = empty;
|
||||
snprintf(h->_size, 3, "%s", rule_cond->_size);
|
||||
|
||||
if(rule_cond->attachment_name == NULL || strlen(rule_cond->attachment_name) < 1){ rule_cond->attachment_name[0] = empty; h->emptyaname = 1; }
|
||||
if(rule_cond->attachment_name[0] == 0){ h->emptyaname = 1; }
|
||||
if(regcomp(&(h->attachment_name), rule_cond->attachment_name, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
|
||||
|
||||
if(rule_cond->attachment_type == NULL || strlen(rule_cond->attachment_type) < 1){ rule_cond->attachment_type[0] = empty; h->emptyatype = 1; }
|
||||
if(rule_cond->attachment_type[0] == 0){ h->emptyatype = 1; }
|
||||
if(regcomp(&(h->attachment_type), rule_cond->attachment_type, REG_ICASE | REG_EXTENDED)) h->compiled = 0;
|
||||
|
||||
|
||||
h->attachment_size = rule_cond->attachment_size;
|
||||
|
||||
if(rule_cond->_attachment_size == NULL) rule_cond->_attachment_size[0] = empty;
|
||||
snprintf(h->_attachment_size, 3, "%s", rule_cond->_attachment_size);
|
||||
|
||||
len = strlen(rule_cond->domain)+8 + strlen(rule_cond->from)+6 + strlen(rule_cond->to)+4 + strlen(rule_cond->subject)+9 + strlen(rule_cond->body)+6 + strlen(rule_cond->_size)+6 + strlen(rule_cond->attachment_name)+10 + strlen(rule_cond->attachment_type)+10 + strlen(rule_cond->_attachment_size)+10 + 9 + 15 + 15;
|
||||
|
14
src/smtp.c
14
src/smtp.c
@ -42,7 +42,7 @@ void process_smtp_command(struct smtp_session *session, char *buf, struct config
|
||||
}
|
||||
|
||||
if(strncasecmp(buf, SMTP_CMD_RCPT_TO, strlen(SMTP_CMD_RCPT_TO)) == 0){
|
||||
process_command_rcpt_to(session, buf);
|
||||
process_command_rcpt_to(session, buf, cfg);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ void process_command_mail_from(struct smtp_session *session, char *buf){
|
||||
}
|
||||
|
||||
|
||||
void process_command_rcpt_to(struct smtp_session *session, char *buf){
|
||||
void process_command_rcpt_to(struct smtp_session *session, char *buf, struct config *cfg){
|
||||
|
||||
if(session->protocol_state == SMTP_STATE_MAIL_FROM || session->protocol_state == SMTP_STATE_RCPT_TO){
|
||||
|
||||
@ -249,6 +249,14 @@ void process_command_rcpt_to(struct smtp_session *session, char *buf){
|
||||
|
||||
if(session->num_of_rcpt_to < MAX_RCPT_TO){
|
||||
extractEmail(buf, session->rcptto[session->num_of_rcpt_to]);
|
||||
|
||||
// Check if we should accept archive_address only
|
||||
if(cfg->archive_address[0] && !strstr(cfg->archive_address, session->rcptto[session->num_of_rcpt_to])){
|
||||
syslog(LOG_PRIORITY, "ERROR: Invalid recipient: *%s*", session->rcptto[session->num_of_rcpt_to]);
|
||||
send_smtp_response(session, SMTP_RESP_550_ERR_INVALID_RECIPIENT);
|
||||
return;
|
||||
}
|
||||
|
||||
session->num_of_rcpt_to++;
|
||||
}
|
||||
|
||||
@ -306,7 +314,7 @@ void process_command_period(struct smtp_session *session){
|
||||
|
||||
session->buflen = 0;
|
||||
session->last_data_char = 0;
|
||||
memset(session->buf, 0, SMALLBUFSIZE);
|
||||
memset(session->buf, 0, sizeof(session->buf));
|
||||
|
||||
send_smtp_response(session, buf);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ void process_command_ehlo_lhlo(struct smtp_session *session, char *buf, int bufl
|
||||
void process_command_quit(struct smtp_session *session, char *buf, int buflen);
|
||||
void process_command_reset(struct smtp_session *session);
|
||||
void process_command_mail_from(struct smtp_session *session, char *buf);
|
||||
void process_command_rcpt_to(struct smtp_session *session, char *buf);
|
||||
void process_command_rcpt_to(struct smtp_session *session, char *buf, struct config *cfg);
|
||||
void process_command_data(struct smtp_session *session, struct config *cfg);
|
||||
void process_command_period(struct smtp_session *session);
|
||||
void process_command_starttls(struct smtp_session *session);
|
||||
|
@ -56,6 +56,7 @@
|
||||
|
||||
#define SMTP_RESP_502_ERR "502 Command not implemented\r\n"
|
||||
#define SMTP_RESP_503_ERR "503 Bad command sequence\r\n"
|
||||
#define SMTP_RESP_550_ERR_INVALID_RECIPIENT "550 Invalid recipient\r\n"
|
||||
#define SMTP_RESP_550_ERR_YOU_ARE_BANNED_BY_LOCAL_POLICY "550 You are banned by local policy\r\n"
|
||||
#define SMTP_RESP_550_ERR "550 Service currently unavailable\r\n"
|
||||
|
||||
|
@ -228,7 +228,7 @@ int store_file(struct session_data *sdata, char *filename, int len, struct confi
|
||||
|
||||
ENDE:
|
||||
if(outbuf) free(outbuf);
|
||||
if(z) free(z);
|
||||
if(z) free(z); //-V547
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -64,10 +64,11 @@ class ControllerAuditHelper extends Controller {
|
||||
$this->data['actions'][ACTION_DOWNLOAD_ATTACHMENT] = $this->data['text_download_attachment2'];
|
||||
$this->data['actions'][ACTION_UNAUTHORIZED_DOWNLOAD_ATTACHMENT] = $this->data['text_unauthorized_download_attachment'];
|
||||
$this->data['actions'][ACTION_VIEW_JOURNAL] = $this->data['text_view_journal'];
|
||||
$this->data['actions'][ACTION_MARK_AS_PRIVATE] = $this->data['text_mark_private'];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* paging info */
|
||||
|
||||
$this->data['prev_page'] = $this->data['page'] - 1;
|
||||
|
@ -211,6 +211,7 @@ $_['text_logout2'] = "odhlášení";
|
||||
$_['text_maillog_status'] = "status maillog collectoru";
|
||||
$_['text_main_title'] = "clapf web UI";
|
||||
$_['text_mapped_domain'] = "Mapovaná doména";
|
||||
$_['text_mark_private'] = "private";
|
||||
$_['text_marked_for_removal'] = "Zpráva označena k odstranění";
|
||||
$_['text_memory_usage'] = "Využití paměti";
|
||||
$_['text_message'] = "zpráva";
|
||||
|
@ -197,6 +197,7 @@ $_['text_logout2'] = "Abmeldung";
|
||||
$_['text_maillog_status'] = "Sammelstatus Maillogbuch";
|
||||
$_['text_main_title'] = "Clapf Benutzeroberfläche";
|
||||
$_['text_mapped_domain'] = "Domänenalias";
|
||||
$_['text_mark_private'] = "private";
|
||||
$_['text_marked_for_removal'] = "Nachricht zum Löschen markiert";
|
||||
$_['text_memory_usage'] = "Arbeitsspeicher";
|
||||
$_['text_message'] = "Nachricht";
|
||||
|
@ -216,6 +216,7 @@ $_['text_logout2'] = "logout";
|
||||
$_['text_maillog_status'] = "maillog collector status";
|
||||
$_['text_main_title'] = "clapf web UI";
|
||||
$_['text_mapped_domain'] = "Mapped domain";
|
||||
$_['text_mark_private'] = "private";
|
||||
$_['text_marked_for_removal'] = "Message marked for removal";
|
||||
$_['text_memory_usage'] = "Memory usage";
|
||||
$_['text_message'] = "message";
|
||||
|
@ -197,6 +197,7 @@ $_['text_logout2'] = "cerrar sesión";
|
||||
$_['text_maillog_status'] = "estado del colector de logs de mails";
|
||||
$_['text_main_title'] = "IU web clapf";
|
||||
$_['text_mapped_domain'] = "Dominio mapeado";
|
||||
$_['text_mark_private'] = "private";
|
||||
$_['text_marked_for_removal'] = "Mensaje marcado para remover";
|
||||
$_['text_memory_usage'] = "Uso de memoria";
|
||||
$_['text_message'] = "mensaje";
|
||||
|
@ -210,6 +210,7 @@ $_['text_logout2'] = "déconnexion";
|
||||
$_['text_maillog_status'] = "statut du collecteur de logs mails";
|
||||
$_['text_main_title'] = "clapf web UI";
|
||||
$_['text_mapped_domain'] = "Domaine mappé";
|
||||
$_['text_mark_private'] = "private";
|
||||
$_['text_marked_for_removal'] = "Message marqué pour suppression";
|
||||
$_['text_memory_usage'] = "Utilisation mémoire";
|
||||
$_['text_message'] = "message";
|
||||
|
@ -217,6 +217,7 @@ $_['text_logout2'] = "kijelentkezés";
|
||||
$_['text_maillog_status'] = "maillog gyűjtő státusz";
|
||||
$_['text_main_title'] = "clapf web UI";
|
||||
$_['text_mapped_domain'] = "Hozzárendelt domain";
|
||||
$_['text_mark_private'] = "privát";
|
||||
$_['text_marked_for_removal'] = "Levél törlésre jelölve";
|
||||
$_['text_memory_usage'] = "Memória használat";
|
||||
$_['text_message'] = "üzenet";
|
||||
|
@ -212,6 +212,7 @@ $_['text_logout2'] = "wylogowany";
|
||||
$_['text_maillog_status'] = "program od zbierania wiadomości e-mail";
|
||||
$_['text_main_title'] = "clapf interfejsu użytkownika strony";
|
||||
$_['text_mapped_domain'] = "Zmapowana domena";
|
||||
$_['text_mark_private'] = "private";
|
||||
$_['text_marked_for_removal'] = "Wiadomość oznaczona do usunięcia";
|
||||
$_['text_memory_usage'] = "Użycie pamięci";
|
||||
$_['text_message'] = "wiadomość";
|
||||
|
@ -210,6 +210,7 @@ $_['text_logout2'] = "выход";
|
||||
$_['text_maillog_status'] = "статус сборщика maillog";
|
||||
$_['text_main_title'] = "Основной заголовок";
|
||||
$_['text_mapped_domain'] = "Отображаемый домен";
|
||||
$_['text_mark_private'] = "private";
|
||||
$_['text_marked_for_removal'] = "Помеченные для удаления сообщения";
|
||||
$_['text_memory_usage'] = "Использование памяти";
|
||||
$_['text_message'] = "сообщение";
|
||||
|
@ -209,6 +209,7 @@ $_['text_logout2'] = "çıkış";
|
||||
$_['text_maillog_status'] = "e-posta logu toplama durumu";
|
||||
$_['text_main_title'] = "clapf web arabirimi";
|
||||
$_['text_mapped_domain'] = "Eşleşmiş alan adı";
|
||||
$_['text_mark_private'] = "private";
|
||||
$_['text_marked_for_removal'] = "Mesaj kaldırılmak üzere işaretlenmiş";
|
||||
$_['text_memory_usage'] = "Hafıza kullanımı";
|
||||
$_['text_message'] = "mesaj";
|
||||
|
Loading…
Reference in New Issue
Block a user