Thus allowing a SSL/HTTPS server role.
void idleTime(int timeout);
void close_session();
const char *getpeername();
+ void set_cert_fname(const char *fname);
};
class YAZ_EXPORT PDU_AssocThread : public PDU_Assoc {
char *arg;
char *prog = *argv;
const char *addr = "tcp:@:9999";
+ const char *cert_fname = 0;
char *apdu_log = 0;
SocketManager mySocketManager;
MyServer *z = 0;
int ret;
- while ((ret = options("a:v:T", argv, argc, &arg)) != -2)
+ while ((ret = options("a:C:v:T", argv, argc, &arg)) != -2)
{
switch (ret)
{
case 'a':
apdu_log = xstrdup(arg);
break;
+ case 'C':
+ cert_fname = xstrdup(arg);
+ break;
case 'v':
yaz_log_init_level (yaz_log_mask_str(arg));
break;
my_PDU_Assoc = new PDU_Assoc(&mySocketManager);
#endif
+ my_PDU_Assoc->set_cert_fname(cert_fname);
+
z = new MyServer(my_PDU_Assoc);
z->server(addr);
if (apdu_log)
void init(yazpp_1::ISocketObservable *socketObservable);
COMSTACK comstack(const char *type_and_host, void **vp);
bool m_session_is_dead;
+ char *cert_fname;
};
}
idleTime = 0;
log = YLOG_DEBUG;
m_session_is_dead = false;
+ cert_fname = 0;
}
PDU_Assoc::~PDU_Assoc()
{
+ xfree(m_p->cert_fname);
delete m_p;
}
if (!m_p->cs)
return -1;
+
+ if (m_p->cert_fname)
+ cs_set_ssl_certificate_file(m_p->cs, m_p->cert_fname);
+
if (cs_bind(m_p->cs, ap, CS_SERVER) < 0)
return -2;
return 0;
return cs_addrstr(m_p->cs);
}
+
+void PDU_Assoc::set_cert_fname(const char *fname)
+{
+ xfree(m_p->cert_fname);
+ m_p->cert_fname = 0;
+ if (fname)
+ m_p->cert_fname = xstrdup(fname);
+}
+
/*
* Local variables:
* c-basic-offset: 4