2011-11-14 15:57:52 +01:00
|
|
|
/*
|
|
|
|
* misc.h, SJ
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MISC_H
|
|
|
|
#define _MISC_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-07-06 21:44:57 +02:00
|
|
|
int get_build();
|
2011-11-14 15:57:52 +01:00
|
|
|
void __fatal(char *s);
|
|
|
|
long tvdiff(struct timeval a, struct timeval b);
|
|
|
|
int searchStringInBuffer(char *s, int len1, char *what, int len2);
|
|
|
|
int countCharacterInBuffer(char *p, char c);
|
|
|
|
void replaceCharacterInBuffer(char *p, char from, char to);
|
|
|
|
char *split(char *row, int ch, char *s, int size);
|
|
|
|
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);
|
|
|
|
void create_id(char *id);
|
|
|
|
int get_random_bytes(unsigned char *buf, int len);
|
|
|
|
int readFromEntropyPool(int fd, void *_s, size_t n);
|
|
|
|
int recvtimeout(int s, char *buf, int len, int timeout);
|
2012-10-27 14:40:25 +02:00
|
|
|
int write1(int sd, char *buf, int use_ssl, SSL *ssl);
|
|
|
|
int recvtimeoutssl(int s, char *buf, int len, int timeout, int use_ssl, SSL *ssl);
|
2011-11-14 15:57:52 +01:00
|
|
|
|
|
|
|
void write_pid_file(char *pidfile);
|
|
|
|
int drop_privileges(struct passwd *pwd);
|
|
|
|
|
2012-01-03 00:19:43 +01:00
|
|
|
int is_email_address_on_my_domains(char *email, struct __config *cfg);
|
|
|
|
void init_session_data(struct session_data *sdata);
|
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
|
|
|
|
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
char *strcasestr(const char *s, const char *find);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _MISC_H */
|