Added verbose switch
Signed-off-by: Tyrolyean <tyrolyean@tyrolyean.net>
This commit is contained in:
parent
9fcb7dc001
commit
e46ae1e21c
5 changed files with 19 additions and 12 deletions
|
@ -28,6 +28,6 @@ extern int abort_on_pgp, abort_on_dkim;
|
|||
|
||||
extern char* instance_id;
|
||||
|
||||
extern bool verbose;
|
||||
extern int verbose;
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
|
|
|
@ -50,6 +50,9 @@ struct email_t* mail_from_text(char* message, size_t length,
|
|||
char* cont_type = search_header_key(mail, "Content-Type");
|
||||
if(cont_type == NULL){
|
||||
/* Halleluja, I've got nothing to do! WOO */
|
||||
if(verbose){
|
||||
printf("Mail found without content type!");
|
||||
}
|
||||
mail->is_multipart = false;
|
||||
return mail;
|
||||
}else{
|
||||
|
|
|
@ -23,4 +23,4 @@ uint16_t listen_port = 4269, forward_port = 4270;
|
|||
int abort_on_pgp = true, abort_on_dkim = true;
|
||||
char* instance_id = NULL;
|
||||
|
||||
bool verbose = false;
|
||||
int verbose = false;
|
||||
|
|
22
src/main.c
22
src/main.c
|
@ -28,6 +28,8 @@ int main(int argc, char* argv[]){
|
|||
{"abort-dkim", no_argument, &abort_on_dkim,1},
|
||||
{"noabort-pgp", no_argument, &abort_on_pgp, 0},
|
||||
{"noabort-dkim",no_argument, &abort_on_dkim,0},
|
||||
{"verbose", no_argument, &verbose, 1},
|
||||
{"quiet", no_argument, &verbose, 0},
|
||||
{"in-port", required_argument, 0, 'i'},
|
||||
{"out-port", required_argument, 0, 'o'},
|
||||
{"instance-id", required_argument, 0, 'n'},
|
||||
|
@ -79,18 +81,20 @@ int main(int argc, char* argv[]){
|
|||
perror("gethostname failed! set instance id manually");
|
||||
}
|
||||
}
|
||||
if(verbose){
|
||||
|
||||
printf("Incoming port: %u outgoing port: %u on loopback interface\n",
|
||||
listen_port, forward_port);
|
||||
printf("Incoming port: %u outgoing port: %u on loopback "
|
||||
"interface\n", listen_port, forward_port);
|
||||
|
||||
printf("Ignoring PGP signed/encrypted messages: %s\n",
|
||||
abort_on_pgp ? "true":false);
|
||||
printf("Ignoring PGP signed/encrypted messages: %s\n",
|
||||
abort_on_pgp ? "true":false);
|
||||
|
||||
printf("Ignoring DKIM signed messages: %s\n",
|
||||
abort_on_dkim ? "true" : "false");
|
||||
|
||||
printf("Instance id for messages: %s\n",
|
||||
instance_id);
|
||||
printf("Ignoring DKIM signed messages: %s\n",
|
||||
abort_on_dkim ? "true" : "false");
|
||||
|
||||
printf("Instance id for messages: %s\n",
|
||||
instance_id);
|
||||
}
|
||||
|
||||
if(init_net() < 0){
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -59,7 +59,7 @@ char* search_header_key(struct email_t* mail, const char* key){
|
|||
}
|
||||
size_t keylen = strlen(key);
|
||||
|
||||
for(size_t i = 0; i < (mail->header_len - keylen); i++){
|
||||
for(size_t i = 0; (i+keylen) < mail->header_len; i++){
|
||||
if(mail->message[i] == '\n' || i == 0){
|
||||
if(strncasecmp(&mail->message[i+1], key, keylen) == 0){
|
||||
return &mail->message[i+1];
|
||||
|
|
Loading…
Reference in a new issue