shellinabox  2.20
About: shellinabox implements a web server that can export arbitrary command line tools to a web based terminal emulator. This emulator is accessible to any JavaScript and CSS enabled web browser. Fork of the no longer maintained original version on respectively
  Fossies Dox: shellinabox-2.20.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

ssl.c File Reference
#include "config.h"
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include "libhttp/ssl.h"
#include "libhttp/httpconnection.h"
#include "logging/logging.h"
Include dependency graph for ssl.c:

Go to the source code of this file.


#define _GNU_SOURCE
#define pthread_once   x_pthread_once
#define pthread_sigmask   x_pthread_sigmask
#define UNUSED(x)   do { (void)(x); } while (0)
#define sigwait   x_sigwait
#define NSIG   32


static void sslDestroyCachedContext (void *ssl_, char *context_)
struct SSLSupportnewSSL (void)
void initSSL (struct SSLSupport *ssl)
void destroySSL (struct SSLSupport *ssl)
void deleteSSL (struct SSLSupport *ssl)
int serverSupportsSSL (void)
void sslSetCertificate (struct SSLSupport *ssl, const char *filename, int autoGenerateMissing)
void sslSetCertificateFd (struct SSLSupport *ssl, int fd)
int sslEnable (struct SSLSupport *ssl, int enabled)
int sslForce (struct SSLSupport *ssl, int force)
void sslBlockSigPipe (void)
static void dummysignal (int signo)
static int x_sigwait (const sigset_t *set, int *sig)
int sslUnblockSigPipe (void)
int sslPromoteToSSL (struct SSLSupport *ssl, SSL **sslHndl, int fd, const char *buf, int len)
BIOsslGetNextBIO (BIO *b)
void sslFreeHndl (SSL **sslHndl)


static int dummysignalno

Macro Definition Documentation


#define _GNU_SOURCE

Definition at line 46 of file ssl.c.



Definition at line 72 of file ssl.c.


#define NSIG   32

◆ pthread_once

#define pthread_once   x_pthread_once

Definition at line 49 of file ssl.c.

◆ pthread_sigmask

#define pthread_sigmask   x_pthread_sigmask

Definition at line 50 of file ssl.c.

◆ sigwait

#define sigwait   x_sigwait

Definition at line 927 of file ssl.c.


#define UNUSED (   x)    do { (void)(x); } while (0)

Definition at line 73 of file ssl.c.

Function Documentation

◆ deleteSSL()

void deleteSSL ( struct SSLSupport ssl)

Definition at line 194 of file ssl.c.

References destroySSL().

◆ destroySSL()

void destroySSL ( struct SSLSupport ssl)

◆ dummysignal()

static void dummysignal ( int  signo)

Definition at line 923 of file ssl.c.

References dummysignalno.

Referenced by x_sigwait().

◆ initSSL()

◆ newSSL()

struct SSLSupport* newSSL ( void  )

Definition at line 162 of file ssl.c.

References check, and initSSL().

◆ serverSupportsSSL()

int serverSupportsSSL ( void  )

Definition at line 352 of file ssl.c.

References pthread_once.

Referenced by initSSL(), parseArgs(), serverSetupSSL(), setUpSSL(), sslSetCertificate(), and usage().

◆ sslBlockSigPipe()

void sslBlockSigPipe ( void  )

Definition at line 906 of file ssl.c.

References dcheck, and pthread_sigmask.

Referenced by httpHandleConnection(), httpRead(), httpShutdown(), httpWrite(), and sslPromoteToSSL().

◆ sslDestroyCachedContext()

static void sslDestroyCachedContext ( void *  ssl_,
char *  context_ 

Definition at line 149 of file ssl.c.

References check, and SSLSupport::sslContext.

Referenced by initSSL().

◆ sslEnable()

int sslEnable ( struct SSLSupport ssl,
int  enabled 

Definition at line 894 of file ssl.c.

References SSLSupport::enabled.

Referenced by serverSetupSSL().

◆ sslForce()

int sslForce ( struct SSLSupport ssl,
int  force 

Definition at line 900 of file ssl.c.

References SSLSupport::force.

Referenced by serverSetupSSL().

◆ sslFreeHndl()

void sslFreeHndl ( SSL **  sslHndl)

Definition at line 1026 of file ssl.c.

References check, dcheck, debug(), fatal(), sslGetNextBIO(), and warn().

Referenced by httpHandleConnection(), and httpShutdown().

◆ sslGetNextBIO()

BIO* sslGetNextBIO ( BIO b)

Definition at line 1018 of file ssl.c.

Referenced by sslFreeHndl().

◆ sslPromoteToSSL()

int sslPromoteToSSL ( struct SSLSupport ssl,
SSL **  sslHndl,
int  fd,
const char *  buf,
int  len 

Definition at line 985 of file ssl.c.

References check, dcheck, sslBlockSigPipe(), SSLSupport::sslContext, and sslUnblockSigPipe().

Referenced by httpPromoteToSSL().

◆ sslSetCertificate()

void sslSetCertificate ( struct SSLSupport ssl,
const char *  filename,
int  autoGenerateMissing 

◆ sslSetCertificateFd()

void sslSetCertificateFd ( struct SSLSupport ssl,
int  fd 

Definition at line 881 of file ssl.c.

References fatal(), SSLSupport::generateMissing, and SSLSupport::sslContext.

Referenced by serverSetCertificateFd().

◆ sslUnblockSigPipe()

int sslUnblockSigPipe ( void  )

Definition at line 965 of file ssl.c.

References check, dcheck, pthread_sigmask, and sigwait.

Referenced by httpHandleConnection(), httpRead(), httpShutdown(), httpWrite(), and sslPromoteToSSL().

◆ x_sigwait()

static int x_sigwait ( const sigset_t *  set,
int *  sig 

Definition at line 928 of file ssl.c.

References dcheck, dummysignal(), dummysignalno, NSIG, and pthread_sigmask.

Variable Documentation

◆ dummysignalno

int dummysignalno

Definition at line 922 of file ssl.c.

Referenced by dummysignal(), and x_sigwait().