X-Git-Url: http://git.indexdata.com/?p=yazproxy-moved-to-github.git;a=blobdiff_plain;f=src%2Fyaz-proxy-config.cpp;h=e6642a5a40f665e66dfbdb0ae47f4955e93ee407;hp=24fa1b0be785f48b729b5a7571c4839e12ea453a;hb=c990b5f85d736a35132c6902ba8b2966d5146360;hpb=9a7e8960b79b0b9bd6df38258ecda51f42d41280;ds=sidebyside diff --git a/src/yaz-proxy-config.cpp b/src/yaz-proxy-config.cpp index 24fa1b0..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.32 2006-06-09 09:35:14 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, @@ -1110,6 +1148,9 @@ void Yaz_ProxyConfig::get_generic_info(int *log_mask, !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);