diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 11:44:11 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 11:44:11 +0200 |
commit | f1b71c9fe7dbb4886588a036399cf5ebe16b7c47 (patch) | |
tree | e07786aa479c9fb6ee3e537078470aaab5454f80 /sqmail-4.3.07/src/tls_start.c | |
parent | a293489ee83c8b05d845a162dc2a4de026f3775d (diff) |
removed top level directory
Diffstat (limited to 'sqmail-4.3.07/src/tls_start.c')
-rw-r--r-- | sqmail-4.3.07/src/tls_start.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/sqmail-4.3.07/src/tls_start.c b/sqmail-4.3.07/src/tls_start.c deleted file mode 100644 index a632f94..0000000 --- a/sqmail-4.3.07/src/tls_start.c +++ /dev/null @@ -1,82 +0,0 @@ -#include <unistd.h> -#include "scan.h" -#include "env.h" -#include "open.h" -#include "stralloc.h" -#include "fd.h" -#include "logmsg.h" -#include "qmail.h" - -#define WHO "tls_start" - -static void die_nomem() { logmsg(WHO,111,FATAL,"out of memory"); } - -int starttls_init(void) -{ - unsigned long fd; - char *fdstr; - - if (!(fdstr = env_get("SSLCTLFD"))) return 0; - if (!scan_ulong(fdstr,&fd)) return 0; - if (write((int)fd,"Y",1) < 1) return 0; - - if (!(fdstr = env_get("SSLREADFD"))) return 0; - if (!scan_ulong(fdstr,&fd)) return 0; - if (fd_move(0,(int)fd) == -1) return 0; - - if (!(fdstr = env_get("SSLWRITEFD"))) return 0; - if (!scan_ulong(fdstr,&fd)) return 0; - if (fd_move(1,(int)fd) == -1) return 0; - - return 1; -} - -int starttls_info(void) -{ - unsigned long fd; - char *fdstr; - char envbuf[BUFSIZE_MESS]; - char *x; - int j; - - stralloc ssl_env = {0}; - stralloc ssl_parm = {0}; - stralloc ssl_value = {0}; - - if (!(fdstr = env_get("SSLCTLFD"))) return 0; - if (!scan_ulong(fdstr,&fd)) return 0; - - while ((j = read(fd,envbuf,BUFSIZE_MESS)) > 0 ) { - if (!stralloc_catb(&ssl_env,envbuf,j)) die_nomem(); - if (ssl_env.len >= 2 && ssl_env.s[ssl_env.len - 2] == 0 && ssl_env.s[ssl_env.len - 1] == 0) - break; - } - if (j <= 0) return 0; // nothing to read; really nothing - - x = ssl_env.s; - - for (j = 0; j < ssl_env.len - 1; ++j) { - if ( *x != '=' ) { - if (!stralloc_catb(&ssl_parm,x,1)) die_nomem(); - x++; - } else { - if (!stralloc_0(&ssl_parm)) die_nomem(); - x++; - - for (; j < ssl_env.len - j - 1; ++j) { - if ( *x != '\0' ) { - if (!stralloc_catb(&ssl_value,x,1)) die_nomem(); - x++; - } else { - if (!stralloc_0(&ssl_value)) die_nomem(); - x++; - if (!env_put(ssl_parm.s,ssl_value.s)) die_nomem(); - ssl_parm.len = 0; - ssl_value.len = 0; - break; - } - } - } - } - return j; -} |