diff options
Diffstat (limited to 'src/headers.h')
-rw-r--r-- | src/headers.h | 111 |
1 files changed, 94 insertions, 17 deletions
diff --git a/src/headers.h b/src/headers.h index 55665e2..a97345d 100644 --- a/src/headers.h +++ b/src/headers.h @@ -1,11 +1,11 @@ /* headers.h This file is part of GNU Anubis. - Copyright (C) 2001-2014 The Anubis Team. + Copyright (C) 2001-2024 The Anubis Team. GNU Anubis is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. @@ -130,19 +130,28 @@ #define N_(String) String #ifdef WITH_GUILE # include <libguile.h> #endif /* WITH_GUILE */ -#include "xalloc.h" -#include <argcv.h> +#ifdef HAVE_SYSEXITS_H +# include <sysexits.h> +#else +# define EX_OK 0 +# define EX_USAGE 64 +# define EX_UNAVAILABLE 69 +# define EX_SOFTWARE 70 +# define EX_TEMPFAIL 75 +# define EX_PROTOCOL 76 +# define EX_CONFIG 78 +#endif + #include <keyword.h> #include "list.h" #include "smtprepl.h" - -#include <sysexits.h> +#include <wordsplit/wordsplit.h> #ifndef INADDR_NONE # define INADDR_NONE (unsigned long)0xffffffff #endif /* not INADDR_NONE */ #ifndef INADDR_ANY # define INADDR_ANY (unsigned long)0x00000000 @@ -236,12 +245,13 @@ ANUBIS_MODE; #define T_SMTP_ERROR_CODES 0x02000000 #define T_TRACEFILE_SYS 0x04000000 #define T_TRACEFILE_USR 0x08000000 #define T_XELO 0x10000000 #define T_LOCATION_COLUMN 0x20000000 #define T_ESMTP_AUTH_DELAYED 0x40000000 +#define T_PASSFD 0x80000000 /* Regexp modifiers */ /* Basic types */ #define R_EXACT 0x00000001 #define R_POSIX 0x00000002 #define R_PERLRE 0x00000004 @@ -493,14 +503,14 @@ void eval_warning (EVAL_ENV env, const char *fmt, ...) void rc_disable_keyword (int mask, const char *kw); /* help.c */ void print_config_options (void); /* quit.c */ -RETSIGTYPE sig_exit (int); -RETSIGTYPE sig_timeout (int); +void sig_exit (int); +void sig_timeout (int); void free_mem (void); void quit (int); /* socks.c */ #ifdef USE_SOCKS_PROXY int check_socks_proxy (int, char *, unsigned int); @@ -521,15 +531,14 @@ void gpg_section_init (void); /* guile.c */ #ifdef WITH_GUILE void init_guile (void); void guile_debug (int); void guile_section_init (void); -void guile_init_anubis_error_port (void); +void guile_init_anubis_log_port (void); SCM guile_make_anubis_error_port (int err); -void guile_init_anubis_info_port (void); SCM guile_make_anubis_info_port (void); #endif /* WITH_GUILE */ /* url.c */ typedef struct anubis_url @@ -601,13 +610,13 @@ const char *anubis_db_strerror (void *dptr); void anubis_db_free_record (ANUBIS_USER * rec); /* dbtext.c */ void dbtext_init (void); /* gdbm.c */ -void gdbm_db_init (void); +void db_gdbm_init (void); /* mysql.c */ void mysql_db_init (void); /* pgsql.c */ void pgsql_db_init (void); @@ -638,19 +647,87 @@ ANUBIS_LIST auth_method_list (const char *input); void anubis_set_mech_list (ANUBIS_LIST *out, ANUBIS_LIST list); void anubis_set_server_mech_list (ANUBIS_LIST list); /* xdatabase.c */ int xdatabase (char *command); void xdatabase_capability (ANUBIS_SMTP_REPLY reply); -void xdatabase_enable (void); -/* md5.c */ -int anubis_md5_file (unsigned char *digest, int fd); -void string_bin_to_hex (unsigned char *output, unsigned char *input, int inlen); -int string_hex_to_bin (unsigned char *output, unsigned char *input, int inlen); - -#define MD5_DIGEST_BYTES 16 +/* md5sum.c */ +int anubis_md5_file (int fd, unsigned char **out_digest, char const **err); /* mda.c */ void mda (void); +void argv_free (char **argv); +char *argv_string (char **argv); + +#ifdef USE_GCRYPT +char *idecrypt_username (char const *text, size_t len); +#else +static inline char *idecrypt_username (char const *text, size_t len) { return NULL; } +#endif + +/* getpass.c */ +int anubis_getpass (char const *prompt, char **pass); + +/* mem.c */ +void xnomem (void); +void *mem2nrealloc (void *p, size_t *pn, size_t s); +void *xmalloc (size_t s); +void *xcalloc (size_t nmemb, size_t size); +static inline void *xzalloc (size_t size) { return xcalloc (1, size); } +void *xrealloc (void *p, size_t s); +void *x2nrealloc (void *p, size_t *pn, size_t s); +static inline void *x2realloc (void *p, size_t *pn) { + return x2nrealloc (p, pn, 1); +} +char *xstrdup (char const *s); +char *xstrndup (const char *s, size_t n); +ssize_t xgetline (char **pbuf, size_t *psize, FILE *fp); + +struct stringbuf +{ + char *base; /* Buffer storage. */ + size_t size; /* Size of buf. */ + size_t len; /* Actually used length in buf. */ + void (*nomem) (void); /* Out of memory handler. */ + int err; /* Error indicator */ +}; + +#define STRINGBUF_INITIALIZER { NULL, 0, 0, xnomem, 0 } + +void stringbuf_init (struct stringbuf *sb, void (*nomem) (void)); +void stringbuf_reset (struct stringbuf *sb); +char *stringbuf_finish (struct stringbuf *sb); +void stringbuf_free (struct stringbuf *sb); +int stringbuf_add (struct stringbuf *sb, char const *str, size_t len); +int stringbuf_add_char (struct stringbuf *sb, int c); +int stringbuf_add_string (struct stringbuf *sb, char const *str); +int stringbuf_vprintf (struct stringbuf *sb, char const *fmt, va_list ap); +int stringbuf_printf (struct stringbuf *sb, char const *fmt, ...) + ANUBIS_PRINTFLIKE(2,3); +char *stringbuf_set (struct stringbuf *sb, int c, size_t n); +int stringbuf_strftime (struct stringbuf *sb, char const *fmt, + const struct tm *tm); + +static inline int +stringbuf_err (struct stringbuf *sb) +{ + return sb->err; +} + +static inline char *stringbuf_value (struct stringbuf *sb) +{ + return sb->base; +} + +static inline size_t stringbuf_len (struct stringbuf *sb) +{ + return sb->len; +} + +static inline void xstringbuf_init (struct stringbuf *sb) +{ + stringbuf_init (sb, xnomem); +} + /* EOF */ |