Copyright (C) 1999, 2000 Daiki Ueno <ueno@unixuser.org>
Author: Daiki Ueno <ueno@unixuser.org>
- Kenichi OKADA <okada@opaopa.org>
Created: 1999-11-19
Keywords: TLS, OpenSSL
#endif
#ifndef HAVE_GETADDRINFO
-#include "getaddrinfo.h"
+#include "addrinfo.h"
#endif /* !HAVE_GETADDRINFO */
#include <sys/time.h>
#define _GNU_SOURCE
#include <getopt.h>
-#ifdef HAVE_BASENAME
-# ifdef HAVE_LIBGEN_H
-# include <libgen.h>
-# ifdef basename
-# undef basename
-# endif
-# endif
-# include <string.h>
-#else
-inline char *
-basename(path)
- const char *path;
-{
- char *p = rindex((path), '/');
- return p ? p + 1 : (path);
-}
-#endif
-
-#define true 1
-
static SSL_CTX *tls_ctx = NULL;
static SSL *tls_conn = NULL;
static int tls_fd;
static char *opt_cert_file = NULL, *opt_key_file = NULL;
static int opt_verify = 0;
-static int opt_force;
static int
tls_ssl_ctx_new (cert_file, key_file)
"Options:\n\n"
" --cert-file [file] specify certificate file\n"
" --key-file [file] specify private key file\n"
- " --verify [level] set verification level\n"
- " --force force negotiate\n",
+ " --verify [level] set verification level\n",
progname, PACKAGE, VERSION, progname);
}
{"cert-file", 1, 0, 'c'},
{"key-file", 1, 0, 'k'},
{"verify", 1, 0, 'v'},
- {"force", 0, 0, 'f'},
{0, 0, 0, 0}
};
case 'v':
opt_verify = atoi (optarg);
break;
- case 'f':
- opt_force = true;
- break;
default:
usage (basename (argv[0]));
return 1;
act.sa_flags = SA_RESTART|SA_RESETHAND;
sigaction (SIGALRM, &act, NULL);
- if (opt_force == true)
- tls_negotiate();
-
while (1)
{
FD_SET (tls_fd, &readfds);