1 /* This file is part of YAZ proxy
2 Copyright (C) 1998-2008 Index Data
4 YAZ proxy is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 YAZ proxy is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <yazproxy/module.h>
26 #include <libxml/parser.h>
27 #include <libxml/tree.h>
28 #include <libxml/xinclude.h>
29 #include <libxslt/xsltutils.h>
30 #include <libxslt/transform.h>
35 return 0; // no private data for handler
38 void my_destroy(void *p)
40 // private data destroy
43 int my_authenticate(void *user_handle,
44 const char *target_name,
46 const char *user, const char *group, const char *password,
49 // see if we have an "args" attribute
52 xmlNodePtr ptr = (xmlNodePtr) element_ptr;
53 struct _xmlAttr *attr;
55 for (attr = ptr->properties; attr; attr = attr->next)
57 if (!strcmp((const char *) attr->name, "args") &&
58 attr->children && attr->children->type == XML_TEXT_NODE)
59 args = (const char *) attr->children->content;
62 // args holds args (or NULL if none is provided)
65 fprintf(stderr, "my_authenticate: target=%s user=%s group=%s args=%s IP=%s"
67 target_name ? target_name : "none",
68 user ? user : "none", group ? group : "none",
71 // authentication handler
72 if (!user && !group && !password)
73 return YAZPROXY_RET_OK; // OK if anonymous
74 if (user && !strcmp(user, "guest")
75 && password && !strcmp(password, "guest")) // or guest guest
76 return YAZPROXY_RET_OK;
77 return YAZPROXY_RET_PERM; // fail otherwise
80 Yaz_ProxyModule_int0 interface0 = {
86 Yaz_ProxyModule_entry yazproxy_module = {
87 0, // interface version
89 "Sample Module for YAZ Proxy",// description
95 * indent-tabs-mode: nil
97 * vim: shiftwidth=4 tabstop=8 expandtab