summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/commands.h8
-rw-r--r--src/include/constmap.h8
-rw-r--r--src/include/datetime.h4
-rw-r--r--src/include/headerbody.h5
-rw-r--r--src/include/hfield.h8
-rw-r--r--src/include/hier.h12
-rw-r--r--src/include/ipalloc.h5
-rw-r--r--src/include/ipme.h8
-rw-r--r--src/include/meson.build61
-rw-r--r--src/include/newfield.h6
-rw-r--r--src/include/now.h2
-rw-r--r--src/include/prioq.h6
-rw-r--r--src/include/prot.h4
-rw-r--r--src/include/qsutil.h1
-rw-r--r--src/include/rcpthosts.h4
-rw-r--r--src/include/readsubdir.h8
-rw-r--r--src/include/recipients.h6
-rw-r--r--src/include/smtpdlog.h7
-rw-r--r--src/include/spawn.h12
-rw-r--r--src/include/srs2.h2
-rw-r--r--src/include/tcpto.h16
-rw-r--r--src/include/tls_errors.h8
-rw-r--r--src/include/tls_timeoutio.h13
-rw-r--r--src/include/token822.h39
-rw-r--r--src/include/trigger.h10
-rw-r--r--src/include/triggerpull.h6
26 files changed, 174 insertions, 95 deletions
diff --git a/src/include/commands.h b/src/include/commands.h
index fed35e7..ea15add 100644
--- a/src/include/commands.h
+++ b/src/include/commands.h
@@ -1,12 +1,14 @@
#ifndef COMMANDS_H
#define COMMANDS_H
+#include "buffer.h"
+
struct commands {
char *text;
- void (*fun)();
- void (*flush)();
+ void (*fun)(char *);
+ void (*flush)(void);
};
-int commands();
+extern int commands(buffer *, struct commands *);
#endif
diff --git a/src/include/constmap.h b/src/include/constmap.h
index 0a43e98..4e33dd1 100644
--- a/src/include/constmap.h
+++ b/src/include/constmap.h
@@ -13,9 +13,9 @@ struct constmap {
int *inputlen;
};
-int constmap_init(struct constmap *, char *, int, int);
-int constmap_init_char(struct constmap *, char *, int, int, char);
-void constmap_free();
-char *constmap();
+extern int constmap_init(struct constmap *, char *, int, int);
+extern int constmap_init_char(struct constmap *, char *, int, int, char);
+extern void constmap_free(struct constmap *cm);
+extern char *constmap(struct constmap *cm, char *s, int len);
#endif
diff --git a/src/include/datetime.h b/src/include/datetime.h
index eb8abc6..0f71755 100644
--- a/src/include/datetime.h
+++ b/src/include/datetime.h
@@ -14,7 +14,7 @@ struct datetime {
typedef long datetime_sec;
-void datetime_tai();
-datetime_sec datetime_untai();
+extern void datetime_tai(struct datetime *dt, datetime_sec t);
+extern datetime_sec datetime_untai(struct datetime *dt);
#endif
diff --git a/src/include/headerbody.h b/src/include/headerbody.h
index a074981..eec505f 100644
--- a/src/include/headerbody.h
+++ b/src/include/headerbody.h
@@ -1,6 +1,9 @@
#ifndef HEADERBODY_H
#define HEADERBODY_H
-int headerbody();
+#include "buffer.h"
+#include "stralloc.h"
+
+extern int headerbody(buffer *b, void (*dohf)(stralloc *), void (*hdone)(void), void (*dobl)(stralloc *));
#endif
diff --git a/src/include/hfield.h b/src/include/hfield.h
index f2110b5..1415683 100644
--- a/src/include/hfield.h
+++ b/src/include/hfield.h
@@ -1,10 +1,6 @@
#ifndef HFIELD_H
#define HFIELD_H
-unsigned int hfield_skipname();
-int hfield_known();
-int hfield_valid();
-
#define H_SENDER 1
#define H_FROM 2
#define H_REPLYTO 3
@@ -35,4 +31,8 @@ int hfield_valid();
#define H_MAILFOLLOWUPTO 28
#define H_NUM 29
+extern unsigned int hfield_skipname(char *s, int len);
+extern int hfield_known(char *s, int len);
+extern int hfield_valid(char *s, int len);
+
#endif
diff --git a/src/include/hier.h b/src/include/hier.h
index 21413cc..0c04c4b 100644
--- a/src/include/hier.h
+++ b/src/include/hier.h
@@ -1,10 +1,12 @@
#ifndef HIER_H
#define HIER_H
-void c(char *, char *, char *, int, int, int);
-void h(char *, int, int, int);
-void d(char *, char *, int, int, int);
-void p(char *, char *, int, int, int);
-void z(char *, char *, int, int, int, int);
+extern void c(const char *, char *, char *, int, int, int);
+extern void h(const char *, int, int, int);
+extern void d(const char *, char *, int, int, int);
+extern void p(const char *, char *, int, int, int);
+extern void z(const char *, char *, int, int, int, int);
+
+extern void hier(void);
#endif
diff --git a/src/include/ipalloc.h b/src/include/ipalloc.h
index cec29a9..8100c11 100644
--- a/src/include/ipalloc.h
+++ b/src/include/ipalloc.h
@@ -3,6 +3,7 @@
#include "genalloc.h"
#include "ip.h"
+
#define NAME_LEN 256
struct ip_mx {
@@ -16,7 +17,7 @@ struct ip_mx {
};
GEN_ALLOC_typedef(ipalloc, struct ip_mx, ix, len, a);
-int ipalloc_readyplus();
-int ipalloc_append();
+GEN_ALLOC_readyplus(ipalloc, struct ip_mx, ix, len, a, i, n, x, 22, ipalloc_readyplus);
+GEN_ALLOC_append(ipalloc, struct ip_mx, ix, len, a, i, n, x, 22, ipalloc_readyplus, ipalloc_append);
#endif
diff --git a/src/include/ipme.h b/src/include/ipme.h
index f9dff4e..d559dd8 100644
--- a/src/include/ipme.h
+++ b/src/include/ipme.h
@@ -7,9 +7,9 @@
extern ipalloc ipme;
-int ipme_init();
-int ipme_is4();
-int ipme_is6();
-int ipme_is();
+extern int ipme_init(void);
+extern int ipme_is4(struct ip4_address *);
+extern int ipme_is6(struct ip6_address *);
+extern int ipme_is(struct ip_mx *);
#endif
diff --git a/src/include/meson.build b/src/include/meson.build
index 3677692..ca8c752 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -1,3 +1,58 @@
+config = configuration_data()
+cc = meson.get_compiler('c')
+
+if cc.has_member('struct sockaddr', 'sa_len', prefix : '#include <sys/socket.h>')
+ config.set('HASSALEN', true)
+endif
+
+if cc.has_function('getspnam', prefix : '#include <shadow.h>')
+ config.set('HASGETSPNAM', true)
+elif cc.has_function('getuserpw', prefix : '#include <userpw.h>')
+ config.set('HASGETUSERPW', true)
+endif
+
+if cc.has_function('mkfifo', prefix : '#include <sys/stat.h>')
+ config.set('HASMKFIFO', true)
+endif
+
+if cc.has_header('utmp.h')
+ config.set('HASUTMP', true)
+endif
+
+if idn2_dep.found()
+ config.set('IDN2', true)
+endif
+
+auto_qmail = run_command('head', '-n1',
+ meson.project_source_root() / 'conf-home', check : true).stdout().strip()
+config.set('auto_qmail', auto_qmail)
+
+config.set('auto_usera', 'alias')
+
+config.set('auto_split', get_option('split'))
+config.set('auto_patrn', get_option('patrn'))
+config.set('auto_spawn', get_option('spawn'))
+
+user_groups = [
+ 'alias', 'qmaild', 'qmaill', 'qmailp', 'qmailq', 'qmailr', 'qmails',
+ 'sqmail', 'nofiles',
+]
+
+foreach id : user_groups
+ config.set(id, get_option(id))
+endforeach
+
+sqmail_hdrs_subdir = 'sqmail'
+
+configure_file(
+ configuration : config,
+ input : 'fehsqm-config.h.in',
+ output : 'fehsqm-config.h',
+ install_dir : get_option('includedir') / sqmail_hdrs_subdir,
+ install_tag : 'devel')
+
+add_project_arguments('-DUSE_CONFIG', language : 'c')
+
sqmail_hdrs = [
'base64.h',
'commands.h',
@@ -42,6 +97,7 @@ sqmail_hdrs = [
'sha1.h',
'sha256.h',
'smtpdlog.h',
+ 'spawn.h',
'spf.h',
'srs2.h',
'strset.h',
@@ -52,10 +108,9 @@ sqmail_hdrs = [
'tls_timeoutio.h',
'token822.h',
'trigger.h',
- 'triggerpull.h',
'wildmat.h',
]
-sqmail_hdrs_subdir = 'sqmail'
-
install_headers(sqmail_hdrs, subdir : sqmail_hdrs_subdir)
+
+inc = include_directories('.')
diff --git a/src/include/newfield.h b/src/include/newfield.h
index 049fb5e..8cfed4c 100644
--- a/src/include/newfield.h
+++ b/src/include/newfield.h
@@ -3,10 +3,12 @@
#include "stralloc.h"
+#include "datetime.h"
+
extern stralloc newfield_date;
-int newfield_datemake();
+extern int newfield_datemake(datetime_sec when);
extern stralloc newfield_msgid;
-int newfield_msgidmake();
+extern int newfield_msgidmake(char *idhost, int idhostlen, datetime_sec when);
#endif
diff --git a/src/include/now.h b/src/include/now.h
index 1379d76..06b2f38 100644
--- a/src/include/now.h
+++ b/src/include/now.h
@@ -3,6 +3,6 @@
#include "datetime.h"
-datetime_sec now();
+extern datetime_sec now(void);
#endif
diff --git a/src/include/prioq.h b/src/include/prioq.h
index 31c99ac..db61b59 100644
--- a/src/include/prioq.h
+++ b/src/include/prioq.h
@@ -12,8 +12,8 @@ struct prioq_elt {
GEN_ALLOC_typedef(prioq, struct prioq_elt, p, len, a);
-int prioq_insert();
-int prioq_min();
-void prioq_delmin();
+extern int prioq_insert(prioq *pq, struct prioq_elt *pe);
+extern int prioq_min(prioq *pq, struct prioq_elt *pe);
+extern void prioq_delmin(prioq *pq);
#endif
diff --git a/src/include/prot.h b/src/include/prot.h
index 08203da..7dd0503 100644
--- a/src/include/prot.h
+++ b/src/include/prot.h
@@ -1,7 +1,7 @@
#ifndef PROT_H
#define PROT_H
-int prot_gid();
-int prot_uid();
+extern int prot_gid(int);
+extern int prot_uid(int);
#endif
diff --git a/src/include/qsutil.h b/src/include/qsutil.h
index 7ef8ec1..0d5eca1 100644
--- a/src/include/qsutil.h
+++ b/src/include/qsutil.h
@@ -9,7 +9,6 @@ void log3s(char *, char *, char *);
void log4s(char *, char *, char *, char *);
void log5s(char *, char *, char *, char *, char *);
void logsa(stralloc *);
-void nomem();
void pausedir(char *);
void logsafe(char *);
int issafe(char);
diff --git a/src/include/rcpthosts.h b/src/include/rcpthosts.h
index 0c58797..791df47 100644
--- a/src/include/rcpthosts.h
+++ b/src/include/rcpthosts.h
@@ -1,7 +1,7 @@
#ifndef RCPTHOSTS_H
#define RCPTHOSTS_H
-int rcpthosts_init();
-int rcpthosts();
+extern int rcpthosts_init(void);
+extern int rcpthosts(char *, int);
#endif
diff --git a/src/include/readsubdir.h b/src/include/readsubdir.h
index 3910693..fc816f4 100644
--- a/src/include/readsubdir.h
+++ b/src/include/readsubdir.h
@@ -1,17 +1,17 @@
#ifndef READSUBDIR_H
#define READSUBDIR_H
-#include "direntry.h"
+#include <dirent.h>
typedef struct readsubdir {
DIR *dir;
int pos;
char *name;
- void (*pause)();
+ void (*pause)(char *);
} readsubdir;
-void readsubdir_init();
-int readsubdir_next();
+extern void readsubdir_init(readsubdir *rs, char *name, void (*pause)(char *));
+extern int readsubdir_next(readsubdir *rs, unsigned long *id);
#define READSUBDIR_NAMELEN 10
diff --git a/src/include/recipients.h b/src/include/recipients.h
index 34542d5..2fabd26 100644
--- a/src/include/recipients.h
+++ b/src/include/recipients.h
@@ -3,8 +3,8 @@
#include <sys/types.h>
-int recipients_init(void);
-int recipients(char *, int);
-ssize_t safewrite();
+extern int recipients_init(void);
+extern int recipients(char *, int);
+extern ssize_t safewrite(int, char *, int);
#endif
diff --git a/src/include/smtpdlog.h b/src/include/smtpdlog.h
index 9b305c5..d0ec06a 100644
--- a/src/include/smtpdlog.h
+++ b/src/include/smtpdlog.h
@@ -1,9 +1,10 @@
#ifndef SMTPDLOG_H
#define SMTPDLOG_H
-#define FDLOG 2
-void flush();
-void out();
+// #define FDLOG 2
+
+void flush(void);
+void out(char *);
void smtpdlog_init(void);
void smtp_loga(char *, char *, char *, char *, char *, char *, char *, char *, char *);
diff --git a/src/include/spawn.h b/src/include/spawn.h
new file mode 100644
index 0000000..93b6e69
--- /dev/null
+++ b/src/include/spawn.h
@@ -0,0 +1,12 @@
+#ifndef SPAWN_H_INCLUDE
+#define SPAWN_H_INCLUDE
+
+#include "buffer.h"
+
+extern int truncreport;
+
+extern int spawn(int fdmess, int fdout, const char *s, char *r, const int at);
+extern void report(buffer *log, int wstat, char *s, int len);
+extern void initialize(int argc, char **argv);
+
+#endif
diff --git a/src/include/srs2.h b/src/include/srs2.h
index 9856636..928573a 100644
--- a/src/include/srs2.h
+++ b/src/include/srs2.h
@@ -95,7 +95,7 @@ typedef struct _srs_t {
/* Interface */
int srs_set_malloc(srs_malloc_t m, srs_realloc_t r, srs_free_t f);
-srs_t *srs_new();
+srs_t *srs_new(void);
void srs_init(srs_t *);
void srs_free(srs_t *);
int srs_forward(srs_t *, char *, int, const char *, const char *);
diff --git a/src/include/tcpto.h b/src/include/tcpto.h
index 678d12a..010dd1b 100644
--- a/src/include/tcpto.h
+++ b/src/include/tcpto.h
@@ -1,25 +1,27 @@
#ifndef TCPTO_H
#define TCPTO_H
+#include "ipalloc.h"
+
#define TCPTO_BUFSIZ 1024
-/* persistency structure: record
-struct tcpto {
+/* persistency structure: record
+struct tcpto {
unsigned char af; -- 1 byte -- IPv4: x'2' / IPv6: x'a' (10)
unsigned char nul[3]; -- 3 byte
unsigned char errorcount -- 1 byte -- if err_timeout || err_conrefused || err_proto (TLS)
unsigned char nul[3]; -- 3 byte
- unsigned long when; -- 8 byte
+ unsigned long when; -- 8 byte
union {
struct ip_address ip;
struct ip6_address ip6;
unsigned char nul[16]; -- 16 byte -- IPv4: filled up with '.' = x'2e'
- } addr;
+ } addr;
}; total: 32 byte
*/
-int tcpto();
-void tcpto_err();
-void tcpto_clean();
+int tcpto(struct ip_mx *);
+void tcpto_err(struct ip_mx *ix, int flagerr);
+void tcpto_clean(void);
#endif
diff --git a/src/include/tls_errors.h b/src/include/tls_errors.h
index a61e8fd..31f105c 100644
--- a/src/include/tls_errors.h
+++ b/src/include/tls_errors.h
@@ -3,10 +3,10 @@
#include "stralloc.h"
-extern void temp_tlscon();
-extern void temp_tlspeercert();
-extern void temp_tlspeervalid();
-extern void temp_tlspeerverify();
+extern void temp_tlscon(void);
+extern void temp_tlspeercert(void);
+extern void temp_tlspeervalid(void);
+extern void temp_tlspeerverify(void);
extern stralloc host;
extern stralloc remotehost;
diff --git a/src/include/tls_timeoutio.h b/src/include/tls_timeoutio.h
index 175757e..fe3cd86 100644
--- a/src/include/tls_timeoutio.h
+++ b/src/include/tls_timeoutio.h
@@ -3,13 +3,14 @@
#include <openssl/ssl.h>
-int tls_timeoutconn(int t, int rfd, int wfd, SSL *tls);
-int tls_timeoutaccept(int t, int rfd, int wfd, SSL *tls);
-int tsl_timeoutrehandshake(int t, int rfd, int wfd, SSL *tls);
+extern int tls_timeoutconn(int t, int rfd, int wfd, SSL *tls);
+extern int tls_timeoutaccept(int t, int rfd, int wfd, SSL *tls);
+extern int tls_timeoutrehandshake(int t, int rfd, int wfd, SSL *tls);
-int tls_timeoutread(int t, int rfd, int wfd, SSL *tls, char *buf, int len);
-int tls_timeoutwrite(int t, int rfd, int wfd, SSL *tls, char *buf, int len);
+extern int tls_timeoutread(int t, int rfd, int wfd, SSL *tls, char *buf, int len);
+extern int tls_timeoutwrite(int t, int rfd, int wfd, SSL *tls, char *buf, int len);
-int tls_timeoutio(int (*fun)(), int t, int rfd, int wfd, SSL *tls, char *buf, int len);
+extern int tls_timeoutio(
+ int (*fun)(SSL *, void *, int), int t, int rfd, int wfd, SSL *tls, char *buf, int len);
#endif
diff --git a/src/include/token822.h b/src/include/token822.h
index 73ef0be..565cf5b 100644
--- a/src/include/token822.h
+++ b/src/include/token822.h
@@ -2,24 +2,7 @@
#define TOKEN822_H
#include "genalloc.h"
-
-struct token822 {
- int type;
- char *s;
- int slen;
-};
-
-GEN_ALLOC_typedef(token822_alloc, struct token822, t, len, a);
-
-int token822_parse();
-int token822_addrlist();
-int token822_unquote();
-int token822_unparse();
-void token822_free();
-void token822_reverse();
-int token822_ready();
-int token822_readyplus();
-int token822_append();
+#include "stralloc.h"
#define TOKEN822_ATOM 1
#define TOKEN822_QUOTE 2
@@ -33,4 +16,24 @@ int token822_append();
#define TOKEN822_COLON 10
#define TOKEN822_DOT 11
+struct token822 {
+ int type;
+ char *s;
+ int slen;
+};
+
+GEN_ALLOC_typedef(token822_alloc, struct token822, t, len, a);
+GEN_ALLOC_ready(token822_alloc, struct token822, t, len, a, i, n, x, 30, token822_ready);
+GEN_ALLOC_readyplus(token822_alloc, struct token822, t, len, a, i, n, x, 30, token822_readyplus);
+GEN_ALLOC_append(
+ token822_alloc, struct token822, t, len, a, i, n, x, 30, token822_readyplus, token822_append);
+
+int token822_parse(token822_alloc *, stralloc *, stralloc *);
+int token822_addrlist(
+ token822_alloc *taout, token822_alloc *taaddr, token822_alloc *ta, int (*callback)());
+int token822_unquote(stralloc *, token822_alloc *);
+int token822_unparse(stralloc *, token822_alloc *, unsigned int);
+void token822_free();
+void token822_reverse(token822_alloc *);
+
#endif
diff --git a/src/include/trigger.h b/src/include/trigger.h
index d0f4a3e..01bd4c4 100644
--- a/src/include/trigger.h
+++ b/src/include/trigger.h
@@ -1,9 +1,11 @@
#ifndef TRIGGER_H
#define TRIGGER_H
-extern void trigger_set();
-extern void trigger_selprep();
-extern int trigger_pulled();
-extern void triggerpull();
+#include "select.h"
+
+extern void trigger_set(void);
+extern void trigger_selprep(int *nfds, fd_set *rfds);
+extern int trigger_pulled(fd_set *rfds);
+extern void triggerpull(void);
#endif
diff --git a/src/include/triggerpull.h b/src/include/triggerpull.h
deleted file mode 100644
index 188f4f2..0000000
--- a/src/include/triggerpull.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef TRIGGERPULL_H
-#define TRIGGERPULL_H
-
-void triggerpull(void);
-
-#endif