X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fyaz-proxy-config.cpp;h=e6642a5a40f665e66dfbdb0ae47f4955e93ee407;hb=c990b5f85d736a35132c6902ba8b2966d5146360;hp=dbf03a58fb42e5e30c9220e16e08642c9fa01a0f;hpb=d1c87720d3ce527cde3486b3b8154fb6316e279e;p=yazproxy-moved-to-github.git diff --git a/src/yaz-proxy-config.cpp b/src/yaz-proxy-config.cpp index dbf03a5..e6642a5 100644 --- a/src/yaz-proxy-config.cpp +++ b/src/yaz-proxy-config.cpp @@ -1,4 +1,4 @@ -/* $Id: yaz-proxy-config.cpp,v 1.30 2006-04-06 16:25:21 adam Exp $ +/* $Id: yaz-proxy-config.cpp,v 1.33 2006-06-28 23:38:23 adam Exp $ Copyright (c) 1998-2006, Index Data. This file is part of the yazproxy. @@ -676,6 +676,44 @@ int Yaz_ProxyConfig::client_authentication(const char *name, return 1; } +int Yaz_ProxyConfig::global_client_authentication(const char *user, + const char *group, + const char *password, + const char *peer_IP) +{ + int ret = YAZPROXY_RET_NOT_ME; +#if HAVE_XSLT + if (!m_cp->m_proxyPtr) + return 1; + xmlNodePtr ptr; + for (ptr = m_cp->m_proxyPtr->children; ptr; ptr = ptr->next) + { + if (ptr->type == XML_ELEMENT_NODE && + !strcmp((const char *) ptr->name, "client-authentication")) + { + struct _xmlAttr *attr; + const char *module_name = 0; + for (attr = ptr->properties; attr; attr = attr->next) + { + if (!strcmp((const char *) attr->name, "module") && + attr->children && attr->children->type == XML_TEXT_NODE) + module_name = (const char *) attr->children->content; + } + ret = m_cp->m_modules.authenticate(module_name, + NULL, ptr, + user, group, password, + peer_IP + ); + if (ret != YAZPROXY_RET_NOT_ME) + break; + } + } +#endif + if (ret == YAZPROXY_RET_PERM) + return 0; + return 1; +} + int Yaz_ProxyConfig::check_syntax(ODR odr, const char *name, Odr_oid *syntax, Z_RecordComposition *comp, char **addinfo, @@ -1022,10 +1060,12 @@ void Yaz_ProxyConfig::get_generic_info(int *log_mask, int *max_clients, int *max_connect, int *limit_connect, - int *period_connect) + int *period_connect, + int *num_msg_threads) { *max_connect = 0; *limit_connect = 0; + *num_msg_threads = 0; #if HAVE_XSLT xmlNodePtr ptr; if (!m_cp->m_proxyPtr) @@ -1104,6 +1144,21 @@ void Yaz_ProxyConfig::get_generic_info(int *log_mask, else if (ptr->type == XML_ELEMENT_NODE && !strcmp((const char *) ptr->name, "docpath")) ; + else if (ptr->type == XML_ELEMENT_NODE && + !strcmp((const char *) ptr->name, "module")) + ; + else if (ptr->type == XML_ELEMENT_NODE && + !strcmp((const char *) ptr->name, "client-authentication")) + ; + else if (ptr->type == XML_ELEMENT_NODE && + !strcmp((const char *) ptr->name, "threads")) + { + const char *t = m_cp->get_text(ptr); + if (t) + { + *num_msg_threads = atoi(t); + } + } else if (ptr->type == XML_ELEMENT_NODE) { yaz_log(YLOG_WARN, "0 Unknown element %s in yazproxy config",