X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmod_sample.cpp;h=11c00ad110fbcd69ec8ca610d86202dbe75063a9;hb=7f81d5b3aa6b9d7e4c5c1e02c91dd416eb97d19e;hp=05b121b13407b509e775238f1122921f649764c7;hpb=c6ca4f0f79d5ea0ca391d420bcb6dd6b4d7935d2;p=yazproxy-moved-to-github.git diff --git a/src/mod_sample.cpp b/src/mod_sample.cpp index 05b121b..11c00ad 100644 --- a/src/mod_sample.cpp +++ b/src/mod_sample.cpp @@ -1,4 +1,4 @@ -/* $Id: mod_sample.cpp,v 1.1 2005-02-11 15:19:08 adam Exp $ +/* $Id: mod_sample.cpp,v 1.2 2005-02-21 14:27:32 adam Exp $ Copyright (c) 1998-2005, Index Data. This file is part of the yaz-proxy. @@ -24,6 +24,14 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include +#if HAVE_XSLT +#include +#include +#include +#include +#include +#endif + void *my_init(void) { return 0; // no private data for handler @@ -34,11 +42,30 @@ void my_destroy(void *p) // private data destroy } -int my_authenticate(void *p, const char *user, const char *group, - const char *password) +int my_authenticate(void *user_handle, + const char *target_name, + void *element_ptr, + const char *user, const char *group, const char *password) { - fprintf(stderr, "my_authenticate: user=%s group=%s\n", - user ? user : "none", group ? group : "none"); + // see if we have an "args" attribute + const char *args = 0; +#if HAVE_XSLT + xmlNodePtr ptr = (xmlNodePtr) element_ptr; + struct _xmlAttr *attr; + + for (attr = ptr->properties; attr; attr = attr->next) + { + if (!strcmp((const char *) attr->name, "args") && + attr->children && attr->children->type == XML_TEXT_NODE) + args = (const char *) attr->children->content; + } +#endif + // args holds args (or NULL if none is provided) + + fprintf(stderr, "my_authenticate: target=%s user=%s group=%s args=%s\n", + target_name ? target_name : "none", + user ? user : "none", group ? group : "none", + args ? args : "none"); // authentication handler if (!user && !group && !password) return YAZPROXY_RET_OK; // OK if anonymous @@ -60,4 +87,3 @@ Yaz_ProxyModule_entry yazproxy_module = { "Sample Module for YAZ Proxy",// description &interface0 }; -