2011-11-14 15:57:52 +01:00
|
|
|
/*
|
|
|
|
* misc.h, SJ
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MISC_H
|
|
|
|
#define _MISC_H
|
|
|
|
|
2014-04-17 15:40:24 +02:00
|
|
|
#include <sys/socket.h>
|
2012-10-27 14:40:25 +02:00
|
|
|
#include <openssl/ssl.h>
|
2011-11-14 15:57:52 +01:00
|
|
|
#include <sys/time.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
#include <cfg.h>
|
|
|
|
#include "defs.h"
|
|
|
|
|
2012-11-24 23:02:08 +01:00
|
|
|
#define CHK_NULL(x, errmsg) if ((x)==NULL) { printf("error: %s\n", errmsg); return ERR; }
|
|
|
|
#define CHK_SSL(err, msg) if ((err)==-1) { printf("ssl error: %s\n", msg); return ERR; }
|
|
|
|
|
2012-07-06 21:44:57 +02:00
|
|
|
int get_build();
|
2015-07-17 14:50:49 +02:00
|
|
|
void get_extractor_list();
|
2011-11-14 15:57:52 +01:00
|
|
|
void __fatal(char *s);
|
|
|
|
long tvdiff(struct timeval a, struct timeval b);
|
|
|
|
int countCharacterInBuffer(char *p, char c);
|
|
|
|
void replaceCharacterInBuffer(char *p, char from, char to);
|
2014-07-22 16:00:03 +02:00
|
|
|
char *split(char *str, int ch, char *buf, int buflen, int *result);
|
2011-11-14 15:57:52 +01:00
|
|
|
char *split_str(char *row, char *what, char *s, int size);
|
2012-10-01 21:09:11 +02:00
|
|
|
int trimBuffer(char *s);
|
2011-11-14 15:57:52 +01:00
|
|
|
int extractEmail(char *rawmail, char *email);
|
2018-01-11 10:20:02 +01:00
|
|
|
int extract_verp_address(char *email);
|
2013-09-11 09:19:29 +02:00
|
|
|
void make_random_string(char *buf, int buflen);
|
2013-01-06 21:04:58 +01:00
|
|
|
void create_id(char *id, unsigned char server_id);
|
|
|
|
int get_random_bytes(unsigned char *buf, int len, unsigned char server_id);
|
2016-04-05 21:10:09 +02:00
|
|
|
int readFromEntropyPool(int fd, void *_s, ssize_t n);
|
2011-11-14 15:57:52 +01:00
|
|
|
int recvtimeout(int s, char *buf, int len, int timeout);
|
2017-08-08 15:34:45 +02:00
|
|
|
int write1(struct net *net, void *buf, int buflen);
|
|
|
|
int recvtimeoutssl(struct net *net, char *buf, int len);
|
|
|
|
void close_connection(struct net *net);
|
2011-11-14 15:57:52 +01:00
|
|
|
|
|
|
|
void write_pid_file(char *pidfile);
|
|
|
|
int drop_privileges(struct passwd *pwd);
|
|
|
|
|
2017-08-08 15:34:45 +02:00
|
|
|
void init_session_data(struct session_data *sdata, struct config *cfg);
|
2012-05-04 21:26:16 +02:00
|
|
|
int read_from_stdin(struct session_data *sdata);
|
2012-10-05 14:27:03 +02:00
|
|
|
void strtolower(char *s);
|
2011-11-14 15:57:52 +01:00
|
|
|
|
2013-04-09 14:50:27 +02:00
|
|
|
void *get_in_addr(struct sockaddr *sa);
|
2016-11-06 22:16:03 +01:00
|
|
|
int make_socket_non_blocking(int fd);
|
|
|
|
int create_and_bind(char *listen_addr, int listen_port);
|
2013-04-09 14:50:27 +02:00
|
|
|
|
2017-05-14 17:18:09 +02:00
|
|
|
int can_i_write_directory(char *dir);
|
2014-10-02 10:02:33 +02:00
|
|
|
|
2016-10-23 22:04:55 +02:00
|
|
|
void move_email(struct smtp_session *session);
|
2018-03-02 22:46:48 +01:00
|
|
|
int read_one_line(char *s, int c, char *buf, int buflen, int *rc);
|
2016-10-23 22:04:55 +02:00
|
|
|
|
2011-11-14 15:57:52 +01:00
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
char *strcasestr(const char *s, const char *find);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _MISC_H */
|