#ifndef NOPROTO
static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int export,int keylength);
-static int sv_body(char *hostname, int s);
-static int www_body(char *hostname, int s);
+static int sv_body(char *hostname, int s, char *context);
+static int www_body(char *hostname, int s, char *context);
static void close_accept_socket(void );
static void sv_usage(void);
static int init_ssl_connection(SSL *s);
BIO_printf(bio_err,"usage: s_server [args ...]\n");
BIO_printf(bio_err,"\n");
BIO_printf(bio_err," -accept arg - port to accept on (default is %d)\n",PORT);
+ BIO_printf(bio_err," -context arg - set session ID context\n");
BIO_printf(bio_err," -verify arg - turn on peer certificate verification\n");
BIO_printf(bio_err," -Verify arg - turn on peer certificate verification, must have a cert.\n");
BIO_printf(bio_err," -cert arg - certificate file to use, PEM format assumed\n");
{
short port=PORT;
char *CApath=NULL,*CAfile=NULL;
+ char *context = NULL;
int badop=0,bugs=0;
int ret=1;
int off=0;
verify_depth=atoi(*(++argv));
BIO_printf(bio_err,"verify depth is %d, must return a certificate\n",verify_depth);
}
+ else if (strcmp(*argv,"-context") == 0)
+ {
+ if (--argc < 1) goto bad;
+ context= *(++argv);
+ }
else if (strcmp(*argv,"-cert") == 0)
{
if (--argc < 1) goto bad;
BIO_printf(bio_s_out,"ACCEPT\n");
if (www)
- do_server(port,&accept_socket,www_body);
+ do_server(port,&accept_socket,www_body, context);
else
- do_server(port,&accept_socket,sv_body);
+ do_server(port,&accept_socket,sv_body, context);
print_stats(bio_s_out,ctx);
ret=0;
end:
SSL_CTX_sess_get_cache_size(ssl_ctx));
}
-static int sv_body(hostname, s)
+static int sv_body(hostname, s, context)
char *hostname;
int s;
+char *context;
{
char *buf=NULL;
fd_set readfds;
}
#endif
- if (con == NULL)
+ if (con == NULL) {
con=(SSL *)SSL_new(ctx);
+ if(context)
+ SSL_set_session_id_context(con, context, strlen(context));
+ }
SSL_clear(con);
sbio=BIO_new_socket(s,BIO_NOCLOSE);
SSL *con;
{
int i;
- char *str;
+ const char *str;
X509 *peer;
long verify_error;
MS_STATIC char buf[BUFSIZ];
}
#endif
-static int www_body(hostname, s)
+static int www_body(hostname, s, context)
char *hostname;
int s;
+char *context;
{
char *buf=NULL;
int ret=1;
if (!BIO_set_write_buffer_size(io,bufsize)) goto err;
if ((con=(SSL *)SSL_new(ctx)) == NULL) goto err;
+ if(context) SSL_set_session_id_context(con, context, strlen(context));
sbio=BIO_new_socket(s,BIO_NOCLOSE);
if (s_nbio_test)
{
char *p;
X509 *peer;
- STACK *sk;
+ STACK_OF(SSL_CIPHER) *sk;
static char *space=" ";
BIO_puts(io,"HTTP/1.0 200 ok\r\nContent-type: text/html\r\n\r\n");
* be done */
BIO_printf(io,"Ciphers supported in s_server binary\n");
sk=SSL_get_ciphers(con);
- j=sk_num(sk);
+ j=sk_SSL_CIPHER_num(sk);
for (i=0; i<j; i++)
{
- c=(SSL_CIPHER *)sk_value(sk,i);
+ c=sk_SSL_CIPHER_value(sk,i);
BIO_printf(io,"%-11s:%-25s",
SSL_CIPHER_get_version(c),
SSL_CIPHER_get_name(c));