X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fstatserv.c;h=063ac467edac705ff3404e08485db7d6508d9d49;hb=d7b75f236b92e98bff554317e123753d0549c3c3;hp=ebd0b70e1a75cf5b2f0e65fbf9e87cd7019cf087;hpb=83ac63cea12d7b176008739ac5fdafd01f628bef;p=yaz-moved-to-github.git diff --git a/src/statserv.c b/src/statserv.c index ebd0b70..063ac46 100644 --- a/src/statserv.c +++ b/src/statserv.c @@ -5,7 +5,12 @@ * NT threaded server code by * Chas Woodfield, Fretwell Downing Informatics. * - * $Id: statserv.c,v 1.5 2004-01-18 02:28:42 adam Exp $ + * $Id: statserv.c,v 1.10 2004-11-02 11:37:21 heikki Exp $ + */ + +/** + * \file statserv.c + * \brief Implements GFS logic */ #include @@ -78,7 +83,8 @@ statserv_options_block control_block = { #endif /* WIN32 */ 0, /* SOAP handlers */ "", /* PID fname */ - 0 /* background daemon */ + 0, /* background daemon */ + "" /* SSL certificate filename */ }; static int max_sessions = 0; @@ -420,8 +426,7 @@ static void listener(IOCHAN h, int event) sprintf(nbuf, "%s(%d)", me, getpid()); yaz_log_init(control_block.loglevel, nbuf, 0); /* ensure that bend_stop is not called when each child exits - - only for the main process .. - */ + only for the main process .. */ control_block.bend_stop = 0; } else /* parent */ @@ -654,9 +659,12 @@ static int add_listener(char *where, int what) l = cs_create_host(where, 2, &ap); if (!l) { - yaz_log(LOG_FATAL|LOG_ERRNO, "Failed to listen on %s", where); + yaz_log(LOG_FATAL, "Failed to listen on %s", where); return -1; } + if (*control_block.cert_fname) + cs_set_ssl_certificate_file(l, control_block.cert_fname); + if (cs_bind(l, ap, CS_SERVER) < 0) { yaz_log(LOG_FATAL|LOG_ERRNO, "Failed to bind to %s", where); @@ -833,7 +841,8 @@ int check_options(int argc, char **argv) int ret = 0, r; char *arg; - while ((ret = options("1a:iszSTl:v:u:c:w:t:k:d:A:p:D", argv, argc, &arg)) != -2) + while ((ret = options("1a:iszSTl:v:u:c:w:t:k:d:A:p:DC:", + argv, argc, &arg)) != -2) { switch (ret) { @@ -884,6 +893,9 @@ int check_options(int argc, char **argv) case 'c': strcpy(control_block.configname, arg ? arg : ""); break; + case 'C': + strcpy(control_block.cert_fname, arg ? arg : ""); + break; case 'd': strcpy(control_block.daemon_name, arg ? arg : ""); break; @@ -930,7 +942,7 @@ int check_options(int argc, char **argv) default: fprintf(stderr, "Usage: %s [ -a -v " " -l -u -c -t " - " -k -d -p " + " -k -d -p -C certfile" " -ziDST1 -w ... ]\n", me); return 1; }