as documented within the package.
Current contributions:
- gtk-tool
- GTK-based frontend from Predrag Balorda
-
ldapc++
The OpenLDAP LDAP C++ API
Contributed by SuSE Gmbh.
ldaptcl
TCL API from NeoSoft
- php3-tool
- PHP3-based frontend from Predrag Balorda
-
saucer
General purpose command-line LDAP client, modeled
after ISODE's DISH (DIrectory SHell) client.
Contributed by Eric Rosenquist. See saucer/README
and its man page for more information.
- tweb
- HTTP gateway derived from web500gw. Contributed
- by the Universitaet Tuebingen, GERMANY. See
- tweb/README for more information.
-
- web_ldap
- web frontend (in C) from Jens Moller
-
- web500gw
- HTTP gateway for X.500, modeled after go500gw.
- Contributed by Frank Richter. See web500gw/README
- for more information.
-
- whois++
- WHOIS++ gateway to X.500. Contributed by Mark Prior.
- See whois++/README for more information.
-
-
Please submit your contributions using the OpenLDAP Issue
Tracking System <http://www.openldap.org/>.
+++ /dev/null
-Copyright 1998,1999,2000 Predrag Balorda, London, UK
-All rights reserved.
-
-Redistribution and use in source and binary forms are permitted only
-as authorized by the OpenLDAP Public License. A copy of this
-license is available at http://www.OpenLDAP.org/license.html or
-in file LICENSE in the top-level directory of the distribution.
-
+++ /dev/null
-ChangeLog for gtk-tool
-06/01/2000 - Pele
- * Added cn=schema
-
-03/01/2000 - Pele
- * Fixed localtime() bug in Linux ?;)
-
-03/01/19100 - Pele
- * Auto-select the first server if any supplied as arguments
- * A visual bug in the former (deselect a bit messy)
- * Follow aliases (not tested with leaf nodes though)
- * "Show Debug Info" in "Options" menu
-
-28/12/1999 - Pele
- * Updated Gtk-- API from 1.0 to 1.1
- * Added -d switch (for debugging info)
- * Added "Options" menu
-
-12/01/1999 - Pele
- * Added some defines for U-MICH compatibility
- * Updated to the latest Gtk-- API (in Gtk-- CVS tree)
- * Minor fixes due to the new and cleaner Gtk-- API
- * A new server can be added by entering a hostname into the
- "url" field at the top and clicking on "Query Server" button
- (note that one server still has to be supplied on the command line -
- I'll try and fix this tomorrow...to do with ldap_get_opt)
- * Somewhat "smarter" Makefile - can someone please look into integrating
- gtk-tool into the openldap autoconf stuff?
-
-09/12/1998 - Pele
- * Display of all ldap options in their proper widgets (sliders for
- timeout, radio buttons for booleans etc.) when server selected
- * Code cleanups
- * Misc fixes
-
-03/12/1998 - Pele
- * Added support for multiple servers (via multiple -s options)
- * More testing
- * Started experimenting with status bar for display of various info
- * Got rid of many warning and error messages generate by gtk
- * Added a new icon for objectclass=alias;
- * Display of some ldap options aquired with ldap_get_option when
- server selected.
- * Traversing set to only 1 subtree (then 1 by 1);
- * Started experimenting with a progress bar for traversal
- (so users don't get bored while waiting for subtrees to be aquired and
- constructed)
-
-02/12/1998 - Pele
- * Added Gtk_LdapTree class
- * Added utils (with debug only)
- * "Smart" traversing of ldap tree (only 2-deep, then add 2 subtrees as
- the tree gets expanded)
- * Lots of updates and bug-fixes
-
-29/11/1998 - Pele
- * Added Gtk_LdapServer class
- * Started using cn=config, ldap_get_option (not sure about get_option
- though, cn=config looks much nicer for the future-proofing)
- * Can traverse, display and serve two (or possibly/hopefully) more
- databases on the local machine - remote machines also possible -
- need to use "-s hostname"
- * The program needs the "-s" switch! Without it it won't run (temporary
- "feature")
-
-28/11/1998 - Pele
- * Fixes, enhancements, started using ldap utility api
- * It now traverses the whole tree at startup, not sure if it's smart
- but I did it because of something that has no relevance to network
- traffic
-
-27/11/1998 - Pele
- * Added viewports, both sides now scroll automatically
- * Brought back the "cache" stuff, now data gets reused if it's allready
- available without redundant searches/listings.
- * Editing pixmaps by hand is so much, er, fun!
- * Miniscule fixes
-
-26/11/1998 - Pele
- * Added nice icons in the browser pane - looks decent now.
- * Fixed scrolling in the data (right) pane - now scrolls if there is
- a long tab
- * removed class My_Scroller
- * removed file Gtk_LdapItem.cc (useless)
- * commented-out the part where data gets reused instead of re-querying
- the server, stupid I know, but for the time being if resolves some
- problems with replacement of right pane.
- * Misc. fixes
-
-26/11/1998 - Pele
- * First appearance of ChangeLog
- * Fixed removal of scrolled window on the right hand side
- thus making gtk-tool a viable project to be worked on
- * added command-line parameter parsing - now accepts
- -s for server, -p for port, -b for baseDN
+++ /dev/null
-#ifndef GTK_LDAPITEM_H
-#define GTK_LDAPITEM_H
-#include "cpluscommon.h"
-#include "gtk.h"
-#include <Gtk_LdapTreeItem.h>
-class Gtk_LdapTreeItem;
-
-class Gtk_LdapItem {
-public:
- Gtk_Tree *tree;
- Gtk_LdapTreeItem *treeitem;
- G_List<gchar> *value_list;
- char *attribute_name;
- G_List<Gtk_LdapItem> *attribute_list;
- char *entry_name;
-};
-#endif
+++ /dev/null
-#include "Gtk_LdapServer.h"
-#include <gtk--/base.h>
-
-Gtk_LdapServer::Gtk_LdapServer() : Gtk_TreeItem() {
- this->hostname = NULL;
- this->par = NULL;
- this->base_dn = NULL;
- this->port = 0;
-}
-
-Gtk_LdapServer::Gtk_LdapServer(My_Window *w, char *h, int p) : Gtk_TreeItem() {
- char *s, *s2;
- this->par = w;
- this->hostname = h;
- this->port = p;
- this->notebook = NULL;
- debug("%s %i\n", this->hostname, this->port);
- this->setType(1);
- this->getConfig();
-}
-
-Gtk_LdapServer::Gtk_LdapServer(GtkTreeItem *t) : Gtk_TreeItem(t) {
-}
-
-Gtk_LdapServer::~Gtk_LdapServer() {
- debug("Bye\n");
- delete this;
-}
-
-void Gtk_LdapServer::setType(int t) {
- debug("Gtk_LdapServer::setType(%i)\n", t);
- Gtk_Pixmap *xpm_icon;
- Gtk_Label *label;
- char *c = NULL;
- if (this->get_child() != NULL) this->remove();
- xpm_label = new Gtk_HBox();
- debug(this->hostname);
- if (strcasecmp(this->hostname,"localhost") == 0)
- xpm_icon=new Gtk_Pixmap(local_server);
- else xpm_icon=new Gtk_Pixmap(remote_server);
-// sprintf(c, "%s:%i", this->hostname, this->port);
-// printf("%s\n", c);
- label = new Gtk_Label(this->hostname);
- xpm_label->pack_start(*xpm_icon, false, false, 1);
- xpm_label->pack_start(*label, false, false, 1);
- if (this->get_child() == NULL) this->add(*xpm_label);
- this->show_all();
-}
-
-int Gtk_LdapServer::showDetails() {
- debug("Gtk_LdapServer::showDetails()\n");
- if (this->notebook == NULL) this->getOptions();
- if (this->notebook != NULL) {
- debug("Have a notebook here");
- if (par->viewport2->get_child() != NULL) {
- debug(" and viewport has children");
- par->viewport2->remove();
- debug(" which have been removed\n");
- }
- else debug(" and viewport without children\n");
- par->viewport2->add(*this->notebook);
- }
- this->show_all();
- debug("done\n");
- return 0;
-}
-
-int Gtk_LdapServer::getMonitor() {
- debug("Gtk_LdapServer::getMonitor()\n");
- int error, entriesCount;
- LDAPMessage *entry, *result_identifier;
- BerElement *ber;
- char *attribute, **t;
-
- if ((this->ld = ldap_open(this->hostname, this->port)) == NULL) {
- perror("connection");
- }
-
- error = ldap_search_s(this->ld, "cn=monitor", LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, &result_identifier);
- entriesCount = ldap_count_entries(this->ld, result_identifier);
- if (entriesCount == 0) {
- return 0;
- }
-
- debug("%i tree(s)\n", entriesCount);
- for (entry = ldap_first_entry(this->ld, result_identifier); entry != NULL; entry = ldap_next_entry(this->ld, result_identifier)) {
- for (attribute = ldap_first_attribute(this->ld, entry, &ber); attribute != NULL; attribute = ldap_next_attribute(this->ld, entry, ber)) {
- debug("Attrib: %s\n", attribute);
- if (strcasecmp(attribute, "database") == 0) {
- debug("have database here\n");
- this->databases = NULL;
- t = ldap_get_values(this->ld, entry, attribute);
- for (int i=0; i<ldap_count_values(t); i++) {
- this->databases = g_list_append(this->databases, strdup(t[i]));
- }
- ldap_value_free(t);
- debug("databases loaded\n");
- GList *t;
- for (int i=0;i>g_list_length(this->databases);i++) {
- t = g_list_nth(this->databases, i);
- debug("database(%i) %s\n", i, (char*) t->data);
- }
- }
- }
- debug("entry done\n");
- }
- return entriesCount;
-}
-
-int Gtk_LdapServer::getConfig() {
- debug("Gtk_LdapServer::getConfig()\n");
- int error, entriesCount;
- LDAPMessage *entry, *result_identifier;
- BerElement *ber;
- char *attribute, **t;
-
- if ((this->ld = ldap_open(this->hostname, this->port)) == NULL) {
- perror("connection");
- }
-
- error = ldap_search_s(this->ld, "cn=config", LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, &result_identifier);
- entriesCount = ldap_count_entries(this->ld, result_identifier);
- if (entriesCount == 0) {
- return 0;
- }
-
-// debug("%i tree(s)\n", entriesCount);
- for (entry = ldap_first_entry(this->ld, result_identifier); entry != NULL; entry = ldap_next_entry(this->ld, result_identifier)) {
- for (attribute = ldap_first_attribute(this->ld, entry, &ber); attribute != NULL; attribute = ldap_next_attribute(this->ld, entry, ber)) {
- debug("Attrib: %s\n", attribute);
- if (strcasecmp(attribute, "database") == 0) {
- debug("have database here\n");
- this->databases = NULL;
- t = ldap_get_values(this->ld, entry, attribute);
- for (int i=0; i<ldap_count_values(t); i++) {
- this->databases = g_list_append(this->databases, strdup(t[i]));
- }
- this->databases = g_list_append(this->databases, "ldbm : cn=config");
- this->databases = g_list_append(this->databases, "ldbm : cn=monitor");
- this->databases = g_list_append(this->databases, "ldbm : cn=schema");
- ldap_value_free(t);
- debug("databases loaded\n");
- GList *t;
- for (int i=0;i<g_list_length(this->databases);i++) {
- t = g_list_nth(this->databases, i);
- debug("database(%i) %s\n", i, (char*) t->data);
- }
- }
- }
- debug("entry done\n");
- }
- return entriesCount;
-}
-
-#ifndef LDAP_GET_OPT /* a temporary fix for usability with (old) U-MICH api */
-char* Gtk_LdapServer::getOptDescription(int option) {
- debug("Gtk_LdapServer::getOptDescription(%i) ", option);
- char *c;
- switch (option) {
- case LDAP_OPT_API_INFO: c = "API info"; break;
- case LDAP_OPT_CLIENT_CONTROLS: c = "Client controls"; break;
- case LDAP_OPT_DEREF: c = "Dereference"; break;
- case LDAP_OPT_DESC: c = "Description"; break;
- case LDAP_OPT_DNS: c = "DNS Lookup"; break;
- case LDAP_OPT_ERROR_NUMBER: c = "Error number"; break;
- case LDAP_OPT_ERROR_STRING: c = "Error string"; break;
- case LDAP_OPT_SIZELIMIT: c = "Size limit"; break;
- case LDAP_OPT_TIMELIMIT: c = "Time limit"; break;
- case LDAP_OPT_REFERRALS: c = "Referrals"; break;
- case LDAP_OPT_RESTART: c = "Started"; break;
- case LDAP_OPT_PROTOCOL_VERSION: c = "Protocol version"; break;
- case LDAP_OPT_HOST_NAME: c = "Host name"; break;
- case LDAP_OPT_SERVER_CONTROLS: c = "Server controls"; break;
- default: c = "No description"; break;
- }
- debug("%s\n", c);
- return c;
-}
-
-int Gtk_LdapServer::getOptType(int option) {
- debug("Gtk_LdapServer::getOptType(%i) ", option);
- /* types:
- * 0 = int, 1 = string, 2 = boolean,
- * 3 = range, 4 = LDAPAPIInfo, 5 = unknown
- */
- int type;
- switch(option) {
- /* ints */
- case LDAP_OPT_DEREF:
- case LDAP_OPT_DESC:
- case LDAP_OPT_ERROR_NUMBER:
- case LDAP_OPT_PROTOCOL_VERSION: type = 0; break;
- /* strings */
- case LDAP_OPT_ERROR_STRING:
- case LDAP_OPT_HOST_NAME: type = 1; break;
- /* bools */
- case LDAP_OPT_REFERRALS:
- case LDAP_OPT_DNS:
- case LDAP_OPT_RESTART: type = 2; break;
- /* range */
- case LDAP_OPT_SIZELIMIT:
- case LDAP_OPT_TIMELIMIT: type = 3; break;
- /* api */
- case LDAP_OPT_API_INFO: type = 4; break;
- /* unknowns */
- case LDAP_OPT_SERVER_CONTROLS:
- case LDAP_OPT_CLIENT_CONTROLS:
- default: type = 5; break;
- }
- debug("%i\n", type);
- return type;
-}
-#endif /* LDAP_GET_OPT */
-
-int Gtk_LdapServer::getOptions() {
- debug("Gtk_LdapServer::getOptions()\n");
- if (this->notebook != NULL) return 0;
-#ifdef LDAP_GET_OPT /* a temporary fix for usability with (old) U-MICH api */
- Gtk_Label *label;
- label = new Gtk_Label("This tool has been compiled with (old) U-MICH API (no LDAP_GET_OPT)\nCompile with the latest -devel (from OpenLDAP cvs tree)\nto get some nice options here");
- this->notebook = new Gtk_Frame("LDAP Options");
- this->notebook->add(*label);
- //label->show();
- //this->notebook->show();
- this->notebook->show_all();
- return 0;
-#else
- LDAPAPIInfo api;
- Gtk_HBox *hbox, *mini_hbox;
- Gtk_VBox *vbox, *mini_vbox;
- Gtk_Table *table;
- Gtk_Label *label;
- Gtk_RadioButton *radio1, *radio2;
- Gtk_HScale *scale;
- Gtk_Adjustment *adjustment;
- char *description = NULL, *s_value = NULL;
-// int i_value;
- string label_string;
-
- int things[10] = {
- LDAP_OPT_API_INFO,
- LDAP_OPT_CLIENT_CONTROLS,
- // LDAP_OPT_DESC,
- // LDAP_OPT_DEREF,
- LDAP_OPT_DNS,
- // LDAP_OPT_ERROR_NUMBER,
- // LDAP_OPT_ERROR_STRING,
- LDAP_OPT_HOST_NAME,
- LDAP_OPT_PROTOCOL_VERSION,
- LDAP_OPT_REFERRALS,
- LDAP_OPT_RESTART,
- LDAP_OPT_SERVER_CONTROLS,
- LDAP_OPT_SIZELIMIT,
- LDAP_OPT_TIMELIMIT
- };
-
-/* if (GTK_TREE_ITEM(this->gtkobj())->subtree == NULL) {
- this->getSubtree();
- } */
-
-// vbox = new Gtk_VBox();
- table = new Gtk_Table(10, 1, TRUE);
-
- for (int i=0; i<10; i++) {
- int i_value;
- // debug("%i\n", i);
- hbox = new Gtk_HBox(TRUE, 2);
- hbox->set_border_width(2);
- description = this->getOptDescription(things[i]);
- label = new Gtk_Label(description);
- label->set_justify(GTK_JUSTIFY_LEFT);
- label->set_alignment(0, 0);
- hbox->pack_start(*label);
- label->show();
- switch (this->getOptType(things[i])) {
- case 0:
- ldap_get_option(this->ld, things[i], &i_value);
- debug("%s value %d\n", description, i_value);
- sprintf(s_value, "%d", i_value);
- label = new Gtk_Label(s_value);
- label->set_justify(GTK_JUSTIFY_LEFT);
- label->set_alignment(0, 0);
- hbox->pack_end(*label);
- label->show();
- break;
- case 1:
- ldap_get_option(this->ld, things[i], &s_value);
- label = new Gtk_Label(s_value);
- label->set_justify(GTK_JUSTIFY_LEFT);
- label->set_alignment(0, 0);
- hbox->pack_end(*label);
- label->show();
- break;
- case 2:
- ldap_get_option(this->ld, things[i], &i_value);
- radio1 = new Gtk_RadioButton("Enabled");
- radio2 = new Gtk_RadioButton("Disabled");
- radio2->set_group(radio1->group());
- if (i_value == 1) radio1->set_active(true);
- else radio2->set_active(true);
- mini_hbox = new Gtk_HBox(FALSE, 2);
- mini_hbox->set_border_width(2);
- mini_hbox->pack_start(*radio1);
- //radio1->show();
- mini_hbox->pack_end(*radio2);
- //radio2->show();
- hbox->pack_end(*mini_hbox);
- //mini_hbox->show();
- break;
- case 3:
- ldap_get_option(this->ld, things[i], &i_value);
- debug("i_value: %s\n", i_value);
- adjustment = new Gtk_Adjustment(i_value, 0.0, 20.0, 1.0, 1.0, 0.0);
- scale = new Gtk_HScale(*adjustment);
- scale->set_update_policy(GTK_UPDATE_CONTINUOUS);
- scale->set_value_pos(GTK_POS_TOP);
- scale->set_digits(0);
- scale->set_draw_value(true);
- hbox->pack_end(*scale);
- //scale->show();
- break;
- case 4:
-#ifdef LDAP_API_INFO_VERSION
- api.ldapai_info_version = LDAP_API_INFO_VERSION;
-#else
- api.ldapai_info_version = 1;
-#endif
- if (ldap_get_option(this->ld, things[i], &api) != LDAP_SUCCESS) {
- perror(this->getOptDescription(things[i]));
- break;
- }
- s_value = api.ldapai_vendor_name;
- label = new Gtk_Label(s_value);
- label->set_justify(GTK_JUSTIFY_LEFT);
- label->set_alignment(0, 0);
- hbox->pack_end(*label);
- //label->show();
- break;
- default:
- label = new Gtk_Label("Not implemented (yet)");
- label->set_justify(GTK_JUSTIFY_LEFT);
- label->set_alignment(0, 0);
- hbox->pack_end(*label);
- //label->show();
- break;
- }
- // hbox->pack_end(*label);
- // label->show();
- table->attach(*hbox, 0, 1, i, i+1);
- hbox->show();
- }
- table->set_border_width(2);
- this->notebook = new Gtk_Frame("LDAP Options");
- this->notebook->add(*table);
- //table->show();
- this->notebook->show_all();
- return 0;
-#endif /* LDAP_GET_OPT */
-}
-
-Gtk_Tree* Gtk_LdapServer::getSubtree() {
- debug("Gtk_LdapServer::getSubtree()\n");
- Gtk_LdapTree *tree, *subtree;
- Gtk_LdapTreeItem *treeitem;
- int entries;
-
- debug("this->hostname=%s\n", this->hostname);
- debug("this->port=%i", this->port);
-
- char *c;
- char *tok;
-
- int len = g_list_length(this->databases);
- debug("this->databases->length()=%i\n", len);
-
- tree = new Gtk_LdapTree();
- for (int i=0; i<len; i++) {
- GList *t = g_list_nth(this->databases, i);
- tok = strdup((char*)t->data);
- tok = strtok(tok, ":");
- // c = strtok(NULL, " ");
- c = strtok(NULL, "\0");
- debug("database %i %s\n", i, c);
- treeitem = new Gtk_LdapTreeItem(c, this->par, this->ld);
- subtree = treeitem->getSubtree(this->ld, 1);
- debug("inserting %s into %s\n", treeitem->rdn, this->hostname);
- tree->append(*treeitem);
- if (subtree != NULL) treeitem->set_subtree(*subtree);
- treeitem->show();
- // treeitem->setDnd();
- // tree->show();
- }
-// this->set_subtree(*tree);
- debug("getSubtree() done\n");
- return tree;
-}
-/*
-void Gtk_LdapServer::show_impl() {
- debug("%s showed\n", this->hostname);
- BaseClassType *sig=static_cast<BaseClassType *>(get_parent_class());
- if (!sig->show) return;
- sig->show(gtkobj());
-// Gtk_c_signals_Item *sig=(Gtk_c_signals_Item *)internal_getsignalbase();
-// sig->show(GTK_WIDGET(gtkobj()));
-}
-*/
-void Gtk_LdapServer::select_impl() {
- debug("%s selected\n", this->hostname);
-// Gtk_c_signals_Item *sig=(Gtk_c_signals_Item *)internal_getsignalbase();
-// if (!sig->select) return;
- this->showDetails();
-// sig->select(GTK_ITEM(gtkobj()));
- Gtk_TreeItem::select_impl();
-}
-
-void Gtk_LdapServer::collapse_impl() {
- debug("%s collapsed\n", this->hostname);
-// Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
-// if (!sig->collapse) return;
-// sig->collapse(GTK_TREE_ITEM(gtkobj()));
-// gtk_widget_hide(GTK_WIDGET(GTK_TREE(GTK_TREE_ITEM (this->gtkobj())->subtree)));
- Gtk_TreeItem::collapse_impl();
-}
-
-void Gtk_LdapServer::expand_impl() {
- debug("%s expanded\n", this->hostname);
- Gtk_TreeItem::expand_impl();
-// BaseClassType *sig=static_cast<BaseClassType *>(get_parent_class());
-// if (!sig->expand)
-// { return; }
-// sig->expand(gtkobj());
-// Gtk_c_signals_TreeItem *sig=(Gtk_c_signals_TreeItem *)internal_getsignalbase();
-// if (!sig->expand) return;
-// sig->expand(GTK_TREE_ITEM(gtkobj()));
-// Gtk_Tree *t;
-// t = new Gtk_Tree(GTK_TREE(GTK_TREE_ITEM(this->gtkobj())->subtree));
-// bool vis = t->visible();
-// if (vis == false) {
-// gtk_widget_show(GTK_WIDGET(GTK_TREE(GTK_TREE_ITEM (this->gtkobj())->subtree)));
-// cout << this->dn << " expanded" << endl;
-// }
-// else {
-// gtk_widget_hide(GTK_WIDGET(GTK_TREE(GTK_TREE_ITEM (this->gtkobj())->subtree)));
-// cout << this->dn << " collapsed" << endl;
-// }
-}
+++ /dev/null
-#ifndef GTK_LDAPSERVER_H
-#define GTK_LDAPSERVER_H
-#include "gtk.h"
-#include "utils.h"
-#include <My_Window.h>
-#include <Gtk_LdapTree.h>
-#include <Gtk_LdapTreeItem.h>
-#include <lber.h>
-#include <ldap.h>
-#include "icons/local_server.h"
-#include "icons/remote_server.h"
-
-#define LOCAL_SERVER 1
-#define REMOTE_SERVER 2
-
-class My_Window;
-
-class Gtk_LdapServer : public Gtk_TreeItem {
-public:
- char *dn;
- char *hostname;
- LDAPMessage **thing;
- LDAP *ld;
- char *host;
- char *base_dn;
- int c, port;
- My_Window *par;
-// Gtk_Notebook *notebook;
- Gtk_Frame *notebook;
- Gtk_HBox *xpm_label;
-// Gtk_Tree *subtree;
- Gtk_Menu *popup;
- GList *databases;
- Gtk_LdapServer();
- Gtk_LdapServer(My_Window *w, char *c, int p);
- Gtk_LdapServer(GtkTreeItem *t);
- ~Gtk_LdapServer();
- void setType(int t);
- int getMonitor();
- int getConfig();
- Gtk_Tree* getSubtree();
-#ifndef LDAP_GET_OPT
- char* getOptDescription(int option);
- int getOptType(int option);
-#endif
- int getOptions();
- int showDetails();
-// void show_impl();
- void select_impl();
- void collapse_impl();
- void expand_impl();
-};
-#endif
+++ /dev/null
-#include <Gtk_LdapTree.h>
-
-void Gtk_LdapTree::show_impl() {
- debug("Gtk_LdapTree::show_impl()\n");
- Gtk_LdapTree *tree;
- Gtk_LdapTreeItem *item = NULL;
- Gtk_LdapTree::ItemList &items = this->tree();
- Gtk_LdapTree::ItemList::iterator i; // = items.begin();
- debug("iterator\n");
- for (i=items.begin(); i!=items.end();++i) {
-// while (i!=items.end()) {
- item = (Gtk_LdapTreeItem *)(*i);
- debug("new item\n");
- debug("#%s#\n", item->dn);
- if (item->get_subtree() == NULL) {
- debug("ding!\n");
- tree = item->getSubtree(item->ld, 1);
- if (tree != NULL) {
- item->set_subtree(*tree);
- }
- item->setDnd();
- }
- }
- debug("done\n");
- Gtk_Tree::show_impl();
-}
+++ /dev/null
-#ifndef GTK_LDAP_TREE_H
-#define GTK_LDAP_TREE_H
-#include <gtk--/tree.h>
-#include "utils.h"
-#include <Gtk_LdapTreeItem.h>
-
-class Gtk_LdapTree : public Gtk_Tree {
- void show_impl();
-};
-#endif
+++ /dev/null
-#include "Gtk_LdapTreeItem.h"
-
-Gtk_LdapTreeItem::Gtk_LdapTreeItem() : Gtk_TreeItem() {
- this->objectClass = NULL;
-}
-
-Gtk_LdapTreeItem::Gtk_LdapTreeItem(char *c, My_Window *w, LDAP *ld) : Gtk_TreeItem() {
- debug("Gtk_LdapTreeItem::Gtk_LdapTreeItem(%s)\n", c);
- char **s;
- this->dn = c;
- s = ldap_explode_dn(this->dn, 1);
- this->rdn = g_strdup_printf("%s", s[0]);
- this->par = w;
- this->ld = ld;
- this->objectClass = NULL;
- this->getDetails();
- this->createPopupMenu();
-}
-
-void Gtk_LdapTreeItem::setDnd() {
- debug("Gtk_LdapTreeItem::setDnd()\n");
- this->set_events(get_events()|GDK_ALL_EVENTS_MASK);
- this->drag_dest_set(GTK_DEST_DEFAULT_ALL, target_table, n_targets, static_cast <GdkDragAction> (GDK_ACTION_COPY|GDK_ACTION_MOVE));
- this->drag_data_received.connect(slot(this, &(Gtk_LdapTreeItem::item_drag_data_received)));
- this->drag_drop.connect(slot(this,&Gtk_LdapTreeItem::target_drag_drop));
- this->drag_source_set(static_cast<GdkModifierType>(GDK_BUTTON1_MASK|GDK_BUTTON3_MASK), target_table, n_targets, static_cast<GdkDragAction>(GDK_ACTION_COPY|GDK_ACTION_MOVE));
- gtk_drag_source_set(GTK_WIDGET(this->gtkobj()), static_cast<GdkModifierType>(GDK_BUTTON1_MASK|GDK_BUTTON3_MASK), target_table, n_targets, static_cast<GdkDragAction>(GDK_ACTION_COPY|GDK_ACTION_MOVE));
- this->drag_data_get.connect(slot(this, &Gtk_LdapTreeItem::source_drag_data_get));
- this->drag_data_delete.connect(slot(this,&Gtk_LdapTreeItem::source_drag_data_delete));
- this->drag_leave.connect(slot(this,&Gtk_LdapTreeItem::target_drag_leave));
-
-}
-
-Gtk_LdapTreeItem::Gtk_LdapTreeItem(GtkTreeItem *t) : Gtk_TreeItem(t) {
-}
-
-Gtk_LdapTreeItem::~Gtk_LdapTreeItem() {
- cout << "Bye" << endl;
- delete this;
-}
-
-Gtk_LdapTree* Gtk_LdapTreeItem::getSubtree(LDAP *ld, int counter) {
- debug("Gtk_LdapTreeItem::getSubtree(%s)\n", this->dn);
- if (counter <= 0) return NULL;
- if (this->gtkobj()->subtree != NULL) {
- //return (Gtk_LdapTree *)GTK_TREE(this->gtkobj()->subtree);
- debug("This item has a subtree\n");
- return (Gtk_LdapTree *)this->get_subtree(); //gtkobj()->subtree);
- }
- counter--;
- Gtk_LdapTree *subtree = NULL, *tree = NULL;
- Gtk_LdapTreeItem *subtreeitem = NULL;
- LDAPMessage *r_i = NULL, *entry = NULL;
- gchar *c;
- char **s;
- int entriesCount = 0, error;
-
- this->ld = ld;
- if (this->dn == "cn=config" || this->dn == "cn=monitor" || this->dn == "cn=schema") error = ldap_search_s(this->ld, this->dn, LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, &r_i);
- else {
- if (strcasecmp(this->objectClass,"alias") == 0) error = ldap_search_s(this->ld, this->getAttribute("aliasedobjectname"), LDAP_SCOPE_ONELEVEL, "objectclass=*", NULL, 0, &r_i);
- else error = ldap_search_s(this->ld, this->dn, LDAP_SCOPE_ONELEVEL, "objectclass=*", NULL, 0, &r_i);
- }
-// printf("%s\n", ldap_err2string(error));
- entriesCount = ldap_count_entries(this->ld, r_i);
- debug("%i results\n", entriesCount);
- if (entriesCount != 0) {
- tree = new Gtk_LdapTree();
- // this->set_subtree(*tree);
- tree->set_selection_mode(GTK_SELECTION_BROWSE);
- tree->set_view_mode(GTK_TREE_VIEW_ITEM);
- tree->set_view_lines(false);
- entry = ldap_first_entry(this->ld, r_i);
- // float i = 1;
- gfloat percent = 100/entriesCount;
- debug("percent is %f\n", percent);
- // this->par->progress.set_percentage(percent/100);
- // this->par->progress.show();
- while (entry != NULL) {
- subtreeitem = new Gtk_LdapTreeItem(ldap_get_dn(this->ld, entry), this->par, this->ld);
- debug("inserting %s into %s\n",subtreeitem->rdn,this->rdn);
- tree->append(*subtreeitem);
- subtree = subtreeitem->getSubtree(this->ld, counter);
- subtreeitem->show();
- if (subtree != NULL) subtreeitem->set_subtree(*subtree);
- // subtreeitem->setDnd();
- debug("done\n");
- entry = ldap_next_entry(this->ld, entry);
- // gfloat pvalue = (i*percent)/100;
- // cout << pvalue << " %" << endl;
- // this->par->progress.update(pvalue);
- // this->par->progress.show();
- // i++;
- }
- // this->set_subtree(*tree);
- // this->par->progress.update(0);
- // this->par->progress->show();
- }
-// this->getDetails();
- debug("done\n");
- return tree;
-}
-
-void Gtk_LdapTreeItem::setType(int t) {
- debug("Gtk_LdapTreeItem::setType(%s)\n", this->objectClass);
- Gtk_Pixmap *xpm_icon;
- Gtk_Label *label;
- if (this->get_child() != NULL) {
- debug("got a child here");
- //xpm_label = new Gtk_HBox(this->get_child());
- this->remove();
- /*
- //xpm_label = new Gtk_HBox(*GTK_HBOX(this->get_child()->gtkobj()));
- xpm_label = new Gtk_HBox(this->get_child()); //->gtkobj());
- //xpm_label->remove_c(xpm_label->children().nth_data(0));
- Gtk_HBox::BoxList &list = xpm_label->children();
- Gtk_HBox::BoxList::iterator i = list.begin();
- xpm_label->remove(*i);
- //xpm_label->remove_c(xpm_label->children().nth_data(0));
- xpm_label->remove(*xpm_label->children().begin());
- */
- }
- xpm_label = new Gtk_HBox();
- if (strcasecmp(this->objectClass,"organization") == 0)
- //xpm_icon=new Gtk_Pixmap(*xpm_label, root_node);
- xpm_icon=new Gtk_Pixmap(root_node);
- else if (strcasecmp(this->objectClass,"organizationalunit") == 0)
- //xpm_icon=new Gtk_Pixmap(*xpm_label, branch_node);
- xpm_icon=new Gtk_Pixmap(branch_node);
- else if (strcasecmp(this->objectClass,"person") == 0)
- //xpm_icon=new Gtk_Pixmap(*xpm_label, leaf_node);
- xpm_icon=new Gtk_Pixmap(leaf_node);
- else if (strcasecmp(this->objectClass,"alias") == 0)
- //xpm_icon=new Gtk_Pixmap(*xpm_label, alias_node);
- xpm_icon=new Gtk_Pixmap(alias_node);
- else if (strcasecmp(this->objectClass,"rfc822mailgroup") == 0)
- //xpm_icon=new Gtk_Pixmap(*xpm_label, rfc822mailgroup_node);
- xpm_icon=new Gtk_Pixmap(rfc822mailgroup_node);
- else if (strcasecmp(this->objectClass,"LDAPsubentry") == 0)
- xpm_icon=new Gtk_Pixmap(monitor);
- else //xpm_icon=new Gtk_Pixmap(*xpm_label, general_node);
- xpm_icon=new Gtk_Pixmap(general_node);
- label = new Gtk_Label(this->rdn);
- xpm_label->pack_start(*xpm_icon, false, false, 1);
- xpm_label->pack_start(*label, false, false, 1);
- if (this->get_child() == NULL) {
- debug("no children - GREAT!!");
- this->add(*xpm_label);
- }
- //label->show();
- //xpm_icon->show();
- //xpm_label->show();
- show_all();
-}
-
-int Gtk_LdapTreeItem::showDetails() {
- debug("Gtk_LdapTreeItem::showDetails()\n");
- if (this->notebook == NULL) this->getDetails();
- if (this->notebook != NULL) {
- debug("Have a notebook here");
- if (par->viewport2->get_child() != NULL) {
- debug(" and the viewport has children");
- //par->viewport2->remove(par->viewport2->get_child());
- par->viewport2->remove();
- debug(" which have been removed");
- }
- else debug(" and viewport has no children");
- par->viewport2->add(*this->notebook);
- this->notebook->show();
- par->viewport2->show();
- return 0;
- }
- else debug("No notebook and no details");
- return 0;
-}
-
-char* Gtk_LdapTreeItem::getAttribute(char *c) {
- int entriesCount, error;
- BerElement *ber;
- LDAPMessage *entry;
- char *attribute, **values;
- error = ldap_search_s(this->ld, this->dn, LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, &this->result_identifier);
- entriesCount = ldap_count_entries(this->ld, this->result_identifier);
- if (entriesCount == 0) return 0;
- for (entry = ldap_first_entry(ld, result_identifier); entry != NULL; entry = ldap_next_entry(ld, result_identifier)) {
- for (attribute = ldap_first_attribute(ld, entry, &ber); attribute != NULL; attribute = ldap_next_attribute(ld, entry, ber)) {
- values = ldap_get_values(ld, entry, attribute);
- if (strcasecmp(attribute, "aliasedobjectname") == 0) {
- this->aliasedObjectName = strdup(values[0]);
- }
- }
- }
- return this->aliasedObjectName;
-}
-
-int Gtk_LdapTreeItem::getDetails() {
- debug("Gtk_LdapTreeItem::getDetails()\n");
- int error, entriesCount;
- BerElement *ber;
- LDAPMessage *entry;
- char *attribute, **values;
- char attrib[32];
- Gtk_CList *table;
- Gtk_Label *label;
- GList *child_list;
- Gtk_Viewport *viewport;
- error = ldap_search_s(this->ld, this->dn, LDAP_SCOPE_BASE, "objectclass=*", NULL, 0, &this->result_identifier);
- entriesCount = ldap_count_entries(this->ld, this->result_identifier);
- if (entriesCount == 0) return 0;
- this->notebook = new Gtk_Notebook();
- this->notebook->set_tab_pos(GTK_POS_LEFT);
- const gchar *titles[] = { "values" };
-
- for (entry = ldap_first_entry(ld, result_identifier); entry != NULL; entry = ldap_next_entry(ld, result_identifier)) {
- for (attribute = ldap_first_attribute(ld, entry, &ber); attribute != NULL; attribute = ldap_next_attribute(ld, entry, ber)) {
- values = ldap_get_values(ld, entry, attribute);
- if (strcasecmp(attribute, "objectclass") == 0) {
- // debug("processing objectclass\n");
- if (strcasecmp(values[0],"top") == 0)
- this->objectClass = strdup(values[1]);
- else this->objectClass = strdup(values[0]);
- }
- table = new Gtk_CList(1, titles);
- for (int i=0; i<ldap_count_values(values); i++) {
- // debug("%i:%s\n",i, values[i]);
- const gchar *t[] = { values[i] };
- table->append(t);
- }
- ldap_value_free(values);
- sprintf(attrib, "%s", attribute);
- label = new Gtk_Label(attrib);
- label->set_alignment(0, 0);
- label->set_justify(GTK_JUSTIFY_LEFT);
- this->notebook->pages().push_back(Gtk_Notebook_Helpers::TabElem(*table, *label));
- table->show();
- label->show();
- }
- }
- this->setType(1);
- debug("done\n");
- return 0;
-}
-
-void Gtk_LdapTreeItem::createPopupMenu() {
- debug("Gtk_LdapTreeItem::createPopupMenu()\n");
- Gtk_MenuItem *item;
-
- this->menu = new Gtk_Menu();
-
- item = new Gtk_MenuItem("Add");
- this->menu->add(*item);
- item = new Gtk_MenuItem("Delete");
- this->menu->add(*item);
- item = new Gtk_MenuItem();
- this->menu->add(*item);
- item = new Gtk_MenuItem("Cut");
- this->menu->add(*item);
- item = new Gtk_MenuItem("Copy");
- this->menu->add(*item);
- item = new Gtk_MenuItem("Paste");
- this->menu->add(*item);
- this->menu->show_all();
- this->menu->activate();
-}
-/*
-void Gtk_LdapTreeItem::show_impl() {
- debug("%s showed\n", this->dn);
-// Gtk_c_signals_Base *sig=(Gtk_c_signals_Base *)internal_getsignalbase();
-// sig->show(GTK_WIDGET(gtkobj()));
-}
-*/
-/*
-void Gtk_LdapTreeItem::select_impl() {
- debug("%s selected\n", this->dn);
- this->showDetails();
- Gtk_TreeItem::select_impl();
-}
-*/
-
-void Gtk_LdapTreeItem::collapse_impl() {
- debug("%s collapsed\n", this->dn);
- Gtk_TreeItem::collapse_impl();
-}
-
-void Gtk_LdapTreeItem::expand_impl() {
- debug("%s expanded\n",this->dn);
- Gtk_LdapTreeItem *item;
- G_List<GtkWidget> *list;
- Gtk_Tree *tree;
- Gtk_TreeItem::expand_impl();
-}
-
-void Gtk_LdapTreeItem::click() {
- debug("%s clicked\n", this->dn);
-}
-
-/*
-gint Gtk_LdapTreeItem::button_press_event_impl(GdkEventButton *p0) {
- debug("Gtk_LdapTreeItem::button_press_event_impl(%i)\n", p0->button);
- GdkEventButton *bevent = (GdkEventButton *) p0;
- if (p0->button == 3) gtk_menu_popup(this->menu->gtkobj(), NULL, NULL, NULL, NULL, bevent->button, bevent->time);
- Gtk_TreeItem::button_press_event_impl(p0);
-// Gtk_TreeItem::select_impl();
-}
-*/
-
-void Gtk_LdapTreeItem::item_drag_data_received(GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *data,
- guint info,
- guint time) {
- debug("Gtk_LdapTreeItem::item_drag_data_received\n");
- Gdk_DragContext gdc(context);
- if ((data->length >= 0) && (data->format == 8)) {
- cout << "Received \"" << (gchar *)data->data << "\" in label" << endl;
- Gtk_Widget::drag_finish(gdc, true, false, time);
- return;
- }
-
- Gtk_Widget::drag_finish(gdc , false, false, time);
-}
-
-gboolean Gtk_LdapTreeItem::target_drag_drop(GdkDragContext *context,
- gint x, gint y, guint theTime) {
- debug("Gtk_LdapTreeItem::target_drag_drop\n");
- cout << "drop" << endl;
- have_drag = false;
-
-// pixmap.set(trashcan_closed, trashcan_closed_mask);
-
- Gdk_DragContext gdc(context);
- Gdk_Atom *ga = static_cast <GdkAtom *>(context->targets->data);
- if (context->targets) {
- this->drag_get_data(gdc, *ga, theTime);
- return true;
- }
-
- return false;
-}
-
-
-void Gtk_LdapTreeItem::source_drag_data_get(GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info, guint32 time) {
- debug("Gtk_LdapTreeItem::source_drag_data_get\n");
- if (info == TARGET_ROOTWIN) {
- cout << "I was dropped on the rootwin" << endl;
- }
- else {
- if ( info == TARGET_URL ) {
- gtk_selection_data_set(selection_data,
- selection_data->target, 8,
- reinterpret_cast < const unsigned char * >
- ("file:///home/otaylor/images/weave.png"), 37);
- }
- else {
- gtk_selection_data_set(selection_data,
- selection_data->target, 8,
- reinterpret_cast <const unsigned char *>
- ("I'm Data!"), 9);
- }
- }
-}
-
-void Gtk_LdapTreeItem::source_drag_data_delete(GdkDragContext *context) {
- debug("Gtk_LdapTreeItem::source_drag_data_delete\n");
- debug("Delete the data!\n");
-}
-
-void Gtk_LdapTreeItem::target_drag_leave(GdkDragContext *context, guint time) {
- debug("Gtk_LdapTreeItem::target_drag_leave\n");
- this->have_drag = false;
-// pixmap.set(trashcan_closed, trashcan_closed_mask);
-}
-
+++ /dev/null
-#ifndef GTK_LDAPTREEITEM_H
-#define GTK_LDAPTREEITEM_H
-#include "gtk.h"
-#include "utils.h"
-#include <My_Window.h>
-#include <Gtk_LdapTree.h>
-#include <lber.h>
-#include <ldap.h>
-#include "icons/root_node.h"
-#include "icons/branch_node.h"
-#include "icons/leaf_node.h"
-#include "icons/alias_node.h"
-#include "icons/rfc822mailgroup_node.h"
-#include "icons/general_node.h"
-#include "icons/monitor.h"
-
-#define ROOT_NODE 1
-#define BRANCH_NODE 2
-#define LEAF_NODE 3
-
-class My_Window;
-class Gtk_LdapTree;
-
-class Gtk_LdapTreeItem : public Gtk_TreeItem {
-public:
- char *dn;
- char *rdn;
- char *objectClass;
- char *aliasedObjectName;
- LDAP *ld;
- LDAPMessage *result_identifier;
- My_Window *par;
- Gtk_Notebook *notebook;
- Gtk_HBox *xpm_label;
- Gtk_Menu *menu;
- enum
- {
- TARGET_STRING,
- TARGET_ROOTWIN,
- TARGET_URL
- };
- bool have_drag;
-
- //Functions
- Gtk_LdapTreeItem();
- Gtk_LdapTreeItem(char *c, My_Window *w, LDAP *ld);
- Gtk_LdapTreeItem(GtkTreeItem *t);
- ~Gtk_LdapTreeItem();
- void setDnd();
- gchar* getAttribute(char *c);
- Gtk_LdapTree* getSubtree(LDAP *ld, int i);
- void setType(int t);
- int getDetails();
- void createPopupMenu();
- int showDetails();
-// void show_impl();
-// void select_impl();
- void collapse_impl();
- void expand_impl();
- void click();
-// gint button_press_event_impl(GdkEventButton *p0);
- void item_drag_data_received (GdkDragContext *context,
- gint x, gint y, GtkSelectionData *data,
- guint info, guint32 time);
- gboolean target_drag_drop ( GdkDragContext *context,
- gint x, gint y, guint time);
-
- void source_drag_data_get(GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info, guint32 time);
- void source_drag_data_delete(GdkDragContext *context);
- void target_drag_leave(GdkDragContext *context, guint time);
-};
-
-static GtkTargetEntry target_table[] = {
- { "STRING", 0, Gtk_LdapTreeItem::TARGET_STRING },
- { "text/plain", 0, Gtk_LdapTreeItem::TARGET_STRING },
- { "text/uri-list", 0, Gtk_LdapTreeItem::TARGET_URL },
- { "application/x-rootwin-drop", 0, Gtk_LdapTreeItem::TARGET_ROOTWIN }
-};
-
-static guint n_targets = sizeof(target_table) / sizeof(target_table[0]);
-#endif
+++ /dev/null
-Please read this carefully
-
-To copile gtk-tool, although OpenLDAP in itself is a very out-of-the-box
-straightforward piece of code to compile gtk-tool isn't. You will require following:
-
- Gtk+1.2.x
- Gtk--1.1.x
-
-So, latest gtk stuff and if you successfully compiled and installed all that it should be easy. If you didn't I really hope you can take some comfort in that I have provided you with some snapshots of what the thing actually looks like. I hope in the near future I would be able to provide you with a static binary..next week perhaps..I don't know, I'm looking for a job right now so no promises...
-(I'm no longer looking for a job but the situation with spare time seems even worse - I wish I could do this full-time guys, I really do...)
-
-Pele
-pele@openldap.org
+++ /dev/null
-The OpenLDAP Public License
-
-Version 1.2, 1 September 1998
-Copyright 1998, The OpenLDAP Foundation.
-All Rights Reserved.
-
-Note:
- This license is derived from the "Artistic License" as distributed
- with the Perl Programming Language. As differences may exist, the
- complete license should be read.
-
-PREAMBLE
-
-The intent of this document is to state the conditions under which a
-Package may be copied, such that the Copyright Holder maintains some
-semblance of artistic control over the development of the package,
-while giving the users of the package the right to use and distribute
-the Package in a more-or-less customary fashion, plus the right to make
-reasonable modifications.
-
-Definitions:
-
- "Package" refers to the collection of files distributed by the
- Copyright Holder, and derivatives of that collection of files
- created through textual modification.
-
- "Standard Version" refers to such a Package if it has not been
- modified, or has been modified in accordance with the wishes
- of the Copyright Holder.
-
- "Copyright Holder" is whoever is named in the copyright or
- copyrights for the package.
-
- "You" is you, if you're thinking about copying or distributing
- this Package.
-
- "Reasonable copying fee" is whatever you can justify on the
- basis of media cost, duplication charges, time of people involved,
- and so on. (You will not be required to justify it to the
- Copyright Holder, but only to the computing community at large
- as a market that must bear the fee.)
-
- "Freely Available" means that no fee is charged for the item
- itself, though there may be fees involved in handling the item.
- It also means that recipients of the item may redistribute it
- under the same conditions they received it.
-
-1. You may make and give away verbatim copies of the source form of the
-Standard Version of this Package without restriction, provided that you
-duplicate all of the original copyright notices and associated disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications
-derived from the Public Domain or from the Copyright Holder. A Package
-modified in such a way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way, provided
-that you insert a prominent notice in each changed file stating how and
-when you changed that file, and provided that you do at least ONE of the
-following:
-
- a) place your modifications in the Public Domain or otherwise make them
- Freely Available, such as by posting said modifications to Usenet or
- an equivalent medium, or placing the modifications on a major archive
- site such as uunet.uu.net, or by allowing the Copyright Holder to include
- your modifications in the Standard Version of the Package.
-
- b) use the modified Package only within your corporation or organization.
-
- c) rename any non-standard executables so the names do not conflict
- with standard executables, which must also be provided, and provide
- a separate manual page for each non-standard executable that clearly
- documents how it differs from the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or
-executable form, provided that you do at least ONE of the following:
-
- a) distribute a Standard Version of the executables and library files,
- together with instructions (in the manual page or equivalent) on where
- to get the Standard Version.
-
- b) accompany the distribution with the machine-readable source of
- the Package with your modifications.
-
- c) accompany any non-standard executables with their corresponding
- Standard Version executables, giving the non-standard executables
- non-standard names, and clearly documenting the differences in manual
- pages (or equivalent), together with instructions on where to get
- the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this
-Package. You may charge any fee you choose for support of this Package.
-You may not charge a fee for this Package itself. However,
-you may distribute this Package in aggregate with other (possibly
-commercial) programs as part of a larger (possibly commercial) software
-distribution provided that you do not advertise this Package as a
-product of your own.
-
-6. The scripts and library files supplied as input to or produced as
-output from the programs of this Package do not automatically fall
-under the copyright of this Package, but belong to whomever generated
-them, and may be sold commercially, and may be aggregated with this
-Package.
-
-7. C subroutines supplied by you and linked into this Package in order
-to emulate subroutines and variables of the language defined by this
-Package shall not be considered part of this Package, but are the
-equivalent of input as in Paragraph 6, provided these subroutines do
-not change the language in any way that would cause it to fail the
-regression tests for the language.
-
-8. The name of the Copyright Holder may not be used to endorse or promote
-products derived from this software without specific prior written permission.
-
-9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-The End
+++ /dev/null
-HOME_LOCATION=$(shell pwd)
-CPLUS= g++
-OPTS=-g #-DDEBUG
-INCLUDES=`gtkmm-config --cflags` -I.
-GTKMMLIBS=`gtkmm-config --libs`
-LDFLAGS=-L/usr/lib -L/usr/X11/lib -L/usr/local/ldap/lib -lldap -llber -L/usr/local/kerberos/lib -lkrb5 -lkrb4 `gtkmm-config --libs`
-LIBS=-lXext -lgtkmm -lX11 -lXt -lXxf86dga
-
-.EXPORT_ALL_VARIABLES:
-
-SOURCES=My_Window.cc Gtk_LdapTree.cc Gtk_LdapTreeItem.cc Gtk_LdapServer.cc utils.cc main.o
-OBJECTS=My_Window.o Gtk_LdapTree.o Gtk_LdapTreeItem.o Gtk_LdapServer.o utils.o main.o
-
-################################################################################
-
-all: main
-main: $(OBJECTS)
- $(CPLUS) $(OBJECTS) -o main $(LDFLAGS) $(GTKMMLIBS)
- exec
-
-main.o: main.cc
- $(CPLUS) -c $(OPTS) $(INCLUDES) $<
-
-exec: all
- chmod a+x main
- ls -al main
-
-%.o: %.cc %.h
- $(CPLUS) -c $(OPTS) $(INCLUDES) $<
-
-clean:
- rm -f main a.out *.o straced core
+++ /dev/null
-#include <My_Window.h>
-
-My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
- debug("My_Window(t)\n");
- Gtk_VBox *main_hbox;
- Gtk_HBox *top_hbox;
- Gtk_VBox *bottom_hbox;
- Gtk_Menu *menu, *sub_menu;
- Gtk_MenuItem *new_menu, *file_menu, *options_menu, *menuitem;
- Gtk_CheckMenuItem *check_menuitem;
-
- pane = new Gtk_HPaned();
- this->scroller = new Gtk_ScrolledWindow();
- this->viewport = new Gtk_Viewport();
- this->scroller->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- this->scroller->add(*this->viewport);
- pane->add1(*this->scroller);
- this->scroller->show();
- this->viewport->show();
-
- this->scroller2 = new Gtk_ScrolledWindow();
- this->viewport2 = new Gtk_Viewport();
- this->scroller2->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- this->scroller2->add(*this->viewport2);
- pane->add2(*this->scroller2);
- this->scroller2->show();
- this->viewport2->show();
-
- top_hbox = new Gtk_HBox();
-
- menu = new Gtk_Menu();
-
- sub_menu = new Gtk_Menu();
- menuitem = new Gtk_MenuItem("Server");
- menuitem->activate.connect(slot(this,&My_Window::addServer));
- //connect_to_method(menuitem->activate, this, &addServer);
- sub_menu->append(*menuitem);
-// menuitem->show();
- new_menu = new Gtk_MenuItem("New...");
- new_menu->set_submenu(*sub_menu);
-// sub_menu->show();
- menu->append(*new_menu);
-// new_menu->show();
-
- menuitem = new Gtk_MenuItem("Quit");
- menuitem->activate.connect(Gtk_Main::quit.slot());
- menu->append(*menuitem);
-// menuitem->show();
- this->menubar = new Gtk_MenuBar();
- file_menu = new Gtk_MenuItem("File (?)");
- file_menu->set_submenu(*menu);
- this->menubar->append(*file_menu);
-// menu->show();
-
- menu = new Gtk_Menu();
- check_menuitem = new Gtk_CheckMenuItem("Show Debug Info");
- check_menuitem->toggled.connect(slot(this,&My_Window::setDebug));
- //connect_to_method(check_menuitem->toggled, this, &setDebug);
- menu->append(*check_menuitem);
- check_menuitem->show();
- options_menu = new Gtk_MenuItem("Options");
- options_menu->set_submenu(*menu);
- this->menubar->append(*options_menu);
-// menu->show();
-
-// file_menu->show();
-// options_menu->show();
-
-// top_hbox->pack_start(*this->menubar, TRUE, TRUE, 1);
-// this->menubar->show();
- this->urlfield = new Gtk_Entry();
- top_hbox->pack_start(*this->urlfield, TRUE, TRUE, 1);
-// this->urlfield->show();
- this->display_button = new Gtk_Button("Query Server");
- this->display_button->clicked.connect(slot(this, &My_Window::getHost));
- //connect_to_method(this->display_button->clicked, this, &getHost);
- top_hbox->pack_end(*this->display_button, FALSE, FALSE, 1);
-// this->display_button->show();
-
- this->status = new Gtk_Statusbar();
-// this->progress = new Gtk_ProgressBar();
-// this->status->add(*progress);
-// this->progress->show();
-
- bottom_hbox = new Gtk_VBox();
- bottom_hbox->pack_start(*pane, TRUE, TRUE, 1);
- bottom_hbox->pack_end(*status, FALSE, TRUE, 1);
- pane->show();
-// status->show();
-
- main_hbox = new Gtk_VBox();
- main_hbox->pack_start(*this->menubar, FALSE, FALSE, 1);
- main_hbox->pack_start(*top_hbox, FALSE, TRUE, 1);
- main_hbox->pack_end(*bottom_hbox, TRUE, TRUE, 1);
- top_hbox->show();
- bottom_hbox->show();
- this->add(*main_hbox);
- this->destroy.connect(Gtk_Main::quit.slot());
- main_hbox->show();
-// this->show_all();
-}
-
-My_Window::~My_Window() {
- cout << "~My_Window()" << endl;
- delete this;
-}
-
-int My_Window::debug(const char *format,...) {
- if (debug_level > 1) {
- va_list args;
- int ret;
- char *c;
- char buff[50];
- unsigned int m_context_id;
- va_start(args, format);
- ret = vprintf(format, args);
- /* if (this->status != NULL) {
- m_context_id = this->status->get_context_id("gtk-tool");
- ret = vsprintf(c, format, args);
- g_snprintf(buff, 50, "Action: %s", c);
- this->status->push(m_context_id, buff);
- }
- */ va_end(args);
- return ret;
- }
-}
-
-void My_Window::do_display() {
- cout << this->urlfield->get_text() << endl;
-}
-
-void My_Window::getHost() {
- debug("My_Window::getHost()\n");
- Gtk_Tree *tree, *subtree;
- Gtk_LdapServer *treeitem;
- char *host, *prt;
- int port;
-
-// viewport = (Gtk_Viewport *) GTK_VIEWPORT(this->scroller->children()->nth_data(1));
-// viewport = (Gtk_Viewport *)this->scroller->children()->nth_data(1);
- if (this->viewport->get_child()!=NULL) {
- tree = (Gtk_Tree *)(this->viewport->get_child());
- }
- else {
- tree = new Gtk_Tree();
- }
- string thing;
- thing = this->urlfield->get_text();
- gchar **c;
- c = g_strsplit(thing.c_str(), ":", 2);
- host = c[0];
- prt = c[1]; //strtok(NULL, "\0");
- if (prt != NULL) port = atoi(prt);
- else port = LDAP_PORT;
- treeitem = new Gtk_LdapServer(this, host, port);
- subtree = treeitem->getSubtree();
- tree->append(*treeitem);
- treeitem->set_subtree(*subtree);
- treeitem->show();
- this->viewport->add(*tree);
- tree->show();
- this->viewport->show();
- this->scroller->show();
- treeitem->select();
-}
-
-void My_Window::setDebug() {
- if (debug_level > 0) debug_level = 0;
- else debug_level = 1;
-}
-
-void My_Window::addServer() {
- debug("%s\n", "Creating new server");
- Gtk_Entry *entry = new Gtk_Entry();
-// entry->connect(slot(entry->activate, this, &getHost));
- entry->activate.connect(slot(this,&My_Window::getHost));
- this->dialog = new Gtk_InputDialog();
-// this->dialog->add(*entry);
-// entry->show();
- this->dialog->show();
-
-}
-
-gint My_Window::delete_event_impl(GdkEventAny*) {
- //Gtk_Main::instance()->quit();
- return 0;
-}
+++ /dev/null
-#ifndef MY_WINDOW_H
-#define MY_WINDOW_H
-#include "cpluscommon.h"
-#include "gtk.h"
-#include "Gtk_LdapServer.h"
-#include "Gtk_LdapTreeItem.h"
-
-extern int debug_level;
-
-class My_Window : public Gtk_Window {
-public:
- Gtk_ScrolledWindow *scroller, *scroller2;
- Gtk_Viewport *viewport, *viewport2;
- Gtk_Entry *urlfield;
- Gtk_Button *display_button;
- Gtk_InputDialog *dialog;
- Gtk_Paned *pane;
- Gtk_MenuBar *menubar;
-// Gtk_ProgressBar *progress;
- Gtk_Statusbar *status;
- My_Window(GtkWindowType t);
- ~My_Window();
- int debug(const char *c,...);
- void do_display();
- void addServer();
- void getHost();
- void setDebug();
- gint delete_event_impl(GdkEventAny *);
-};
-#endif
+++ /dev/null
-README for gtk-tool v0.7a
-
-This package has been tested and run with the latest Gtk+1.2/Gtk--1.1
-OpenLDAP 2.0-devel. It should also compile (i.e. it is backward-compatible) with
-the U-MICH (old) API but it has not been tested (read compiled) - however the siplicity of the "problem" and a few ifdefs lead me to believe everything should
-be allright with gtk-tool now. This thing doesn't run as it should, please
-read TODO!
-
-Just type 'make' to compile and if you have all the necessary stuff it'll do so.
-You do need the latest version of Gtk+ and Gtk-- (which may be tricky to build).
-You can also edit the Makefile and under "OPTS=-g" add " -DDEBUG" (line should
-read "OPTS=-g -DDEBUG") to get a trace of what the gtk-tool is doing (getting
-entries, traversing trees etc...)
-After that, hopefully all goes well, you start the thing by doing:
-./main -s localhost
-
-It no longer has a default base, instead it reads cn=config off your slapd
-and accordignly inserts all available databases under "localhost". If you are
-not running slapd on your local machine, then supply it with a "-s hostname"
-i.e.:
- ./main -s server02.nowhere.net
-
-or if you feel like having an adventure try multiple servers
-i.e.:
- ./main -s server02.nowhere.net -s server03.nowhere.com:322
-
-etc...
-It does not accept -b switch as it no longer needs it to aquire databases.
-There's also a -d <level> switch (try it with -d 1) for all the debug info.
-But please feel free to add whatever else you consider neccessary to
-understanding how this thing works. Enjoy, and I hope this can be useful to
-you in some miniscule way.
-
-All emails to -devel list, and plase make sure you put "GTK-TOOL"
-in the subject line, so other people who are not interested don't
-have to read our garbage.
-
-Pele
-pele@openldap.org
+++ /dev/null
-LOADS!!!
-
-Please someone test this with old U-MICH API - hopefully all is as it should be.
-
-Priorities:
- Now that we have cn=config we can start using ldap_get_option propperly
- and be able to run/stop server from the gtk-tool. Other things like
- new entries would now come in handy.
- Implement searches
- Integrate with OpenLDAP build - autoconf stuff (anyone?)
-
-Optional:
- comments in the source code
- port it to NT so we can use it with the NT port of OpenLDAP
- (they say that there is an NT port of Gtk+?)
-
-Pele
-pele@openldap.org
+++ /dev/null
-#ifndef MY_COMMON
-#define MY_COMMON
-
-#include "system.h"
-#include "cpluscommon.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <error.h>
-#include <string.h>
-extern int errno;
-extern int debug_level;
-#endif
+++ /dev/null
-#ifndef MY_CPLUS_COMMON
-#define MY_CPLUS_COMMON
-
-#include <iostream.h>
-#include <iomanip.h>
-#include <fstream.h>
-#include <strstream.h>
-#include <unistd.h>
-#include <stdio.h>
-#endif
+++ /dev/null
-#ifndef MY_GTK_INCLUDES
-#define MY_GTK_INCLUDES
-
-#include <gtk--.h>
-#include <gtk/gtk.h>
-#include <gtk--/widget.h>
-#include <gtk--/button.h>
-#include <gtk--/window.h>
-#include <gtk--/list.h>
-#include <gtk--/main.h>
-/*#include <gtk--sig.h>*/
-#include <gtk--/container.h>
-
-#endif
+++ /dev/null
-/* XPM */
-static char *alias_node[] = {
-/* columns rows colors chars-per-pixel */
-"19 20 28 1",
-" c Gray0",
-". c #010101010101",
-"X c #020202020202",
-"o c Gray1",
-"O c Gray2",
-"+ c #060606060606",
-"@ c #090909090909",
-"# c Gray6",
-"$ c Gray9",
-"% c Gray11",
-"& c #1d1d1d1d1d1d",
-"* c #7f7f78787f7f",
-"= c #909090900000",
-"- c #cfcfc8c86060",
-"; c #cfcfc8c86161",
-": c #d0d0c9c96262",
-"> c #d0d0c9c96363",
-", c #d1d1caca6565",
-"< c #d1d1caca6666",
-"1 c #ffffc8c89090",
-"2 c #ffffc8c89191",
-"3 c #ffffc9c99191",
-"4 c #fffff8f89090",
-"5 c #c0c0c0c0c0c0",
-"6 c #fffff8f8cfcf",
-"7 c #efefe8e8efef",
-"8 c #fffff8f8ffff",
-"9 c None",
-/* pixels */
-"9999999999999999999",
-"99===== 99999999999",
-"9=76644= 9999999999",
-"=-------======99999",
-"=666666666664- 9999",
-"=644444444441- 9999",
-"=644444441414- 9999",
-"=644444444141- 9999",
-"=644444141414- 9999",
-"****** 414141- 9999",
-"*88888 141411- 9999",
-"*88 8 414233;X9999",
-"*8 * 8.;:>,<<,+9999",
-"*8 888.o@#$&%$#9999",
-"*88888o999999999999",
-" .O999999999999",
-"9999999999999999999",
-"9999999999999999999",
-"9999999999999999999",
-"9999999999999999999"
-};
+++ /dev/null
-/* XPM */
-static char *branch_node[] = {
-/* columns rows colors chars-per-pixel */
-"19 20 10 1",
-" c Gray0",
-". c Gray40",
-"X c Magenta",
-"o c #999999990000",
-"O c #cccccccc6666",
-"+ c #ffffcccc9999",
-"@ c #ffffffff9999",
-"# c #ffffffffcccc",
-"$ c Gray100",
-"% c None",
-/* pixels */
-"%%%%%%%%%%%%%%%%%%%",
-"%%ooooo %%%%%%%%%%%",
-"%o$$##@O %%%%%%%%%%",
-"oOOOOOOOoooooo%%%%%",
-"o###########@O %%%%",
-"o#@@@@@@@@@@+O %%%%",
-"o#@@@@@@@+@+@@ %%%%",
-"o#@@@@@@@@+@+O %%%%",
-"o#@@@@@+@+@+@O %%%%",
-"o#@@@@@@+@+@+O %%%%",
-"o#@@@+@+@+@++@ %%%%",
-"o#+@+@+@+@+++O %%%%",
-"oOOOOOOOOOOOOO %%%%",
-"% %%%%",
-"%%%%%%%%%%%%%%%%%%%",
-"%%%%%%%%%%%%%%%%%%%",
-"%%%%%%%%%%%%%%%%%%%",
-"%%%%%%%%%%%%%%%%%%%",
-"%%%%%%%%%%%%%%%%%%%",
-"%%%%%%%%%%%%%%%%%%%"
-};
+++ /dev/null
-/* XPM */
-static char *general_node[] = {
-/* columns rows colors chars-per-pixel */
-"17 17 44 1",
-" c Gray0",
-". c #101000000000",
-"X c #000000003030",
-"o c #303020203030",
-"O c Gray19",
-"+ c #000030305151",
-"@ c #000020206161",
-"# c #000030306161",
-"$ c #414130304141",
-"% c #414141414141",
-"& c #515161615151",
-"* c #717171717171",
-"= c #101000008686",
-"- c #00000000aeae",
-"; c #30302020aeae",
-": c #00001010efef",
-"> c #20201010efef",
-", c #20202020efef",
-"< c #000051519e9e",
-"1 c #51514141efef",
-"2 c #61617171efef",
-"3 c #717182827171",
-"4 c #868671717171",
-"5 c #868671718686",
-"6 c #969692929696",
-"7 c #9e9ea2a29e9e",
-"8 c #9e9eaeae9e9e",
-"9 c #9e9ea2a2aeae",
-"0 c #aeaea2a2aeae",
-"q c #aeaeaeaeaeae",
-"w c #bebebebebebe",
-"e c #86868282efef",
-"r c #96968282efef",
-"t c #9e9ea2a2efef",
-"y c #9e9eaeaeefef",
-"u c #aeaeaeaeefef",
-"i c #bebebebeefef",
-"p c #cfcfcfcfdfdf",
-"a c #cfcfcfcfefef",
-"s c #cfcfdfdfefef",
-"d c #dfdfefefdfdf",
-"f c #efefdfdfefef",
-"g c #efefefefefef",
-"h c None",
-/* pixels */
-"hhhhhhhhhhhhhhhhh",
-"hh gggggggg hhhhh",
-"hh gg<gggg+ g hhh",
-"hh gg<<#+## hhh",
-"hh ggggggggggg hh",
-"hh ggggggggggg hh",
-"hX ggggggggggg hh",
-"h :=3 4gg hh",
-"h X>X5q gggggg hh",
-"h-,;%$6 fdgggg hh",
-"h 12e u 8wgggg hh",
-"h rtua .7&&gg hh",
-"hh yisg O9gggg hh",
-" o 4gg hh",
-"h * & gg hh",
-"h 808988pgggg hh",
-"hhh hh"
-};
+++ /dev/null
-/* XPM */
-static char *leaf_node[] = {
-/* columns rows colors chars-per-pixel */
-"16 20 33 1",
-" c Gray0",
-". c Gray19",
-"X c #303030306060",
-"o c #505050505050",
-"O c #5f5f5f5f5f5f",
-"+ c Gray44",
-"@ c #000000008080",
-"# c #000030309f9f",
-"$ c #30303030cfcf",
-"% c #000060609f9f",
-"& c #00006060cfcf",
-"* c #30306060cfcf",
-"= c #30306060ffff",
-"- c #0000cfcfffff",
-"; c #60609f9f9f9f",
-": c #6060ffffffff",
-"> c Magenta",
-", c #808080800000",
-"< c #9f9f9f9f6060",
-"1 c #cfcf9f9f6060",
-"2 c #808080808080",
-"3 c #9f9f9f9f9f9f",
-"4 c #9f9fcfcfcfcf",
-"5 c #ffffcfcf9f9f",
-"6 c #ffffffff9f9f",
-"7 c #c0c0c0c0c0c0",
-"8 c Gray81",
-"9 c #e0e0e0e0d0d0",
-"0 c #efefefefefef",
-"q c Gray94",
-"w c ivory",
-"e c Gray100",
-"r c None",
-/* pixels */
-"rrr+222222222rrr",
-"rrr+eeeeeeee3orr",
-"rrr+ewwwwwww3wor",
-"rrr+eww&&wwwo...",
-"rrr@&&&&w=qw83+o",
-"rr@;4$$:&qwq083o",
-"r@<6&ww$-&q0098o",
-"r+5=&&&&&&00998o",
-"+1*=&wwqw0q9098o",
-"O<#==77$=%00998o",
-",$X$====%009098o",
-"r$r %%%0090998o",
-"rr$+eqwq0909998o",
-"rrr+00099099998o",
-"rrr+88888888888o",
-"rrr+oooooooooooo",
-"rrrrrrrrrrrrrrrr",
-"rrrrrrrrrrrrrrrr",
-"rrrrrrrrrrrrrrrr",
-"rrrrrrrrrrrrrrrr"
-};
+++ /dev/null
-/* XPM */
-static char *local_server[] = {
-/* columns rows colors chars-per-pixel */
-"19 20 240 2",
-" c Gray0",
-". c #023e04130000",
-"X c #073b07af0360",
-"o c #000000000a4b",
-"O c #000000000f11",
-"+ c #0f580fce0000",
-"@ c #0000000010d0",
-"# c #07ab0eb01e98",
-"$ c #14b41637012b",
-"% c #168917a80ab2",
-"& c #175c18520a5a",
-"* c #1a0b1b520eb5",
-"= c #1e231e6d0bf9",
-"- c #17091db31bda",
-"; c #1aaf1bb4122d",
-": c #19741af214be",
-"> c #1c8d1df31118",
-", c #1ec01fc915d0",
-"< c #1ef51ff71651",
-"1 c #0000079e232a",
-"2 c #03a20f492c9f",
-"3 c #05590f692831",
-"4 c #072b113229fd",
-"5 c #0de317392448",
-"6 c #0e48163327ef",
-"7 c #09e713c52c71",
-"8 c #0ebe1619282b",
-"9 c #0e6d17482956",
-"0 c #0f4817eb299f",
-"q c #0c56160c2dcf",
-"w c #0f201a2425db",
-"e c #0be6165230b9",
-"r c #0d6917bd324a",
-"t c #0ff51a183470",
-"y c #10431cfd2b8f",
-"u c #15631d8a32e0",
-"i c #16811da73182",
-"p c #1f2f209a1346",
-"a c #1d4020891a22",
-"s c #171221aa2fcd",
-"d c #160d20113996",
-"f c #18d621893596",
-"g c #1d8e235a30e7",
-"h c #1e4226db3a44",
-"j c #1f4027663b36",
-"k c #1ebd282c3af4",
-"l c #21c022e615d4",
-"z c #224e22ab1570",
-"x c #24e325221696",
-"c c #2172227b18dd",
-"v c #2374248b1abd",
-"b c #25ae26bd18f5",
-"n c #257726891c6a",
-"m c #275c28461e3d",
-"M c #2ce52d5d1e67",
-"N c #2e0d317f1d9b",
-"B c #298b2a6f2027",
-"V c #2a5b2ae92075",
-"C c #2b1d2bb82201",
-"Z c #2b922c3522c4",
-"A c #2b8b2dfb26cc",
-"S c #224929923335",
-"D c #23892b663903",
-"F c #217c2aa73e75",
-"G c #280f2f9e3ac1",
-"H c #2f6231172843",
-"J c #28e4318f3d9b",
-"K c #2de4327f3c5e",
-"L c #385c392a2eb5",
-"P c #370e3bbe368b",
-"I c #3d973fff3561",
-"U c #200d2964419b",
-"Y c #21382a9542af",
-"T c #21372b164533",
-"R c #22882c8447b1",
-"E c #267e2f8a46a5",
-"W c #23f82e1d485b",
-"Q c #27c430b34778",
-"! c #277f30be48e2",
-"~ c #280330ee4794",
-"^ c #28c331ed4959",
-"/ c #28f9321f48f3",
-"( c #295232764a58",
-") c #2aab33ad4a5d",
-"_ c #2b9734644ad0",
-"` c #2b4234414b9a",
-"' c #2cdd35a14c17",
-"] c #2d9c3759502c",
-"[ c #35c73a1843c3",
-"{ c #348e39fb453b",
-"} c #36d33e394a1a",
-"| c #34a13d075244",
-" . c #34f73d7b5328",
-".. c #35983dbd5362",
-"X. c #36cc3f2f53d4",
-"o. c #37713fd854df",
-"O. c #3c1b41ef4a48",
-"+. c #382941505988",
-"@. c #3cb244ae5933",
-"#. c #413545b24744",
-"$. c #44c1455c418f",
-"%. c #428c464e4eb2",
-"&. c #49e74b17480e",
-"*. c #4b7a4b984919",
-"=. c #4b424c124924",
-"-. c #4e2b4ce1494c",
-";. c #4b5450bb574f",
-":. c #545f56ee543c",
-">. c #520055075b58",
-",. c #45ca4deb63f7",
-"<. c #47c54ea9618f",
-"1. c #477d4f716673",
-"2. c #48314fb16218",
-"3. c #4cd2542760ea",
-"4. c #4b93542768dd",
-"5. c #528858de6a23",
-"6. c #5d7f62a36740",
-"7. c #606162956770",
-"8. c #639c687068a6",
-"9. c #692e6b18620d",
-"0. c #6c456e4766cc",
-"q. c #6bc06e9068a9",
-"w. c #64656af87761",
-"e. c #6c7f6da9716d",
-"r. c #6e426e0971fc",
-"t. c #6eae6f6f73f0",
-"y. c #6f79716769b5",
-"u. c #75af75d26eec",
-"i. c #71a275b87813",
-"p. c #7dc582a986da",
-"a. c #862d47a59174",
-"s. c #885b47d79329",
-"d. c #8fac5b4596fb",
-"f. c #898d7a518c04",
-"g. c #8a1b7bb78c25",
-"h. c #9ff76cefabfe",
-"j. c #a01373e4a9c2",
-"k. c #a9327743af85",
-"l. c #813c82307990",
-"z. c #81e482da7a7f",
-"x. c #82a183727b14",
-"c. c #833e83de7b92",
-"v. c #83248602867e",
-"b. c #8b538c308b37",
-"n. c #8f4d99148ef8",
-"m. c #8ddd9240969e",
-"M. c #9b689b8586d9",
-"N. c #953097a99355",
-"B. c Gray58",
-"V. c #96d09842970f",
-"C. c #979799719910",
-"Z. c #9b579caa9ae3",
-"A. c #9ba99d2a9c8f",
-"S. c Gray62",
-"D. c #99659de1a359",
-"F. c #ac17ab8b9ea2",
-"G. c Gray64",
-"H. c #a007a1f1a793",
-"J. c #a2a1a27ea639",
-"K. c #a1c7a6b9ac80",
-"L. c Gray66",
-"P. c #aa08ab5ba86e",
-"I. c #aaa1aa8daa8b",
-"U. c #adedaf8bae65",
-"Y. c #a8ffaf75b90b",
-"T. c #ad0bb5d3aca9",
-"R. c #afcab577bbfb",
-"E. c #b3cab37fae09",
-"W. c #b065b1f7b0b8",
-"Q. c #b1f1b1efb1e7",
-"!. c #b0b0b090b228",
-"~. c #b27fb26eb259",
-"^. c #b34ab4cdb34c",
-"/. c #b6f9b7c3b6c1",
-"(. c #b2d3b572b8bd",
-"). c #b679bc3fbfdf",
-"_. c #b94dba06b74f",
-"`. c #bb54bb51bb4c",
-"'. c #bf9eb931bc1d",
-"]. c Gray74",
-"[. c #bd72bdc7bee1",
-"{. c #bebbbe54bf75",
-"}. c #c12dc14abd26",
-"|. c #c23ec236c1f7",
-" X c Gray76",
-".X c #c3e8c682c6e7",
-"XX c #c6c6c7c3c0d5",
-"oX c #c1a0c68acf26",
-"OX c #c506c896cf5d",
-"+X c #c991ca28ccd9",
-"@X c Gray80",
-"#X c #cdcccceccccd",
-"$X c #cf73c67ed0d0",
-"%X c #c95fcc81d1c3",
-"&X c #ca18cce0d140",
-"*X c #ce76d0ddd44f",
-"=X c #cfc6d296d6cb",
-"-X c #d1e9d451d713",
-";X c #d559d665d6c9",
-":X c #d501d68ed787",
-">X c Gray84",
-",X c #d543d771d9f9",
-"<X c #d4b6d7e8dea1",
-"1X c #d827d709d5f4",
-"2X c #da4fd4fadc81",
-"3X c #d8d6dac9dcbd",
-"4X c #dd07dc27db7b",
-"5X c #dd63de3ddd35",
-"6X c #dc48de00dfa1",
-"7X c #dbe2de33e22f",
-"8X c #dd72dfafe2a2",
-"9X c #dfd1df87e12e",
-"0X c #dfcee12ae24a",
-"qX c #e039e165e29f",
-"wX c #e3b6e4b4e55c",
-"eX c #e360e516e7b7",
-"rX c #e623e518e29f",
-"tX c #e674e93eeb1a",
-"yX c #e722e8f8eacf",
-"uX c #eb0aec94ee5b",
-"iX c #ebb6ed47ee96",
-"pX c #ef4af08af194",
-"aX c #f120f318ef4d",
-"sX c #f197f142f2ce",
-"dX c #f1a3f2def53d",
-"fX c #f330f431f4ea",
-"gX c #f3fbf485f52c",
-"hX c Gray97",
-"jX c #f6b4f7b7f8d7",
-"kX c #f632f8aaf7ce",
-"lX c #f5ebf828fd61",
-"zX c #fc48fffff501",
-"xX c #f9a9f9affb15",
-"cX c #fafafbe4fa37",
-"vX c #f83df975fc09",
-"bX c Gray99",
-"nX c #fcdbfd0ffc96",
-"mX c #ffffffd4feaf",
-"MX c Gray100",
-"NX c None",
-/* pixels */
-"Z L .X%X&X*X-X,X3X6X0XwXwXqX:X0.NXNXNX",
-"C z tX<X7XeXyXuXpXfXhXbXnXgXdXy.NXNXNX",
-"V x K.D 5 G O.;.6.i.v.V.A.C.MXz.NXNXNX",
-"B b _.$.9 U j f q 7 4 3 1 O MXc.NXNXNX",
-"m l /.=.F 1.5.<.` ! ( ( R 0 MXx.NXNXNX",
-"n p ^.&.k 4.2.../ E E ~ T 0 MXz.NXNXNX",
-"v > W.=.h ,.X._ | ) E Q T 6 MXl.NXNXNX",
-"c * U.*.u +.@.o. .` ^ ) W 8 MXl.NXNXNX",
-"< % P.-.i ] ' Y d t r e 2 @ mXl.NXNXNX",
-", & D.{ # g K [ %.>.7.e.t.r.MXx.NXNXNX",
-"; & ).Y.R.oXOX=X8XiXjXvXlXkXaX9.NXNXNX",
-"X A H I 8.w.3.} J s y w - a : NXNXNX",
-" NXNX NX . P S o NX NXNXNX",
-"M $ + M.}.E.F.XX(.m.p.q.:.#.N = NXNXNX",
-"'.rXzXcXMXxXsX9X4X1X#X{.!.J.N.u.NXNXNX",
-"j.h.2XT.;X+X|.H.[.].~.I.G.Z.n.f.NXNXNX",
-"a.s.k.$X5X>X@X X`.Q.L.S.B.b.g.d.NXNXNX",
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX",
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX",
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX"
-};
+++ /dev/null
-/* XPM */
-static char *monitor[] = {
-/* columns rows colors chars-per-pixel */
-"19 19 260 2",
-" c Gray0",
-". c #0433043a0433",
-"X c Gray2",
-"o c #062c06220626",
-"O c #0cb40cb50cb4",
-"+ c #0ccd0d540d92",
-"@ c #0d8e0d760e8b",
-"# c Gray6",
-"$ c #10530f801046",
-"% c #10da10c610d7",
-"& c #117f11721184",
-"* c #11f8120d120c",
-"= c Gray7",
-"- c #13a7139113a8",
-"; c #142214191519",
-": c Gray9",
-"> c #18e718f318ea",
-", c #19a719aa19a1",
-"< c Gray12",
-"1 c #234e23382345",
-"2 c #27ad279627c0",
-"3 c #2a872a822a84",
-"4 c #2e0d2de92dfb",
-"5 c Gray24",
-"6 c #3dd03e053df5",
-"7 c #6dde57513ad0",
-"8 c #78ae78d132cd",
-"9 c #7fc87faf3a4e",
-"0 c #417d416c41f8",
-"q c #43c544184427",
-"w c #4594460145b7",
-"e c Gray28",
-"r c #48b8489a48b0",
-"t c #49ba49a849b8",
-"y c #4c834c894c48",
-"u c Gray30",
-"i c Gray31",
-"p c #4fb251055619",
-"a c #55e2566a426c",
-"s c #507c5060506d",
-"d c #5122511750e7",
-"f c #520551f75202",
-"g c Gray32",
-"h c #536853575355",
-"j c #558b557d5578",
-"k c #561455fa5621",
-"l c #531353795e7a",
-"z c #588d58a8589d",
-"x c Gray35",
-"c c #5adf5ad25ada",
-"v c #5bb45b5e5bd6",
-"b c #593c59f85ef7",
-"n c #5cc55d315d83",
-"m c #5da35da05d68",
-"M c Gray37",
-"N c #5f285f3e5f24",
-"B c #59d65dcc6463",
-"V c #5bf95e1566e2",
-"C c #4a576f134a1d",
-"Z c #4c067f2f4c3e",
-"A c #659966275b42",
-"S c #7df565484934",
-"D c Gray38",
-"F c #607761f96387",
-"G c #63f964176407",
-"H c #646f6454646f",
-"J c #64fb65246521",
-"K c #65fe66076606",
-"L c #661f65e76612",
-"P c Gray40",
-"I c #662166a2670b",
-"U c #669667186662",
-"Y c #671c674c672b",
-"T c #624b677e6c07",
-"R c #628a676a6d3a",
-"E c #64d764fd6e4d",
-"W c #655e65cc6e6f",
-"Q c #668e672c6c5e",
-"! c #64e36a126edf",
-"~ c #6eae6f8f62d7",
-"^ c #68f368de690a",
-"/ c #69d969e66a08",
-"( c #69f96a6469be",
-") c #6af16afd6aff",
-"_ c Gray42",
-"` c #6b7d6be06e14",
-"' c #6bb06c496c6a",
-"] c #6cb76cba6cb7",
-"[ c #6d8c6d806d6a",
-"{ c #6c076dfa6f68",
-"} c Gray43",
-"| c #6fc56fda6fa1",
-" . c #66f166e871f5",
-".. c #6a7f6ad97350",
-"X. c #6aee705f75d2",
-"o. c #6ec4724d76ee",
-"O. c #70116fbd7026",
-"+. c #70c26f4a7124",
-"@. c #72996fba72bc",
-"#. c Gray44",
-"$. c #70f0712570c3",
-"%. c #719a71a371c2",
-"&. c #72b372bc7299",
-"*. c #7355733672f5",
-"=. c Gray45",
-"-. c #712f71e47703",
-";. c #7457744d7480",
-":. c #752374e174e1",
-">. c Gray46",
-",. c #7630765675ec",
-"<. c #7660767f7688",
-"1. c #777a7778778d",
-"2. c #72e572f77e86",
-"3. c #71a774037abe",
-"4. c #778677f97e30",
-"5. c #77aa780b7795",
-"6. c #77fb7806780c",
-"7. c #79c570ac7a0a",
-"8. c Gray47",
-"9. c #795579317930",
-"0. c Gray48",
-"q. c #7aff7b1e7b62",
-"w. c #7bc57bbc7b80",
-"e. c #7c3d7bfd7bf5",
-"r. c #7cbd7cd57c8f",
-"t. c Gray49",
-"y. c #7dd67e417e2e",
-"u. c #7ef17f057ece",
-"i. c #7f3c7ef87f3a",
-"p. c Gray50",
-"a. c #7e5e794984ba",
-"s. c #7efa7858883b",
-"d. c #3a32a4303a10",
-"f. c #7f0e802f5593",
-"g. c #47f3d9d747ed",
-"h. c #7df58115862a",
-"j. c #80427f288146",
-"k. c #876b879d4763",
-"l. c #814681036c33",
-"z. c #c9c7849537bf",
-"x. c #f0f6a65957f2",
-"c. c #f3ecf3e9321d",
-"v. c #ff25fefa3c32",
-"b. c #c79cc70d7fb9",
-"n. c #80898076804c",
-"m. c #80ee814b8120",
-"M. c #812c81338115",
-"N. c #8218820b81e7",
-"B. c Gray51",
-"V. c #832d82e3833e",
-"C. c #8361836b8333",
-"Z. c #83ed83c78414",
-"A. c #846b8463848a",
-"S. c #84e1851e84ac",
-"D. c Gray52",
-"F. c #85fa864a8620",
-"G. c #867d867a8661",
-"H. c #874486e4873e",
-"J. c Gray53",
-"K. c #807c815489e4",
-"L. c #80ef80b38a26",
-"P. c #84b683d98c0f",
-"I. c #8808876f87e6",
-"U. c #8ab183538acf",
-"Y. c #880e87bd880f",
-"T. c #8f3485e48ef9",
-"R. c #887d88628873",
-"E. c #88e2890188c4",
-"W. c #8915891388de",
-"Q. c #8a0a89c78a0e",
-"!. c Gray54",
-"~. c #8ad38b0d8b09",
-"^. c #8b7a8ae18b80",
-"/. c #8bb78b818ba7",
-"(. c Gray55",
-"). c #8d4b8ce08d0f",
-"_. c #8da38dc08d9e",
-"`. c #8e2e8dc88e29",
-"'. c #8eb28e598ea6",
-"]. c #8ea98f258eca",
-"[. c Gray56",
-"{. c #908f879d90be",
-"}. c #90768ef190e7",
-"|. c #91ce8ee691f7",
-" X c Gray57",
-".X c #91fb91f39203",
-"XX c #91e4922091fe",
-"oX c #921f91f59219",
-"OX c #920a920a91f4",
-"+X c #92bd9279928f",
-"@X c #930092d792e6",
-"#X c #933792de936c",
-"$X c #937d936f9376",
-"%X c #94bd909d9776",
-"&X c Gray58",
-"*X c #953a95209549",
-"=X c Gray59",
-"-X c #975f9792979d",
-";X c #980d985b9837",
-":X c #98e4990298fc",
-">X c Gray60",
-",X c #9a729a479aac",
-"<X c #9b179b4c9b51",
-"1X c #9bca9c0f9c01",
-"2X c Gray61",
-"3X c #9dda9d6c9d9a",
-"4X c #9dd79dc69e13",
-"5X c Gray62",
-"6X c #9fb19faa9fd2",
-"7X c #9fbda856a021",
-"8X c #a5e89ff7a63c",
-"9X c #b13bb1f1808e",
-"0X c #a0c1a094a15d",
-"qX c #a17aa0e8a162",
-"wX c Gray63",
-"eX c #a1dba20da20b",
-"rX c #a255a249a257",
-"tX c #a315a2e7a359",
-"yX c Gray64",
-"uX c #a424a3f7a3d6",
-"iX c #a4b2a48da4b2",
-"pX c #a55ea54ea56a",
-"aX c #a5d4a63da5e6",
-"sX c #a6e4a679a73f",
-"dX c #a74da730a73e",
-"fX c #a851a80da7f3",
-"gX c Gray66",
-"hX c #a8d2a8baa93b",
-"jX c #a9c8a9a4a9cb",
-"kX c #a9f6aa0ba9f6",
-"lX c #aaf9aaf9aac9",
-"zX c #ab3dab08aaec",
-"xX c #ac1eabdfac00",
-"cX c #ac74ac77ac86",
-"vX c #ad0aac7cad0b",
-"bX c #ae9cae5bae85",
-"nX c #aed5aeeaaf01",
-"mX c #aec9af12aef4",
-"MX c #afe0af87b031",
-"NX c Gray69",
-"BX c #b16ab13bb150",
-"VX c #b1bfb1deb20e",
-"CX c #b1d0b201b1c9",
-"ZX c #b20cb16eb233",
-"AX c Gray70",
-"SX c #b47db456b437",
-"DX c #b500b515b4f6",
-"FX c Gray71",
-"GX c #b635b607b65e",
-"HX c #b7afb78bb787",
-"JX c Gray72",
-"KX c #bab0bafdbb0d",
-"LX c #bc13bb8abc3c",
-"PX c #bf61befebf78",
-"IX c Gray75",
-"UX c #c0eac148c0ce",
-"YX c #c23dc1eec270",
-"TX c #c3f5c376c49a",
-"RX c Gray79",
-"EX c #d690d590d6c8",
-"NX c None",
-/* pixels */
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX",
-"KX[.EXTXPXIXLXZXNXMXsXwX0X4X&X+XR.NXNX",
-"HX`.qX2 V.FXc 1 gXoX4 L 4XJ < !.C.NXNX",
-"DX'.^. F.vXH M bXN.O K ,Xh : =Xn.NXNX",
-"CX).'.. G.vXeXJ.:.D.* P @XpXNXt.e.NXNX",
-"mX!.!.. D.jX6 # 6Xq.o N X&.3 ) t.NXNX",
-"xXY.R.X A.hXe , zXR._.:XA.i O ].9.NXNX",
-"hXA.C. i.iXr > iX(.t.N ,.j % !.>.NXNX",
-"aXi./.5 X3Xr , iX1.# z ~.f & J.&.NXNX",
-"tX9.yXkXr.H.t , rX;.- G F.d = S.#.NXNX",
-"6X8.I.$ v #X0 ; ,X' + n y.q @ y.} NXNX",
-"2X>.8X7.{.%XL. .K.h.R X.o...l E ` NXNX",
-">X@.7Xg.d.s.b.c.f.P.x.z.V 9Xv.k.W NXNX",
-"=X+.}.Z C a.l.9 A 3.S 7 B ~ 8 a Q NXNX",
-"$X] |.T.U.j.4.2.-.{ ! T F b l p I NXNX",
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX",
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX",
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX",
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX"
-};
+++ /dev/null
-/* XPM */
-static char *remote_server[] = {
-/* columns rows colors chars-per-pixel */
-"19 20 240 2",
-" c Gray0",
-". c #023e04130000",
-"X c #073b07af0360",
-"o c #000000000a4b",
-"O c #000000000f11",
-"+ c #0f580fce0000",
-"@ c #0000000010d0",
-"# c #07ab0eb01e98",
-"$ c #14b41637012b",
-"% c #168917a80ab2",
-"& c #175c18520a5a",
-"* c #1a0b1b520eb5",
-"= c #1e231e6d0bf9",
-"- c #17091db31bda",
-"; c #1aaf1bb4122d",
-": c #19741af214be",
-"> c #1c8d1df31118",
-", c #1ec01fc915d0",
-"< c #1ef51ff71651",
-"1 c #0000079e232a",
-"2 c #03a20f492c9f",
-"3 c #05590f692831",
-"4 c #072b113229fd",
-"5 c #0de317392448",
-"6 c #0e48163327ef",
-"7 c #09e713c52c71",
-"8 c #0ebe1619282b",
-"9 c #0e6d17482956",
-"0 c #0f4817eb299f",
-"q c #0c56160c2dcf",
-"w c #0f201a2425db",
-"e c #0be6165230b9",
-"r c #0d6917bd324a",
-"t c #0ff51a183470",
-"y c #10431cfd2b8f",
-"u c #15631d8a32e0",
-"i c #16811da73182",
-"p c #1f2f209a1346",
-"a c #1d4020891a22",
-"s c #171221aa2fcd",
-"d c #160d20113996",
-"f c #18d621893596",
-"g c #1d8e235a30e7",
-"h c #1e4226db3a44",
-"j c #1f4027663b36",
-"k c #1ebd282c3af4",
-"l c #21c022e615d4",
-"z c #224e22ab1570",
-"x c #24e325221696",
-"c c #2172227b18dd",
-"v c #2374248b1abd",
-"b c #25ae26bd18f5",
-"n c #257726891c6a",
-"m c #275c28461e3d",
-"M c #2ce52d5d1e67",
-"N c #2e0d317f1d9b",
-"B c #298b2a6f2027",
-"V c #2a5b2ae92075",
-"C c #2b1d2bb82201",
-"Z c #2b922c3522c4",
-"A c #2b8b2dfb26cc",
-"S c #224929923335",
-"D c #23892b663903",
-"F c #217c2aa73e75",
-"G c #280f2f9e3ac1",
-"H c #2f6231172843",
-"J c #28e4318f3d9b",
-"K c #2de4327f3c5e",
-"L c #385c392a2eb5",
-"P c #370e3bbe368b",
-"I c #3d973fff3561",
-"U c #200d2964419b",
-"Y c #21382a9542af",
-"T c #21372b164533",
-"R c #22882c8447b1",
-"E c #267e2f8a46a5",
-"W c #23f82e1d485b",
-"Q c #27c430b34778",
-"! c #277f30be48e2",
-"~ c #280330ee4794",
-"^ c #28c331ed4959",
-"/ c #28f9321f48f3",
-"( c #295232764a58",
-") c #2aab33ad4a5d",
-"_ c #2b9734644ad0",
-"` c #2b4234414b9a",
-"' c #2cdd35a14c17",
-"] c #2d9c3759502c",
-"[ c #35c73a1843c3",
-"{ c #348e39fb453b",
-"} c #36d33e394a1a",
-"| c #34a13d075244",
-" . c #34f73d7b5328",
-".. c #35983dbd5362",
-"X. c #36cc3f2f53d4",
-"o. c #37713fd854df",
-"O. c #3c1b41ef4a48",
-"+. c #382941505988",
-"@. c #3cb244ae5933",
-"#. c #413545b24744",
-"$. c #44c1455c418f",
-"%. c #428c464e4eb2",
-"&. c #49e74b17480e",
-"*. c #4b7a4b984919",
-"=. c #4b424c124924",
-"-. c #4e2b4ce1494c",
-";. c #4b5450bb574f",
-":. c #545f56ee543c",
-">. c #520055075b58",
-",. c #45ca4deb63f7",
-"<. c #47c54ea9618f",
-"1. c #477d4f716673",
-"2. c #48314fb16218",
-"3. c #4cd2542760ea",
-"4. c #4b93542768dd",
-"5. c #528858de6a23",
-"6. c #5d7f62a36740",
-"7. c #606162956770",
-"8. c #639c687068a6",
-"9. c #692e6b18620d",
-"0. c #6c456e4766cc",
-"q. c #6bc06e9068a9",
-"w. c #64656af87761",
-"e. c #6c7f6da9716d",
-"r. c #6e426e0971fc",
-"t. c #6eae6f6f73f0",
-"y. c #6f79716769b5",
-"u. c #75af75d26eec",
-"i. c #71a275b87813",
-"p. c #7dc582a986da",
-"a. c #862d47a59174",
-"s. c #885b47d79329",
-"d. c #8fac5b4596fb",
-"f. c #898d7a518c04",
-"g. c #8a1b7bb78c25",
-"h. c #9ff76cefabfe",
-"j. c #a01373e4a9c2",
-"k. c #a9327743af85",
-"l. c #813c82307990",
-"z. c #81e482da7a7f",
-"x. c #82a183727b14",
-"c. c #833e83de7b92",
-"v. c #83248602867e",
-"b. c #8b538c308b37",
-"n. c #8f4d99148ef8",
-"m. c #8ddd9240969e",
-"M. c #9b689b8586d9",
-"N. c #953097a99355",
-"B. c Gray58",
-"V. c #96d09842970f",
-"C. c #979799719910",
-"Z. c #9b579caa9ae3",
-"A. c #9ba99d2a9c8f",
-"S. c Gray62",
-"D. c #99659de1a359",
-"F. c #ac17ab8b9ea2",
-"G. c Gray64",
-"H. c #a007a1f1a793",
-"J. c #a2a1a27ea639",
-"K. c #a1c7a6b9ac80",
-"L. c Gray66",
-"P. c #aa08ab5ba86e",
-"I. c #aaa1aa8daa8b",
-"U. c #adedaf8bae65",
-"Y. c #a8ffaf75b90b",
-"T. c #ad0bb5d3aca9",
-"R. c #afcab577bbfb",
-"E. c #b3cab37fae09",
-"W. c #b065b1f7b0b8",
-"Q. c #b1f1b1efb1e7",
-"!. c #b0b0b090b228",
-"~. c #b27fb26eb259",
-"^. c #b34ab4cdb34c",
-"/. c #b6f9b7c3b6c1",
-"(. c #b2d3b572b8bd",
-"). c #b679bc3fbfdf",
-"_. c #b94dba06b74f",
-"`. c #bb54bb51bb4c",
-"'. c #bf9eb931bc1d",
-"]. c Gray74",
-"[. c #bd72bdc7bee1",
-"{. c #bebbbe54bf75",
-"}. c #c12dc14abd26",
-"|. c #c23ec236c1f7",
-" X c Gray76",
-".X c #c3e8c682c6e7",
-"XX c #c6c6c7c3c0d5",
-"oX c #c1a0c68acf26",
-"OX c #c506c896cf5d",
-"+X c #c991ca28ccd9",
-"@X c Gray80",
-"#X c #cdcccceccccd",
-"$X c #cf73c67ed0d0",
-"%X c #c95fcc81d1c3",
-"&X c #ca18cce0d140",
-"*X c #ce76d0ddd44f",
-"=X c #cfc6d296d6cb",
-"-X c #d1e9d451d713",
-";X c #d559d665d6c9",
-":X c #d501d68ed787",
-">X c Gray84",
-",X c #d543d771d9f9",
-"<X c #d4b6d7e8dea1",
-"1X c #d827d709d5f4",
-"2X c #da4fd4fadc81",
-"3X c #d8d6dac9dcbd",
-"4X c #dd07dc27db7b",
-"5X c #dd63de3ddd35",
-"6X c #dc48de00dfa1",
-"7X c #dbe2de33e22f",
-"8X c #dd72dfafe2a2",
-"9X c #dfd1df87e12e",
-"0X c #dfcee12ae24a",
-"qX c #e039e165e29f",
-"wX c #e3b6e4b4e55c",
-"eX c #e360e516e7b7",
-"rX c #e623e518e29f",
-"tX c #e674e93eeb1a",
-"yX c #e722e8f8eacf",
-"uX c #eb0aec94ee5b",
-"iX c #ebb6ed47ee96",
-"pX c #ef4af08af194",
-"aX c #f120f318ef4d",
-"sX c #f197f142f2ce",
-"dX c #f1a3f2def53d",
-"fX c #f330f431f4ea",
-"gX c #f3fbf485f52c",
-"hX c Gray97",
-"jX c #f6b4f7b7f8d7",
-"kX c #f632f8aaf7ce",
-"lX c #f5ebf828fd61",
-"zX c #fc48fffff501",
-"xX c #f9a9f9affb15",
-"cX c #fafafbe4fa37",
-"vX c #f83df975fc09",
-"bX c Gray99",
-"nX c #fcdbfd0ffc96",
-"mX c #ffffffd4feaf",
-"MX c Gray100",
-"NX c None",
-/* pixels */
-"Z L .X%X&X*X-X,X3X6X0XwXwXqX:X0.NXNXNX",
-"C z tX<X7XeXyXuXpXfXhXbXnXgXdXy.NXNXNX",
-"V x K.D 5 G O.;.6.i.v.V.A.C.MXz.NXNXNX",
-"B b _.$.9 U j f q 7 4 3 1 O MXc.NXNXNX",
-"m l /.=.F 1.5.<.` ! ( ( R 0 MXx.NXNXNX",
-"n p ^.&.k 4.2.../ E E ~ T 0 MXz.NXNXNX",
-"v > W.=.h ,.X._ | ) E Q T 6 MXl.NXNXNX",
-"c * U.*.u +.@.o. .` ^ ) W 8 MXl.NXNXNX",
-"< % P.-.i ] ' Y d t r e 2 @ mXl.NXNXNX",
-", & D.{ # g K [ %.>.7.e.t.r.MXx.NXNXNX",
-"; & ).Y.R.oXOX=X8XiXjXvXlXkXaX9.NXNXNX",
-"X A H I 8.w.3.} J s y w - a : NXNXNX",
-" NXNX NX . P S o NX NXNXNX",
-"M $ + M.}.E.F.XX(.m.p.q.:.#.N = NXNXNX",
-"'.rXzXcXMXxXsX9X4X1X#X{.!.J.N.u.NXNXNX",
-"j.h.2XT.;X+X|.H.[.].~.I.G.Z.n.f.NXNXNX",
-"a.s.k.$X5X>X@X X`.Q.L.S.B.b.g.d.NXNXNX",
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX",
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX",
-"NXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNXNX"
-};
+++ /dev/null
-/* XPM */
-static char *rfc822mailgroup_node[] = {
-/* columns rows colors chars-per-pixel */
-"19 20 188 2",
-" c Gray0",
-". c #07ec07f907f3",
-"X c #182314d8146d",
-"o c #1e231c221704",
-"O c #19be18a01d49",
-"+ c #1e561e181f78",
-"@ c #1dd61e7e2152",
-"# c #1fde1fb822c6",
-"$ c #20a31fc52305",
-"% c #21e6216923e3",
-"& c #23b623892600",
-"* c #248021b820a9",
-"= c #2f322c592663",
-"- c #2d2b2f472fb9",
-"; c #39b03c313cd7",
-": c #6ec620f41c4a",
-"> c #444b3fab42c8",
-", c #416e41f64689",
-"< c #42e543e1448b",
-"1 c #4cbe4fcc5163",
-"2 c #4ced4f405230",
-"3 c #4d034f715233",
-"4 c #4cea501b5125",
-"5 c #4d7552225212",
-"6 c #4f0d523b5357",
-"7 c #4e7f5151541e",
-"8 c #69b86c9a6ada",
-"9 c #6ea16d54712e",
-"0 c #75906b666109",
-"q c #70166ce2720b",
-"w c #77e778e075e8",
-"e c #820e74fc7d5a",
-"r c #85b87b917708",
-"t c #915b7e0f6e32",
-"y c #9a5e7e7c8a53",
-"u c #939484d477b3",
-"i c #abd7840f7bf8",
-"p c #83d18068847e",
-"a c #8bb880a78829",
-"s c #885288778970",
-"d c #89e388af89f7",
-"f c #8ad58beb8c02",
-"g c #948587d780da",
-"h c #953f810c8d16",
-"j c #903389da8ddb",
-"k c #90d38d838ffc",
-"l c #95aa886e8a91",
-"z c #90c591b28ac7",
-"x c #948091a58e4a",
-"c c Gray58",
-"v c #95bc945095b4",
-"b c #953c9543959d",
-"n c #9624972597cc",
-"m c #973b94549946",
-"M c #99a593bd96a6",
-"N c #9cd0975c9c3a",
-"B c #9cee9c29942e",
-"V c #9af499929e79",
-"C c #9ffa9e3fa019",
-"Z c #a79084328fe5",
-"A c #a7eb8ca69735",
-"S c #a28d8e35987a",
-"D c #a160956e9bb9",
-"F c #a11a964d9eac",
-"G c #b69a9d9aacf5",
-"H c #a57fa2159dcf",
-"J c #a866a1f49301",
-"K c #b249a4cb8be6",
-"L c #a40ba35fa567",
-"P c #aa20ab3eac0e",
-"I c #b141a8c0ad2e",
-"U c #b4b8abccaada",
-"Y c #b66eacbdaa0c",
-"T c #b46dadc5b088",
-"R c #b954a7eeb2f9",
-"E c #b6abb013b44e",
-"W c Gray71",
-"Q c #b724b7bbb862",
-"! c #b7fdba01b8c5",
-"~ c #bf11b3c6b779",
-"^ c Gray72",
-"/ c #ba9bb8ffba6e",
-"( c #bc41bd36bf2d",
-") c #bf4dc73fc925",
-"_ c #c16bad47ae4f",
-"` c #c4adac0fac1e",
-"' c #c99bbe96a1dd",
-"] c #cdc7bed6a35d",
-"[ c #c2bab293b434",
-"{ c #c0f1b999b8cc",
-"} c #c995b3c1b26a",
-"| c #ceceb062b0a4",
-" . c #d4c9ba53b1cf",
-".. c #c8f9ba29c4cb",
-"X. c #cb67bde2c81c",
-"o. c #cbd2bc75ca58",
-"O. c #d1d6bb50c77d",
-"+. c #c29bc064bd9d",
-"@. c #da7ecaf8af12",
-"#. c #db3ad18bb699",
-"$. c #e1fdd073b2e1",
-"%. c #f38ae2a6be16",
-"&. c #c45fc94cc8fc",
-"*. c #c98ec715c6fe",
-"=. c #cdd9cb75c361",
-"-. c #cbfdc9b1ca87",
-";. c #c940cc27d0be",
-":. c #caf8cd6ad331",
-">. c #cf6ed365d5f7",
-",. c #d191c301ce2c",
-"<. c #d1e5ccb0cfdc",
-"1. c #d670cde4cfcb",
-"2. c #d55fc433d1e3",
-"3. c #d4edcfb7d3f9",
-"4. c #da77cd44d11e",
-"5. c #dc54cd67dbf8",
-"6. c #d493d2dfcd5d",
-"7. c #d296d516dbd1",
-"8. c #d307d5e6da14",
-"9. c #dbddd262d49d",
-"0. c #deeed007d441",
-"q. c #ddddd53fd59d",
-"w. c #de3ed638d560",
-"e. c #d8c8d6f0db5e",
-"r. c #df88d22ad81e",
-"t. c #de4bd5abdaaf",
-"y. c #dee2db6bd34f",
-"u. c #dfa7db2bdcb5",
-"i. c #eddbc33cc98e",
-"p. c #e3dad086d1d2",
-"a. c #e218d5fbd86e",
-"s. c #e2bfd7ffdba9",
-"d. c #e325d765db4b",
-"f. c #e0d1da19da1c",
-"g. c #e0fedc7bdf13",
-"h. c #e391df6edc8f",
-"j. c #e50fdbfddeb0",
-"k. c #eb5fdb16d71e",
-"l. c #f03bddfadcf2",
-"z. c #e3d0dc36e364",
-"x. c #e24bdf83e33f",
-"c. c #e300def1e2be",
-"v. c #e2b0de09e412",
-"b. c #e334df1fe43b",
-"n. c #e2efe2e5ddde",
-"m. c #ffffefa7d2cd",
-"M. c #ff9ef4c5d83d",
-"N. c #e036e30ae01d",
-"B. c #e227e002e294",
-"V. c #e7d2e46fe31a",
-"C. c #e6cae51ae728",
-"Z. c #e8f3e3cfe3f8",
-"A. c #e87fe5c0e77e",
-"S. c #eab9e60de6a3",
-"D. c #e8b5e415e83d",
-"F. c #e94ae426e933",
-"G. c #eb09e86ae626",
-"H. c #e9a1eadeeea5",
-"J. c #e92deb70eed0",
-"K. c #eb91e966ecc8",
-"L. c #ed64eb3bedbf",
-"P. c #ee1bee85eeca",
-"I. c #ed44ebedf06b",
-"U. c #eed8ecd1f1a2",
-"Y. c #f197e5d0e989",
-"T. c #f6f2e0cdeaef",
-"R. c #f02dea01e9b5",
-"E. c #f192ea47ee91",
-"W. c #f016eff5f204",
-"Q. c #f96ceda8f62c",
-"!. c #f053f0daf4ac",
-"~. c #f5ddf1e3f730",
-"^. c #f606f36ef6c8",
-"/. c #f570f42bf44a",
-"(. c #f52ff1f5f892",
-"). c #f4f3f51ef9ab",
-"_. c #f726f6cfffff",
-"`. c #f7dcf835f989",
-"'. c #f7a7f8adfbd6",
-"]. c #fbb3f497f63e",
-"[. c #f88ff59ffc7c",
-"{. c #f818f99dfb5e",
-"}. c #fd46f943fd84",
-"|. c #feadfb96ff2b",
-" X c #ff97fceeffba",
-".X c #ff5afd52ffff",
-"XX c Gray100",
-"oX c None",
-/* pixels */
-"oXoXoXoXoXoX = 0 X oXoXoXoXoXoXoXoXoX",
-"oXoXoXoXoXoXoXo u oXoXoXoXoXoXoXoXoX",
-"oXoXoXoXoXoX #.XXg oX oXoXoXoXoXoX",
-"oXoXoXoXoX @.m.' %.r 9 * oXoXoXoXoX",
-"oXoXoXoX ] $.J z ^ XXXXE oXoXoXoXoX",
-"oXoXoX K M.B &.XX.XY.}.XX> oXoXoXoXoX",
-"oXoXoXt .Y w.p.| _ } ` l.l oXoXoX",
-"< 5 H k.X.[ U y Z D S A F o.q . oXoXoX",
-"a R T.,._.).I.L.W.J.F.K.4.i.N.+ oXoXoX",
-"e h O.G ..P.G.Z.B.u.q.D.i : { & oXoXoX",
-"j I Q.5.2.E.S.C.b.d.0.z.n 8 ) % oXoXoX",
-"b ! XXH.+.1.P ( 3.j.t.e.n.].7.$ oXoXoX",
-"c W XXx.L V d M ~ T v.h.6.f.;.$ oXoXoX",
-"c W Xc.N f k m C p w x *.g.:.$ oXoXoX",
-"v / XXR.V.A.s.a.r.9.=.-.<.y.>.# oXoXoX",
-"s Q XX`.{.'.[.^.~.(./.!.U.|.8.@ oXoXoX",
-"- ; 6 4 1 1 1 1 1 1 3 2 3 7 , O oXoXoX",
-"oXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoX",
-"oXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoX",
-"oXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoXoX"
-};
+++ /dev/null
-/* XPM */
-static char *root_node[] = {
-/* columns rows colors chars-per-pixel */
-"19 20 49 1",
-" c #313131310000",
-". c #313131313131",
-"X c #000000006363",
-"o c #000031316363",
-"O c #313131316363",
-"+ c #000042424242",
-"@ c #00007b7b7b7b",
-"# c #313163636363",
-"$ c #636363633131",
-"% c #5a5a5a5a5a5a",
-"& c #7b7b7b7b7b7b",
-"* c #31313131ffff",
-"= c #000042428484",
-"- c #313163639c9c",
-"; c #31316363cece",
-": c #636363639c9c",
-"> c #00009c9c3131",
-", c #31319c9c3131",
-"< c #63639c9c3131",
-"1 c #63639c9c6363",
-"2 c #31319c9ccece",
-"3 c #31319c9cffff",
-"4 c #0000ceceffff",
-"5 c Cyan",
-"6 c #63639c9c9c9c",
-"7 c #63639c9ccece",
-"8 c #63639c9cffff",
-"9 c #6363ceceffff",
-"0 c #9c9c00000000",
-"q c #cece00000000",
-"w c Magenta",
-"e c #848484844242",
-"r c #9c9c9c9c6363",
-"t c #848484848484",
-"y c Gray58",
-"u c Gray71",
-"i c #84848484ffff",
-"p c #9c9ccececece",
-"a c #9c9cceceffff",
-"s c #8484ffffffff",
-"d c #a5a5cecef7f7",
-"f c #ffff9c9c9c9c",
-"g c #cececece9c9c",
-"h c #c6c6c6c6c6c6",
-"j c #c6c6dedec6c6",
-"k c #cecececeffff",
-"l c #ceceffffcece",
-"z c Gray100",
-"x c None",
-/* pixels */
-"xxxxx&t&&txxxxxxxxx",
-"xxxhujds9u&&xxxxxxx",
-"xxhzzdadd1<1 xxxxxx",
-"x7zhjdag&1e,$ xxxxx",
-"x7ddkuj61e&$, xxxxx",
-"7asapryt&.@>., xxxx",
-"7983py&z5l.., xxxx",
-"2i226&z5l54.%. xxxx",
-"272;:t5l545.. xxxx",
-"22;-$&h5454. . xxxx",
-"---1.,&454.&.. xxxx",
-"-*##$#+...&zq0xxxxx",
-"xXO++. + . qfq0xxxx",
-"xxXoOo+.. . qfq0xxx",
-"xxxXX+=++ ..xqq0xxx",
-"xxxxx.....xxxx..xxx",
-"xxxxxxxxxxxxxxxxxxx",
-"xxxxxxxxxxxxxxxxxxx",
-"xxxxxxxxxxxxxxxxxxx",
-"xxxxxxxxxxxxxxxxxxx"
-};
+++ /dev/null
-#include "cpluscommon.h"
-#include "gtk.h"
-#include <lber.h>
-#include <ldap.h>
-#include <My_Window.h>
-#include <Gtk_LdapItem.h>
-#include <Gtk_LdapServer.h>
-
-int debug_level = 0;
-
-target_drag_leave(GdkDragContext *context, guint time) {
-}
-
-int main(int argc, char **argv) {
- My_Window *window;
- Gtk_LdapItem *treeresult;
- Gtk_Tree *tree = NULL, *subtree = NULL;
- Gtk_Tree *machine, *machinetree;
- Gtk_LdapServer *server;
- Gtk_Viewport *viewport;
- char *host = NULL, *prt = NULL;
- char *base_dn = NULL;
- int c, port = 0;
- GList *hosts = NULL;
- int host_count = 0;
- char *pair[2];
-
- //hosts = new G_List<char>();
- while ((c = getopt(argc, argv, "d:s:p:h")) != -1) {
- switch (c) {
- case 'd':
- debug_level = atoi(optarg);
- break;
- case 's':
- debug("host\n");
- hosts = g_list_append(hosts, (strdup(optarg)));
- break;
- case 'p':
- port = atoi(optarg); break;
- case 'h':
- default:
- fprintf(stderr, "Usage: %s [-d level] [-s server[:port]]*\n", argv[0]);
- exit(-1);
- }
- fprintf(stderr,"b");
- }
- debug("%i hosts\n", g_list_length(hosts));
- if (g_list_length(hosts) == 0) {
-#ifndef LDAP_GET_OPT
- ldap_get_option(NULL, LDAP_OPT_HOST_NAME, host);
-#endif /* LDAP_GET_OPT */
- if (host!=NULL) {
- hosts = g_list_append(hosts, host);
- debug("Default host: %s\n", host);
- } else {
-#ifndef LDAP_GET_OPT
- fprintf(stderr,"Why isn't your LDAP_OPT_HOST_NAME defined?\n");
-#endif
- fprintf(stderr,"Supply me with a host please (hint: use -s)\n");
- }
- } else {
- for (int f=0; f<g_list_length(hosts); f++) {
- debug("%s\n", g_list_nth(hosts,f)->data);
- }
- }
- if (port == 0) port = LDAP_PORT;
-
- Gtk_Main m(&argc, &argv);
-
- window = new My_Window(GTK_WINDOW_TOPLEVEL);
-
- if (hosts!=NULL) {
- tree = new Gtk_Tree();
- window->viewport->add(*tree);
- for (int f=0; f<g_list_length(hosts); f++) {
- host = strtok((char*)g_list_nth(hosts, f)->data, ":");
- prt = strtok(NULL, "\0");
- if (prt != NULL) port = atoi(prt);
- else port = LDAP_PORT;
- server = new Gtk_LdapServer(window, host, port);
- subtree = server->getSubtree();
- tree->append(*server);
- server->set_subtree(*subtree);
- server->show();
- }
- //window->viewport->add(*tree);
-// tree->show();
- }
-
-// window->viewport->show();
-// window->scroller->show();
-
- //Select first server
- if (tree != NULL) {
- Gtk_LdapTree::ItemList &items = tree->tree();
- Gtk_LdapTree::ItemList::iterator i = items.begin();
- server = (Gtk_LdapServer *)(* i);
- // server->select_impl();
- }
-
- window->set_title("gtk-tool");
- window->activate();
- window->set_usize(600, 500);
-
- window->set_events(window->get_events()|GDK_ALL_EVENTS_MASK);
- window->drag_dest_set(GTK_DEST_DEFAULT_ALL, target_table, n_targets, static_cast <GdkDragAction> (GDK_ACTION_COPY|GDK_ACTION_MOVE));
- window->drag_source_set(static_cast<GdkModifierType>(GDK_BUTTON1_MASK|GDK_BUTTON3_MASK), target_table, n_targets, static_cast<GdkDragAction>(GDK_ACTION_COPY|GDK_ACTION_MOVE));
- window->drag_leave.connect(window->slot(window,target_drag_leave));
- window->show_all();
-
- m.run();
- return 0;
-}
+++ /dev/null
-#ifndef MY_SYSTEM_H
-#define MY_SYSTEM_M
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <linux/string.h> /* for memcpy.h */
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <stdarg.h>
-
-extern int debug_level;
-
-int debug(const char *format,...) {
- if (debug_level > 0) {
-//#ifdef DEBUG
- va_list args;
- int ret;
- va_start(args, format);
- ret = vprintf(format, args);
- va_end(args);
- return ret;
-//#endif
- }
-}
+++ /dev/null
-#ifndef MY_UTIL_H
-#define MY_UTIL_H
-int debug(const char *format,...);
-#endif /* MY_UTIL_H */
+++ /dev/null
-aliasedObjectName,Aliased Object Name,TRUE
-associatedname,Associated Name,TRUE
-associateddomain,Associated Domain,TRUE
-audio,Audio Sample,TRUE
-cn,Common Name,TRUE
-dn,Distinguished Name,TRUE
-description,Description,TRUE
-documentauthor,Document Author,TRUE
-drink,Favourite Drink,TRUE
-errorsto,Errors To,TRUE
-facsimiletelephonenumber,Fax Number,TRUE
-fax,Fax Number,TRUE
-homephone,Home Telephone Number,TRUE
-homepostaladdress,Home Postal Address,TRUE
-joinable,Can be joined,TRUE
-jpegphoto,Photograph,TRUE
-krbname,Kerberos Name,FALSE
-l,Location,TRUE
-labeledurl,Web Page,TRUE
-lastmodifiedby,Last Modified by,TRUE
-lastmodifiedtime,Last Modified at,TRUE
-mail,E-mail,TRUE
-manager,Manager,TRUE
-member,Mambers,TRUE
-mobile,Mobile Phone Number,TRUE
-mobiletelephonenumber,Mobile Phone Number,TRUE
-modifytimestamp,Modified at,TRUE
-modifiersname,Modified by,TRUE
-multilinedescription,Multi-lined description,TRUE
-naminglink,Naming Link,TRUE
-nobatchupdates,No Batch Updates,FALSE
-notice,Notice,TRUE
-o,Organization,TRUE
-objectclass,Object Class,TRUE
-onvacation,On Vacation,TRUE
-ou,Organizational Unit,TRUE
-owner,Owner,TRUE
-pager,Pager Number,TRUE
-pagertelephonenumber,Pager Number,TRUE
-personalsignature,Personal Signature,TRUE
-photo,Photograph,TRUE
-postaladdress,Postal Address,TRUE
-reciprocalnaminglink,Reciprocal Naming Link,TRUE
-requeststo,Requests To,TRUE
-secretary,Secretary,TRUE
-seealso,See Also,TRUE
-sn,Surname,TRUE
-st,State,TRUE
-streetaddress,Streed Address,TRUE
-telephonenumber,Telephone Number,TRUE
-title,Title,TRUE
-userpassword,User Password,TRUE
-uid,User ID,TRUE
+++ /dev/null
-aliasedObjectName,Aliased Object Name,TRUE
-associatedname,Associated Name,TRUE
-associateddomain,Associated Domain,TRUE
-audio,Audio Sample,TRUE
-cn,Common Name,TRUE
-dn,Distinguished Name,TRUE
-description,Description,TRUE
-documentauthor,Document Author,TRUE
-drink,Favourite Drink,TRUE
-errorsto,Errors To,TRUE
-facsimiletelephonenumber,Fax Number,TRUE
-fax,Fax Number,TRUE
-homephone,Home Telephone Number,TRUE
-homepostaladdress,Home Postal Address,TRUE
-joinable,Can be joined,TRUE
-jpegphoto,Photograph,TRUE
-krbname,Kerberos Name,TRUE
-l,Location,TRUE
-labeledurl,Web Page,TRUE
-lastmodifiedby,Last Modified by,TRUE
-lastmodifiedtime,Last Modified at,TRUE
-mail,E-mail,TRUE
-manager,Manager,TRUE
-member,Mambers,TRUE
-mobile,Mobile Phone Number,TRUE
-mobiletelephonenumber,Mobile Phone Number,TRUE
-modifytimestamp,Modified at,TRUE
-modifiersname,Modified by,TRUE
-multilinedescription,Multi-lined description,TRUE
-naminglink,Naming Link,TRUE
-nobatchupdates,No Batch Updates,TRUE
-notice,Notice,TRUE
-o,Organization,TRUE
-objectclass,Object Class,TRUE
-onvacation,On Vacation,TRUE
-ou,Organizational Unit,TRUE
-owner,Owner,TRUE
-pager,Pager Number,TRUE
-pagertelephonenumber,Pager Number,TRUE
-personalsignature,Personal Signature,TRUE
-photo,Photograph,TRUE
-postaladdress,Postal Address,TRUE
-reciprocalnaminglink,Reciprocal Naming Link,TRUE
-requeststo,Requests To,TRUE
-secretary,Secretary,TRUE
-seealso,See Also,TRUE
-sn,Surname,TRUE
-st,State,TRUE
-streetaddress,Streed Address,TRUE
-telephonenumber,Telephone Number,TRUE
-title,Title,TRUE
-userpassword,User Password,TRUE
-uid,User ID,TRUE
+++ /dev/null
-<?
-include 'include/ldap_entry_attribute.inc';
-class ldap_entry {
- var $attributes;
- var $dn;
- var $parent;
- var $attributeCount;
- var $link_identifier;
- var $r_e_i;
-
- cfunction ldap_entry($l_i) {
- // echo "creating new ldap_entry<br>\n";
- $this->link_identifier = $l_i;
- }
-
- cfunction getAttributes() {
- $i=0;
- $attrib = new ldap_entry_attribute($this->dn);
- $n = ldap_first_attribute($this->link_identifier, $this->r_e_i, &$ber);
- while ($n) {
- $attrib->name = $n;
- $attrib->getValues($this->link_identifier,$this->r_e_i);
- $this->attributes[$i] = $attrib;
- $i++;
- $attrib = new ldap_entry_attribute($this->dn);
- $n = ldap_next_attribute($this->link_identifier, $this->r_e_i, $ber);
- }
- }
-
- cfunction formatHTMLDN($dn) {
- global $FILE, $host;
- $string = "";
- $attribs = ldap_explode_dn($dn, 0);
- $names = ldap_explode_dn($dn, 1);
- for ($i=0; $i<$attribs["count"]; $i++) {
- $s = $attribs[$i];
- for ($j=$i+1; $j<$attribs["count"]; $j++) {
- $s .= ",".$attribs[$j];
- }
- if (($s[0] == "c") && ($s[1] == "n")) {
- $string .= "<a href=".$FILE."?ldap_action=read&base_dn=".urlencode($s).">".$names[$i]."</a>";
- }
- else {
- $string .= "<a href=".$FILE."?ldap_action=list&base_dn=".urlencode($s).">".$names[$i]."</a>";
- }
- if ($i<$attribs["count"]-1) { $string .= ", "; }
- }
- return $string;
- }
-
- cfunction formatHTMLAttributes() {
- global $FILE, $host;
- $s = "";
- $s .= "<tr>\n\t";
- $s .= '<td colspan=2 bgcolor="#9380DB" align="center" valign="middle">';
- $s .= "\n\t\t<h3 class=head>".$this->formatHTMLDN($this->dn)."</h3>\n";
- $s .= "\t\t</td>\n\t</tr>\n";
- $c = count($this->attributes);
- for ($i=0; $i<$c; $i++) {
- $attrib = $this->attributes[$i];
- if ($attrib->isVisible($attrib->name) == "TRUE") {
- $s .= $attrib->formatHTMLValues();
- }
- }
- $a = $this->attributes[0];
- $v = $a->values[1];
- if ($v == "organizationalUnit" || $v == "organization") {
- $s .= "<tr>\n\t<td colspan=2>\n";
- $s .= "\t\t<a href=".$FILE."?host=".urlencode($host)."&ldap_action=list&base_dn=".urlencode($this->dn).">Browse</a>\n";
- $s .= "\t\t</td>\n\t</tr>\n";
- }
- else if ($v == "person") {
- $s .= "<tr>\n\t<td colspan=2>\n";
- $s .= "\t\t<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&admin_action=modify&base_dn=".urlencode($this->dn).">Modify</a>\n";
- $s .= "\t\t</td>\n\t</tr>\n";
- }
- else {
- $s .= "<tr>\n\t<td colspan=2>\n\t\t \n\t\t</td>\n\t</tr>\n";
- }
- return $s;
- }
-
- cfunction display() {
- global $FILE, $host;
- echo "<tr><td colspan=2 bgcolor=gray>";
- echo "<h3>".ldap_dn2ufn($this->dn)."</h3>";
- echo "</td></tr>";
- $c = count($this->attributes);
- for ($i=0; $i<$c; $i++) {
- $attrib = $this->attributes[$i];
- $attrib->display();
- }
- $a = $this->attributes[0];
- $v = $a->values[1];
- if ($v == "organizationalUnit" || $v == "organization") {
- echo "<tr><td colspan=2>";
- echo "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=list&base_dn=".urlencode($this->dn).">Browse</a>";
- echo "</td></tr>";
- }
- else {
- echo "<tr><td colspan=2> </td></tr>";
- }
- }
-}
-?>
+++ /dev/null
-<?
-class ldap_entry_attribute {
- var $name, $values, $parent;
- cfunction ldap_entry_attribute($d) {
- // echo "creating new ldap_entry_attribtute<br>\n";
- $this->dn = $d;
- $a = ldap_explode_dn($this->dn, 1);
- $this->cn = $a[0];
- }
-
- cfunction getAttributeName($string) {
- global $prefs;
- for ($i=0; $i<count($prefs->attribute_names); $i++) {
- if ($prefs->attribute_names[$i][0] == $string) {
- return $prefs->attribute_names[$i][1];
- }
- }
- return $string;
- }
- cfunction isVisible($string) {
- global $prefs;
- for ($i=0; $i<count($prefs->attribute_names); $i++) {
- if ($prefs->attribute_names[$i][0] == $string) {
- return $prefs->attribute_names[$i][2];
- }
- }
- return "FALSE";
- }
-
- cfunction getValues($l_i, $r_e_i) {
- //echo "My name is ".$this->name."<br>\n";
- $this->values = ldap_get_values($l_i, $r_e_i, $this->name);
- }
-
- cfunction display() {
- echo "<tr>\n\t<td valign=top bgcolor=white>\n";
- echo "\t\t".$this->name."\n\t\t</td>\n\t<td valign=top bgcolor=lightyellow>\n";
- echo "<ul type=square>\n";
- for($i=0; $i<$this->values["count"]; $i++) {
- //echo "Displaying value ".$i."<br>\n";
- echo "<li>";
- $this->displayValue($i);
- echo "<br>\n";
- }
- echo "</ul>\n";
- echo "</td>\n</tr>\n";
- }
-
- cfunction formatHTMLValues() {
- $ct = $this->values["count"];
- $str = "";
- $str .= "<tr>\n\t<td valign=top bgcolor=white>\n";
- $n = $this->getAttributeName($this->name);
- $str .= "\t\t".$n."\n\t\t</td>\n\t<td valign=top bgcolor=lightyellow>\n\t\t<ul type=square>\n";
- // if ($ct > 1) {
- // $str .= "\t\t<ul type=square>\n";
- // }
- for ($i=0; $i<$this->values["count"]; $i++) {
- $str .= "\t\t\t<li>";
- $str .= $this->formatHTMLValue($i);
- $str .= "<br>\n";
- }
- //if ($ct > 1) { $str .= "\t\t\t</ul>\n"; }
- $str .= "\t\t\t</ul>\n\t\t</td>\n\t</tr>\n";
- return $str;
- }
-
- cfunction formatHTMLValue($index) {
- global $prefs, $FILE, $host;
- $p = "";
- switch ($this->name) {
- case "cn":
- $p .= "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
- break;
- case "ou":
- $p .= "<a href=".$FILE."?ldap_action=list&host=".urlencode($host)."&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
- break;
- case "seealso":
- case "member":
- case "requeststo":
- case "errorsto":
- case "owner":
- case "lastmodifiedby":
- case "modifiersname":
- $p .= "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->values[$index]).">".ldap_dn2ufn($this->values[$index])."</a>";
- break;
- case "mail":
- $p .= "<a href=mailto:".$this->values[$index].">".$this->values[$index]."</a>";
- break;
- case "postaladdress":
- case "homepostaladdress":
- $i=0;
- $tok = strtok($this->values[$index], "$");
- while ($tok) {
- $p .= $i." ".$tok."<br>\n";
- $tok = strtok("$");
- $i++;
- }
- break;
- case "labeledurl":
- $tok = strtok($this->values[$index], " ");
- $tok2 = strtok("\0");
- $p .= '<a href='.$tok.'>'.$tok2.'</a>';
- break;
- case "lastmodifiedtime":
- case "modifytimestamp":
- $t = $this->values[$index];
- $hour = (int) $t[6].$t[7];
- $minute = (int) $t[8].$t[9];
- $second = (int) $t[10].$t[11];
- $month = (int) $t[2].$t[3];
- $day = (int) $t[4].$t[5];
- $year = (int) $t[0].$t[1];
- $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
- $date = date("h:i:sa, on l, dS of F Y", $timestamp);
- $p .= $date;
- break;
- case "jpegphoto":
- $p .= '<a href="'.$prefs->get("PATH.photo").'?base_dn='.urlencode($this->dn).'"><img src="'.$prefs->get("PATH.photo").'?base_dn='.urlencode($this->dn).'" alt="Image of '.$this->cn.'" border=0></a>';
- break;
- default:
- $p .= $this->values[$index];
- break;
- }
- return $p;
- }
-
- cfunction displayValue($index) {
- //echo "ldap_entry_attribute.displayValue(".$index.")<br>\n";
- global $FILE, $host;
- if ($this->name == "cn") {
- print "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
- }
- else if ($this->name == "ou") {
- print "<a href=".$FILE."?ldap_action=list&host=".urlencode($host)."&base_dn=".urlencode($this->dn).">".$this->values[$index]."</a>";
- }
- else if ($this->name == "seealso" || $this->name == "member" || $this->name == "requeststo" || $this->name == "errorsto" || $this->name == "owner" || $this->name == "lastmodifiedby" || $this->name == "modifiersname") {
- print "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&base_dn=".urlencode($this->values[$index]).">".ldap_dn2ufn($this->values[$index])."</a>";
- }
- else if ($this->name == "mail") {
- print "<a href=mailto:".$this->values[$index].">".$this->values[$index]."</a>";
- }
- else if ($this->name == "labeledurl") {
- $tok = strtok($this->values[$index], " ");
- $tok2 = strtok("\0");
- print '<a href='.$tok.'>'.$tok2.'</a>';
- }
- else if ($this->name == "lastmodifiedtime" || $this->name == "modifytimestamp") {
- $t = $this->values[$index];
- $hour = (int) $t[6].$t[7];
- $minute = (int) $t[8].$t[9];
- $second = (int) $t[10].$t[11];
- $month = (int) $t[2].$t[3];
- $day = (int) $t[4].$t[5];
- $year = (int) $t[0].$t[1];
- $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
- $date = date("h:i:sa, on l, dS of F Y", $timestamp);
- // $date = getdate($timestamp);
- // $date = getdate($this->values[$index]);
- // echo "".$date["hours"].":".$date["minutes"].",
- // ".$date["weekday"].",".$date["month"]." ".$date["mday"].", ".$date["year"]."<br>\n";
- print $date;
- }
- else {
- print $this->values[$index];
- }
- }
-}
-?>
+++ /dev/null
-<?
-include 'include/ldap_entry.inc';
-class ldap_manager {
- var $entries;
- var $result_identifier, $search_filter, $base_dn;
- var $ldap_action, $host;
- var $link_identifier;
- var $entriesCount;
-
- function connect($host) {
- $this->link_identifier = ldap_connect($host);
- if ($this->link_identifier) return 1;
- return 0;
- }
-
- function disconnect() {
- ldap_close($this->link_identifier);
- }
-
- function ldapTakeAction($a = "search") {
- $func_ptr = "ldap_".$a;
- if ($this->result_identifier = $func_ptr($this->link_identifier, $this->base_dn, $this->search_filter)) {
- $this->entriesCount = ldap_count_entries($this->link_identifier, $this->result_identifier);
- return 1;
- }
- return 0;
- }
-
- cfunction getEntries() {
- $i=0;
- $entry = new ldap_entry($this->link_identifier);
- $entry->r_e_i = ldap_first_entry($this->link_identifier, $this->result_identifier);
- while($entry->r_e_i) {
- $entry->dn = ldap_get_dn($this->link_identifier, $entry->r_e_i);
- $entry->getAttributes();
- $this->entries[$i] = $entry;
- $i++;
- $r = $entry->r_e_i;
- $entry = new ldap_entry($this->link_identifier);
- $entry->r_e_i = ldap_next_entry($this->link_identifier, $r);
- }
-// ldap_free_result($this->result_identifier);
- }
-
- cfunction displayEntries() {
- echo $this->formatHTMLEntries();
- }
-
- cfunction formatHTMLBaseDN($dn) {
- global $FILE, $host;
- $string = "";
- $attribs = ldap_explode_dn($dn, 0);
- $names = ldap_explode_dn($dn, 1);
- for ($i=0; $i<$attribs["count"]; $i++) {
- $s = $attribs[$i];
- for ($j=$i+1; $j<$attribs["count"]; $j++) {
- $s .= ",".$attribs[$j];
- }
- if (($s[0] == "c") && ($s[1] == "n")) {
- $string .= "<a href=".$FILE."?ldap_action=read&base_dn=".urlencode($s).">".$names[$i]."</a>, ";
- }
- else {
- $string .= "<a href=".$FILE."?ldap_action=list&base_dn=".urlencode($s).">".$names[$i]."</a>, ";
- }
- }
- return $string;
- }
-
- cfunction formatHTMLEntries() {
- $string = "";
- $string .= '<table width="100%" border=1 cellpadding=0 cellspacing=0>';
- $string .= "\n";
- for ($i=0; $i<count($this->entries); $i++) {
- $e = $this->entries[$i];
- $string .= $e->formatHTMLAttributes();
- }
- $string .= "</table>\n";
- return $string;
- }
-
- cfunction calculateTime($string, $s_t, $e_t) {
- $tok1 = strtok($s_t, " ");
- $msecs1 = $tok1;
- $tok1 = strtok(" ");
- $secs1 = $tok1;
-
- $tok2 = strtok($e_t, " ");
- $msecs2 = $tok2;
- $tok2 = strtok(" ");
- $secs2 = $tok2;
- $t_t = (float) ($secs2 + $msecs2) - (float) ($secs1 + $msecs1);
- echo "execution time for <b>".$string."</b> : <b>".$t_t."</b> seconds<br>\n";
- // echo "start: ".$secs1."<br>\n";
- // echo "end: ".$secs2."<br>\n";
- return (float) $t_t;
- }
-
- cfunction stripString($string, $tokens) {
- $s = $string;
- for ($i=0; $i<count($tokens); $i++) {
- $result = "";
- $tok = strtok($s, $tokens[$i]);
- while($tok) {
- $result .= $tok;
- // echo "result = ".$result."\n";
- $tok = strtok($tokens[$i]);
- }
- $s = $result;
- // echo "s = ".$s."\n";
- }
- // echo "result = ".$result."\n";
- return $result;
- }
-}
-?>
+++ /dev/null
-<?
-class preferences {
- var $name;
- var $sections = array();
- var $base_dn;
- var $host;
- var $attribute_names = array();
-
- cfunction getSection($s) {
- //// echo "getSection(".$s.")<br>";
- $sect = array();
- for ($i=0; $i<count($this->sections); $i++) {
- $sect = $this->sections[$i];
- // echo $sect[0]."<br>";
- if ($sect[0] == $s) {
- // echo "Found ".$sect[0]."<br>";
- return $sect[1];
- }
- }
- // echo "Didn't find ".$s."<br>";
- }
- cfunction get($s) {
- $class = explode(".", $s);
- $sect = $this->getSection($class[0]);
- $values = array();
- $values = $sect[1];
- for ($i=0; $i<count($sect); $i++) {
- $values = $sect[$i];
- // echo $values[0]."<br>";
- if ($values[0] == $class[1]) {
- // echo "Found ".$values[0]."<br>";
- return $values[1];
- }
- }
- // echo "Didn't find ".$class[1]."<br>";
- }
- cfunction getName($s) {
- $n = trim(strtok($s, "{"));
- return $n;
- }
- cfunction getBody($s) {
- $i = strpos($s, "{") + 1;
- $j = strpos($s, "}") - 1;
- $tok = substr($s, $i, $j-$i);
- return $tok;
- }
- cfunction getValues($b) {
- $t = '" ","\" ","\n"';
- $av_pairs = array();
- $pairs = array();
- $av_pair = array();
- $pairs = explode(";", $b);
- for ($i=0; $i<count($pairs)-1; $i++) {
- $av_pair = explode(":", $pairs[$i]);
- $av_pair[0] = trim($av_pair[0]);
- $av_pair[1] = trim($this->stripString($av_pair[1], $t));
- // echo "<li>".$av_pair[0].":".$av_pair[1];
- $av_pairs[$i] = $av_pair;
- }
- return $av_pairs;
- }
- cfunction getStatements($s) {
- $i = 0;
- $end = strpos($s, "}");
- while($end != FALSE) {
- $tok = substr($s, 0, $end+1);
- $s = substr($s, $end+1, strlen($s));
- // echo "<ul>";
- $this->sections[$i] = $this->getStatement($tok);
- // echo "</ul>\n";
- $end = strpos($s, "}");
- $i++;
- }
- // echo count($this->sections)." sections<br>";
- }
- cfunction getStatement($s) {
- $values[0] = $this->getName($s);
-// echo "<li>Name ".$values[0];
- $body = $this->getBody($s);
-// echo "<li>Values<ul>";
- $values[1] = $this->getValues($body);
-// echo "</ul></li>";
- return $values;
- }
- cfunction loadPreferences() {
- if (count($preferences) != 0) {
- echo "I have got ".count($this->sections)." preferences here<br>\n";
- }
- else {
- $fp = fopen("php3tool.conf", "r");
- $i = 0;
- $string = "";
- while (!feof($fp)) {
- $string .= fgets($fp, 80);
- }
- fclose($fp);
- $this->getStatements($string);
- }
- $this->loadAttributeNames($this->get("PATH.attributes"));
- }
-
- cfunction loadAttributeNames($s = "at.conf") {
- // global $attribute_names;
- if (count($this->attribute_names) != 0) {
- //This is bullshit here..how do we make php3
- //preserve an array in memory between re-loads?
- //And no, I'm not going to send it every time
- //I make a subsequent request..
- //If we don't fix these things it won't run
- //on anything smaller than a StarFire 10000
- //EVEN THOUGH this stuff is suprisingly fast.
- echo "I have got attribute_names here<br>\n";
- }
- else {
- //echo "I dont have attribute_names here<br>\n";
- $fp = fopen($s, "r");
- $i = 0;
- while (!feof($fp)) {
- $string = "";
- $foo = "";
- $string = fgets($fp, 80);
- $foo = strtok($string, ",");
- $this->attribute_names[$i][0] = $foo;
- $foo = strtok(",");
- $this->attribute_names[$i][1] = $foo;
- $foo = strtok("\n");
- $this->attribute_names[$i][2] = $foo;
- $i++;
- }
- }
- // echo "Hello world:<b>".count($this->attribute_names)."</b>\n";
- // for ($i=0; $i<count($this->attribute_names)-1; $i++) {
- // echo $this->attribute_names[$i][0]." - <strong>".$this->attribute_names[$i][1]."</strong> - ".$this->attribute_names[$i][2]."<br>\n";
- // }
- return $this->attribute_names;
- }
-
- cfunction stripString($string, $tokens) {
- $s = $string;
- for ($i=0; $i<count($tokens); $i++) {
- $result = "";
- $tok = strtok($s, $tokens[$i]);
- while($tok) {
- $result .= $tok;
- // echo "result = ".$result."\n";
- $tok = strtok($tokens[$i]);
- }
- $s = $result;
- // echo "s = ".$s."\n";
- }
- // echo "result = ".$result."\n";
- return $result;
- }
-}
-?>
+++ /dev/null
-<?
-class query_manager {
- function get_action() {
- global $ldap_action;
- if (isset ($ldap_action)) {
- $ldap_action = urldecode ($ldap_action);
- }
- else {
- $ldap_action = "read";
- }
- return $ldap_action;
- }
- function get_base_dn() {
- global $base_dn;
- if (isset ($base_dn)) {
- $base_dn = urldecode ($base_dn);
- }
- else {
- $base_dn = "o=University of Michigan, c=US";
- // $base_dn = "o=Balorda and Balorda, c=UK";
- }
- return $base_dn;
- }
-
- function get_host() {
- global $host;
- if (isset ($host)) {
- $host = urldecode($host);
- }
- else {
- $host = "localhost";
- }
- return $host;
- }
-
- function get_search_filter() {
- global $objectclass, $attrib, $precision, $search_string;
-// global $search_filter;
-// if (isset ($search_filter)) {
-// $search_filter = urldecode($search_filter);
-// }
-// else {
- $search_filter = "(objectclass=";
- switch(urldecode($objectclass)) {
- case "People": $search_filter .= "person)";break;
- case "Groups": $search_filter .= "organizationalUnit)"; break;
- case "Joinable Groups": $search_filter .= "joinableGroup)"; break;
- case "Organisations": $search_filter .= "organization)"; break;
- default: $search_filter .= "*)"; break;
- }
- switch(urldecode($attrib)) {
- case "Common Name": $search_filter .= "(cn"; break;
- case "Surname": $search_filter .= "(sn"; break;
- case "Business Phone": $search_filter .= "(telephone"; break;
- case "E-mail Address": $search_filter .= "(mail"; break;
- case "Title": $search_filter .= "(title"; break;
- case "Distinguished Name": $search_filter .="(dn"; break;
- case "Location": $search_filter .="(l"; break;
- default: break;
- }
- switch(urldecode($precision)) {
- case "exactly matches": $search_filter .= "=".$search_string.")"; break;
- case "starts with": $search_filter .= "=".$search_string."*)"; break;
- case "ends with": $search_filter .= "=*".$search_string.")"; break;
- case "approximates": $search_filter .= "~=".$search_string.")"; break;
- case "contains": $search_filter .= "=*".$search_string."*)"; break;
- default: break;
- }
- $search_filter = "(&".$search_filter.")";
- // echo $search_filter;
-// }
- return $search_filter;
- }
-
- cfunction get_mode() {
- global $mode;
- if (isset ($mode)) {
- $mode = urldecode($mode);
- }
- else {
- $mode = "tree";
- }
- return $mode;
- }
-
- function display_form() {
- global $lm, $FILE;
-?> <form method=get action=<? echo $FILE; ?>>
- <input type=text name=search_filter size=25 value="<? echo $lm->search_filter; ?>"><br>
- <input type=hidden name=ldap_action value=search>
- <input type=submit value="Search">
- <input type=reset value="Clear">
- </form>
-<?
- }
-
- cfunction makeForm($s) {
- global $FILE;
- echo "<table border=0 cellspacing=2 cellpadding=2 bgcolor=gray>\n";
- for ($i=0; $i<count($s); $i++) {
- $parameter = $s[$i];
- echo "<form method=get action=".$FILE.">\n";
- echo "<tr>\n\t<td colspan=2 align=left bgcolor=lightgrey>\n";
- echo $parameter[0];
- echo "\t\t</td>\n\t</tr>";
- echo "<tr>\n\t<td align=left bgcolor=white>\n";
- echo "\t\t<input type=submit width=80 height=30 value=".$parameter[1].">\n";
- echo "\t\t</td>\n\t<td align=left bgcolor=lightyellow>\n";
- echo "\t\t<input type=text size=25 name=".$parameter[2].">\n";
- echo "\t\t</td>\n\t</tr>\n</form>\n";
- }
- echo "</table>\n";
- }
-
- cfunction display_console() {
- echo '<table width="100%" border=0 cellspacing=2 cellpadding=2 bgcolor=gray><tr>';
- echo '<td colspan=2 align=center valign=middle bgcolor=white><h2>LDAP Console</h2></td></tr><tr>';
- echo '<td align=center valign=middle>';
- $things = array(
- 0 => array("Bind (authenticate) to the directory.", "bind", "who"),
- 1 => array("Change the search base.", "cb", "where"),
- 2 => array("Change information associated with an entry","change","entry"),
- 3 => array("Create a new group entry","create","group"),
- 4 => array("Edit a complete Directory entry","vedit","entry"),
- 5 => array("Find an entry in the directory.","find","entry")
- );
- $this->makeForm($things);
- echo '</td><td align=center valign=middle>';
- $things = array(
- 0 => array("Change the group base.","groupbase","where"),
- 1 => array("Display detailed help for a function","help","command"),
- 2 => array("Subscribe to a group.","join","group"),
- 3 => array("List the groups owned by someone","list","who"),
- 4 => array("List out the groups in which someone is a member.", "memberships", "who"),
- 5 => array("Remove obsolete entries from a group.", "purge", "group")
- );
- $this->makeForm($things);
- echo '</td></tr></table>';
- }
-}
-?>
+++ /dev/null
-<?
-function display_options($string) {
-?>
- <select name="precision">
- <option>exactly matches</option>
- <option selected>approximates</option>
- <option>starts with</option>
- <option>ends with</option>
- <option>contains</option>
- </select>
-<?
-}
-function display_items($string) {
-?>
- <select name="objectclass">
- <option selected>People</option>
- <option>Groups</option>
- <option>Joinable Groups</option>
- <option>Services</option>
- <option>Organisations</option>
- <option>Documents</option>
- </select>
-<?
-}
-function display_attribs($string) {
-?>
- <select name="attrib">
- <option selected>Common Name</option>
- <option>Surname</option>
- <option>Business Phone</option>
- <option>E-mail Address</option>
- <option>Distinguished Name</option>
- <option>Title</option>
- <option>Location</option>
- </select>
-<?
-}
-
-function display_base_dn($string) {
-?>
- <select name="base_dn">
- <option value="c=US">US</option>
- <option value="o=University of Michigan, c=US" selected>University of Michigan</option>
- <option value="o=Balorda and Balorda, c=UK">Balorda and Balorda</option>
- </select>
-<?
-}
-
-function display_simple_form() {
- global $lm, $FILE;
-?> <form method=form action=<? echo $FILE; ?>>
- <input type=text name=search_filter size=25 value="<? echo $lm->search_filter; ?>"><br>
- <input type=hidden name=ldap_action value=search>
- <input type=submit value="Search"><input type=reset value="Clear">
- </form><?
-}
-
-function display_advanced_form() {
- global $lm, $FILE;
-?>
- <table width="100%" border=1 cellspacing=0 cellpadding=0>
- <tr>
- <td colspan=2 bgcolor="lightyellow"> <!bgcolor=#9380DB>
- <p class=form>
- <form method=get action=<? echo $FILE; ?>>
- Find <?display_items("objectclass")?>
- within <?display_base_dn("base_dn")?>
- whose <?display_attribs("attrib")?><br>
- <?display_options("precision")?>
- <input type=text name=search_string size=25 value="">
- <input type=hidden name=ldap_action value=search>
- <input type=submit value="Search">
- </form>
- </p>
- </td>
- </tr>
- </table>
-<?
-}
-?>
+++ /dev/null
-<!DOCTYPE PUBLIC HTML "-//W3C//HTML3.2 Final//En">
-<html>
-<head>
- <!-- copyright, (C) Predrag Balorda, OpenLDAP Foundation, 1998,1999,2000 -->
- <title>PHP3 Thingy</title>
- <link rel="stylesheet" type="text/css" href="style.css">
-</head>
-<body>
-<?
-include ('include/preferences.inc');
-include ('include/ldap_manager.inc');
-include ('include/query_manager.inc');
-include ('include/search_form.inc');
-$FILE = "http://$HTTP_HOST$SCRIPT_NAME";
-$JPEGFILE = "http://$HTTP_HOST/ldap/php3-tool/ldap-photo.php3";
-$qm = new query_manager;
-$lm = new ldap_manager;
-$prefs = new preferences;
-
-function main() {
- $main_start_time = microtime();
- global $lm, $qm, $prefs, $FILE;
- $qm = new query_manager;
- $lm = new ldap_manager;
- $prefs = new preferences;
- $lm->ldap_action = $qm->get_action();
- $lm->base_dn = $qm->get_base_dn();
- $lm->host = $qm->get_host();
- $lm->search_filter = $qm->get_search_filter();
- $prefs->loadPreferences();
- display_advanced_form();
- if (!$lm->connect($lm->host)) {
- echo "Couldn't connect to <b>".$lm->host."</b><br>\n";
- echo "Bye";
- return 0;
- }
- if (!$lm->ldapTakeAction($lm->ldap_action) || $lm->entriesCount == 0) {
- echo "Didn't find anything for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."<br>\n";
- return 0;
- }
- else {
- // echo "I got <b>".$lm->entriesCount."</b> entries for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."<br>\n";
- $get_entries_s_t = microtime();
- $lm->getEntries();
- $get_entries_e_t = microtime();
- // echo "Disconnecting from <b>".$lm->host."</b><br>\n";
- $lm->disconnect();
- }
- if (($qm->get_mode() == "tree") && ($lm->ldap_action == "list")) {
- $display_entries_s_t = microtime();
- ?><table width="100%" border=1 cellpadding=0 cellspacing=0>
- <tr>
- <td bgcolor="#9380DB" align=center valign=absmiddle>
- <h3 class=head><?echo $lm->formatHTMLBaseDN($lm->base_dn);?></h3>
- </td>
- </tr>
- </table>
- <p>
- <script language="JavaScript" src="javascript/expandable-outlines.js">
- </script><?
- $tokens = array( 0 => " ", 1 => ",");
- $e = $lm->entries[0];
- $s = ldap_dn2ufn($e->dn);
- $firstel = $lm->stripString($s, $tokens);
- for ($i=0; $i<count($lm->entries); $i++) {
- $c = "";
- $e = $lm->entries[$i];
- $s = ldap_dn2ufn($e->dn);
- $tin = $lm->stripString($s, $tokens);
- ?><div id="<? echo $tin; ?>Parent" class=parent>
- <h3 class=subsection>
- <a href="#" onClick="expandIt('<? echo $tin; ?>'); return false">
- <img name="imEx" src="false.gif" border=0 alt=""></a>
- <? $n = ldap_explode_dn($e->dn, 1); echo $n[0]; ?></h3>
- </div>
- <div id="<? echo $tin; ?>Child" class=child>
- <table border=1 cellspacing=0 cellpadding=0>
- <? $c .= $e->formatHTMLAttributes(); echo $c; ?>
- </table>
- <br>
- </div><?
- }
- ?><script language="JavaScript"><!--
- if (NS4) {
- firstEl = "<? echo $firstel; ?>Parent";
- firstInd = getIndex(firstEl);
- showAll();
- arrange();
- }
- //--></script><?
- }
- else {
- $display_entries_s_t = microtime();
- $c = $lm->formatHTMLEntries();
- echo $c;
- }
- $display_entries_e_t = microtime();
-// echo "<div align=right valign=bottom>";
-// $t1 = $lm->calculateTime("getEntries()", $get_entries_s_t, $get_entries_e_t);
-// $t2 = $lm->calculateTime("displayEntries()", $display_entries_s_t, $display_entries_e_t);
-// $main_end_time = microtime();
-// $t3 = $lm->calculateTime("main()", $main_start_time, $main_end_time);
-// $t = $t3 - ($t1 + $t2);
-// echo "Ether : ".$t." seconds<br>\n";
-// echo "</div>";
- return 1;
-}
-$return = main();
-?>
-</body>
-</html>
+++ /dev/null
- var bV=parseInt(navigator.appVersion);
- NS4=(document.layers) ? true : false;
- IE4=((document.all)&&(bV>=4))?true:false;
- ver4 = (NS4 || IE4) ? true : false;
- function expandIt(){return}
- function expandAll(){return}
- isExpanded = false;
-
- function getIndex(el) {
- ind = null;
- for (i=0; i<document.layers.length; i++) {
- whichEl = document.layers[i];
- if (whichEl.id == el) {
- ind = i;
- break;
- }
- }
- return ind;
- }
-
- function arrange() {
- nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
- for (i=firstInd+1; i<document.layers.length; i++) {
- whichEl = document.layers[i];
- if (whichEl.visibility != "hide") {
- whichEl.pageY = nextY;
- nextY += whichEl.document.height;
- }
- }
- }
-
- function initIt(){
- if (NS4) {
- for (i=0; i<document.layers.length; i++) {
- whichEl = document.layers[i];
- if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
- }
- arrange();
- }
- else {
- tempColl = document.all.tags("div");
- for (i=0; i<tempColl.length; i++) {
- if (tempColl(i).className == "child") tempColl(i).style.display = "none";
- }
- }
- }
-
- function expandIt(el) {
- if (!ver4) return;
- if (IE4) {expandIE(el)} else {expandNS(el)}
- }
-
- function expandIE(el) {
- whichEl = eval(el + "Child");
- whichIm = event.srcElement;
- if (whichEl.style.display == "none") {
- whichEl.style.display = "block";
- whichIm.src = "true.gif";
- }
- else {
- whichEl.style.display = "none";
- whichIm.src = "false.gif";
- }
- }
-
- function expandNS(el) {
- whichEl = eval("document." + el + "Child");
- whichIm = eval("document." + el + "Parent.document.images['imEx']");
- if (whichEl.visibility == "hide") {
- whichEl.visibility = "show";
- whichIm.src = "true.gif";
- }
- else {
- whichEl.visibility = "hide";
- whichIm.src = "false.gif";
- }
- arrange();
- }
-
- function showAll() {
- for (i=firstInd; i<document.layers.length; i++) {
- whichEl = document.layers[i];
- whichEl.visibility = "show";
- }
- }
-
- function expandAll(isBot) {
- newSrc = (isExpanded) ? "false.gif" : "true.gif";
-
- if (NS4) {
- document.images["imEx"].src = newSrc;
- for (i=firstInd; i<document.layers.length; i++) {
- whichEl = document.layers[i];
- if (whichEl.id.indexOf("Parent") != -1) {
- whichEl.document.images["imEx"].src = newSrc;
- }
- if (whichEl.id.indexOf("Child") != -1) {
- whichEl.visibility = (isExpanded) ? "hide" : "show";
- }
- }
-
- arrange();
- if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
- }
- else {
- divColl = document.all.tags("div");
- for (i=0; i<divColl.length; i++) {
- if (divColl(i).className == "child") {
- divColl(i).style.display = (isExpanded) ? "none" : "block";
- }
- }
- imColl = document.images.item("imEx");
- for (i=0; i<imColl.length; i++) {
- imColl(i).src = newSrc;
- }
- }
-
- isExpanded = !isExpanded;
- }
-
-with (document) {
- write("<style type='text/css'>");
- if (NS4) {
- write(".parent {position:absolute; visibility:hidden}");
- write(".child {position:absolute; visibility:hidden}");
- write(".regular {position:absolute; visibility:hidden}")
- }
- else {
- write(".child {display:none}")
- }
- write("</style>\n");
-}
-onload = initIt;
+++ /dev/null
-/**
- * resize.js 0.3 970811
- * by gary smith
- * js component for "reloading page onResize"
- */
-
-if(!window.saveInnerWidth) {
- window.onresize = resize;
- window.saveInnerWidth = window.innerWidth;
- window.saveInnerHeight = window.innerHeight;
-}
-
-function resize() {
- if (saveInnerWidth < window.innerWidth ||
- saveInnerWidth > window.innerWidth ||
- saveInnerHeight > window.innerHeight ||
- saveInnerHeight < window.innerHeight )
- {
- window.history.go(0);
- }
-}
+++ /dev/null
-<?
-if (isset($base_dn)) {
-// echo urldecode ($base_dn)."<br>\n";
-}
-if (isset($cn)) {
-// echo urldecode ($cn)."<br>\n";
-}
-$link_identifier = ldap_connect("127.0.0.1");
-$result_identifier = ldap_read($link_identifier, $base_dn, 'objectclass=*');
-if(!$result_identifier) {
- echo "No results.\n";
-}
-else {
- $num_entries = ldap_count_entries($link_identifier, $result_identifier);
- if ($num_entries == 0) {
- echo "No results\n";
- return 1;
- }
- Header("Content-type: image/jpeg");
- $info = ldap_get_entries($link_identifier, $result_identifier);
- ldap_close($link_identifier);
- for ($i=0; $i<$info["count"]; $i++) {
-// echo $i;
- if ($info[$i]["cn"][0] == $cn) {
- //echo "<b>".$info[$i]["cn"][0]."</b><br>";
- }
- for ($j=0; $j<$info[$i]["count"]; $j++) {
- $attribute = $info[$i][$j];
- if (strtolower ($attribute) == "jpegphoto") {
- // $file = fopen("/tmp/tmpphoto.jpg", "w");
- // echo $info[$i]["jpegphoto"][0];
- $p = $info[$i]["jpegphoto"][0];
- $photo = base64_decode($p);
- echo $photo;
- // fwrite($file, $photo);
- // flush();
- // fclose($file);
- // $file = fopen("/tmp/tmpphoto.jpg", r);
- // $contents = fread ($file, filesize("/tmp/tmpphoto.jpg"));
- // fclose($file);
- // echo $contents;
- }
- }
- }
-}
-?>
+++ /dev/null
-PATH {
- attributes: "at.conf";
- photo: "ldap-photo.php3";
-}
-
-BASE {
- basedn: "o=University of Michigan, c=US";
- other: "o=Balorda and Balorda, c=UK";
- other: "o=Simpson Family, c=ES";
-}
+++ /dev/null
- BODY,B,P,H2,H1 {
- font-family: lucida sans unicode;
- }
- BODY,P {
- font-weight: bold;
- font-size: 12pt;
- }
- .form {
- font-size: 10pt;
- color: #003333;
- }
- H3 {
- font-family: Verdana,Arial,Helvetica;
- font-size: 12pt;
- font-weight: bold;
- }
- .head {
- font-size: 13pt;
- color: #003333;
- }
- .subsection {
- font-size: 12pt;
- color: #003333;
- }
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* CHANGES *
-* *
-* Function:..A short description of the last modifications of TWEB *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* September 14 1995 Z D D V V *
-* Last modification: Z D D V V *
-* January 15 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/
-
-
-
- Changes of the web-x.500-gateway TWEB
- =====================================
-
-Version: tweb-2.3 1998/10/05
-
-Changes to code
-
- - dynamic re-sort and re-display based on entries found in the DIT:
- SORT definitions given by config files can be changed due to
- local information within a DIT area; that provides for dynamic
- definitions of sorting groups and/or display of groups with new
- labels and/or other sorting order;
- DISPLAY definitions can be replaced or added dynamically, in order
- to display contents of entries in other than the statically
- configured way
-
-
-Version: tweb-2.2 1998/3/20
-
-Changes in configuration files (please check!)
-
- - INDEX-URL (new): display hrefs below a certain dit showing special parts
- of the entry-dn in any sequence
-
- - DIT-CONFIG (new): get from a specified location the information how to
- switch to other gateways depending on the given dn.
- With NOT-BROWSE you can turn of this functionality for browsing.
-
- - DISP-SEA-RDN (new): with this option you can make search-results to be
- displayed only by rdn and not by relative dn to the search-base
-
- - TON-URLS (new): hereby you can reference a given organization/alunit
- by TONS (special numbers for organizational hirarchies)
- example: T013307 can mean:
- computing centre, dept. development of new services
-
- - INDIRECT-ATTRS (new): attribute-value can be fetched by special keys from
- other locations and additional be transformed by according
- functions
-
- - ALLOW-STRING DENY-STRING GRANT REFUSE : CHANGE IN BEHAVIOUR!!
- now regular expressions are used. That means you have shorter
- config strings.
-
- - ALLOW-MSG (new): by this option you can specify a special file located
- in the ETCDIRectorie containing a message to be displayed
- in case of an allowed access to TWEB
-
- - TABLES (new): triggered by the presence of a special objectclass
- will be displayed a button in the header of the TWEB-page
- allowing an eXtended data access such as:
- a table with names, telephonenumbers and e-mail addresses
- of the current organization
-
- or the access to the electronic telephonebook-data
- of the university of tuebingen generated by TWEB
- dynamically
-
-
-Version: tweb-2.0a 1997/1/7
-
-Changes in configuration files (please check!)
-
- - PULL-DOWN-MENUS (new): use BUTTONS and PULL-DOWN-MENUS instead of links
- in order to support: help, language-switch, move-upwards
- and read-entry functionalities
-
- - GRANT (new): allow general access to TWEB for specified locations
- ( same syntax as ALLOW-STRING )
-
- - REFUSE (new): refuse general access to TWEB for specified locations
- ( same syntax as DENY-STRING )
-
- - INDIRECT-ATTRS (new): Get specified attribute-values from another
- location
-
- - CACHING-TERMS (new): specify caching-behaviour for browsers and www-caches
-
- - CACHE-EXPIRE-DEFAULT (new): set a default caching-time for browsers
- and www-caches
-
- - SHOW-DEFOC (new): Show Default Objectclass
-
- - COMREFUSE (new): prevent engine-access
-
- - robots.txt (new): supply robots.txt-file functionality with the same
- behaviour as in www-servers
-
-
-Version: tweb-1.1b 1996/5/7
-
-Changes in configuration files (please check!)
-
- - STRICT-BASEDN (new): Access not below basedn is switched to responsible
- gateway ( -> gw-switch)
-
- - ALLOW-PROXY (new): if NO-PROXY is configured access from
- given domain is allowed
-
-
-Version: tweb-1.1a, 1996/4/25
-
-Changes in configuration files (please check!)
-
- - SORT extensions: fourth parameter RELATED DISPLAY-CLASS:
- relation to according DISPLAY-entry
- (default is 'default')
- see DISPLAY changes
-
- fifth parameter SORT-ATTRIBUTE:
- attribute used to sort entries
- (default is 'sn')
-
- - DISPLAY changes: The DISPLAY objectClass entry is replaced by the string
- that is used as fifth attribute with SORT
-
- - NO-PROXY (new): option for access restrictions via PROXY-servers
-
- - TWEBHOST (new): option to support a constant tweb-hostname
-
- - NO-MODIFY (new): option to prevent entries with named objectclasses from
- modification
-
- - PGPKEY (new): DISPLAY-TYPE for PGPKeys enabling cut&paste
-
-
- Changes to code
-
- - conversion from upper to lowercase characters in:
- make_oc_to_str(), pick_oc(), init_sort(), init_modify(),
- attrs in display() and all internal comparison-strings!!!
-
- - modification with multiline attributes now possible with NETSCAPE
-
- - pictures in X.500 are shown (only with NETSCAPE)
-
- - display is denied in do_read() in case of missing default-Display
-
- - technical entries (gw...) are not shown if using DYNAMIC-GW
-
- - the tokens to filter proxy-access with NO_PROXY are extended to:
- " via " & "Proxy gateway"
-
- - the tweb-version and compilation date is now shown with C & K options
-
- - many bugfixes
-
-
-Version: tweb-1.0b, 1996/2/29
-
- Changes in configuration files (please check!)
-
- - ALLOW/DENY-String moved from tweb.conf.[01] to tweb.rc
- - tweb.lang.[01]: string 4 TEXT/HTML --> text/html
- - tweb.rc : optional parameter TWEBHOST (see FEATURE-LIST)
-
- Changes to code
-
- - better behaviour in modify operations
- BEWARE: modification of inherited attributes still NOT possible (!)
-
- - logging-option (-l) with facultative parameter: LOCAL[0-7] of syslogd
-
- -lx --> LOCAL3 (default)
-
- - simplified metasyntax of GW-switches:
-
- labeledURI= http://<host>:<port>/ <descriptive string> (gw[-<lang>])
-
- - use 'aliasedObjectName' in HREF of aliases
- - always print HTML header
- - many bugfixes
-
-
-Version: tweb-1.0a, 1996/2/7
-
- - base distibution
-
+++ /dev/null
-Copyright (c) 1994 - 1999 University of Tuebingen, Germany.
-Written by Kurt Spanier and Bernhard Winkler. All rights reserved.
-
-This software is not subject to any license of the University of
-Tuebingen, Germany.
-
-Permission is granted to anyone to use this software for any purpose
-on any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits should appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits should appear in the documentation.
-
-4. This notice may not be removed or altered.
-
-
-
-This work is derived from the Technical University of Chemnitz web500gw
-by Frank Richter. Information concerning is available at
- http://www.tu-chemnitz.de/~fri/web500gw.
-
-web500gw is itself derived from the University of Michigan go500gw
-by Tim Howes. Information concerning is available at
- http://www.umich.edu/~dirsvcs/ldap/ldap.html
-
-This work also contains materials derived from public sources:
-
- ch_malloc.c, charray.c, dn.c from the University of Michigan LDAPv3.3,
- with some minor bug fixes.
-
- regular.c from the University of Toronto regexp by Henry Spencer,
- with renaming of functions for not colliding with putative
- build-in regexp functions in the underlying LDAP libraries,
- as well as minor modifications.
- The original software can be obtained from
- ftp://ftp.cs.toronto.edu/pub/regexp.README, and
- ftp://ftp.cs.toronto.edu/pub/regexp.shar.Z
-
-
-Additional Information can be obtained by sending e-mail to:
- tweb-support@mail500.uni-tuebingen.de
-
-
----
-
-Portions Copyright (c) 1994-1998 Chemnitz University of Technology.
-All rights reserved.
-
- A LDAP based WWW - X.500 gateway
-
- written by: Frank Richter, Frank.Richter@hrz.tu-chemnitz.de
- Chemnitz University of Technology, Germany, 1994-1998
-
- Redistribution and use in source and binary forms are permitted
- provided that this notice is preserved and that due credit is given
- to the Technical University of Chemnitz. The name of the University
- may not be used to endorse or promote products derived from this
- software without specific prior written permission. This software
- is provided ``as is'' without express or implied warranty.
-
-
----
-
-Portions Copyright (c) 1992-1996 Regents of the University of Michigan.
-All rights reserved.
-
- Redistribution and use in source and binary forms are permitted
- provided that this notice is preserved and that due credit is given
- to the University of Michigan at Ann Arbor. The name of the University
- may not be used to endorse or promote products derived from this
- software without specific prior written permission. This software
- is provided ``as is'' without express or implied warranty.
-
-
----
-
-Portions Copyright (c) 1986 by University of Toronto.
- Written by Henry Spencer. Not derived from licensed software.
-
- Permission is granted to anyone to use this software for any
- purpose on any computer system, and to redistribute it freely,
- subject to the following restrictions:
-
- 1. The author is not responsible for the consequences of use of
- this software, no matter how awful, even if they arise
- from defects in it.
-
- 2. The origin of this software must not be misrepresented, either
- by explicit claim or by omission.
-
- 3. Altered versions must be plainly marked as such, and must not
- be misrepresented as being the original software.
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* FEATURE-LIST *
-* *
-* Function:..A description of the basic of TWEB, *
-* the Tuebinger Web-X.500 gateway *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* September 14 1995 Z D D V V *
-* Last modification: Z D D V V *
-* January 15 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/
-
-
-
-0 TABLE OF CONTENTS
-
- 1 Introduction
- 2 General overview
- 2.1 A case of Public Relations
- 2.2 Configuration files and TWEB start-up
- 2.3 The running gateway
- 2.4 check4access: who is allowed to see (what) data
- 2.5 Preparing the data
- 2.6 Searching for data
- 2.7 Data based behaviour: the dynamic gateway
- 2.8 Restricting the service
- 2.8.1 Restricting the number of entries
- 2.8.2 Suppression of certain entries by RDN
- 2.8.3 Defining DIT areas for search-only operations
- 2.8.4 Controlling the hackers
- 3 Configuration of TWEB features in detail
- 3.1 Technical configuration options
- 3.2 Political configuration options
- 3.3 Load balancing configuration options
- 3.4 Display configuration options
- 4 Support and discussion list
-
-
-1 INTRODUCTION
-
- TWEB is based on the Web500gw implementation by Frank Richter,
- Technische Universitaet Chemnitz-Zwickau, which is based on the
- go500gw implementation by Tim Howes, University of Michigan.
-
- TWEB was compiled and tested on LINUX with cc, HPUX 9.05 with the
- HP-ANSI C compiler, as well as SunOS 4.1.2 with the SUN C compiler.
- TWEB was also compiled with gcc on all platforms. On SUN Solaris
- 2.6.x TWEB was also compiled with gcc 2.7.2.
-
- The UMICH LDAP client library version 3.0 or 3.3
- ( URL:ftp://terminator.rs.itd.umich.edu/ldap/ldap-3.3.tar.Z )
- must be installed on the machine (library path and include file
- path is configured in Makefile). With QUIPU ICR-2.x the ISODE-
- provided LDAP libraries should be used. As such, TWEB only supports
- LDAP version 2 with the University of Michigan type C API. TWEB is
- also adapted for the OpenLDAP LDAP library, release version 1.1.2
- (http://www.openldap.org).
-
- An upgrade to LDAP version 3 and a C API standadized by the IETF
- is planned for a not so far away future, most probably in step
- with the OpenLDAP package.
-
- TWEB, as provided here is a fully functional core gateway, which
- is extended at the author's site by some local features. These
- extensions are included into the same code base, so that some
- "#ifdef TUE_TEL" or "#ifdef AMBIX" pre-processor statements can
- be found throughout the code.
-
-
-2 GENERAL OVERVIEW
-
-2.1 A case of Public Relations
-
- TWEB is a gateway between the HTML-based World-Wide-Web (WWW
- for short) and the X.500-based wordlwide directory, nowadays
- mainly accessed through LDAP, the Leightweight Directory Access
- Protocoll. As such, TWEB is a mediator between these worlds,
- providing run-time access to a lively database and preparing
- results in a usable format.
-
- Why not access the directory directly via my browser-built-in
- LDAP functionality, you may ask. One answer is, that TWEB with
- it's build-in security features may provide access to more
- internal data for permitted users, while denying these data for
- outside users. This might be very handy from the database
- administration point of view, easing the task of checking
- for consistencies between seperate inside and outside databases.
-
- Secondly, TWEB provides for a flexible display of results,
- not just showing the pure data. Corporate identity, even when
- using a staff's directory, can be implemented by an organization.
- Furtheron, important messages and hints can be added on the fly,
- that are relevant to the directory user. This is also possible
- via HTTP links, provided either through the directory data (e.g.,
- links to personal home pages) or embeded into HTML text loaded
- during result page preparation. Thus, the integration of WWW and
- the directory can be two-ways, not just one-way.
-
- Thirdly, TWEB can, with some extensions not yet provided in
- the current distribution, easily be configured to access the
- directory more than once, in order to return results for a
- single request. For example, this can be used to build a page
- with the phoenbook entries of a whole department, institute, or
- faculty, spanning many hierarchies is the underlying directory
- database, as implemented at the University of Tuebingen.
-
- When running TWEB with some of the configuration options, one
- might easily find more points that are in favor of a gateway
- solution, rather than purely accessing the data of a single
- directory entry at a time.
-
- BUT AFTER THIS SHORT EXCURSION INTO THE WORLD OF PR, LET'S
- HAVE A LOOK AT WHAT TWEB PROVIDES AND WHAT FEATURES CAN
- BE USED.
-
-
-2.2 Configuration files and TWEB start-up
-
- Allmost anything what TWEB provides is determined by a set of
- configuration files during start-up, or at run-time. There is
- the main ressource file (tweb.rc) that provides for basic,
- language-independant features, like host and port of the connected
- directory server. Language-specific configuration parameters
- are located in the config files (tweb.conf.x), with x (0-9)
- standing for any of a set of supported languages. Language
- strings, that are used to build an HTML result page are taken
- from the language files (tweb.lang.x), again with x indicating
- the language in question. Those files are located in the
- TWEB_conFiles subdirectory; the TWEB binary, probably via a
- symbolic link, should also reside within that directory.
-
- Header and footer files, and certain message files are loaded
- during run-time, so that the content can be updated on-the-fly,
- without restarting the gateway. Those files can be found in the
- LDAP_etc subdirectory, but can also be located elsewhere, after
- setting the ETCDIR parameter in the tweb.rc file.
-
- Certain configuration parameters can be overridden by command
- line parameters during start-up. Type 'tweb -h' to get a short
- description of each command line parameter, or have a look at
- the description below. The important parameters are '-l' for
- selection of the LOCAL user of the syslog facility, and '-L'
- for selection of languages.
-
- When starting, TWEB first of all determines which languages should
- be supported. A sub-process is created for each language by the
- fork() system call, and the starting process is terminated. (In case
- of only one language, TWEB will not fork, but instead use the first
- process for the gateway service.) Each sub-process is responsible for
- one of the languages, and presents hyperlinks to the other languages'
- HTTP addresses on HTML pages, so that the user can switch from one
- language to the other. When language hints are provided within the
- directory data (see below) even attribute values may be presented
- language-specific. (This is not to be mixed up with the LDAPv3
- standard, which provides for language specification via attribute
- options.)
-
- The starting TWEB initializes itself by reading the tweb.rc, the
- tweb.conf.x, and the tweb.lang.x files, and stores the configuration
- in a global data structure that can be used by all parts of the
- program. Command line options are considered last, and can override
- previously defined parameters. In the tweb.rc and tweb.conf.x files
- parameters are generally additive, meaning that configuration can be
- spread across those files (e.g., GW-SWITCH can be set to language-
- independant gateways in tweb.rc and extended by language-specific
- gateways in the tweb.conf.x files.)
-
- Also, message, header and footer files are checked for presence, and
- a warning is printed to standard output, if they are missing. After
- some more sanity checks of the configuration, TWEB connects to the
- port it was configured for and starts listening for HTTP requests.
- (In the tweb.rc config file only a base port is given; the gateway
- process serving for language 0 will listen at this port; the gateway
- for language 1 at port+1, for language 2 at port+2, and so on, upto
- the language with number 9.)
-
-
-2.3 The running gateway
-
- When a request is started by an external HTTP client, TWEB checks
- for access rights of that client (see below), and decides, whether
- the request can be handled by the process itself (mainly simple
- requests, like, e.g., sending the help file), or whether another
- sub-process should be started. In both cases the TWEB master process
- returns to listening for requests, so that new request can be
- handled while old ones are still in progress.
-
- A request is encoded into the URL, the Universial Ressource Locater,
- the HTTP client sends to the gateway process. Such an URL is build
- of different parts, as follows:
-
- http://host:port/request
-
- First of all, 'http://' defines the HTTP protocoll itself. As
- TWEB is the mediator between WWW and the directory, it is an HTTP
- server towards the browser, accepting normal HTTP request, but is an
- LDAP client towards the directory server, sending LDAP requests.
-
- Host and port are the same as in the tweb.rc configuration file,
- and tell the browser, where to direct the request.
-
- The request for TWEB is given in the last part of the URL, in a more
- or less complicated format. The most simple request is the EMPTY
- request ( http://host:port/ ), which will cause TWEB to return a
- listing of directory entries just below it's BASEDN. (Besides beeing
- the "home" for TWEB when sending an URL without further specification,
- the BASEDN can also be configured as beeing the root entry of an DIT
- area, and TWEB will only serve requests within, but not outside that
- area; STRICT-BASEDN.)
-
- All other requests are given by a starting letter (beware: that
- letter is CASE-SENSITIVE) and possibly a further specification.
- That letter directs TWEB to one of several actions, like returning
- a directory listing, reading a specified entry, or sending a
- formular for modification of an entry. If a directory look-up
- is necessary, TWEB will perform that via LDAP, prepare the results
- as an HTML page, and return it to the requesting client. After
- that the process will die, unless it was the master process, that
- returns to listening for further requests. Thus, TWEB's action is
- as state-less as the HTTP protocoll itself, but some information
- for subsequent client requests can be embedded into the result,
- like for example a gateway-switch (see below) or an entries' old
- data in a modification formular.
-
- Like in HTTP, the TWEB request URL should contain no space characters,
- and certain special chars should be HTML escaped. TWEB will allways
- prepare such URLs in its own results, e.g., when returning a list of
- entries, with each one beeing a clickable hyperlink for the next data
- retrieval. Thus, during interaction with TWEB, the user has not to
- consider such special characters, for they are converted automatically.
- Only the very first link to TWEB, be it embedded into a web page, or
- entered directly into the browser's 'goto URL' field, or whatever it is
- called, should be checked for those characters.
-
-
-2.4 check4access: who is allowed to see (what) data
-
- A requesting client not only gives the URL to TWEB, but also it's
- IP or Internet address. This is an address needed by computers to
- find each other in the world-wide network. Normally, computers
- have also so-called Internet Names, that are more human-readable.
- To match IP addresses and internet names, the Domain Name Service
- (DNS) is run on the Internet. When TWEB receives an IP adress,
- it will try to look up the corresponding internet name of the
- requesting client and use that information to decide on access
- rights of the client. If a host's name cannot be found in the
- DNS, this is also used as a bit of information. The configuration
- parameters GRANT, REFUSE, ALLOW-STRING, and DENY-STRING can be
- set to specify access rights based on internet names in a very
- flexible way. Furtheron, the HTTP information of proxy access
- is considered, if the parameters NO-PROXY and ALLOW-PROXY are set.
-
- When TWEB has decided on access rights, it will continue depending
- on these rights. When service is totally refused to a requesting
- host, or a complete IP domain, a corresponding message is send to
- the client and the TWEB process terminates. Otherwise, TWEB selects
- one of two configured WEBDNs (the directory names of corresponding
- entries in the local directory) and WEBPWs (corresponding passwords)
- and sends the LDAP requests with these DNs to the directory server.
- The server should of course be configured in a way, that the one DN
- has access to internal data, whereas the other has not. Thus, data
- retrieval can be controlled by the server, not only by TWEB itself.
-
-
-2.5 Preparing the data
-
- Almost any result page is build by combining different areas, as
- appropriate for the result returned. A header and footer is located
- at the top and the bottom of the HTML page, respectively. (In fact,
- the footer is followed by a tiny TWEB version info, so the footer
- is only the second-last element.) Below the header some internal
- message can follow (ALLOW-MESSAGE), which will not be shown to an
- outside requestor, and in front of the footer there can be a Legal
- Message for the outsider (LEGAL; actually, if the ON-TOP parameter
- is specified for the LEGAL option, this Legal Message will also be
- printed at the beginning of the result page). Below the header/
- internal message, an area for navigation, reading the current base
- position and a search box may follow, that can be used for entering
- further requests. Below that, the results of the current request
- are shown.
-
- If there are more than one result entries to the current request (e.g.,
- due to a listing of entries below the current DIT position, or multiple
- matches for a search request), a hyperlink for each entry is displayed,
- to give the user the possibility to follow the link and obtain the
- results for the next request. The HREF within the hyperlink is a
- complete URL, with host:port, and the directory entries' distinguished
- name (DN) for the next request to TWEB.
-
- Results can be grouped to different lists and sorted within each
- group, according to the settings of the SORT configuration parameter,
- and the entries' objectclasses. The objectclasses given in the SORT
- configuration parameter are scanned for in each result entry,
- sequentially, and an entry is placed into the appropriate group, as
- soon as an objectclass is found. (Entries having none of the SORT
- objectclasses will only be shown, if the SHOW-DEFOC configuration
- parameter as well as a DEFAULT DISPLAY-TYPE is given.) After scanning
- for groups, each group of entries is sorted according to the contents
- of the sort attribute listed within the group's SORT clause, or by the
- attribute "sn" (surname), if no explicite sort attribute is given, or
- according to the entries' relative distinguished name, if there is no
- sn attribute within the entries. The sorted groups are displayed in
- the order, that is given numerically in the SORT clauses. Thus, the
- order while scanning for objectclasses (i.e., preparing the groups)
- is distinct from the order during display. Each group is prepanded
- by the label given in the SORT clause, with a label consisting only
- of space characters meaning no label. (Labels containing space
- characters must be surrounded by double quote characters, i.e., '"'.)
-
- If there is only one result to a request, TWEB will perform a read
- request for the X.500 entry and display the attributes of the entry.
- Since access rights are also checked at the server (see above), the
- attribute list for a permitted user can differ from the list of an
- external user. In each case, the attributes are sorted according to
- the DISPLAY-OBJECT given in the SORT configuration parameter, after
- classification of the entry to one of the SORT groups in much the
- same way, as described above. The DISPLAY-OBJECT selects the attributes
- to be displayed and determines the order of, as well as labels for
- the attributes. (If the DISPLAY-OBJECT parameter is not given to the
- SORT configuration option, DISPLAY-OBJECT DEFAULT will be used; if
- that, however, is not given by the configuration files, the entry
- will NOT be displayed!) The method for displaying is also given. Thus,
- attributes can be displayed as simple strings, prepared as HTTP URLs,
- or as mailto hyperlinks. A complete list of display methods is given
- below with the description of the FIRST-PAGE configuration parameter.
- Within the DISPLAY-OBJECT definition, FIRST-PAGE describes attributes
- to be shown on a first HTML page, and SECOND-PAGE lists attributes
- for a second HTML page, if given. To obtain the second page, a hyper-
- link that directs TWEB to read the same entry again with additional
- attributes, is placed at the end of the first page's attribute list.
-
-
-2.6 Searching for data
-
- As described above, one element of a result page may be a search box
- that can be used to enter appropriate search strings. The input is
- taken by TWEB and used according to the definitions of the
- ldapfilter.conf file (a basic version is located in the LDAP_etc
- sub directory.) In that file, rather complicated search algorithms
- can be defined, but the most simple ones will be to look for cn or
- sn attributes. By default, the search scope is restricted to one
- level below the current DIT position, unless the base entry (the
- current position) containes objectclasses 'organization' or
- 'organizationalUnit'. In this case, the search will cover the whole
- DIT area rooted at the current position. (Subtree search.) This
- scope also determines which search rules are taken from the
- ldapfilter.conf file. (Look for "web500gw onelevel" and "web500gw
- subtree".)
-
- One word for a warning: since TWEB is currently based on LDAPv2 and
- servers that are NOT aware of special characters, like german umlaute,
- such characters should NOT be entered to the search box. Depending
- on the server's implementation and configuration, these characters
- might crash the server, since they are not one of the expected ASCII
- characters. TWEB, on the other hand, can hardly figure out the
- character entered because of differrent code tables in use with
- the browsers and the platforms housing TWEB itself. If someone has
- a simple sollution to the latter problem, the authers would welcome
- a hint, so they could implement a safe character conversion method.
-
-
-2.7 Data based behaviour: the dynamic gateway
-
- In the 'preparing data' section, the construction of hyperlinks for
- further requests was described for situations, when more than one
- entry matches the previous request. For these hyperlinks, the under-
- lying URL will normally contain the TWEB's own host and port address,
- so that requests will be directed towards the same gateway. This,
- however, can be modified by a feature called "gateway-switching",
- directing further requests to other gateways.
-
- Gateway-switching exists in two flavors: static (via the GW-SWITCH
- configuration option) and dynamic (selected by the configuration
- option DYNAMIC-GW) due to data contents. In both cases, a new host
- and corresponding port address is inserted into the URL of a hyperlink.
-
- Static gateway-switching is performed, if a DN given in the configu-
- ration file, or an entry below that DN, is referred to in the hyperlink.
- In that case, the beginning of the URL is taken from the configuration
- file and the DN of the referred-to X.500 entry is appended. Like other
- configuration options, GW-SWITCH in the tweb.rc file will refer to one
- such external gateway for all TWEB languages, whereas GW-SWITCH in the
- tweb.conf.x files will be language-specific.
-
- When the configuration option DYNAMIC-GW is given, TWEB will scan each
- entry to be referred to, for the presence of a so-called gateway-
- switch-URL. For the time beeing, this is encoded in the attribute
- "labeledURI", with the value having a special syntax. Normal syntax
- is an URL of the from "http://host/ label". With the gateway-switching
- option, this format is extended to "http://host:port/ label (gw)",
- for a language-independant switch, and "http://host:port/ label (gw-xx)",
- for a languager-specific switch. The "xx" has to be replaced by the
- international 2-letter language tag, as defined in ISO 639, "Code for
- the representation of names of languages" (see also RFC-1766). Thus,
- "gw-de" means "german language", "gw-en" means "english", "gw-fr"
- means "frensh". When displaying the contents of a labeledURI attribute,
- TWEB will suppress values that follow the above syntax. For performance
- reasons, searching of entries, as well as listing entries below the
- current position (i.e., browsing through the directory), will allways
- include look-up of the labeledURI and other attributes.
-
- If both static and dynamic gateway-switching are active, the dynamic
- switch will be considerred first; if no gateway-switch URL, first testing
- for a language-specific one, than testing for an independant one, is
- found within an entry, static switching is tested, again the specific
- case prior to the un-specific.
-
- The most prominent usage of the gateway-switching feature is to direct
- requests for other organizations' data within a country (or for sub-
- organizations within one organization) to specific gateways, thus
- giving the option to implement a Corporate Identity for each organi-
- zation via organization-specific header and footer files. Beside that,
- of course, specific access policies can be implemented by each orga-
- nization, and network traffic is reduced by accessing an organization's
- data directly with a HTTP browser, not via an intermittant gateway
- and X.500 server of another organization. This latter point may also
- mean a much reduced response time, when unnecessary data transfers are
- ommited.
-
-
-2.8 Restricting the service
-
- A number of configuration options can be used to restrict the display
- of certain information, or to deny service totally for certain users.
- These options are described in the following sub-chapters.
-
-2.8.1 Restricting the number of entries
-
- Normally, an X.500 server will have an option "sizelimit" set to
- some small or medium value, e.g., 100 or 500. This sizelimit will
- prevent the number of entries returned for any one request, to
- exceed that number. This is mainly set by the server's administrator
- to reduce system and network load.
-
- When displaying all entries returned from the server, TWEB might
- produce a very large HTML file. That file may take some time for
- transfer, and may be very un-handy, because of the long list of
- entries.
-
- To prevent the possibiloty of such large files, the TWEB administrator
- can reduce the number of entries displayed even further, by use of
- the MAXCOUNT configuration option. This will reduce the number of
- ALL entries returned from the server.
-
- If this restriction should only apply to person's entries, the
- configuration option MAX-PERSON can be used. This option will
- apply to each sub list of person's entries seperately. Thus, the
- total number of persons may exceed the MAX-PERSON limit, if more
- sub lists containing person's entries are given.
-
- Each restriction of the number of entries to be displayed, will
- lead to a random list of entries, cutting the results as soon as
- the maximum count is reached. However, rhis is also true for the
- sizelimit option at the server itself.
-
-2.8.2 Suppression of certain entries by RDN
-
- The server's access control rules will normally define, which entries
- can be obtained by the TWEB gateway. In some situations, the TWEB
- administrator might want to suppress even more entries, e.g., DSA
- entries or other mere technical ones. (This can also mean, that
- complete DIT areas could be hided from the user.)
-
- To invoke that, the configuration option NO-SHOW-RDN can be defined
- to reflect a space-seperated collection of RDNs, or parts of RDNs,
- which will not be shown to the user. This, of course, is a very
- crude method, but normally will give the results, the TWEB admin
- may be interested in.
-
-2.8.3 Defining DIT areas for search-only operations
-
- As described allready in the "Restricting the number of entries"
- section, large lists of entries may be cumbersome to read, if at
- all they are returned completely by the server. To exclude the
- possibility of such partial, or ultra-long lists, TWEB can be
- configured to display the search box only at certain DIT positions.
- This is done via the SEARCH-ONLY configuration option, which defines
- the DIT area(s) for this restriction, as well as certain message
- files, which should explain the local restriction to the user, and
- tell him, how to find the information, he is looking for. The
- SEARCH-ONLY configuration option will only take effect, when
- browsing the directory, but not prevent a normal subtree search.
-
- This configuration option, of course, can also be used to implement
- certain access policies. The option will be active for both the
- internal and the external user.
-
-2.8.4 Controlling the hackers
-
- From time to time, users will direct tools to the world-wide-web,
- that will screen through all, what is supplied in the system. This
- tools are known as robots, or crawles, and normally the collect data
- to build indices for faster information retrieval.
-
- Sometimes, however, these tools can be very ugly, especially, when
- they try to collect data as fast as possible. This might cause
- severe performance decrease, preventing other users to get data
- at all. In order to have some mechanisms against this type of
- data harvest, TWEB can be configured with the COMREFUSE option
- activated, which will control the number of accesses to the gate-
- way by a certain number of IP ranges within a selected time-slice.
-
- Those IP ranges are constructed by reducing the requesting host's
- 32-bit Internet address to a 13-bit number, thus giving 8192
- different IP ranges. Each IP range is controlled seperately during
- a pre-set time-slice, and each IP range can be excluded from
- further service (returning an appropriate error message), when
- a pre-set number of accesses is reached within that time-slice.
- All hosts of that IP range are suspended from TWEB's service for
- a number of time-slices, and resumed for service afterwards.
-
-
-3 Configuration of TWEB features in detail
-
- Runtime configuration is provided by the files tweb.rc (general
- configuration) and tweb.conf.x (language-specific configuration).
- For each supported language there must be a tweb.conf.x and
- tweb.lang.x file, with 0 <= x <= 9.
-
- Remark: most of the features are best configured in the files as given
- below, but there may be situations, where transfer, or even
- splitting to other configuration files could be used, e.g.,
- static gateway-switching may be configured in tweb.rc listing
- organizations which support only one gateway, whereas organi-
- zations supporting different language-specific gateways may be
- configured in the appropriate tweb.conf.x files; the resulting
- gw-switch list will contain all organizations, regardless of the
- originating files.
-
- In order to keep off WWW robots from blocking the gateway put
- a file with name robots.txt into the directory, together with
- the tweb binary, containing the following:
-
- # go away
- User-agent: *
- Disallow: /
-
- This is the same behaviour as if there were a www-server with a
- corresponding public directory containing the file robots.txt.
-
-
- The following sections will list TWEB's configuration options.
- (See also the example configuration files.)
-
-
-3.1 Technical configuration options
-
- This section lists options, which define the technical parameters of
- TWEB's operation. Most of them are located in the tweb.rc configuration
- file, but some could also go into the tweb.conf.x files.
-
- LDAPD -- The host running the LDAP daemon
- ( usually located in tweb.rc )
-
- example: LDAPD x500.zdv.uni-tuebingen.de
-
- LDAPPORT -- The port the LDAP daemon is listening on
- ( usually located in tweb.rc )
-
- example: LDAPPORT 389
-
- WEBPORT -- The base port the gateway is attached to
- (the language-specific offset x is added
- to this number for every running GW)
- ( usually located in tweb.rc )
-
- example: WEBPORT 7000
-
- TIMEOUT -- Timeout in seconds for any one LDAP
- operation
- ( usually located in tweb.rc )
-
- example: TIMEOUT 240
-
- ETCDIR -- The directory containing support files
- (help files, header/footer files ...)
- ( usually located in tweb.rc )
-
- example: ETCDIR ./LDAP_etc/
-
- FILTERFILE -- The LDAP filterfile
- ( usually located in tweb.rc )
-
- example: FILTERFILE ldapfilter.conf
-
- BASEDN -- The default starting point of DIB access, when
- no other directory position is given
- At this position, optional header and footer
- information (HTML code in file) can be displayed
- ( usually located in tweb.conf.x )
-
- example: BASEDN "o=Universitaet Tuebingen, c=DE"
- tweb-base.head.0 tweb-base.foot.0
-
- HELPFILE -- Name and path of the help-file
- ( usually located in tweb.conf.x )
-
- example: HELPFILE tweb.help.0
-
- FRIENDLYFILE -- Name and path of the friendly-file
- ( usually located in tweb.conf.x )
-
- example: FRIENDLYFILE ldapfriendly.0
-
- HEADER/FOOTER -- General header/footer information displayed on
- every HTML-page, except when other headers/footers
- apply
- ( usually located in tweb.conf.x )
-
- example: HEADER tweb.header.0
- FOOTER tweb.footer.0
-
- ALLOW-MSG -- Option to specify a special file located in the
- ETCDIRectory containing a message to be displayed
- in case of an allowed access to TWEB
- (see next section)
- ( usually located in tweb.conf )
-
- example: ALLOW-MSG allow.msg.0
-
-
-3.2 Political configuration options
-
- This section lists options to implement a certain access policy with the
- TWEB web-X.500 gateway, or to alter the behaviour of the gateway when
- displaying data from certain DIT areas.
-
- WEBDN -- The DN of a technical webgw X.500 entry,
- which is used for a permitted (internal) user
- (for logging AND access control)
- ( usually located in tweb.rc )
-
- example: WEBDN "cn=TWEB-quickie-intern,
- ou=SERVICES, o=Universitaet
- Tuebingen, c=DE"
-
- WEBPW -- The Password in the WEBDN entry
- ( usually located in tweb.rc )
-
- example: WEBPW password4quickie-intern
-
- WEBDN2* -- The DN of a technical webgw X.500 entry,
- which is used for a not-permitted (external) user
- (for logging AND access control)
- ( usually located in tweb.rc )
-
- example: WEBDN2 cn=TWEB-quickie-extern,
- ou=SERVICES, o=Universitaet
- Tuebingen, c=DE"
-
- WEBPW2* -- The Password in the WEBDN2 entry
- ( usually located in tweb.rc )
-
- example: WEBPW2 password4quickie-extern
-
- * setting WEBDN2 as well as WEBPW2 to real values is useful,
- if the X.500 service in the background is also used by other
- directory user agents; in this case, a clean distinction,
- even on the ACL level, can be made between TWEB and those
- other DUAs.
- To fully exploit the feature of two different WEBDNs the
- DSA must support an ACL policy, which can reduce access
- rights for a specified DN, while at the same time defining
- broader access rights for a group of other DN, which may
- also include the specific DN; such a behaviour is NOT
- implemented in Isode's QUIPU 2.x DSA; a patch introducing
- such a policy was developped at the University of Tuebingen
- for QUIPU 2.2v4, and can be optained seperately.
- Slapd stand-alone LDAP servers implement a different ACL
- mechanism and can be configured more easily by use of the
- first matching access-rule in the slapd.conf configuration file
-
- GRANT** -- A string describing IP domains allowed to access
- the gateway
- ( usually located in tweb.rc )
-
- example: GRANT (www9|mog|x500server|meal)
- \.zdv\.uni-tuebingen\.de$|
- (abcde01|xyz)\.modem\.org\.de$
-
- REFUSE** -- A string describing IP domains refused to access
- the gateway
- ( usually located in tweb.rc )
-
- example: REFUSE hackhost\.(org1\.)?uni-xyz\.de$
-
- ALLOW-STRING** -- A string describing IP domains allowed to
- access the DIB authorized by WEBDN (see above)
- example: "\.de$|\.us$|\.edu$"
- ==> host of domains de, us and edu will
- have authorized access to the DSA, others NOT
- ( usually located in tweb.rc )
-
- example: ALLOW-STRING uni-tuebingen\.de$
-
- DENY-STRING** -- The opposite of ALLOW-STRING. Here, access for
- subsets of the ALLOW-STRING may be reduced.
- ( usually located in tweb.rc )
-
- example: DENY-STRING not\.secure\.host
- \.uni-tuebingen\.de$
-
- ** GRANT/REFUSE are considered first to decide, whether the
- requesting host will be served at all; only hosts granted
- the service will be checked against ALLOW-STRING/DENY-STRING
- to classify as internal or external user (hence, giving
- WEBDN or WEBDN2 as the DN during X.500 look-up);
- both, GRANT and ALLOW-STRING are used as positive-lists,
- whereas REFUSE and DENY-STRING are used as negative-lists;
- if the positive-lists are defined, and the requesting host's
- IP domain is NOT covered by the list's description, the
- host is considered as not-permitted; only when the host
- is accepted by the positive-list, the negative-list will
- be considered to decide on a more specific exclusion of
- the host's IP domain;
- if the positive-lists are not defined, each host will be
- accepted, as if contained within the list; if the negative-
- lists are not defined, each host will be accepted, as if
- NOT contained within the list;
- hosts NOT found in the Domain Name Service (DNS) will be
- granted access, but will NEVER have authorized access
- via WEBDN
-
- TWEBHOST -- Supplies a constant hostname in the returned URL
- of HTTP links independant from the local one
- ( usually located in tweb.rc )
-
- example: TWEBHOST x500.zdv.uni-tuebingen.de
-
- NO-PROXY -- Access restrictions for WWW-PROXY-Servers
- ( usually located in tweb.rc )
-
- example: NO-PROXY
-
- ALLOW-PROXY -- if NO-PROXY is configured
- access from a given set of proxy-hosts
- ('host1:host2') is allowed
- ( usually located in tweb.rc )
-
- example: ALLOW-PROXY www1.zdv.uni-tuebingen.de:
- www2.zdv.uni-tuebingen.de
-
- COMREFUSE -- If configured, implements an interrupt-driven
- time-slicing of the gateway. During these
- slices only a maximum number of accesses
- from a given group of IP-addresses is permitted;
- additional accesses will lead to immediate
- suspension of the IP connection to the WWW
- client; this suspension will last for a con-
- figured number of time-slices, and service
- for the IP domain in question will resume
- afterwards. Additionally, access statistics will
- be dumped to a file at given intervals;
- the duration of a time-slice will be computed
- randomly between a minimum and maximum;
- all times are given in seconds
- ( usually located in tweb.rc )
-
- example: COMREFUSE 100 200 40 12 43200
- ./stats/hack-stats
-
- i.e.: minimum timeslice -> 100 secs
- maximum timeslice -> 200 secs
- number of accesses to tolerate in slice -> 40
- how long will be blocked -> 12 slices
- period to write a stat-file -> 43200 secs
- name of stat-file -> ./stats/hack-stats
- (i.e., file relative to TWEB binary)
-
- STRICT-BASEDN -- Access to entries not below basedn is relayed
- to another gateway ( -> GW-SWITCH must be set)
- ( usually located in tweb.rc )
-
- example: STRICT-BASEDN
-
- MAXCOUNT -- The maximum number of displayed entries
- ( usually located in tweb.rc )
-
- example: MAXCOUNT 200
-
- MAX-PERSON -- Maximum number of persons displayed in any of
- the configured sub-lists ( -> SORT option),
- if access is not allowed;
- if STRICT is given, this number of persons is
- shown at maximum, even in case of an
- allowed access;
- if NO-BROWSE is given, only non-person entries
- will be displayed while browsing, whereas persons
- have to be searched for
- ( usually located in tweb.rc )
-
- example: MAX-PERSON 5 STRICT NO-BROWSE
-
- NO-SHOW-RDN -- Matching rules for RDNs that will NOT be displayed
- (e.g., technical entries in the DIT or internal
- OUs not to be displayed by the GW)
- words surrounded by spaces will be matched as
- substrings; allignment to the start or end of
- the tested RDN can be enforced by surrounding
- the words with "|", on either side
- ( usually located in tweb.rc )
-
- example: NO-SHOW-RDN "|cn=Dummy notToBeShownRDN"
-
- SEARCH-ONLY -- Defines the root of a DIT area, where browsing
- is restricted to non-person entries; person
- entries can only be found by explicite searching
- (with appropriate header and footer information)
- ( usually located in tweb.conf )
-
- example: SEARCH-ONLY "ou=students, o=my-university,
- c=my" search-only.head.0
- search-only.foot.0
-
- LEGAL -- Flag for displaying of a comment concerning
- Peoples Rights
- (the text is configured in the tweb.lang.x files,
- string numbered 65 of the gateway)
- (Comment: certainly, it would be better to have
- that text in an external file)
- Sub-option ON-TOP directs TWEB to display the
- message immediately below the HEADER information,
- not above the FOOTER message
- ( usually located in tweb.rc )
-
- example: LEGAL ON-TOP
-
- CACHE-EXPIRE-DEFAULT -- The default value for the expire time
- in seconds. After this time the page is no
- longer cached by a browser or WWW cache.
- ( usually located in tweb.rc )
-
- example: CACHE-EXPIRE-DEFAULT 900
-
- CACHING-TERMS -- A more detailed description of caching directives.
- Format:
- <expire-time> READ|MENU|L2ND RDN|OC <value>
- ...
-
- To specify for a given access-type:
- READ|MENU|L2ND (L2ND = second page) the expire-time
- in seconds for given RDN|OC values
- ( usually located in tweb.rc )
-
- BEWARE: THIS OPTION IS NOT USED AT THE AUTHOR'S
- SITE, ROUTINELY. THUS, CORRECT BEHAVIOUR
- CANNOT BE GARANTEED !
-
- example: CACHING-TERMS 3600 READ RDN Fax
- 7200 MENU OC person
- 10800 menu RDN Mueller
-
- MODIFY/MODATTR -- Selects for specified object-class (MODIFY) the
- attributes permitted for modification, their
- labels and the maximum number of values to be
- handled by TWEB (MODATTR)
- ( usually located in tweb.conf )
-
- BEWARE: THIS OPTION IS NOT USED AT THE AUTHOR'S
- SITE, ROUTINELY. THUS, CORRECT BEHAVIOUR
- CANNOT BE GARANTEED !
-
- example: MODIFY person
- MODATTR personalTitle title 1
- telephoneNumber phone 2
- ...
-
- NO-MODIFY -- Entries that contain one of the named
- ObjectClasses will be displayed without
- the possibility for modification.
- ( usually located in tweb.rc )
-
- example: NO-MODIFY |toc_primas|
-
-
-3.3 Load balancing configuration options
-
- This section lists configuration options related to gateway-switching.
-
- GW-SWITCH -- Defines DIT areas, which will direct TWEB to
- introduce other gateway addresses for the
- so-called gateway-switching
- (STATIC gateway-switching; see section 2.7)
- ( usually located in tweb.conf )
-
- REMARK: A set of slides explaining gateway-switching,
- presented at the January-1999 DANTE meeting
- in Utrecht, NL, can be found at the TWEB FTP
- site at
- ftp://ftp-x500.uni-tuebingen.de/tweb
-
- example: GW-SWITCH "ROOT" HTTP://x500-relay.
- uni-tuebingen.de:8901/M
- "c=DE" HTTP://x500-relay.
- uni-tuebingen.de:8911/
-
- DYNAMIC-GW -- If given, tells TWEB to use dynamic gateway-
- switching; if not given, only static switching
- will be used, if configured;
- a labeledURI attribute in an X.500 entry con-
- taining (gw), (gw-de), or (gw-en) in its label
- part is used to link this entry to another gateway
- ( usually located in tweb.rc )
-
- example: DYNAMIC-GW
-
-3.4 Display configuration options
-
- This section lists options related to the displaying of results on an
- HTML page. The options direct display of entries, attributes, as well
- as styles for displaying.
-
- SORT -- Classification of a list of entries into sub-lists
- according to their object classes; generating of
- sub-lists will be according to the order the
- OCs are given in the SORT option; displaying the
- sub-lists will be according to the numbers given
- as third parameter; sub-lists without an intro-
- ducing label (second parameter) should have a
- label of " "; the fourth parameter is the DISPLAY-
- TYPE for a given object (see below) and the fifth
- parameter is the attribute used for sorting;
- parameters four and five are optional;
- if not given reasonable defaults will be used;
- if none of the entries objectclasses is given
- in the SORT option, TWEB will randomly select
- one of the entry's OCs as a new entry to the
- SORT list, using DISPLAY-TYPE "default"; if that
- type is not defined, the entry will NOT be
- displayed at all
- (see also section 2.5)
- ( usually located in tweb.conf.x )
-
- example: SORT person Staff 4 person tat_sort
- organization Organizations 3 orgs
- organizationalUnit "O Units" 2 ous
- ...
-
- DISPLAY-OBJECT -- For specified DISPLAY-TYPES define the order,
- labels and type of HTML-code produced for given
- attributes (see FIRST-PAGE, SECOND-PAGE below);
- a DISPLAY-TYPE "default" will match all types
- NOT specifically listed; when the default type
- is not giving, some X.500 entries might NOT be
- displayed (see also SHOW-DEFOC below)
- ( usually located in tweb.conf.x )
-
- example: DISPLAY-OBJECT person
- FIRST-PAGE ....
-
- FIRST-PAGE -- Attributes to be displayed for a specified
- DISPLAY-TYPE
- Format: <attribute> <label> <display-type>
- Display-types:
- MULTILINE -- attribute with multiple lines
- DATE -- attribute as date
- HREF -- attribute with syntax DN
- as hyperlink (READ DN entry)
- URI -- attribute with syntax URL
- as hyperlink
- MAILTO -- attribute as mailto (must be
- supported by WWW client)
- MOVETO -- like HREF, but the link will
- be a LIST, instead of a READ
- hyperlink
- BMP -- phote as bitmap
- JPEG -- photo as jpeg
- JPEG2GIF -- convert jpeg to gif
- BOOLEAN -- binary attribute
- PGPKEY -- display PGPKey for cut&paste
- DYNAMICDN -- uses DIT-CONFIG to show
- attribute as hyperlink
- INDEXURL -- show this hyperlink as defined
- with INDEX-URL
- DEFAULT -- anything else
-
- example: DISPLAY-OBJECT person
- FIRST-PAGE cn Name DEFAULT
- personalTitle Title DEFAULT
- ...
-
- SECOND-PAGE -- show additional attributes not displayed on
- the first page
-
- example: DISPLAY-OBJECT person
- FIRST-PAGE ...
- ...
- SECOND-PAGE sn Surname DEFAULT
- info Information DEFAULT
-
- SHOW-DEFOC -- Show Default Objectclass. If no objectclass
- did match -> show entry with attributes as
- defined in default-display
- ( usually located in tweb.rc )
-
- example: SHOW-DEFOC
-
- PULL-DOWN-MENUS -- Use BUTTONS and PULL-DOWN-MENUS instead of links
- in order to support: help, language-switch,
- move-upwards and read-entry functionalities
- ( usually located in tweb.rc )
-
- example: PULL-DOWN-MENUS
-
- LANGUAGE -- The labels of buttons for the switch to
- the other started language-specific gateways
- ( usually located in tweb.rc )
-
- example: LANGUAGE Deutsch
- English
- Français
-
- STRIP-PIN -- Specify here the object-classes where numbers
- ( PINs, personal ident numbers, etc. ) following
- an RDN will be stripped when displayed
- ( usually located in tweb.rc )
-
- example: STRIP-PIN |toc_profs|person|toc_primas|
- toc_cperson|toc_funcs|toc_pextra|
-
- INDIRECT-ATTRS -- Format:
- INDIRECT-ATTRS <ref-attribute>
- IND_ATTRS <selection> REPLACE|APPEND <attribute>
- <host> <port> <baseDN>
-
- If there is an attribute with name <ref-attribute>
- in a given entry, values of attribute <attribute>
- in this entry will be REPLACEed|APPENDed by values
- taken from the same attribute <attribute> of
- an entry with DN:
- "cn=<ref-attribute-value>,<baseDN>",
- looked-up at an LDAP server <host>:<port>,
- but only when some value in <ref-attribute>
- matches <selection> at its beginning
- ( usually located in tweb.rc )
-
- example: INDIRECT-ATTRS tat_refattr
- IND_ATTRS POST- append postaladdress
- x500.uni-tuebingen.de 10100
- "ou=POST,ou=INTERNA,ou=NETZWERK,
- o=Universitaet Tuebingen,c=DE"
-
- DISP-SEA-RDN -- Make search-results to be displayed only by RDN
- and not by DN relative to the search-base
- ( usually located in tweb.rc )
-
- example: DISP-SEA-RDN
-
- INDEX-URL -- Display labels of hyperlinks only with selected
- RDN parts in the order configured by INDEX-URL;
- this option applies to URL attributes within an
- entry, which are directed towards other X.500
- entries; an application of that might be an
- index of entries
- DISPLAY-TYPE must be set to INDEXURL.
- ( usually located in tweb.rc )
-
- example: INDEX-URL 0,-2 "o=Universitaet Tuebingen, c=DE"
-
- i.e.: labels of a hyperlink below the University
- of Tuebingen are shown as follows:
-
- 1. lowest part of the DN (e.g., a person's name)
- 2. third-top-most part of the DN (e.g., faculty)
-
- all other DN parts will be supressed
-
- TABLES -- Format:
- TABLES <ALLOW|ALL> <objectclass> <Button-label>
- <mode-selection>:<attribute>,<col-width>
- [&<attribute>,<col-width>]*
-
- During browsing, the entries listed below a
- base object (i.e., DIT position) can be displayed
- together with some selected attributes in a
- tabular format; the SORT configuration option
- will be applied to the entries; attribute mail
- will be displayed as mailto: and the RDN will
- be displayed as a link to the respective entry;
- in order to select the tabular format, TWEB will
- display a button with a given label, that, if
- pressed, will request the tabular format;
- however, the button will only be displayed, if
- the requesting user is allowed to get this
- feature (i.e., ALLOW will select internal users
- only, whereas ALL will select all users)
-
- example: TABLES ALLOW oleaf Tabelle persontable:rdn,28
- &telephonenumber,25&tat_dummyattr,2
- &mail,45
-
- i.e.: ALLOW -> only allowed users will see the table
- oleaf -> table button is shown on presence of
- the objectclass oleaf in the base entry
- Tabelle -> the label for the table-request-
- button
- persontable -> the keyword for function-
- selection of a persons' table
- rdn,28 -> first the rdn-attribute is shown
- in the table with width 28 percent
- telephonenumber,25 -> telephonenumber,
- width 25
- tat_dummyattr,2 -> a separating column, width 2
- mail,45 -> the e-mail-address with width 45
-
- (all width values are given in percentage of
- the width of the browsers window, and should
- sum up to 100 %)
-
-
-4 Support and discussion list
-
- Bug reports and flames (but also critical comments) send to
-
- tweb-support@mail500.uni-tuebingen.de.
-
- For general discussion (e.g., about interesting new features,
- which should be supported), there is a discussion list at
-
- tweb-l@mail500.uni-tuebingen.de.
-
- Send requests for subscription to
-
- tweb-l-request@mail500.uni-tuebingen.de.
-
-
-
-TWEB development team, Tuebingen, January, 15th, 1999
-
-
+++ /dev/null
-TWEB WWW-X500 GATEWAY - GETTING STARTED
-
-With the information provided by this file you should be able to start
-an initial version of TWEB. Please follow the steps below:
-
-1. Copy the distribution Makefile onto Makefile:
-
- > cp Makefile.openldap Makefile
-
-2. Edit the Makefile. You have to change the variables in the first block of
- the file to your appropriate settings:
-
- > vi Makefile
-
-3. Now type in make:
-
- > make
-
- This should make a binary called tweb whithout severe problems
-
-4. Running the TWEB www-x500 gateway
-
-4.1. Testing the newly compiled binary
-
- Copy the tweb binary to the sub-directory TWEB_conFiles and
- change to that directory:
-
- > cp tweb TWEB_conFiles
- > cd TWEB_conFiles
-
- Copy the config files with extension .dist to their respective
- basefiles:
-
- > cp tweb.rc.dist tweb.rc
- > cp tweb.conf.0.dist tweb.conf.0
- > cp tweb.conf.1.dist tweb.conf.1
- > cp tweb.lang.0.dist tweb.lang.0
- > cp tweb.lang.1.dist tweb.lang.1
-
- Edit tweb.rc to adjust the variables in the
- first block to your appropriate settings:
-
- > vi tweb.rc
-
- Run TWEB with language 0 and 1 (i.e., german and english)
-
- > ./tweb -L01
-
- This will run two TWEB server processes, one for german language, the
- other for english language, whithout syslog logging;
- you can assess them with your WWW browser by giving the URL
-
- http://<your-tweb-host>:<your-tweb-port>/
-
-4.2. Adapting TWEB to your local requirements
-
- When you reached this point you have a running TWEB with basic
- functionality. Have a look to the FEATURE-LIST file for a
- description of all features, TWEB does provide. The least, you
- might want to change are the several header and footer files
- in order to build up your organizational identity with TWEB.
- But check also the security features, and the performance (i.e.,
- load balancing) features. By setting the respective parameters,
- TWEB can provide for a very special appearance with local require-
- ments enforced as far as possible. Should you want more reasonable
- features, please don't hesitate to contact the development team.
-
-
- Have fun,
-
- TWEB development team, Tuebingen, September, 9th, 1999
-
- email: tweb-support@mail500.uni-tuebingen.de
-
-
+++ /dev/null
-<strong>Datei: LDAP_etc/allow.msg.0<br>
-Achtung</strong>: Dies ist eine Meldung, die nur dem authorisierten
-Nutzer angezeigt wird !!!
-<hr>
+++ /dev/null
-<strong>File: LDAP_etc/allow.msg.1<br>
-Attention</strong>: This message will only be shown to the
-permitted user.
-<hr>
+++ /dev/null
-# ldap filter file
-#
-# lines like this that start with # or empty lines are ignored
-#
-# syntax:
-#
-# <tag>
-# <pattern1> <delimiters> <filter1-1> <desc1-1> [<scope>]
-# <filter1-2> <desc1-2> [<scope>]
-#
-# <pattern2> <delimiters> <filter2-1> <desc2-1> [<scope>] ...
-#
-# The "desc" should describe the filter and it should correctly complete
-# both of the following phrases:
-#
-# One <desc> match was found for...
-# Three <desc> matches were found for...
-#
-# The scope is optional, and should be one of:
-# "base"
-# "onelevel"
-# "subtree"
-# if it is included.
-#
-
-"finger and go500 and go500gw subtree and rp500 and rcpt500"
- "=" " " "%v" "arbitrary filter"
-
- "^[0-9][0-9\-]*$" " " "(telephoneNumber=*%v)" "phone number"
-
- "@" " " "(mail=%v)" "email address"
- "(mail=%v*)" "start of email address"
-
- "^.[\. _].*" ". _" "(cn=%v1* %v2-)" "first initial"
-
- ".*[. _].$" ". _" "(cn=%v1-*)" "last initial"
-
- "[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact"
- "(|(sn~=%v1-)(cn~=%v1-))" "approximate"
-
- ".*" ". " "(|(cn=%v1)(sn=%v1)(uid=%v1))" "exact"
- "(|(cn~=%v1)(sn~=%v1))" "approximate"
-
-"web500gw subtree"
- "=" " " "%v" "arbitrary filter"
-
- "^[0-9][0-9\-]*$" " " "(|(telephoneNumber=*%v)(facsimileTelephoneNumber=*%v))" "phone number"
-
- "@" " " "(mail=%v)" "email address"
- "(mail=%v*)" "start of email address"
-
- "^.[\. _].*" ". _" "(cn=%v1* %v2-)" "first initial"
-
- ".*[. _].$" ". _" "(cn=%v1-*)" "last initial"
-############
-# "[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact"
-# "(|(sn~=%v1-)(cn~=%v1-))" "approximate"##
-#
-# ".*" ". " "(|(cn=%v1)(sn=%v1))" "exact"
-# "(|(cn~=%v1)(sn~=%v1))" "approximate"#
-#
-# Neue Einstellungen 970127 KPG:
- "[oO][xX]:.*" ":" "(|(ou=%v2-))" "exact"
- "[xX][oO]:.*" ":" "(|(ou=%v2-))" "exact"
- "[oO]:.*" ":" "(|(ou=%v2-))" "exact"
- "(|(ou~=%v2-))" "approximate"
- "[xX]:.*[. _].*" ":" "(|(cn=%v2%v3%v4-))" "exact"
- "[xX]:.*" ":" "(|(sn=%v2-))" "exact"
-
- "[. _]" ". _" "(|(cn=%v))" "exact"
- "(|(cn~=%v))" "approximate"
-
- ".*" ". " "(|(sn=%v))" "exact"
- "(|(sn~=%v))" "approximate"
-
-"go500gw onelevel and web500gw onelevel"
- "^..$" " " "(|(o=%v)(c=%v)(l=%v)(co=%v))" "exact"
- "(|(o~=%v)(c~=%v)(l~=%v)(co~=%v))" "approximate"
-
- " " " " "(|(o=%v)(l=%v)(co=%v))" "exact"
- "(|(o~=%v)(l~=%v)(co~=%v))" "approximate"
-
- "\." " " "(associatedDomain=%v)" "exact"
-
- ".*" " " "(|(o=%v)(l=%v)(co=%v))" "exact"
- "(|(o~=%v)(l~=%v)(co~=%v))" "approximate"
+++ /dev/null
-AU Australien
-AR Argentinien
-AT Österreich
-BE Belgien
-BR Brasilien
-CA Kanada
-HR Kroatien
-CS Tschechoslowakei
-CZ Tschechische Republik
-DK Dänemark
-FI Finnland
-FR Frankreich
-DE Deutschland
-EE Estland
-GB Großbritannien
-GR Griechenland
-HK Hong Kong
-HU Ungarn
-IS Island
-IN Indien
-IE Irland
-IL Israel
-IT Italien
-JP Japan
-KR Korea
-LI Liechtenstein
-LU Luxemburg
-NL Niederlande
-NZ Neuseeland
-NO Norwegen
-PL Polen
-PT Portugal
-ES Spanien
-SE Schweden
-CH Schweiz
-RU Russische Föderation
-US Vereinigte Staaten von Amerika
-SI Slowenien
-SK Slowakei
-SG Singapur
+++ /dev/null
-AU Australia
-AR Argentina
-AT Austria
-BE Belgium
-BR Brazil
-CA Canada
-HR Croatia
-CS Czechoslovakia
-CZ Czech Republic
-DK Denmark
-FI Finland
-FR France
-DE Germany
-EE Estonia
-GB Great Britain
-GR Greece
-HK Hong Kong
-HU Hungary
-IS Iceland
-IN India
-IE Ireland
-IL Israel
-IT Italy
-JP Japan
-KR Korea
-LI Liechtenstein
-LU Luxemburg
-NL Netherlands
-NZ New Zealand
-NO Norway
-PL Poland
-PT Portugal
-ES Spain
-SE Sweden
-CH Switzerland
-RU Russian Federation
-US United States of America
-SI Slovenia
-SK Slovakia
-SG Singapore
+++ /dev/null
-<hr>
-<strong>Datei: LDAP_etc/search-only.foot.0<br>
-Achtung:</strong> Dieser Text wird als Footer einer Search-Only-Seite
-angezeigt !!!
+++ /dev/null
-<hr>
-<strong>File: LDAP_etc/search-only.foot.1<br>
-Attention:</strong> This footer will be display'ed at the end
-of a search-only page.
+++ /dev/null
-<h1>Search-Only-Seite</h1>
-<strong>Datei: LDAP_etc/search-only.head.0<br>
-Achtung:</strong> Dieser Text wird am Beginn einer Search-Only-Seite
-angezeigt !!!
-<hr>
+++ /dev/null
-<h1>Search-Only-Page</h1>
-<strong>File: LDAP_etc/search-only.head.1<br>
-Attention:</strong> This header will be display'ed at the beginning
-of a search-only page.
-<hr>
+++ /dev/null
-<hr>
-<strong>Datei: LDAP_etc/tweb-base.foot.0<br>
-Achtung:</strong> Diese Seite wird als Footer auf der BASEDN-Seite
-angezeigt !!!
+++ /dev/null
-<hr>
-<strong>File: LDAP_etc/tweb-base.foot.1<br>
-Attention:</strong> This text will be display'ed at the end of
-the BASEDN page.
+++ /dev/null
-<h1>BASEDN-Header</h1>
-<strong>Datei: LDAP_etc/tweb-base.head.0<br>
-Achtung:</strong> Dieser Header wird am Beginn der BASEDN-Seite
-angezeigt !!!
-<hr>
+++ /dev/null
-<h1>BASEDN-Header</h1>
-<strong>File: LDAP_etc/tweb-base.head.1<br>
-Attention:</strong> This header will be display'ed at the beginning
-of the BASEDN page.
-<hr>
+++ /dev/null
-<hr>
-<strong>Datei: LDAP_etc/tweb.footer.0<br>
-Achtung:</strong> Dieser Footer wird am Ende einer normalen
-Seite unterhalb BASEDN angezeigt !!!
+++ /dev/null
-<hr>
-<strong>File: LDAP_etc/tweb.footer.1<br>
-Attention:</strong> This footer will be display'ed at the end of a page
-below BASEDN.
+++ /dev/null
-<h1>TWEB</h1>
-<strong>Datei: LDAP_etc/tweb.header.0<br>
-Achtung:</strong> Dieser Header wird am Beginn einer Seite unterhalb
-von BASEDN angezeigt !!!
-<hr>
+++ /dev/null
-<h1>TWEB</h1>
-<strong>File: LDAP_etc/tweb.header.1<br>
-Attention:</strong> This header will be display'ed at the beginning of
-a page below BASEDN.
-<hr>
+++ /dev/null
-<TITLE>TWEB HILFE</TITLE>
-<BODY>
-<H2> Das TWEB WWW2X.500-Gateway </H2>
-
-Im X.500 sind weltweit viele Personen und Organisationen mit EMail- Adresse,
-Postanschrift, FAX, Telefonnummer, Aufgabenbereich, etc. zu finden.
-Zum einfachen Zugriff per WorldWideWeb dient <strong>TWEB</strong> WWW2X.500-Gateway.<P>
-
-<strong>TWEB</strong> ermöglicht das einfache Browsen, die Suche
-und die Modifikation des eigenen Eintrages im X.500.<P>
-Das Gateway enthält folgende Features
-<ul>
-
-<li>Für den Administrator bietet <strong>TWEB</strong> umfangreiche Möglichkeiten
-der Konfiguration mittels Konfigurations-Dateien, ohne Änderungen im
-Code und ohne erneutes Übersetzen.
-<li>Zusätzlich sind Datenschutzmechanismen aktivierbar.
-<li>Andere Sprachen sind durch Ersetzen/Hinzufügen
-von Sprach-Dateien leicht realisierbar.
-
-<li>Wie Sie es vom WWW her gewohnt sind, brauchen Sie nur den gewünschten
-unterstrichenen Eintrag anklicken, und Sie sehen, was darunter angesiedelt ist.
-
-<li>Mit "Weitere Informationen" wird eine zweite Info-Seite gezeigt.
-
-<li>Mit Hilfe der SUCH-Box können Sie nach Namen und Teilstrings suchen.
-
-<li>Ihren eigenen Eintrag können Sie mit Ihrem Passwort in Verbindung
-mit dem entsprechenden Button ändern.
-</ul>
-
-
-<hr>
-
-<strong>TWEB</strong> ist eine Weiterentwicklung vom Web500gw von Frank Richter, Technische
-Universitaet Chemnitz-Zwickau, basierend auf go500gw von Tim Howes,
-University of Michigan.
-
-<hr>
-
-Bei Fragen, Anregungen, Bug-Reports Mail an:
-
-<ADDRESS><A HREF="mailto:web500gw-support@mail500.uni-tuebingen.de"> web500gw-support@mail500.uni-tuebingen.de</A> - Stand: 16. Februar 1996</ADDRESS>
-
-<hr>
-
+++ /dev/null
-<TITLE>TWEB HELP</TITLE>
-<BODY>
-<H2> TWEB WWW2X.500-Gateway HELP</H2>
-
-There are worldwide lots of persons and organizations stored in the X.500-
-directory with email-address, postal address, fax, telephone-number,
-working-area, etc. For easy access with WorldWideWeb there is the
-<strong>TWEB</strong> WWW2X.500-Gateway.<P>
-
-<strong>TWEB</strong> allows easy browsing, searching and modification of
-entries in the X.500-directory.<p>
-Features of the gateway include
-<ul>
-<li>For the administrator <strong>TWEB</strong> offers extensive opportunities of
-configuration by means of configuration-files without change of code
-and without recompilation.
-<li>Configurable data-protection-mechanisms are available.
-<li>Other languages are supported by language-resource-files.
-
-<li>As with other WWW applications you only have to click on the desired entry
-to see, what is settled beneath.
-
-<li>The button "More Information" shows a second page of information.
-
-<li>By means of the SEARCH-box you can look for persons with exact or substring
-match.
-
-<li>You can modify your own entry by typing in your password in combination
-with the modification button.
-</ul>
-
-
-
-<hr>
-
-<strong>TWEB</strong> is based on Web500gw from Frank Richter, Technische
-Universitaet Chemnitz-Zwickau, that itself is based on go500gw from Tim Howes,
-University of Michigan.
-
-<hr>
-
-For questions, suggestions, bug-reports mail to:
-
-<ADDRESS><A HREF="mailto:x500-netman@mail500.uni-tuebingen.de"> x500-netman@mail500.uni-tuebingen.de</A> - 27. October 1995</ADDRESS>
-
-<hr>
-
+++ /dev/null
-#*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-# *
-# Makefile... *
-# *
-# Function:..TWEB WWW to X.500-GATEWAY SERVER MAKEFILE *
-# *
-# *
-# *
-# Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-# Zentrum fuer Datenverarbeitung, *
-# Bereich Entwicklungneuer Dienste, *
-# Universitaet Tuebingen, GERMANY *
-# *
-# ZZZZZ DDD V V *
-# Creation date: Z D D V V *
-# August 16 1995 Z D D V V *
-# Last modification: Z D D V V *
-# September 13 1999 ZZZZ DDD V *
-# *
-#/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/
-#-----------------------------------------------------------------------------
-#
-# based on web500gw.c of Frank Richter, TU Chemnitz-Zwickau, DE
-#
-# first edition: 95/07/28, /KSp
-#
-# $Id: Makefile.openldap,v 1.6 1999/09/10 15:01:15 zrnsk01 Exp $
-#
-#-----------------------------------------------------------------------------
-
-#########################################################################
-###
-### Tailor the following to your local settings
-###
-#########################################################################
-
-# where is your LDAP client library located
-# WE NEED portable.h AND ldap_log.h, SO POINT TO THE SOURCE TREE
-LDAP_RUNTIME=../..
-LDAP_SOURCE =../..
-
-LIBDIR= $(LDAP_RUNTIME)/libraries
-INCDIR= $(LDAP_RUNTIME)/include
-
-# where is some version information for your LDAP client library
-LDAPDIR= $(LDAP_SOURCE)/build
-
-# select your compiler (DEFAULT=cc) and uncomment ACFLAGS and/or COPTS
-# to have options for the linker and/or compiler
-CC= gcc
-# ACFLAGS=
-# COPTS= -Aa -O # cc on a HP box
-COPTS= -Wall -ansi -pedantic -O2
-
-# uncomment next line when compiling on SUN
-# LXNET = -lxnet
-
-# we don't have any special definitions for the current distribution
-# DEFINES=
-
-#########################################################################
-###
-### You should leave the following definitions untouched
-###
-#########################################################################
-
-SRCS = tweb.c strng.c init.c queries.c server.c \
- x500.c html.c support.c checkclient.c \
- charray.c ch_malloc.c dn.c regular.c
-OBJS = tweb.o strng.o init.o queries.o server.o \
- x500.o html.o support.o checkclient.o \
- charray.o ch_malloc.o dn.o regular.o
-GWOBJS = $(OBJS) gwversion.o
-
-CFLAGS = $(COPTS) -I$(INCDIR) $(ACFLAGS) $(DEFINES) $(GWVERS)
-LIBS = -lldap -llber $(KRBLIBFLAG) $(KRBLIBS) $(LXNET)
-DLIBS = $(LIBDIR)/libldap.a $(LIBDIR)/liblber.a
-
-gw: gwversion.o
- $(CC) $(ALDFLAGS) -o $@ $(GWOBJS) -L$(LIBDIR) $(LIBS)
- mv $@ tweb
-
-gwversion.c: $(OBJS) $(DLIBS)
- rm -f $@
- (u=$${USER-root} v=`cat $(LDAPDIR)/version` d=`pwd` h=`hostname` t=`date`; \
- sed -e "s|%WHEN%|$${t}|" \
- -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
- -e "s|%VERSION%|$${v}|" \
- < Versiongw.c > $@)
-
-lint:;
- lint -I. $(SRCS)
-
-5lint:;
- /usr/5bin/lint -I. $(SRCS)
-
-clean:;
- rm -f *.o core a.out gwversion.c tweb
-
-depend:;
- $(LDAPDIR)/mkdep $(CFLAGS) $(SRCS)
-
-# DO NOT DELETE THIS LINE -- mkdep uses it.
-# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
-
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* README *
-* *
-* Function:..Introduction to the WWW-X.500 gateway TWEB *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* September 14 1995 Z D D V V *
-* Last modification: Z D D V V *
-* September 13 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/
-
-
-IMPORTANT HINT FOR UPGRADING TO VERSION 2.3.x:
-
- the config-syntax of ALLOW-STRING DENY-STRING GRANT REFUSE has changed:
- now regular expressions are used enabling shorter config strings.
-
- the language-files have been extended. Please use the newly provided
- language-files or update your old ones.
-
-
-
-INTRODUCTION
-
- TWEB is based on the Web500gw implementation by Frank Richter,
- Technische Universitaet Chemnitz-Zwickau, which is based on the
- go500gw implementation by Tim Howes, University of Michigan.
-
- TWEB was compiled and tested on LINUX with cc, HPUX 9.05 with the
- HP-ANSI C compiler, as well as SunOS 4.1.2 with the SUN C compiler.
- TWEB was also compiled with gcc on all platforms.
-
- The UMICH LDAP client library version 3.0 or 3.3
- ( URL:ftp://terminator.rs.itd.umich.edu/ldap/ldap-3.3.tar.Z )
- must be installed on the machine (library path and include file
- path is configured in Makefile). With QUIPU ICR-2.x the ISODE-
- provided LDAP libraries should be used. As such, TWEB only supports
- LDAP version 2 with the University of Michigan type C API. TWEB is
- also adapted for the OpenLDAP LDAP library, release version 1.1.2
- (http://www.openldap.org).
-
- An upgrade to LDAP version 3 and a C API standadized by the IETF
- is planned for a not so far away future, most probably in step
- with the OpenLDAP package.
-
- TWEB, as provided here is a fully functional core gateway, which
- is extended at the author's site by some local features. These
- extensions are included into the same code base, so that some
- "#ifdef TUE_TEL" or "#ifdef AMBIX" pre-processor statements can
- be found throughout the code.
-
- Have a look at the doc sub-directory to get some further documentation.
-
-
-INSTALLATION
-
- The installation and configuration of TWEB is described in the
- GETTING-STARTED file. After making and testing the basic TWEB
- you should have a look to file FEATURE-LIST to learn about the
- several configuration parameters TWEB provides for runtime
- configuration of the program.
-
- SINCE THE CODE IS ONLY THE CORE GATEWAY, WITH SOME PRIVATE EXTENSIONS
- NOT INCLUDED INTO THAT DISTRIBUTION, DO NOT DELETE CODE BETWEEN
-
- #ifdef TUE_TEL
- #endif
-
- AND
-
- #ifdef AMBIXGW
- #endif
-
- IN ANY OF THE SUPPORTED FILES !!!
-
-
-SUPPORT
-
- Bug reports and flames (but also critical comments) please send to
-
- tweb-support@mail500.uni-tuebingen.de.
-
- For general discussion (e.g., about interesting new features,
- which should be supported), there is a discussion list at
-
- tweb-l@mail500.uni-tuebingen.de.
-
- Send requests for subscription to
-
- tweb-l-request@mail500.uni-tuebingen.de.
-
-
-TWEB development team, Tuebingen, September, 9th, 1999
-
-
+++ /dev/null
-# go away
-User-agent: *
-Disallow: /
+++ /dev/null
-#*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-# *
-# tweb.conf.0 *
-# *
-# Function:..Configuration-file for TWEB *
-# *
-# *
-# *
-# Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-# Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-# neuer Dienste, Universitaet Tuebingen, GERMANY *
-# *
-# ZZZZZ DDD V V *
-# Creation date: Z D D V V *
-# July 26 1996 Z D D V V *
-# Last modification: Z D D V V *
-# December 18 1998 ZZZZ DDD V *
-# *
-#/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/
-#==========================================================================
-# $Id: tweb.conf.0.dist,v 1.6 1999/09/10 15:01:21 zrnsk01 Exp $
-
-
-# THE PARAMETERS IN THIS FILE AND THE CORRESPONDING CONFIG-FILE.1
-# ARE PRE-SET TO PROVIDE A BASIC FUNCTIONALITY.
-#
-# IF YOU LIKE, YOU CAN CHECK FOR FURTHER DISPLAY-OBJECTs, SORT,
-# SEARCH-ONLY AND MODIFY DEFINITIONS IN THE SECOND PART OF THE FILE.
-#
-# TO ACTIVATE A CERTAIN FEATURE, THE CORRESPONDING LINES HAVE TO
-# BE DE-COMMENTED
-
-
-#########################################################################
-
-
-###
-### the description, how to display an object upon read
-###
-
-# FIRST-PAGE is the main view, SECOND-PAGE a linked page with more
-# (e.g., not so important) information
-#
-# given is a list of attributes, with labels for each and the method,
-# how to display the content of the attribute
-
-DISPLAY-OBJECT pers
-# 1.Bild
-FIRST-PAGE cn Name DEFAULT
- personalTitle Titel DEFAULT
- organizationalStatus Dienststellung DEFAULT
- description Arbeitsgebiet DEFAULT
- telephoneNumber Geschäfts-Telefon DEFAULT
- facsimileTelephoneNumber Fax DEFAULT
- mail E-Mail-Adresse MAILTO
- textEncodedORaddress X400-Adresse DEFAULT
- postalAddress Anschrift MULTILINE
- roomNumber Raum DEFAULT
- labeledURI URL URI
-# 2.Bild (see more)
-SECOND-PAGE sn Nachname DEFAULT
- roleOccupant Funktionsträger HREF
- memberOfGroup E-Mail-Verteiler DEFAULT
- homepostalAddress Heimat-Anschrift MULTILINE
- homePhone Privat-Telefon DEFAULT
- pager Pager DEFAULT
- lastModifiedTime "letztmalig geändert" DATE
- lastModifiedBy "letztmalig geändert von" DEFAULT
-
-DISPLAY-OBJECT organization
-# 1.Bild
-FIRST-PAGE o Name DEFAULT
- ou Name DEFAULT
- l Ort DEFAULT
- description Beschreibung DEFAULT
- postalAddress Postanschrift MULTILINE
- telephoneNumber Telefon DEFAULT
- facsimileTelephoneNumber Fax DEFAULT
- labeledURI URL URI
-# 2.Bild (see more)
-SECOND-PAGE st Bundesland DEFAULT
- seeAlso "weitere Informationen" MOVETO
- lastModifiedTime "letztmalig geändert" DATE
- lastModifiedBy "letztmalig geändert von" DEFAULT
-
-DISPLAY-OBJECT rfc822MailList
-# 1. Bild
-FIRST-PAGE description Beschreibung DEFAULT
- joinable abonnierbar BOOLEAN
- associatedDomain E-Mail-Domain DEFAULT
- rfc822RequestsTo "Anfragen an" MAILTO
- requestsTo "Anfragen an" HREF
- owner Eigentümer HREF
-# 2. Bild
-SECOND-PAGE lastModifiedTime "letzte Änderung" DATE
- lastModifiedBy "geändert durch" DEFAULT
-
-DISPLAY-OBJECT country
-# 1.Bild
-FIRST-PAGE friendlyCountryName Ländernamen DEFAULT
- associatedDomain Domain DEFAULT
- manager Manager HREF
- labeledURI URL URI
-# 2.Bild (see more)
-SECOND-PAGE masterDSA Master-DSA HREF
- slaveDSA Slave-DSA HREF
- lastModifiedTime "letztmalig geändert" DATE
- lastModifiedBy "letztmalig geändert von" DEFAULT
- lastUpdateTime "letztmalig geändert" DATE
-
-DISPLAY-OBJECT default
-# 1.Bild
-FIRST-PAGE jpegPhoto Foto JPEG
- photo Foto BMP
- cn Name DEFAULT
- sn Nachname DEFAULT
- textEncodedMtaName MTA-Name DEFAULT
- relatedMHSdomain MHS-Domain DEFAULT
- description Beschreibung DEFAULT
- multiLineDescription Beschreibung MULTILINE
- info "Allgemeines" DEFAULT
- productName Produktname DEFAULT
- mail Mail-Adresse MAILTO
- telephoneNumber Telefon DEFAULT
- facsimileTelephoneNumber Fax DEFAULT
- labeledURL URL URL
- memberOfGroup E-Mail-Verteiler DEFAULT
- member Mitglied HREF
- owner Eigentümer HREF
- requestsTo "Anfragen an" HREF
- errorsTo "Fehler an" HREF
- krbName Kerberos-Name DEFAULT
- postalAddress Postanschrift MULTILINE
- l Ort DEFAULT
- textEncodedPSAP Netz-Adresse DEFAULT
- presentationAddress Netz-Adresse DEFAULT
- supportedApplicationContext Anwendung DEFAULT
- publicAccess Zugang DEFAULT
- availability Verfügbarkeit DEFAULT
- knowledgeInformation Kontakt DEFAULT
- seeAlso "siehe auch" HREF
- roleOccupant Stelleninhabr HREF
- manager Manager HREF
- administrator Manager HREF
- secretary Sekretariat HREF
- associatedName "zugeordneter Name" HREF
- responsiblePerson Verantwortlicher HREF
- domainComponent Domain DEFAULT
- labeledURI URL URI
-# 2.Bild (see more)
-SECOND-PAGE source Quelle DEFAULT
- homePostalAddress Heimat-Anschrift MULTILINE
- masterDSA Master-DSA HREF
- slaveDSA Slave-DSA HREF
- lastModifiedTime "letztmalig geändert" DATE
- lastModifiedBy "letztmalig geändert von" DEFAULT
- lastUpdateTime "letztmalig geändert" DATE
-
-
-###
-### sorting and display of groups of entries
-###
-
-# while browsing and searching, entries below the current position
-# in the DIT, or the search results, can be grouped according to some
-# SORT rules; these rules determine,
-# 1. which objectclass should signal a specific group, and in what
-# order the entries should be checked for those objectclasses
-# (the sequential order of the objectclasses given below),
-# 2. what label should be applied to a group (" " means none),
-# 3. the order of groups during output,
-# 4. the display type for an object of the given object class
-# when display´ing a read result, and
-# 5. the attribute, that will control sort order of entries
-# within each group
-# the last two parameters are optional, and will default to display
-# type ´default´ (see DISPLAY-OBJECTS), and sort attribute sn (surname)
-# (if given in the entry, otherwise the RDN itself)
-#
-# When an entry has none of the listed object classes, it will NOT be
-# included into the display !!!
-
-SORT dNSDomain Domäne 8
- domain Faxanschlüsse 9
- rfc822MailList X.500-E-Mail-Verteiler 10 rfc822MailList
- organizationalPerson Mitarbeiter 1 pers registeredAddress
- residentialPerson Privat-Personen 2 pers registeredAddress
- person "sonstige Personen" 3 pers registeredAddress
- locality Gebiete 7 organization
- organization Organisationen 5 organization
- organizationalUnit Unterorganisationen 6 organization
- alias Verweise 11
- country Länder 4 country
-
-
-###
-### the position of certain language-specific support-files
-###
-
-# a help file (accessible via http://host:port/H)
-HELPFILE tweb.help.0
-
-# converting certain RDNs to a more user-friendly form)
-FRIENDLYFILE ldapfriendly.0
-
-# header and footer beeing attached to every HTML page (not BASEDN)
-HEADER tweb.header.0
-FOOTER tweb.footer.0
-
-# a special message beeing attached to a HTML page when a allowed
-# user accesses the gateway (see ALLOW-STRING/DENY-STRING in tweb.rc)
-ALLOW-MSG allow.msg.0
-
-
-###
-### some more settings for (language-specific) gateway-switches (see tweb.rc)
-###
-
-# GW-SWITCH "ROOT" http://<my-world-relay.my-domain>:<port0>/M
-# "c=<my-country-ID>" http://<my-country-relay.my-domain>:<port0>/
-
-
-###
-### where to prevent listing and provide for searching only
-###
-
-# a (list of) DN(s), where no person lists should be display´ed, but
-# a search box only (e.g., because to many person are contained in
-# here, so list results would be too long); also, which header and
-# footer files will be display´ed at that position
-
-# SEARCH-ONLY "ou=<some-ou>, o=<my-organization>, c=<my-country-ID>" search-only.head.0 search-only.foot.0
-
-
-###
-### modifying entries via TWEB
-###
-
-# when the user is allowed to modify her own entry, MODIFY/MODATTR will
-# describe, what can be modified
-#
-# BEWARE: this feature is not allowed at the University of Tuebingen,
-# so the code is not tested very well; usage is on own risc
-
-# objects of what class can be modified
-# (for each class a seperate description>)
-# MODIFY person
-
-# what attributes can be modified
-# a label in the HTTP formular is given for each attribute,
-# together with the maximum count of values, beeing accepted
-# in the input area
-
-# MODATTR personalTitle Titel 1
-# organizationalStatus Dienststellung 1
-# description Beschreibung 2
-# telephoneNumber Telefon 2
-# facsimileTelephoneNumber FAX 2
-# mail Mail-Adresse 2
-# roomNumber Raum 1
-# memberOfGroup Mailgruppe 10
-# homePostalAddress Heimatanschrift 1
-# homePhone "privat Telefon" 2
-# pager Pager 2
-# info Information 2
-
-
+++ /dev/null
-#*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-# *
-# tweb.conf.1 *
-# *
-# Function:..Configuration-File for TWEB-SOFTWARE *
-# *
-# *
-# *
-# Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-# Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-# neuer Dienste, Universitaet Tuebingen, GERMANY *
-# *
-# ZZZZZ DDD V V *
-# Creation date: Z D D V V *
-# July 26 1995 Z D D V V *
-# Last modification: Z D D V V *
-# December 18 1998 ZZZZ DDD V *
-# *
-#/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/
-#==========================================================================
-# $Id: tweb.conf.1.dist,v 1.6 1999/09/10 15:01:21 zrnsk01 Exp $
-
-# FOR DESCRIPTION OF THE PARAMETERS SEE THE CONFIG FILE tweb.conf.0(.dist)
-
-
-###
-### the description, how to display an object upon read
-###
-
-DISPLAY-OBJECT person
-# main page
-FIRST-PAGE cn Name DEFAULT
- personalTitle Title DEFAULT
- organizationalStatus Status DEFAULT
- description Working-Area DEFAULT
- telephoneNumber Telephone DEFAULT
- facsimileTelephoneNumber Fax DEFAULT
- mail E-Mail-Address MAILTO
- textEncodedORaddress X400-Address DEFAULT
- postalAddress "Postal address" MULTILINE
- roomNumber Room DEFAULT
- labeledURI URL URI
-# additional page
-SECOND-PAGE sn Surname DEFAULT
- roleOccupant Role-Occupant HREF
- memberOfGroup Group-Member DEFAULT
- homepostalAddress Home-Address MULTILINE
- homePhone Home-Phone DEFAULT
- pager Pager DEFAULT
- lastModifiedTime "Last modified Time" DATE
- lastModifiedBy "Last modified by" DEFAULT
-
-DISPLAY-OBJECT organization
-# main page
-FIRST-PAGE o Name DEFAULT
- ou Name DEFAULT
- l Locality DEFAULT
- description Description DEFAULT
- postalAddress "Postal address" MULTILINE
- telephoneNumber Telephone DEFAULT
- facsimileTelephoneNumber Fax DEFAULT
- labeledURI URL URI
-# additional page
-SECOND-PAGE st State DEFAULT
- seeAlso "More Information" MOVETO
- lastModifiedTime "Last modified Time" DATE
- lastModifiedBy "Last modified by" DEFAULT
-
-DISPLAY-OBJECT rfc822MailList
-# main page
-FIRST-PAGE description Description DEFAULT
- joinable Joinable BOOLEAN
- associatedDomain E-Mail-Domain DEFAULT
- rfc822RequestsTo "Requests to" MAILTO
- requestsTo "Requests to" HREF
- owner Owner HREF
-# additional page
-SECOND-PAGE lastModifiedTime "Last modified Time" DATE
- lastModifiedBy "Last modified by" DEFAULT
-
-DISPLAY-OBJECT country
-# main page
-FIRST-PAGE friendlyCountryName Country-Name DEFAULT
- associatedDomain Domain DEFAULT
- manager Manager HREF
- labeledURI URL URI
-# additional page
-SECOND-PAGE masterDSA Master-DSA HREF
- slaveDSA Slave-DSA HREF
- lastModifiedTime "Last modified Time" DATE
- lastModifiedBy "Last modified by" DEFAULT
- lastUpdateTime "Last update Time" DATE
-
-DISPLAY-OBJECT default
-# main page
-FIRST-PAGE jpegPhoto Photo JPEG
- photo Photo BMP
- cn Name DEFAULT
- sn Surname DEFAULT
- textEncodedMtaName MTA-Name DEFAULT
- relatedMHSdomain MHS-Domain DEFAULT
- description Description DEFAULT
- multiLineDescription Description MULTILINE
- info "More Information" DEFAULT
- productName Productname DEFAULT
- mail Mail-Address MAILTO
- telephoneNumber Telephone DEFAULT
- facsimileTelephoneNumber Fax DEFAULT
- labeledURL URL URL
- memberOfGroup "Member of Group" DEFAULT
- member Member HREF
- owner Owner HREF
- requestsTo "Requests to" HREF
- errorsTo "Errors to" HREF
- krbName Kerberos-Name DEFAULT
- postalAddress Postal-Address MULTILINE
- l Locality DEFAULT
- textEncodedPSAP "Network address" DEFAULT
- presentationAddress "Network address" DEFAULT
- supportedApplicationContext Application DEFAULT
- publicAccess Access DEFAULT
- availability Availability DEFAULT
- knowledgeInformation Contact DEFAULT
- seeAlso "See also" HREF
- roleOccupant Role-Occupant HREF
- manager Manager HREF
- administrator Manager HREF
- secretary Secretary HREF
- associatedName "Associated Name" HREF
- responsiblePerson "Responsible person" HREF
- domainComponent Domain DEFAULT
- labeledURI URL URI
-# 2.Page (see more)
-SECOND-PAGE source Source DEFAULT
- homePostalAddress Home-Address MULTILINE
- masterDSA Master-DSA HREF
- slaveDSA Slave-DSA HREF
- lastModifiedTime "Last modified Time" DATE
- lastModifiedBy "Last modified by" DEFAULT
- lastUpdateTime "Last update Time" DATE
-
-
-
-###
-### sorting and display of groups of entries
-###
-
-SORT dNSDomain Domain 8
- domain Fax 9
- rfc822MailList X.500-E-Mail-List 10 rfc822MailList
- organizationalPerson Staff 1 person registeredAddress
- residentialPerson Residentials 2 person registeredAddress
- person Persons 3 person registeredAddress
- locality Localities 7 organization
- organization Organizations 5 organization
- organizationalUnit "Organizational Units" 6 organization
- alias Aliases 11
- country Countries 4 country
-
-
-###
-### the position of certain language-specific support-files
-###
-
-HELPFILE tweb.help.1
-
-FRIENDLYFILE ldapfriendly.1
-
-HEADER tweb.header.1
-FOOTER tweb.footer.1
-
-ALLOW-MSG allow.msg.1
-
-
-###
-### some more settings for (language-specific) gateway-switches (see tweb.rc)
-###
-
-# GW-SWITCH "ROOT" http://<my-world-relay.my-domain>:<port1>/M
-# "c=<my-country-ID>" http://<my-country-relay.my-domain>:<port1>/
-
-
-###
-### where to prevent listing and provide for searching only
-###
-
-# SEARCH-ONLY "ou=<some-ou>, o=<my-organization>, c=<my-country-ID>" search-only.head.1 search-only.foot.1
-
-
-###
-### modifying entries via TWEB
-###
-
-# MODIFY person
-# MODATTR personalTitle Title 1
-# organizationalStatus Status 1
-# description Description 2
-# telephoneNumber Telephone 2
-# facsimileTelephoneNumber Fax 2
-# mail "E-Mail address" 2
-# roomNumber Room 1
-# memberOfGroup Group-Member 10
-# homePostalAddress "Home address" 1
-# homePhone "Home phone" 2
-# pager Pager 2
-# info Information 2
-
-
+++ /dev/null
-#*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-# *
-# tweb.lang.0 *
-# *
-# Function:..Language-File for TWEB-SOFTWARE *
-# *
-# *
-# *
-# Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-# Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-# neuer Dienste, Universitaet Tuebingen, GERMANY *
-# *
-# ZZZZZ DDD V V *
-# Creation date: Z D D V V *
-# February 14 1996 Z D D V V *
-# Last modification: Z D D V V *
-# February 20 1997 ZZZZ DDD V *
-# *
-#/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/
-#
-# $Id: tweb.lang.0.dist,v 1.6 1999/09/10 15:01:22 zrnsk01 Exp $
-
-0 de
-1 [not used]
-2 [not used]
-3 [not used]
-4 [not used]
-5 Kommando nicht implementiert!
-6 Nicht gefunden
-7 Last-Modified
-8 Ändere Ergebnisse:
-9 Änderungs-Ergebnisse für
-10 Änderungen:
-11 Fehler während Änderungs-Operation:
-12 LÖSCHE alten Wert
-13 von Attribut
-14 Der Fehler-Kode war
-15 Änderung
-16 Erfolgreich ausgeführt
-17 Lese diesen geänderten Wert
-18 Benutzer-Passwort
-19 Ändere diesen Eintrag erneut
-20 Die angegebene Abfrage war nicht spezifisch genug, wodurch ein Sizelimit
- überschritten wurde, wobei die ersten paar Übereinstimmungen
- zurückgegeben wurden. Falls Sie nicht den gesuchten Eintrag
- gefunden haben, machen Sie bitte eine genauere Abfrage,
- zum Beispiel mit Vor- und Nachnamen.
-21 Die Anzahl der gefundenen Einträge hat eine systemseitig
- vorgegebene Obergrenze überschritten. Falls der gesuchte Eintrag
- in der dargestellten Liste nicht vorhanden ist, nutzen Sie die
- <STRONG>Such</STRONG>-Option, um das Gesuchte genauer zu spezifizieren.
-22 Fehler
-23 X.500 - WWW Fehler:
-24 Beim Durchsuchen von X.500 tauchte ein Fehler auf
-25 Der Fehlercode war
-26 Es ist keine zusätzliche Information erhältlich.
-27 Liste unterhalb von
-28 aktuelle Position:
-29 About
-30 Suche:
-31 Wir haben nicht die entsprechenden Zugriffsrechte, um hier eine globale
- Suche zu starten, aber wenn Sie wissen, wen Sie suchen, benutzen Sie die
- <STRONG>Such</STRONG>-Option oben mit dem Namen des
- gewünschten Eintrages.
-32 Habe nichts unter diesem Eintrag gefunden. Sie können den Eintrag
- selbst lesen, oder eine Suche probieren ...
-33 (eingeschränkte Liste
-34 siehe Fußnote
-35 suche in
-36 Keine Suchergebnisse:
-37 Habe nichts gefunden ...
-38 für
-39 Suchergebnisse:
-40 Suchergebnisse für
-41 <H2>X.500 - WWW Fehler:</H2><P>Bei der Darstellung des X.500 Eintrages
- tauchte ein Fehler auf. <P>Keine bekannte Object-Klasse
- für diesen Eintrag.<P>
-42 Weitere Informationen
-43 VORSICHT: Dies ist noch <B>EXPERIMENTELL</B>!!!
-44 Geben Sie das Passwort für diesen Eintrag ein
-45 wenn Sie ihn
-46 übermitteln wollen
-47 ÄNDERN
-48 wollen
-49 Fehlendes Passwort!
-50 Unbekanntes Argument
-51 Ändern
-52 altes Passwort
-53 VORSICHT: Dies ist noch EXPERIMENTELL!!!
-54 Fehler in der Abfrage: Kein Wert
-55 für
-56 Fehler in der Abfrage: Kein alter Wert
-57 <B>Fehler während der Modifikation:</B><P>Neuen Wert HINZUFÜGEN
-58 zum Attribut
-59 Der Fehlercode war
-60 <B>Fataler Fehler:</B><BR>Konnte den alten Wert nicht zurücksetzen
-61 auf Attribut
-62 Setze den alten Wert wieder
-63 auf Attribut
-64 Mail an:
-65 Aus datenschutzrechtlichen Gründen werden <strong>keine</strong>
- umfangreichen Personenlisten ausgegeben. Falls die gesuchte Person
- in der angezeigten Teilliste nicht vorhanden ist, verwenden Sie die
- <STRONG>Such</STRONG>-Option, um die gesuchte Person genauer
- zu spezifizieren.<BR>
-66 Einstufige Suche
-67 suche unterhalb nach...
-68 SUCHEN
-69 Eingabe löschen
-70 Eintrag
-71 Einträge
-72 Einträge zuruecksetzen
-73 en
-74 gelöscht
-75 ersetzt
-76 hinzugefügt
-77 Welt
-78 Ja
-79 Nein
-80 <B>Fataler Fehler:</B><BR>Konnte den Wert nicht modifizieren
-81 bei Attribut
-82 http://ambix.uni-tuebingen.de/cgi-bin/selbst
-83 http://ambix.uni-tuebingen.de/selbstinfo.html
-84 <FORM METHOD=POST ACTION=%s>Selbsteintrag:
-85 <INPUT type=hidden name="aloc" value="%s">
- <INPUT TYPE="submit" name="worker" VALUE="Angestellte">
-86 <INPUT type=hidden name="sloc" value="%s">
- <INPUT TYPE="submit" name="studie" VALUE="Studierende">
-87 </FORM>
-88 Ungültige Anfrage
-89 <EM>Fehlender Such-Filter!</EM>
-90 <EM>Fehlender Scope!</EM>
-91 [not used]
-92 <EM>Fehlender Suchbegriff!</EM> <P>Bitte geben Sie einen Suchbegriff an!
-93 <EM>Fehlender DN!</EM>
-94 <EM>Fehlendes Passwort!</EM>
-95 <EM>Unbekannte Abfrage!</EM>
-96 <H1>ZUGRIFF VERWEIGERT</H1>
- Die angefragten Daten stehen über diesen Server nicht zur
- Verfügung!<br>Bitte benutzen Sie folgende URL:
-97 <H1>ZUGRIFF VERWEIGERT</H1>
-98 ...lesen
-99 %s<H6>Daten erstellt durch %s <br>
- © TWEB: Zentrum für Datenverarbeitung,
- Universität Tübingen, Deutschland</H6>
-100 BODY BGCOLOR=#ffffe0 TEXT=#000000 LINK=#0000a0 VLINK=#00a000 font-family="times serif"
-101 <HR>
-102 <BR><H1>Der Name Ihres Hosts ist nicht verfuegbar. Sie sehen deshalb nicht alle Daten!</H1><BR>
-103 [not used]
-104 Wenn Sie mehr Daten sehen wollen, schalten Sie Ihren Proxy-Server aus !
+++ /dev/null
-#*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-# *
-# tweb.lang.1 *
-# *
-# Function:..Language-File for TWEB-SOFTWARE *
-# *
-# *
-# *
-# Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-# Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-# neuer Dienste, Universitaet Tuebingen, GERMANY *
-# *
-# ZZZZZ DDD V V *
-# Creation date: Z D D V V *
-# February 14 1996 Z D D V V *
-# Last modification: Z D D V V *
-# February 20 1997 ZZZZ DDD V *
-# *
-#/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/
-#
-# $Id: tweb.lang.1.dist,v 1.6 1999/09/10 15:01:22 zrnsk01 Exp $
-
-0 en
-1 [not used]
-2 [not used]
-3 [not used]
-4 [not used]
-5 Command not implemented!
-6 Not found
-7 Last-Modified
-8 Modify results:
-9 Modify results for
-10 Changes:
-11 Error during modify operation:
-12 DELETE old value
-13 from attribute
-14 The error code was
-15 change
-16 successfully done
-17 Read this modified entry
-18 userPassword
-19 Modify this entry again
-20 The query you specified was not specific enough, causing a size limit to be exceeded and the first several matches found to be returned.<br>If you did not find the match you were looking for, try issuing a more specific query, for example one that contains both first and last name.<br>
-21 Not all entries could be returned because a size limit was exceeded.<br>There is no way to defeat this feature, but if you know who you are looking for, try choosing the <STRONG>Search</STRONG> option listed above and specifying the name of the entry you want.<br>
-22 Error
-23 X.500 - WWW Error:
-24 An error occurred searching X.500
-25 The error code was
-26 No additional information is available.
-27 Move upwards to
-28 current location:
-29 About
-30 search:
-31 We don't have the access right to do a global search here. If you know who you are looking for, try choosing the <STRONG>Search</STRONG> option listed above and specifying the name of the entry you want.<br>
-32 Didn't find anything below this entry! You can read the entry itself or try a search ...
-33 (restricted list
-34 see below
-35 search in
-36 No search results:
-37 Didn't find anything...
-38 for
-39 Search results:
-40 Search results for
-41 <H2>X.500 - WWW Error:</H2><P>An error occurred showing X.500 entry. <P>No known object-class for this entry.<P>
-42 See more attributes
-43 Beware, this is still <B>EXPERIMENTAL</B>!!!
-44 Enter the password of this entry
-45 if you want to
-46 submit
-47 MODIFY
-48 it
-49 Missing Password!
-50 Unknown argument
-51 Modify
-52 oldPassword
-53 Beware, this is still EXPERIMENTAL!!!
-54 Error in query: No value
-55 for
-56 Error in query: No oldvalue
-57 <B>Error during modify operation:</B><P><P>ADD new value
-58 to attribute
-59 The error code was
-60 <B>Fatal Error:</B><BR>Couldn't reset the old value
-61 to attribute
-62 Reset the old value
-63 to attribute
-64 mailto:
-65 Due to Legal Rights no extended lists of persons will be displayed.
- If the requested person is not in the list shown, please use the
- <STRONG>Search</STRONG>-option with a more significant personal name.
- <BR>
-66 Onelevel search
-67 search below for...
-68 SEARCH
-69 DELETE INPUT
-70 entry
-71 entries
-72 RESET Values
-73 s
-74 deleted
-75 replaced
-76 added
-77 The World
-78 Yes
-79 No
-80 <B>Fatal Error:</B><BR>Couldn't modify the value
-81 at attribute
-82 http://ambix.uni-tuebingen.de/cgi-bin/selbst
-83 http://ambix.uni-tuebingen.de/selbstinfo.html
-84 <FORM METHOD=POST ACTION=%s>Self-subscription:
-85 <INPUT type=hidden name="aloc" value="%s">
- <INPUT TYPE="submit" name="worker" VALUE="Staff">
-86 <INPUT type=hidden name="sloc" value="%s">
- <INPUT TYPE="submit" name="studie" VALUE="Students">
-87 </FORM>
-88 Bad request
-89 <EM>Missing filter!</EM>
-90 <EM>Missing scope!</EM>
-91 [not used]
-92 <EM>Missing search value!</EM> <P>Please specify a search value.
-93 <EM>Missing DN!</EM>
-94 <EM>Missing password!</EM>
-95 <EM>Unknown query!</EM>
-96 <H1>ACCESS DENIED</H1>
- The requested data are not delivered via this server!<br>
- Please use the following URL:
-97 <H1>ACCESS DENIED</H1>
-98 ...read it
-99 %s<H6>Data composed by %s <br>
- © TWEB: Zentrum fuer Datenverarbeitung,
- Universitaet Tuebingen, GERMANY</H6>
-100 BODY BGCOLOR=#ffffe0 TEXT=#000000 LINK=#0000a0 VLINK=#00a000
-101 <HR>
-102 <BR><H1>The name of your host is not available. Therefore you don't see the whole database!</H1><BR>
-103 [not used]
-104 If you want to see more data, please inactivate your proxy-server !
+++ /dev/null
-#*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-# *
-# tweb.rc.... *
-# *
-# Function:..Ressource-File for TWEB *
-# *
-# *
-# *
-# Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-# Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-# neuer Dienste, Universitaet Tuebingen, GERMANY *
-# *
-# ZZZZZ DDD V V *
-# Creation date: Z D D V V *
-# July 26 1995 Z D D V V *
-# Last modification: Z D D V V *
-# January 11 1999 ZZZZ DDD V *
-# *
-#/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/
-#==========================================================================
-# $Id: tweb.rc.dist,v 1.6 1999/09/10 15:01:22 zrnsk01 Exp $
-
-
-##########################################################################
-# #
-# set the following variables to your local addresses (NEEDED) #
-# check also for the location of certain help files #
-# and proper timeout #
-# #
-##########################################################################
-
-# the base port, TWEB is listening on;
-# indizes for the languages are added to this base port number
-# (e.g., TWEB with language 1 is listening on port (WEBPORT + 1))
-WEBPORT <the-base-port-tweb-should-listen-to>
-
-# the host and port, your x500 server (e.g., UMICH slapd) is listening on
-LDAPD <the-host-running-your-ldap-server>
-LDAPPORT <the-port-of-that-ldapserver>
-
-
-#------------------------------------------------------------------------#
-
-# the DN, TWEB will consider it´s home, together with header and
-# footer files to be display´ed at that position
-#
-# the BASEDN will be accessed, when NO DN is given (http://host:port/
-# the BASEDN will be stripped off from hyperlinks beeing display´ed
-# access to DIT areas NOT below BASEDN will be denied, if STRICT-BASEDN
-# (see tweb.rc(.dist)) is activ
-#
-# BEWARE: HEADER AND FOORTER FILE NAMES ARE ONLY THE BASE NAMES; THE
-# CORRESPONDING WORKING FILES MUST HAVE EXTENSIONS OF '.x'
-# WITH x INDICATING THE DESIRED GATEWAY LANGUAGE NUMBER (0-9)
-
-BASEDN "o=<my-organization>, c=<my-country-ID>" tweb-base.head tweb-base.foot
-
-
-#------------------------------------------------------------------------#
-
-# assuming you have copied the binary into the TWEB_conFiles directory,
-# the ETCDIR directory should be a parallel directory of the current one
-ETCDIR ../LDAP_etc/
-
-# the filter file directs the mode, TWEB will search for entries
-# (e.g., first search input as is in attribute cn, then search
-# for any one word in attributes cn and/or sn ... )
-FILTERFILE ldapfilter.conf
-
-# the time in secs, TWEB will try to get a connection to the x500 server
-TIMEOUT 240
-
-
-##########################################################################
-# #
-# check the following variables for proper access rights #
-# and handling of entry lists/legal hints #
-# (NOT NEEDED FOR FIRST START-UP) #
-# #
-##########################################################################
-
-# DN and password of an x500 entry, TWEB will use, when access of the
-# user to the servers data is without restrictions
-#
-# WEBDN "cn=<TWEB-DN-1>, o=<your-organization>, c=<your-country>"
-# WEBPW <TWEB-PW-1>
-
-# DN (and password) of an x500 entry, TWEB will use, when access of the
-# user to the servers data is restricted (e.g., external users);
-# a NULL password (by not configuring) will lead to anonymous access,
-# irrespective, whether the DN is given or not
-#
-# WEBDN2 "cn=<TWEB-DN-2>, o=<your-organization>, c=<your-country>"
-# WEBPW2 <TWEB-PW-2>
-
-# Refuse/grant service to certain IP hosts/domains names;
-# both settings will be checked when deciding deniel of service;
-# the most special definition for the host given will dominate
-# (settings can be given by using regular expressions, to cover more than
-# one host/domain with one expression; alternatives, which should be
-# or'ed must be seperated by '|')
-# (continuations can be given on follow-up lines, whith no additional
-# character at the end of the previous line, and an indentation by
-# TAB or SPACE on the follow-up line)
-#
-# REFUSE some-host(\.some-sub-domain)?\.some-domain$|another-domain$|
-# ^some-initial-char[0-9]+.+\.some-domain$
-
-# GRANT (host1|host2|host3).*\.another-domain$
-
-# When service is granted to the requesting host, allow-string/deny-string
-# decide on full or restricted access to the servers data; in both cases
-# one of WEBDN1/WEBDN2 (or anonymous if not configured) is used for
-# accessing the server;
-# ACLs on the server must be set accourding to the required visibility of
-# data (see description of ACLs in the servers documentation)
-# (host/domain names are given as with GRANT/REFUSE)
-#
-# ALLOW-STRING my-domain$
-# DENY-STRING some-special-host/sub-domain-in-my-domain\.my-domain$
-
-# Consider WWW proxies as not authorized to get un-restricted access
-# NO-PROXY
-
-# Consider the explicit list of proxies as authorized to get full access
-# (the list is as colon-seperated list of host names)
-# ALLOW-PROXY proxy.in.my.domain:some-proxy.in.another.domain
-
-# Refuse access to DNs, outside the scope of TWEBs BASEDN
-# (this is necessary, if no referral mechanism is working on the
-# x500 server level; e.g., with slapd in the UMICH package)
-# STRICT-BASEDN
-
-# Activate anti-hacking code: count access from a range of IP adresses
-# (IP-Group) to the gateway during a timeslice (randomly selected between
-# a minimum and maximum number of secs); if the count exceeds a pre-
-# defined maximum, refuse service for a certain number of timeslices;
-# after that resume service for the IP-Group
-# Print statistics for number of accesses from all IP-Groups to file,
-# at regular intervalls
-#
-# COMREFUSE TMIN TMAX MAX_ACCEPT SUSPEND_CYCLE STAT_CYCLE STAT_FILE
-COMREFUSE 100 200 40 12 43200 /LDAP/ldap-3.0/tweb-1.0/hack-stats
-
-#------------------------------------------------------------------------#
-
-# The maximum number of entries display'ed on any one HTML page
-MAXCOUNT 2000
-
-# During searching/browsing restrict the number of person entries to the
-# given number; numbers apply to each of the person groups given by the
-# SORT parameter
-# STRICT means, even allowed access will be restricted in numbers
-# NO-BROWSE means, during browsing no person entries are shown at all
-# MAX-PERSON 5 STRICT NO-BROWSE
-
-# List of (parts of ) RDNs, which should not be display'ed
-# For the current release, strings are seperated by BLANK, with forced
-# matching to the beginning or end of an RDN signalled by '|';
-# in a future release, this will be replaced by regular expressions,
-# very like as in GRANT/REFUSE and beasts
-NO-SHOW-RDN "|cn=Dummy| netz| LDAP-SAP Mail500|"
-
-
-# Print a legal message for restricted users;
-# normally, this message is printed at the end of the HTML page,
-# with ON-TOP, the message can be printed near the top of the page
-#
-# LEGAL ON-TOP
-
-
-##########################################################################
-# #
-# configure TWEB gateway-switching #
-# #
-##########################################################################
-
-# Gateway-switching is an original feature of the TWEB, www-x500-gateway.
-# Switching enables TWEB to generate hyper-links, that are directed towards
-# other well-known gateways. Following those hyper-links will lead the
-# user to those gateways, effectively balancing the load between a net
-# of gateways. Another benefit is the 'Corporate Identity' each gateway
-# can implement for an organizations own directory data.
-#
-# Gateway-switching can be configured statically, in the config files
-# tweb.rc and/or tweb.conf.? , or dynamically, via hints in the
-# directory data to be display'ed.
-#
-# Select dynamic gateway-switching: TWEB will look for labeleduri
-# attributes within each entry to be display'ed as a hyper-link
-# before constructing the host-part of the hyper-link URL; the
-# labelleduri attribut must follow the syntax:
-# <base-url-of-the-other-gateway> <some-label> (gw[-<language-key>])
-# The DN of the entry will be appended to the base-url, if the language
-# selection matches, or no specific selection is given (gw)
-#
-DYNAMIC-GW
-
-# Configure static gateway switches; they may be replaced at run-time by
-# dynamic switches (in tweb.rc, gateways, which only support one language
-# are given; gatways supporting more languages are defined in the
-# tweb.conf.? files)
-GW-SWITCH "l=DFN,c=DE" http://ambix.uni-tuebingen.de:8889/
-
-
-##########################################################################
-# #
-# some miscelleneous configuration parameters #
-# #
-##########################################################################
-
-# the labelling of buttons/links leading to gateways with other languages
-LANGUAGE Deutsch
- English
-
-# the hierarchy above the current DIT position is presented as a
-# pull down menu and an action button, or as a list of hyperlinks
-PULL-DOWN-MENUS
-
-# entries are kept for some time in a WWW browser´s or proxy´s cache,
-# before expiring
-CACHE-EXPIRE-DEFAULT 900
-
-# digits at the end of RDNs (e.g., to make RDNs unique) are stripped
-# off before displaying; in the config parameter a list of object
-# classes with stripping in the RDN parts is given
-# STRIP-PIN |toc_profs|person|toc_primas|toc_cperson|toc_funcs|toc_pextra|
-
-# when MODIFY is configured (in tweb.conf.x), entries belonging to
-# the object class(es) given here can NOT be modified
-# NO-MODIFY |toc_primas|
-
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* Versiongw.c *
-* *
-* Function:..File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* February 13 1996 Z D D V V *
-* Last modification: Z D D V V *
-* August 26 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: Versiongw.c,v 1.6 1999/09/10 15:01:16 zrnsk01 Exp $
- *
- */
-
-/*
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Tuebingen, Gremany. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char version[] = "TWEB 2.3.4 (%WHEN%)";
-char Version[] = " TWEB 2.3.4 (%WHEN%)\t%WHOANDWHERE%";
-char copyright[] = "TWEB Version 2.3.4";
-
-char sccsid[] = "@(#) TWEB 2.3.4 - 1995-1999, University of Tuebingen, DE";
-
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* ch_malloc.c *
-* *
-* Function:..Alloc-Functions with Error-Handling *
-* *
-* from LDAP3.2 University of Michigan *
-* *
-* Patch: unsigned long --> size_t fuer size-Parameter *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* April 16 1996 Z D D V V *
-* Last modification: Z D D V V *
-* December 31 1998 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: ch_malloc.c,v 1.6 1999/09/10 15:01:16 zrnsk01 Exp $
- *
- */
-
-#include "tgeneral.h"
-#include "tglobal.h"
-
-#include "ch_malloc_exp.h"
-#include "support_exp.h"
-
-
-/* ch_malloc.c - malloc routines that test returns from malloc and friends */
-
-PUBLIC char * ch_malloc( size )
-size_t size;
-{
- char *new;
-
- if ( (new = (char *) calloc(1, size )) == NULL ) {
- if (dosyslog) syslog( LOG_INFO, "malloc of %d bytes failed\n", size );
- exit_tweb( 1 );
- }
-
- return( new );
-}
-/* end of function: ch_malloc */
-
-PUBLIC char * ch_realloc( block, size )
-char *block;
-size_t size;
-{
- char *new;
-
- if ( block == NULL ) {
- return( ch_malloc( size ) );
- }
-
- if ( (new = (char *) realloc( block, size )) == NULL ) {
- if (dosyslog) syslog( LOG_INFO, "realloc of %d bytes failed\n", size );
- exit_tweb( 1 );
- }
-
- return( new );
-}
-/* end of function: ch_realloc */
-
-PUBLIC char * ch_calloc( nelem, size )
-size_t nelem;
-size_t size;
-{
- char *new;
-
- if ( (new = (char *) calloc( nelem, size )) == NULL ) {
- if (dosyslog) syslog( LOG_INFO, "calloc of %d elems of %d bytes failed\n",
- nelem, size );
- exit_tweb( 1 );
- }
-
- return( new );
-}
-/* end of function: ch_calloc */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* ch_malloc_exp.h *
-* *
-* Function:..File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* April 16 1996 Z D D V V *
-* Last modification: Z D D V V *
-* November 21 1996 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: ch_malloc_exp.h,v 1.6 1999/09/10 15:01:16 zrnsk01 Exp $
- *
- */
-
-#ifndef _CH_MALLOC_EXP_
-#define _CH_MALLOC_EXP_
-
-PUBLIC char * ch_malloc();
-PUBLIC char * ch_realloc();
-PUBLIC char * ch_calloc();
-
-
-#endif /* _CH_MALLOC_EXP_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* charray.c.. *
-* *
-* Function:..Array-Handling-Functions *
-* *
-* from LDAP3.2 University of Michigan *
-* *
-* Patch: NULL-Pointers are caught in Arrays/Strings *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* April 16 1996 Z D D V V *
-* Last modification: Z D D V V *
-* December 21 1998 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: charray.c,v 1.6 1999/09/10 15:01:16 zrnsk01 Exp $
- *
- */
-
-#include "tgeneral.h"
-#include "charray_exp.h"
-#include "ch_malloc_exp.h"
-
-/* charray.c - routines for dealing with char * arrays */
-
-
-PUBLIC void charray_add( a, s )
-char ***a;
-char *s;
-{
- int n;
-
- if ( s == NULL )
- return;
-
- if ( *a == NULL ) {
- *a = (char **) ch_malloc( 2 * sizeof(char *) );
- n = 0;
- } else {
- for ( n = 0; *a != NULL && (*a)[n] != NULL; n++ ) {
- ; /* NULL */
- }
-
- *a = (char **) ch_realloc( (char *) *a,
- (n + 2) * sizeof(char *) );
- }
-
- (*a)[n++] = strdup(s);
- (*a)[n] = NULL;
-}
-/* end of function: charray_add */
-
-PUBLIC void charray_merge( a, s )
-char ***a;
-char **s;
-{
- int i, n, nn;
-
- if ( s == NULL )
- return;
-
- for ( n = 0; *a != NULL && (*a)[n] != NULL; n++ ) {
- ; /* NULL */
- }
-
- for ( nn = 0; s[nn] != NULL; nn++ ) {
- ; /* NULL */
- }
-
- *a = (char **) ch_realloc( (char *) *a, (n + nn + 1) * sizeof(char *) );
-
- for ( i = 0; i < nn; i++ ) {
- (*a)[n + i] = s[i];
- }
- (*a)[n + nn] = NULL;
-}
-/* end of function: charray_merge */
-
-PUBLIC void charray_free( array )
-char **array;
-{
- char **a;
-
- if ( array == NULL ) {
- return;
- }
-
- for ( a = array; *a != NULL; a++ ) {
- if ( *a != NULL ) {
- free( *a );
- }
- }
- free( (char *) array );
-}
-/* end of function: charray_free */
-
-PUBLIC int charray_inlist( a, s )
- char **a;
- char *s;
-{
- int i;
-
- if (( a == NULL ) || ( s == NULL ))
- return( 0 );
-
- for ( i = 0; a[i] != NULL; i++ ) {
- if ( strcasecmp( s, a[i] ) == 0 ) {
- return( 1 );
- }
- }
-
- return( 0 );
-}
-/* end of function: charray_inlist */
-
-PUBLIC char ** charray_dup( a )
-char **a;
-{
- int i;
- char **new;
-
- if ( a == NULL )
- return( NULL );
-
- for ( i = 0; a[i] != NULL; i++ )
- ; /* NULL */
-
- new = (char **) ch_malloc( (i + 1) * sizeof(char *) );
-
- for ( i = 0; a[i] != NULL; i++ ) {
- new[i] = strdup( a[i] );
- }
- new[i] = NULL;
-
- return( new );
-}
-/* end of function: charray_dup */
-
-PUBLIC char ** str2charray( str, brkstr )
-char *str;
-char *brkstr;
-{
- char **res;
- char *s;
- int i;
- char *str1;
-
- if (( str == NULL ) || ( brkstr == NULL )) return( (char **) NULL );
-
- str1 = strdup(str);
- i = 1;
- for ( s = str1; *s; s++ ) {
- if ( strchr( brkstr, *s ) != NULL ) {
- i++;
- }
- }
-
- res = (char **) ch_malloc( (i + 1) * sizeof(char *) );
- i = 0;
- for ( s = strtok( str1, brkstr ); s != NULL; s = strtok( NULL,
- brkstr ) ) {
- res[i++] = strdup( s );
- }
- res[i] = NULL;
-
- free(str1);
- return( res );
-}
-/* end of function: str2charray */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* charray_exp.h *
-* *
-* Function:..File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* April 16 1996 Z D D V V *
-* Last modification: Z D D V V *
-* November 21 1996 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: charray_exp.h,v 1.6 1999/09/10 15:01:16 zrnsk01 Exp $
- *
- */
-
-#ifndef _CHARRAY_EXP_
-#define _CHARRAY_EXP_
-
-PUBLIC void charray_add();
-PUBLIC void charray_merge();
-PUBLIC void charray_free();
-PUBLIC int charray_inlist();
-PUBLIC char ** charray_dup();
-PUBLIC char ** str2charray();
-
-
-#endif /* _CHARRAY_EXP_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* checkclient.c *
-* *
-* Function:..Client-Check-Funktions *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* March 7 1996 Z D D V V *
-* Last modification: Z D D V V *
-* March 19 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: checkclient.c,v 1.6 1999/09/10 15:01:16 zrnsk01 Exp $
- *
- */
-
-#include "tgeneral.h"
-#include "tglobal.h"
-#include "init_exp.h"
-#include "charray_exp.h"
-#include "checkclient.h"
-#include "regular_exp.h"
-
-PRIVATE int check4access (host, glob)
-char *host;
-GLOB_STRUCT *glob;
-/*
- * check if host ends in a valid domain.
- * return OK if so, NOTOK otherwise
- */
-{
- return(
- (glob->allow_string ? checkad(host, glob->comp_allow, glob) : OK) &&
- (glob->deny_string ? !checkad(host, glob->comp_deny, glob) : OK));
-
-}
-/* end of function: check4access */
-
-
-PRIVATE int checkad (host, string, glob)
-char *host;
-regexp *string;
-GLOB_STRUCT *glob;
-{
- char nhost[BUFSIZ];
-
- strcpy(nhost, host ? host : "unknown.xxx");
- return( tweb_regexec( string, nhost ));
-
-}
-/* end of function: checkad */
-
-/* Analyse Web-Client-Type / proxy + Log-Message */
-
-PUBLIC void checkwwwclient (fp, ip_addr, ip_port, hp, glob)
-FILE *fp;
-char *ip_addr;
-unsigned int ip_port;
-struct hostent *hp;
-GLOB_STRUCT *glob;
-{
- char in[BUFSIZ];
- char agent[BUFSIZ], via[BUFSIZ];
- char *host = hp ? hp->h_name : "unknown";
-
- *via = *agent = '\0';
-
- if(!((glob->grant ? checkad(host, glob->comp_grant, glob) : OK) &&
- (glob->refuse ? !checkad(host, glob->comp_refuse, glob) : OK))){
-
- if (dosyslog)
- syslog (LOG_INFO, "%s REFUSED <%08d>",
- glob->server_connection_msg, glob->svc_cnt);
- fflush(fp);
- if (http == 1) PRINT_HTML_HEADER;
- fprintf( fp, HTML_HEAD_TITLE, "ACCESS DENIED", glob->la[100]);
- disp_file(glob, glob->header, fp);
- fprintf(fp, "%s", glob->la[97]);
- disp_file(glob, glob->footer, fp);
- PRINT_HTML_FOOTER;
- close_ldap_connections(glob);
- exit_tweb(0);
- }
-
- glob->is_proxy = FALSE;
- while(fgets( in, BUFSIZ-1, fp ) && *trimright(in, WSPACE) ) {
- if(strstr(in, "User-Agent:")){
- strcpy(agent, in);
- if(strstr(str_tolower(in), PROXY_TOKEN1) ||
- strstr(in, PROXY_TOKEN2))
- glob->is_proxy = TRUE;
- }
- if(strstr(in, "Via:")){
- strcpy(via, in);
- glob->is_proxy = TRUE;
- }
- }
- if (dosyslog){
- char useragent[BUFSIZ];
-
- sprintf(useragent, "%s (%s,%u) %s",
- *agent ? agent : "User-Agent: unknown",
- ip_addr, ip_port, via);
- glob->user_agent_msg = strdup(useragent);
- }
-
- /* check if access is allowed ... */
-
- glob->allowed =
- ( hp
- && ((check4access(str_tolower(hp->h_name), glob) == OK))
- && !( glob->no_proxy && glob->is_proxy
- && !charray_inlist(glob->allow_proxy, hp->h_name)
- )
- );
-}
-
-/* end of function: checkwwwclient */
-
-PUBLIC void decide_access(glob)
-GLOB_STRUCT *glob;
-{
-
- if(!glob->allowed) {
- /* access from a non allowed computer
- ==> put webdn/webpw on a alternative value (if existant) */
- glob->webdn = glob->webdn2;
- glob->webpw = glob->webpw2;
- glob->noauth = TRUE;
-
- if (dosyslog) syslog (LOG_INFO, "%s DENIED <%08d>",
- glob->server_connection_msg, glob->svc_cnt);
-
- } else {
-
- /* if allowed and not strict: list persons without limits */
- if (!glob->strict) glob->max_person = 0;
-
- if (dosyslog) syslog (LOG_INFO, "%s ALLOWED <%08d>",
- glob->server_connection_msg, glob->svc_cnt);
- }
- if (dosyslog) syslog (LOG_INFO, "%s <%08d>",
- glob->user_agent_msg, glob->svc_cnt);
-
- /* non configured max-person means full listing */
- if (!glob->max_person) glob->max_person = 100000;
-
- /* if result-lists shall be restricted: configure display of
- privacy-message */
- glob->legal = glob->legal && (!glob->allowed || glob->strict);
-
- /* if browsing should be restricted: configure no_browse-variable */
- glob->no_browse = glob->no_browse &&
- (glob->noauth || glob->strict);
-
-}
-
-/* end of function: decide_access */
-
-/* Read ip_refuse dat_file and build up the data structure */
-
-PUBLIC void get_ip_refuse_clients(glob)
-GLOB_STRUCT *glob;
-{
- if ( glob->ip_refuse ) {
-
- FILE *rfp;
- char inLine[BUFSIZ];
- char *inLineP;
- size_t buflen = REFU_BUFSIZ;
- size_t curlen = (size_t) 1;
-
- if(!(rfp = fopen(glob->ip_refuse->dat_file, "r"))) {
- return;
- }
-
- if ( glob->ip_refuse->refu_str ) free( glob->ip_refuse->refu_str );
- glob->ip_refuse->refu_str = ch_calloc( 1, REFU_BUFSIZ );
- *glob->ip_refuse->refu_str = '&';
-
- while(fgets(inLine, BUFSIZ-1, rfp)) {
- int inLen;
-
- if ( ( inLineP = strchr( inLine, '#' ) )) *inLineP = '\0';
- inLineP = trim(inLine, " \t\n");
- if ( *inLineP == '\0' ) continue;
-
- inLen = strlen( inLineP );
- if ( !( curlen + inLen + 1 < buflen )) {
-
- glob->ip_refuse->refu_str =
- ch_realloc( glob->ip_refuse->refu_str,
- buflen + REFU_BUFSIZ );
- buflen += REFU_BUFSIZ;
-
- }
-
- sprintf( glob->ip_refuse->refu_str, "%s%s&",
- glob->ip_refuse->refu_str, inLineP );
-
- curlen += inLen;
-
- }
- fclose( rfp );
-
- }
-} /* get_ip_refuse_clients */
-
-
-/* Routine needed to initialize structure in init.c */
-
-/* Test the incomming IP address for denial */
-
-PUBLIC int
-check_ip_denial( ip_connection, glob )
-struct sockaddr_in *ip_connection;
-GLOB_STRUCT *glob;
-{
- int res = OK;
-
- if ( glob->ip_refuse ) {
- char ip_address[18];
-
- sprintf( ip_address, "&%s&", inet_ntoa( ip_connection->sin_addr ));
- if ( strstr( glob->ip_refuse->refu_str, ip_address ))
- res = NOTOK;
-
- }
-
- return( res );
-
-} /* check_ip_denial */
-
-
-/* re-read IP-REFUSE file if necessary */
-
-PUBLIC void
-re_readIPrefuse( glob )
-GLOB_STRUCT *glob;
-{
- static int ip_refuse_reload = 0;
-
- if ( glob->ip_refuse &&
- !( ++ip_refuse_reload % glob->ip_refuse->rereadcycle )) {
- get_ip_refuse_clients( glob );
- }
-
-} /* re_readIPrefuse */
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* checkclient.h *
-* *
-* Function:..File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* March 18 1996 Z D D V V *
-* Last modification: Z D D V V *
-* March 19 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: checkclient.h,v 1.6 1999/09/10 15:01:16 zrnsk01 Exp $
- *
- */
-#include "checkclient_exp.h"
-#include "regular_exp.h"
-#include "support_exp.h"
-#include "x500_exp.h"
-#include "charray_exp.h"
-#include "ch_malloc_exp.h"
-
-#ifndef _CHECKCLIENT_
-#define _CHECKCLIENT_
-
-#define PROXY_TOKEN1 " via "
-#define PROXY_TOKEN2 "gateway"
-
-PRIVATE int checkad();
-PRIVATE int check4access();
-
-#endif /* _CHECKCLIENT_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* checkclient_exp.h *
-* *
-* Function:..File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* March 18 1996 Z D D V V *
-* Last modification: Z D D V V *
-* March 19 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: checkclient_exp.h,v 1.6 1999/09/10 15:01:16 zrnsk01 Exp $
- *
- */
-
-#ifndef _CHECKCLIENT_EXP_
-#define _CHECKCLIENT_EXP_
-
-PUBLIC void checkwwwclient();
-PUBLIC void decide_access();
-PUBLIC void get_ip_refuse_clients();
-PUBLIC int check_ip_denial();
-PUBLIC void re_readIPrefuse();
-
-#endif /* _CHECKCLIENT_EXP_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* dn.c....... *
-* *
-* Function:..DN-Handling-Functions *
-* *
-* from LDAP3.2 University of Michigan *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* April 24 1996 Z D D V V *
-* Last modification: Z D D V V *
-* September 13 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: dn.c,v 1.8 1999/09/13 13:47:44 zrnsk01 Exp $
- *
- */
-
-/* dn.c - routines for dealing with distinguished names */
-
-#include "tgeneral.h"
-#include "tglobal.h"
-#include "strng_exp.h"
-#include "dn.h"
-
-#if OL_LDAPV == 2
-#define LDAP_DEBUG_ANY 0xffff
-#endif
-
-
-/*
- * dn_normalize - put dn into a canonical format. the dn is
- * normalized in place, as well as returned.
- */
-
-PUBLIC char * dn_normalize( dn )
-char *dn;
-{
- char *d, *s;
- int state, gotesc;
-
- /* Debug( LDAP_DEBUG_TRACE, "=> dn_normalize \"%s\"\n", dn, 0, 0 ); */
-
- gotesc = 0;
- state = B4TYPE;
- for ( d = s = dn; *s; s++ ) {
- switch ( state ) {
- case B4TYPE:
- if ( ! SPACE( *s ) ) {
- state = INTYPE;
- *d++ = *s;
- }
- break;
- case INTYPE:
- if ( *s == '=' ) {
- state = B4VALUE;
- *d++ = *s;
- } else if ( SPACE( *s ) ) {
- state = B4EQUAL;
- } else {
- *d++ = *s;
- }
- break;
- case B4EQUAL:
- if ( *s == '=' ) {
- state = B4VALUE;
- *d++ = *s;
- } else if ( ! SPACE( *s ) ) {
- /* not a valid dn - but what can we do here? */
- *d++ = *s;
- }
- break;
- case B4VALUE:
- if ( *s == '"' ) {
- state = INQUOTEDVALUE;
- *d++ = *s;
- } else if ( ! SPACE( *s ) ) {
- state = INVALUE;
- *d++ = *s;
- }
- break;
- case INVALUE:
- if ( !gotesc && SEPARATOR( *s ) ) {
- while ( SPACE( *(d - 1) ) )
- d--;
- state = B4TYPE;
- if ( *s == '+' ) {
- *d++ = *s;
- } else {
- *d++ = ',';
- }
- } else if ( gotesc && !NEEDSESCAPE( *s ) &&
- !SEPARATOR( *s ) ) {
- *--d = *s;
- d++;
- } else {
- *d++ = *s;
- }
- break;
- case INQUOTEDVALUE:
- if ( !gotesc && *s == '"' ) {
- state = B4SEPARATOR;
- *d++ = *s;
- } else if ( gotesc && !NEEDSESCAPE( *s ) ) {
- *--d = *s;
- d++;
- } else {
- *d++ = *s;
- }
- break;
- case B4SEPARATOR:
- if ( SEPARATOR( *s ) ) {
- state = B4TYPE;
- *d++ = *s;
- }
- break;
- default:
-
-#if OL_LDAPV >= 2
-
- if ( ldap_debug & LDAP_DEBUG_ANY )
- fprintf( stderr, "dn_normalize - unknown state %d\n", state );
-
- if ( ldap_syslog & LDAP_DEBUG_ANY )
- syslog( ldap_syslog_level,
- "dn_normalize - unknown state %d\n", state );
-
-#else
- Debug( LDAP_DEBUG_ANY,
- "dn_normalize - unknown state %d\n", state, 0, 0 );
-#endif
-
- break;
- }
- if ( *s == '\\' ) {
- gotesc = 1;
- } else {
- gotesc = 0;
- }
- }
- *d = '\0';
-
- /* Debug( LDAP_DEBUG_TRACE, "<= dn_normalize \"%s\"\n", dn, 0, 0 ); */
- return( dn );
-}
-/* end of function: dn_normalize */
-
-/*
- * dn_normalize_case - put dn into a canonical form suitable for storing
- * in a hash database. this involves normalizing the case as well as
- * the format. the dn is normalized in place as well as returned.
- */
-
-PUBLIC char * dn_normalize_case( dn )
-char *dn;
-{
-
- /* normalize format */
- dn_normalize( dn );
-
- /* normalize case */
- str_toupper( dn );
-
- return( dn );
-}
-/* end of function: dn_normalize_case */
-
-/*
- * dn_issuffix - tells whether suffix is a suffix of dn. both dn
- * and suffix must be normalized.
- */
-
-PUBLIC int dn_issuffix( dn, suffix )
-char *dn;
-char *suffix;
-{
- int dnlen, suffixlen;
-
- if ( dn == NULL ) {
- return( 0 );
- }
-
- suffixlen = strlen( suffix );
- dnlen = strlen( dn );
-
- if ( suffixlen > dnlen ) {
- return( 0 );
- }
-
- return( strcasecmp( dn + dnlen - suffixlen, suffix ) == 0 );
-}
-/* end of function: dn_issuffix */
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* dn.h....... *
-* *
-* Function:..Header-Datei fuer TWEB-Software *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* April 24 1996 Z D D V V *
-* Last modification: Z D D V V *
-* November 21 1996 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: dn.h,v 1.6 1999/09/10 15:01:16 zrnsk01 Exp $
- *
- */
-
-#ifndef _DN_
-#define _DN_
-
-#define DNSEPARATOR(c) (c == ',' || c == ';')
-#define SEPARATOR(c) (c == ',' || c == ';' || c == '+')
-#define SPACE(c) (c == ' ' || c == '\n')
-#define NEEDSESCAPE(c) (c == '\\' || c == '"')
-#define B4TYPE 0
-#define INTYPE 1
-#define B4EQUAL 2
-#define B4VALUE 3
-#define INVALUE 4
-#define INQUOTEDVALUE 5
-#define B4SEPARATOR 6
-
-#include "dn_exp.h"
-
-#endif /* _DN_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* dn_exp.h... *
-* *
-* Function:..Header-Datei fuer TWEB-Software *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* April 24 1996 Z D D V V *
-* Last modification: Z D D V V *
-* November 21 1996 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: dn_exp.h,v 1.6 1999/09/10 15:01:17 zrnsk01 Exp $
- *
- */
-
-#ifndef _DN_EXP_
-#define _DN_EXP_
-
-PUBLIC char * dn_normalize();
-PUBLIC char * dn_normalize_case();
-PUBLIC int dn_issuffix();
-
-#endif /* _DN_EXP_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* html.c..... *
-* *
-* Function:..WorldWideWeb-X.500-Gateway - HTML-Procedures *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* May 28 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: html.c,v 1.6 1999/09/10 15:01:17 zrnsk01 Exp $
- *
- */
-
-#include "tgeneral.h"
-#include "tglobal.h"
-#include "html.h"
-#include "init_exp.h"
-#include "support_exp.h"
-
-#ifdef TUETEL
-#include "tueTel_exp.h"
-#endif
-
-PUBLIC void print_attr(ld, fp, dn, label, tattr, e, flag, doNotShow, glob)
-LDAP *ld;
-FILE *fp;
-char *dn;
-char *label;
-char *tattr;
-LDAPMessage *e;
-int flag;
-char *doNotShow;
-GLOB_STRUCT *glob;
-{
- char **val;
- int i, gotone = 0, firstline = TRUE, valid_label = FALSE;
- static char *nlabel;
- char imageChar = 'J';
- char strbuf[BUFSIZ];
- int first_of_same = TRUE;
-
- nlabel = ldap_friendly_name(glob->friendlyfile, label, &fm);
-
- if ( (val = ldap_get_values( ld, e, tattr )) == NULL )
- return;
-
- /* check if only 1 value and this one is in "doNotShow"
- if((doNotShow) && (val[1] == NULL) && (strcmp(val[0],doNotShow) == 0))
- return;
- */
-
- for ( i = 0; val[i]; i++ ) {
-
- sprintf(strbuf, "(%s)", glob->la[0]);
- if(!strncasecmp(val[i], strbuf, 4)) {
- strcpy(val[i], val[i]+4);
- }
- else if(val[i][0] == '(' && val[i][3] == ')' ) {
- val[i][0] = '\0';
- continue;
- }
-
- if (!doNotShow || strncasecmp (val[i], doNotShow, strlen (val[i])))
- valid_label = TRUE;
- else
- val[i][0] = '\0';
- }
-
- if(!valid_label) {
-
- ldap_value_free (val);
- return;
-
- }
-
- fprintf( fp, "\n<DT><B>%s</B><DD>", nlabel );
-
- /* handle photo-requests */
- if((flag == BMP) || (flag == JPEG2GIF) || (flag == JPEG)) {
- photof(fp, flag, imageChar, dn, tattr);
- return;
- }
-
- for ( i = 0; val[i] != NULL; i++ ) {
-
- char *vali;
-
- if(!*label ) first_of_same = FALSE;
-
- if(!*val[i]) continue;
-
- vali = char2html(val[i]);
-
- if (flag == URL) {
- urlf(fp, vali);
-
-#ifdef TUE_TEL
- } else if (flag == TFUNCPERS) {
- tfuncpersf(fp, vali, ld, glob);
-#endif
-
- } else if (flag == DYNAMICDN) {
- dynamicdnf(fp, vali, glob);
-
- } else if (flag == INDEXURL) {
- indexurlf(fp, vali, dn, glob);
-
- } else if (flag == URI) {
- urif(fp, vali, glob);
-
- } else if (flag == PGPKEY) {
- pgpkeyf(fp, vali, &firstline);
-
- } else if ( ( flag == MULTILINE ) || (strchr(vali, '$') &&
- strncmp(vali, "{T.61}", 6) != 0 )) {
- multilinef(fp, vali, &first_of_same, &firstline, &gotone, nlabel);
-
- } else if (flag == BOOLEAN) {
- booleanf(fp, val[i], glob);
-
- } else if (flag == DATE) {
- datef(fp, val[i]);
-
- } else if (flag == MAILTO) {
- mailtof(fp, val[i], vali);
-
- } else if (flag == HREF) {
- hreff(fp, val[i], vali, glob);
-
- } else if (flag == MOVETO) {
- movetof(fp, val[i], vali, glob);
-
- } else if (flag == PRE) {
- pref(fp, vali, glob);
-
- } else if (flag == HEADER) {
- headerf(fp, vali, glob);
-
- } else if (flag == REFERRAL) {
- referralf(fp, vali, glob);
-
-#ifdef TUE_TEL
- } else if(flag == FAXTABLE) {
- faxtablef(fp, val, &firstline);
-#endif
-
- } else
- defaultf(fp, vali, &firstline);
- }
- ldap_value_free( val );
-}
-/* end of function: print_attr */
-
-PUBLIC void form_attr(ld, fp, label, tattr, e, multiline, add_empty, glob)
-LDAP *ld;
-FILE *fp;
-char *label;
-char *tattr;
-LDAPMessage *e;
-int multiline;
-int add_empty;
-GLOB_STRUCT *glob;
-{
- char **val, *s;
- char buffer[1024];
- int i, gotone = 0, line = 0;
- static char *nlabel;
- nlabel = ldap_friendly_name(glob->friendlyfile, label, &fm);
- if ( (val = ldap_get_values( ld, e, tattr )) == NULL ) {
- if (add_empty > 0)
- if(multiline)
- fprintf( fp, "<DT><B>%s</B><DD><TEXTAREA NAME=\"%s=\" ROWS=4 COLS=30></TEXTAREA><BR>\n",
- nlabel, tattr);
- else
- fprintf( fp, "<DT><B>%s</B><DD><INPUT NAME=\"%s=\" SIZE=30 ><BR>\n",
- nlabel, tattr);
- return;
- }
- fprintf( fp, "\n<DT><B>%s</B><DD>", nlabel );
- buffer[0] ='\0';
- for ( i = 0; val[i] != NULL; i++ ) {
- if ( multiline ) {
- char *s, *p;
- buffer[0] ='\0';
- if ( gotone )
- fprintf( fp, "<DT><B>%s</B><DD>", nlabel);
- p = s = val[i];
- while ( ( s = strchr( s, '$' )) ) {
- *s++ = '\0';
- while ( isspace( *s ) )
- s++;
- if ( line == 0 ) {
- sprintf(buffer, "%s", p);
- line++;
- } else {
- sprintf(buffer, "%s\n%s", buffer, p);
- line++;
- }
- p = s;
- }
- if (line++ == 0) {
- sprintf(buffer, "%s", p);
- } else {
- sprintf(buffer, "%s\n%s", buffer, p);
- }
- s = form_encode(buffer);
- fprintf( fp,
- "<TEXTAREA NAME=\"%s=%s\" ROWS=%d COLS=30>%s</TEXTAREA><BR>\n",
- tattr, s, line + 1, s);
- /* fprintf( fp, "<INPUT NAME=\"%s=%s\" SIZE=30,%d VALUE=\"%s\"> <BR>\n", tattr, s, line + 1, s); */
- gotone = 1;
- line = 0;
- } else {
- s = form_encode(val[i]);
- fprintf( fp, "<INPUT NAME=\"%s=%s\" SIZE=\"%d\" VALUE=\"%s\"><BR>\n", tattr, s,
- strlen(val[i]) > 30 ? strlen(val[i]) + 3 : 30, s);
- }
- }
- if (add_empty > i)
- fprintf( fp, "<INPUT NAME=\"%s=\" SIZE=30 ><BR>\n", tattr);
- ldap_value_free( val );
-}
-/* end of function: form_attr */
-
-PUBLIC void do_pict(ld, fp, dn, type, glob)
-LDAP *ld;
-FILE *fp;
-char *dn;
-int type;
-GLOB_STRUCT *glob;
-{
- int rc, i;
- struct berval **val;
- char cmd[128], buffer[1024];
- char *s;
- FILE *op, *tp;
- LDAPMessage *res, *e;
- struct stat st;
- char *cPtr, *ptype;
- char *tattr;
-
- if ( (rc = ldap_search_s( ld, dn, LDAP_SCOPE_BASE, NULL,
- NULL, 0, &res )) != LDAP_SUCCESS ) {
- do_error(fp, rc, NOT_FOUND, glob);
- return;
- }
-
- if ( (e = ldap_first_entry( ld, res )) == NULL ) {
- do_error(fp, -2, SERVER_ERROR, glob);
- return;
- }
-
- /*
- * old behaviour: use "photo" or "jpegPhoto" attribute
- * as indicated by type-argument.
- */
- tattr = (type == 0 ? "photo" : "jpegPhoto");
-
- /* NEW: if attr is added to URL via "+" use that attribute */
- if( ( cPtr = strQuoteChr(dn,'+')) )
- tattr = ++cPtr;
-
- if ( (val = ldap_get_values_len( ld, e, tattr)) == NULL )
- return;
-
- s = tmpnam( NULL );
- tp = fopen( s, "w+");
-
- if (type == 0) { /* g3fax photo -> xbm */
- sprintf(cmd, "%s > %s", G3TOXBM, s);
- if (debug) fprintf(stderr, "%ld bytes FAX!! %s\n",
- val[0]->bv_len, cmd);
- ptype = "x-xbitmap";
- } else if (type == 1) { /* jpeg -> gif */
- sprintf(cmd, "%s > %s", JPEGTOGIF, s);
- if (debug) fprintf(stderr, "%ld bytes JPEG!! %s\n",
- val[0]->bv_len, cmd);
- ptype = "gif";
- } else { /* jpeg direct */
- sprintf(cmd, "cat > %s", s);
- if (debug) fprintf(stderr, "%ld bytes JPEG!! %s\n",
- val[0]->bv_len, cmd);
- ptype = "jpeg";
- }
-
-
-
- if (http == 1) {
- fprintf(fp, "HTTP/1.0 %d OK<br>MIME-Version: 1.0<br>",
- DOCUMENT_FOLLOWS );
- fprintf(fp, "Content-type: image/%s<br>", ptype );
- }
- if (request == HEAD) {
- fflush(fp);
- exit_tweb (1);
- }
- if ((op = popen(cmd, "w")) == NULL )
- return;
- fwrite(val[0]->bv_val, val[0]->bv_len, 1, op);
- pclose(op);
- if (stat(s, &st) == 0 && http == 1) {
- fprintf(fp, "Content-length: %lu<br>", st.st_size);
- if (debug) fprintf(stderr, "Image size: %lu\n", st.st_size);
- }
- fprintf(fp, "<br>\n\n");
-
- while (( i = fread(buffer, 1, 1024, tp))) fwrite(buffer, 1, i, fp);
- fclose(tp);
- if (unlink(s) == -1) {
- if (debug) perror("Couldn't unlink temp image file");
- }
- fflush(fp);
-}
-/* end of function: do_pict */
-
-
-
-PUBLIC void do_audio(ld, fp, dn, type, glob)
-LDAP *ld;
-FILE *fp;
-char *dn;
-int type;
-GLOB_STRUCT *glob;
-{
- int rc;
- struct berval **val;
- LDAPMessage *res, *e;
- struct timeval timeout;
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
- if ( (rc = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, NULL,
- NULL, 0, &timeout, &res )) != LDAP_SUCCESS ) {
- do_error(fp, rc, NOT_FOUND, glob);
- return;
- }
-
- if ( (e = ldap_first_entry( ld, res )) == NULL ) {
- do_error(fp, -2, SERVER_ERROR, glob);
- return;
- }
- if ( (val = ldap_get_values_len( ld, e, "audio" )) == NULL )
- return;
- if (http == 1) {
- fprintf(fp, "HTTP/1.0 %d OK\nMIME-Version: 1.0\nServer: %s\n",
- DOCUMENT_FOLLOWS, version);
- fprintf(fp, "Content-type: audio/basic<P>Content-length: %ld\n\n",
- val[0]->bv_len);
- }
- if (request == HEAD) {
- fflush(fp);
- exit_tweb (1);
- }
- fwrite(val[0]->bv_val, val[0]->bv_len, 1, fp);
- fflush(fp);
-}
-/* end of function: do_audio */
-
-PUBLIC void do_sizelimit(fp, type, glob)
-FILE *fp;
-int type;
-GLOB_STRUCT *glob;
-
-{
- fprintf(fp, type ? glob->la[21] : glob->la[20]);
-}
-/* end of function: do_sizelimit */
-
-PUBLIC void do_error(fp, code, status, glob)
-FILE *fp;
-int code;
-int status;
-GLOB_STRUCT *glob;
-{
- char *s = "";
-
- if (http == 1) {
- switch (status) {
- case BAD_REQUEST: s = "Bad request"; break;
- case AUTH_REQUIRED: s = "Authorization required"; break;
- case FORBIDDEN: s = "Forbidden"; break;
- case NOT_FOUND: s = "Not found"; break;
- case SERVER_ERROR: s = "Server error"; break;
- case NOT_IMPLEMENTED: s = "Not implemented"; break;
- default: s = "Unknown error";
- }
-
- fprintf(fp, "HTTP/1.0 %03d %s\nMIME-Version: 1.0\nContent-Type: text/html\n\n", status, s);
- }
-
- if (request == HEAD) {
- fflush(fp);
- exit_tweb (1);
- }
-
- fprintf( fp, HTML_HEAD_TITLE, glob->la[22], glob->la[100]);
- fprintf( fp, "\n<H2>%s %s</H2>\n%s <P>%s <EM> %d: %s.</EM><P>%s<br></BODY></HTML>", glob->la[23], s, glob->la[24], glob->la[25], code, ldap_err2string( code ), glob->la[26] );
-}
-/* end of function: do_error */
-
-PUBLIC void explain_error (fp, error, status, glob )
-FILE *fp;
-char *error;
-int status;
-GLOB_STRUCT *glob;
-
-{
- char *s = "Unknown error";
- if (http == 1) {
- switch (status) {
- case BAD_REQUEST: s = "Bad request"; break;
- case AUTH_REQUIRED: s = "Authorization required"; break;
- case FORBIDDEN: s = "Forbidden"; break;
- case NOT_FOUND: s = "Not found"; break;
- case SERVER_ERROR: s = "Server error"; break;
- case NOT_IMPLEMENTED: s = "Not implemented"; break;
- default: s = "Unknown error";
- }
- fprintf(fp, "HTTP/1.0 %03d %s\n",status, s);
- fprintf(fp, "MIME-Version: 1.0\n");
- fprintf(fp, "Content-Type: text/html\n\n");
- }
- if (request == HEAD) {
- fflush(fp);
- exit_tweb (1);
- }
- fprintf( fp, HTML_HEAD_TITLE, glob->la[22], glob->la[100]);
- fprintf( fp, "<H2>%s: %s</H2>\n", glob->la[22], s);
- fprintf( fp, "%s</BODY>\n</HTML>", error);
-}
-/* end of function: explain_error */
-
-/* Make "Move upwards" Header */
-PUBLIC void make_header (fp, dn, action, glob)
-FILE *fp;
- char *dn;
-int action;
-GLOB_STRUCT *glob;
-{
- char **s, **t, hrdn[1024];
- int cnt, i, j;
- pGW_SWITCH_LINE gw_ptr;
- char url[BUFSIZ];
-
- if(glob->pull_down_menus) {
- make_header_pull_down(fp, dn, action, glob);
- return;
- }
-
- hrdn[0] = '\0';
- if ( strlen(dn) == 0) /* the root */
- return;
- s = ldap_explode_dn( dn, 1 );
- t = ldap_explode_dn( dn, 0 );
-
- strcpy(url, "M");
- for(gw_ptr = glob->gw_switch->list; gw_ptr; gw_ptr = gw_ptr->next)
- if (!strcasecmp(gw_ptr->dn, "ROOT"))
- strcpy(url, gw_ptr->url);
-
- fprintf( fp, "<strong>%s </strong><MENU>\n<LI> <A HREF=\"%s\">%s</A>\n",
- glob->la[27], url, glob->la[77]);
-
-
- for (cnt=0; t[cnt]; cnt++);
- for (i = cnt - 1; i > 0 && s[i]; i--) {
- strcpy(hrdn, hex_encode(t[i]));
- for (j = i + 1; j < cnt ; j++) {
- strcat(hrdn, hex_encode(", "));
- strcat(hrdn,hex_encode(t[j]));
- }
-
- strcpy(url, "/");
- for(gw_ptr = glob->gw_switch->list; gw_ptr; gw_ptr = gw_ptr->next)
- if (!dn_cmp(hex_encode (gw_ptr->dn), hrdn))
- strcpy(url, url_complete(gw_ptr->url, hrdn, "M"));
- if(strcmp(url, "/"))
- fprintf( fp, "<LI> <A HREF=\"%s\">%s</A>\n",
- url, i == cnt - 1 ?
- ldap_friendly_name( glob->friendlyfile, s[i], &fm ) :
- s[i]);
- else
- fprintf( fp, "<LI> <A HREF=\"%sM%s\">%s</A>\n",
- url, hrdn, i == cnt - 1 ?
- ldap_friendly_name( glob->friendlyfile, s[i], &fm ) :
- s[i]);
- hrdn[0] = '\0';
- }
- fprintf( fp, "</MENU>\n");
- ldap_value_free(s);
- ldap_value_free(t);
-}
-/* end of function: make_header */
-
-/* Make "Move upwards" Header with pull-down-menus*/
-PUBLIC void make_header_pull_down (fp, dn, action, glob)
-FILE *fp;
- char *dn;
-int action;
-GLOB_STRUCT *glob;
-{
- char **s, **t, hrdn[1024];
- int cnt, i, j;
- pGW_SWITCH_LINE gw_ptr;
- char url[BUFSIZ];
-
- hrdn[0] = '\0';
- if ( strlen(dn) == 0) /* the root */
- return;
- s = ldap_explode_dn( dn, 1 );
- t = ldap_explode_dn( dn, 0 );
-
- strcpy(url, "M");
- for(gw_ptr = glob->gw_switch->list; gw_ptr; gw_ptr = gw_ptr->next)
- if (!strcasecmp(gw_ptr->dn, "ROOT"))
- strcpy(url, gw_ptr->url);
-
- fprintf( fp, "<FORM ACTION=\"/D\">\n");
- fprintf( fp,
- "<INPUT TYPE=submit VALUE=\"%s\"> -> <SELECT NAME=\"H\">\n",
- glob->la[27]);
- fprintf( fp, "<OPTION VALUE=\"%s\">%s\n", url, glob->la[77]);
-
- for (cnt=0; t[cnt]; cnt++);
- for (i = cnt - 1; i > 0 && s[i]; i--) {
- strcpy(hrdn, hex_encode(t[i]));
- for (j = i + 1; j < cnt ; j++) {
- strcat(hrdn, hex_encode(", "));
- strcat(hrdn,hex_encode(t[j]));
- }
-
- strcpy(url, "/");
- for(gw_ptr = glob->gw_switch->list; gw_ptr; gw_ptr = gw_ptr->next)
- if (!dn_cmp(hex_encode (gw_ptr->dn), hrdn))
- strcpy(url, url_complete(gw_ptr->url, hrdn, "M"));
- if(strcmp(url, "/"))
- fprintf( fp, "<OPTION VALUE=\"%s\" %s>%s\n", url,
- i==1 ? "SELECTED" : "", i == cnt - 1 ?
- ldap_friendly_name( glob->friendlyfile, s[i], &fm ) :s[i]);
- else
- fprintf( fp, "<OPTION VALUE=\"%sM%s\" %s>%s\n",
- url, hrdn, i==1 ? "SELECTED" : "", i == cnt - 1 ?
- ldap_friendly_name( glob->friendlyfile, s[i], &fm ) :s[i]);
- hrdn[0] = '\0';
- }
- fprintf( fp, "</SELECT></FORM>\n");
-
- ldap_value_free(s);
- ldap_value_free(t);
-}
-/* end of function: make_header_pull_down */
-
-PUBLIC char * url_complete (gwp_url, rdn, separator)
-char *gwp_url, *rdn, *separator;
-{
- static char url[BUFSIZ];
- char *strptr;
-
- strcpy(url, gwp_url);
-
- if(!strchr (gwp_url, '=')) {
-
- if (!strncasecmp (url, "http://", 7)) {
-
- if ( ( strptr = strchr (url+7, '/')) ) *(++strptr) = '\0';
- else strcat (url, "/");
-
- } else *url = '\0';
-
- sprintf (url, "%s%s%s", url, separator, rdn);
-
- }
-
- return(url);
-
-}
-/* end of function: url_complete */
-
-PRIVATE void photof(fp, flag, imageChar, dn, tattr)
-FILE *fp;
-int flag;
-char imageChar;
-char *dn;
-char *tattr;
-{
- switch(flag) {
- case BMP : imageChar = 'G'; break;
- case JPEG2GIF: imageChar = 'I'; break;
- case JPEG : imageChar = 'J'; break;
- }
- fprintf( fp, "<IMG ALT=\"Photo\" SRC=\"%c%s\"+%s>\n",
- imageChar, hex_encode(dn), tattr);
-}
-/* end of function: photof */
-
-PRIVATE void urlf(fp, vali)
-FILE *fp;
-char *vali;
-{
- char *cp;
-
- if ((cp = strchr(vali, '$')) != NULL) {
- *cp++ = '\0';
- fprintf( fp, "%s%c\n", vali,
- (vali[0] ? ':' : ' '));
- fprintf(fp," <A HREF=\"%s\"> %s</A><BR>\n",
- cp, cp);
- } else
- fprintf( fp, "%s<BR>\n", vali);
-}
-/* end of function: urlf */
-
-PRIVATE void dynamicdnf(fp, vali, glob)
-FILE *fp;
-char *vali;
-GLOB_STRUCT *glob;
-{
- fprintf(fp," <A HREF=\"%s/M%s\"> %s</A><BR>\n",
-
-#ifdef TUE_TEL
- dn2server(vali, glob),
-#else
- "",
-#endif
-
- vali, vali);
-}
-/* end of function: dynamicdnf */
-
-/* Allow href dn-lable flexible configuration via INDEXURL */
-PRIVATE void indexurlf(fp, vali, entrydn, glob)
-FILE *fp;
-char *vali;
-char *entrydn;
-GLOB_STRUCT *glob;
-{
- char *cp;
- char dnbuf[BUFSIZ], *strptr, **dn;
- char rulebuf[BUFSIZ], *disp_item;
- int arrsize, first;
- char entrydnbuf[BUFSIZ], dit_dnbuf[BUFSIZ];
- int index;
-
- if (((cp = strchr(vali, ' ')) != NULL) && glob->index_url) {
-
- *cp++ = '\0';
- index = atoi(cp);
-
- if ( index < 0 || index >= INDEX_RULE_SIZE )
- return;
- if (!glob->index_url->rarr[index].rule) {
- return;
- }
-
- /* case entrydn out of range */
- strcpy(entrydnbuf, entrydn);
- strcpy(dit_dnbuf, glob->index_url->rarr[index].dit_dn);
- dn_normalize(entrydnbuf);
- dn_normalize(dit_dnbuf);
- if(!dn_issuffix(entrydnbuf, dit_dnbuf)){
- fprintf(fp," <A HREF=\"%s\"> %s</A><BR>\n", vali, cp);
- return;
- }
-
- /* return if url doesn't contain cn= ( no dn ) */
- if(!(strptr = strstr(vali, "cn=")))
- return;
- strcpy(dnbuf, strptr);
- hex_decode(dnbuf);
- dn = ldap_explode_dn(dnbuf, 1);
-
- for(arrsize=0; dn[arrsize]; arrsize++)
- ;
-
- if(arrsize && glob->strip_pin)
- trimright(dn[0], " 1234567890");
-
- fprintf(fp," <A HREF=\"%s\">", vali);
- strcpy(rulebuf, glob->index_url->rarr[index].rule);
- first = 1;
-
- for(disp_item = strtok(rulebuf, ","); disp_item;
- disp_item = strtok(NULL, ",")) {
- if(abs(atoi(disp_item)) >= arrsize) continue;
-
- if(*disp_item == '-') {
- fprintf(fp,"%s%s", !first ? ", " : "",
- dn[arrsize + atoi(disp_item) - 1]);
- } else {
- fprintf(fp,"%s%s", !first ? ", " : "", dn[atoi(disp_item)]);
- }
- first = 0;
- }
-
- fprintf(fp,"</A><BR>\n");
- } else
- fprintf( fp, "%s<BR>\n", vali);
-}
-/* end of function: indexurlf */
-
-PRIVATE void urif(fp, vali, glob)
-FILE *fp;
-char *vali;
-GLOB_STRUCT *glob;
-{
- char *cp;
-
- if(glob->gw_switch->dynamic && strstr(vali, "(gw"))
- return;
- if ((cp = strchr(vali, ' ')) != NULL) {
- *cp++ = '\0';
- fprintf(fp," <A HREF=\"%s\"> %s</A><BR>\n", vali, cp);
- } else
- fprintf( fp, "%s<BR>\n", vali);
-}
-/* end of function: urif */
-
-/* function for ldap-referrals etc. */
-PRIVATE void referralf(fp, vali, glob)
-FILE *fp;
-char *vali;
-GLOB_STRUCT *glob;
-{
- char *cp;
-
- if(glob->gw_switch->dynamic && strstr(vali, "(gw"))
- return;
- if ((cp = strchr(vali, ' ')) != NULL) {
- *cp++ = '\0';
- fprintf(fp," <A HREF=\"http://%s:%d/W%s\"> %s</A><BR>\n",
- glob->hostname, glob->webport, vali, cp);
- } else
- fprintf(fp," <A HREF=\"http://%s:%d/W%s\"> %s</A><BR>\n",
- glob->hostname, glob->webport, vali, vali);
-}
-/* end of function: referralf */
-
-PRIVATE void pgpkeyf(fp, vali, firstline)
-FILE *fp;
-char *vali;
-int *firstline;
-{
- char *s, *p;
-
- fprintf( fp, "<TT>\n");
- p = s = vali;
- while ( ( s = strstr( s, " $" )) ) {
- *s++ = '\0'; /* delete BLANK */
- *s++ = '\0'; /* delete DOLLAR */
- while ( isspace( *s ) )
- s++;
- if ( *firstline == TRUE ) {
- fprintf( fp, "<DT>%s<BR>\n", p );
- *firstline = FALSE;
- } else if (!strncasecmp(p, "Version", 7)) {
- fprintf( fp, "%s<BR><BR>\n", p );
- } else {
- fprintf( fp, "%s<BR>\n", p );
- }
- p = s;
- }
- if ( *firstline == TRUE ) {
- fprintf( fp,"<DT>%s<BR>", p );
- *firstline = FALSE;
- } else {
- fprintf( fp, "%s\n", p );
- }
- fprintf( fp, "</TT>\n");
-}
-/* end of function: pgpkeyf */
-
-PRIVATE void multilinef(fp, vali, first_of_same, firstline, gotone, nlabel)
-FILE *fp;
-char *vali;
-int *first_of_same;
-int *firstline;
-int *gotone;
-char *nlabel;
-{
- char *s, *p;
-
- if ( !*first_of_same && *gotone)
- fprintf( fp, "<BR>");
- if ( *gotone && *first_of_same)
- fprintf( fp, "<DT><B>%s</B><DD>", nlabel);
- else if (!*first_of_same)
- fprintf( fp, "<BR>");
- p = s = vali;
-
- /* PATCH to process MULTILINE correctly:
- replace strstr() instead of strchr(), in order not to missinterpret
- DOLLAR in Text ; /KSp, 95/06/28
- */
-
- /*
- while ( s = strchr( s, '$' ) ) {
- */
- while ( ( s = strstr( s, " $" )) ) {
- *s++ = '\0'; /* delete BLANK */
- *s++ = '\0'; /* delete DOLLAR */
- while ( isspace( *s ) )
- s++;
-
- /*
- if (dosyslog)
- syslog (LOG_INFO, "multiLineAttr: %s", p);
- */
-
- fprintf( fp, "%s<BR>\n", p );
- if ( *firstline == TRUE )
- *firstline = FALSE;
- p = s;
- }
- if ( *firstline ) {
- fprintf( fp, "%s<BR>\n", p );
- } else {
- fprintf( fp, "%s", p );
- }
- *gotone = 1;
- *firstline = FALSE;
- *first_of_same = FALSE;
-}
-/* end of function: multilinef */
-
-PRIVATE void booleanf(fp, val_i, glob)
-FILE *fp;
-char *val_i;
-GLOB_STRUCT *glob;
-{
- if (!strcmp(val_i, "TRUE")) fprintf( fp, "%s<BR>\n", glob->la[78]);
- else fprintf( fp, "%s<BR>\n", glob->la[79]);
-}
-/* end of function: booleanf */
-
-PRIVATE void datef(fp, val_i)
-FILE *fp;
-char **val_i;
-{
- fprintf( fp, "%s<BR>\n", format_date(&val_i, "%A, %d-%h-%y %T GMT"));
-}
-/* end of function: datef */
-
-PRIVATE void mailtof(fp, val_i, vali)
-FILE *fp;
-char *val_i;
-char *vali;
-{
- fprintf (fp, "<A HREF=\"mailto:%s\">%s</A><BR>\n", val_i, vali);
-}
-/* end of function: mailtof */
-
-PRIVATE void hreff(fp, val_i, vali, glob)
-FILE *fp;
-char *val_i;
-char *vali;
-GLOB_STRUCT *glob;
-{
- char *ufn;
- char op = 'R';
-
- ufn = friendly_dn( val_i, glob );
- fprintf( fp, "<A HREF=\"/%c%s\">%s</A><BR>\n", op,
- hex_encode(val_i), ufn ? ufn : vali);
- if ( ufn ) {
- free( ufn );
- }
-}
-/* end of function: hreff */
-
-PRIVATE void movetof(fp, val_i, vali, glob)
-FILE *fp;
-char *val_i;
-char *vali;
-GLOB_STRUCT *glob;
-{
- char *ufn;
- char op = 'M';
-
- ufn = friendly_dn( val_i, glob );
- fprintf( fp, "<A HREF=\"/%c%s\">%s</A><BR>\n", op,
- hex_encode(val_i), ufn ? ufn : vali);
- if ( ufn ) {
- free( ufn );
- }
-}
-/* end of function: movetof */
-
-
-PRIVATE void headerf(fp, vali, firstline)
-FILE *fp;
-char *vali;
-int *firstline;
-{
- fprintf( fp, "<DT>");
- fprintf( fp, "<H1>");
- fprintf( fp,"%s", vali );
- fprintf( fp, "</H1>\n");
-}
-/* end of function: headerf */
-
-PRIVATE void pref(fp, vali, firstline)
-FILE *fp;
-char *vali;
-int *firstline;
-{
- fprintf( fp, "<DT>");
- fprintf( fp, "<PRE>");
- fprintf( fp,"%s", vali );
- fprintf( fp, "</PRE>\n");
-}
-/* end of function: pref */
-
-PRIVATE void defaultf(fp, vali, firstline)
-FILE *fp;
-char *vali;
-int *firstline;
-{
- if ( *firstline == TRUE ) {
- fprintf( fp,"%s", vali );
- *firstline = FALSE;
- } else {
- fprintf( fp, "<BR>\n%s", vali );
- }
-}
-/* end of function: defaultf */
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* html.h..... *
-* *
-* Function:..File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* April 19 1996 Z D D V V *
-* Last modification: Z D D V V *
-* May 14 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: html.h,v 1.6 1999/09/10 15:01:17 zrnsk01 Exp $
- *
- */
-
-#ifndef _HTML_
-#define _HTML_
-
-#include "html_exp.h"
-#include "dn_exp.h"
-
-PRIVATE void photof();
-PRIVATE void urlf();
-PRIVATE void urif();
-PRIVATE void referralf();
-PRIVATE void dynamicdnf();
-PRIVATE void indexurlf();
-PRIVATE void pgpkeyf();
-PRIVATE void multilinef();
-PRIVATE void booleanf();
-PRIVATE void datef();
-PRIVATE void mailtof();
-PRIVATE void hreff();
-PRIVATE void movetof();
-PRIVATE void pref();
-PRIVATE void headerf();
-PRIVATE void defaultf();
-PRIVATE void make_header_pull_down();
-
-#endif /* _HTML_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* html_exp.h. *
-* *
-* Function:..File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* February 13 1996 Z D D V V *
-* Last modification: Z D D V V *
-* November 21 1996 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: html_exp.h,v 1.6 1999/09/10 15:01:17 zrnsk01 Exp $
- *
- */
-
-#ifndef _HTML_EXP_
-#define _HTML_EXP_
-
-PUBLIC void print_attr(/*ld, fp, dn, label, tattr, e, flag, doNotShow, glob*/);
-PUBLIC void form_attr(/*ld, fp, label, tattr, e, multiline, add_empty, glob*/);
-PUBLIC void do_pict(/*ld, fp, dn, type, glob*/);
-PUBLIC void do_audio(/*ld, fp, dn, type, glob*/);
-PUBLIC void do_sizelimit(/*fp, type, glob*/);
-PUBLIC void do_error(/*fp, code, status, glob*/);
-PUBLIC void explain_error (/*fp, error, status, glob */);
-PUBLIC void make_header (/*fp, dn, action, glob*/);
-PUBLIC char * url_complete (/*gwp_url, rdn, separator*/);
-
-
-
-#endif /* _HTML_EXP_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* init.c..... *
-* *
-* Function:..Initialisation-Routine for TWEB *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* July 21 1995 Z D D V V *
-* Last modification: Z D D V V *
-* May 11 1999 ZZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: init.c,v 1.6 1999/09/10 15:01:17 zrnsk01 Exp $
- *
- */
-
-#include "tgeneral.h"
-#include "tglobal.h"
-#include "init.h"
-
-
-PUBLIC void getopts (argc, argv, glob)
-int argc;
-char **argv;
-GLOB_STRUCT *glob;
-{
- int i;
- extern char *optarg;
- char hname[BUFSIZ];
- struct hostent *hstruct;
-
- while ( (i = getopt( argc, argv, "P:ad:f:l:p:x:b:L:" )) != EOF ) {
- switch( i ) {
- case 'a':
- searchaliases = 0;
- break;
- case 'b':
- if(glob->basedn && glob->basedn->dn)
- free(glob->basedn->dn);
- glob->basedn->dn = strdup( optarg );
- break;
- case 'd':
- debug = atoi( optarg );
-#ifdef LDAP_DEBUG
- ldap_debug = debug;
-#else
- fprintf( stderr,
- "warning: ldap debugging requires LDAP_DEBUG\n" );
-#endif
- break;
-
- case 'f':
- glob->filterfile = strdup( optarg );
- break;
-
- case 'l':
- dosyslog = cnvt_str2int( optarg, syslog_types, LOG_LOCAL3 );
- break;
-
- case 'p':
- glob->webport = atoi( optarg );
- break;
-
- case 'P':
- glob->ldapport = atoi( optarg );
- break;
-
- case 'x':
- if(glob->ldapd)
- free(glob->ldapd);
- glob->ldapd = str_tolower( strdup( optarg ));
- break;
- case 'L':
- break;
- default:
- usage(argv[0]);
- }
- }
- if ( (glob->myname = strrchr( argv[0], '/' )) == NULL )
- glob->myname = argv[0];
- else
- glob->myname++;
-
- if(!glob->hostname) {
- gethostname(hname, BUFSIZ);
- hstruct = gethostbyname(hname);
- glob->hostname = str_tolower( strdup( hstruct->h_name ));
- }
-
-}
-/* end of function: getopts */
-
-PRIVATE void usage(name)
-char *name;
-{
- fprintf(stderr, USAGE, name);
- exit( 1 );
-}
-/* end of function: usage */
-
-PUBLIC void check (glob)
-GLOB_STRUCT *glob;
-{
- if(!glob->webport || !glob->ldapd || !glob->ldapport ||
- !glob->basedn || !glob->sort) {
- fprintf(stderr,
-"\nMissing must-attribute: webport || ldapd || ldapport || basedn->dn || sort\n!\n\n");
- exit(1);
- }
-
- if(glob->grant){
- trim(glob->grant, "|");
- glob->comp_grant = tweb_regcomp(glob->grant);
- }
-
- if(glob->refuse){
- trim(glob->refuse, "|");
- glob->comp_refuse = tweb_regcomp(glob->refuse);
- }
-
- if(glob->allow_string){
- trim(glob->allow_string, "|");
- glob->comp_allow = tweb_regcomp(glob->allow_string);
- }
-
- if(glob->deny_string){
- trim(glob->deny_string, "|");
- glob->comp_deny = tweb_regcomp(glob->deny_string);
- }
-
- if(!glob->webdn){
- glob->webdn = "c=DE";
- if(glob->webpw) free(glob->webpw);
- glob->webpw = NULL;
- }
- if(!glob->webdn2){
- glob->webdn2 = "c=BR";
- if(glob->webpw2) free(glob->webpw2);
- glob->webpw2 = NULL;
- }
-
- if(!glob->timeout)
- glob->timeout = DEFAULT_TIMEOUT;
- if(!glob->maxcount)
- glob->maxcount = DEFAULT_MAXCOUNT;
-
- if(!glob->subtree_search)
- glob->subtree_search =
- str2charray( "organization:organizationalUnit", ":");
-
- glob->cache_expire = glob->cache_expire % MAX_EXPIRE;
-
- f_test(glob);
- if(glob->sort) {
- pSORT_LINE s_ptr;
- pDISPLAY d_ptr;
-
- for(s_ptr = glob->sort; s_ptr; s_ptr = s_ptr->next)
- for(d_ptr = glob->display; d_ptr; d_ptr = d_ptr->next) {
- if(!strcmp(d_ptr->ocs, s_ptr->display_class)) {
- s_ptr->display_class_ptr = d_ptr;
- break;
- }
- if(!strcmp(d_ptr->ocs, "default"))
- s_ptr->display_class_ptr = d_ptr;
- }
- }
-
- if( glob->ldapd && !strcmp(glob->ldapd, "x500-relay.uni-tuebingen.de")
- && !strcmp(glob->lang, "0")) {
- fprintf( stderr,
- "\n\n\tYou missed to set LDAP-HOST and LDAP-PORT to\n\
- a machine of your own.\n\n\tPlease change as soon as \
- possible to avoid\n\
- overload of host x500-relay.uni-tuebingen.de !\n\n");
- }
-
-}
-/* end of function: check */
-
-PUBLIC void init(argv, lang, glob)
-char **argv;
-char *lang;
-GLOB_STRUCT *glob;
-{
-FILE *fp;
-static char file[BUFSIZ];
-
- glob->argv0 = strdup(argv[0]);
- glob->gw_switch = (pGW_SWITCH) ch_calloc(1, sizeof(GW_SWITCH));
- glob->basedn = (BASEDN_LINE *) ch_calloc(1, sizeof(BASEDN_LINE));
- glob->basedn->dn = strdup("");
- glob->menu_filter = strdup("(& (objectClass=top)(!(objectClass=dSA)) )");
-
-#ifdef RCINIT
- strcpy(file, RCINIT);
-#else
- sprintf( file, "%s.rc", argv[0] );
-#endif
- glob->acfilename = file;
- if(!(fp = fopen(file, "r"))) {
- fprintf(stderr, "\n\nATTENTION!!!\n\nCould not open file %s !\n", file);
- exit(1);
- }
- main_loop(fp, glob);
- fclose(fp);
-
-#ifdef CONFINIT
- strcpy(file, CONFINIT);
-#else
- sprintf( file, "%s.conf.%s", argv[0], glob->lang );
-#endif
- glob->acfilename = file;
- if(!(fp = fopen(file, "r"))) {
- fprintf(stderr, "\n\nATTENTION!!!\n\nCould not open file %s !\n", file);
- exit(1);
- }
- main_loop(fp, glob);
- fclose(fp);
- return;
-}
-/* end of function: init */
-
-#define STRINGP(x) ((x) ? (x) : "(NULL)")
-
-PUBLIC void output(fp, glob, html_flag)
-FILE *fp;
-GLOB_STRUCT *glob;
-int html_flag;
-{
- pDISPLAY d_ptr;
- pSEARCH_ONLY_LINE so_ptr;
- pGW_SWITCH_LINE gw_ptr;
- pSORT_LINE s_ptr;
- pDISPLAY_LINE dis_ptr;
- pMODIFY_LINE mod_ptr;
- pMODIF m_ptr;
- pCACHING_TERMS_LINE ca_ptr;
- pIND_ATTRS i_ptr;
- IND_ATTR_ARR *idx;
- pTABLE_DISPLAY ta_ptr;
- pFORM_BUTTON fo_ptr;
- int i;
- char hb[BUFSIZ], he[BUFSIZ], li[BUFSIZ], lb[BUFSIZ], le[BUFSIZ];
-
- strcpy(lb, html_flag ? "<UL>" : "");
- strcpy(le, html_flag ? "</UL>" : "");
- strcpy(li, html_flag ? "<LI>" : "");
- strcpy(hb, html_flag ? "</UL><B>" : "");
- strcpy(he, html_flag ? "</B><UL>" : "");
-
-/*for(i=0; glob->sort_attribs[i]; i++)
- fprintf(fp,"%s<p>\n", glob->sort_attribs[i]);
-*/
-
- fprintf(fp,
- "%s\n\n\n###############CONFIGURATION-DISPLAY###############\n\n%s",
- html_flag ? "<B>" : "", he);
- fprintf(fp, "\n%s\n\n%s", version, html_flag ? "<p>" : "");
-/* fprintf(fp, "%s\n%s\n\n%s", html_flag ? "<B>" : "", version, he);
-*/
-
- fprintf(fp, "%sWEBDN%s%s %s\n", hb, he, li, STRINGP( glob->webdn ));
- fprintf(fp, "%sWEBDN2%s%s %s\n", hb, he, li, STRINGP( glob->webdn2 ));
- if(!html_flag){
- fprintf(fp, "WEBPW: %s\n", STRINGP( glob->webpw ));
- fprintf(fp, "WEBPW2: %s\n", STRINGP( glob->webpw2 ));
- }
- fprintf(fp, "%sTWEBHOST%s%s %s:%d\n", hb, he, li, STRINGP( glob->hostname ),
- glob->virtualport ? glob->virtualport : glob->webport);
- fprintf(fp, "%sWEBPORT%s%s %d\n", hb, he, li, glob->webport);
- fprintf(fp, "%sTIMEOUT%s%s %d\n", hb, he, li, glob->timeout);
- fprintf(fp, "%sLDAPD%s%s %s\n", hb, he, li, STRINGP( glob->ldapd ));
- fprintf(fp, "%sLDAPPORT%s%s %d\n\n", hb, he, li, glob->ldapport);
- fprintf(fp, "%sETCDIR%s%s %s\n", hb, he, li, STRINGP( glob->etcdir ));
- fprintf(fp, "%sHELPFILE%s%s %s\n", hb, he, li, STRINGP( glob->helpfile ));
- fprintf(fp, "%sFILTERFILE%s%s %s\n", hb, he, li,
- STRINGP( glob->filterfile ));
- fprintf(fp, "%sFRIENDLYFILE%s%s %s\n", hb, he, li,
- STRINGP( glob->friendlyfile ));
- fprintf(fp, "%sHEADER%s%s %s\n", hb, he, li, STRINGP( glob->header ));
- fprintf(fp, "%sFOOTER%s%s %s\n", hb, he, li, STRINGP( glob->footer ));
- fprintf(fp, "%sGRANT%s%s %s\n", hb, he, li, STRINGP( glob->grant ));
- fprintf(fp, "%sREFUSE%s%s %s\n", hb, he, li, STRINGP( glob->refuse ));
-
- fprintf(fp, "%s\nPULL-DOWN-MENUS%s%s %s\n",
- hb, he, li, glob->pull_down_menus?"YES":"NO");
- fprintf(fp, "%s\nDISP-SEA-RDN%s%s %s\n",
- hb, he, li, glob->disp_sea_rdn?"YES":"NO");
- fprintf(fp, "%s\nNO-PROXY%s%s %s\n", hb, he, li, glob->no_proxy?"YES":"NO");
- fprintf(fp, "%s\nALLOW-PROXY%s\n%s", hb, he, li);
- for(i = 0; glob->allow_proxy && glob->allow_proxy[i]; i++)
- fprintf(fp, "%s:", glob->allow_proxy[i]);
-
- fprintf(fp, "%sALLOW-STRING%s%s %s\n", hb, he, li,
- STRINGP( glob->allow_string ));
- fprintf(fp, "%sDENY-STRING%s%s %s\n", hb, he, li,
- STRINGP( glob->deny_string ));
- fprintf(fp, "%sALLOW-MSG%s%s %s\n", hb, he, li, STRINGP( glob->allow_msg ));
- fprintf(fp, "%s\nBASEDN%s%s \t%s\t%s\t%s\n", hb, he, li,
- STRINGP( glob->basedn->dn ), STRINGP( glob->basedn->head ),
- STRINGP( glob->basedn->foot ));
-/* fprintf(fp, "%s\nBASEDNARRAY%s%s \t%s\t%s\n", hb, he, li, glob->basedn->dnarray[0], glob->basedn->dnarray[1]); */
- fprintf(fp, "%s\nMAXCOUNT%s%s %d\n", hb, he, li, glob->maxcount);
- if (glob->comrefuse)
- fprintf(fp, "%s\nCOMREFUSE%s%s %d\t%d\t%d\t%d\t%lu\t%s\n",
- hb, he, li, glob->comrefuse->tmin, glob->comrefuse->tdiff,
- glob->comrefuse->maxAccept, glob->comrefuse->suspendCycle,
- glob->comrefuse->statCycle,
- STRINGP( glob->comrefuse->statFile ));
- fprintf(fp, "%s\nMAX-PERSON%s%s %d\t%s\t%s\n", hb, he, li,
- glob->max_person, glob->strict?"STRICT":"",
- glob->no_browse?"NO-BROWSE":"");
- fprintf(fp, "%s\nLEGAL%s%s %s %s\n", hb, he, li, glob->legal?"YES":"NO",
- glob->legal_top ? "ON-TOP" : "");
-/* fprintf(fp, "%s\nSHOW-DEFOC%s%s %s\n", hb, he, li, glob->show_defoc?"YES":"NO");
-*/
-
-#ifdef AMBIXGW
- fprintf(fp, "%s\nSELBSTEINTRAG%s\n", hb, he);
- for(i = 0; i<9; i++)
- if (glob->selbsteintrag[i])
- fprintf(fp, "%s\t%s\n", li, glob->selbsteintrag[i]);
-#endif
-
- fprintf(fp, "%s\nSTRIP-PIN%s%s %s\n", hb, he, li,
- STRINGP( glob->strip_pin ));
- fprintf(fp, "%s\nPREFER-REF-URIS%s%s %s\n", hb, he, li,
- glob->prefer_ref_uris?"YES":"NO");
- fprintf(fp, "%s\nSTRICT-BASEDN%s%s %s\n", hb, he, li,
- glob->strict_basedn?"YES":"NO");
- fprintf(fp, "%s\nNO-SHOW-RDN%s%s %s\n\n", hb, he, li,
- STRINGP( glob->no_show_rdn ));
- fprintf(fp, "%s\nNO-MODIFY%s%s %s\n\n", hb, he, li,
- STRINGP( glob->no_modify ));
-
-#ifdef TUE_TEL
- fprintf(fp, "%sPHONEWORLD%s%s %s\n", hb, he, li,
- STRINGP( glob->phoneworld ));
-#endif
-
- fprintf(fp, "%s\nLANGUAGE%s\n", hb, he);
- for(i = 0; glob->language[i]; i++)
- fprintf(fp, "%s\t%s\n", li, glob->language[i]);
-
- fprintf(fp, "%s\nCACHE-EXPIRE-DEFAULT%s%s %d\n", hb, he, li,
- glob->cache_expire);
- fprintf(fp, "%s\nCACHING-TERMS%s\n", hb, he);
- for(ca_ptr = glob->caching_terms; ca_ptr; ca_ptr = ca_ptr->next) {
- fprintf(fp, "%s\t%d\t%s\t%s\t%s\n", li, ca_ptr->time,
- STRINGP( ca_ptr->access_type ), ca_ptr->rdn_oc ? "RDN" : "OC",
- STRINGP( ca_ptr->pattern ));
- }
-
-#ifdef TUE_TEL
- if(glob->ton_urls) {
- fprintf(fp, "%s\nTON-URLS%s\n", hb, he);
- fprintf(fp, "%s\t%s\t%s\t%s\t%s\t%s\t%s\n",li,
- STRINGP( glob->ton_urls->attribute ),
- STRINGP( glob->ton_urls->rdn_attr ),
- STRINGP( glob->ton_urls->redirect ),
- STRINGP( glob->ton_urls->x_disp ),
- STRINGP( glob->ton_urls->base ),
- glob->ton_urls->admin?"ADMIN":
- glob->ton_urls->pass_oc? glob->ton_urls->pass_oc : "");
- }
-#endif
- if(glob->ip_refuse) {
- fprintf(fp, "%s\nIP-REFUSE%s\n", hb, he);
- fprintf(fp, "%s\t%s\t%d\n",li,
- STRINGP( glob->ip_refuse->dat_file ), glob->ip_refuse->rereadcycle);
- }
-
- fprintf(fp, "%s\nSEARCH-ONLY%s\n", hb, he);
- for(so_ptr = glob->search_only; so_ptr; so_ptr = so_ptr->next) {
- fprintf(fp, "%s\t%s\t%s\t%s\n", li, STRINGP( so_ptr->dn ),
- STRINGP( so_ptr->head ), STRINGP( so_ptr->foot ));
- }
-
- fprintf(fp, "%s\nSUBTREE-SEARCH%s\n%s", hb, he, li);
- for(i = 0; glob->subtree_search && glob->subtree_search[i]; i++)
- fprintf(fp, "%s:", glob->subtree_search[i]);
-
- if(glob->index_url) {
- fprintf(fp, "%s\nINDEX-URL%s\n", hb, he);
- fprintf(fp, "%s\t%s\t%d\n", li, STRINGP( glob->index_url->dat_file ),
- glob->index_url->rereadcycle );
- }
-
-#ifdef TUE_TEL
- if(glob->dit_config) {
- fprintf(fp, "%s\nDIT-CONFIG%s\n", hb, he);
- fprintf(fp, "%s\t%s\t%s\t%s\n", li, STRINGP( glob->dit_config->attr ),
- STRINGP( glob->dit_config->fetch_dn ),
- glob->dit_config->not_browse ? "NOT-BROWSE" : "");
- }
-#endif
-
- fprintf(fp, "%s\nDYNAMIC-GW%s%s %s\n", hb, he, li,
- glob->gw_switch->dynamic?"YES":"NO");
- fprintf(fp, "%s\nGW-SWITCH%s\n", hb, he);
- for(gw_ptr = glob->gw_switch->list; gw_ptr; gw_ptr = gw_ptr->next) {
- fprintf(fp, "%s\t%s\t%s\n", li, STRINGP( gw_ptr->dn ),
- STRINGP( gw_ptr->url ));
- }
-
- fprintf(fp, "%s\nSORT%s\n", hb, he);
- for(s_ptr = glob->sort; s_ptr; s_ptr = s_ptr->next) {
- fprintf(fp, "%s\t%s\t%s\t%d\t%s\t%s\n", li,
- STRINGP( s_ptr->object_class ),
- STRINGP( s_ptr->label ), s_ptr->priority,
- STRINGP( s_ptr->display_class ), STRINGP( s_ptr->sort_attr ));
- }
-
- fprintf(fp, "%s\nTABLES%s\n", hb, he);
- for(ta_ptr = glob->tables; ta_ptr; ta_ptr = ta_ptr->next) {
- fprintf(fp, "%s\t%s\t%s\t%s\t%s\n", li, ta_ptr->allow ? "ALLOW" : "ALL",
- STRINGP( ta_ptr->select_oc ), STRINGP( ta_ptr->button_label ),
- STRINGP( ta_ptr->dn_extension ));
- }
-
- fprintf(fp, "%s\nFORM-BUTTON%s\n", hb, he);
- for(fo_ptr = glob->form_button; fo_ptr; fo_ptr = fo_ptr->next) {
- fprintf(fp, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", li,
- fo_ptr->read_menu ? "READ" : "MENU",
- STRINGP( fo_ptr->object_class ), STRINGP( fo_ptr->method ),
- STRINGP( fo_ptr->script_url ), STRINGP( fo_ptr->text ),
- STRINGP( fo_ptr->dn_name ), STRINGP( fo_ptr->form_name ),
- STRINGP( fo_ptr->button_label ));
- }
-
- fprintf(fp, "%s\nINDIRECT-ATTRS%s", hb, he);
- for(i_ptr = glob->ind_attrs; i_ptr; i_ptr = i_ptr->next) {
- fprintf(fp, "%s %s\n%s", li, STRINGP( i_ptr->ref_attr ), lb );
- for(idx = i_ptr->ia_arr, i=0; idx[i].key; i++)
- fprintf(fp, "%s\t%s\t%s\t%s\t%s\t%d\t%s\n", li, idx[i].key,
- idx[i].replace == 2 ? "FUNCTION" : idx[i].replace ? "REPLACE" :
- "APPEND", STRINGP( idx[i].attr ), STRINGP( idx[i].host ),
- idx[i].port, STRINGP( idx[i].base ));
- fprintf(fp, le);
- }
- fprintf(fp, le);
-
- fprintf(fp, "%s\nMODIFY%s", hb, he);
- for(m_ptr = glob->modify; m_ptr; m_ptr = m_ptr->next) {
- fprintf(fp, "%s %s\n%s", li, STRINGP( m_ptr->ocs ), lb );
- for(mod_ptr = m_ptr->modattr; mod_ptr; mod_ptr = mod_ptr->next)
- fprintf(fp, "%s\t%s\t%s\t%d\n", li, STRINGP( mod_ptr->attribute ),
- STRINGP( mod_ptr->label ), mod_ptr->count);
- }
- fprintf(fp, le);
-
- fprintf(fp, "%s\nDISPLAY-OBJECT%s", hb, he);
- for(d_ptr = glob->display; d_ptr; d_ptr = d_ptr->next) {
- fprintf(fp, "%s\n\n %s\n%s", li, STRINGP( d_ptr->ocs) , lb );
- fprintf(fp, "%sFIRST-PAGE:\n%s", li, lb);
- for(dis_ptr = d_ptr->first_page; dis_ptr; dis_ptr = dis_ptr->next)
- fprintf(fp, "%s\t%s\t%s\t%s\n", li, STRINGP( dis_ptr->attribute ),
- STRINGP( dis_ptr->label ), STRINGP( dis_ptr->type ));
- fprintf(fp, "%s%sSECOND-PAGE:\n%s", le, li, lb);
- for(dis_ptr = d_ptr->second_page; dis_ptr; dis_ptr = dis_ptr->next)
- fprintf(fp, "%s\t%s\t%s\t%s\n", li, STRINGP( dis_ptr->attribute ),
- STRINGP( dis_ptr->label ), STRINGP( dis_ptr->type ));
- fprintf(fp, "%s%s", le, le);
- }
- fprintf(fp, le);
-}
-/* end of function: output */
-
-PRIVATE void main_loop(fp,glob)
-FILE *fp;
-GLOB_STRUCT *glob;
-{
-FILELINE inLine;
-extern PARSE_ENTRY parse_table[];
-
- while(do_readf(&inLine, fp)){
- parse(&inLine, parse_table, glob, 0);
- }
-}
-/* end of function: main_loop */
-
-PUBLIC int do_readf(inLine, fp)
-FILE *fp;
-FILELINE *inLine;
-{
-static FILE *fo;
-static int lineCount = 0;
-
- if(fp)
- fo = fp;
-
- do {
- char *comment;
-
- if(!fgets(inLine->value, BUFSIZ-1, fo)){
- lineCount = 0;
- return(0);
- }
- lineCount++;
- if( (comment = strchr(inLine->value, '#')) )
- *comment = '\0';
- trim(inLine->value, " \t\n");
- } while(!*inLine->value);
-
- inLine->count = lineCount;
-/* printf("%d: %s\n", inLine->count, inLine->value);
-*/
- return (inLine->count);
-}
-/* end of function: do_readf */
-
-PRIVATE int parse(inLine, p_table, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *p_table;
-GLOB_STRUCT *glob;
-int level;
-{
-int lineCount = inLine->count;
-
- while(1){
- switch(parse2(inLine, p_table, glob, level)){
- case NOTOK:
- printf("Error in init-file line %d:\n%s\n ", inLine->count, inLine->value);
- exit(1);
- case DONE:
- if(lineCount == inLine->count)
- return (DONE);
- else
- lineCount = inLine->count;
- break;
- default:
- return (OK);
- }
- }
-}
-/* end of function: parse */
-
-PRIVATE int parse2(inLine, p_table, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *p_table;
-GLOB_STRUCT *glob;
-int level;
-{
-PARSE_ENTRY *disp;
-char keyWord[BUFSIZ];
-
- sscanf(inLine->value, "%s", keyWord);
- str_toupper( keyWord );
- for(disp=p_table; disp->keyWord; disp++) {
- if(!strcmp(keyWord, disp->keyWord)){
- return ((*disp->keyFunc)(inLine, disp, glob, level));
- }
- }
- return (level?DONE:NOTOK);
-}
-/* end of function: parse2 */
-
-PUBLIC int get_str_param(inLine, str, glob, lower)
-FILELINE *inLine;
-char **str;
-GLOB_STRUCT *glob;
-int lower;
-{
-char tmp[4*BUFSIZ];
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- }else
- if (sscanf(inLine->value, "%*s%s", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- do {
- if(*str) {
- *str = realloc(*str, strlen(*str) + strlen(tmp) +1 );
- strcat(*str, lower ? str_tolower( tmp ) : tmp );
- } else {
- *str = strdup( lower ? str_tolower( tmp ) : tmp );
- }
-
- if(!do_readf(inLine, NULL))
- return (OK);
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- }else
- if (sscanf(inLine->value, "%s", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
-
- return (DONE);
-}
-/* end of function: get_str_param */
-
-PRIVATE int get_int_param(inLine, integer, glob)
-FILELINE *inLine;
-int *integer;
-GLOB_STRUCT *glob;
-{
-char tmp[BUFSIZ];
-
- if (sscanf(inLine->value, "%*s%s", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- *integer = atoi(tmp);
- return (OK);
-}
-/* end of function: get_int_param */
-
-
-PRIVATE int webdn(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->webdn, glob, 0));
-}
-/* end of function: webdn */
-
-PRIVATE int webpw(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->webpw, glob, 0));
-}
-/* end of function: webpw */
-
-PRIVATE int webdn2(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->webdn2, glob, 0));
-}
-/* end of function: webdn2 */
-
-PRIVATE int webpw2(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->webpw2, glob, 0));
-}
-/* end of function: webpw2 */
-
-
-PRIVATE int webport(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_int_param(inLine, &glob->webport, glob));
-}
-/* end of function: webport */
-
-PRIVATE int timeout(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_int_param(inLine, &glob->timeout, glob));
-}
-/* end of function: timeout */
-
-PRIVATE int hostname(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char hostname[BUFSIZ];
-char *virtualport;
-
- if (sscanf(inLine->value, "%*s%s", hostname) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- if( ( virtualport = strchr(hostname, ':')) ) {
- *virtualport++ = '\0';
- glob->virtualport = atoi( virtualport );
- }
- glob->hostname = strdup( hostname );
- return (OK);
-}
-/* end of function: hostname */
-
-PRIVATE int ldapd(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->ldapd, glob, 1));
-}
-/* end of function: ldapd */
-
-PRIVATE int ldapportf(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_int_param(inLine, &glob->ldapport, glob));
-}
-/* end of function: ldapportf */
-
-PRIVATE int etcdir(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->etcdir, glob, 0));
-}
-/* end of function: etcdir */
-
-PRIVATE int filterfilef(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->filterfile, glob, 0));
-}
-/* end of function: filterfile */
-
-PRIVATE int helpfilef(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->helpfile, glob, 0));
-}
-/* end of function: helpfile */
-
-PRIVATE int friendlyfilef(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->friendlyfile, glob, 0));
-}
-/* end of function: friendlyfile */
-
-PRIVATE int index_url(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- char dat_file[BUFSIZ];
- char rereadcycle[BUFSIZ];
-
- if (sscanf(inLine->value, "%*s%s%s", dat_file, rereadcycle) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n",
- glob->acfilename, inLine->count, inLine->value);
-
- glob->index_url = (INDEX_URL *) ch_calloc(1, sizeof(INDEX_URL));
- glob->index_url->dat_file = strdup( dat_file );
- glob->index_url->rereadcycle = atoi(rereadcycle);
-
- get_index_url_rules(glob);
-
- return (OK);
-} /* index_url */
-
-PUBLIC void get_index_url_rules(glob)
-GLOB_STRUCT *glob;
-{
-char index[BUFSIZ];
-char rule[BUFSIZ];
-char dit_dn[BUFSIZ];
-FILE *dfp;
-char inLine[BUFSIZ];
-int idx;
-
- if ( !glob->index_url || !glob->index_url->dat_file )
- return;
- if(!(dfp = fopen(glob->index_url->dat_file, "r")))
- return;
-
- for ( idx = 0; idx < INDEX_RULE_SIZE; idx++ ) {
- free( glob->index_url->rarr[idx].rule );
- free( glob->index_url->rarr[idx].dit_dn );
- }
-
- while(fgets(inLine, BUFSIZ-1, dfp)) {
-
- if(strchr(inLine, '"')) {
- if (sscanf(inLine, "%s%s%*[^\"]\"%[^\"]\"",
- index, rule, dit_dn) < 1)
- syslog (LOG_INFO, "Error in index_url-file");
- } else {
- if (sscanf(inLine, "%s%s%s",
- index, rule, dit_dn) < 1)
- syslog (LOG_INFO, "Error in index_url-file");
- }
- idx = atoi(index);
- if ( idx < 0 || idx >= INDEX_RULE_SIZE )
- continue;
- glob->index_url->rarr[idx].rule = str_tolower( strdup( rule ));
- glob->index_url->rarr[idx].dit_dn = strdup( dit_dn );
- }
- fclose( dfp );
-}
-/* end of function: get_index_url_rules */
-
-PUBLIC void re_read_index_url_rules( glob )
-GLOB_STRUCT *glob;
-{
- static int index_url_rules_reload = 0;
-
- if ( glob->index_url && glob->index_url->rereadcycle && !( ++index_url_rules_reload % glob->index_url->rereadcycle )) {
- get_index_url_rules( glob );
- }
-
-} /* re_read_index_url_rules */
-
-
-PRIVATE int allow_proxy(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char tmp[BUFSIZ];
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- }else
- if (sscanf(inLine->value, "%*s%s", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- glob->allow_proxy = str2charray( str_tolower(tmp), ":");
- return (OK);
-}
-/* end of function: allow_proxy */
-
-PRIVATE int subtree_search(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char tmp[BUFSIZ];
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- }else
- if (sscanf(inLine->value, "%*s%s", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- glob->subtree_search = str2charray( tmp, ":");
- return (OK);
-}
-/* end of function: subtree_search */
-
-PRIVATE int grant(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->grant, glob, 1));
-}
-/* end of function: grant */
-
-PRIVATE int refuse(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->refuse, glob, 1));
-}
-/* end of function: refuse */
-
-PRIVATE int allow_string(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->allow_string, glob, 1));
-}
-/* end of function: allow_string */
-
-PRIVATE int deny_string(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->deny_string, glob, 1));
-}
-/* end of function: deny_string */
-
-
-PRIVATE int show_defoc(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-
- glob->show_defoc = 1;
- return (OK);
-}
-/* end of function: show_defoc */
-
-PRIVATE int max_person(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char tmp[BUFSIZ];
-char tmp2[BUFSIZ];
-char tmp3[BUFSIZ];
-
- if (sscanf(inLine->value, "%*s%s%s%s", tmp, tmp2, tmp3) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- glob->max_person = atoi(tmp);
- glob->strict = (!strcasecmp (tmp2, "strict") || !strcasecmp (tmp3, "strict")) ? TRUE : FALSE;
- glob->no_browse = (!strcasecmp (tmp2, "no-browse") || !strcasecmp (tmp3, "no-browse")) ? TRUE : FALSE;
-
- return (OK);
-}
-/* end of function: max_person */
-
-PRIVATE int comrefuse(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- char tmp[BUFSIZ];
- char tmp2[BUFSIZ];
- char tmp3[BUFSIZ];
- char tmp4[BUFSIZ];
- char tmp5[BUFSIZ];
- char tmp6[BUFSIZ];
-
- if (sscanf(inLine->value, "%*s%s%s%s%s%s%s",
- tmp, tmp2, tmp3, tmp4, tmp5, tmp6) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- comRefuseP = glob->comrefuse =
- (COMREFUSE *) ch_calloc(1, sizeof(COMREFUSE));
- glob->comrefuse->tmin = atoi(tmp);
- glob->comrefuse->tdiff = atoi(tmp2) - glob->comrefuse->tmin;
- glob->comrefuse->maxAccept = atoi(tmp3);
- glob->comrefuse->suspendCycle = -1 * atoi(tmp4);
- glob->comrefuse->statCycle = (time_t) atol (tmp5);
- sprintf (tmp6, "%s.%s-%d", tmp6, glob->lang, (int) getpid());
- glob->comrefuse->statFile = strdup (tmp6);
-
- return (OK);
-}
-/* end of function: comrefuse */
-
-PRIVATE int display(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char tmp[BUFSIZ];
-pDISPLAY *d_ptr;
-
- for(d_ptr = &glob->display; *d_ptr; d_ptr = &(*d_ptr)->next)
- ;
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%*s%s", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- *d_ptr = (pDISPLAY) ch_calloc(1, sizeof(DISPLAY));
- (*d_ptr)->ocs = str_tolower( strdup( tmp ));
- if(strcmp(tmp, "default"))
- glob->default_display_type = *d_ptr;
- if(!do_readf(inLine, NULL))
- return (OK);
- return (parse(inLine,disp->subTable, glob, ++level));
-}
-/* end of function: display */
-
-PRIVATE int basednf(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char dn[BUFSIZ];
-char head[BUFSIZ];
-char foot[BUFSIZ];
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]\"%s%s", dn, head, foot) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%*s%s%s%s", dn, head, foot) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- if ( !strcasecmp( dn, "ROOT" )) *dn = '\0';
- glob->basedn->dn = strdup( dn );
- glob->basedn->dnarray = dn2charray( dn );
- glob->basedn->head = strdup(head);
- glob->basedn->foot = strdup(foot);
- return (OK);
-}
-/* end of function: basednf */
-
-PRIVATE int search_only(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char dn[BUFSIZ];
-char head[BUFSIZ];
-char foot[BUFSIZ];
-pSEARCH_ONLY_LINE *so_ptr;
-
- so_ptr = &glob->search_only;
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]\"%s%s", dn, head, foot) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%*s%s%s%s", dn, head, foot) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- do {
- *so_ptr = (pSEARCH_ONLY_LINE) ch_calloc(1, sizeof(SEARCH_ONLY_LINE));
- (*so_ptr)->dn = str_tolower( strdup( dn ));
- (*so_ptr)->head = strdup(head);
- (*so_ptr)->foot = strdup(foot);
- so_ptr = &(*so_ptr)->next;
- if(!do_readf(inLine, NULL))
- return (OK);
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]\"%s%s", dn, head, foot) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%s%s%s", dn, head, foot) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
- return (DONE);
-}
-/* end of function: search_only */
-
-PRIVATE int dynamic_gw(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-
- glob->gw_switch->dynamic = 1;
- return (OK);
-}
-/* end of function: dynamic_gw */
-
-PRIVATE int caching_terms(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char time[BUFSIZ];
-char access_type[BUFSIZ];
-char rdn_oc[BUFSIZ];
-char pattern[BUFSIZ];
-pCACHING_TERMS_LINE *ca_ptr;
-
- ca_ptr = &glob->caching_terms;
-
- if (sscanf(inLine->value, "%*s%s%s%s%s",
- time, access_type, rdn_oc, pattern) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n",
- glob->acfilename, inLine->count, inLine->value);
- do {
- *ca_ptr = (pCACHING_TERMS_LINE) ch_calloc(1, sizeof(CACHING_TERMS_LINE));
- (*ca_ptr)->time = atoi(time);
- (*ca_ptr)->access_type = str_toupper(strdup(trim (access_type,WSPACE)));
- (*ca_ptr)->rdn_oc = !strncasecmp(rdn_oc, "RDN", 3) ? 1 : 0;
- (*ca_ptr)->pattern = str_tolower(strdup(trim (pattern, WSPACE)));
- ca_ptr = &(*ca_ptr)->next;
- if(!do_readf(inLine, NULL))
- return (OK);
- if (sscanf(inLine->value, "%s%s%s%s",
- time, access_type, rdn_oc, pattern) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n",
- glob->acfilename, inLine->count, inLine->value);
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
- return (DONE);
-}
-/* end of function: caching_terms */
-
-PRIVATE int gw_switch(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char dn[BUFSIZ];
-char url[BUFSIZ];
-pGW_SWITCH_LINE *gw_ptr;
-
- for(gw_ptr = &glob->gw_switch->list; *gw_ptr; gw_ptr = &(*gw_ptr)->next)
- ;
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]\"%[\40-\177]", dn, url) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%*s%s%[\40-\177]", dn, url) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- do {
- *gw_ptr = (pGW_SWITCH_LINE) ch_calloc(1, sizeof(GW_SWITCH_LINE));
- (*gw_ptr)->dn = str_tolower( strdup( dn ));
- (*gw_ptr)->url = strdup(trim (url, WSPACE));
- gw_ptr = &(*gw_ptr)->next;
- if(!do_readf(inLine, NULL))
- return (OK);
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]\"%[\40-\177]", dn, url) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%s%[\40-\177]", dn, url) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
- return (DONE);
-}
-/* end of function: gw_switch */
-
-PRIVATE int table_disp(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- char allow[BUFSIZ];
- char select_oc[BUFSIZ];
- char button_label[BUFSIZ];
- char dn_extension[BUFSIZ];
- pTABLE_DISPLAY *ta_ptr;
-
- for(ta_ptr = &glob->tables; *ta_ptr; ta_ptr = &(*ta_ptr)->next)
- ;
- if (sscanf(inLine->value, "%*s%s%s%s%s", allow, select_oc, button_label, dn_extension) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- do {
- *ta_ptr = (pTABLE_DISPLAY) ch_calloc(1, sizeof(TABLE_DISPLAY));
- (*ta_ptr)->allow = !strcasecmp(allow, "ALLOW") ? 1 : 0;
- (*ta_ptr)->select_oc = str_tolower( strdup( select_oc ));
- (*ta_ptr)->button_label = strdup( button_label );
- (*ta_ptr)->dn_extension = str_tolower( strdup( dn_extension ));
- ta_ptr = &(*ta_ptr)->next;
- if(!do_readf(inLine, NULL))
- return (OK);
- if (sscanf(inLine->value, "%s%s%s%s", allow, select_oc, button_label, dn_extension) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
- return (DONE);
-}
-/* end of function: table_disp */
-
-PRIVATE int modify(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- char tmp[BUFSIZ];
- pMODIF *m_ptr;
-
- sprintf (tmp, "|");
- for(m_ptr = &glob->modify; *m_ptr; m_ptr = &(*m_ptr)->next)
- ;
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*[^\"]\"%[^\"]", tmp+1) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%*s%s", tmp+1) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- *m_ptr = (pMODIF) ch_calloc(1, sizeof(MODIF));
- strcat (tmp, "|");
- (*m_ptr)->ocs = str_tolower (tr1 (strdup(tmp), ' ', '|'));
-
- if(!do_readf(inLine, NULL)) return (NOTOK);
- return (parse(inLine,disp->subTable, glob, ++level));
-}
-/* end of function: modify */
-
-PRIVATE int ind_attrs(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- char tmp[BUFSIZ];
- pIND_ATTRS *i_ptr;
-
- for(i_ptr = &glob->ind_attrs; *i_ptr; i_ptr = &(*i_ptr)->next)
- ;
- if (sscanf(inLine->value, "%*s%s", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- *i_ptr = (pIND_ATTRS) ch_calloc(1, sizeof(IND_ATTRS));
- (*i_ptr)->ref_attr = str_tolower(strdup(tmp));
-
- if(!do_readf(inLine, NULL)) return (NOTOK);
- return (parse(inLine,disp->subTable, glob, ++level));
-}
-/* end of function: ind_attrs */
-
-PRIVATE int cache_expire(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_int_param(inLine, &glob->cache_expire, glob));
-}
-/* end of function: cache_expire */
-
-PRIVATE int maxcount(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_int_param(inLine, &glob->maxcount, glob));
-}
-/* end of function: maxcount */
-
-PRIVATE int language(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char tmp[BUFSIZ];
-int slots = 2, i = 0;
-
- glob->language = (char **) ch_calloc(slots+1, sizeof(char **));
- if (sscanf(inLine->value, "%*s%s", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- do {
- if(i == slots){
- slots *= 2;
- glob->language = (char **) ch_realloc((char *)glob->language, (slots+1)*sizeof(char **));
- }
- glob->language[i++] = strdup(tmp);
- if(!do_readf(inLine, NULL))
- return (OK);
- if (sscanf(inLine->value, "%s", tmp) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
- return (DONE);
-}
-/* end of function: language */
-
-PRIVATE int strict_basedn(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-
- glob->strict_basedn = 1;
- return (OK);
-}
-/* end of function: strict_basedn */
-
-PRIVATE int pull_down_menus(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-
- glob->pull_down_menus = 1;
- return (OK);
-}
-/* end of function: pull_down_menus */
-
-PRIVATE int no_proxy(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-
- glob->no_proxy = 1;
- return (OK);
-}
-/* end of function: no_proxy */
-
-PRIVATE int disp_sea_rdn(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-
- glob->disp_sea_rdn = 1;
- return (OK);
-}
-/* end of function: disp_sea_rdn */
-
-PRIVATE int prefer_ref_uris(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-
- glob->prefer_ref_uris = 1;
- return (OK);
-}
-/* end of function: prefer_ref_uris */
-
-PRIVATE int strip_pin(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-
- return(get_str_param(inLine, &glob->strip_pin, glob, 1));
-}
-/* end of function: strip_pin */
-
-PRIVATE int legal(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char tmp[BUFSIZ];
-
- sscanf(inLine->value, "%*s%s", tmp);
- glob->legal = 1;
- glob->legal_top = tmp && !strcasecmp(tmp, "ON-TOP");
- return (OK);
-}
-/* end of function: legal */
-
-PRIVATE int no_modify(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->no_modify, glob, 1));
-}
-/* end of function: no_modify */
-
-PRIVATE int no_show_rdn(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->no_show_rdn, glob, 1));
-}
-/* end of function: no_show_rdn */
-
-PRIVATE int sort(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- char object_class[BUFSIZ];
- char label[BUFSIZ];
- char priority[BUFSIZ];
- char display_class[BUFSIZ];
- char sort_attr[BUFSIZ];
- pSORT_LINE *s_ptr;
-
- s_ptr = &glob->sort;
- strcpy(sort_attr, "sn");
- strcpy( display_class, "default" );
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*s%s%*[^\"]\"%[^\"]\"%s%s%s", object_class, label, priority, display_class, sort_attr) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- } else
- if (sscanf(inLine->value, "%*s%s%s%s%s%s", object_class, label, priority, display_class, sort_attr) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- do {
- char tmpBuf[BUFSIZ];
-
- *s_ptr = (pSORT_LINE) ch_calloc(1, sizeof(SORT_LINE));
- sprintf (tmpBuf, "|%s|", object_class);
- (*s_ptr)->object_class = str_tolower (strdup(tmpBuf));
- (*s_ptr)->label = strdup(label);
- (*s_ptr)->priority = atoi(priority);
- (*s_ptr)->display_class = str_tolower( strdup( display_class ));
- (*s_ptr)->sort_attr = strdup( str_tolower( sort_attr ));
- s_ptr = &(*s_ptr)->next;
-
- if(!charray_inlist(glob->sort_attribs, sort_attr))
- charray_add(&glob->sort_attribs, sort_attr );
-
- if(!do_readf(inLine, NULL))
- return (OK);
-
- strcpy(sort_attr, "sn");
- strcpy( display_class, "default" );
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%s%*[^\"]\"%[^\"]\"%s%s%s", object_class, label, priority, display_class, sort_attr) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%s%s%s%s%s", object_class, label, priority, display_class, sort_attr) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
-
- return (DONE);
-}
-/* end of function: sort */
-
-PRIVATE int form_button(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- char read_menu[BUFSIZ];
- char object_class[BUFSIZ];
- char method[BUFSIZ];
- char script_url[BUFSIZ];
- char text[BUFSIZ];
- char dn_name[BUFSIZ];
- char form_name[BUFSIZ];
- char button_label[BUFSIZ];
- pFORM_BUTTON *f_ptr;
-
- f_ptr = &glob->form_button;
-/* for(f_ptr = &glob->form_button; (*f_ptr)->next; f_ptr = &(*f_ptr)->next)
- ;
-*/
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*s%s%s%s%s%*[^\"]\"%[^\"]\"%s%s%s", read_menu, object_class, method, script_url, text, dn_name, form_name, button_label) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- } else
- if (sscanf(inLine->value, "%*s%s%s%s%s%s%s%s%s", read_menu, object_class, method, script_url, text, dn_name, form_name, button_label) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- do {
-
- *f_ptr = (pFORM_BUTTON) ch_calloc(1, sizeof(FORM_BUTTON));
- (*f_ptr)->read_menu = strcasecmp(read_menu, "READ") ? 0 : 1;
- (*f_ptr)->object_class = strdup(object_class);
- (*f_ptr)->method = strdup(method);
- (*f_ptr)->script_url = strdup(script_url);
- (*f_ptr)->text = strdup(text);
- (*f_ptr)->dn_name = strdup(dn_name);
- (*f_ptr)->form_name = strdup(form_name);
- (*f_ptr)->button_label = strdup(button_label);
- f_ptr = &(*f_ptr)->next;
-
- if(!do_readf(inLine, NULL))
- return (OK);
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%s%s%s%s%*[^\"]\"%[^\"]\"%s%s%s", read_menu, object_class, method, script_url, text, dn_name, form_name, button_label) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%s%s%s%s%s%s%s%s", read_menu, object_class, method, script_url, text, dn_name, form_name, button_label) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
-
- return (DONE);
-}
-/* end of function: form_button */
-
-PRIVATE int firstPage(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char attribute[BUFSIZ];
-char label[BUFSIZ];
-char type[BUFSIZ];
-pDISPLAY_LINE *dis_ptr;
-pDISPLAY d_ptr;
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*s%s%*[^\"]\"%[^\"]\"%s", attribute, label, type) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%*s%s%s%s", attribute, label, type) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- for(d_ptr = glob->display; d_ptr->next; d_ptr = d_ptr->next)
- ;
- dis_ptr = &d_ptr->first_page;
- do {
- *dis_ptr = (pDISPLAY_LINE) ch_calloc(1, sizeof(DISPLAY_LINE));
- (*dis_ptr)->attribute = str_tolower( strdup( attribute ));
- (*dis_ptr)->label = strdup(label);
- (*dis_ptr)->type = strdup( str_toupper( type ));
- (*dis_ptr)->ty = cnvt_str2int (type, disp_types, "DEFAULT");
- if(!do_readf(inLine, NULL))
- return (OK);
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%s%*[^\"]\"%[^\"]\"%s", attribute, label, type) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%s%s%s", attribute, label, type) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- dis_ptr = &(*dis_ptr)->next;
-
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
-
- return (parse(inLine,disp->subTable, glob, ++level));
-}
-/* end of function: firstPage */
-
-PRIVATE int secondPage(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char attribute[BUFSIZ];
-char label[BUFSIZ];
-char type[BUFSIZ];
-pDISPLAY_LINE *dis_ptr;
-pDISPLAY d_ptr;
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*s%s%*[^\"]\"%[^\"]\"%s", attribute, label, type) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%*s%s%s%s", attribute, label, type) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- for(d_ptr = glob->display; d_ptr->next; d_ptr = d_ptr->next)
- ;
- dis_ptr = &d_ptr->second_page;
- do {
- *dis_ptr = (pDISPLAY_LINE) ch_calloc(1, sizeof(DISPLAY_LINE));
- (*dis_ptr)->attribute = str_tolower( strdup( attribute ));
- (*dis_ptr)->label = strdup(label);
- (*dis_ptr)->type = strdup( str_toupper( type ));
- (*dis_ptr)->ty = cnvt_str2int (type, disp_types, "DEFAULT");
- if(!do_readf(inLine, NULL))
- return (OK);
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%s%*[^\"]\"%[^\"]\"%s", attribute, label, type) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%s%s%s", attribute, label, type) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- dis_ptr = &(*dis_ptr)->next;
-
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
-/*puts("leaving secondpage!");
-*/
-
- return (DONE);
-}
-/* end of function: secondPage */
-
-PRIVATE int modattr(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char attribute[BUFSIZ];
-char label[BUFSIZ];
-char count[BUFSIZ];
-pMODIFY_LINE *mod_ptr;
-pMODIF m_ptr;
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*s%s%*[^\"]\"%[^\"]\"%s", attribute, label, count) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%*s%s%s%s", attribute, label, count) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- for(m_ptr = glob->modify; m_ptr->next; m_ptr = m_ptr->next)
- ;
- mod_ptr = &m_ptr->modattr;
- do {
- *mod_ptr = (pMODIFY_LINE) ch_calloc(1, sizeof(MODIFY_LINE));
- (*mod_ptr)->attribute = str_tolower( strdup( attribute ));
- (*mod_ptr)->label = strdup(label);
- (*mod_ptr)->count = atoi(count);
- if(!do_readf(inLine, NULL))
- return (OK);
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%s%*[^\"]\"%[^\"]\"%s", attribute, label, count) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%s%s%s", attribute, label, count) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- mod_ptr = &(*mod_ptr)->next;
-
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
-/*puts("leaving secondpage!");
-*/
-
- return (DONE);
-}
-/* end of function: modattr */
-
-PRIVATE int ind_attribute(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
-char key[BUFSIZ];
-char replace[BUFSIZ];
-char attribute[BUFSIZ];
-char host[BUFSIZ];
-char port[BUFSIZ];
-char base[BUFSIZ];
-pIND_ATTRS i_ptr;
-IND_ATTR_ARR **idx;
-int i;
-
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%*s%s%s%s%s%s%*[^\"]\"%[^\"]\"", key,
- replace, attribute, host, port, base) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%*s%s%s%s%s%s%s", key, replace, attribute,
- host, port, base) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- for(i_ptr = glob->ind_attrs; i_ptr->next; i_ptr = i_ptr->next)
- ;
-
- idx = &i_ptr->ia_arr;
-
- *idx = (IND_ATTR_ARR *) ch_malloc( 100 * sizeof(IND_ATTR_ARR) );
- i = 0;
-
- do {
- (*idx)[i].key = strdup(key);
- (*idx)[i].replace = !strcasecmp(replace, "function") ? 2 :
- !strcasecmp(replace, "replace") ? 1 : 0;
- (*idx)[i].attr = strdup(attribute);
- (*idx)[i].host = strdup(host);
- (*idx)[i].port = atoi(port);
- (*idx)[i].base = strdup(base);
- (*idx)[++i].key = NULL;
-
- if(!do_readf(inLine, NULL))
- return (OK);
- if(strchr(inLine->value, '"')) {
- if (sscanf(inLine->value, "%s%s%s%s%s%*[^\"]\"%[^\"]\"", key, replace, attribute, host, port, base) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
- } else
- if (sscanf(inLine->value, "%s%s%s%s%s%s", key, replace, attribute, host, port, base) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n", glob->acfilename, inLine->count, inLine->value);
-
- } while(inLine->value[0] == ' ' || inLine->value[0] == '\t');
-
- return (DONE);
-}
-/* end of function: ind_attribute */
-
-
-PUBLIC void langinit(glob)
-GLOB_STRUCT *glob;
-{
- FILE *fp;
- char inLine[BUFSIZ], lCountS[BUFSIZ], phrase[BUFSIZ], file[BUFSIZ];
-
- sprintf( file, "%s.lang.%s", glob->argv0, glob->lang );
- if(!(fp = fopen(file, "r"))) {
- fprintf(stderr, "\n\nATTENTION!!!\n\nCould not open file %s !\n", file);
- exit(0);
- }
- while(fgets(inLine, BUFSIZ-1, fp)) {
-
- /* Comment-sign is accepted in the first column only */
- if(*inLine == '#')
- *inLine = '\0';
- if(*inLine == '\t') {
- strcat(strcat(glob->la[atoi(lCountS)], " "), trim(inLine, " \t\n"));
- continue;
- }
- if(!*(trim(inLine, " \t\n"))) continue;
- sscanf(trim(inLine, " \t\n"), "%s %[^\n]", lCountS, phrase);
- if(*glob->la[atoi(lCountS)])
- fprintf(stderr, "\nWarning: glob->la[%s] existed already with value <%s> and was overwritten with value <%s> !\n\n", lCountS, glob->la[atoi(lCountS)], phrase );
- strcpy(glob->la[atoi(lCountS)], phrase);
- }
-
-}
-/* end of function: langinit */
-
-PUBLIC void langoutput(fp, glob, html_flag)
-FILE *fp;
-GLOB_STRUCT *glob;
-int html_flag;
-{
- int i;
-
- fprintf(fp, "%s\n\n\nLanguage Settings\n\n%s",html_flag ? "<H2>" : "", html_flag ? "</H2>" : "\n");
- for(i=0 ; i<LANG_ARR_SIZE; i++)
- if(*glob->la[i]) fprintf(fp, "%s%d%s\t%s%s", html_flag ? "<H2>" : "", i, html_flag ? "</H2>" : "", glob->la[i], html_flag ? "<br>" : "\n");
-}
-/* end of function: langoutput */
-
-PUBLIC void get_lang(argc, argv, lang)
-int argc;
-char **argv;
-char *lang;
-{
- int i;
-
- for(i=1;i<argc;i++)
- if (strstr(argv[i] , "-L")){
- strcpy(lang, argv[i]+2);
- }
- if(!*lang){
- usage(argv[0]);
- exit(0);
- }
-}
-/* end of function: get_lang */
-
-PRIVATE int header(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->header, glob, 0));
-}
-/* end of function: header */
-
-PRIVATE int footer(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->footer, glob, 0));
-}
-/* end of function: footer */
-
-PRIVATE int allow_msg(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- return(get_str_param(inLine, &glob->allow_msg, glob, 0));
-}
-/* end of function: allow_msg */
-
-PRIVATE int ip_refuse(inLine, disp, glob, level)
-FILELINE *inLine;
-PARSE_ENTRY *disp;
-GLOB_STRUCT *glob;
-int level;
-{
- char dat_file[BUFSIZ];
- char rereadcycle[BUFSIZ];
-
- if (sscanf(inLine->value, "%*s%s%s", dat_file, rereadcycle) < 1)
- fprintf(stderr, "\nWarning: Error in init-file %s, line %d:\n%s\n",
- glob->acfilename, inLine->count, inLine->value);
-
- glob->ip_refuse = (IP_REFUSE *) ch_calloc(1, sizeof(IP_REFUSE));
- glob->ip_refuse->dat_file = strdup( dat_file );
- glob->ip_refuse->rereadcycle = atoi(rereadcycle);
-
- return (OK);
-} /* ip_refuse */
-
-PUBLIC void file_test(filename, etcdir)
-char **filename;
-char *etcdir;
-{
- FILE *fp;
- char newfname[BUFSIZ];
-
- if(*filename){
- if(!(fp = fopen(*filename, "r"))) {
- sprintf(newfname, "%s%s", etcdir, *filename);
- if(!(fp = fopen(newfname, "r"))) {
- sprintf(newfname, "%s.%s", newfname, globP->lang);
- fp = fopen(newfname, "r");
- }
- }
- if(fp) {
- free(*filename);
- *filename = strdup(newfname);
- fclose(fp);
- } else {
- fprintf(stderr, "\n\nCould not open file %s !\n\n",
- *filename);
- }
- }
-}
-/* end of function: file_test */
-
-PRIVATE void f_test(glob)
-GLOB_STRUCT *glob;
-{
- pSEARCH_ONLY_LINE so_ptr;
-
- file_test(&glob->helpfile, glob->etcdir);
- file_test(&glob->filterfile, glob->etcdir);
- file_test(&glob->friendlyfile, glob->etcdir);
- file_test(&glob->header, glob->etcdir);
- file_test(&glob->footer, glob->etcdir);
- file_test(&glob->allow_msg, glob->etcdir);
- if(glob->basedn) {
- file_test(&glob->basedn->head, glob->etcdir);
- file_test(&glob->basedn->foot, glob->etcdir);
- }
- for(so_ptr = glob->search_only; so_ptr; so_ptr = so_ptr->next) {
- file_test(&so_ptr->head, glob->etcdir);
- file_test(&so_ptr->foot, glob->etcdir);
- }
-}
-/* end of function: f_test */
-
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* init.h..... *
-* *
-* Function:..File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* July 21 1995 Z D D V V *
-* Last modification: Z D D V V *
-* May 14 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: init.h,v 1.6 1999/09/10 15:01:17 zrnsk01 Exp $
- *
- */
-
-#ifndef _INIT_
-#define _INIT_
-
-#include <getopt.h>
-#include "strng_exp.h"
-#include "init_exp.h"
-#include "charray_exp.h"
-#include "ch_malloc_exp.h"
-#include "support_exp.h"
-
-#ifdef TUE_TEL
-# include "tueTel_exp.h"
-#endif
-
-#ifdef AMBIXGW
-# include "ambix_exp.h"
-#endif
-
-
-/* Usage-Text */
-#define USAGE "\nUSAGE: %s -Lx[yz..] [-p webport] [-x ldaphost]\
- \n\t\t[-P ldapport] [-b basedn] [-f filterfile] [-l logger] [-d]\n\
- \n\
- A short description of TWEB WWW2X.500-Gateway: \n\n\
- (does not compensate reading the README files\n\
- and the correct configuration)\n\
- \n\
- Options:\n\n\
- -L:\ttells TWEB the numbers of the languages that have to be started,\n\
- \twherewith are also created the language-buttons\n\
- \tExample: tweb -L01 starts TWEB in german und english\n\
- -p:\tnames the port on which the gateway is to be reached\n\
- -x:\tnames the LDAP-Hosts\n\
- -P:\tnames the port of the LDAP-Server\n\
- -b:\tnames the DN where the gateway shall start by default\n\
- -f:\tnames the ldapfilter-file\n\
- -l:\tswitches on logging for example LOCAL3\n\
- -d:\tswitches on debugging (no sub-processes!)\n\
- \n"
-
-
-/* Funktions in the init-module */
-PRIVATE int webdn();
-PRIVATE int webpw();
-PRIVATE int webdn2();
-PRIVATE int webpw2();
-PRIVATE int webport();
-PRIVATE int timeout();
-PRIVATE int ldapd();
-PRIVATE int ldapportf();
-PRIVATE int hostname();
-PRIVATE int header();
-PRIVATE int footer();
-PRIVATE int index_url();
-PRIVATE int allow_msg();
-PRIVATE int helpfilef();
-PRIVATE int filterfilef();
-PRIVATE int etcdir();
-PRIVATE int friendlyfilef();
-PRIVATE int grant();
-PRIVATE int refuse();
-PRIVATE int allow_string();
-PRIVATE int allow_proxy();
-PRIVATE int subtree_search();
-PRIVATE int deny_string();
-PRIVATE int show_defoc();
-PRIVATE int display();
-PRIVATE int basednf();
-PRIVATE int search_only();
-PRIVATE int gw_switch();
-PRIVATE int modify();
-PRIVATE int ind_attrs();
-PRIVATE int ind_attribute();
-PRIVATE int maxcount();
-PRIVATE int cache_expire();
-PRIVATE int max_person();
-PRIVATE int caching_terms();
-PRIVATE int comrefuse();
-PRIVATE int language();
-PRIVATE void f_test();
-PRIVATE void main_loop();
-PRIVATE int strip_pin();
-PRIVATE int prefer_ref_uris();
-PRIVATE int pull_down_menus();
-PRIVATE int no_proxy();
-PRIVATE int disp_sea_rdn();
-PRIVATE int strict_basedn();
-PRIVATE int dynamic_gw();
-PRIVATE int legal();
-PRIVATE int no_show_rdn();
-PRIVATE int no_modify();
-PRIVATE int sort();
-PRIVATE int firstPage();
-PRIVATE int secondPage();
-PRIVATE int modattr();
-PRIVATE void usage();
-PRIVATE int parse();
-PRIVATE int parse2();
-PRIVATE int table_disp();
-PRIVATE int form_button();
-PRIVATE int ip_refuse();
-
-
-/* Sub-tables to analyse the DISPLAY-Keys */
-static PARSE_ENTRY first_table[] = {
- {"SECOND-PAGE", secondPage, NULL},
- { NULL, NULL, NULL }
-};
-
-static PARSE_ENTRY display_table[] = {
- {"FIRST-PAGE", firstPage, first_table},
- { NULL, NULL, NULL }
-};
-
-
-/* Sub-tables to analyse the MODIFY-Keys */
-static PARSE_ENTRY modify_table[] = {
- {"MODATTR", modattr, NULL},
- { NULL, NULL, NULL }
-};
-
-/* Sub-tables to analyse the IND_ATTRS-Keys */
-static PARSE_ENTRY ind_attrs_table[] = {
- {"IND_ATTRS", ind_attribute, NULL},
- { NULL, NULL, NULL }
-};
-
-
-/* The main-table for key-word-parsing */
-static PARSE_ENTRY parse_table[] = {
- {"WEBDN", webdn, NULL},
- {"WEBPW", webpw, NULL},
- {"WEBDN2", webdn2, NULL},
- {"WEBPW2", webpw2, NULL},
- {"WEBPORT", webport, NULL},
- {"TIMEOUT", timeout, NULL},
- {"TWEBHOST", hostname, NULL},
- {"LDAPD", ldapd, NULL},
- {"LDAPPORT", ldapportf, NULL},
- {"HEADER", header, NULL},
- {"FOOTER", footer, NULL},
- {"INDEX-URL", index_url, NULL},
- {"ALLOW-MSG", allow_msg, NULL},
- {"HELPFILE", helpfilef, NULL},
- {"FILTERFILE", filterfilef, NULL},
- {"ETCDIR", etcdir, NULL},
- {"FRIENDLYFILE", friendlyfilef, NULL},
- {"GRANT", grant, NULL},
- {"REFUSE", refuse, NULL},
- {"ALLOW-STRING", allow_string, NULL},
- {"ALLOW-PROXY", allow_proxy, NULL},
- {"SUBTREE-SEARCH", subtree_search, NULL},
- {"DENY-STRING", deny_string, NULL},
- {"SHOW-DEFAULT-OC", show_defoc, NULL},
- {"DISPLAY-OBJECT" , display, display_table},
- {"BASEDN", basednf, NULL},
- {"SEARCH-ONLY", search_only, NULL},
- {"GW-SWITCH", gw_switch, NULL},
- {"MODIFY", modify, modify_table},
- {"INDIRECT-ATTRS", ind_attrs, ind_attrs_table},
- {"MAXCOUNT", maxcount, NULL},
- {"CACHE-EXPIRE-DEFAULT", cache_expire, NULL},
- {"MAX-PERSON", max_person, NULL},
- {"CACHING-TERMS", caching_terms, NULL},
- {"COMREFUSE", comrefuse, NULL},
- {"LANGUAGE", language, NULL},
- {"STRIP-PIN", strip_pin, NULL},
- {"PREFER-REF-URIS", prefer_ref_uris, NULL},
- {"PULL-DOWN-MENUS", pull_down_menus, NULL},
- {"NO-PROXY", no_proxy, NULL},
- {"DISP-SEA-RDN", disp_sea_rdn, NULL},
- {"STRICT-BASEDN", strict_basedn, NULL},
- {"DYNAMIC-GW", dynamic_gw, NULL},
- {"LEGAL", legal, NULL},
- {"NO-SHOW-RDN", no_show_rdn, NULL},
- {"NO-MODIFY", no_modify, NULL},
- {"SORT", sort, NULL},
- {"TABLES", table_disp, NULL},
- {"FORM-BUTTON", form_button, NULL},
-
-#ifdef AMBIXGW
- {"SELBSTEINTRAG", selbsteintrag, NULL},
-#endif
-
-#ifdef TUE_TEL
- {"DIT-CONFIG", dit_config, NULL},
- {"PHONEWORLD", phoneworld, NULL},
- {"TON-URLS", ton_urls, NULL},
-#endif
- {"IP-REFUSE", ip_refuse, NULL},
-
- { NULL, NULL, NULL }
-};
-
-
-/* tables to compute DISPLAY-types to integer */
-STRDISP disp_types[] = {
-
- { "DEFAULT", 3, 0 },
- { "MAILTO", 4, 6 },
- { "MULTILINE", 5, 1 },
- { "JPEG", 4, 9 },
- { "JPEG2GIF", 8, 10 },
- { "BMP", 3, 8 },
- { "HREF", 4, 2 },
- { "URL", 3, 5 },
- { "FINGER", 6, 3 },
- { "DATE", 4, 4 },
- { "MOVETO", 4, 7 },
- { "BOOLEAN", 9, 11 },
- { "URI", 3, 12 },
- { "PGPKEY", 6, 13 },
- { "INDEXURL", 8, 14 },
- { "DYNAMICDN", 9, 15 },
- { "REFERRAL", 8, 20 },
- { "PRE", 3, 21 },
- { "HEADER", 6, 22 },
-
-#ifdef TUE_TEL
- { "PHONREFSHORT", 12, 16 },
- { "PHONREFLONG", 11, 17 },
- { "TFUNCPERS", 9, 18 },
- { "FAXTABLE", 8, 19 },
-#endif
-
- { NULL, 0, 0 }
-
-};
-
-/* tables to compute syslog-options to integer */
-static STRDISP syslog_types[] = {
-
- { "LOCAL0", 6, LOG_LOCAL0 },
- { "LOCAL1", 6, LOG_LOCAL1 },
- { "LOCAL2", 6, LOG_LOCAL2 },
- { "LOCAL3", 6, LOG_LOCAL3 },
- { "LOCAL4", 6, LOG_LOCAL4 },
- { "LOCAL5", 6, LOG_LOCAL5 },
- { "LOCAL6", 6, LOG_LOCAL6 },
- { "LOCAL7", 6, LOG_LOCAL7 },
- { NULL, 0, 0 }
-
-};
-
-
-/* Defaults */
-#define DEFAULT_TIMEOUT 120
-#define DEFAULT_MAXCOUNT 200
-#define MAX_EXPIRE 604800
-
-
-/* Variable for the Anti-Hack-Code */
-extern COMREFUSE *comRefuseP;
-
-struct timeval timestore[5]; /* Time assigned to events:
- 0 -> after accept, 1-> after dns,
- 2 -> after check4access,
- 3 -> before list_output/print_attr */
-
-int items_displayed = 0; /* number of items showed on
- do_menu/do_search*/
-
-#endif /* _INIT_ */
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* init_exp.h. *
-* *
-* Function:..File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* July 21 1995 Z D D V V *
-* Last modification: Z D D V V *
-* May 11 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-/*
- * $Id: init_exp.h,v 1.6 1999/09/10 15:01:17 zrnsk01 Exp $
- *
- */
-
-
-#ifndef _INIT_EXP_
-#define _INIT_EXP_
-
-#ifdef TUE_TEL
-# include "tueTel_exp.h"
-#endif
-
-#include "regular_exp.h"
-
-PUBLIC int get_str_param(/* FILELINE *inLine, char **str,
- GLOB_STRUCT *glob, int lower */);
-
-PUBLIC void getopts ();
-PUBLIC void check ();
-PUBLIC void init();
-PUBLIC void output();
-PUBLIC void langinit();
-PUBLIC void langoutput();
-PUBLIC void get_lang();
-PUBLIC void file_test();
-PUBLIC int do_readf();
-PUBLIC void get_index_url_rules();
-PUBLIC void re_read_index_url_rules();
-
-extern STRDISP disp_types[];
-
-
-/* A pointer to an integer-function */
-typedef int (*IFP)();
-
-
-/* One line in the config-file, with line-counter */
-typedef struct _fileline {
- char value[BUFSIZ];
- int count;
-} FILELINE;
-
-
-/* Table-structure to parse the key-words in the config- und rc-files */
-typedef struct _parse_keys {
- char *keyWord;
- IFP keyFunc;
- struct _parse_keys *subTable;
-} PARSE_ENTRY;
-
-
-/* Maximum number of sub-lists in order to display result-lists */
-#define MAX_OCS 128
-
-/* List of attributes which will be displayed (on 1./2. page) */
-typedef struct _display_line {
- char *attribute; /* the X.500-Attribute */
- char *label; /* the Label of the Web-Page */
- char *type; /* the Format-Type as String (C-Option) */
- int ty; /* the Format-Type as Int (print-Funkt.) */
- struct _display_line *next; /* the next Attribute */
-} DISPLAY_LINE, *pDISPLAY_LINE;
-
-
-/* List of Object-Classes which shall be displayed */
-typedef struct _display {
- char *ocs; /* the X.500-Object-Class(es) */
- DISPLAY_LINE *first_page; /* Attribute on the first page */
- DISPLAY_LINE *second_page; /* Attribute on the second page */
- struct _display *next; /* the next Objekt-Class(es) */
-} DISPLAY, *pDISPLAY;
-
-
-/* List of attributes which may be modified */
-typedef struct _modify_line {
- char *attribute; /* the X.500-attribute */
- char *label; /* the Label in the modification-formulare */
- int count; /* the maximmum number of attribute-values */
- struct _modify_line *next; /* the next attribute */
-} MODIFY_LINE, *pMODIFY_LINE;
-
-/* List of Object-Class(es) which may be modified */
-typedef struct _modify {
- char *ocs; /* the X.500-Object-Class(es) */
- MODIFY_LINE *modattr; /* the modifyable attributes */
- struct _modify *next; /* the next Object-Class(es) */
-} MODIF, *pMODIF;
-
-/*attributes which are read from another entry */
-typedef struct _ind_attr_arr {
- char *key; /* pers for person etc. */
- int replace; /* 2 -> function, 1 -> replace, 0 -> append */
- char *attr; /* functionname / referenced attribute */
- char *host; /* on which host to look */
- int port; /* on which port to look */
- char *base; /* where to look for ref-entry */
- LDAPMessage **e; /* Pointer to the result */
- LDAP *ld; /* Pointer to the matching LDAP-Struct */
-} IND_ATTR_ARR;
-
-typedef struct _ind_attrs {
- char *ref_attr; /* name of the reference-attribute */
- IND_ATTR_ARR *valid_nodes; /* valid nodes array (only in 1st element) */
- IND_ATTR_ARR *ia_arr; /* supported keys, attrs and bases */
- struct _ind_attrs *next; /* the next ind_attr */
-} IND_ATTRS, *pIND_ATTRS;
-
-
-/* Support-structure to sort the result-lists */
-typedef struct _dncompare {
- char *string; /* Sort-String */
- char *href; /* Hyper-Link for the sorted entry */
- char *raw; /* Raw data: -> <name>[<attr>=<value>&..%..$.. */
-} DNLIST, *pDNLIST;
-
-
-/* Structure to sort the result-lists object-class/attribute-related */
-typedef struct _sort_line {
- char *object_class; /* Object-class by which is sorted */
- char *label; /* Label to display sub-lists */
- int priority; /* Sequence for list-output */
- char *display_class; /* dedicated display-class */
- DISPLAY *display_class_ptr; /* Pointer therefor */
- char *sort_attr; /* Attribut by which sorting is done */
- pDNLIST *dnList; /* Entries in the sub-list */
- int dnLast; /* Amount of entries in the sub-list */
- int restricted; /* 1 -> sub-list was restricted : 0 -> not*/
- struct _sort_line *next; /* the next Object-Class */
-} SORT_LINE, *pSORT_LINE;
-
-/* Structure to handle caching */
-
-typedef struct _caching_terms_line {
- int time; /* time to cache */
- char *access_type; /* type of access */
- int rdn_oc; /* 1 -> rdn, 0 -> oc -lookup */
- char *pattern; /* mach-pattern: oc/rdn */
- struct _caching_terms_line *next; /* the next line */
-} CACHING_TERMS_LINE, *pCACHING_TERMS_LINE;
-
-
-/* DN of the TWEB-Homepage, including header and footer thereof */
-typedef struct _basedn_line {
- char *dn;
- char **dnarray;
- char *head;
- char *foot;
-} BASEDN_LINE;
-
-/* List of rules for table-button and table display */
-typedef struct _table_display {
- int allow; /* 1 -> tables only if allowed, 0 -> in any case */
- char *select_oc; /* table-button only if
- objectclass contains select_oc */
- char *button_label; /* label for table-request-button */
- char *dn_extension; /* extension behind button Xdn?MENU */
- struct _table_display *next;
-} TABLE_DISPLAY, *pTABLE_DISPLAY;
-
-/* List of organisational units where only searching is permitted,
- including header and footer thereof */
-typedef struct _search_only_line {
- char *dn;
- char *head;
- char *foot;
- struct _search_only_line *next;
-} SEARCH_ONLY_LINE, *pSEARCH_ONLY_LINE;
-
-/* Anti-Hack Structure */
-typedef struct _comrefuse {
- int tmin;
- int tdiff;
- int maxAccept;
- int suspendCycle;
- time_t statCycle;
- char *statFile;
-} COMREFUSE;
-
-
-/* static list of Gateway-Switches */
-typedef struct _gw_switch_line {
- char *dn; /* the DN of the organization(al unit) */
- char *url; /* the URL of the gateway to be called */
- struct _gw_switch_line *next; /* the next Gateway-Switch */
-} GW_SWITCH_LINE, *pGW_SWITCH_LINE;
-
-/* the head of the Gateway-Switch-list */
-typedef struct _gw_switch {
- int dynamic; /* is dynamic switching allowed */
- char *lagws; /* language dependant recognition of
- GW-Switch-entries in X.500
- (language independant recognition is
- implemented by macro) */
- GW_SWITCH_LINE *list; /* the static list of switches */
-} GW_SWITCH, *pGW_SWITCH;
-
-/* static list of already available ldap-connections */
-typedef struct _ld_list {
- LDAP *ld; /* pointer to the ldap-structure */
- char *host; /* The corresponding host */
- int port; /* The corresponding port */
- struct _ld_list *next; /* the next */
-} LD_LIST, *pLD_LIST;
-
-typedef struct _index_url_rule {
- char *rule; /* Atribute providing data */
- char *dit_dn; /* DN supporting config */
-} INDEX_URL_RULE;
-
-typedef struct _index_url {
- char *dat_file; /* File providing data */
-#define INDEX_RULE_SIZE 20
- INDEX_URL_RULE rarr[INDEX_RULE_SIZE]; /* array with rules */
- int rereadcycle; /* frequency to reread */
-} INDEX_URL;
-
-/* Structure to hold config of buttons leading to form-scripts */
-typedef struct _form_button {
- int read_menu; /* 1-> button in do_read; 0-> in do_menu */
- char *object_class; /* display the button on presence of this
- object-class*/
- char *method; /* cgi method: GET .. */
- char *script_url; /* URL of CGI-Script */
- char *text; /* text in front of button */
- char *dn_name; /* name of dn in hidden form */
- char *form_name; /* name of form (submit-button) */
- char *button_label; /* label of submit-button */
- struct _form_button *next; /* the next FORM_BUTTON definition */
-} FORM_BUTTON, *pFORM_BUTTON;
-
-typedef struct _ip_refuse {
- char *dat_file; /* File providing data */
- char *refu_str; /* String of refused clients */
-#define REFU_BUFSIZ 256
-#define REFU_STRDELIM "&"
-
- int rereadcycle; /* frequency to reread */
-} IP_REFUSE;
-
-/* the central structure of TWEB with the configuration of the gateway */
-typedef struct _glob_struct {
- char *webdn; /* GW-DN in case of authorisded access */
- char *webpw; /* GW-PW in case of authorisded access */
- char *webdn2; /* GW-DN in case of non-authorisded access */
- char *webpw2; /* GW-PW in case of non-authorisded access */
- int webport; /* the Port the GW is listening on */
- int timeout; /* how long does the gateway wait for the DSA*/
- time_t stat_slice; /* Time for the anti-Hack + Statistic */
- char *ldapd; /* the computer LDAPD is running on */
- int ldapport; /* the Port thereof */
- char *grant; /* ':'-separated list of domains with access */
- char *refuse; /* ':'-separated list of domains
- without access */
- char *allow_string; /* ':'-separated list of domains
- supported with authorised access */
- char *deny_string; /* ':'-separated list of domains
- supported with restricted access */
- regexp *comp_grant; /* compiled regular expressions for GRANT */
- regexp *comp_refuse; /* compiled regular expressions for REFUSE */
- regexp *comp_allow; /* compiled regular expressions for ALLOW_ST */
- regexp *comp_deny; /* compiled regular expressions for DENY_ST. */
- char **allow_proxy; /* ':'-separated list of proxy-servers
- supported with authorised access */
- char **subtree_search; /* ':'-separated list of objectclasses
- where to make subtree_search instead of
- single_level_search */
- DISPLAY *display; /* presentation of Objects */
- DISPLAY *default_display_type; /* pointer to the default display descript */
- BASEDN_LINE *basedn; /* the entry-page of TWEB */
- SEARCH_ONLY_LINE *search_only; /* where only searching is supported */
- GW_SWITCH *gw_switch; /* the Gateway-Switching */
- MODIF *modify; /* what may be modified within TWEB */
- IND_ATTRS *ind_attrs; /*attributes which are read from
- another entry */
- int cache_expire; /* caching-time for proxies in seconds */
- CACHING_TERMS_LINE *caching_terms; /* cache-control-rules */
- int maxcount; /* maximum amount of result-lists */
- int max_person; /* maximum amount of persons displayed */
- COMREFUSE *comrefuse; /* Anti-Hack Structure */
- TABLE_DISPLAY *tables; /* listings also as tables by button-request */
- INDEX_URL *index_url; /* how to display search-results of index
- -> display-type INDEX-URL */
- FORM_BUTTON *form_button; /* display buttons leading to forms */
- char *tables_marker; /* flag for menu with tables += their config */
- char **language; /* the language links on a html-page */
- char lang[2]; /* the number of the "own" language */
- char *olang; /* the other languages */
- char *no_show_rdn; /* String with "unvisible" DN parts */
- char *no_modify; /* Objectclasses without MODIFY-button */
- SORT_LINE *sort; /* how shall the results be sorted */
- SORT_LINE *sorty[MAX_OCS]; /* Array with the sorted lists */
- char **sort_attribs; /* Array with the sort-attributes */
- char *myname; /* the programname */
- char *argv0; /* ARGV[0] */
- char *hostname; /* the name of the computer TWEB
- is running on*/
- int virtualport; /* port if defined is set in every link
- instead of webport (may always
- lead requests over www4ward) */
- char *header; /* the header for the standardpage */
- char *footer; /* the footer for the standardpage */
- char *allow_msg; /* file containing allow-message */
- char *helpfile; /* the helpfile */
- char *filterfile; /* the filterfile for LDAP-search */
- char *etcdir; /* the directory containing the supportfiles */
- char *friendlyfile; /* the file for "more friendly" DNs */
- char *acfilename; /* the name of the actual config-file */
- time_t nowtime; /* actual time in tics */
- time_t expiretime; /* time for cache to expire in tics */
- char *nowtimestr; /* actual timestring in GMT */
- char *strip_pin; /* truncation of PINs at named sort_ocs */
- char *expiretimestr; /* timestring for cache to expire in GMT */
- char *server_connection_msg; /* TCP Connection-message */
- char *user_agent_msg; /* User-Agent message */
- char *menu_filter; /* menu_filter */
-#define LANG_ARR_SIZE 110
- char la[LANG_ARR_SIZE][BUFSIZ]; /* language-specific text-fragments */
- LD_LIST *ld_list; /* List of open LDAP-Connections */
- char **raw_attrs; /* Attributes to be shown with raw_access */
- size_t svc_cnt; /* A counter for the number of requests */
-
-#ifdef TUE_TEL
- DIT_CONFIG *dit_config; /* container for relations between DNs and
- responsible host:port */
- TON_URLS *ton_urls; /* TONs in addition to DNs */
- char *phoneworld; /* visibility of phonebook */
-#endif
- IP_REFUSE *ip_refuse; /* refuse certain hosts by ip-addr */
-
-#ifdef AMBIXGW
- char *selbsteintrag[10]; /* some strings for AMBIX-selfentry */
-#endif
-
- unsigned show_defoc : 1, /* respect unknown OCs while sorting */
- strict : 1, /* restriction of person-lists also in the
- authorised case */
- restricted : 1, /* hard restriction of the extent of the list*/
- persRestricted : 1, /* restriction of person-lists (legal) */
- prefer_ref_uris : 1, /* take over labeledURIS from
- referenced objects */
- is_proxy : 1, /* did the request come from a proxy-server */
- pull_down_menus : 1, /* move upwards with pull-down-menus */
- no_proxy : 1, /* no local proxy-servers */
- strict_basedn : 1, /* no access outside BASEDN */
- no_browse : 1, /* no person-lists while browsing */
- noauth : 1, /* dynamic flag for question of authorisation*/
- caching : 1, /* shall be cached by proxy-server */
- legal : 1, /* display privacy-text */
- legal_top : 1, /* display privacy-text on top */
- unknown_host : 1, /* connection from unknown */
- allowed : 1; /* access allowed for decide_access */
- unsigned raw_data : 1, /* provide raw-data instead of html */
- ldap_referral_mode : 1, /* TWEB displayes foreign ldap-url */
- disp_sea_rdn : 1; /* display only rdns as search-result */
-} GLOB_STRUCT, *pGLOB_STRUCT;
-
-
-/* the function the gateway is initialized with */
-void init();
-
-#endif /* _INIT_EXP_ */
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* queries.c.. *
-* *
-* Function:..WorldWideWeb-X.500-Gateway - Server-Functions *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* September 13 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: queries.c,v 1.8 1999/09/13 13:47:47 zrnsk01 Exp $
- *
- */
-
-#include "queries.h"
-
-
-PUBLIC void do_queries( s, glob , ip_addr, ip_port, hp)
-int s;
-GLOB_STRUCT *glob;
-char *ip_addr;
-unsigned int ip_port;
-struct hostent *hp;
-{
- char buf[100*BUFSIZ], *query, *tail;
- int len;
- FILE *fp;
- int rc, tblsize;
- struct timeval timeout;
- fd_set readfds;
- LDAP *ld;
- char tstring[100];
-
-#if OL_LDAPV > 0
- int ldap_opt;
-#endif
-
- /* get time for performance log */
- gettimeofday(×tore[2], NULL);
-
- /* open output-port to waiting client */
- if ( (fp = fdopen( s, "a+")) == NULL ) {
- perror( "fdopen" );
- exit_tweb( 1 );
- }
-
- tblsize = getdtablesize();
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
- FD_ZERO( &readfds );
- FD_SET( fileno( fp ), &readfds );
-
- time(&glob->nowtime);
- time(&glob->expiretime);
- if(glob->cache_expire) {
- glob->expiretime += glob->cache_expire;
- glob->caching =TRUE;
- }
- free(glob->nowtimestr);
- free(glob->expiretimestr);
-
- strftime(tstring, 99, GMT_FORMAT, gmtime(&glob->nowtime));
- glob->nowtimestr = strdup(tstring);
- strftime(tstring, 99, GMT_FORMAT2, gmtime(&glob->expiretime));
- glob->expiretimestr = strdup(tstring);
-
- /* get client-query out from the system */
- if((rc=select(tblsize,(fd_set *)&readfds,NULL,NULL,&timeout))<=0)
- exit_tweb( 1 );
-
- if ( fgets( buf, sizeof(buf), fp ) == NULL )
- exit_tweb( 1 );
-
- /* Analyse Web-Client-Type / proxy + log-message */
- checkwwwclient(fp, ip_addr, ip_port, hp, glob);
-
- len = strlen( buf );
- if ( debug ) {
- fprintf( stderr, "got %d bytes\n", len );
-
-#if OL_LDAPV > 2
- ber_bprint( buf, len );
-#else
- lber_bprint( buf, len );
-#endif
-
- }
-
- /* strip of white spaces */
- query = trim (buf, WSPACE);
-
- rewind (fp);
-
-
- /* strip "HTTP" from the end of the request */
- if ((tail = strstr(query, " HTTP")) != NULL ||
- (tail = strstr(query, " http")) != NULL) {
- http = 1;
- *tail = '\0';
- }
-
- /* recognize GET/HEAD */
- if (!strncasecmp (query, "get", 3)) {
-
- request = GET;
- query += 3;
-
- } else if (!strncasecmp (query, "head", 4)) {
-
- request = HEAD;
- query += 4;
-
- } else {
-
- /* Error because of neither GET- nor HEAD-request */
- do_error(fp, -2, NOT_IMPLEMENTED, glob);
- /* fprintf(fp, "HTTP/1.0 501 %s<br>", glob->la[5]); */
- rewind(fp);
- exit_tweb( 1 );
- }
-
- /* strip off leading white space and '/' */
- while ( isspace( *query ) || *query == '/') {
- ++query;
- }
-
-
- /* Now the real request is to be analized and served */
-
- /* refuse robots if according robots.txt file exists */
-
- if (!strcasecmp(query, "robots.txt")){
- if (http == 1) PRINT_PLAIN_HEADER;
- disp_file(glob, ROBOTS_TXT_FILE, fp);
- exit_tweb(0);
- }
-
-#ifdef TUE_TEL
- if( glob->ton_urls && *query == cTON) {
- if(!glob->ton_urls->admin)
- glob->allowed = 0;
- if(glob->ton_urls->pass_oc) {
- glob->max_person = 10000;
- glob->no_browse = FALSE;
- }
- }
-#endif
-
- decide_access(glob);
-
- /* get time for performance log */
- gettimeofday(×tore[3], NULL);
-
- /* perform handling of pulldown/form retcodes
- -> gwswitch-redirect || pass */
- if(*query == cPULLDOWN) {
- if(strstr(query, "http")) {
- /* redirection */
- query += 4;
- hex_decode(query);
- PRINT_REDIRECT_HEADER;
- PRINT_HTML_FOOTER;
- exit_tweb(0);
- } else {
- /* pass */
- query += 7;
- hex_decode(query);
- }
- }
-
- /* perform handling of buttons/form retcodes
- -> gwswitch-redirect || pass */
- if(*query == cBUTTON) {
- char *strptr;
-
- query += 2;
- strptr = strrchr( query, '=' );
- *strptr = '\0';
-
- if(strstr(query, "http")) {
- /* redirection */
- hex_decode(query);
- PRINT_REDIRECT_HEADER;
- PRINT_HTML_FOOTER;
- exit_tweb(0);
- } else {
- /* pass */
- hex_decode(query);
- }
- }
-
-
- /* 1. requests that may be served without DSA */
- switch (*query) {
-
-
- /* display Help-File */
- case cHELP:
- if (dosyslog)
- syslog (LOG_INFO, "working on query: %c (%s,%u) <%08d>",
- cHELP, ip_addr, ip_port, glob->svc_cnt);
- if (http == 1) PRINT_HTML_HEADER;
- fprintf(fp, "<HTML><HEAD>");
- disp_file(glob, glob->helpfile, fp);
- PRINT_HTML_FOOTER;
- rewind(fp);
- exit_tweb( 0 );
-
- /* request error-explanation */
- case cERROR:
- if (dosyslog)
- syslog (LOG_INFO, "working on query: %c (%s,%u) <%08d>",
- cERROR, ip_addr, ip_port, glob->svc_cnt);
-/* fprintf(fp, HTML_HEAD_TITLE, "Errors", glob->la[100]);
-*/
- do_error( fp, 0 , 1, glob );
- rewind(fp);
- exit_tweb( 0 );
-
- /* RCC: remote configuration control */
- case cCONFIG:
- if (dosyslog)
- syslog (LOG_INFO, "working on query: %c (%s,%u) <%08d>",
- cCONFIG, ip_addr, ip_port, glob->svc_cnt);
- if (http == 1) PRINT_HTML_HEADER;
- fprintf(fp, HTML_HEAD_TITLE, "Configuration", glob->la[100]);
- output(fp, glob, TRUE);
- langoutput(fp, glob, TRUE);
- PRINT_HTML_FOOTER;
- rewind(fp);
- exit_tweb(0);
-
- /* query access-statistic */
- case cSTATS:
- if (dosyslog)
- syslog (LOG_INFO, "working on query: %c (%s,%u) <%08d>",
- cSTATS, ip_addr, ip_port, glob->svc_cnt);
- if (http == 1) PRINT_HTML_HEADER;
- fprintf(fp, HTML_HEAD_TITLE, "Statistics", glob->la[100]);
- fprintf(fp,
- "\n<strong>#############STATISTIC-DISPLAY#############</strong><br>\n" );
- fprintf( fp, "\n%s\n\n<p>\n", version );
- (void) put_hackStats (fp, 0);
- PRINT_HTML_FOOTER;
- rewind (fp);
- exit_tweb (0);
-
- /* NOT REACHED */
- }
-
- /* with ldap-referral use this host + port + use do_read */
- /* query looks like this: Wldap://host:port/dn */
- if ( *query == cREFERRAL ) {
- char *host, *port, *dn = NULL;
-
- glob->ldap_referral_mode = 1;
- if ( ( host = strstr( query, "ldap://" ) ) ) {
- host += 7;
- if ( ( port = strchr( host, ':' ) ) ) {
- *port++ = '\0';
- if ( ( dn = strchr( port, '/' ) ) ) {
- *dn = '\0';
- glob->ldapd = strdup ( host );
- glob->ldapport = atoi ( port );
- *dn = cREAD;
- query = dn;
- }
- }
- }
- if ( !dn )
- exit_tweb( 1 );
- }
-
- /* from here on there is needed a connection to the DSA */
- if ( (ld = ldap_open( glob->ldapd, glob->ldapport )) == NULL ) {
- if ( debug ) perror( "ldap_open" );
- do_error( fp, LDAP_SERVER_DOWN, SERVER_ERROR, glob);
- rewind(fp);
- exit_tweb( 1 );
- }
-
- if(glob->caching_terms)
- trade_cache(fp, ld, query, glob);
-
- /* performance of STRICT-BASEDN (blind out accesses != BASEDN) */
-
- if(glob->strict_basedn)
- strict_basednf(fp, ld, query, glob);
-
-
- /* 2. queries with binding of the owner */
- switch (*query) {
-
- /* request of the modification-formulare */
- case cGETMOD:
- /* log the request without password */
- hex_decode(query);
- if (dosyslog) {
- char qbuf[BUFSIZ], *qbufp;
-
- strcpy(qbuf, query);
- if( ( qbufp = strchr(qbuf, '?')) )
- *qbufp = '\0';
- syslog (LOG_INFO, "working on query: %s (%s,%u) <%08d>",
- qbuf, ip_addr, ip_port, glob->svc_cnt);
- }
- rewind(fp);
-
- /* follow aliases while searching */
-#if OL_LDAPV > 0
-
- ldap_opt = LDAP_DEREF_ALWAYS;
- ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
-
-#else
- ld->ld_deref = LDAP_DEREF_ALWAYS;
-#endif
-
- if ( !searchaliases )
-#if OL_LDAPV > 0
-
- ldap_opt = LDAP_DEREF_FINDING;
- ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
-
-#else
- ld->ld_deref = LDAP_DEREF_FINDING;
-#endif
-
- /* send WWW-Formulare with contence of the desired entry
- to the client */
- do_form( ld, fp, ++query, glob);
- ldap_unbind (ld);
- close_ldap_connections(glob);
- rewind(fp);
- exit_tweb (0);
-
- /* return of the modification-formulare */
- case cDOMOD:
-
- /* log the request in readable form without password if desired */
- if (dosyslog) {
-
- char qbuf[100*BUFSIZ], *qbufp;
-
- strcpy(qbuf, query);
- if( ( qbufp = strchr (qbuf, '?')) )
- *qbufp = '\0';
- hex_decode(qbuf+1);
- syslog (LOG_INFO, "working on query: %s (%s,%u) <%08d>",
- qbuf, ip_addr, ip_port, glob->svc_cnt);
-
- }
-
- /* perform modification with the original request */
- do_modify( ld, fp, ++query, glob);
- ldap_unbind (ld);
- close_ldap_connections(glob);
- rewind(fp);
- exit_tweb (0);
-
- /* NOT REACHED */
- }
-
-
- /* perform all the other requests */
-
- /* log the request in readable form first */
- hex_decode(query);
- if (dosyslog)
- syslog (LOG_INFO, "working on query: %s (%s,%u) <%08d>",
- *query ? trimright(query, WSPACE) : "BASEDN", ip_addr, ip_port,
- glob->svc_cnt);
-
- /* accesses with resolvation of alias-entries */
-#if OL_LDAPV > 0
-
- ldap_opt = LDAP_DEREF_ALWAYS;
- ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
-
-#else
- ld->ld_deref = LDAP_DEREF_ALWAYS;
-#endif
-
- if ( !searchaliases )
-#if OL_LDAPV > 0
-
- ldap_opt = LDAP_DEREF_FINDING;
- ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
-
-#else
- ld->ld_deref = LDAP_DEREF_FINDING;
-#endif
-
- /* bind to DSA by order of the user as Web-DN
- (DN1 or DN2 was decided at check4access) */
-
-#if OL_LDAPV > 0
-
- /* a dummy call as long as socket connections are not settled
- * with OpenLDAP
- */
- if ( dosyslog )
- syslog( LOG_INFO, "do_queries(): calling ldap_simple_bind_s()...\n" );
-
-#endif
-
- if ( (rc=ldap_simple_bind_s( ld, glob->webdn, glob->webpw ))
- != LDAP_SUCCESS ) {
- if ( debug ) ldap_perror( ld, "ldap_simple_bind_s" );
- do_error( fp, rc, SERVER_ERROR, glob);
- rewind(fp);
- exit_tweb( 1 );
- }
-
- /* 3. requests to the GW by order of the user */
- switch ( *query++ ) {
-
- /* read entry */
- case cREAD:
- do_read( ld, fp, query, 0, glob );
- break;
-
- /* display second page */
- case cREADALL:
- do_read( ld, fp, query, 1, glob);
- break;
-
- /* search entries */
- case cSEARCH:
- do_search( ld, fp, query, glob );
- break;
-
- /* list entries (browsing) */
- case cLIST:
- do_menu( ld, fp, query, "", glob );
- break;
-
-#ifdef TUE_TEL
- /* list entries (browsing TON instead of DN) */
- case cTON:
- if(glob->ton_urls)
- do_ton( ld, fp, query, glob );
- break;
-#endif
-
- /* request GIF-photo (Photo in X.500 as JPEG) */
- case cGIF:
- do_pict( ld, fp, query, 1, glob);
- break;
-
- /* display JPEG-Photo */
- case cJPEG:
- do_pict( ld, fp, query, 2, glob);
- break;
-
- /* display X.500-G3FAX-Photo */
- case cG3FAX:
- do_pict( ld, fp, query, 0, glob);
- break;
-
- /* play Audio-attribute */
- case cAUDIO:
- do_audio( ld, fp, query, 0, glob);
- break;
-
- /* eXtended query format */
- case cEXTENDED:
- do_xtend( ld, fp, query, 0, glob);
- break;
-
- /* Default (empty query) is browsing of BASEDN */
- default:
- do_menu( ld, fp, glob->basedn->dn, "", glob );
- break;
- }
-
- /* Job done, terminate connection to the DSA and bye! */
- ldap_unbind (ld);
- close_ldap_connections(glob);
- rewind(fp);
- exit_tweb( 0 );
- /* NOT REACHED */
-}
-/* end of function: do_queries */
-
-PUBLIC void timeoutf(sig)
-int sig;
-{
- /* fprintf(stderr, "timeout!"); */
- exit_tweb(0);
-}
-/* end of function: timeoutf */
-
-
-PRIVATE void strict_basednf(fp, ld, query, glob)
-FILE *fp;
-LDAP *ld;
-char *query;
-GLOB_STRUCT *glob;
-{
- char dnbuf[BUFSIZ], basednbuf[BUFSIZ], *strptr;
- LDAPMessage *res, *e;
- int rc, flag = 0, i, j;
- struct timeval timeout;
- char *url = NULL, **uri, *urlnola = NULL;
- pGW_SWITCH_LINE gw_ptr;
- char *url_tmp;
- char **dnarray, **bdnarray;
-
-#ifdef TUE_TEL
- /* Patch for TONS */
- if( glob->ton_urls && (*query == cTON))
- return;
-#endif
-
- /* Patch for FORMs/PULLDOWNs (cPULLDOWN) */
- if( glob->pull_down_menus && (*query == cPULLDOWN))
- return;
-
- /* Patch for FORMs/BUTTONs (cBUTTONs) */
- if( glob->pull_down_menus && (*query == cBUTTON))
- return;
-
- if(*query)
- strcpy(dnbuf, query+1);
- else
- strcpy(dnbuf, "\0");
- hex_decode(dnbuf);
- strcpy(basednbuf, glob->basedn->dn);
-
- if( ( strptr = strchr(dnbuf, '?')) )
- *strptr = '\0';
-
- if( *query && !dn_issuffix( dn_normalize(dnbuf), dn_normalize(basednbuf))) {
-
- dnarray = dn2charray(dnbuf);
- bdnarray = glob->basedn->dnarray;
-
- strcpy(dnbuf, "\0");
- if (glob->gw_switch) {
- for(gw_ptr = glob->gw_switch->list;
- !flag && gw_ptr; gw_ptr = gw_ptr->next) {
- if (!dn_cmp ("root", gw_ptr->dn)) {
- flag = 1;
- url = gw_ptr->url;
- }
- }
- }
- if(!flag) {
- fprintf(stderr, "Fehler:strict_basedn w/o root-switch!!!!\n");
- exit_tweb(0);
- }
-
- for(j=0; bdnarray[j] && dnarray[j]; j++) {
- char *dnbufb;
-
- flag = 0;
-
- dnbufb = strdup(dnbuf);
- sprintf(dnbuf, "%s%s%s", dnarray[j], *dnbuf ? "," : "" , dnbufb);
-
- if ( glob->gw_switch && glob->gw_switch->dynamic) {
-
- if ( (rc=ldap_simple_bind_s( ld, glob->webdn, glob->webpw ))
- != LDAP_SUCCESS ) {
- if ( debug ) ldap_perror( ld, "ldap_simple_bind_s" );
- do_error( fp, rc, SERVER_ERROR, glob);
- rewind(fp);
- exit_tweb( 1 );
- }
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
-
- if ( (rc = ldap_search_st( ld, dnbuf, LDAP_SCOPE_BASE, "objectClass=*",
- NULL, 0, &timeout, &res )) != LDAP_SUCCESS ) {
-/* do_error(fp, rc, NOT_FOUND, glob);
-*/
- continue;
- }
-
-
- if ( (e = ldap_first_entry( ld, res )) == NULL ) {
- do_error(fp, -2, SERVER_ERROR, glob);
- return;
- }
-
-
- uri = ldap_get_values( ld, e, "labeledURI" );
- for(i=0; uri && uri[i] && *uri[i]; i++) {
- char *sp;
-
- if( ( sp = strchr(uri[i], ' ')) ) {
- *sp++ = '\0';
- if(strstr(sp, glob->gw_switch->lagws)) {
- flag = 1;
- url = uri[i];
- break;
- } else if(strstr(sp, GWS))
- urlnola = uri[i];
- }
- }
- }
- if(!flag && urlnola) {
- url = urlnola;
- flag = 1;
- }
- if (glob->gw_switch) {
-
- for(gw_ptr = glob->gw_switch->list;
- !flag && gw_ptr; gw_ptr = gw_ptr->next) {
- if (!dn_cmp (dnbuf, gw_ptr->dn)) {
- flag = 1;
- url = gw_ptr->url;
- }
- }
- }
- if(strcmp(bdnarray[j], dnarray[j]))
- break;
- }
-
- if (http == 1) PRINT_HTML_HEADER;
- fprintf( fp, HTML_HEAD_TITLE, "ACCESS DENIED", glob->la[100]);
- disp_file(glob, glob->header, fp);
- fprintf( fp, "%s\n", glob->la[96]);
- url_tmp = strdup(url_complete(url, query, ""));
- fprintf( fp, "<P><A HREF=\"%s\"><b>%s</b></A>\n",
- url_tmp, url_tmp);
- disp_file(glob, glob->footer, fp);
- PRINT_HTML_FOOTER;
- ldap_unbind (ld);
- close_ldap_connections(glob);
- exit_tweb(0);
- }
-}
-/* end of function: strict_basednf */
-
-PRIVATE void trade_cache(fp, ld, query, glob)
-FILE *fp;
-LDAP *ld;
-char *query;
-GLOB_STRUCT *glob;
-{
- pCACHING_TERMS_LINE ca_ptr;
- char dnbuf[BUFSIZ], rdn[BUFSIZ], *strptr;
- char tstring[100];
- int resflag;
- int rc;
- struct timeval timeout;
- LDAPMessage *res, *e;
- char **vals = NULL;
-
- resflag = 0;
- if(*query)
- strcpy(dnbuf, query+1);
- else
- strcpy(dnbuf, glob->basedn->dn);
- hex_decode(dnbuf);
- if( ( strptr = strchr(dnbuf, '?')) )
- *strptr = '\0';
- strcpy(rdn, dnbuf);
- if( ( strptr = strQuoteChr(rdn, ',')) )
- *strptr = '\0';
-
- for(ca_ptr = glob->caching_terms; ca_ptr; ca_ptr = ca_ptr->next) {
- if((toupper(*query) == toupper(*ca_ptr->access_type)) ||
- ( !*query && (toupper(*ca_ptr->access_type) == 'M'))) {
-
- if(ca_ptr->rdn_oc && (strstr(str_tolower(rdn), ca_ptr->pattern) ||
- (*ca_ptr->pattern == '*'))) {
- time(&glob->expiretime);
- glob->expiretime += ca_ptr->time;
- free(glob->expiretimestr);
- strftime(tstring, 99, GMT_FORMAT2, gmtime(&glob->expiretime));
- glob->expiretimestr = strdup(tstring);
- glob->caching = TRUE;
- }
- if(!ca_ptr->rdn_oc) {
- if(!resflag) {
-
- if ( (rc=ldap_simple_bind_s( ld, glob->webdn, glob->webpw ))
- != LDAP_SUCCESS ) {
- if ( debug ) ldap_perror( ld, "ldap_simple_bind_s" );
- do_error( fp, rc, SERVER_ERROR, glob);
- rewind(fp);
- exit_tweb( 1 );
- }
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
-
- if ( (rc = ldap_search_st( ld, dnbuf, LDAP_SCOPE_BASE, "objectClass=*",
- NULL, 0, &timeout, &res )) != LDAP_SUCCESS ) {
- do_error(fp, rc, NOT_FOUND, glob);
- return;
- }
-
-
- if ( (e = ldap_first_entry( ld, res )) == NULL ) {
- do_error(fp, -2, SERVER_ERROR, glob);
- return;
- }
-
-
- vals = ldap_get_values( ld, e, "objectClass" );
- resflag = 1;
- }
- if(charray_inlist( vals, ca_ptr->pattern )) {
- time(&glob->expiretime);
- glob->expiretime += ca_ptr->time;
- free(glob->expiretimestr);
- strftime(tstring, 99, GMT_FORMAT2, gmtime(&glob->expiretime));
- glob->expiretimestr = strdup(tstring);
- glob->caching = TRUE;
- }
- }
-
- }
- }
-
-}
-/* end of function: trade_cache */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* queries.h.. *
-* *
-* Funktion:..WorldWideWeb-X.500-Gateway - Server-Functions *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: : Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* May 10 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: queries.h,v 1.6 1999/09/10 15:01:18 zrnsk01 Exp $
- *
- */
-
-#ifndef _QUERIES_
-#define _QUERIES_
-
-#include "tgeneral.h"
-#include "tglobal.h"
-#include "init_exp.h"
-#include "checkclient_exp.h"
-#include "support_exp.h"
-
-#include "queries_exp.h"
-#include "x500_exp.h"
-#include "html_exp.h"
-#include "server_exp.h"
-#include "dn_exp.h"
-#include "charray_exp.h"
-
-#ifdef TUE_TEL
-#include "tueTel_exp.h"
-#endif
-
-
-/* Macros for request-recognition */
-
-/* 1. without DSA */
-#define cHELP 'H'
-#define cERROR 'E'
-#define cCONFIG 'C'
-#define cSTATS 'K'
-#define cPULLDOWN 'D'
-#define cBUTTON 'B'
-
-/* 2. with user-bind */
-#define cGETMOD 'F'
-#define cDOMOD 'Y'
-
-/* 3. with GW-bind */
-#define cREAD 'R'
-#define cREADALL 'L'
-#define cSEARCH 'S'
-#define cLIST 'M'
-#ifdef TUE_TEL
-#define cTON 'T'
-#endif
-#define cGIF 'I'
-#define cJPEG 'J'
-#define cG3FAX 'G'
-#define cAUDIO 'A'
-#define cREFERRAL 'W'
-#define cEXTENDED 'X'
-
-#define GMT_FORMAT "%a, %d %b %Y %T GMT"
-#define GMT_FORMAT2 "Expires: %a, %d %b %Y %T GMT\n"
-#define ROBOTS_TXT_FILE "robots.txt"
-
-PRIVATE void strict_basednf();
-PRIVATE void trade_cache();
-
-#endif /* _QUERIES_ */
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* queries_exp.h *
-* *
-* Function:..File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* February 13 1996 Z D D V V *
-* Last modification: Z D D V V *
-* November 21 1996 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: queries_exp.h,v 1.6 1999/09/10 15:01:18 zrnsk01 Exp $
- *
- */
-
-#ifndef _QUERIES_EXP_
-#define _QUERIES_EXP_
-
-PUBLIC void do_queries(/* s, glob , ip_addr, ip_port*/);
-PUBLIC void timeoutf(/*sig*/);
-
-
-#endif /* _QUERIES_EXP_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* regular.c.. *
-* *
-* Function:..Routine for TWEB -> regular expressions *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* January 20 1998 Z D D V V *
-* Last modification: Z D D V V *
-* December 31 1998 ZZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-/*
- * $Id: regular.c,v 1.6 1999/09/10 15:01:19 zrnsk01 Exp $
- *
- */
-
-
-#include "tgeneral.h"
-#include "tglobal.h"
-#include "regular_exp.h"
-#include "regular.h"
-#include "support_exp.h"
-
-
-PUBLIC void tweb_regerror(s)
-char *s;
-{
-#ifdef ERRAVAIL
- error("regexp: %s", s);
-#else
-/* fprintf(stderr, "regexp(3): %s", s);
- exit(1);
-*/
- /* TWEB: error-logging by syslog */
- if (dosyslog) syslog (LOG_INFO,
- "ALLOW/DENY/GRANT/REFUSE - regexp-error: %s", s);
- exit_tweb( 1 );
-#endif
- /* NOTREACHED */
-}
-/*
- * tweb_regsub
- *
- * Copyright (c) 1986 by University of Toronto.
- * Written by Henry Spencer. Not derived from licensed software.
- *
- * Permission is granted to anyone to use this software for any
- * purpose on any computer system, and to redistribute it freely,
- * subject to the following restrictions:
- *
- * 1. The author is not responsible for the consequences of use of
- * this software, no matter how awful, even if they arise
- * from defects in it.
- *
- * 2. The origin of this software must not be misrepresented, either
- * by explicit claim or by omission.
- *
- * 3. Altered versions must be plainly marked as such, and must not
- * be misrepresented as being the original software.
- */
-
-#ifndef CHARBITS
-#define UCHARAT(p) ((int)*(unsigned char *)(p))
-#else
-#define UCHARAT(p) ((int)*(p)&CHARBITS)
-#endif
-
-/*
- - tweb_regsub - perform substitutions after a regexp match
- */
-PUBLIC void tweb_regsub(prog, source, dest)
-regexp *prog;
-char *source;
-char *dest;
-{
- register char *src;
- register char *dst;
- register char c;
- register int no;
- register int len;
- extern char *strncpy();
-
- if (prog == NULL || source == NULL || dest == NULL) {
- tweb_regerror("NULL parm to tweb_regsub");
- return;
- }
- if (UCHARAT(prog->program) != MAGIC) {
- tweb_regerror("damaged regexp fed to tweb_regsub");
- return;
- }
-
- src = source;
- dst = dest;
- while ((c = *src++) != '\0') {
- if (c == '&')
- no = 0;
- else if (c == '\\' && '0' <= *src && *src <= '9')
- no = *src++ - '0';
- else
- no = -1;
-
- if (no < 0) { /* Ordinary character. */
- if (c == '\\' && (*src == '\\' || *src == '&'))
- c = *src++;
- *dst++ = c;
- } else if (prog->startp[no] != NULL && prog->endp[no] != NULL) {
- len = prog->endp[no] - prog->startp[no];
- (void) strncpy(dst, prog->startp[no], len);
- dst += len;
- if (len != 0 && *(dst-1) == '\0') { /* strncpy hit NUL. */
- tweb_regerror("damaged match string");
- return;
- }
- }
- }
- *dst++ = '\0';
-}
-/*
- * tweb_regcomp and tweb_regexec -- tweb_regsub and tweb_regerror are elsewhere
- *
- * Copyright (c) 1986 by University of Toronto.
- * Written by Henry Spencer. Not derived from licensed software.
- *
- * Permission is granted to anyone to use this software for any
- * purpose on any computer system, and to redistribute it freely,
- * subject to the following restrictions:
- *
- * 1. The author is not responsible for the consequences of use of
- * this software, no matter how awful, even if they arise
- * from defects in it.
- *
- * 2. The origin of this software must not be misrepresented, either
- * by explicit claim or by omission.
- *
- * 3. Altered versions must be plainly marked as such, and must not
- * be misrepresented as being the original software.
- *
- * Beware that some of this code is subtly aware of the way operator
- * precedence is structured in regular expressions. Serious changes in
- * regular-expression syntax might require a total rethink.
- */
-
-/*
- * The "internal use only" fields in regexp.h are present to pass info from
- * compile to execute that permits the execute phase to run lots faster on
- * simple cases. They are:
- *
- * regstart char that must begin a match; '\0' if none obvious
- * reganch is the match anchored (at beginning-of-line only)?
- * regmust string (pointer into program) that match must include, or NULL
- * regmlen length of regmust string
- *
- * Regstart and reganch permit very fast decisions on suitable starting points
- * for a match, cutting down the work a lot. Regmust permits fast rejection
- * of lines that cannot possibly match. The regmust tests are costly enough
- * that tweb_regcomp() supplies a regmust only if the r.e. contains something
- * potentially expensive (at present, the only such thing detected is * or +
- * at the start of the r.e., which can involve a lot of backup). Regmlen is
- * supplied because the test in tweb_regexec() needs it and tweb_regcomp() is computing
- * it anyway.
- */
-
-/*
- * Structure for regexp "program". This is essentially a linear encoding
- * of a nondeterministic finite-state machine (aka syntax charts or
- * "railroad normal form" in parsing technology). Each node is an opcode
- * plus a "next" pointer, possibly plus an operand. "Next" pointers of
- * all nodes except BRANCH implement concatenation; a "next" pointer with
- * a BRANCH on both ends of it is connecting two alternatives. (Here we
- * have one of the subtle syntax dependencies: an individual BRANCH (as
- * opposed to a collection of them) is never concatenated with anything
- * because of operator precedence.) The operand of some types of node is
- * a literal string; for others, it is a node leading into a sub-FSM. In
- * particular, the operand of a BRANCH node is the first node of the branch.
- * (NB this is *not* a tree structure: the tail of the branch connects
- * to the thing following the set of BRANCHes.) The opcodes are:
- */
-/*#include "regular.h"*/
-
-/*
- - tweb_regcomp - compile a regular expression into internal code
-e*
- * We can't allocate space until we know how big the compiled form will be,
- * but we can't compile it (and thus know how big it is) until we've got a
- * place to put the code. So we cheat: we compile it twice, once with code
- * generation turned off and size counting turned on, and once "for real".
- * This also means that we don't allocate space until we are sure that the
- * thing really will compile successfully, and we never have to move the
- * code and thus invalidate pointers into it. (Note that it has to be in
- * one piece because free() must be able to free it all.)
- *
- * Beware that the optimization-preparation code in here knows about some
- * of the structure of the compiled regexp.
- */
-PUBLIC regexp * tweb_regcomp(exp)
-char *exp;
-{
- register regexp *r;
- register char *scan;
- register char *longest;
- register int len;
- int flags;
-
- if (exp == NULL)
- FAIL("NULL argument");
-
- /* First pass: determine size, legality. */
- regparse = exp;
- regnpar = 1;
- regsize = 0L;
- regcode = ®dummy;
- tweb_regc(MAGIC);
- if (tweb_reg(0, &flags) == NULL)
- return(NULL);
-
- /* Small enough for pointer-storage convention? */
- if (regsize >= 32767L) /* Probably could be 65535L. */
- FAIL("regexp too big");
-
- /* Allocate space. */
- r = (regexp *)malloc(sizeof(regexp) + (unsigned)regsize);
- if (r == NULL)
- FAIL("out of space");
-
- /* Second pass: emit code. */
- regparse = exp;
- regnpar = 1;
- regcode = r->program;
- tweb_regc(MAGIC);
- if (tweb_reg(0, &flags) == NULL)
- return(NULL);
-
- /* Dig out information for optimizations. */
- r->regstart = '\0'; /* Worst-case defaults. */
- r->reganch = 0;
- r->regmust = NULL;
- r->regmlen = 0;
- scan = r->program+1; /* First BRANCH. */
- if (OP(tweb_regnext(scan)) == END) { /* Only one top-level choice. */
- scan = OPERAND(scan);
-
- /* Starting-point info. */
- if (OP(scan) == EXACTLY)
- r->regstart = *OPERAND(scan);
- else if (OP(scan) == BOL)
- r->reganch++;
-
- /*
- * If there's something expensive in the r.e., find the
- * longest literal string that must appear and make it the
- * regmust. Resolve ties in favor of later strings, since
- * the regstart check works with the beginning of the r.e.
- * and avoiding duplication strengthens checking. Not a
- * strong reason, but sufficient in the absence of others.
- */
- if (flags&SPSTART) {
- longest = NULL;
- len = 0;
- for (; scan != NULL; scan = tweb_regnext(scan))
- if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
- longest = OPERAND(scan);
- len = strlen(OPERAND(scan));
- }
- r->regmust = longest;
- r->regmlen = len;
- }
- }
-
- return(r);
-}
-
-/*
- - reg - regular expression, i.e. main body or parenthesized thing
- *
- * Caller must absorb opening parenthesis.
- *
- * Combining parenthesis handling with the base level of regular expression
- * is a trifle forced, but the need to tie the tails of the branches to what
- * follows makes it hard to avoid.
- */
-PRIVATE char * tweb_reg(paren, flagp)
-int paren; /* Parenthesized? */
-int *flagp;
-{
- register char *ret;
- register char *br;
- register char *ender;
- register int parno = 0;
- int flags;
-
- *flagp = HASWIDTH; /* Tentatively. */
-
- /* Make an OPEN node, if parenthesized. */
- if (paren) {
- if (regnpar >= NSUBEXP)
- FAIL("too many ()");
- parno = regnpar;
- regnpar++;
- ret = tweb_regnode(OPEN+parno);
- } else
- ret = NULL;
-
- /* Pick up the branches, linking them together. */
- br = tweb_regbranch(&flags);
- if (br == NULL)
- return(NULL);
- if (ret != NULL)
- tweb_regtail(ret, br); /* OPEN -> first. */
- else
- ret = br;
- if (!(flags&HASWIDTH))
- *flagp &= ~HASWIDTH;
- *flagp |= flags&SPSTART;
- while (*regparse == '|') {
- regparse++;
- br = tweb_regbranch(&flags);
- if (br == NULL)
- return(NULL);
- tweb_regtail(ret, br); /* BRANCH -> BRANCH. */
- if (!(flags&HASWIDTH))
- *flagp &= ~HASWIDTH;
- *flagp |= flags&SPSTART;
- }
-
- /* Make a closing node, and hook it on the end. */
- ender = tweb_regnode((paren) ? CLOSE+parno : END);
- tweb_regtail(ret, ender);
-
- /* Hook the tails of the branches to the closing node. */
- for (br = ret; br != NULL; br = tweb_regnext(br))
- tweb_regoptail(br, ender);
-
- /* Check for proper termination. */
- if (paren && *regparse++ != ')') {
- FAIL("unmatched ()");
- } else if (!paren && *regparse != '\0') {
- if (*regparse == ')') {
- FAIL("unmatched ()");
- } else
- FAIL("junk on end"); /* "Can't happen". */
- /* NOTREACHED */
- }
-
- return(ret);
-}
-
-/*
- - tweb_regbranch - one alternative of an | operator
- *
- * Implements the concatenation operator.
- */
-PRIVATE char * tweb_regbranch(flagp)
-int *flagp;
-{
- register char *ret;
- register char *chain;
- register char *latest;
- int flags;
-
- *flagp = WORST; /* Tentatively. */
-
- ret = tweb_regnode(BRANCH);
- chain = NULL;
- while (*regparse != '\0' && *regparse != '|' && *regparse != ')') {
- latest = tweb_regpiece(&flags);
- if (latest == NULL)
- return(NULL);
- *flagp |= flags&HASWIDTH;
- if (chain == NULL) /* First piece. */
- *flagp |= flags&SPSTART;
- else
- tweb_regtail(chain, latest);
- chain = latest;
- }
- if (chain == NULL) /* Loop ran zero times. */
- (void) tweb_regnode(NOTHING);
-
- return(ret);
-}
-
-/*
- - tweb_regpiece - something followed by possible [*+?]
- *
- * Note that the branching code sequences used for ? and the general cases
- * of * and + are somewhat optimized: they use the same NOTHING node as
- * both the endmarker for their branch list and the body of the last branch.
- * It might seem that this node could be dispensed with entirely, but the
- * endmarker role is not redundant.
- */
-PRIVATE char * tweb_regpiece(flagp)
-int *flagp;
-{
- register char *ret;
- register char op;
- register char *next;
- int flags;
-
- ret = tweb_regatom(&flags);
- if (ret == NULL)
- return(NULL);
-
- op = *regparse;
- if (!ISMULT(op)) {
- *flagp = flags;
- return(ret);
- }
-
- if (!(flags&HASWIDTH) && op != '?')
- FAIL("*+ operand could be empty");
- *flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH);
-
- if (op == '*' && (flags&SIMPLE))
- tweb_reginsert(STAR, ret);
- else if (op == '*') {
- /* Emit x* as (x&|), where & means "self". */
- tweb_reginsert(BRANCH, ret); /* Either x */
- tweb_regoptail(ret, tweb_regnode(BACK)); /* and loop */
- tweb_regoptail(ret, ret); /* back */
- tweb_regtail(ret, tweb_regnode(BRANCH)); /* or */
- tweb_regtail(ret, tweb_regnode(NOTHING)); /* null. */
- } else if (op == '+' && (flags&SIMPLE))
- tweb_reginsert(PLUS, ret);
- else if (op == '+') {
- /* Emit x+ as x(&|), where & means "self". */
- next = tweb_regnode(BRANCH); /* Either */
- tweb_regtail(ret, next);
- tweb_regtail(tweb_regnode(BACK), ret); /* loop back */
- tweb_regtail(next, tweb_regnode(BRANCH)); /* or */
- tweb_regtail(ret, tweb_regnode(NOTHING)); /* null. */
- } else if (op == '?') {
- /* Emit x? as (x|) */
- tweb_reginsert(BRANCH, ret); /* Either x */
- tweb_regtail(ret, tweb_regnode(BRANCH)); /* or */
- next = tweb_regnode(NOTHING); /* null. */
- tweb_regtail(ret, next);
- tweb_regoptail(ret, next);
- }
- regparse++;
- if (ISMULT(*regparse))
- FAIL("nested *?+");
-
- return(ret);
-}
-
-/*
- - tweb_regatom - the lowest level
- *
- * Optimization: gobbles an entire sequence of ordinary characters so that
- * it can turn them into a single node, which is smaller to store and
- * faster to run. Backslashed characters are exceptions, each becoming a
- * separate node; the code is simpler that way and it's not worth fixing.
- */
-PRIVATE char * tweb_regatom(flagp)
-int *flagp;
-{
- register char *ret;
- int flags;
-
- *flagp = WORST; /* Tentatively. */
-
- switch (*regparse++) {
- case '^':
- ret = tweb_regnode(BOL);
- break;
- case '$':
- ret = tweb_regnode(EOL);
- break;
- case '.':
- ret = tweb_regnode(ANY);
- *flagp |= HASWIDTH|SIMPLE;
- break;
- case '[': {
- register int class;
- register int classend;
-
- if (*regparse == '^') { /* Complement of range. */
- ret = tweb_regnode(ANYBUT);
- regparse++;
- } else
- ret = tweb_regnode(ANYOF);
- if (*regparse == ']' || *regparse == '-')
- tweb_regc(*regparse++);
- while (*regparse != '\0' && *regparse != ']') {
- if (*regparse == '-') {
- regparse++;
- if (*regparse == ']' || *regparse == '\0')
- tweb_regc('-');
- else {
- class = UCHARAT(regparse-2)+1;
- classend = UCHARAT(regparse);
- if (class > classend+1)
- FAIL("invalid [] range");
- for (; class <= classend; class++)
- tweb_regc(class);
- regparse++;
- }
- } else
- tweb_regc(*regparse++);
- }
- tweb_regc('\0');
- if (*regparse != ']')
- FAIL("unmatched []");
- regparse++;
- *flagp |= HASWIDTH|SIMPLE;
- }
- break;
- case '(':
- ret = tweb_reg(1, &flags);
- if (ret == NULL)
- return(NULL);
- *flagp |= flags&(HASWIDTH|SPSTART);
- break;
- case '\0':
- case '|':
- case ')':
- FAIL("internal urp"); /* Supposed to be caught earlier. */
- break;
- case '?':
- case '+':
- case '*':
- FAIL("?+* follows nothing");
- break;
- case '\\':
- if (*regparse == '\0')
- FAIL("trailing \\");
- ret = tweb_regnode(EXACTLY);
- tweb_regc(*regparse++);
- tweb_regc('\0');
- *flagp |= HASWIDTH|SIMPLE;
- break;
- default: {
- register int len;
- register char ender;
-
- regparse--;
- len = strcspn(regparse, META);
- if (len <= 0)
- FAIL("internal disaster");
- ender = *(regparse+len);
- if (len > 1 && ISMULT(ender))
- len--; /* Back off clear of ?+* operand. */
- *flagp |= HASWIDTH;
- if (len == 1)
- *flagp |= SIMPLE;
- ret = tweb_regnode(EXACTLY);
- while (len > 0) {
- tweb_regc(*regparse++);
- len--;
- }
- tweb_regc('\0');
- }
- break;
- }
-
- return(ret);
-}
-
-/*
- - tweb_regnode - emit a node
- */
-PRIVATE char * tweb_regnode(op)
-char op;
-{
- register char *ret;
- register char *ptr;
-
- ret = regcode;
- if (ret == ®dummy) {
- regsize += 3;
- return(ret);
- }
-
- ptr = ret;
- *ptr++ = op;
- *ptr++ = '\0'; /* Null "next" pointer. */
- *ptr++ = '\0';
- regcode = ptr;
-
- return(ret);
-}
-
-/*
- - regc - emit (if appropriate) a byte of code
- */
-PRIVATE void tweb_regc(b)
-char b;
-{
- if (regcode != ®dummy)
- *regcode++ = b;
- else
- regsize++;
-}
-
-/*
- - tweb_reginsert - insert an operator in front of already-emitted operand
- *
- * Means relocating the operand.
- */
-PRIVATE void tweb_reginsert(op, opnd)
-char op;
-char *opnd;
-{
- register char *src;
- register char *dst;
- register char *place;
-
- if (regcode == ®dummy) {
- regsize += 3;
- return;
- }
-
- src = regcode;
- regcode += 3;
- dst = regcode;
- while (src > opnd)
- *--dst = *--src;
-
- place = opnd; /* Op node, where operand used to be. */
- *place++ = op;
- *place++ = '\0';
- *place++ = '\0';
-}
-
-/*
- - tweb_regtail - set the next-pointer at the end of a node chain
- */
-PRIVATE void tweb_regtail(p, val)
-char *p;
-char *val;
-{
- register char *scan;
- register char *temp;
- register int offset;
-
- if (p == ®dummy)
- return;
-
- /* Find last node. */
- scan = p;
- for (;;) {
- temp = tweb_regnext(scan);
- if (temp == NULL)
- break;
- scan = temp;
- }
-
- if (OP(scan) == BACK)
- offset = scan - val;
- else
- offset = val - scan;
- *(scan+1) = (offset>>8)&0377;
- *(scan+2) = offset&0377;
-}
-
-/*
- - tweb_regoptail - tweb_regtail on operand of first argument; nop if operandless
- */
-PRIVATE void tweb_regoptail(p, val)
-char *p;
-char *val;
-{
- /* "Operandless" and "op != BRANCH" are synonymous in practice. */
- if (p == NULL || p == ®dummy || OP(p) != BRANCH)
- return;
- tweb_regtail(OPERAND(p), val);
-}
-
-/*
- * tweb_regexec and friends
- */
-
-/*
- * Global work variables for tweb_regexec().
- */
-static char *reginput; /* String-input pointer. */
-static char *regbol; /* Beginning of input, for ^ check. */
-static char **regstartp; /* Pointer to startp array. */
-static char **regendp; /* Ditto for endp. */
-
-/*
- * Forwards.
- */
-STATIC int tweb_regtry();
-STATIC int tweb_regmatch();
-STATIC int tweb_regrepeat();
-
-#ifdef DEBUG
-int regnarrate = 0;
-void tweb_regdump();
-STATIC char *tweb_regprop();
-#endif
-
-/*
- - tweb_regexec - match a regexp against a string
- */
-int
-PUBLIC tweb_regexec(prog, string)
-register regexp *prog;
-register char *string;
-{
- register char *s;
- extern char *strchr();
-
- /* Be paranoid... */
- if (prog == NULL || string == NULL) {
- tweb_regerror("NULL parameter");
- return(0);
- }
-
- /* Check validity of program. */
- if (UCHARAT(prog->program) != MAGIC) {
- tweb_regerror("corrupted program");
- return(0);
- }
-
- /* If there is a "must appear" string, look for it. */
- if (prog->regmust != NULL) {
- s = string;
- while ((s = strchr(s, prog->regmust[0])) != NULL) {
- if (strncmp(s, prog->regmust, prog->regmlen) == 0)
- break; /* Found it. */
- s++;
- }
- if (s == NULL) /* Not present. */
- return(0);
- }
-
- /* Mark beginning of line for ^ . */
- regbol = string;
-
- /* Simplest case: anchored match need be tried only once. */
- if (prog->reganch)
- return(tweb_regtry(prog, string));
-
- /* Messy cases: unanchored match. */
- s = string;
- if (prog->regstart != '\0')
- /* We know what char it must start with. */
- while ((s = strchr(s, prog->regstart)) != NULL) {
- if (tweb_regtry(prog, s))
- return(1);
- s++;
- }
- else
- /* We don't -- general case. */
- do {
- if (tweb_regtry(prog, s))
- return(1);
- } while (*s++ != '\0');
-
- /* Failure. */
- return(0);
-}
-
-/*
- - tweb_regtry - try match at specific point
- */
-PRIVATE int tweb_regtry(prog, string)
-regexp *prog;
-char *string;
-{
- register int i;
- register char **sp;
- register char **ep;
-
- reginput = string;
- regstartp = prog->startp;
- regendp = prog->endp;
-
- sp = prog->startp;
- ep = prog->endp;
- for (i = NSUBEXP; i > 0; i--) {
- *sp++ = NULL;
- *ep++ = NULL;
- }
- if (tweb_regmatch(prog->program + 1)) {
- prog->startp[0] = string;
- prog->endp[0] = reginput;
- return(1);
- } else
- return(0);
-}
-
-/*
- - tweb_regmatch - main matching routine
- *
- * Conceptually the strategy is simple: check to see whether the current
- * node matches, call self recursively to see whether the rest matches,
- * and then act accordingly. In practice we make some effort to avoid
- * recursion, in particular by going through "ordinary" nodes (that don't
- * need to know whether the rest of the match failed) by a loop instead of
- * by recursion.
- */
-PRIVATE int tweb_regmatch(prog)
-char *prog;
-{
- register char *scan; /* Current node. */
- char *next; /* Next node. */
- extern char *strchr();
-
- scan = prog;
-#ifdef DEBUG
- if (scan != NULL && regnarrate)
- fprintf(stderr, "%s(\n", tweb_regprop(scan));
-#endif
- while (scan != NULL) {
-#ifdef DEBUG
- if (regnarrate)
- fprintf(stderr, "%s...\n", tweb_regprop(scan));
-#endif
- next = tweb_regnext(scan);
-
- switch (OP(scan)) {
- case BOL:
- if (reginput != regbol)
- return(0);
- break;
- case EOL:
- if (*reginput != '\0')
- return(0);
- break;
- case ANY:
- if (*reginput == '\0')
- return(0);
- reginput++;
- break;
- case EXACTLY: {
- register int len;
- register char *opnd;
-
- opnd = OPERAND(scan);
- /* Inline the first character, for speed. */
- if (*opnd != *reginput)
- return(0);
- len = strlen(opnd);
- if (len > 1 && strncmp(opnd, reginput, len) != 0)
- return(0);
- reginput += len;
- }
- break;
- case ANYOF:
- if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == NULL)
- return(0);
- reginput++;
- break;
- case ANYBUT:
- if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != NULL)
- return(0);
- reginput++;
- break;
- case NOTHING:
- break;
- case BACK:
- break;
- case OPEN+1:
- case OPEN+2:
- case OPEN+3:
- case OPEN+4:
- case OPEN+5:
- case OPEN+6:
- case OPEN+7:
- case OPEN+8:
- case OPEN+9: {
- register int no;
- register char *save;
-
- no = OP(scan) - OPEN;
- save = reginput;
-
- if (tweb_regmatch(next)) {
- /*
- * Don't set startp if some later
- * invocation of the same parentheses
- * already has.
- */
- if (regstartp[no] == NULL)
- regstartp[no] = save;
- return(1);
- } else
- return(0);
- }
- break;
- case CLOSE+1:
- case CLOSE+2:
- case CLOSE+3:
- case CLOSE+4:
- case CLOSE+5:
- case CLOSE+6:
- case CLOSE+7:
- case CLOSE+8:
- case CLOSE+9: {
- register int no;
- register char *save;
-
- no = OP(scan) - CLOSE;
- save = reginput;
-
- if (tweb_regmatch(next)) {
- /*
- * Don't set endp if some later
- * invocation of the same parentheses
- * already has.
- */
- if (regendp[no] == NULL)
- regendp[no] = save;
- return(1);
- } else
- return(0);
- }
- break;
- case BRANCH: {
- register char *save;
-
- if (OP(next) != BRANCH) /* No choice. */
- next = OPERAND(scan); /* Avoid recursion. */
- else {
- do {
- save = reginput;
- if (tweb_regmatch(OPERAND(scan)))
- return(1);
- reginput = save;
- scan = tweb_regnext(scan);
- } while (scan != NULL && OP(scan) == BRANCH);
- return(0);
- /* NOTREACHED */
- }
- }
- break;
- case STAR:
- case PLUS: {
- register char nextch;
- register int no;
- register char *save;
- register int min;
-
- /*
- * Lookahead to avoid useless match attempts
- * when we know what character comes next.
- */
- nextch = '\0';
- if (OP(next) == EXACTLY)
- nextch = *OPERAND(next);
- min = (OP(scan) == STAR) ? 0 : 1;
- save = reginput;
- no = tweb_regrepeat(OPERAND(scan));
- while (no >= min) {
- /* If it could work, try it. */
- if (nextch == '\0' || *reginput == nextch)
- if (tweb_regmatch(next))
- return(1);
- /* Couldn't or didn't -- back up. */
- no--;
- reginput = save + no;
- }
- return(0);
- }
- break;
- case END:
- return(1); /* Success! */
- break;
- default:
- tweb_regerror("memory corruption");
- return(0);
- break;
- }
-
- scan = next;
- }
-
- /*
- * We get here only if there's trouble -- normally "case END" is
- * the terminating point.
- */
- tweb_regerror("corrupted pointers");
- return(0);
-}
-
-/*
- - tweb_regrepeat - repeatedly match something simple, report how many
- */
-PRIVATE int tweb_regrepeat(p)
-char *p;
-{
- register int count = 0;
- register char *scan;
- register char *opnd;
- extern char *strchr();
-
- scan = reginput;
- opnd = OPERAND(p);
- switch (OP(p)) {
- case ANY:
- count = strlen(scan);
- scan += count;
- break;
- case EXACTLY:
- while (*opnd == *scan) {
- count++;
- scan++;
- }
- break;
- case ANYOF:
- while (*scan != '\0' && strchr(opnd, *scan) != NULL) {
- count++;
- scan++;
- }
- break;
- case ANYBUT:
- while (*scan != '\0' && strchr(opnd, *scan) == NULL) {
- count++;
- scan++;
- }
- break;
- default: /* Oh dear. Called inappropriately. */
- tweb_regerror("internal foulup");
- count = 0; /* Best compromise. */
- break;
- }
- reginput = scan;
-
- return(count);
-}
-
-/*
- - tweb_regnext - dig the "next" pointer out of a node
- */
-PRIVATE char * tweb_regnext(p)
-register char *p;
-{
- register int offset;
-
- if (p == ®dummy)
- return(NULL);
-
- offset = NEXT(p);
- if (offset == 0)
- return(NULL);
-
- if (OP(p) == BACK)
- return(p-offset);
- else
- return(p+offset);
-}
-
-#ifdef DEBUG
-
-PRIVATE char *tweb_regprop();
-
-/*
- - tweb_regdump - dump a regexp onto stdout in vaguely comprehensible form
- */
-PUBLIC void tweb_regdump(r)
-regexp *r;
-{
- register char *s;
- register char op = EXACTLY; /* Arbitrary non-END op. */
- register char *next;
- extern char *strchr();
-
-
- s = r->program + 1;
- while (op != END) { /* While that wasn't END last time... */
- op = OP(s);
- printf("%2d%s", s-r->program, tweb_regprop(s)); /* Where, what. */
- next = tweb_regnext(s);
- if (next == NULL) /* Next ptr. */
- printf("(0)");
- else
- printf("(%d)", (s-r->program)+(next-s));
- s += 3;
- if (op == ANYOF || op == ANYBUT || op == EXACTLY) {
- /* Literal string, where present. */
- while (*s != '\0') {
- putchar(*s);
- s++;
- }
- s++;
- }
- putchar('\n');
- }
-
- /* Header fields of interest. */
- if (r->regstart != '\0')
- printf("start `%c' ", r->regstart);
- if (r->reganch)
- printf("anchored ");
- if (r->regmust != NULL)
- printf("must have \"%s\"", r->regmust);
- printf("\n");
-}
-
-/*
- - tweb_regprop - printable representation of opcode
- */
-PRIVATE char * tweb_regprop(op)
-char *op;
-{
- register char *p;
- static char buf[50];
-
- (void) strcpy(buf, ":");
-
- switch (OP(op)) {
- case BOL:
- p = "BOL";
- break;
- case EOL:
- p = "EOL";
- break;
- case ANY:
- p = "ANY";
- break;
- case ANYOF:
- p = "ANYOF";
- break;
- case ANYBUT:
- p = "ANYBUT";
- break;
- case BRANCH:
- p = "BRANCH";
- break;
- case EXACTLY:
- p = "EXACTLY";
- break;
- case NOTHING:
- p = "NOTHING";
- break;
- case BACK:
- p = "BACK";
- break;
- case END:
- p = "END";
- break;
- case OPEN+1:
- case OPEN+2:
- case OPEN+3:
- case OPEN+4:
- case OPEN+5:
- case OPEN+6:
- case OPEN+7:
- case OPEN+8:
- case OPEN+9:
- sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN);
- p = NULL;
- break;
- case CLOSE+1:
- case CLOSE+2:
- case CLOSE+3:
- case CLOSE+4:
- case CLOSE+5:
- case CLOSE+6:
- case CLOSE+7:
- case CLOSE+8:
- case CLOSE+9:
- sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE);
- p = NULL;
- break;
- case STAR:
- p = "STAR";
- break;
- case PLUS:
- p = "PLUS";
- break;
- default:
- tweb_regerror("corrupted opcode");
- break;
- }
- if (p != NULL)
- (void) strcat(buf, p);
- return(buf);
-}
-#endif
-
-/*
- * The following is provided for those people who do not have strcspn() in
- * their C libraries. They should get off their butts and do something
- * about it; at least one public-domain implementation of those (highly
- * useful) string routines has been published on Usenet.
- */
-#ifdef strcspn
-/*
- * strcspn - find length of initial segment of s1 consisting entirely
- * of characters not from s2
- */
-
-PRIVATE int strcspn(s1, s2)
-char *s1;
-char *s2;
-{
- register char *scan1;
- register char *scan2;
- register int count;
-
- count = 0;
- for (scan1 = s1; *scan1 != '\0'; scan1++) {
- for (scan2 = s2; *scan2 != '\0';) /* ++ moved down. */
- if (*scan1 == *scan2++)
- return(count);
- count++;
- }
- return(count);
-}
-#endif
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* regular.h.. *
-* *
-* Function:..Routine for TWEB *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* January 20 1998 Z D D V V *
-* Last modification: Z D D V V *
-* December 31 1998 ZZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-/*
- * $Id: regular.h,v 1.6 1999/09/10 15:01:19 zrnsk01 Exp $
- *
- */
-
-#ifndef _REGULAR_
-#define _REGULAR_
-
-
-/* definition number opnd? meaning */
-#define END 0 /* no End of program. */
-#define BOL 1 /* no Match "" at beginning of line. */
-#define EOL 2 /* no Match "" at end of line. */
-#define ANY 3 /* no Match any one character. */
-#define ANYOF 4 /* str Match any character in this string. */
-#define ANYBUT 5 /* str Match any character not in this string. */
-#define BRANCH 6 /* node Match this alternative, or the next... */
-#define BACK 7 /* no Match "", "next" ptr points backward. */
-#define EXACTLY 8 /* str Match this string. */
-#define NOTHING 9 /* no Match empty string. */
-#define STAR 10 /* node Match this (simple) thing 0 or more times. */
-#define PLUS 11 /* node Match this (simple) thing 1 or more times. */
-#define OPEN 20 /* no Mark this point in input as start of #n. */
- /* OPEN+1 is number 1, etc. */
-#define CLOSE ((OPEN)+(NSUBEXP)+1) /* no Analogous to OPEN. */
-
-/*
- * Opcode notes:
- *
- * BRANCH The set of branches constituting a single choice are hooked
- * together with their "next" pointers, since precedence prevents
- * anything being concatenated to any individual branch. The
- * "next" pointer of the last BRANCH in a choice points to the
- * thing following the whole choice. This is also where the
- * final "next" pointer of each individual branch points; each
- * branch starts with the operand node of a BRANCH node.
- *
- * BACK Normal "next" pointers all implicitly point forward; BACK
- * exists to make loop structures possible.
- *
- * STAR,PLUS '?', and complex '*' and '+', are implemented as circular
- * BRANCH structures using BACK. Simple cases (one character
- * per match) are implemented with STAR and PLUS for speed
- * and to minimize recursive plunges.
- *
- * OPEN,CLOSE ...are numbered at compile time.
- */
-
-/*
- * A node is one char of opcode followed by two chars of "next" pointer.
- * "Next" pointers are stored as two 8-bit pieces, high order first. The
- * value is a positive offset from the opcode of the node containing it.
- * An operand, if any, simply follows the node. (Note that much of the
- * code generation knows about this implicit relationship.)
- *
- * Using two bytes for the "next" pointer is vast overkill for most things,
- * but allows patterns to get big without disasters.
- */
-#define OP(p) (*(p))
-#define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377))
-#define OPERAND(p) ((p) + 3)
-
-/*
- * See regmagic.h for one further detail of program structure.
- */
-
-
-/*
- * Utility definitions.
- */
-#ifndef CHARBITS
-#define UCHARAT(p) ((int)*(unsigned char *)(p))
-#else
-#define UCHARAT(p) ((int)*(p)&CHARBITS)
-#endif
-
-#define FAIL(m) { tweb_regerror(m); return(NULL); }
-#define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?')
-#define META "^$.[()|?+*\\"
-
-/*
- * Flags to be passed up and down.
- */
-#define HASWIDTH 01 /* Known never to match null string. */
-#define SIMPLE 02 /* Simple enough to be STAR/PLUS operand. */
-#define SPSTART 04 /* Starts with * or +. */
-#define WORST 0 /* Worst case. */
-
-/*
- * Global work variables for regcomp().
- */
-PRIVATE char *regparse; /* Input-scan pointer. */
-PRIVATE int regnpar; /* () count. */
-PRIVATE char regdummy;
-PRIVATE char *regcode; /* Code-emit pointer; ®dummy = don't. */
-PRIVATE long regsize; /* Code size. */
-
-/*
- * Forward declarations for regcomp()'s friends.
- */
-#ifndef STATIC
-#define STATIC static
-#endif
-PRIVATE char *tweb_reg();
-PRIVATE char *tweb_regbranch();
-PRIVATE char *tweb_regpiece();
-PRIVATE char *tweb_regatom();
-PRIVATE char *tweb_regnode();
-PRIVATE char *tweb_regnext();
-PRIVATE void tweb_regc();
-PRIVATE void tweb_reginsert();
-PRIVATE void tweb_regtail();
-PRIVATE void tweb_regoptail();
-#ifdef STRCSPN
-STATIC int tweb_strcspn();
-#endif
-
-#endif /* _REGULAR_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* regular_exp.h *
-* *
-* Function:..Routine for TWEB *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* January 20 1998 Z D D V V *
-* Last modification: Z D D V V *
-* January 20 1998 ZZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-/*
- * $Id: regular_exp.h,v 1.6 1999/09/10 15:01:19 zrnsk01 Exp $
- *
- */
-
-
-#ifndef _REGULAR_EXP_
-#define _REGULAR_EXP_
-
-/*
- * Definitions etc. for regexp(3) routines.
- *
- * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof],
- * not the System V one.
- */
-#define NSUBEXP 10
-typedef struct regexp {
- char *startp[NSUBEXP];
- char *endp[NSUBEXP];
- char regstart; /* Internal use only. */
- char reganch; /* Internal use only. */
- char *regmust; /* Internal use only. */
- int regmlen; /* Internal use only. */
- char program[1]; /* Unwarranted chumminess with compiler. */
-} regexp;
-
-extern regexp *tweb_regcomp();
-extern int tweb_regexec();
-extern void tweb_regsub();
-extern void tweb_regerror();
-/*
- * The first byte of the regexp internal "program" is actually this magic
- * number; the start node begins in the second byte.
- */
-#define MAGIC 0234
-
-#endif /* _REGULAR_EXP_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* server.c... *
-* *
-* Function:..WorldWideWeb-X.500-Gateway - Server-Funktions *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* May 6 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: server.c,v 1.6 1999/09/10 15:01:19 zrnsk01 Exp $
- *
- */
-
-#include "tgeneral.h"
-#include "tglobal.h"
-#include "init_exp.h"
-#include "checkclient_exp.h"
-#include "server.h"
-#include "charray_exp.h"
-
-#if defined( TUE_TEL ) || defined( AMBIXGW )
-#include "tueTest_exp.h"
-#endif
-
-
-/**
- ** start_server()
- **
- ** Start the Web-X.500-Server.
- **/
-
-PUBLIC void start_server(glob)
-GLOB_STRUCT *glob;
-{
-
- int s, ns, rc;
- int tblsize;
- int pid = getpid();
- fd_set readfds;
- struct hostent *hp;
- struct sockaddr_in from;
- int fromlen;
- void wait4child();
- long int idx;
-
- glob->stat_slice = time(&glob->stat_slice);
- stat_slice = &glob->stat_slice;
- /* if logging is desired via syslog establish connection to syslogd
- and write first log-message */
- if ( dosyslog ) {
-
- openlog( glob->myname, LOG_PID | LOG_NOWAIT, dosyslog );
- syslog( LOG_INFO, "initializing" );
-
- }
-
- /* set up the socket to listen on */
- /* the actual port to listen is composed by the base-port
- and the language-offset */
- s = set_socket( glob->webport + atoi(glob->lang) );
-
- /* arrange to reap children */
- (void) signal( SIGCHLD, wait4child );
-
- if ( dosyslog )
- syslog (LOG_INFO, "socket: %d", s);
-
- /* Read LDAP-filter for search-operations */
- if ( (filtd = ldap_init_getfilter( glob->filterfile )) == NULL ) {
- fprintf(stderr,"Cannot open filter file (%s)\n", glob->filterfile );
- exit( 1 );
- }
-
-/* ### Code for the static server ### */
-
- tblsize = getdtablesize();
- syslog (LOG_INFO, "listening for calls...");
-
- /* Initialisation of the Anti-Hack-code */
- srand(pid);
- if (glob->comrefuse) hackTimer();
- bzero((char *) conArr, CARRSIZE * sizeof(int));
- bzero((char *) shadowconArr, CARRSIZE * sizeof(long int));
- bzero((char *) sumconArr, CARRSIZE * sizeof(long int));
-
-#ifdef TUE_TEL
- /* initialisation of dit_config 1st time */
- if(glob->dit_config) {
- init_dit_config();
- }
-#endif
-
- /* initialisation of ip_refuse 1st time */
- if(glob->ip_refuse) {
- get_ip_refuse_clients(glob);
- }
-
- /* the server runs in an infinite loop !!! */
- for ( ;; ) {
-
- /* listen on the server-port for incoming connections */
- FD_ZERO( &readfds );
- FD_SET( s, &readfds );
-
- if ((rc=select(tblsize,(fd_set *)&readfds,NULL,NULL,0))==-1) {
- if ( debug ) perror( "select" );
- continue;
- } else if ( rc == 0 ) {
- continue;
- }
-
- if ( ! FD_ISSET( s, &readfds ) )
- continue;
-
-
- /* got connection for the server: get data */
- fromlen = sizeof(from);
-
- /* increment the counter for total connections */
- glob->svc_cnt++;
-
- /* get new file-descriptors for the connection */
- if ( (ns = accept( s, (struct sockaddr *) &from, &fromlen )) == -1 ) {
-
- /* new fd could not be assigned -> log & bye */
- if ( debug ) perror( "accept" );
- if ( dosyslog ) {
- syslog (LOG_INFO,
- "problem with accept, errno=%d, %s <%08d>",
- errno, strerror(errno), glob->svc_cnt);
- }
- continue;
- }
-
- /* get time for performance log */
- gettimeofday(×tore[0], NULL);
-
- /* get client-address via DNS */
- hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr),
- sizeof(from.sin_addr.s_addr), AF_INET );
-
- /* check ip-address for ip_refuse and bye if matched */
- if ( check_ip_denial( &from, glob ) == NOTOK ) {
-
- if ( dosyslog )
- syslog( LOG_INFO, "IP-REFUSE: access denied for %s <%08d>",
- inet_ntoa( from.sin_addr ), glob->svc_cnt);
-
- close (ns);
- continue;
-
- }
-
- /* get time for performance log */
- gettimeofday(×tore[1], NULL);
-
- /* Anti-Hack-part */
-
- /* divide Host-IP-addresses in index-groups and count connection */
- idx = IP_HACK(from.sin_addr.s_addr);
- sumconArr[idx]++;
-
- /* count try if already locked and bye */
- if(conArr[idx] < 0) {
-
- shadowconArr[idx]++;
- close (ns);
- continue;
-
- }
-
- /* if not yet locked and maximum amount of connections is exeeded ->
- lock & message & bye
- */
- if (glob->comrefuse && (++conArr[idx] > glob->comrefuse->maxAccept)){
-
- if (dosyslog)
- syslog(LOG_INFO,
-"connection refused for %s (IDX=%d): %d attempts, %d cycles suspended <%08d>",
- hp ? hp->h_name : "unknown", idx, conArr[idx],
- glob->comrefuse->suspendCycle, glob->svc_cnt);
-
- /* lock for x timecycles */
- conArr[idx] = glob->comrefuse->suspendCycle;
-
- /* bye, bye baby */
- close (ns);
- continue;
-
- }
-
- /* END of Anti-Hack-part */
-
- /* Log the connection */
- if ( dosyslog ) {
- char msg[BUFSIZ];
-
- sprintf(msg, "TCP connection from %s (%s,%u)",
- (hp == NULL) ? "unknown" : hp->h_name,
- inet_ntoa( from.sin_addr ), from.sin_port );
- glob->server_connection_msg = strdup(msg);
- }
-
- if ( debug ) {
- fprintf( stderr, "connection from %s (%s)\n",
- (hp == NULL) ? "unknown" : hp->h_name,
- inet_ntoa( from.sin_addr ) );
- }
-
- glob->unknown_host = !hp;
-
- /* OK, now fork a sub-process performing the further communication
- to the client; the father-process is listening for further
- connections */
- switch( pid = fork() ) {
- case 0: /* child */
-
- /* the connection to the client should last at most OUT_TIME
- thereafter terminate connection */
- signal(SIGALRM, timeoutf);
- alarm(OUT_TIME);
-
- /* the s-filedescriptor is not needed any more */
- close( s );
-
- /* Serve client-request */
- do_queries( ns, glob , inet_ntoa( from.sin_addr ), from.sin_port, hp);
- break;
-
- case -1: /* failed */
- if (dosyslog)
- syslog (LOG_INFO, "%s <%08d>",
- glob->server_connection_msg, glob->svc_cnt);
- perror( "fork" );
- break;
-
- default: /* parent */
- /* the father-process continues listening */
- close( ns );
- if ( debug )
- fprintf( stderr, "forked child %d\n", pid );
- break;
- }
- }
- /* NOT REACHED */
-}
-/* end of function: start_server */
-
-
-/**
- ** set_socket()
- **
- ** Initialise socket to listen on and assign dedicated FD
- **/
-
-PRIVATE int set_socket(port)
-int port;
-{
- int s, one;
- struct sockaddr_in addr;
-
- if ( (s = socket( AF_INET, SOCK_STREAM, 0 )) == -1 ) {
- perror( "socket" );
- exit( 1 );
- }
-
- /* set option so clients can't keep us from coming back up */
- one = 1;
- if ( setsockopt( s, SOL_SOCKET, SO_REUSEADDR, (char *) &one,
- sizeof(one) ) < 0 ) {
- perror( "setsockopt" );
- exit( 1 );
- }
-
- /* bind to a name */
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = INADDR_ANY;
- addr.sin_port = htons( port );
- if ( bind( s, (struct sockaddr *) &addr, sizeof(addr) ) ) {
- perror( "bind" );
- exit( 1 );
- }
-
- /* listen for connections */
- if ( listen( s, 512 ) == -1 ) {
- perror( "listen" );
- exit( 1 );
- }
-
- if ( debug )
- printf( "web500gw listening on port %d\n", port );
-
- return( s );
-}
-/* end of function: set_socket */
-
-/* If a sub-daemon exists, remove from Process list */
-PRIVATE void wait4child(arg)
-int arg;
-{
- int status;
-
- if ( debug ) printf( "parent: catching child status\n" );
- while ( wait3( &status, WNOHANG | WUNTRACED, 0 ) > 0 )
- ; /* NULL */
- (void) signal( SIGCHLD, wait4child );
-}
-/* end of function: wait4child */
-
-/* set signal-handler for Anti-Hack */
-PRIVATE void hackTimer()
-{
- static time_t timer = (time_t) 0;
- time_t now = time (&now);
-
- /* re-read IP-REFUSE file if necessary */
- re_readIPrefuse( globP );
-
- /* re-read INDEX-URL file if necessary */
- re_read_index_url_rules( globP );
-
- if (!timer) {
-
- timer = now + comRefuseP->statCycle;
-
- }
-
- signal(SIGALRM, reset_conMem);
- alarm((rand() % comRefuseP->tdiff) + comRefuseP->tmin);
-
- if (now + comRefuseP->tmin > timer) {
-
- timer = put_hackStats (NULL, now) + comRefuseP->statCycle;
- *stat_slice = now;
-
- }
-
-}
-/* end of function: hackTimer */
-
-
-/* Signal-handler for Anti-Hack-code */
-PRIVATE void reset_conMem()
-{
- int i;
-
- hackTimer();
-
- for(i=0; i< 8192; i++)
- if(conArr[i] >= 0) conArr[i] = 0;
- else {
- if(++conArr[i] == 0){
- if (dosyslog)
- syslog(LOG_INFO, "connection accept resumed for IDX=%d; \
-%u connection attempts during suspension <%08d>", i, shadowconArr[i],
- globP->svc_cnt);
- shadowconArr[i] = 0;
- }
- }
-
-}
-/* end of function: reset_conMem */
-
-
-/* regular output of the access-statistic */
-PUBLIC time_t put_hackStats (fp, now)
-FILE *fp;
-time_t now;
-{
- int i, bereiche;
- int is_html = (fp != NULL);
- char *eol = is_html ? "<BR>\n" : "\n";
- unsigned long int gesamt = 0;
-
- if (!now) now = time (&now);
-
- if (!fp) fp = fopen (comRefuseP->statFile, "w");
-
- if (fp) {
-
- if (is_html) fprintf (fp, "<PRE><BR>\n");
-
- fprintf (fp, "Access-Statistic TWEB%s", eol);
- fprintf (fp, "======================%s", eol);
- if (comRefuseP) fprintf (fp, "FILE : %s%s", comRefuseP->statFile, eol);
- fprintf (fp, "START: %s%s", format_time (*stat_slice), eol);
- fprintf (fp, "END : %s%s%s%s", format_time (now), eol, eol, eol);
-
- for (i = 0, bereiche = 0; i < CARRSIZE; i++) {
-
- if(sumconArr[i]) {
- fprintf (fp, "IP-IDX %5d: %8lu%s", i, sumconArr[i], eol);
- gesamt += sumconArr[i];
- bereiche++;
- }
-
- }
- if(bereiche > 1) {
- fprintf (fp, "----------------------%s", eol);
- fprintf (fp, "Total: %8lu ( from %d IP-Ranges )%s",
- gesamt, bereiche, eol);
- }
-
- if (is_html) {
-
- fprintf (fp, "</PRE><BR>\n");
-
- } else {
-
- bzero((char *) sumconArr, CARRSIZE * sizeof(long int));
- fprintf (fp, "\n");
- fclose (fp);
-
- }
- }
-
- return (now);
-
-} /* put_hackStats */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* server.h... *
-* *
-* Funktion:..WorldWideWeb-X.500-Gateway - Server-Funktions *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* December 31 1998 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: server.h,v 1.6 1999/09/10 15:01:19 zrnsk01 Exp $
- *
- */
-
-#ifndef _SERVER_
-#define _SERVER_
-
-#include "server_exp.h"
-#include "queries_exp.h"
-#include "support_exp.h"
-
-#ifdef TUE_TEL
-#include "tueTel_exp.h"
-#endif
-
-
-#define CARRSIZE 8192
-
-#define MASK_30 0x40000000
-#define MASK_20 0x00100000
-#define MASK_17 0x00020000
-#define MASK_10 0x00000ffc
-
-#define IP_HACK(x) ((((MASK_30 & (x)) != 0) * 4096) + \
- (((MASK_20 & (x)) != 0) * 2048) + \
- (((MASK_17 & (x)) != 0) * 1024) + \
- ((MASK_10 & (x)) >> 2))
-
-/* three integer-arrays to count connections */
-int conArr[CARRSIZE];
-unsigned long int shadowconArr[CARRSIZE];
-unsigned long int sumconArr[CARRSIZE];
-
-/* the signal-handler */
-PRIVATE void reset_conMem();
-
-/* set the Alarm-Timer */
-PRIVATE void hackTimer();
-
-PRIVATE int set_socket();
-PRIVATE void wait4child();
-
-/* A pointer to the Anti-Hack-infos in the Glob-structure */
-COMREFUSE *comRefuseP = NULL;
-time_t *stat_slice;
-
-
-#endif /* _SERVER_ */
-
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* server_exp.h... *
-* *
-* Function:..WorldWideWeb-X.500-Gateway - Server-Funktions *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* February 2 1996 Z D D V V *
-* Last modification: Z D D V V *
-* December 31 1996 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: server_exp.h,v 1.6 1999/09/10 15:01:19 zrnsk01 Exp $
- *
- */
-
-#ifndef _SERVER_EXP_
-#define _SERVER_EXP_
-
-/* Statistic Output */
-extern time_t put_hackStats();
-extern void start_server();
-
-#endif /* _SERVER_EXP_ */
-
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* strng.c.... *
-* *
-* Function:..String Handling Functions *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* February 13 1996 Z D D V V *
-* Last modification: Z D D V V *
-* November 3 1998 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: strng.c,v 1.6 1999/09/10 15:01:19 zrnsk01 Exp $
- *
- */
-
-#include "strng_exp.h"
-#include "tgeneral.h"
-
-/*
- * Convert string to integer by means of a dispatcherlist
- * if string is not in the dispatcher -> return default
- */
-
-PUBLIC int cnvt_str2int (stringVal, dispatcher, defaultVal)
-STRDISP_P dispatcher;
-int defaultVal;
-char *stringVal;
-{
- int retVal = defaultVal;
- STRDISP_P disp;
-
- for (disp = dispatcher; disp->stringVal; disp++) {
-
- if (!strncmp (stringVal, disp->stringVal, disp->abbr)) {
-
- retVal = disp->intVal;
- break;
-
- }
- }
-
- return (retVal);
-
-} /* cnvt_str2int */
-
-
-/*
- * Truncate characters at the beginning of a string
- */
-
-PUBLIC char * trimleft (s, what)
-char *s, *what;
-{
-
- return (s + strspn (s, what));
-
-} /* trimleft */
-
-
-/*
- * Truncate characters at the end of a string
- */
-
-PUBLIC char * trimright (s, what)
-char *s, *what;
-{
- char *tmp = s + strlen (s) - 1;
-
- while ((tmp >= s) && strchr (what, *tmp)) *tmp-- = '\0';
-
- return (s);
-
-} /* trimright */
-
-
-/*
- * Truncate characters at the beginning and end of a string
- */
-
-PUBLIC char * trim (s, what)
-char *s, *what;
-{
- (void) trimright (s, what);
- return (trimleft (s, what));
-
-} /* trim */
-
-
-/*
- * Convert a string to lower-case "in place"
- * uses tolower()
- */
-
-PUBLIC char *str_tolower (source)
-char *source;
-{
- char *target = source;
-
- for (; *target; target++) *target = tolower (*target);
- return (source);
-
-} /* str_tolower */
-
-
-/*
- * Convert a string to upper-case "in place"
- * uses toupper()
- */
-
-PUBLIC char *str_toupper (source)
-char *source;
-{
- char *target = source;
-
- for (; *target; target++){
- *target = toupper (*target);
-
- /* Patch fuer Umlaute */
- if(*target == 'ä') *target = 'Ä';
- else if(*target == 'ö') *target = 'Ö';
- else if(*target == 'ü') *target = 'Ü';
- }
- return (source);
-
-} /* str_toupper */
-
-
-/*
- * Substitute a character in a string by another
- */
-
-PUBLIC char *tr1 (source, from, to)
-char *source;
-char from, to;
-{
- char *target = source - 1;
-
- while ( ( target = strchr( ++target, from )) ) *target = to;
-
- return (source);
-
-} /* tr1 */
-
-
-PUBLIC int chrcnt(string, c)
-char *string;
-char *c;
-{
- int count=0;
-
- string--;
- while( ( string = strpbrk(string+1, c)) )
- count++;
- return(count);
-}
-/* end of function: chrcnt */
-
-
-PUBLIC int
-qSortByString( a, b )
-char **a, **b;
-{
- return strcmp( *a, *b );
-}
-/* end of function: qSortByString */
-
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* strng_exp.h *
-* *
-* Function:..String Handling Functions *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* February 13 1996 Z D D V V *
-* Last modification: Z D D V V *
-* November 3 1998 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: strng_exp.h,v 1.6 1999/09/10 15:01:19 zrnsk01 Exp $
- *
- */
-
-#ifndef __STRNG_EXP__
-#define __STRNG_EXP__
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-
-
-
-/*
- * Structures for the offered Funktions
- */
-
-typedef struct _str2intDispatch {
-
- char *stringVal;
- int abbr,
- intVal;
-
- } STRDISP, *STRDISP_P;
-
-
-/*
- * The "offered" Funktions
- */
-
-/* Conversion to upper/lower case in the whole string */
-char *str_tolower (/* char *string */);
-char *str_toupper (/* char *string */);
-
-/* Convert string to integer by means of a dispatcherlist */
-/* if string is not in the dispatcher -> return default */
-int cnvt_str2int (/* string, dispatcher, default */);
-
-/* Truncate characters at the beginning and end of a string */
-char *trimleft (/* char *s, char *what */);
-char *trimright (/* char *s, char *what */);
-char *trim (/* char *s, char *what */);
-
-/* A special WHAT: whitespaces */
-#define WSPACE "\n\r\t "
-
-/* Substitute a character in a string to another */
-char *tr1 (/* char *source, char from, char to */);
-
-/* Count the named characters of string2 in string1 */
-int chrcnt (/*String1, String2*/);
-
-
-/* Compare by string values in qsort() */
-int qSortByString (/* char **StringP1, char **StringP2 */);
-
-#endif
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* support.c.. *
-* *
-* Function:..WorldWideWeb-X.500-Gateway - Supporting Routines *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* September 7 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: support.c,v 1.6 1999/09/10 15:01:20 zrnsk01 Exp $
- *
- */
-
-#include "tgeneral.h"
-#include "tglobal.h"
-#include "init_exp.h"
-#include "support.h"
-
-/*
- * Utilities for dealing with HTML junk
- */
-
-char hex[17] = "0123456789abcdef";
-char buffer[1024];
-
-PUBLIC char * hex_decode (in)
-char *in;
-{
- char b, c;
- int q = 0;
- char *out = in;
-
- while (*in) {
- if (*in == '?') /* start search */
- q = 1;
- if (*in == '%') { /* Hex escape */
- in++;
- if(!(c = *in++)) break;
- b = from_hex(c);
- if(!(c = *in++)) break;
- *out++ = (b<<4) + from_hex(c);
- } else if (q && *in == '+') {
- /* '+' is legal in path, in search it's a ' ' */
- *out++ = ' ';
- in++;
- } else {
- *out++ = *in++;
- }
- }
- *out = '\0';
- return (out);
-}
-/* end of function: hex_decode */
-
-/* decode in search (for do_modify) */
-
-PUBLIC char * hex_qdecode (in)
-char *in;
-{
- char b, c;
- char *out = in;
-
- while (*in) {
- if (*in == '%') { /* Hex escape */
- in++;
- if(!(c = *in++)) break;
- b = from_hex(c);
- if(!(c = *in++)) break;
- *out++ = (b<<4) + from_hex(c);
- } else if (*in == '+') { /* we are in search, so: '+' -> ' ' */
- *out++ = ' ';
- in++;
- } else {
- *out++ = *in++;
- }
- }
- *out = '\0';
- return (out);
-}
-/* end of function: hex_qdecode */
-
-PUBLIC char * form_encode (in)
-char *in;
-{
- char *out = buffer;
-
- /* bzero(out, 1024); */
- while (*in) {
- if (*in == '"' || *in == '>' ) {
- *out++ = '\\';
- }
- *out++ = *in++;
- }
- *out = '\0';
-
- /* fprintf( stderr, "returning - esc: %s.\n", buffer); */
- return (buffer);
-}
-/* end of function: form_encode */
-
-/* gtime(): the inverse of localtime().
- This routine was supplied by Mike Accetta at CMU many years ago.
- */
-
-int dmsize[] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-#define dysize(y) \
- (((y) % 4) ? 365 : (((y) % 100) ? 366 : (((y) % 400) ? 365 : 366)))
-
-#define YEAR(y) ((y) >= 100 ? (y) : (y) + 1900)
-
-PRIVATE time_t gtime (tm)
-struct tm *tm;
-{
- register int i,
- sec,
- mins,
- hour,
- mday,
- mon,
- year;
- register long result;
-
- if ((sec = tm -> tm_sec) < 0 || sec > 59
- || (mins = tm -> tm_min) < 0 || mins > 59
- || (hour = tm -> tm_hour) < 0 || hour > 24
- || (mday = tm -> tm_mday) < 1 || mday > 31
- || (mon = tm -> tm_mon + 1) < 1 || mon > 12)
- return ((long) -1);
- if (hour == 24) {
- hour = 0;
- mday++;
- }
- year = YEAR (tm -> tm_year);
- result = 0L;
- for (i = 1970; i < year; i++)
- result += dysize (i);
- if (dysize (year) == 366 && mon >= 3)
- result++;
- while (--mon)
- result += dmsize[mon - 1];
- result += mday - 1;
- result = 24 * result + hour;
- result = 60 * result + mins;
- result = 60 * result + sec;
- return result;
-}
-/* end of function: gtime */
-
-PUBLIC char * format_date (s, format)
-char **s;
-char *format;
-{
-/* PATCHED by /KSp, 94/04/29 */
- static char date[256];
-/* ^^^^^^ */
-/* END PATCH */
-
- struct tm tm, *ntm;
- time_t t;
-
-
- tm.tm_year = 10*((*s)[0] - '0') + ((*s)[1] - '0');
- tm.tm_mon = 10*((*s)[2] - '0') + ((*s)[3] - '0') - 1;
- tm.tm_mday = 10*((*s)[4] - '0') + ((*s)[5] - '0');
- tm.tm_hour = 10*((*s)[6] - '0') + ((*s)[7] - '0');
- tm.tm_min = 10*((*s)[8] - '0') + ((*s)[9] - '0');
- tm.tm_sec = 10*((*s)[10] - '0') + ((*s)[11] - '0');
-
-/* PATCHED for HPUX by /KSp, 94/04/28 */
-
- tm.tm_isdst = 0;
-
-#if !defined(__hpux) && !defined(__linux__) && !defined(__sun)
- tm.tm_gmtoff = 0;
-#endif
-
-/* END PATCH */
-
- t = gtime(&tm);
- ntm = gmtime(&t);
- strftime(date, 256, format, ntm);
- return (date);
-}
-/* end of function: format_date */
-
-PUBLIC char * friendly_dn (dn, glob)
-char *dn;
-GLOB_STRUCT *glob;
-{
-/* PATCHED BY /KSp, 94/04/29 */
- /* static char fufn[1024], **s; */
-/* ^^^^^^ */
-/* END PATCH */
-
-/* Again patched by /KSp, 97/01/25: dynamic mem-allocation */
- char *fufn;
-
- if ( ( fufn = calloc( 1, BUFSIZ )) ) {
-
- if (strlen(dn) == 0) {
- strcpy( fufn, glob->la[77] );
- } else {
-
- int i = 0;
- char **s;
-
- s = ldap_explode_dn( dn, 1 );
- while (s[i+1]) {
- strcat( fufn, s[i++] );
- strcat( fufn, ", " );
- }
- strcat( fufn, ldap_friendly_name( glob->friendlyfile, s[i], &fm ));
- }
- }
-
- return (fufn);
-}
-/* end of function: friendly_dn */
-
-
-PUBLIC char * format_time (whatTime)
-time_t whatTime;
-{
- time_t timer;
- static char theTime[_TIMEOUT_LEN+1];
-
- timer = whatTime ? whatTime : time (&timer);
- strftime (theTime, (_TIMEOUT_LEN + 1), _LOG_TIME, localtime (&timer));
-
- return (theTime);
-
-} /* end of function: format_time */
-
-PUBLIC char * strQuoteChr(string, c)
-char *string;
-char c;
-{
- char *cPtr;
- int inQuote = FALSE;
-
- cPtr = string;
- while(*cPtr) {
- if( *cPtr == '\"')
- inQuote = ( (inQuote == TRUE) ? FALSE : TRUE );
- if( (*cPtr == c) && (inQuote == FALSE) )
- return(cPtr);
- cPtr++;
- }
-
- return(NULL);
-}
-/* end of function: strQuoteChr */
-
-PUBLIC char * strrQuoteChr(string, c)
-char *string;
-char c;
-{
- char *cPtr;
- int inQuote = FALSE;
-
- cPtr = string + strlen(string) - 1;
- while(cPtr >= string) {
- if( *cPtr == '\"')
- inQuote = ( (inQuote == TRUE) ? FALSE : TRUE );
- if( (*cPtr == c) && (inQuote == FALSE) )
- return(cPtr);
- cPtr--;
- }
-
- return(NULL);
-}
-/* end of function: strrQuoteChr */
-
-
-PUBLIC void disp_file(glob, filename, fp)
-GLOB_STRUCT *glob;
-char *filename;
-FILE *fp;
-{
-char buf[4096];
-FILE *fp2;
- if(filename && (fp2 = fopen(filename, "r" ))) {
- while ( fgets(buf, 4095, fp2) != NULL )
- fprintf( fp, "%s",buf);
- fclose(fp2);
- }
-
- /* Copyright-Zeile */
- if(filename == glob->footer ||
- (glob->basedn && filename == glob->basedn->foot))
- fprintf( fp, glob->la[99],glob->la[101], copyright );
-}
-/* end of function: disp_file */
-
-
-PUBLIC int dn_cmp(dn1, dn2)
-char *dn1, *dn2;
-{
- do {
- while(*dn1 == ' ' || *dn1 == '"')
- dn1++;
- while(*dn2 == ' ' || *dn2 == '"')
- dn2++;
- if(!*dn1 && !*dn2)
- return(FALSE); /* equality */
- } while(tolower(*dn1++) == tolower(*dn2++));
- return(TRUE);
-}
-/* end of function: dn_cmp */
-
-
-/*
- * dn_cmp_parts()
- *
- * comparison of dns by rdn parts. in case of unmatched the part(s) which
- * matched can be returned (matched not NULL)
- *
- * input:
- *
- * - dn1 (in url format)
- * - dn2 ( " )
- * - matched (pointer to dynamically allocatable string, or NULL)
- *
- * output:
- *
- * - DN_EQUAL | DN_LESS | DN_GREATER | DN_UNMATCHED (with matched allocated)
- */
-
-PUBLIC int
-dn_cmp_parts( dn1, dn2, matched )
-char *dn1;
-char *dn2;
-char **matched;
-{
- char **dn1arr = dn2charray( dn1 );
- char **dn2arr = dn2charray( dn2 );
- int idx;
- int domatch = TRUE;
- int result = DN_EQUAL;
-
- for ( idx = 0; dn1arr[idx] && dn2arr[idx]; idx++ ) {
-
- if ( strcasecmp( dn1arr[idx], dn2arr[idx] )) {
-
- domatch = FALSE;
- break;
-
- }
- }
-
- /* what was the result */
-
- if ( !domatch ) {
-
- if ( matched ) {
- char buf[BUFSIZ];
- char buf2[BUFSIZ];
- int idx2;
-
- *buf = '\0';
-
- for ( idx2 = 0; idx2 < idx; idx2++ ) {
-
- strcpy( buf2, buf );
- sprintf( buf, "%s,%s", dn1arr[idx2], buf2 );
-
- }
- trimright( buf, "," );
-
- *matched = strdup( buf );
-
- }
-
- result = DN_UNMATCHED;
-
- } else if ( dn1arr[idx] ) result = DN_GREATER;
- else if ( dn2arr[idx] ) result = DN_LESS;
-
- charray_free( dn1arr ); charray_free( dn2arr );
-
- return( result );
-
-} /* dn_cmp_parts */
-
-
-
-/*
- * Comparison of substring lists
- */
-
-PUBLIC int strlstcmp (s1, s2, sep)
-char *s1, *s2;
-char sep;
-{
- int retCode = FALSE;
- char *target;
- char *source;
- char *idx, *idx2;
- char tmpChar;
-
- if ( !s1 || !s2 )
- return( FALSE );
-
- target = str_tolower (strdup (s1));
- source = str_tolower (strdup (s2));
- idx = source;
-
- while (idx && (idx2 = strchr (idx+1, sep))) {
-
- tmpChar = *(++idx2); *idx2 = '\0';
- if (strstr (target, idx)) {
-
- retCode = TRUE;
- break;
-
- }
-
- *(idx2) = tmpChar;
- idx = --idx2;
-
- }
-
- free (source);
- free (target);
- return (retCode);
-
-}
-/* end of function: strlstcmp */
-
-PUBLIC char *hex_html_encode(string, flag)
-char *string;
-int flag; /* 0->hex 1->html */
-{
- static char strbuf[10*BUFSIZ];
- char *strptr;
-
- *strbuf = '\0';
- for(strptr = string; *strptr; strptr++){
- /* 200 a -> ä fuer aouAOU */
- if((flag==1) && (((int)*strptr&255)==200)) {
- if(strchr("aouAOU", *(strptr+1))) {
- sprintf(strbuf, "%s&%cuml;", strbuf, *++strptr);
- continue;
- }
- }
-
- /* &#xxx; Handling-Patch */
- if((flag==1) && (((int)*strptr&255)>=160)) {
- sprintf(strbuf, "%s&#%d;", strbuf, ((int)*strptr&255));
- continue;
- }
- /* end Patch */
-
- if(!encoding_tbl[(int)*strptr&255][flag]) {
- sprintf(strbuf, "%s%c", strbuf, *strptr);
- } else {
- strcat(strbuf, encoding_tbl[(int)*strptr&255][flag]);
- }
- }
- return(strbuf);
-}
-/* end of function: hex_html_encode */
-
-/* Strips basecount+1 characters of type target at the end of an RDN */
-PUBLIC char *dnrcut(rdn, target, basecount)
-char *rdn;
-char *target;
-int basecount;
-{
- static char buf[BUFSIZ];
- char *strptr;
- int rdncount, morecount;
-
- rdncount = chrcnt(rdn, target);
- if( (morecount = (rdncount - basecount)) > 0) {
- strcpy(buf, rdn);
- strptr = buf-1;
- while(morecount--) {
- strptr = strpbrk(strptr+1, target);
- }
- *strptr = '\0';
- } else *buf = '\0';
- return(buf);
-}
-/* end of function: dnrcut */
-
-PUBLIC char **dn2charray(dn)
-char *dn;
-{
- char *dnbuf, *strptr, **a=NULL;
-
- if ( !dn || !*dn ) {
-
- a = (char **) ch_calloc( 1, sizeof( char ** ));
- return( a );
-
- }
-
- dnbuf = strdup(dn);
- do {
- strptr = strrQuoteChr(dnbuf, ',');
- if(strptr) {
- *strptr++ = '\0';
-/*
- while(*strptr == ' ')
- strptr++;
-*/
- strptr = trim( strptr, " " );
- }
- charray_add( &a, strptr ? strptr : trim( dnbuf, " " ));
- } while(strptr);
- free(dnbuf);
- return(a);
-}
-/* end of function: dn2charray */
-
-
-/* get the parent DN for a given one */
-PUBLIC char *
-get_parentDN( dn )
-char *dn;
-{
- char **a = NULL;
- char tmp[BUFSIZ];
-
- a = dn2charray( dn );
- *tmp = *(tmp + 1) = '\0';
-
- if ( a ) {
- char **rdnH;
-
- /* we have to re-build the DN beginning at the last array element */
- for ( rdnH = a; *rdnH; rdnH++ )
- ;
-
- /* re-build DN from it's parts */
- rdnH--; rdnH--;
- for ( ; rdnH >= a; rdnH-- ) {
-
- sprintf( tmp, "%s,%s", tmp, *rdnH );
-
- }
-
- charray_free( a );
-
- }
-
- /* ignore a leading ',' */
- return( strdup( tmp + 1 ));
-
-} /* get_parentDN */
-
-
-PUBLIC char *elapsed(firsttime, secondtime)
-struct timeval firsttime;
-struct timeval secondtime;
-{
- long int elapsedmicrosec, elapsedsec;
- char elapsed_string[BUFSIZ];
-
- elapsedsec = secondtime.tv_sec - firsttime.tv_sec;
- elapsedmicrosec = secondtime.tv_usec - firsttime.tv_usec;
- if(elapsedmicrosec < 0) {
- elapsedmicrosec += 1000000;
- elapsedsec -= 1;
- }
- if(elapsedsec > 1000){
- elapsedsec = 0;
- elapsedmicrosec = 0;
- }
- sprintf(elapsed_string, "%ld.%.6ld", elapsedsec, elapsedmicrosec);
- return(strdup(elapsed_string));
-}
-/* end of function: elapsed */
-
-
-/* performance-log on exit */
-PUBLIC int exit_tweb(rc)
-int rc;
-{
- struct timeval secondtime;
-
- gettimeofday(&secondtime, NULL);
- if(!secondtime.tv_sec || !timestore[0].tv_sec) exit(rc);
-
- if (dosyslog)
- syslog (LOG_INFO, "performance: %s#%s#%s#%s#%s#%s#%d seconds <%08d>",
- elapsed(timestore[0], secondtime), elapsed(timestore[0],
- timestore[1]), elapsed(timestore[1], timestore[2]),
- elapsed(timestore[2], timestore[3]),
- elapsed(timestore[3], items_displayed ? timestore[4] : secondtime),
- items_displayed ? elapsed(timestore[4], secondtime) : "",
- items_displayed, globP->svc_cnt);
- exit(rc);
-}
-/* end of function: exit_tweb */
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* support.h.. *
-* *
-* Function:..WorldWideWeb-X.500-Gateway - Support-Functions *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* September 7 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: support.h,v 1.6 1999/09/10 15:01:20 zrnsk01 Exp $
- *
- */
-
-#ifndef _SUPPORT_
-#define _SUPPORT_
-
-#include "support_exp.h"
-#include "charray_exp.h"
-#include "ch_malloc_exp.h"
-
-
-/* Array for translation */
-/* 0: HEX; 1: uml (not used); 2: flatten */
-
-char *encoding_tbl[257][3] = {
-/* 0 \0 */ { "%00" , "", NULL },
-/* 1 \ 1 */ { "%01" , "\ 1", NULL },
-/* 2 \ 2 */ { "%02" , "\ 2", NULL },
-/* 3 \ 3 */ { "%03" , "\ 3", NULL },
-/* 4 \ 4 */ { "%04" , "\ 4", NULL },
-/* 5 \ 5 */ { "%05" , "\ 5", NULL },
-/* 6 \ 6 */ { "%06" , "\ 6", NULL },
-/* 7 \a */ { "%07" , "\a", NULL },
-/* 8 \b */ { "%08" , "\b", NULL },
-/* 9 \t */ { "%09" , " ", NULL },
-/* 10 \n */ { "%0a" , "\n", NULL },
-/* 11 \v */ { "%0b" , "\v", NULL },
-/* 12 \f */ { "%0c" , "\f", NULL },
-/* 13 \r */ { "%0d" , "\r", NULL },
-/* 14 \ e */ { "%0e" , "\ e", NULL },
-/* 15 \ f */ { "%0f" , "\ f", NULL },
-/* 16 \10 */ { "%10" , "\10", NULL },
-/* 17 \11 */ { "%11" , "\11", NULL },
-/* 18 \12 */ { "%12" , "\12", NULL },
-/* 19 \13 */ { "%13" , "\13", NULL },
-/* 20 \14 */ { "%14" , "\14", NULL },
-/* 21 \15 */ { "%15" , "\15", NULL },
-/* 22 \16 */ { "%16" , "\16", NULL },
-/* 23 \17 */ { "%17" , "\17", NULL },
-/* 24 \18 */ { "%18" , "\18", NULL },
-/* 25 \19 */ { "%19" , "\19", NULL },
-/* 26 \1a */ { "%1a" , "\1a", NULL },
-/* 27 \e */ { "%1b" , "\e", NULL },
-/* 28 \1c */ { "%1c" , "\1c", NULL },
-/* 29 \1d */ { "%1d" , "\1d", NULL },
-/* 30 \1e */ { "%1e" , "\1e", NULL },
-/* 31 \1f */ { "%1f" , "\1f", NULL },
-/* 32 */ { "%20" , " ", NULL },
-/* 33 ! */ { "%21" , "!", NULL },
-/* 34 " */ { "%22" , """, NULL },
-/* 35 # */ { "%23" , "#", NULL },
-/* 36 $ */ { NULL, NULL, NULL },
-/* 37 % */ { "%25" , "%", NULL },
-/* 38 & */ { "%26" , "&", NULL },
-/* 39 ' */ { "%27" , "'", NULL },
-/* 40 ( */ { "%28" , "(", NULL },
-/* 41 ) */ { "%29" , ")", NULL },
-/* 42 * */ { "%2a" , "*", NULL },
-/* 43 + */ { "%2b" , "+", NULL },
-/* 44 , */ { "%2c" , ",", NULL },
-/* 45 - */ { NULL, NULL, NULL },
-/* 46 . */ { NULL, NULL, NULL },
-/* 47 / */ { "%2f" , "/", NULL },
-/* 48 0 */ { NULL, NULL, NULL },
-/* 49 1 */ { NULL, NULL, NULL },
-/* 50 2 */ { NULL, NULL, NULL },
-/* 51 3 */ { NULL, NULL, NULL },
-/* 52 4 */ { NULL, NULL, NULL },
-/* 53 5 */ { NULL, NULL, NULL },
-/* 54 6 */ { NULL, NULL, NULL },
-/* 55 7 */ { NULL, NULL, NULL },
-/* 56 8 */ { NULL, NULL, NULL },
-/* 57 9 */ { NULL, NULL, NULL },
-/* 58 : */ { "%3a" , ":", NULL },
-/* 59 ; */ { "%3b" , ";", NULL },
-/* 60 < */ { "%3c" , "<", NULL },
-/* 61 = */ { "%3d" , "=", NULL },
-/* 62 > */ { "%3e" , ">", NULL },
-/* 63 ? */ { "%3f" , "?", NULL },
-/* 64 @ */ { "%40" , "@", NULL },
-/* 65 A */ { NULL, NULL, NULL },
-/* 66 B */ { NULL, NULL, NULL },
-/* 67 C */ { NULL, NULL, NULL },
-/* 68 D */ { NULL, NULL, NULL },
-/* 69 E */ { NULL, NULL, NULL },
-/* 70 F */ { NULL, NULL, NULL },
-/* 71 G */ { NULL, NULL, NULL },
-/* 72 H */ { NULL, NULL, NULL },
-/* 73 I */ { NULL, NULL, NULL },
-/* 74 J */ { NULL, NULL, NULL },
-/* 75 K */ { NULL, NULL, NULL },
-/* 76 L */ { NULL, NULL, NULL },
-/* 77 M */ { NULL, NULL, NULL },
-/* 78 N */ { NULL, NULL, NULL },
-/* 79 O */ { NULL, NULL, NULL },
-/* 80 P */ { NULL, NULL, NULL },
-/* 81 Q */ { NULL, NULL, NULL },
-/* 82 R */ { NULL, NULL, NULL },
-/* 83 S */ { NULL, NULL, NULL },
-/* 84 T */ { NULL, NULL, NULL },
-/* 85 U */ { NULL, NULL, NULL },
-/* 86 V */ { NULL, NULL, NULL },
-/* 87 W */ { NULL, NULL, NULL },
-/* 88 X */ { NULL, NULL, NULL },
-/* 89 Y */ { NULL, NULL, NULL },
-/* 90 Z */ { NULL, NULL, NULL },
-/* 91 [ */ { "%5b" , "[", NULL },
-/* 92 \ */ { "%5c" , "\\", NULL },
-/* 93 ] */ { "%5d" , "]", NULL },
-/* 94 ^ */ { "%5e" , "^", NULL },
-/* 95 _ */ { NULL, NULL, NULL },
-/* 96 ` */ { "%60" , "`", NULL },
-/* 97 a */ { NULL, NULL, NULL },
-/* 98 b */ { NULL, NULL, NULL },
-/* 99 c */ { NULL, NULL, NULL },
-/* 100 d */ { NULL, NULL, NULL },
-/* 101 e */ { NULL, NULL, NULL },
-/* 102 f */ { NULL, NULL, NULL },
-/* 103 g */ { NULL, NULL, NULL },
-/* 104 h */ { NULL, NULL, NULL },
-/* 105 i */ { NULL, NULL, NULL },
-/* 106 j */ { NULL, NULL, NULL },
-/* 107 k */ { NULL, NULL, NULL },
-/* 108 l */ { NULL, NULL, NULL },
-/* 109 m */ { NULL, NULL, NULL },
-/* 110 n */ { NULL, NULL, NULL },
-/* 111 o */ { NULL, NULL, NULL },
-/* 112 p */ { NULL, NULL, NULL },
-/* 113 q */ { NULL, NULL, NULL },
-/* 114 r */ { NULL, NULL, NULL },
-/* 115 s */ { NULL, NULL, NULL },
-/* 116 t */ { NULL, NULL, NULL },
-/* 117 u */ { NULL, NULL, NULL },
-/* 118 v */ { NULL, NULL, NULL },
-/* 119 w */ { NULL, NULL, NULL },
-/* 120 x */ { NULL, NULL, NULL },
-/* 121 y */ { NULL, NULL, NULL },
-/* 122 z */ { NULL, NULL, NULL },
-/* 123 { */ { "%7b" , "{", NULL },
-/* 124 | */ { "%7c" , "|", NULL },
-/* 125 } */ { "%7d" , "}", NULL },
-/* 126 ~ */ { "%7e" , "~", NULL },
-/* 127 \7f */ { "%7f" , "\7f", NULL },
-/* 128 \80 */ { "%80" , "\80", NULL },
-/* 129 \81 */ { "%81" , "\81", NULL },
-/* 130 \82 */ { "%82" , "\82", NULL },
-/* 131 \83 */ { "%83" , "\83", NULL },
-/* 132 \84 */ { "%84" , "\84", NULL },
-/* 133 \85 */ { "%85" , "\85", NULL },
-/* 134 \86 */ { "%86" , "\86", NULL },
-/* 135 \87 */ { "%87" , "\87", NULL },
-/* 136 \88 */ { "%88" , "\88", NULL },
-/* 137 \89 */ { "%89" , "\89", NULL },
-/* 138 \8a */ { "%8a" , "\8a", NULL },
-/* 139 \8b */ { "%8b" , "\8b", NULL },
-/* 140 \8c */ { "%8c" , "\8c", NULL },
-/* 141 \8d */ { "%8d" , "\8d", NULL },
-/* 142 \8e */ { "%8e" , "\8e", NULL },
-/* 143 \8f */ { "%8f" , "\8f", NULL },
-/* 144 \90 */ { "%90" , "\90", NULL },
-/* 145 \91 */ { "%91" , "\91", NULL },
-/* 146 \92 */ { "%92" , "\92", NULL },
-/* 147 \93 */ { "%93" , "\93", NULL },
-/* 148 \94 */ { "%94" , "\94", NULL },
-/* 149 \95 */ { "%95" , "\95", NULL },
-/* 150 \96 */ { "%96" , "\96", NULL },
-/* 151 \97 */ { "%97" , "\97", NULL },
-/* 152 \98 */ { "%98" , "\98", NULL },
-/* 153 \99 */ { "%99" , "\99", NULL },
-/* 154 \9a */ { "%9a" , "\9a", NULL },
-/* 155 \9b */ { "%9b" , "\9b", NULL },
-/* 156 \9c */ { "%9c" , "\9c", NULL },
-/* 157 \9d */ { "%9d" , "\9d", NULL },
-/* 158 \9e */ { "%9e" , "\9e", NULL },
-/* 159 \9f */ { "%9f" , "\9f", NULL },
-/* 160 */ { "%a0" , "", NULL },
-/* 161 */ { "%a1" , "", NULL },
-/* 162 */ { "%a2" , "", NULL },
-/* 163 */ { "%a3" , "", NULL },
-/* 164 */ { "%a4" , "", NULL },
-/* 165 */ { "%a5" , "", NULL },
-/* 166 */ { "%a6" , "", NULL },
-/* 167 */ { "%a7" , "", NULL },
-/* 168 */ { "%a8" , "", NULL },
-/* 169 */ { "%a9" , "", NULL },
-/* 170 */ { "%aa" , "", NULL },
-/* 171 */ { "%ab" , "", NULL },
-/* 172 */ { "%ac" , "", NULL },
-/* 173 */ { "%ad" , "", NULL },
-/* 174 */ { "%ae" , "", NULL },
-/* 175 */ { "%af" , "", NULL },
-/* 176 */ { "%b0" , "", NULL },
-/* 177 */ { "%b1" , "", NULL },
-/* 178 */ { "%b2" , "", NULL },
-/* 179 */ { "%b3" , "", NULL },
-/* 180 */ { "%b4" , "", NULL },
-/* 181 */ { "%b5" , "", NULL },
-/* 182 */ { "%b6" , "", NULL },
-/* 183 */ { "%b7" , "", NULL },
-/* 184 */ { "%b8" , "", NULL },
-/* 185 */ { "%b9" , "", NULL },
-/* 186 */ { "%ba" , "", NULL },
-/* 187 */ { "%bb" , "", NULL },
-/* 188 */ { "%bc" , "", NULL },
-/* 189 */ { "%bd" , "", NULL },
-/* 190 */ { "%be" , "", NULL },
-/* 191 */ { "%bf" , "", NULL },
-/* 192 */ { "%c0" , "À", "A" },
-/* 193 */ { "%c1" , "Á", "A" },
-/* 194 */ { "%c2" , "Â", "A" },
-/* 195 */ { "%c3" , "Ã", "A" },
-/* 196 */ { "%c4" , "Ä", "Ae" },
-/* 197 */ { "%c5" , "Å", "A" },
-/* 198 */ { "%c6" , "Æ", "AE" },
-/* 199 */ { "%c7" , "Ç", "C" },
-/* 200 */ { "%c8" , "È", "E" },
-/* 201 */ { "%c9" , "É", "E" },
-/* 202 */ { "%ca" , "Ê", "E" },
-/* 203 */ { "%cb" , "Ë", "E" },
-/* 204 */ { "%cc" , "Ì", "I" },
-/* 205 */ { "%cd" , "Í", "I" },
-/* 206 */ { "%ce" , "Î", "I" },
-/* 207 */ { "%cf" , "Ï", "I" },
-/* 208 */ { "%d0" , "Ð", "Eth" },
-/* 209 */ { "%d1" , "Ñ", "N" },
-/* 210 */ { "%d2" , "Ò", "O" },
-/* 211 */ { "%d3" , "Ó", "O" },
-/* 212 */ { "%d4" , "Ô", "O" },
-/* 213 */ { "%d5" , "Õ", "O" },
-/* 214 */ { "%d6" , "Ö", "Oe" },
-/* 215 */ { "%d7" , "x", "x" },
-/* 216 */ { "%d8" , "Ø", "O" },
-/* 217 */ { "%d9" , "Ù", "U" },
-/* 218 */ { "%da" , "Ú", "U" },
-/* 219 */ { "%db" , "Û", "U" },
-/* 220 */ { "%dc" , "Ü", "Ue" },
-/* 221 */ { "%dd" , "Ý", "Y" },
-/* 222 */ { "%de" , "Þ", NULL },
-/* 223 */ { "%df" , "ß", "ss" },
-/* 224 */ { "%e0" , "à", "a" },
-/* 225 */ { "%e1" , "á", "a" },
-/* 226 */ { "%e2" , "â", "a" },
-/* 227 */ { "%e3" , "ã", "a" },
-/* 228 */ { "%e4" , "ä", "ae" },
-/* 229 */ { "%e5" , "å", "a" },
-/* 230 */ { "%e6" , "æ", "ae" },
-/* 231 */ { "%e7" , "ç", "c" },
-/* 232 */ { "%e8" , "è", "e" },
-/* 233 */ { "%e9" , "é", "e" },
-/* 234 */ { "%ea" , "ê", "e" },
-/* 235 */ { "%eb" , "ë", "e" },
-/* 236 */ { "%ec" , "ì", "i" },
-/* 237 */ { "%ed" , "í", "i" },
-/* 238 */ { "%ee" , "î", "i" },
-/* 239 */ { "%ef" , "ï", "i" },
-/* 240 */ { "%f0" , "ð", "eth" },
-/* 241 */ { "%f1" , "ñ", "n" },
-/* 242 */ { "%f2" , "ò", "o" },
-/* 243 */ { "%f3" , "ó", "o" },
-/* 244 */ { "%f4" , "ô", "o" },
-/* 245 */ { "%f5" , "õ", "o" },
-/* 246 */ { "%f6" , "ö", "oe" },
-/* 247 */ { "%f7" , "/", "/" },
-/* 248 */ { "%f8" , "ø", "o" },
-/* 249 */ { "%f9" , "ù", "u" },
-/* 250 */ { "%fa" , "ú", "u" },
-/* 251 */ { "%fb" , "û", "u" },
-/* 252 */ { "%fc" , "ü", "ue" },
-/* 253 */ { "%fd" , "ý", "y" },
-/* 254 */ { "%fe" , "þ", NULL },
-/* 255 */ { "%ff" , "ÿ", "y" },
-/* 256 EOF*/ { NULL, NULL, NULL },
-};
-
-#endif /* _SUPPORT_ */
-
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* support_exp.h *
-* *
-* Function:..WorldWideWeb-X.500-Gateway - Supporting Routines *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* December 2 1995 Z D D V V *
-* Last modification: Z D D V V *
-* September 7 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: support_exp.h,v 1.6 1999/09/10 15:01:20 zrnsk01 Exp $
- *
- */
-
-#ifndef _SUPPORT_EXP_H_
-#define _SUPPORT_EXP_H_
-
-PUBLIC char * hex_decode ();
-PUBLIC char * hex_qdecode ();
-PUBLIC char * form_encode ();
-
-PUBLIC char * format_date ();
-PUBLIC char * friendly_dn ();
-PUBLIC char * format_time ();
-PUBLIC char * strQuoteChr();
-PUBLIC int strlstcmp (/* char *s1, char *s2, char sep */);
-PUBLIC void re_fail ();
-PUBLIC char *dnrcut(/*rdn, target, basecount*/);
-PUBLIC void disp_file (/* GLOB_STRUCT glob, char *filename, FILE *fp */);
-
-PUBLIC char *elapsed();
-
-PUBLIC char *hex_html_encode();
-
-#define hex_encode(x) hex_html_encode((x), 0)
-#define char2html(x) hex_html_encode((x), 1)
-#define flatten_chars(x) hex_html_encode((x), 2)
-
-PUBLIC char * get_parentDN();
-PUBLIC char **dn2charray();
-PUBLIC char * strrQuoteChr();
-PUBLIC int exit_tweb();
-
-
-/* dn_cmp and return codes */
-PUBLIC int dn_cmp( /* dn1, dn2 */ );
-PUBLIC int dn_cmp_parts( /* dn1, dn2, &matched */ );
-#define DN_EQUAL 0 /* dns are exactly equal */
-#define DN_LESS -1 /* dn1 is part of dn2 */
-#define DN_GREATER 1 /* dn2 is part of dn1 */
-#define DN_UNMATCHED -2 /* dns differ, matched is the same */
- /* (matched as seen from c down) */
-
-
-#endif
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* tgeneral.h. *
-* *
-* Function:..General-Headerfile for TWEB *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* September 13 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: tgeneral.h,v 1.8 1999/09/13 13:47:47 zrnsk01 Exp $
- *
- */
-
-
-#ifndef _TGENERAL_
-#define _TGENERAL_
-
-#define PUBLIC
-#define PRIVATE static
-
-/* For changes see file CHANGES */
-#ifdef __hpux
-#define _INCLUDE_POSIX_SOURCE
-#define _INCLUDE_XOPEN_SOURCE
-#define _INCLUDE_HPUX_SOURCE
-#define TIOCNOTTY _IO('t', 113)
-#define getdtablesize() _NFILE
-#endif
-
-#if defined( __linux__ ) && !defined( _BSD_SOURCE )
-#define _BSD_SOURCE
-#define _SVID_SOURCE
-#define _GNU_SOURCE
-#define _POSIX_SOURCE
-#endif
-
-#include <string.h>
-#include <strings.h>
-#include <sys/time.h>
-#include <time.h>
-#include "lber.h"
-#include "ldap.h"
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <syslog.h>
-#include <sys/wait.h>
-#include <signal.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-/* Support of LDAP API versions */
-#if LDAP_API_VERSION >= 2003 && LDAP_API_VERSION <= 2010
-#define OL_LDAPV 3
-#else
-# if LDAP_API_VERSION >= 2001 && LDAP_API_VERSION <= 2010
-# define OL_LDAPV 2
-# else
-# define OL_LDAPV 0
-# endif
-#endif
-
-# define ldap_debug debug
-
-#if OL_LDAPV > 2
-# include "portable.h"
-# include "ldap_log.h"
-#endif
-
-extern int errno;
-
-
-#include "strng_exp.h"
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-#define OK 1
-#define NOTOK 0
-#define DONE -1
-#define _TIMEOUT_LEN 31
-#define _LOG_TIME "%a, %d.%m.%y, %H:%M:%S"
-
-#include "init_exp.h"
-extern GLOB_STRUCT *globP;
-
-/*
- ***************************************************************************
- * If you are not a University of Tuebingen site,
- * you probably want to tailor the following:
- ***************************************************************************
- */
-
-/* Special code for DFN-Project AMBIX-D */
-#ifdef AMBIXGW
-
-# define SELBST_CN glob->selbsteintrag[0]
-# define SELBST_CN_NAME glob->selbsteintrag[1]
-# define SELBST_STUDIE_ATTR glob->selbsteintrag[2]
-# define SELBST_INSERT_MODE glob->selbsteintrag[3]
-# define SELBST_INSERT_WHO glob->selbsteintrag[4]
-# define SELBST_INSERT_NO glob->selbsteintrag[5]
-# define SELBST_INSERT_WORK glob->selbsteintrag[6]
-# define SELBST_INSERT_ALL glob->selbsteintrag[7]
-# define SELBST_INSERT_STUD glob->selbsteintrag[8]
-
-# define MAXDN_LEN 2048
-
-extern void self_insert();
-
-#endif
-
-
-
-/* Flags for print_attr */
-#define DEFAULT 0
-#define MULTILINE 1
-#define HREF 2
-#define FINGER 3
-#define DATE 4
-#define URL 5
-#define MAILTO 6
-#define MOVETO 7
-#define BMP 8
-#define JPEG 9
-#define JPEG2GIF 10
-#define BOOLEAN 11
-#define URI 12
-#define PGPKEY 13
-#define INDEXURL 14
-#define DYNAMICDN 15
-#define REFERRAL 20
-#define PRE 21
-#define HEADER 22
-
-#ifdef TUE_TEL
-#define PHONREFSHORT 16
-#define PHONREFLONG 17
-#define TFUNCPERS 18
-#define FAXTABLE 19
-#endif
-
-
-/* Patch for hpux from ksp: */
-#ifdef __hpux
-# define rewind(a) fflush(a)
-#endif
-
-#define G3TOXBM "cat"
-#define JPEGTOGIF "/soft/bin/djpeg -gif"
-
-/*
- *************************************************************************
- * The rest of this stuff probably does not need to be changed
- *************************************************************************
- */
-
-#define TIMEOUT 240
-#define WEB500PORT 8889
-
-#ifndef FD_SET
-#define NFDBITS 32
-#define FD_SETSIZE 32
-#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
-#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
-#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
-#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
-#endif
-
-#define from_hex(c) ((c>='0')&&(c<='9') ? c-'0' : (c>='A')&&(c<='F') ?\
- c-'A'+10 : (c>='a')&&(c<='f') ? c-'a'+10 : 0)
-
-/*
- * HTTP request we are implementing
- */
-
-#define UNKNOWN 0
-#define GET 1
-#define HEAD 2
-
-/*
- * HTTP response status
- */
-#define DOCUMENT_FOLLOWS 200
-#define REDIRECT 302
-#define BAD_REQUEST 400
-#define AUTH_REQUIRED 401
-#define FORBIDDEN 403
-#define NOT_FOUND 404
-#define SERVER_ERROR 500
-#define NOT_IMPLEMENTED 501
-
-#define PRINT_HTML_HEADER (fprintf(fp, \
-"HTTP/1.0 %d Document follows\n\
-MIME-Version: 1.0\n\
-Server: %s\n\
-Date: %s\n\
-Content-Type: text/html\n\
-Last-Modified: %s\n\
-%s\n",\
-DOCUMENT_FOLLOWS, version, glob->nowtimestr, glob->nowtimestr,\
- glob->caching ? glob->expiretimestr : "Pragma: no-cache\n" ))
-
-#define PRINT_PLAIN_HEADER (fprintf(fp, \
-"HTTP/1.0 %d Document follows\n\
-MIME-Version: 1.0\n\
-Server: %s\n\
-Date: %s\n\
-Content-Type: text/plain\n\
-Last-Modified: %s\n\
-%s\n",\
-DOCUMENT_FOLLOWS, version, glob->nowtimestr, glob->nowtimestr,\
- glob->caching ? glob->expiretimestr : "Pragma: no-cache\n" ))
-
-#define PRINT_REDIRECT_HEADER (fprintf(fp, \
-"HTTP/1.0 302 Found\n\
-MIME-Version: 1.0\n\
-Server: %s\n\
-Date: %s\n\
-Location: %s\n\
-Content-Type: text/html\n\
-Last-Modified: %s\n\
-%s\n",\
-version, glob->nowtimestr, query, glob->nowtimestr,\
- glob->caching ? glob->expiretimestr : "Pragma: no-cache\n" ))
-
-#define HTML_HEAD_TITLE "<HTML><HEAD><TITLE>%s</TITLE></HEAD><%s>"
-
-#define PRINT_HTML_FOOTER (fprintf(fp, "</BODY></HTML>"))
-
-/* Meta-Syntax of Gateway-Switching feature */
-#define GWS "(gw)"
-#define GWS_FORMAT "(gw-%s)"
-
-
-#define OUT_TIME 900
-
-/* Separator in UFNs */
-#define UFNSEP ","
-
-#endif /* _TGENERAL_ */
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* tglobal.h.. *
-* *
-* Function:..Global variables for TWEB *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1996 Z D D V V *
-* Last modification: Z D D V V *
-* September 13 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: tglobal.h,v 1.8 1999/09/13 13:47:47 zrnsk01 Exp $
- *
- */
-
-
-#ifndef _TGLOBAL_
-#define _TGLOBAL_
-
-#include "lber.h"
-#include "ldap.h"
-
-
-extern int debug;
-extern int dosyslog;
-extern int ldap_syslog;
-extern int ldap_syslog_level;
-
-extern struct timeval timestore[];
-extern int items_displayed;
-
-extern int searchaliases;
-
-#if OL_LDAPV >= 2
-
-extern LDAPFriendlyMap *fm;
-
-#else
-
-extern FriendlyMap *fm;
-
-#endif
-
-extern LDAPFiltDesc *filtd;
-
-extern char version[];
-extern char copyright[];
-
-extern int http; /* HTTP-header in request -> also in reply */
-
-extern int request;
-
-
-#endif /* _TGLOBAL */
-
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* tweb.c..... *
-* *
-* Function:..WorldWideWeb-X.500-Gateway MAIN-Routine *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* December 31 1996 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: tweb.c,v 1.6 1999/09/10 15:01:20 zrnsk01 Exp $
- *
- */
-
-
-/*
- * redesign BW 94/08/16
- * patched for HPUX 9.x by /KSp, 94/04/28
- * patched for AMBIX-D and use at University of Tuebingen by /KSp,
- * patched for always-assume-nonleaf-behaviour-and-reread-on-demand; /KSp
- * patched for restricted listing of Tuebinger students; /KSp
- * patched for mailto HREF in mail attribute; /KSp
- * patched for automatic referral to Chemnitz in case of ROOT access
- * (AMBIX version only); /KSp
- * patched for correct response in case of not found error; /MCl
- * neg patched: subtree search below locality removed; /KSp
- * patched for automatic referral to AMBIX in case of l=DFN access
- * (non-AMBIX version only); /KSp
- * patched for lower case compare during access control; /KSp
- * patched for menu-'seeAlso' in AMBIXGW; /KSp
- * patched for pgpPubKey formatting as MULTILINE; /KSP
- * correction of MULTILINE handling; /KSp
- * objectClass deleted from menu list entry in html-code; /KSp
- * patched for "Selbsteintrag" needed by AMBIX-Project /mc
- * last update: 95/07/07
- *
- * 95/07/17 changed to ANSI-C, deleted lots of compiletime-options. /mc
- *
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Tuebingen. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- *
- * ----------------------------------------------------------------------
- */
-
-#include "tweb.h"
-
-PUBLIC int main (argc, argv)
-int argc;
-char **argv;
-
-{
- /* The Glob-structure is NOT a global variable, but is stored here for
- all other functions !!! */
- GLOB_STRUCT glob;
- char lang[BUFSIZ];
- int pid, i;
-
- /* make glob global available */
- globP = &glob;
-
- /* first of all the language-parameter is scanned from the command-line
- and is written as first value to the Glob-structure */
- get_lang(argc, argv, lang);
- bzero((char *) &glob, sizeof(GLOB_STRUCT));
- glob.olang = strdup(lang);
-
- /* Now start a process for each language and terminate the super-process */
- for(i=0; i<strlen(lang); i++){
-
- /* memorize the sub-process-language */
- *glob.lang = lang[i];
-
- switch( pid = fork() ) {
-
- /* the Sub-Process */
- case 0:
- do_child(argc, argv,lang, &glob);
- break;
-
- /* A Sub-Process could not be created !!! */
- case -1:
- perror( "fork" );
- break;
-
- /* the Parent-Process */
- default:
- if ( debug )
- fprintf( stderr, "forked child %d\n", pid );
- break;
- }
- }
-
- return( 0 );
-}
-/* end of function: main */
-
-
-/**
- ** do_child()
- **
- ** Main-Function for the working-processes; until now only the
- ** language is initialized. The rest of the configuration
- ** must be scanned now.
- **/
-
-PRIVATE void do_child(argc, argv,lang, glob)
-int argc;
-char **argv;
-char *lang;
-GLOB_STRUCT *glob;
-
-{
- FILE *fp = NULL;
- char filename[BUFSIZ];
-
- /* read language-independent (.rc) and -dependent (.conf) configuration */
- init(argv, lang, glob);
-
- /* read commandline-parameter (they overwrite conf) */
- getopts (argc, argv, glob);
-
- /* If debug-Mode: Configuration Output */
- if (debug) {
-
- sprintf(filename, "%s.debug", glob->myname);
- fp =fopen(filename, "a");
- fprintf(fp, "\n\n\n#####%s.%s-log Date: %s\n\n",
- glob->myname, glob->lang, format_time(NULL));
- output(fp, glob, FALSE);
-
- }
-
- /* read language-strings (from .lang) and write out if desired */
- langinit(glob);
-
- if (debug) {
-
- langoutput(fp, glob, FALSE);
- fclose(fp);
-
- }
-
- /* Final Configuration-Test */
- check(glob);
-
- /* If dynamic Gateway-Switching is enabled the language-dependent
- recognition-string for the meta-Syntax must be fixed
- (language-independent recognition-string is given in Macro GWS ) */
- if(glob->gw_switch->dynamic) {
- char strbuf[BUFSIZ];
-
- sprintf(strbuf, GWS_FORMAT, glob->la[0]);
- glob->gw_switch->lagws = strdup(strbuf);
- }
-
- /* and now start the Gateway ... */
- start_server(glob);
-
-}
-/* end of function: do_child */
-
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* tweb.h..... *
-* *
-* Function:..Header-File for TWEB-SOFTWARE *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* September 13 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: tweb.h,v 1.8 1999/09/13 13:47:47 zrnsk01 Exp $
- *
- */
-
-
-#ifndef _TWEB_
-#define _TWEB_
-
-
-#include "tgeneral.h"
-#include "init_exp.h"
-#include "server_exp.h"
-#include "support_exp.h"
-
-PRIVATE void do_child();
-int debug = 0;
-int ldap_syslog = 0;
-int ldap_syslog_level = 0;
-
-int dosyslog = 0;
-
-GLOB_STRUCT *globP;
-
-int searchaliases = 1;
-
-#if OL_LDAPV >= 2
-
-LDAPFriendlyMap *fm = NULL;
-
-#else
-
-FriendlyMap *fm = NULL;
-
-#endif
-
-LDAPFiltDesc *filtd;
-
-extern char version[];
-
-int http = 1; /* HTTP Version ??? */
-
-int request = UNKNOWN;
-
-
-
-#endif /* _TWEB_ */
-
-
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* x500.c..... *
-* *
-* Function:..WorldWideWeb-X.500-Gateway - X.500-Access-Routines *
-* Based on web500gw.c 1.3 written by Frank Richter, TU Chemmniz *
-* which is based on go500gw by Tim Howes, University of *
-* Michigan - All rights reserved *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* August 16 1995 Z D D V V *
-* Last modification: Z D D V V *
-* September 13 1999 ZZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: x500.c,v 1.10 1999/09/13 13:47:48 zrnsk01 Exp $
- *
- */
-
-#include "tgeneral.h"
-#include "tglobal.h"
-#include "x500.h"
-#include "init_exp.h"
-#include "support_exp.h"
-#include "html_exp.h"
-
-#ifdef TUE_TEL
-#include "tueTel_exp.h"
-#endif
-
-#if defined( TUE_TEL ) || defined( AMBIXGW )
-#include "resort_exp.h"
-#endif
-
-
-PRIVATE int compare(a,b)
-DNLIST **a, **b;
-{
- return strcmp((*a)->string,(*b)->string);
-}
-/* end of function: compare */
-
-
-PRIVATE char * pick_oc(oclist)
-char **oclist;
-{
- int i;
-
- if ( oclist == NULL )
- return( "unknown" );
-
- for ( i = 0; oclist[i] != NULL; i++ ) {
- if ( strcasecmp( oclist[i], "top" ) != 0 &&
- strcasecmp( oclist[i], "quipuObject" ) != 0 &&
- strcasecmp( oclist[i], "quipuNonLeafObject" ) != 0 )
- return( str_tolower (oclist[i]) );
- }
-
- return( "unknown" );
-}
-/* end of function: pick_oc */
-
-
-PUBLIC char * make_oc_to_string(oc)
-char **oc;
-{
- static char oc_res[BUFSIZ];
- int i;
-
- if(!oc) return(NULL);
-
- *oc_res = '|';
- *(oc_res+1) = '\0';
- for(i = 0; oc[i] && *oc[i]; i++) {
- sprintf(oc_res, "%s%s|", oc_res, oc[i]);
- }
- return(str_tolower (oc_res));
-}
-/* end of function: make_oc_to_string */
-
-
-PUBLIC void do_xtend(ld, fp, query, filter, glob)
-LDAP *ld;
-FILE *fp;
-char *query;
-char *filter;
-GLOB_STRUCT *glob;
-{
- char *strptr, dn[BUFSIZ], command[BUFSIZ], extension[BUFSIZ];
-
- strptr = strchr(query, '?');
- *strptr++ = '\0';
- strcpy(dn, query);
- strcpy(command, strptr);
- if( ( strptr = strchr(command, '#')) ) {
- *strptr++ = '\0';
- strcpy(extension, strptr);
- }
-
- if(!strcasecmp(command, "MENU")){
- glob->tables_marker = strdup(extension);
- do_menu(ld, fp, dn, "", glob);
- }
-
-#ifdef TUE_TEL
- if(!strcasecmp(command, "PHONEBOOK")){
- do_phonebook(ld, fp, strstr(dn, "ou=TELEFONBUCH") ? dn
- : NULL, extension, glob, 1);
- }
-#endif
-
-}
-/* end of function: do_xtend */
-
-PUBLIC void do_menu(ld, fp, dn, filter, glob)
-LDAP *ld;
-FILE *fp;
-char *dn;
-char *filter;
-GLOB_STRUCT *glob;
-{
- int rc;
- LDAPMessage *pres;
- struct timeval timeout;
- static char *sattrs[] = { "objectClass", "labeledURI",
- "aliasedObjectName", "mail",
- "cn", "telephonenumber",
-#ifdef TUE_TEL
- "tat_ton", "tat_refphone",
-#endif
- 0 };
- static char **attrs = NULL;
- int counter = 0;
- pSEARCH_ONLY_LINE so_ptr;
- char la_url[BUFSIZ];
- int count;
- char *ufn;
-
-#if OL_LDAPV > 0
- int ldap_opt;
-#endif
-
- if(!attrs)
- attrs = (char**) charray_dup(sattrs);
-
- charray_merge(&attrs, glob->sort_attribs);
-
- if(glob->raw_data)
- charray_merge(&attrs, glob->raw_attrs);
-
- for(so_ptr = glob->search_only; so_ptr; so_ptr = so_ptr->next) {
- if (dn_cmp(dn, so_ptr->dn) == 0) {
- break;
- }
- }
-
- if(!so_ptr) {
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
-
-#if OL_LDAPV > 0
-
- ldap_opt = LDAP_DEREF_FINDING;
- ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
-
-#else
- ld->ld_deref = LDAP_DEREF_FINDING;
-#endif
-
- if ( (rc = ldap_search_st( ld, dn, LDAP_SCOPE_ONELEVEL,
- glob->menu_filter, attrs, 0, &timeout, &pres )) != LDAP_SUCCESS
- && rc != LDAP_SIZELIMIT_EXCEEDED
- && rc != LDAP_INSUFFICIENT_ACCESS ) {
- do_error(fp, rc, NOT_FOUND, glob);
- return;
- }
-
- if (rc == LDAP_SIZELIMIT_EXCEEDED) glob->persRestricted = TRUE;
-
-#if OL_LDAPV > 0
-
- ldap_opt = LDAP_DEREF_ALWAYS;
- ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
-
-#else
- ld->ld_deref = LDAP_DEREF_ALWAYS;
-#endif
-
- if ((count = (ldap_count_entries(ld, pres) )) < 1) {
- ldap_msgfree (pres);
- do_read (ld, fp, dn, 0, glob);
- return;
- }
- items_displayed = count;
- }
-
- if (http == 1) {
- PRINT_HTML_HEADER;
- }
- if (request == HEAD) {
- fflush(fp);
- exit_tweb (1);
- }
- fprintf( fp, HTML_HEAD_TITLE, ufn = friendly_dn(dn, glob), glob->la[100]);
- if ( ufn ) free( ufn );
-
- if (dn_cmp(dn, glob->basedn->dn) == 0)
- disp_file(glob, glob->basedn->head, fp);
- else if(so_ptr && so_ptr->head)
- disp_file(glob, so_ptr->head, fp);
- else
- disp_file(glob, glob->header, fp);
-
-#ifdef TUE_TEL
- fprintf (fp, "\n<A NAME=\"phonebook=Telefonbuch\"></A>\n");
- fprintf (fp, "\n<A NAME=\"phonebook\"></A>\n");
-#endif
-
- make_la_buttons("M", fp, ld, dn, la_url, glob );
-
- make_header( fp, dn, 0, glob);
-
- print_rdn(fp, dn, glob);
-
- make_search_box(fp, ld, dn, glob);
-
-#ifdef AMBIXGW
- /* Button leading to cgi-script */
- if( glob->form_button && !glob->selbsteintrag[0]){
- char **oc;
- LDAPMessage *res;
- struct timeval timeout;
- static char *attrs[] = { "objectClass", 0 };
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
- if ( ldap_search_st( ld, dn, LDAP_SCOPE_BASE, "objectClass=*",
- attrs, 0, &timeout, &res ) != LDAP_SUCCESS ) {
- exit_tweb( 1 );
- }
- oc = ldap_get_values( ld, ldap_first_entry( ld, res ), "objectClass" );
-
- disp_form_button(0, oc, dn, ld, fp, glob);
- }
-
- /* check to see if selfinsert-buttons are appropriate here */
- if(glob->selbsteintrag[0])
- self_insert(ld,fp,dn,glob);
-#endif
-
-#ifdef TUE_TEL
- /* Named link to skip header */
- fprintf (fp, "\n<A NAME=\"pure-data\"></A>\n");
-#endif
-
- fprintf(fp, glob->la[101]);
-
-
- if(!so_ptr) {
-
- /* DO_MENU */
- counter = sort_result( ld, pres, dn, glob);
-
- /* get time for performance log */
- gettimeofday(×tore[4], NULL);
-
- list_output(fp, glob);
-
- if ( ldap_result2error( ld, pres, 1 ) == LDAP_SIZELIMIT_EXCEEDED
- || glob->restricted )
- do_sizelimit(fp, 1, glob);
-
- if(glob->legal && !glob->legal_top)
- fprintf (fp, "%s\n%s\n", glob->la[101],
- glob->is_proxy ? glob->la[104] : glob->la[65]);
- }
-
- if (dn_cmp(dn,glob->basedn->dn) == 0)
- disp_file(glob, glob->basedn->foot, fp);
- else if(so_ptr && so_ptr->foot)
- disp_file(glob, so_ptr->foot, fp);
- else
- disp_file(glob, glob->footer, fp);
-
- PRINT_HTML_FOOTER;
-}
-/* end of function: do_menu */
-
-
-PRIVATE int make_scope(ld, dn, glob)
-LDAP *ld;
-char *dn;
-GLOB_STRUCT *glob;
-{
- int scope, idx;
- char **oc;
- LDAPMessage *res;
- struct timeval timeout;
- static char *attrs[] = { "objectClass", 0 };
-
- if ( strcmp( dn, "" ) == 0 )
- return( LDAP_SCOPE_ONELEVEL );
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
- if ( ldap_search_st( ld, dn, LDAP_SCOPE_BASE, "objectClass=*",
- attrs, 0, &timeout, &res ) != LDAP_SUCCESS ) {
- return( -1 );
- }
-
- oc = ldap_get_values( ld, ldap_first_entry( ld, res ), "objectClass" );
-
- /* set scope according to configured object-classes */
- scope = LDAP_SCOPE_ONELEVEL;
- for(idx = 0; glob->subtree_search && glob->subtree_search[idx]; idx++)
- if( charray_inlist( oc, glob->subtree_search[idx]))
- scope = LDAP_SCOPE_SUBTREE;
-
- ldap_value_free( oc );
- ldap_msgfree( res );
-
- return( scope );
-}
-/* end of function: make_scope */
-
-PUBLIC int do_search(ld, fp, query, glob)
-LDAP *ld;
-FILE *fp;
-char *query;
-GLOB_STRUCT *glob;
-{
- int scope;
- char *base, *filter, *strptr;
- char *filtertype;
- int count = 0, rc;
- struct timeval timeout;
- LDAPFiltInfo *fi;
- LDAPMessage *e, *res = NULL;
- static char *attrs[] = { "objectClass", "cn", "sn", "labeledURI",
- "aliasedObjectName", 0 };
- int counter = 0;
- char *ufn;
- char title[BUFSIZ], title2[BUFSIZ];
-
-#if OL_LDAPV > 0
- int ldap_opt;
-#endif
-
- glob->no_browse = FALSE;
-
-/* query string: base-DN?[OS]=filter
- * search onelevel <--||--> search subtree
- */
- if ( (filter = strchr( query, '?' )) == NULL ) {
- explain_error( fp, glob->la[89], BAD_REQUEST, glob );
- exit_tweb( 1 );
- }
- *filter++ = '\0';
- if (*filter == '\0' || *(filter+1) != '=') {
- explain_error( fp, glob->la[90], BAD_REQUEST, glob);
- exit_tweb( 1 );
- }
- if( ( strptr = strchr(filter, '&')) )
- *strptr = '\0';
- if( ( strptr = strchr(filter, '*')) )
- *strptr = '\0';
- if (*filter == 'S') {
- scope = LDAP_SCOPE_SUBTREE;
- } else {
- scope = LDAP_SCOPE_ONELEVEL;
- }
- filter += 2;
- if (*filter == '\0') {
- explain_error( fp, glob->la[92], BAD_REQUEST, glob);
- exit_tweb( 1 );
- }
- /* deutsche Umlaute plaetten */
- filter = flatten_chars(filter);
-
- base = query;
-
- filtertype = (scope == LDAP_SCOPE_ONELEVEL ? "web500gw onelevel" :
- "web500gw subtree");
-
-#if OL_LDAPV > 0
-
- ldap_opt = ( scope == LDAP_SCOPE_ONELEVEL ? LDAP_DEREF_FINDING :
- LDAP_DEREF_ALWAYS );
- ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
-
-#else
- ld->ld_deref = (scope == LDAP_SCOPE_ONELEVEL ? LDAP_DEREF_FINDING :
- LDAP_DEREF_ALWAYS);
-#endif
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
-
- for (fi=ldap_getfirstfilter( filtd, filtertype, filter ); fi != NULL;
- fi = ldap_getnextfilter( filtd ) ) {
- if ( (rc = ldap_search_st( ld, base, scope, fi->lfi_filter,
- attrs, 0, &timeout, &res )) != LDAP_SUCCESS
- && rc != LDAP_SIZELIMIT_EXCEEDED ) {
-
- if (dosyslog) {
-
-#if OL_LDAPV > 0
-
- int ld_errno;
-
- ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
- syslog (LOG_INFO, "ldap_search_st(): %s",
- ldap_err2string ( ld_errno ));
-
-#else
- syslog (LOG_INFO, "ldap_search_st(): %s",
- ldap_err2string (ld->ld_errno));
-#endif
-
- }
-
- do_error(fp, rc, NOT_FOUND, glob);
- return( 1 );
- }
-
- if ( res && (count = ldap_count_entries( ld, res )) != 0 ) {
-
- break;
- }
-
- }
- items_displayed = count;
-
-#if OL_LDAPV > 0
-
- ldap_opt = LDAP_DEREF_ALWAYS;
- ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
-
-#else
- ld->ld_deref = LDAP_DEREF_ALWAYS;
-#endif
-
- if ( count == 0 ) {
-
- if (http == 1) {
- fprintf(fp, "HTTP/1.0 404 %s \n", glob->la[6]);
- fprintf(fp, "MIME-Version: 1.0\n");
- fprintf(fp, "Content-Type: text/html\n\n");
- }
-
- if (request == HEAD) {
- fflush(fp);
- exit_tweb (1);
- }
-
- sprintf( title, "%s %s", filter, glob->la[36]);
- fprintf( fp, HTML_HEAD_TITLE, title, glob->la[100]);
-
- disp_file(glob, glob->header, fp);
-
- fprintf( fp,
- "<H2>%s</H2> %s <STRONG>%s</STRONG> in <STRONG>%s</STRONG></BODY></HTML>\n\n",
- glob->la[37], glob->la[38], filter,
- (strlen(base) == 0) ? glob->la[77] : ldap_dn2ufn(base));
- fflush(fp);
- return( 0 );
- }
- else if ( count == 1 ) {
- e = ldap_first_entry( ld, res );
- if ( e != NULL ) {
- char *dn, **oc;
- oc = ldap_get_values(ld, e, "objectClass");
- dn = ldap_get_dn(ld, e);
- if ( dn ) {
-
- /* GW-Switch if one search-result and dyn-URL by
- PRINT_REDIRECT_HEADER */
- if ( glob->gw_switch->dynamic) {
- char **uri, query[10*BUFSIZ];
- int j;
-
- uri = ldap_get_values( ld, e, "labeledURI" );
- for(j=0; uri && uri[j] && *uri[j]; j++) {
- char *sp;
-
- if( ( sp = strchr(uri[j], ' ')) ) {
- *sp++ = '\0';
- if(strstr(sp, glob->gw_switch->lagws)) {
- /*sprintf(query, "%s/M%s", uri[j], dn);*/
- strcpy(query, uri[j]);
- hex_decode(query);
- PRINT_REDIRECT_HEADER;
- PRINT_HTML_FOOTER;
- exit_tweb(0);
- }
- }
- }
- }
- /* By default on one result: */
- do_menu(ld, fp, dn, "", glob);
- return (0);
- }
- }
- }
-
- if (http == 1)
- PRINT_HTML_HEADER;
- if (request == HEAD) {
- fflush(fp);
- exit_tweb (1);
- }
-
- sprintf( title2, "%s %s", glob->la[39], filter);
- fprintf( fp, HTML_HEAD_TITLE, title2, glob->la[100]);
-
- disp_file(glob, glob->header, fp);
-
- ufn = friendly_dn(base, glob);
- fprintf( fp, "%s <STRONG>\"%s\"</STRONG> in <STRONG>\"%s\"</STRONG> ",
- glob->la[40], filter, ufn );
- if ( ufn ) free( ufn );
-
- if(!glob->noauth)
- fprintf( fp, "(%d %s)<br>", count,
- count == 1 ? glob->la[70] : glob->la[71]);
-
- /* DO_SEARCH */
- counter = sort_result( ld, res, base, glob);
-
- /* get time for performance log */
- gettimeofday(×tore[4], NULL);
-
- list_output(fp, glob);
-
- if ( ldap_result2error( ld, res, 1 ) == LDAP_SIZELIMIT_EXCEEDED )
- do_sizelimit(fp, 0, glob);
-
- if(glob->legal && !glob->legal_top)
- fprintf (fp, "%s\n%s\n", glob->la[101],
- glob->is_proxy ? glob->la[104] : glob->la[65]);
-
- disp_file(glob, glob->footer, fp);
-
- PRINT_HTML_FOOTER;
-
- return( 0 );
-
-}
-/* end of function: do_search */
-
-
-PRIVATE pDISPLAY
-find_dPtr( displayList, displayType )
-pDISPLAY displayList;
-char *displayType;
-{
- pDISPLAY dis;
-
- for ( dis = displayList; dis; dis = dis->next ) {
-
- if ( !strcasecmp( dis->ocs, displayType )) return( dis );
-
- }
-
- return( NULL );
-
-} /* find_dPtr */
-
-
-PUBLIC void do_read(ld, fp, dn, amore, glob)
-LDAP *ld;
-FILE *fp;
-char *dn;
-int amore;
-GLOB_STRUCT *glob;
-{
- int rc, j;
- char **val, **s;
- char *rdn;
- LDAPMessage *res, *e;
- struct timeval timeout;
- int classFound;
- pDISPLAY d_ptr = NULL;
- pDISPLAY_LINE dis_ptr = NULL;
- SORT_LINE *s_ptr;
- char la_url[BUFSIZ];
- char *ufn;
- char already_displayed[BUFSIZ];
- int header_attr_mode = 0;
-
-#if defined( TUE_TEL ) || defined( AMBIXGW )
- char *parentDN;
-#endif
-
-
- *already_displayed = ':';
- *(already_displayed+1) = '\0';
-
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
-
-
- if ( (rc = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, "objectClass=*",
- NULL, 0, &timeout, &res )) != LDAP_SUCCESS ) {
- do_error(fp, rc, NOT_FOUND, glob);
- return;
- }
-
-
- if ( (e = ldap_first_entry( ld, res )) == NULL ) {
- do_error(fp, -2, SERVER_ERROR, glob);
- return;
- }
-
- val = ldap_get_values( ld, e, "objectClass" );
-
-#if defined( TUE_TEL ) || defined( AMBIXGW )
- /* toc_derefalias: read entry, aliasedObjectName is referring to */
- if(charray_inlist(val, "toc_derefalias")){
- char **new_dn;
-
- new_dn = ldap_get_values( ld, e, "aliasedObjectName" );
- if(new_dn && new_dn[0]) {
- do_read(ld, fp, new_dn[0], amore, glob);
- return;
- }
- }
-
- /* before displaying check for dynamic changes of the sorting parms */
- parentDN = get_parentDN( dn );
- dynamicResort( ld, glob, parentDN );
-#endif
-
- /*
- * check for objectClass via displayLists-Table which List
- * of attributes we want to use.
- */
- classFound = -1;
- for(s_ptr = glob->sort; s_ptr; s_ptr = s_ptr->next) {
- char buf[BUFSIZ];
-
- d_ptr = s_ptr->display_class_ptr;
-
- for( j=0; val[j]; j++ ) {
- sprintf( buf, "|%s|", str_tolower( val[j] ));
-
- if ( strstr( s_ptr->object_class, buf )) {
- classFound = 1;
- break;
- }
- }
- if (classFound == 1) break;
- }
-
-#if defined( TUE_TEL ) || defined( AMBIXGW )
- dynamicDisplay( ld, glob, parentDN,
- s_ptr ? s_ptr->display_class : "default" );
-#endif
-
- if((classFound == -1) && (glob->default_display_type)) {
- d_ptr = glob->default_display_type;
- classFound = 1;
- }
-
- /* if we did not find a fitting objectClass, simply return */
- if(classFound == -1) {
-
- fprintf( fp, HTML_HEAD_TITLE, glob->la[22], glob->la[100]);
- fprintf( fp, "\n%s</BODY></HTML>", glob->la[41]);
- return;
- }
-
- /* is the display description defined already */
- if ( !d_ptr && (( d_ptr = find_dPtr( glob->display,
- s_ptr->display_class )) == NULL )) {
-
- if ( dosyslog )
- syslog( LOG_INFO,
- "do_read(%08d): couldn't find display type <%s> -- FATAL.",
- glob->svc_cnt, s_ptr->display_class );
-
- fprintf( fp, HTML_HEAD_TITLE, glob->la[22], glob->la[100]);
- fprintf( fp, "\n%s</BODY></HTML>", glob->la[41]);
- return;
-
- }
-
- /* now we can point to the final display screen */
- dis_ptr = ( amore ? d_ptr->second_page : d_ptr->first_page );
-
- if (http == 1) PRINT_HTML_HEADER;
- if (request == HEAD) {
- fflush(fp);
- exit_tweb (1);
- }
-
- dn = ldap_get_dn( ld, e );
-
- if ( strcmp( dn, "" ) != 0 ) { /* Not the root */
- s = ldap_explode_dn( dn, 1 );
- if ( s[1] == NULL ) /* toplevel */
- rdn = ldap_friendly_name( glob->friendlyfile, s[0], &fm );
- else
- rdn = s[0];
- } else
- rdn = glob->la[77];
-
- fprintf( fp, HTML_HEAD_TITLE, ufn = friendly_dn( dn, glob ),
- glob->la[100] );
- if ( ufn ) free( ufn );
-
- disp_file(glob, glob->header, fp);
-
- if ( !glob->ldap_referral_mode ) {
-
- make_la_buttons("R", fp, ld, dn, la_url, glob);
- make_header( fp, dn, 0, glob );
- } else {
- fprintf( fp, glob->la[105]);
- }
- fprintf( fp, "<DL>");
-
- fprintf( fp, glob->la[101]);
-
- /* don't display rdn if first attribute is in header-mode */
- if ( dis_ptr->ty == HEADER )
- header_attr_mode = 1;
- if( ( dis_ptr && !header_attr_mode ) || !dis_ptr ) {
- if(glob->strip_pin && strstr(glob->strip_pin, d_ptr->ocs)) {
- char rdnstriped[BUFSIZ];
-
- strcpy( rdnstriped, rdn);
- trimright (rdnstriped, " 1234567890");
- fprintf( fp, "<H1>%s</H1>", rdnstriped );
- } else
- fprintf( fp, "<H1>%s</H1>", rdn);
- }
-
- if(glob->ind_attrs)
- get_ref_attrs( ld, dn, e, glob );
-
- /* get time for performance log */
- items_displayed = 1;
- gettimeofday(×tore[4], NULL);
-
- if ( header_attr_mode )
- rdn = NULL;
-
- for( ; dis_ptr; dis_ptr = dis_ptr->next) {
-
- if(glob->ind_attrs){
-
- int n, m, iatlabel=0, replace=0;
- IND_ATTR_ARR *vnodes;
-
-#ifdef TUE_TEL
- int retcode = 0;
-
- /* Function Mode */
- retcode = displayTueRefPhone( ld, fp, dn, dis_ptr,
- e, rdn, glob, already_displayed );
-#endif
- if(strstr(already_displayed, dis_ptr->label)) {
- continue;
- }
-
- vnodes = glob->ind_attrs->valid_nodes;
-
- for(n=0; vnodes && vnodes[n].key && *(vnodes[n].key) ; n++) {
-
- if(!strcasecmp(vnodes[n].attr, dis_ptr->attribute)) {
-
- for(m=0; vnodes[n].e[m]; m++)
- print_attr( vnodes[n].ld, fp, dn,
- m==0 ? dis_ptr->label : "", dis_ptr->attribute,
- vnodes[n].e[m], dis_ptr->ty, rdn, glob);
-
- iatlabel = 1;
- if(vnodes[n].replace)
- replace=1;
-
- }
-
- }
- if( iatlabel && !replace)
- print_attr( ld, fp, dn, "",
- dis_ptr->attribute, e, dis_ptr->ty, rdn, glob);
-
- if(!iatlabel)
- print_attr( ld, fp, dn, dis_ptr->label,
- dis_ptr->attribute, e, dis_ptr->ty, rdn, glob);
-
- } else {
- print_attr( ld, fp, dn, dis_ptr->label,
- dis_ptr->attribute, e, dis_ptr->ty, rdn, glob);
- }
- }
-
-
- if ( !amore && d_ptr && d_ptr->second_page ) {
-
- fprintf( fp, "</DL><A HREF=\"/L%s\"><B>%s</B></A>\n",
- hex_encode(dn), glob->la[42]);
-
-
- }
- fprintf( fp, "</DL>\n");
-
- if (strcasecmp(dn + strlen(dn) - strlen(glob->basedn->dn),
- glob->basedn->dn) == 0) {
-
- pMODIF p_mod;
- char *aoc;
- char **oc;
-
- aoc = make_oc_to_string(oc = ldap_get_values( ld, e, "objectClass" ));
-
- if(!strlstcmp (aoc, glob->no_modify, '|')) {
- for (p_mod = glob->modify; aoc && p_mod; p_mod = p_mod->next) {
- if (strlstcmp (aoc, p_mod->ocs, '|')) {
- fprintf( fp, "%s<TT>%s</TT><P><FORM ACTION=\"F%s\">\n",
- glob->la[101], glob->la[43], hex_encode(dn));
- fprintf (fp, "%s <INPUT TYPE=\"password\" ",
- glob->la[44]);
- fprintf (fp, "NAME=\"userPassword\"><BR>%s ",
- glob->la[45]);
- fprintf (fp, "<INPUT TYPE=\"submit\" VALUE=\"%s\">",
- glob->la[47]);
- fprintf (fp, " %s. </FORM>\n",
- glob->la[48]);
- break;
- }
- }
- }
-
- ldap_value_free( oc );
-
- }
-
- /* Button leading to cgi-script */
- if( glob->form_button ){
- char **oc;
-
- oc = ldap_get_values( ld, e, "objectClass" );
- disp_form_button(1, oc, dn, ld, fp, glob);
- }
-
- disp_file(glob, glob->footer, fp);
-
- PRINT_HTML_FOOTER;
-
-}
-/* end of function: do_read */
-
-PRIVATE void disp_form_button(read_menu, oc, dn, ld, fp, glob)
-int read_menu;
-char **oc;
-char *dn;
-LDAP *ld;
-FILE *fp;
-GLOB_STRUCT *glob;
-{
- pFORM_BUTTON fo_ptr;
- char dn_used[BUFSIZ], button_label[BUFSIZ];
-
-#ifdef AMBIXGW
- char *who_val;
- char **selfInsertWho = NULL;
- char **studie = NULL;
- int selfInsReadFlag = 0;
-#endif
-
- for(fo_ptr = glob->form_button; fo_ptr; fo_ptr = fo_ptr->next) {
- if(read_menu != fo_ptr->read_menu ||
- ( !charray_inlist(oc, fo_ptr->object_class)
- && strncasecmp( "cn=", fo_ptr->object_class, 3 ) ) )
- continue;
- strcpy(dn_used, dn);
- strcpy(button_label, fo_ptr->button_label);
-
-#ifdef AMBIXGW
- /* new-AMBIX cn=Selbst-Eintrag etc. support */
- /* object-class field contains here cn=xyz e.g. cn=Selbst-Eintrag */
- if ( !strncasecmp( "cn=", fo_ptr->object_class, 3 )) {
- char dn_buf[BUFSIZ];
- LDAPMessage *res, *e;
- struct timeval timeout;
- static char *attrs[] = { "objectClass", "selfInsertWho",
- "studie", 0 };
-
- /* cn=Selbsteintrag nur einmal lesen */
- if (!selfInsReadFlag ) {
- selfInsReadFlag = 1;
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
-
- sprintf(dn_buf, "%s,%s", fo_ptr->object_class, dn);
- if (ldap_search_st( ld, dn_buf, LDAP_SCOPE_BASE, "objectClass=*",
- attrs, 0, &timeout, &res ) != LDAP_SUCCESS )
- continue;
- if(( e = ldap_first_entry( ld, res )) == NULL )
- continue;
-
- selfInsertWho = ldap_get_values( ld, e, "selfInsertWho" );
- studie = ldap_get_values( ld, e, "studie" );
- }
-
- if ( (who_val = strchr(button_label, '|')))
- *who_val++ = '\0';
-
- if ( !who_val )
- continue;
-
- if ( !selfInsertWho || !selfInsertWho[0] )
- continue;
-
- /* exception for all + studiedn != dn -> two buttons stud + ang */
- if ( strcasecmp(selfInsertWho[0], who_val ) &&
- !(!strcasecmp(selfInsertWho[0], "all") && studie && studie[0] && dn_cmp(dn, studie[0]) && strcasecmp(who_val, "all")))
- continue;
-
- /* filter for exception all-button */
- if( studie && studie[0] && dn_cmp(dn, studie[0]) && !strcasecmp(selfInsertWho[0], "all") && !strcasecmp(who_val, "all") )
- continue;
-
- if(!strcasecmp(who_val, "stud" ) && studie && studie[0]
- && dn_cmp(dn, studie[0]))
- strcpy(dn_used, studie[0]);
- }
-#endif
-
- fprintf (fp, "<FORM METHOD=%s ACTION=%s>\n", fo_ptr->method,
- fo_ptr->script_url);
- fprintf (fp, "%s\n<INPUT type=hidden name=\"%s\" value=\"%s\">\n",
- fo_ptr->text, fo_ptr->dn_name, hex_encode(dn_used));
- fprintf (fp, "<INPUT TYPE=\"submit\" name=\"%s\" value=\"%s\">\n",
- fo_ptr->form_name, button_label);
- fprintf (fp, "</FORM>\n");
- }
-}
-/* end of function: disp_form_button */
-
-
-PUBLIC void do_form(ld, fp, query, glob)
-LDAP *ld;
-FILE *fp;
-char *query;
-GLOB_STRUCT *glob;
-{
- int rc, count;
- char *dn = query, *pw;
- char *ufn;
- char *a;
- LDAPMessage *res, *e;
- struct timeval timeout;
- pMODIFY_LINE mod_ptr;
- char title[BUFSIZ];
-
-
- if ( (pw = strchr( dn, '?' )) == NULL ) {
- fprintf( fp, "%s<br>", glob->la[49]);
- exit_tweb( 1 );
- }
- *pw++ = '\0';
- if (strncmp(pw, "userPassword=", 13) == 0)
- pw += 13;
- else {
- fprintf( fp, "%s %s!<br>", glob->la[50], pw);
- exit_tweb ( 1 );
- }
- if (strlen(pw) == 0) {
- /* we need a password for simple auth */
- do_error( fp, LDAP_INVALID_CREDENTIALS, FORBIDDEN, glob);
- rewind(fp);
- exit_tweb( 1 );
- }
- if ( (rc = ldap_simple_bind_s( ld, dn, pw )) != LDAP_SUCCESS ) {
- if ( debug ) ldap_perror( ld, "ldap_simple_bind_s" );
- do_error( fp, rc, FORBIDDEN, glob);
- return;
- }
- if (debug) fprintf(stderr, "BOUND as %s\n", dn);
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
- if ( (rc = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, "objectClass=*",
- 0, 0, &timeout, &res )) != LDAP_SUCCESS ) {
- do_error(fp, rc, NOT_FOUND, glob);
- return;
- }
- if ( (e = ldap_first_entry( ld, res )) == NULL ) {
- do_error(fp, -2, SERVER_ERROR, glob);
- return;
- }
- dn = ldap_get_dn( ld, e );
- ufn = ldap_dn2ufn( dn );
- if (http == 1) {
- PRINT_HTML_HEADER;
- }
- sprintf( title, "%s %s", glob->la[51], ufn );
- fprintf( fp, HTML_HEAD_TITLE, title, glob->la[100] );
-
- disp_file(glob, glob->header, fp);
-
- fprintf( fp, "<FORM ACTION=\"Y%s\">\n<INPUT TYPE= \"radio\" ", hex_encode(dn));
- fprintf( fp, "NAME=\"oldPassword\" VALUE=\"%s\" CHECKED><TT>%s</TT>\n<H1>%s</H1><DL><br>", hex_encode(pw), glob->la[53], ufn );
- free( ufn );
- for(mod_ptr = glob->modify->modattr; mod_ptr; mod_ptr = mod_ptr->next){
- a = mod_ptr->attribute;
- count = mod_ptr->count;
- if ( strcmp( a, "homepostaladdress" ) == 0
- || strcmp( a, "postaladdress" ) == 0)
- if (count == 0)
- print_attr(ld,fp,dn,mod_ptr->label,a,e,MULTILINE,NULL, glob);
- else
- form_attr(ld,fp,mod_ptr->label,a,e,1,count, glob);
- else if (count == 0)
- print_attr( ld, fp, dn, mod_ptr->label, a, e, DEFAULT, NULL, glob);
- else
- form_attr( ld, fp, mod_ptr->label, a, e, 0, count, glob );
- }
- fprintf( fp, "</DL><InPut TYPE=\"reset\" VALUE=\"%s\"> ", glob->la[72]);
- fprintf( fp, "<InPut TYPE=\"submit\" VALUE=\"%s\">", glob->la[47]);
- fprintf( fp, "</FORM>");
-
- disp_file(glob, glob->footer, fp);
-
- PRINT_HTML_FOOTER;
- fflush(fp);
-}
-/* end of function: do_form */
-
-
-PUBLIC void do_modify(ld, fp, query, glob)
-LDAP *ld;
-FILE *fp;
-char *query;
-GLOB_STRUCT *glob;
-{
- char *dn, *ufn, *pw, *what, *next, *val, *oldval, *cp;
- int rc, changes = 0, delete_flag;
- static char *value1[2], *value2[2];
- static LDAPMod mod1, mod2;
- static LDAPMod *mods[3] = { &mod1 , &mod2, NULL};
- char title[BUFSIZ];
-
-/* Patch: we can't run the modification of attributes in two distinct steps,
- since inheritage might copy a value into the entry after deletion
- of the old value
-
- /KSp, 95/07/13
-*/
-
-
- /* query: DN?oldPassword=oldpw&att1=oldval1=val1&att2=oldval2=val2&...
- * or: DN?oldPassword=oldpw&att1%3Doldval1=val1&att2%3Doldval2=...
- */
-
- dn = query;
- rewind(fp);
-
- if ( (what = strchr( dn, '?' )) == NULL ) {
- explain_error( fp, glob->la[93], BAD_REQUEST, glob );
- exit_tweb( 1 );
- }
- *what++ = '\0';
- hex_decode(dn);
- if (debug) fprintf(stderr, "What: %s\n", what);
- /* At first there should be the old userPassword */
- if ( (pw = strstr( what, "oldPassword")) == NULL ) {
- explain_error( fp, glob->la[94], BAD_REQUEST, glob);
- exit_tweb ( 1 );
- }
- pw += 12; /* strlen("oldPassword") + 1 */
- /* skip to the first real attribute */
- if ( (what = strchr(pw, '&')) == NULL ) {
- explain_error( fp, glob->la[95], BAD_REQUEST, glob);
- exit_tweb( 1 );
- }
- *what++ = '\0';
- hex_qdecode(pw);
- if (debug) fprintf(stderr,
- "\ndo_modify: DN = %s PW = ####### CONTENT =\n%s\n ", dn, what );
- if ( (rc = ldap_simple_bind_s( ld, dn, pw )) != LDAP_SUCCESS ) {
- if ( debug ) ldap_perror( ld, "ldap_simple_bind_s" );
- do_error( fp, rc, FORBIDDEN, glob);
- exit_tweb( 1 );
- }
- if (debug) fprintf(stderr, "BOUND as %s.\n", dn);
-
- if (http == 1) {
- PRINT_HTML_HEADER;
- }
-
- if (request == HEAD) {
- fflush(fp);
- exit_tweb (1);
- }
- ufn = ldap_dn2ufn( dn );
- sprintf( title, "%s %s", glob->la[8], ufn);
- fprintf(fp, HTML_HEAD_TITLE, title, glob->la[100]);
-
- disp_file(glob, glob->header, fp);
-
- fprintf(fp, "<H2>%s %s</H2>%s<DL>\n", glob->la[9], ufn, glob->la[10]);
- free(ufn);
-
- while (what) {
- if ((next = strchr(what, '&')) != NULL) {
- *next++ = '\0';
- } else { /* last in query */
- next = NULL;
- }
- if ((val = strrchr(what, '=')) == NULL) {
- /* new value */
- fprintf( fp, "<P>%s ", glob->la[54]);
- fprintf( fp, "%s %s!<P>", glob->la[55], hex_qdecode(what));
- exit_tweb (1);
- }
- *val++ = '\0';
- hex_qdecode(what);
- hex_qdecode(val);
- if ((oldval = strchr(what, '=')) == NULL) {
- /* old value */
- fprintf( fp, "<P>%s ", glob->la[56]);
- fprintf( fp, "%s %s!<P>\n", glob->la[55], what);
- exit_tweb (1);
- }
- *oldval++ = '\0';
- if (strcmp(oldval, val) == 0 ) { /* no changes */
- what = next;
- continue;
- }
- if ((strcasecmp(what, "homePostalAddress") == 0) ||
- (strcasecmp(what, "postalAddress") == 0)) {
- /* multiline */
- cp = oldval;
- while ((cp = strchr(cp, '\n')) != NULL) *cp = '$';
- cp = val;
- while ((cp = strchr(cp, '\n')) != NULL) *cp = '$';
- }
- if (debug)
- fprintf(stderr,
- "what = %s, oldval = %s, val = %s\n",
- what, oldval, val);
-
- /* there is something to do:
- * - delete the old value
- * - add the new value if not empty */
- mod1.mod_type = what;
- mod2.mod_type = what;
- value1[1] = NULL;
- value2[1] = NULL;
- mod1.mod_values = value1;
- mod2.mod_values = value2;
- mods[1] = NULL;
- delete_flag = FALSE;
-
-/* ############# */
-
- if (strlen(oldval) > 0) {
-
- if (strlen (val) > 0) {
-
- mod1.mod_op = LDAP_MOD_ADD;
- value1[0] = val;
-
-/* mod2.mod_op = LDAP_MOD_DELETE;
- value2[0] = oldval;
- mods[1] = &mod2;
-*/
- if ((rc = ldap_modify_s(ld, dn, mods)) != LDAP_SUCCESS) {
-
- fprintf( fp,
- "%s <TT>%s</TT> %s <TT>%s</TT>!<P>\n<EM> %d: %s.</EM><p>\n",
- glob->la[80], oldval, glob->la[81], what,
- rc, ldap_err2string(rc));
-
- what = next;
- continue;
-
- }
-
- mod1.mod_op = LDAP_MOD_DELETE;
- value1[0] = oldval;
-
- } else {
-
- mod1.mod_op = LDAP_MOD_DELETE;
- value1[0] = oldval;
- delete_flag = TRUE;
-
- }
-
- } else {
-
- mod1.mod_op = LDAP_MOD_ADD;
- value1[0] = val;
-
- }
-
- if (debug)
- fprintf(stderr, "trying: %s = %s.\n", what, val);
-
- if (((rc=ldap_modify_s(ld, dn, mods)) != LDAP_SUCCESS) &&
- (mod1.mod_op != LDAP_MOD_DELETE) && (rc != LDAP_NO_SUCH_ATTRIBUTE)){
-
-if (dosyslog)
- syslog (LOG_INFO, "ERROR: ldap_modify_s: ADD\n");
- if ( debug )
- ldap_perror( ld, "ldap_modify_s: ADD");
- fprintf( fp,
- "%s <TT>%s</TT> %s <TT>%s</TT><P>\n%s <EM> %d: %s.</EM><P>\n",
- glob->la[57], val, glob->la[58], what, glob->la[59],
- rc, ldap_err2string( rc ) );
- if (strlen(oldval) > 0 && rc != LDAP_INSUFFICIENT_ACCESS) {
- /* try to reset to old value */
-
- mod1.mod_op = LDAP_MOD_ADD;
- mods[1] = NULL;
-
- value1[0] = oldval;
- if ((rc = ldap_modify_s(ld, dn, mods)) != LDAP_SUCCESS) {
- fprintf( fp,
- "%s <TT>%s</TT> %s <TT>%s</TT>!<P>\n<EM> %d: %s.</EM><P>\n",
- glob->la[60], oldval, glob->la[61], what,
- rc, ldap_err2string(rc));
-
- exit_tweb( 1 );
- } else {
- fprintf( fp, "%s <TT>%s</TT> %s <TT>%s</TT><P>\n",
- glob->la[62], oldval, glob->la[61], what);
- }
- }
- what = next;
- continue;
- }
-
- if (debug) fprintf(stderr, "MOD: %s = %s.\n", what, val);
- changes++;
- fprintf(fp, "<DT><B>%s</B> <DD>%s <TT>(%s)</TT>\n",
- ldap_friendly_name(glob->friendlyfile, what, &fm), value1[0],
- delete_flag ? glob->la[74] : strlen(oldval) > 0 ?
- glob->la[75] : glob->la[76]);
- what = next;
- }
- fprintf(fp, "</DL>%d %s%s%s!\n", changes, glob->la[15],
- changes != 1 ? glob->la[73] : "",
- changes > 0 ? glob->la[16] : "");
- if (changes > 0) {
- char *dn2 = hex_encode(dn);
-
- fprintf(fp, "<UL><LI><B><A HREF=\"/R%s\">%s</A>\n",
- dn2, glob->la[17]);
- fprintf(fp, "<LI><A HREF=\"/F%s?userPassword=%s\">%s</A></B></UL>\n",
- dn2, pw, glob->la[19]);
-
- }
-
- disp_file(glob, glob->footer, fp);
-
- PRINT_HTML_FOOTER;
- fflush(fp);
-}
-/* end of function: do_modify */
-
-PRIVATE int no_show( rdn, glob)
-char *rdn;
-GLOB_STRUCT *glob;
-{
- if ( glob->no_show_rdn ) {
-
- char rdn_cpy[BUFSIZ], *toc, no_sh[BUFSIZ];
-
- strcpy(no_sh, glob->no_show_rdn);
- sprintf(rdn_cpy, "|%s|", rdn);
- toc = strtok(no_sh, " ");
- do {
- if(strstr(str_tolower((char *) rdn_cpy), str_tolower(toc)))
- return(TRUE);
- } while( ( toc = strtok(NULL, " ")) );
-
- }
-
- return(FALSE);
-}
-/* end of function: no_show */
-
-
-PRIVATE int sort_result(ld, res, dn, glob)
-LDAP *ld;
-LDAPMessage *res;
-char *dn;
-GLOB_STRUCT *glob;
-{
- LDAPMessage *e;
- char *ufn;
- int counter = 0, baselen;
- int basecount;
- pSORT_LINE s_ptr;
- pMY_LDAP_LIST lmptr;
- LFP getfirst = glob->prefer_ref_uris ? my_first_entry : ldap_first_entry,
- getnext = glob->prefer_ref_uris ? my_next_entry : ldap_next_entry;
-
- hex_decode (dn);
-
- ufn = ldap_dn2ufn(dn);
- baselen = ufn ? strlen(ufn) : 0;
- basecount = ufn ? chrcnt(ufn, UFNSEP) : 0;
-
-#if defined( TUE_TEL ) || defined( AMBIXGW )
- /* before sorting check for dynamic changes of the sorting instructions */
- dynamicResort( ld, glob, dn );
-#endif
-
- for ( e = (*getfirst)(ld, res); e != NULL && counter < glob->maxcount;
- e = (*getnext)(ld, e ) ) {
- sort_parse(ld, e, dn, ufn, baselen, basecount, counter, glob);
- }
- for(lmptr = mllroot; lmptr; lmptr = lmptr->next) {
- sort_parse(ld, lmptr->e, dn, ufn, baselen, basecount, counter, glob);
- }
- mllroot = NULL;
-
- for(s_ptr = glob->sort; s_ptr; s_ptr = s_ptr->next) {
- if( s_ptr->dnLast )
- qsort(s_ptr->dnList, s_ptr->dnLast, sizeof(int), compare);
- }
- return counter;
-}
-/* end of function: sort_result */
-
-
-PRIVATE void list_output(fp, glob)
-FILE *fp;
-GLOB_STRUCT *glob;
-{
- int i, x;
- pSORT_LINE s_ptr;
-
- if(glob->tables_marker)
- fprintf (fp, "</H3><TABLE WIDTH=\"100%%\">");
-
- for (i = 0 ; i < MAX_OCS ; i++ ) {
- if(!glob->sorty[i]) continue;
- s_ptr = glob->sorty[i];
-
- if(glob->tables_marker)
- fprintf( fp, "<TR><TH ALIGN=LEFT><BR>");
-
- fprintf( fp, "<H3>%s", s_ptr->label);
-
-#ifdef TUE_TEL
- if(glob->ton_urls && glob->ton_urls->department
- && (strlen(s_ptr->label) >1) )
- fprintf( fp, " / %s", glob->ton_urls->department);
-#endif
-
- if(s_ptr->restricted) {
- fprintf( fp, " %s", glob->la[33]);
- if (glob->legal && !glob->legal_top)
- fprintf( fp, ", %s", glob->la[34]);
- fprintf (fp, ")");
- }
-
- if(glob->tables_marker)
- fprintf (fp, "</H3></TH></TR>");
- else
- fprintf (fp, "</H3><MENU>\n");
-
- for(x=0; x < s_ptr->dnLast; x++) {
- if(glob->strip_pin && strstr(glob->strip_pin, s_ptr->object_class)){
- s_ptr->dnList[x]->href[strlen(s_ptr->dnList[x]->href) -5] = '\0';
- trimright (s_ptr->dnList[x]->href, " 1234567890");
- strcat(s_ptr->dnList[x]->href, "</A>\n");
- }
-
- if( glob->raw_data ) {
- fprintf(fp,"%s",s_ptr->dnList[x]->raw);
- free(s_ptr->dnList[x]->raw);
- } else {
- fprintf(fp,"%s",s_ptr->dnList[x]->href);
- free(s_ptr->dnList[x]->href);
- }
- free(s_ptr->dnList[x]->string);
- }
-
- if(!glob->tables_marker)
- fprintf (fp, "</MENU>\n");
-
- glob->sorty[i] = NULL;
- }
- if(glob->tables_marker)
- fprintf (fp, "</TABLE>\n");
-}
-/* end of function: list_output */
-
-PRIVATE void make_la_buttons(sep, fp, ld, dn, la_url, glob)
-char *sep;
-FILE *fp;
-LDAP *ld;
-char *dn;
-char *la_url;
-GLOB_STRUCT *glob;
-
-{
- int k;
-
- /* Inform users from unknown */
- if(glob->unknown_host) fprintf( fp, glob->la[102]);
-
- if(glob->legal && glob->legal_top)
- fprintf (fp, "%s\n%s\n",
- glob->is_proxy ? glob->la[104] : glob->la[65], glob->la[101]);
-
- /* if allowed -> allow-file-message */
- if(glob->allowed && glob->allow_msg)
- disp_file(glob, glob->allow_msg, fp);
-
- if(glob->pull_down_menus) {
- make_la_buttons_pull_down(sep, fp, ld, dn, la_url, glob);
- return;
- }
-
- fprintf( fp, "<B>");
- fprintf( fp, " [ <A HREF=\"/H\">%s</A> ] ",glob->la[29]);
- for(k=0; k<strlen(glob->olang); k++){
- if(glob->olang[k] == glob->lang[0]) continue;
- sprintf(la_url, "http://%s:%d/%s%s",
- glob->hostname, glob->webport+glob->olang[k]-'0',
- sep, hex_encode(dn));
- fprintf( fp, " [ <A HREF=\"%s\"> %s </A> ] ",
- la_url, glob->language[glob->olang[k]-'0']);
- }
- fprintf( fp, "</B><p>");
-}
-/* end of function: make_la_buttons */
-
-PRIVATE void make_la_buttons_pull_down(sep, fp, ld, dn, la_url, glob)
-char *sep;
-FILE *fp;
-LDAP *ld;
-char *dn;
-char *la_url;
-GLOB_STRUCT *glob;
-
-{
- int k;
- TABLE_DISPLAY *tab_ptr;
-
- fprintf( fp, "<FORM ACTION=\"/B\">\n");
- fprintf( fp, "<INPUT TYPE=SUBMIT NAME=H Value = \"%s\">\n",glob->la[29]);
-
- fprintf( fp, "_\n");
-
- for(k=0; k<strlen(glob->olang); k++){
- if(glob->olang[k] == glob->lang[0]) continue;
- sprintf(la_url, "http://%s:%d/%s%s",
- glob->hostname, glob->webport+glob->olang[k]-'0',
- sep, hex_encode(dn));
- fprintf( fp, "<INPUT TYPE=SUBMIT NAME=%s Value = \"%s\">\n",
- la_url, glob->language[glob->olang[k]-'0']);
- }
-
- /* make tables button in order to have table-display requests */
- for(tab_ptr = glob->tables; tab_ptr; tab_ptr = tab_ptr->next) {
-
- char **oc = NULL;
- struct timeval timeout;
- LDAPMessage *res;
- static char *attrs[] = { "objectClass", 0 };
-
- if( !((!tab_ptr->allow || glob->allowed) && !glob->tables_marker))
- continue;
-
- /* Check objectclass for tables_oc */
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
- if ( ldap_search_st( ld, dn, LDAP_SCOPE_BASE, "objectClass=*",
- attrs, 0, &timeout, &res ) == LDAP_SUCCESS ){
- oc = ldap_get_values(ld, ldap_first_entry(ld, res), "objectClass");
- }
- if ( oc && charray_inlist( oc, tab_ptr->select_oc)) {
-
- fprintf( fp, "_______\n");
- fprintf( fp, "<INPUT TYPE=SUBMIT NAME=X%s?%s#%s Value = \"%s\">\n",
- hex_encode(dn),
-#ifdef TUE_TEL
- strstr(tab_ptr->dn_extension, "persontable") ?
- "MENU" : "PHONEBOOK",
-#else
- "MENU",
-#endif
- tab_ptr->dn_extension, tab_ptr->button_label);
- }
- }
-
- fprintf( fp, "</FORM>\n");
-}
-/* end of function: make_la_buttons_pull_down */
-
-PRIVATE void print_rdn(fp, dn, glob)
-FILE *fp;
-char *dn;
-GLOB_STRUCT *glob;
-{
- char **s;
- char *rdn = NULL;
-
- if(glob->pull_down_menus) {
- print_rdn_pull_down(fp, dn, glob);
- return;
- }
-
- s = ldap_explode_dn( dn, 1 );
- if ( strcmp( dn, "" ) != 0 ) { /* Not the root */
- if ( s[1] == NULL ) { /* toplevel */
- rdn = ldap_friendly_name( glob->friendlyfile, s[0], &fm );
- } else {
- rdn = s[0];
- }
- fprintf( fp,"%s <B><A HREF=\"/R%s\">%s</A></B>\n",glob->la[28],hex_encode(dn),rdn?rdn:s[0]);
- } else { /* the root */
- fprintf( fp, "<B>%s</B>\n", glob->la[77]);
- }
- ldap_value_free( s );
-}
-/* end of function: print_rdn */
-
-PRIVATE void print_rdn_pull_down(fp, dn, glob)
-FILE *fp;
-char *dn;
-GLOB_STRUCT *glob;
-{
- char **s;
- char *rdn = NULL;
-
- fprintf( fp, "<FORM ACTION=\"/B\">\n");
-
- s = ldap_explode_dn( dn, 1 );
- if ( strcmp( dn, "" ) != 0 ) { /* Not the root */
- if ( s[1] == NULL ) { /* toplevel */
- rdn = ldap_friendly_name( glob->friendlyfile, s[0], &fm );
- } else {
- rdn = s[0];
- }
- fprintf( fp,"%s <BIG><STRONG>%s</STRONG></BIG> ",
- glob->la[28], rdn?rdn:s[0]);
- fprintf( fp, "<INPUT TYPE=SUBMIT NAME=R%s Value = \"%s\">\n",
- hex_encode(dn), glob->la[98]);
- } else { /* the root */
- fprintf( fp, "<BIG><STRONG>%s</STRONG></BIG>\n", glob->la[77]);
- }
- ldap_value_free( s );
- fprintf( fp, "</FORM>\n");
-}
-/* end of function: print_rdn_pull_down */
-
-PRIVATE void make_search_box(fp, ld, dn, glob)
-FILE *fp;
-LDAP *ld;
-char *dn;
-GLOB_STRUCT *glob;
-{
- int scope;
-
- scope = make_scope(ld, dn, glob); /* onelevel or subtree search ? */
- fprintf( fp, "<DL><DT><FORM ACTION=\"/S%s\">%s <inPUT NAME=\"%s\"><INPUT TYPE=submit VALUE=%s><INPUT TYPE=reset VALUE=\"%s\">\n",
- hex_encode(dn),
- scope == LDAP_SCOPE_ONELEVEL ? glob->la[66] : glob->la[67],
- scope == LDAP_SCOPE_ONELEVEL ? "O" : "S",
- glob->la[68], glob->la[69]);
-
- fprintf( fp, "</FORM></DL>\n");
-}
-/* end of function: make_search_box */
-
-PRIVATE LDAPMessage *my_first_entry( ld, e )
-LDAP *ld;
-LDAPMessage *e;
-{
- return(ldap_list_eval(ld, e , ldap_first_entry));
-}
-/* end of function: my_first_entry */
-
-PRIVATE LDAPMessage *my_next_entry(ld, e )
-LDAP *ld;
-LDAPMessage *e;
-{
- return(ldap_list_eval(ld, e , ldap_next_entry));
-}
-/* end of function: my_next_entry */
-
-PRIVATE LDAPMessage *ldap_list_eval(ld, e, funcp )
-LDAP *ld;
-LDAPMessage *e;
-LFP funcp;
-{
-
- char **value = NULL;
- pMY_LDAP_LIST *lmhandle; /* , lmptr; */
-
- for(lmhandle = &mllroot; *lmhandle; lmhandle = &(*lmhandle)->next)
- ;
-
- for( e = (*funcp)( ld, e ) ;
- e && strstr(make_oc_to_string(value = ldap_get_values( ld, e, "objectClass" )),
- "|alias|"); e = ldap_next_entry( ld, e )) {
- *lmhandle = (pMY_LDAP_LIST) ch_malloc(sizeof(MY_LDAP_LIST));
- (*lmhandle)->e = e;
- lmhandle = &(*lmhandle)->next;
- ldap_value_free(value);
- value = NULL;
-
- }
- if (value) ldap_value_free(value);
-
-/* if(!e) {
- for(lmptr = mllroot; lmptr; lmptr = lmptr->next) {
- char **val;
-
- val = ldap_get_values(ld, lmptr->e, "aliasedObjectName");
-if (dosyslog) syslog (LOG_INFO, "alias: %s", val[0]);
- ldap_value_free(val);
- }
- mllroot = NULL;
- }
-*/
- return(e);
-}
-/* end of function: ldap_list_eval */
-
-PRIVATE void sort_parse(ld, e, dn, ufn, baselen, basecount, counter, glob)
-LDAP *ld;
-LDAPMessage *e;
-char *dn;
-char *ufn;
-int baselen;
-int basecount;
-int counter;
-GLOB_STRUCT *glob;
-{
- char **s, **oc;
- char *dn2, *urldn = NULL, *rdn, *doc, *aoc;
- char *ufn2, *sortstring = NULL, *cp;
- char **sattr = NULL, href[20*BUFSIZ], *temp;
- int spaces = 0, iscountry;
- pGW_SWITCH_LINE gw_ptr;
- int flag, found_oc, i;
- pSORT_LINE *s_hndl;
- pSORT_LINE s_ptr;
- char *url = NULL;
- char **uri = NULL, *urlnola, raw_string[BUFSIZ];
-
-#if OL_LDAPV > 0
- int ldap_opt;
-#endif
-
- oc = ldap_get_values( ld, e, "objectClass" );
-
- if(!(aoc = make_oc_to_string(oc))) return;
-
-
-#ifdef TUE_TEL
- /*** ton_urls ***/
- if(glob->ton_urls && glob->ton_urls->value && strstr(aoc, "|person|")) {
- char **tonvals;
- int k, matched;
-
- matched=0;
- tonvals = ldap_get_values( ld, e, glob->ton_urls->attribute);
- if(!tonvals) return;
- for(k=0; tonvals[k]; k++) {
- if(strstr(tonvals[k], glob->ton_urls->value)
- && !(strchr(tonvals[k], '.')
- && (strcspn(tonvals[k],".") > strlen(glob->ton_urls->value)))){
- matched = 1;
- }
- }
- if(!matched) {
- return;
- }
- }
-#endif
-
- /* Begin New Sort */
- found_oc = FALSE;
- i = 0;
- for(s_hndl = &(glob->sort); *s_hndl; s_hndl = &(*s_hndl)->next) {
-
- i++;
- if(strstr( aoc, (*s_hndl)->object_class )) {
-
- if(strstr(aoc, "|person|") && glob->no_browse)
- goto NEXTENTRY;
- found_oc = TRUE;
- }
- if(found_oc) break;
- }
-
- if(!found_oc) {
- if(glob->show_defoc) {
- *s_hndl = s_ptr = (pSORT_LINE) ch_malloc(sizeof(SORT_LINE));
- s_ptr->object_class = strdup(pick_oc(oc));
- s_ptr->label = ldap_friendly_name(glob->friendlyfile,
- s_ptr->object_class, &fm);
- s_ptr->priority = i;
-
- } else return;
- }
-
- s_ptr = *s_hndl;
- doc = s_ptr->object_class;
-
- dn2 = ldap_get_dn( ld, e );
- if(urldn) free(urldn);
- if(strstr(aoc, "|alias|")) {
-
- char **val;
-
- val = ldap_get_values(ld, e, "aliasedObjectName");
- urldn = strdup(hex_encode(val[0]));
- ldap_value_free(val);
-
- } else
- urldn = strdup(hex_encode(dn2));
-
- ufn2 = strdup (ldap_dn2ufn(dn2));
- s = ldap_explode_dn( dn2, 1 );
-
- if(baselen)
- ufn2 = dnrcut(ufn2, UFNSEP, basecount);
-
- /* Support raw data delivery */
- if(glob->raw_data) {
- char **rvals;
- int k, l;
-
- sprintf(raw_string, "%s", ufn2);
- trimright (raw_string, " 1234567890");
-
- for(l=0; glob->raw_attrs[l]; l++) {
- rvals = ldap_get_values( ld, e, glob->raw_attrs[l]);
- if(rvals[0])
- sprintf(raw_string, "%s%% %s=", raw_string, glob->raw_attrs[l]);
- for(k=0; rvals[k]; k++) {
- sprintf(raw_string, "%s%s%s",raw_string,
- k>0 ? "&":"", rvals[k] );
- }
- }
- sprintf(raw_string, "%s|<br><br>", raw_string);
- }
-
- iscountry = (strstr( doc, "country" ) != NULL);
- if ( iscountry ) {
- rdn = ldap_friendly_name( glob->friendlyfile, s[0], &fm );
- sortstring = ufn2 = ldap_friendly_name( glob->friendlyfile,
- ufn2, &fm );
- sattr = NULL;
- } else
- rdn = s[0];
- if ( rdn == NULL )
- rdn = s[0];
- if (( strncasecmp( rdn, "{ASN}", 5 ) == 0 )
- || no_show( rdn, glob)) {
- free( dn2 );
- ldap_value_free( s );
- ldap_value_free( oc );
- return;
- }
- if ( !iscountry ) { /* not a country */
- sattr = ldap_get_values( ld, e, s_ptr->sort_attr);
- sortstring = strdup(dn2);
- if ( ( cp = strchr(sortstring,'=')) ) {
- sortstring = ++cp;
- /* DNs may have components in '"', ignored when sorting */
- if ( *sortstring == '"' )
- sortstring++;
- }
- if ( sattr ) {
- cp = *sattr;
- while ( ( cp = strchr(cp,' ')) ) {
- cp ++;
- spaces ++;
- }
- }
- while ( spaces > 0 ) {
- if ( ( cp = strrchr(sortstring,' ')) ) {
- *cp = '\0';
- spaces --;
- }
- }
- }
-
- ufn2 = trim(ufn2, "\"");
-
- /* GW-SWITCH */
- flag = 0;
- urlnola = NULL;
-
- if (glob->gw_switch && glob->gw_switch->dynamic) {
-
- uri = ldap_get_values( ld, e, "labeledURI" );
-
- /* PREFER-REF-URIS Code */
- if(strstr(aoc, "|alias|") && glob->prefer_ref_uris){
-
- LDAPMessage *ures, *ue;
- struct timeval timeout;
- char **val;
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
-
-#if OL_LDAPV > 0
-
- ldap_opt = LDAP_DEREF_ALWAYS;
- ldap_set_option( ld, LDAP_OPT_DEREF, &ldap_opt );
-
-#else
- ld->ld_deref = LDAP_DEREF_ALWAYS;
-#endif
-
- if ( (ldap_search_st( ld, dn2, LDAP_SCOPE_BASE, "objectClass=*",
- NULL, 0, &timeout, &ures )) == LDAP_SUCCESS ) {
- if ( (ue = ldap_first_entry( ld, ures ))) {
- if( ( val = ldap_get_values( ld, ue, "labeledURI" )) ) {
- if(uri) ldap_value_free(uri);
- uri = val;
-
- }
- }
- }
- }
-
- for(i=0; uri && uri[i] && *uri[i]; i++) {
- char *sp;
-
- if( ( sp = strchr(uri[i], ' ')) ) {
- *sp++ = '\0';
- if(strstr(sp, glob->gw_switch->lagws)) {
- flag = 1;
- url = uri[i];
- break;
- } else if(strstr(sp, GWS))
- urlnola = uri[i];
- }
- }
- }
-
- if(!flag && urlnola) {
- url = urlnola;
- flag = 1;
- }
-
- if (glob->gw_switch) {
-
- for(gw_ptr = glob->gw_switch->list;
- !flag && gw_ptr; gw_ptr = gw_ptr->next) {
- if (!dn_cmp (dn2, gw_ptr->dn)) {
- flag = 1;
- url = gw_ptr->url;
- }
- }
- }
-
- if(flag == 1) {
- char *url_tmp;
-
- sprintf( href, "<LI><A HREF=\"%s\">%s</A>\n",
- (url_tmp = url_complete(url, urldn, "M")),
- glob->disp_sea_rdn ? rdn : ufn2);
-
- }
-
- if (flag==0) {
- char *strptr;
-
- if(glob->strip_pin && strstr(glob->strip_pin, doc))
- if ( ( strptr = strchr(ufn2, ',')) ) {
-
- *strptr++ = '\0';
- trimright(ufn2, " 1234567890");
- sprintf(ufn2, "%s,%s", ufn2, strptr);
-
- } else
- trimright(ufn2, " 1234567890");
-
- ufn2 = trim(ufn2, "\"");
-
- /* TABLES DISPLAY CODE */
- if(glob->tables_marker){
-
- char disp_rule[BUFSIZ], *strptr, strbuf[BUFSIZ];
- char tab_attr[BUFSIZ], percent[BUFSIZ];
- char **aval;
- int n;
-
- strcpy(disp_rule, glob->tables_marker);
- strptr = strstr(disp_rule, "persontable");
-
- if(strptr){
- strptr = strchr(strptr, ':') + 1;
- strcpy(disp_rule, strptr);
- strptr = strchr(disp_rule, '$');
- if(strptr) *strptr = '\0';
- strcat(disp_rule, "&");
-
- strcpy( href, "<TR>\n");
-
- while(*disp_rule){
- strcpy(strbuf, disp_rule);
- strptr=strchr(disp_rule, '&');
- strcpy(disp_rule, strptr+1);
-
- strptr=strchr(strbuf, '&');
- *strptr++ = '\0';
- strcpy(tab_attr, strbuf);
- strptr = strchr(tab_attr, ',');
- *strptr++ = '\0';
- strcpy(percent, strptr);
-
- sprintf( href, "%s <TD WIDTH=\"%s%%\" VALIGN=TOP %s>",
- href, percent,
- !strcasecmp(tab_attr, "telephonenumber") ?
- "ALIGN=RIGHT NOWRAP" : "ALIGN=LEFT");
-
- if(!strcasecmp(tab_attr, "rdn")){
- trimright (ufn2, " 1234567890");
- sprintf( href, "%s<A HREF=\"/M%s\">%s</A><BR>\n",
- href, urldn, ufn2);
-
-#ifdef TUE_TEL
- /* use tat_refphone & fallback to telephonenumber */
- } else if(!strcasecmp(tab_attr, "phone")){
- displayTueTelList( ld, e, href, glob );
-
-#endif
- } else if(!strncasecmp(tab_attr, "objectclass", 11)){
- char objectclass[BUFSIZ], letter[BUFSIZ], *trptr;
- char tab_attr_buf[BUFSIZ];
-
- *(letter+1) = *letter = '\0';
- strcpy(tab_attr_buf, tab_attr);
- trptr = tab_attr_buf;
- while( ( trptr = strchr(trptr, '=')) )
- *trptr++ = ' ';
-
- sscanf(tab_attr_buf, "%*s%s%s",
- objectclass, letter);
- if(!*letter) *letter = '*';
-
- if( ( aval =
- ldap_get_values( ld, e, "objectclass")) ) {
- if(charray_inlist(aval, objectclass))
- sprintf(href, "%s %s",
- href, letter);
- }
- } else if( ( aval =
- ldap_get_values( ld, e, tab_attr )) ) {
- for(n=0; aval[n]; n++){
- if(!strcasecmp(tab_attr, "mail"))
- sprintf(href,
- "%s<A HREF=\"mailto:%s\">%s</A><BR>",
- href, aval[n], aval[n]);
- else
- sprintf(href, "%s %s<BR>", href, aval[n]);
- }
- }
- sprintf( href, "%s</TD>", href);
- }
- sprintf( href, "%s</TR>", href);
- }
-
- /* without tables */
- }else{
- sprintf( href, "<LI><A HREF=\"%s%sM%s\">%s</A>\n",
-
-#ifdef TUE_TEL
- (glob->dit_config && !glob->dit_config->not_browse) ?
- dn2server(urldn, glob) : "",
-#else
- "",
-#endif
-
- "/", urldn,
- glob->disp_sea_rdn ? rdn : ufn2);
- }
- }
-
- if (*sortstring == '&') {
-
- sortstring[0] = sortstring[1];
- sortstring[1] = 'e';
-
- }
-
- if( (strstr(aoc, "person") && (s_ptr->dnLast >= glob->max_person) )
- || ( s_ptr->dnLast >= glob->maxcount) ) {
- s_ptr->restricted = 1;
- return;
- }
-
- if ( sattr )
- temp = (char *) ch_malloc(strlen(*sattr)+strlen(sortstring)+1);
- else
- temp = (char *) ch_malloc(strlen(sortstring)+1);
- if ( sattr )
- strcat(temp, *sattr);
- strcat(temp,sortstring);
-
- if(!s_ptr->dnList)
- s_ptr->dnList = (DNLIST **) ch_calloc(glob->maxcount+1,
- sizeof(pDNLIST));
- if (!s_ptr->dnList[s_ptr->dnLast] )
- s_ptr->dnList[s_ptr->dnLast] = (pDNLIST)
- ch_malloc(sizeof(DNLIST));
-
- s_ptr->dnList[s_ptr->dnLast]->string = temp;
-
- if(glob->raw_data) {
- s_ptr->dnList[s_ptr->dnLast]->raw = strdup(raw_string);
- }
-
- s_ptr->dnList[s_ptr->dnLast++]->href = strdup(href);
- glob->sorty[s_ptr->priority] = s_ptr;
-
- free( dn2 );
- ldap_value_free( s );
- ldap_value_free( oc );
- ldap_value_free( uri );
-
- if(++counter >= glob->maxcount)
- glob->restricted = TRUE;
-
-NEXTENTRY:
- ;
- return;
-}
-/* end of function: sort_parse */
-
-
-PUBLIC void close_ldap_connections(glob)
-GLOB_STRUCT *glob;
-{
- pLD_LIST ldlptr;
-
- for(ldlptr = glob->ld_list; ldlptr; ldlptr = ldlptr->next)
- ldap_unbind(ldlptr->ld);
-}
-/* end of function: close_ldap_connections */
-
-PUBLIC LDAP *get_ldap_connection( host, port, glob )
-char *host;
-int port;
-GLOB_STRUCT *glob;
-{
- pLD_LIST ldlptr, *ldlhdl;
- LDAP *ld = NULL;
- int rc;
-
- for(ldlptr = glob->ld_list; ldlptr; ldlptr = ldlptr->next) {
- if ( !strcasecmp(ldlptr->host, host) && (ldlptr->port == port))
- ld = ldlptr->ld;
-
- }
- if (!ld) {
-
- if ( (ld = ldap_open( host, port )) == NULL )
- return(NULL);
- if ( (rc=ldap_simple_bind_s( ld, glob->webdn, glob->webpw ))
- != LDAP_SUCCESS )
- return(NULL);
- for(ldlhdl = &glob->ld_list; *ldlhdl; ldlhdl = &(*ldlhdl)->next)
- ;
- *ldlhdl = (pLD_LIST) ch_calloc(1, sizeof(LD_LIST));
- (*ldlhdl)->host = strdup(host);
- (*ldlhdl)->port = port;
- (*ldlhdl)->ld = ld;
- }
- return(ld);
-}
-/* end of function: get_ldap_connection */
-
-
-PRIVATE void get_ref_attrs( ld1, dn, e1, glob )
-LDAP *ld1;
-char *dn;
-LDAPMessage *e1;
-GLOB_STRUCT *glob;
-{
- pIND_ATTRS i_ptr;
- IND_ATTR_ARR *idx, **vnodes;
- int i, j, k, n;
- LDAP *ld;
- int rc;
- LDAPMessage *res, *e;
- struct timeval timeout;
- char **val, **val1;
- char ref_dn[BUFSIZ], ref_cnbuf[BUFSIZ], *ref_cn;
-
-
- for(i_ptr = glob->ind_attrs; i_ptr; i_ptr = i_ptr->next) {
-
- /* Function-Mode */
- if (i_ptr->ia_arr && (i_ptr->ia_arr[0].replace == 2))
- continue;
-
- if ( (val1 = ldap_get_values( ld1, e1, i_ptr->ref_attr )) == NULL )
- continue;
-
- for(idx = i_ptr->ia_arr, i=0; idx[i].key; i++){
- /* idx[i].key idx[i].replace idx[i].attr idx[i].host idx[i].port
- idx[i].base -- i_ptr->ref_attr */
-
- ld = get_ldap_connection( idx[i].host, idx[i].port, glob );
-
- timeout.tv_sec = glob->timeout;
- timeout.tv_usec = 0;
-
- for ( j = 0; val1[j] != NULL; j++ ) {
- if(strncasecmp(val1[j], idx[i].key, strlen(idx[i].key)))
- continue;
- else {
- strcpy(ref_cnbuf, val1[j]);
-/* ref_cn = ref_cnbuf + strlen(idx[i].key);
-*/
- ref_cn = ref_cnbuf;
- }
-
- sprintf(ref_dn, "cn=%s,%s", ref_cn, idx[i].base);
- if ( (rc = ldap_search_st( ld, ref_dn, LDAP_SCOPE_BASE,
- "objectClass=*", NULL, 0, &timeout, &res )) != LDAP_SUCCESS )
- continue;
- if ( (e = ldap_first_entry( ld, res )) == NULL )
- return;
- val = ldap_get_values( ld, e, idx[i].attr );
- if(val[0] != NULL) {
- if(!idx[i].e)
- idx[i].e = ( LDAPMessage ** )
- ch_malloc( 16 * sizeof(LDAPMessage *) );
- for(n=0; idx[i].e[n]; n++)
- ;
- idx[i].e[n] = e;
- idx[i].ld = ld;
- vnodes = &glob->ind_attrs->valid_nodes;
- if(!*vnodes)
- *vnodes = (IND_ATTR_ARR *)
- ch_malloc( 100 * sizeof(IND_ATTR_ARR *) );
- for(k=0; (*vnodes)[k].key; k++)
- ;
- if(j==0)
- (*vnodes)[k] = idx[i];
- }
- }
- }
- }
-}
-/* end of function: get_ref_attrs */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* x500.h..... *
-* *
-* Function:..Header-File for TWEB-Software *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* February 13 1996 Z D D V V *
-* Last modification: Z D D V V *
-* February 18 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: x500.h,v 1.6 1999/09/10 15:01:21 zrnsk01 Exp $
- *
- */
-
-#ifndef _X500_
-#define _X500_
-
-#include "x500_exp.h"
-#include "charray_exp.h"
-#include "ch_malloc_exp.h"
-
-typedef LDAPMessage *(*LFP)();
-
-typedef struct _my_ldap_list {
- LDAPMessage *e;
- struct _my_ldap_list *next;
-} MY_LDAP_LIST, *pMY_LDAP_LIST;
-
-pMY_LDAP_LIST mllroot = NULL;
-
-PRIVATE int compare(/*a,b*/);
-PRIVATE char * pick_oc(/*oclist*/);
-PRIVATE int make_scope(/*ld, dn, glob*/);
-PRIVATE int no_show(/* rdn, glob*/);
-PRIVATE int sort_result(/*ld, res, dn, no_browse, glob*/);
-PRIVATE void list_output(/*fp, flag, glob*/);
-PRIVATE void make_la_buttons(/*sep, fp, dn, la_url, glob*/);
-PRIVATE void make_la_buttons_pull_down(/*sep, fp, dn, la_url, glob*/);
-PRIVATE void print_rdn(/*fp, dn, glob*/);
-PRIVATE void print_rdn_pull_down(/*fp, dn, glob*/);
-PRIVATE void make_search_box(/*fp, ld, dn, glob*/);
-PRIVATE LDAPMessage *my_first_entry();
-PRIVATE LDAPMessage *my_next_entry();
-PRIVATE LDAPMessage *ldap_list_eval();
-PRIVATE void sort_parse();
-PRIVATE void get_ref_attrs();
-PRIVATE void disp_form_button();
-
-
-#endif /* _X500_ */
+++ /dev/null
-/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
-* *
-* x500_exp.h. *
-* *
-* Function:..Header-Datei fuer TWEB-Software *
-* *
-* *
-* *
-* Authors:...Dr. Kurt Spanier & Bernhard Winkler, *
-* Zentrum fuer Datenverarbeitung, Bereich Entwicklung *
-* neuer Dienste, Universitaet Tuebingen, GERMANY *
-* *
-* ZZZZZ DDD V V *
-* Creation date: Z D D V V *
-* February 13 1996 Z D D V V *
-* Last modification: Z D D V V *
-* January 10 1999 ZZZZ DDD V *
-* *
-_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_*/
-
-/*
- * $Id: x500_exp.h,v 1.6 1999/09/10 15:01:21 zrnsk01 Exp $
- *
- */
-
-#ifndef _X500_EXP_
-#define _X500_EXP_
-
-PUBLIC void do_menu(/*ld, fp, dn, glob*/);
-PUBLIC void do_xtend(/*ld, fp, dn, glob*/);
-PUBLIC int do_search(/*ld, fp, query, glob*/);
-PUBLIC void do_read(/*ld, fp, dn, amore, glob*/);
-PUBLIC void do_form(/*ld, fp, query, glob*/);
-PUBLIC void do_modify(/*ld, fp, query, glob*/);
-PUBLIC char * make_oc_to_string(/*oc*/);
-PUBLIC LDAP *get_ldap_connection( /* host, port, glob */ );
-PUBLIC void close_ldap_connections();
-
-
-#endif /* _X500_EXP_ */
+++ /dev/null
-At the time of this release, the web500gw World Wide Web/HTTP to
-X.500/LDAP gateway is between major releases. Rather than include
-outdated sources, we have included pointers to sites maintained by the
-author so that you can obtain the latest web500gw sources yourself:
-
- home page URL: http://www.tu-chemnitz.de/~fri/web500gw/
- ftp site URL: ftp://isode.tu-chemnitz.de/pub/other-src/
-
-Any comments of questions should be directed to:
-
- Frank.Richter@hrz.tu-chemnitz.de
+++ /dev/null
-Copyright 1998, Jens Moller, All rights reserved.
-This software is not subject to any license of the COLOMAR
-Group.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits should appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits should appear in the documentation.
-
-4. This notice may not be removed or altered.
-
-Redistribution and use in source and binary forms are permitted
-without restriction or fee of any kind as long as this notice
-is preserved.
-
+++ /dev/null
-PROGRAMS= web_ldap
-
-SRCS= web_ldap.c util.c
-OBJS= web_ldap.o util.o
-
-LDAP_INCDIR= ../../include
-LDAP_LIBDIR= ../../libraries
-
-XLIBS = -lldap -llber -llutil
-XXLIBS = $(SECURITY_LIBS) $(LUTIL_LIBS)
-
-web_ldap: ${OBJS} $(LDAP_LIBDEPEND)
- $(LTLINK) -o $@ $(OBJS) $(LIBS)
-
-install-local: $(PROGRAMS) FORCE
- -$(MKDIR) $(DESTDIR)$(libexecdir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 web_ldap $(DESTDIR)$(libexecdir)
- @echo ">> You must copy and edit web_ldap.cfg and web_ldap.html as needed. <<"
+++ /dev/null
-The web_ldap package contains the following files:
-
- COPYRIGHT - Your rights to use this software
- Makefile - Build file
- README - This file
- maint_form.h - HTML form processing
- process_form.h - HTML form processing
- util.c - HTML form processingg
- web_ldap.c - Form/LDAP processing
- web_ldap.cfg - configuration File
- web_ldap.html - HTML Form
- web_ldap.log.sample - Sample Log file
- web_ldap_usage.txt - Instructions for use
- web_ldap_usage.html - Instructions for use in HTML
-
-Please reveiw the web_ldap_usage.txt or web_ldap_usage.html
-file to understand how to utilize this software.
+++ /dev/null
-/* maint_form.h */
-
-#ifndef __MAINT_FORM_H
-#define __MAINT_FORM_H
-
-#define max number of passed fields.
-#define MAX_ENTRIES 400 /* way bigger than needed. */
-
-/* define the maximum length of a single config line */
-#define MAX_LINE_LEN 256
-
-typedef struct {
- char *name;
- char *val;
-} entry;
-
-/* prototypes */
-char *makeword(char *line,
- char stop);
-
-char *fmakeword(FILE *f,
- char stop,
- int *len);
-
-char x2c(char *what);
-
-void unescape_url(char *url);
-
-void plustospace(char *str);
-
-int strcompare(char* a,
- char* b);
-
-int getvalue(entry* list,
- char* key,
- char** value);
-
-int append_to_list(entry* list,
- char* key,
- char* value);
-
-void remove_leading_blanks(char* str);
-
-void remove_trailing_blanks(char* str);
-
-void pad_with_char(char* buffer,
- int length,
- char padchar);
-
-char* lower_case_string(char* inputbuf);
-
-char* upper_case_string(char* inputbuf);
-
-void strip_CR(char* buffer);
-
-void show_form_data(entry* entries);
-
-void display_html_text(char* filename);
-
-long unformat_cost(char* cost);
-
-int get_line(FILE* file,
- char* returned_line);
-
-void print_header(char* title);
-
-void maint_trailer();
-
-void maint_header(char* name);
-
-void maint_update_form(entry* list,
- char* maint_filename,
- char* DatabaseName);
-
-/*
-int draw_form_fields(char* maint_filename,
- CGIDB_REC* cgidb_rec);
-*/
-void maint_remove_form(entry* list,
- char* DatabaseName);
-
-void maint_add_form(entry* list,
- char* maint_filename,
- char* DatabaseName);
-
-/*
-char* get_field_data(CGIDB_REC* cgidb_rec,
- char* data,
- char* buffer);
-*/
-void maint_dump_db(entry* list,
- char* maint_filename,
- char* DatabaseName);
-/*
-void display_dump_entry(CGIDB_REC* cgidb_rec,
- int cols,
- char* item1,
- char* item2,
- char* item3,
- char* item4);
-*/
-void maint_upload_photo(char* MFileName);
-
-void maint_remove_photo(entry* list,
- char* MFileName);
-/*
-int copy_data_to_db_field(CGIDB_REC* cgidb_rec,
- char* field,
- char* fieldmaxlength,
- char* data);
-*/
-#endif
-
-/* end file 'maint_form.h' */
+++ /dev/null
-/* process_form.h */
-
-#ifndef __PROCESS_FORM_H
-#define __PROCESS_FORM_H
-
-#define MAX_ENTRIES 10000
-
-typedef struct {
- char *name;
- char *val;
-} entry;
-
-char *makeword(char *line, char stop);
-char *fmakeword(FILE *f, char stop, int *len);
-char x2c(char *what);
-void unescape_url(char *url);
-void plustospace(char *str);
-
-int strcompare(char* a, char* b);
-int getvalue(entry* list, char* key, char** value);
-void remove_leading_blanks(char* str);
-void remove_trailing_blanks(char* str);
-void pad_with_char(char* buffer, int length, char padchar);
-char* lower_case_string(char* inputbuf);
-char* upper_case_string(char* inputbuf);
-void strip_CR(char* buffer);
-void show_form_data(entry* entries);
-void display_html_text(char* filename);
-long unformat_cost(char* cost);
-#endif
-
-/* end file 'process_form.h' */
+++ /dev/null
-/* util.c
- *
- * This code module originates from NCSA
- * See: http://hoohoo.ncsa.uiuc.edu/cgi/
- * and: ftp://ftp.ncsa.uiuc.edu/Web/httpd/Unix/ncsa_httpd/cgi/cgi-src/
- *
- * Most of the above listed programs were combined into a single
- * file (this one) - everything here is public domain and free for
- * use in any form..
- *
- * Corrections made for SGI systems (Irix) and
- * time/date functions added - R. Scott Guthrie
- */
-
-#include "portable.h"
-
-#include <stdio.h>
-
-#include <ac/stdlib.h>
-#include <ac/time.h>
-
-#include <ac/string.h>
-#include <ac/ctype.h>
-#include <ac/unistd.h>
-
-#include "process_form.h"
-
-/*--------------*/
-/* strcompare */
-/*--------------*/
-/* This fixes the SGI strcmp function which aborts when passed
- * a NULL in place of a NULL TERMINATED STRING.
- * (The code that depended on it was ported from SUN which considered
- * a NULL to be a NULL terminated string. The standard says strcmp
- * action is undefined when passed a NULL. SGI abends.)
- */
-int strcompare(char* a, char* b)
-{
- if(a && b)
- return(strcmp(a, b)); /* neither char* is NULL */
- return(1); /* different if either (or both) char* are NULL */
-}
-
-
-/*------------*/
-/* getvalue */
-/*------------*/
-/* put a pointer to the value in 'value' for the key specified.
- */
-int getvalue(entry* list, char* key, char** value)
-{
- int index = 0;
-
- *value = NULL; /* initialize value to NULL */
-
- while(list[index].name)
- {
- if(strcmp(list[index].name, key) == 0)
- {
- *value = list[index].val;
- return(1); /* success */
- }
- index++;
- }
- return(0); /* no key value found in list */
-}
-
-
-/*------------------*/
-/* append_to_list */
-/*------------------*/
-/* Append name/value pair to end of list */
-int append_to_list(entry* list, char* key, char* value)
-{
- int index = 0;
- char* newname;
- char* newvalue;
-
- /* go to end of list */
- while(list[index].name)
- index++;
-
- if(index > MAX_ENTRIES)
- return(0); /* out of room */
-
- newname = (char *) malloc(sizeof(char) * (strlen(key) + 1));
- strcpy(newname, key);
- list[index].name = newname;
-
- newvalue = (char *) malloc(sizeof(char) * (strlen(value) + 1));
- strcpy(newvalue, value);
- list[index].val = newvalue;
-
- /* put new nulls at end. */
- index++;
- list[index].name = NULL;
- list[index].val = NULL;
- return(1); /* success */
-}
-
-/*----------------------*/
-/* remove_table_entry */
-/*----------------------*/
-/* replaces table entry 'name' name field with '~' */
-int remove_table_entry(entry* list, char* name)
-{
- int index = 0;
-
- /* search table for matching name entry */
- while(1) /* FOREVER - breaks out with return */
- {
- if(list[index].name == NULL)
- return(0); /* not in list */
-
- if(strcmp(list[index].name, name) == 0)
- {
- /* found match. remove name */
- free(list[index].name);
-
- /* allocate space for deleted name */
- if((list[index].name = (char*)malloc(2 * sizeof(char))) == NULL)
- return(0); /* malloc error */
- else
- strcpy(list[index].name, "~"); /* DELETE INDICATOR */
- return(1); /* replacement successful */
- }
- index++; /* try next name */
- }
- return(0); /* cannot get here */
-} /* remove_table_entry */
-
-
-/*------------*/
-/* makeword */
-/*------------*/
-char* makeword(char *line, char stop)
-{
- int x = 0,y;
- char *word = (char *) malloc(sizeof(char) * (strlen(line) + 1));
-
- for(x=0;((line[x]) && (line[x] != stop));x++)
- word[x] = line[x];
-
- word[x] = '\0';
- if(line[x]) ++x;
- y=0;
-
- while(line[y++] = line[x++]);
- return word;
-}
-
-
-/*-------------*/
-/* fmakeword */
-/*-------------*/
-char* fmakeword(FILE *f, char stop, int *cl)
-{
- int wsize;
- char *word;
- int ll;
-
- wsize = 102400;
- ll=0;
- word = (char *) malloc(sizeof(char) * (wsize + 1));
-
- while(1)
- {
- word[ll] = (char)fgetc(f);
- if(ll==wsize)
- {
- word[ll+1] = '\0';
- wsize+=102400;
- word = (char *)realloc(word,sizeof(char)*(wsize+1));
- }
- --(*cl);
-
- if((word[ll] == stop) || (feof(f)) || (!(*cl)))
- {
- if(word[ll] != stop) ll++;
- word[ll] = '\0';
- return word;
- }
- ++ll;
- }
- return(NULL);
-}
-
-
-/*-------*/
-/* x2c */
-/*-------*/
-char x2c(char *what)
-{
- register char digit;
-
- digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0'));
- digit *= 16;
- digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A')+10 : (what[1] - '0'));
- return(digit);
-}
-
-/*----------------*/
-/* unescape_url */
-/*----------------*/
-void unescape_url(char *url)
-{
- register int x,y;
-
- for(x=0,y=0;url[y];++x,++y)
- {
- if((url[x] = url[y]) == '%')
- {
- url[x] = x2c(&url[y+1]);
- y+=2;
- }
- }
- url[x] = '\0';
-}
-
-
-/*---------------*/
-/* plustospace */
-/*---------------*/
-void plustospace(char *str)
-{
- register int x;
-
- for(x=0;str[x];x++) if(str[x] == '+') str[x] = ' ';
-}
-
-
-/*-------------------------*/
-/* remove_leading_blanks */
-/*-------------------------*/
-void remove_leading_blanks(char* str)
-{
- int i;
- while(str[0] == ' ')
- {
- i = 1;
- do
- {
- str[i-1] = str[i];
- } while(str[i++]);
- }
-} /* end 'remove_leading_blanks()' */
-
-
-/*-------------------------*/
-/* remove_trailing_blanks */
-/*-------------------------*/
-void remove_trailing_blanks(char* str)
-{
- while(str[strlen(str) - 1] == ' ')
- str[strlen(str) - 1] = '\0';
-} /* end 'remove_trailing_blanks()' */
-
-
-/*-----------------*/
-/* pad_with_char */
-/*-----------------*/
-void pad_with_char(char* buffer, int length, char padchar)
-{
- /* if the 'buffer' is >= then 'length', return.
- * Pad the 'buffer' with 'padchar' until = 'length'
- */
- int pos;
- while((pos = strlen(buffer)) < length)
- {
- buffer[pos] = padchar;
- buffer[pos+1] = '\0';
- }
-} /* end pad_with_char */
-
-
-/*---------------------*/
-/* lower_case_string */
-/*---------------------*/
-char* lower_case_string(char* inputbuf)
-{
- int pos = 0;
-
- while(inputbuf[pos])
- {
- inputbuf[pos] = (char)tolower((unsigned char) inputbuf[pos]);
- pos++;
- }
- return(inputbuf);
-} /* lower_case_string */
-
-
-/*---------------------*/
-/* upper_case_string */
-/*---------------------*/
-char* upper_case_string(char* inputbuf)
-{
- int pos = 0;
-
- while(inputbuf[pos])
- {
- inputbuf[pos] = (char)toupper((unsigned char) inputbuf[pos]);
- pos++;
- }
- return(inputbuf);
-} /* upper_case_string */
-
-
-/*------------*/
-/* strip_CR */
-/*------------*/
-void strip_CR(char* buffer)
-{
- char* bufferptr;
- char* newptr;
-
- bufferptr = buffer;
- newptr = buffer;
-
- while(*bufferptr)
- {
- if(*bufferptr != '\r')
- {
- *newptr = *bufferptr;
- newptr++;
- }
- bufferptr++;
- }
- *newptr = '\0';
-
- return;
-}
-
-/*------------------*/
-/* show_form_data */
-/*------------------*/
-/* THIS ROUTINE IS USED FOR DEBUGGING and will not be called in production */
-void show_form_data(entry* entries)
-{
- int x = 0;
-
- printf("<HR><H1>Form Data</H1>");
- printf("The following Name Value pairs currently exist:<p>%c",10);
- printf("<ul><pre>%c",10);
-
- while(entries[x].name)
- {
- printf("<li> <code>%s = [%s]</code>%c",entries[x].name,
- entries[x].val,10);
- x++;
- }
- printf("</pre></ul>%c",10);
-}
-
-/*------------------------*/
-/* maint_show_form_data */
-/*------------------------*/
-/* THIS ROUTINE IS USED FOR DEBUGGING and will not be called in production */
-void maint_show_form_data(entry* entries)
-{
- int x = 0;
-
- printf("Content-type: text/html\n\n");
- printf("<HR><H1>Form Data</H1>");
- printf("The following Name Value pairs currently exist:<p>%c",10);
- printf("<ul><pre>%c",10);
-
- while(entries[x].name)
- {
- printf("<li> <code>%s = [%s]</code>%c",entries[x].name,
- entries[x].val,10);
- x++;
- }
- printf("</pre></ul>%c",10);
-}
-
-/*---------------------*/
-/* display_html_text */
-/*---------------------*/
-/* display the text found in the indicated file */
-void display_html_text(char* filename)
-{
- FILE *fp;
- char buffer[256];
-
- if((fp = fopen(filename, "r")) == NULL)
- {
- printf("%s%s%s",
- "<p><b>(OOPS... We are unable to open file ",
- filename,
- " for reading)</b><p>\n");
- }
- while(fgets(buffer, 256, fp) != NULL)
- {
- if(buffer[strlen(buffer) - 1] == '\n')
- buffer[strlen(buffer) - 1] = '\0';
- printf("%s\n", buffer);
- }
- fclose(fp);
- return ;
-} /* display_html_text */
-
-
-/*-----------------*/
-/* unformat_cost */
-/*-----------------*/
-/* this routine converts a string value and
- * converts it to an integer.
- */
-long unformat_cost(char* cost)
-{
- char buf[100];
- int buf_siz = 0;
-
- char* spos = cost;
- char* dpos = buf;
-
- /* Make sure a string was passed */
- if(!spos)
- return(0L);
-
- /* while in the string */
- while(*spos)
- {
- if(*spos == '.')
- break;
- if(isdigit((unsigned char) *spos))
- *dpos++ = *spos;
- spos++;
- if(buf_siz++ == 98) /* make sure we don't overrun buf */
- break;
- }
- *spos = '\n';
- return(atol(buf));
-}
-
-/*---------------*/
-/* digits_only */
-/*---------------*/
-int digits_only(char* str)
-{
- char* pos;
-
- pos = str;
- while(*pos)
- {
- if(!isdigit((unsigned char) *pos))
- return(0); /* non-digit found */
- pos++;
- }
- return(1);
-}
-
-/*-------------*/
-/* util_year */
-/*-------------*/
-/* return current year -> 0 thru 99 */
-int util_year()
-{
- time_t t;
- struct tm *tptr;
- int ret_val;
- time(&t);
- tptr = localtime(&t);
- ret_val = tptr->tm_year;
- return(ret_val);
-}
-
-/*--------------*/
-/* util_month */
-/*--------------*/
-/* return Month of current year -> 1 thru 12 */
-int util_month()
-{
- time_t t;
- struct tm *tptr;
- int ret_val;
- time(&t);
- tptr = localtime(&t);
- ret_val = tptr->tm_mon;
- return(ret_val + 1);
-}
-
-/*------------*/
-/* util_day */
-/*------------*/
-/* return day of Month -> 1 thru 31 */
-int util_day()
-{
- time_t t;
- struct tm *tptr;
- int ret_val;
- time(&t);
- tptr = localtime(&t);
- ret_val = tptr->tm_mday;
- return(ret_val);
-}
-
-/*-------------*/
-/* util_hour */
-/*-------------*/
-/* return hour of day -> 0 thru 23 */
-int util_hour()
-{
- time_t t;
- struct tm *tptr;
- int ret_val;
- time(&t);
- tptr = localtime(&t);
- ret_val = tptr->tm_hour;
- return(ret_val);
-}
-
-/*---------------*/
-/* util_minute */
-/*---------------*/
-/* return minute of day -> 0 thru 59 */
-int util_minute()
-{
- time_t t;
- struct tm *tptr;
- int ret_val;
- time(&t);
- tptr = localtime(&t);
- ret_val = tptr->tm_min;
- return(ret_val);
-}
-
-/*---------------*/
-/* util_second */
-/*---------------*/
-/* return second of day -> 0 thru 59 */
-int util_second()
-{
- time_t t;
- struct tm *tptr;
- int ret_val;
- time(&t);
- tptr = localtime(&t);
- ret_val = tptr->tm_sec;
- return(ret_val);
-}
-
-/* end file 'util.c' */
+++ /dev/null
-/* web_ldap.c
- * Form Processing Web application that returns html based
- * LDAP data with definitions from a configuration file.
- *
- * Jens Moller - Dec 11, 1998
- */
-
-#include "portable.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-#include <ac/stdlib.h>
-#include <ac/string.h>
-#include <ac/time.h>
-#include <ac/unistd.h>
-
-#include <lber.h>
-#include <ldap.h>
-#include "ldif.h"
-#include "maint_form.h" /* for HTML Form manipulations */
-
-/* default values */
-#ifndef LDAP_PORT
-#define LDAP_PORT 389
-#endif
-#ifndef SERVER
-#define SERVER "ldap.bigfoot.com"
-#endif
-#ifndef CONFIG
-#define CONFIG "web_ldap.cfg"
-#endif
-
-#define MAX_ATTRIB 100
-#define MAX_CHARS 256
-#define version "v 1.1"
-
-entry entries[MAX_ENTRIES];
-
-typedef struct {
- char servername[MAX_CHARS];
- char query[MAX_CHARS];
- char searchbase[MAX_CHARS];
- char htmlfile[MAX_CHARS];
- int ldap_port_num;
- int num_of_attrib;
- int debug; /* if zero, no debug text displayed */
-} LDAP_INFO;
-
-typedef struct {
- char title[40];
-} ATTRIB_TITLE;
-
-/* function Prototypes */
-void process_cfg(char *config,
- LDAP_INFO *ldap_data,
- char *attribute_array[],
- ATTRIB_TITLE *disp_attrib);
-
-int strscn(char *istring,
- char *tstring);
-
-void upcase_string(char *array,
- char *uparray);
-
-int find_comma(char *array);
-
-int find_colon(char *array);
-
-void squeeze_blanks(char *array);
-
-/* Pass in nothing and use the default config file, or
- * pass in the config file to use */
-
-main(int argc, char ** argv) {
- LDAP *ld;
- LDAPMessage *res, *e;
- int i, j, cl, x, how_many;
- char *a, *dn, *value;
- BerElement *ptr;
- char **vals;
- char *read_attrs[MAX_ATTRIB]; /* up to MAX_ATTRIB attribs returned */
- struct berval **bvals;
- char attrs_name[MAX_CHARS];
- char config_file[MAX_CHARS];
- char temp[MAX_CHARS];
- char passed_in[MAX_CHARS];
- LDAP_INFO ldap_data;
- ATTRIB_TITLE attribute[MAX_ATTRIB];
- time_t now;
- FILE *logfp;
-
-
- /* html initialization */
- printf("Content-type: text/html\n\n");
- printf("<html>\n<head>\n<title>Web Ldap Results</title>\n");
- printf("</head>\n");
- printf("<body text=\"#000000\" bgcolor=\"#FFFFFF\">\n");
- printf("<h2>Web LDAP Results</h2>\n");
-
- /* initialize ldap_data structure */
- memset(ldap_data.servername,0,MAX_CHARS);
- memset(ldap_data.query,0,MAX_CHARS);
- memset(ldap_data.searchbase,0,MAX_CHARS);
- memset(ldap_data.htmlfile,0,MAX_CHARS);
- ldap_data.ldap_port_num = 0;
- ldap_data.num_of_attrib = 0;
- ldap_data.debug = 0;
-
- memset(passed_in,0,MAX_CHARS);
-
- if (argc > 1) { /* interactive mode */
-
- /* To use in this fashion when run from a Unix command line:
- *
- * > web_ldap DEF "cn=j*moller"
- * > web_ldap DEF cn=jens moller
- *
- * NOTE: The quotes are required if a special
- * character is a part of the LDAP request such
- * as the asterix (*) in the above example.
- */
-
- /* Parameters passed in are
- *
- * argv[0] = Program Name (argc = 1)
- * argv[1] = Config File Name (argc = 2)
- * argv[2] = Ldap Request (argc => 3)
- */
-
- /* do we use a different config file ? */
- strcpy(config_file, CONFIG);
-
- if (argc == 2){
- if ((strcmp(argv[1],"DEF")) == 0) {
- strcpy(config_file, CONFIG);
- }
- else {
- strcpy(config_file, argv[1]);
- }
- }
-
- /* is there an LDAP request?
- * if so, it may take up to 3 argv[x] values */
-
- if (argc >= 3) {
- if (argc == 3) {
- strcpy(temp, argv[2]);
- }
-
- if (argc == 4) {
- strcpy(temp, argv[2]);
- strcat(temp, " ");
- strcat(temp, argv[3]);
- }
-
- if (argc == 5) {
- strcpy(temp, argv[2]);
- strcat(temp, " ");
- strcat(temp, argv[3]);
- strcat(temp, " ");
- strcat(temp, argv[4]);
- }
-
- j = 0;
- for (i=0; i<strlen(temp);i++) {
- if ((temp[i] != '"') &&
- (temp[i] != '\\')){
- passed_in[j] = temp[i];
- j++;
- }
- }
- }
- }
- else { /* Non Interactive Mode - read from a form */
- if (strcompare(getenv("REQUEST_METHOD"),"POST"))
- {
- printf("<p>++ Error - This script should be referenced with a METHOD of POST.\n");
- exit( EXIT_FAILURE );
- }
- if (strcompare(getenv("CONTENT_TYPE"),"application/x-www-form-urlencoded"))
- {
- printf("<p>++ Error - This script can only be used to decode form results. \n");
- exit( EXIT_FAILURE );
- }
- cl = atoi(getenv("CONTENT_LENGTH"));
-
- for(x=0; cl && (!feof(stdin));x++)
- {
- entries[x].val = fmakeword(stdin,'&',&cl);
- plustospace(entries[x].val);
- unescape_url(entries[x].val);
- entries[x].name = makeword(entries[x].val,'=');
- how_many = x; /* keep track of how many we got */
-
-#ifdef DEBUG_TEXT
- printf("entries[%d].name=%s - ",x,entries[x].name);
- printf("entries[%d].val =%s<br>\n",x,entries[x].val);
-#endif
- }
-
- entries[x].name = NULL; /* entry after last valid one */
- entries[x].val = NULL; /* is set to NULL */
-
- if(!getvalue(entries, "FORM", &value))
- {
- printf("%s%s%s", "This script expected a 'FORM' value returned ",
- "and did not get one. Make sure the HTML used for this ",
- "script is correct.");
- exit( EXIT_FAILURE );
- }
-
- /* Looking for:
- * LDAP_REQUEST - actual LDAP request, ie 'cn=j*moller'
- * CONFIG = Configuration file
- */
-
- strcpy(config_file, CONFIG);
-
- if(getvalue(entries, "LDAP_REQUEST", &value)) {
- strcpy(passed_in,value);
- }
-
- if(getvalue(entries, "CONFIG", &value)) {
- if ((strcmp("DEF",value)) == 0) {
- strcpy(config_file, CONFIG);
- }
- else {
- strcpy(config_file, value);
- }
- }
-
- }
-
- /* zero out the attribute pointers/data area */
- for (i = 0; i < MAX_ATTRIB; i++) {
- read_attrs[i] = NULL;
- memset(attribute[i].title,0,40);
- }
-
- /* read in the config file */
- process_cfg(config_file, &ldap_data, read_attrs, attribute);
-
- if (passed_in[0] != 0) {
- strcpy(ldap_data.query,passed_in);
- }
-
- if (ldap_data.debug != 0) {
- if ((logfp = fopen("web_ldap.log","w")) == 0) {
- printf("<font color=red size=5>\n");
- printf("<p>Unable to open requested log file: web_ldap.log<p>\n");
- printf("</font>\n");
- }
- else {
- time(&now);
- sprintf(temp,"==> web_ldap request made at: %s\n",ctime(&now));
- fputs(temp,logfp);
- if (argc > 1) {
- sprintf(temp," Interactive Unix Command Line Request:\n\n");
- }
- else {
- sprintf(temp," Browser/Form Request:\n\n");
- }
- fputs(temp,logfp);
- sprintf(temp," Server Name: %s\n", ldap_data.servername);
- fputs(temp,logfp);
- sprintf(temp," Query: %s\n", ldap_data.query);
- fputs(temp,logfp);
- sprintf(temp," Passed In: %s\n", passed_in);
- fputs(temp,logfp);
- sprintf(temp," Searchbase: %s\n",ldap_data.searchbase);
- fputs(temp,logfp);
- if (ldap_data.htmlfile[0] != 0) {
- sprintf(temp," HTML File: %s\n",ldap_data.htmlfile);
- }
- else {
- sprintf(temp," HTML File: Non Provided - Use Default Processing\n");
- }
- fputs(temp,logfp);
- sprintf(temp," LDAP Port: %d\n",ldap_data.ldap_port_num);
- fputs(temp,logfp);
- sprintf(temp," Number of Attributes: %d\n",ldap_data.num_of_attrib);
- fputs(temp,logfp);
- if (ldap_data.num_of_attrib > 0) {
- for (i = 0; i < ldap_data.num_of_attrib; i++) {
- sprintf(temp," - %s\n",read_attrs[i]);
- fputs(temp,logfp);
- }
- }
-
- sprintf(temp,"\n==< Process Arguments: %d >==\n\n argv[0]: %s\n",
- argc, argv[0]);
- fputs(temp,logfp);
- if (argc >= 2) {
- sprintf(temp," argv[1]: %s\n",argv[1]);
- fputs(temp,logfp);
- }
- if (argc >= 3) {
- sprintf(temp," argv[2]: %s\n",argv[2]);
- fputs(temp,logfp);
- }
- if (argc >= 4) {
- sprintf(temp," argv[3]: %s\n",argv[3]);
- fputs(temp,logfp);
- }
- if (argc >= 5) {
- sprintf(temp," argv[4]: %s\n",argv[4]);
- fputs(temp,logfp);
- }
- fflush(logfp);
- fclose(logfp);
- }
- }
-
- if (ldap_data.debug != 0) {
- if ((logfp = fopen("web_ldap.log","a")) == 0) {
- }
- else {
- time(&now);
- sprintf(temp,"\n==< Results >==\n\n");
- fputs(temp,logfp);
- sprintf(temp,"** performing ldap_init at %s\n", ctime(&now));
- fputs(temp,logfp);
- fflush(logfp);
- fclose(logfp);
- }
- }
- if ( (ld = ldap_init(ldap_data.servername, ldap_data.ldap_port_num) ) == NULL)
- {
- printf("<font color=red><b>ldap_init error</b></font>\n");
- if (ldap_data.debug != 0) {
- if ((logfp = fopen("web_ldap.log","a")) == 0) {
- }
- else {
- sprintf(temp,"++ ldap_init error\n");
- fputs(temp,logfp);
- fflush(logfp);
- fclose(logfp);
- }
- }
- printf("</body>\n</html>\n");
- exit( EXIT_FAILURE );
- }
-
- /*authenticate as nobody */
- if (ldap_data.debug != 0) {
- if ((logfp = fopen("web_ldap.log","a")) == 0) {
- }
- else {
- time(&now);
- sprintf(temp,"** performing ldap_bind_s at %s\n",ctime(&now));
- fputs(temp,logfp);
- fflush(logfp);
- fclose(logfp);
- }
- }
- if(ldap_bind_s(ld, "", "", LDAP_AUTH_SIMPLE) != 0)
- {
- printf("<font color=red><b>");
- ldap_perror (ld, "ldap_simple_bind_s");
- printf("</b></font>\n");
-
- if (ldap_data.debug != 0) {
- if ((logfp = fopen("web_ldap.log","a")) == 0) {
- }
- else {
- sprintf(temp,"++ ldap_bind_s error\n");
- fputs(temp,logfp);
- fflush(logfp);
- fclose(logfp);
- }
- }
- printf("</body>\n</html>\n");
- exit( EXIT_FAILURE );
- }
-
- printf("<b>Directory Lookup Results</b>\n<pre>\n");
- printf("<hr><p>\n<pre>\n");
-
- /* Get data */
- if (ldap_data.debug != 0) {
- if ((logfp = fopen("web_ldap.log","a")) == 0) {
- }
- else {
- time(&now);
- sprintf(temp,"** performing ldap_search_s at %s\n",ctime(&now));
- fputs(temp,logfp);
- fflush(logfp);
- fclose(logfp);
- }
- }
- if(ldap_search_s(ld, ldap_data.searchbase, LDAP_SCOPE_SUBTREE,
- ldap_data.query, read_attrs, 0, &res)
- != LDAP_SUCCESS)
- {
- ldap_perror(ld, "ldap_search_s");
- }
-
- for (e=ldap_first_entry(ld, res); e != NULL; e=ldap_next_entry(ld, e))
- {
- dn = ldap_get_dn(ld, e);
-
- if (ldap_data.debug != 0) {
- if ((logfp = fopen("web_ldap.log","a")) == 0) {
- }
- else {
- sprintf(temp," dn=%s\n", dn);
- fputs(temp,logfp);
- fflush(logfp);
- fclose(logfp);
- }
- }
-
- /*print each attribute */
- for (a = ldap_first_attribute(ld, e, &ptr);
- a != NULL;
- a = ldap_next_attribute(ld, e, ptr) )
- {
- strcpy(attrs_name, a);
- /* print attribute name */
- printf("%s: ", attrs_name);
-
- /*print each value */
-
- vals = ldap_get_values(ld, e, a);
-
- for(i=0; vals[i] != NULL; i++)
- /* print value of attribute */
- printf("%s\n", vals[i],strlen(vals[i]));
-
- ldap_value_free(vals);
- } /*end for*/
- free(a);
- free(dn);
- printf("<p>\n");
- }
- /*free the search results */
- ldap_msgfree (res);
-
- printf("</pre>\n");
-
- ldap_unbind(ld);
-
- if (ldap_data.debug != 0) {
- if ((logfp = fopen("web_ldap.log","a")) == 0) {
- }
- else {
- time(&now);
- sprintf(temp,"\nFinished gathering results at %s\n",ctime(&now));
- fputs(temp,logfp);
- sprintf(temp,"==< Done >==\n");
- fputs(temp,logfp);
- fflush(logfp);
- fclose(logfp);
- }
- }
- printf("</body>\n</html>\n");
-}
-
-/* Process the user passed in configuration file */
-void process_cfg(char *config,
- LDAP_INFO *ldap_data,
- char *attribute_array[],
- ATTRIB_TITLE *disp_attrib) {
-
- char file_data[1024];
- char upfile_data[1024];
- char temp[1024];
- int lcomma, lcolon, attrib_pos;
- FILE * fp;
-
- strcpy(ldap_data->servername,SERVER);
- ldap_data->ldap_port_num = LDAP_PORT;
- strcpy(ldap_data->query,"cn=jens*moller");
-
- /* config file needs to be in the cgi-bin directory */
- if ((fp = fopen(config,"r")) == 0) {
- return;
- }
-
- attrib_pos = 0;
-
- for (;;) { /* read until eof */
- fgets (file_data,1024,fp);
- if (feof(fp)) break;
- if (file_data[0] != '#') { /* skip commented lines */
- upcase_string(file_data,upfile_data);
-
- /* get the server specific data */
- if (strscn(upfile_data,"SERVER:") == 0) {
- lcolon = find_colon(file_data) + 1;
- lcomma = find_comma(file_data);
- if (lcomma > 0) {
- memset(ldap_data->servername,0,MAX_CHARS);
- strncpy(ldap_data->servername,&file_data[lcolon],
- lcomma - lcolon);
- ldap_data->ldap_port_num = atoi(&file_data[lcomma + 1]);
- }
- else {
- strcpy(ldap_data->servername,&file_data[lcolon]);
- }
- squeeze_blanks(ldap_data->servername);
- }
- else if (strscn(upfile_data,"SEARCHBASE:") == 0) {
- lcolon = find_colon(file_data) + 1;
- strcpy(ldap_data->searchbase,&file_data[lcolon]);
- squeeze_blanks(ldap_data->searchbase);
- }
- else if (strscn(upfile_data,"HTMLFILE:") == 0) {
- lcolon = find_colon(file_data) + 1;
- strcpy(ldap_data->htmlfile,&file_data[lcolon]);
- }
- else if (strscn(upfile_data,"DEBUG:") == 0) {
- lcolon = find_colon(file_data) + 1;
- ldap_data->debug = atoi(&file_data[lcolon]);
- }
-
- /* get the attribute list */
- else if ((file_data[0] != ' ') && (file_data[0] != 0)) {
- memset(temp,0,1024);
- /* data appears as a comma delimited list, where:
- *
- * attrib_name (char),display_length (int)
- *
- * (default length = 20 if display_length undefined)
- *
- * is how each record is defined */
- lcomma = find_comma(file_data);
- if (lcomma < 0) {
- strcpy(temp,file_data);
- squeeze_blanks(temp);
- }
- else {
- strncpy(temp,file_data,lcomma);
- squeeze_blanks(temp);
- }
- attribute_array[attrib_pos] = malloc(strlen(temp));
- strcpy(attribute_array[attrib_pos],temp);
- attrib_pos++;
- ldap_data->num_of_attrib = attrib_pos;
- }
- }
- }
-}
-
-/* find character substring matches */
-int strscn(char * istring,
- char * tstring) {
- int i, status, icmp, len;
- status = -1;
- len = (strlen(istring) + 1) - strlen(tstring);
- if (len < 1) len = 1;
- for (i=0;i<len ;i++) {
- icmp = memcmp(&istring[i],tstring,strlen(tstring));
- if (icmp == 0) {
- status = i;
- break;
- }
- }
- return status;
-}
-
-/* convert the array to uparray, where uparray contains upper
- * case characters */
-void upcase_string(char *array,
- char *uparray) {
- int i;
- for (i=0; i < strlen(array); i++) {
- uparray[i] = toupper((unsigned char) array[i]);
- uparray[i + 1] = 0;
- }
- return;
-}
-
-/* return the position of the first comma - ',' - from within a string */
-int find_comma(char *array){
- int i;
- for (i = 0; i < strlen(array); i++) {
- if (array[i] == ',') return(i);
- }
- return -1;
-}
-
-/* return the position of the first colon - '.' - from within a string */
-int find_colon(char *array){
- int i;
- for (i = 0; i < strlen(array); i++) {
- if (array[i] == ':') return(i);
- }
- return -1;
-}
-
-/* Remove unneeded blanks from a character array. Don't leave
- * any at the end & throw away any newline characters */
-void squeeze_blanks(char *array){
- int i, pos, blank;
- char temp[1024];
- memset(temp,0,1024);
-
- pos = 0; /* location within temp array */
- blank = 0; /* # of blanks written in a row */
-
- for (i = 0; i < strlen(array); i++) {
- if (array[i] != ' ') {
- temp[pos] = array[i];
- blank = 0;
- pos++;
- }
- else if ((blank == 0) &&
- (array[i] == ' ') &&
- (pos != 0)) {
- temp[pos] = array[i];
- blank += 1;
- pos++;
- }
- }
- strcpy(array,temp);
- if (array[strlen(array) - 1] <= ' ')
- array[strlen(array) - 1] = 0;
-}
+++ /dev/null
-#
-# web_ldap.cfg
-#
-#
-# Servers to access:
-#
-# server:dns_name,port_number - default = ldap.bigfoot.com,389
-server:ldap.bigfoot.com,389
-#
-# searchbase:?? Sample: 'o=Xyz, c=US', default - blank (nothing).
-searchbase:
-#
-# debug: Debug Mode; 0 = off, any other integer = on
-debug:1
-#
-# columns list across based on the order in the
-# attribute list.
-#
-# NOTE: Unknown Attributes will be ignored - so list any
-# that you want. To find out what attributes a server
-# has for a given entry, leave the attribute list blank.
-#
-# attribute list - default = all returned of nothing defined
-#
-#cn
-#email
-# done
+++ /dev/null
-<html>
-<head>
-<title>Web LDAP Access</title>
-</head>
-<body text="#000000"
-bgcolor="#FFFFCC">
-<h2>Web LDAP Access</h2>
-<!-- Form Action Statement -->
-<form action="/cgi-bin/web_ldap" method="POST">
-<input type=hidden name="FORM" value="300">
-<p>
-Please fill in the LDAP request you desire. You may use
-wildcards (*) in this fashion:
-<ul>
-<b>Common Name Examples</b><p>
-<li>cn=jens moller
-<li>cn=*moller
-<li>cn=j* moller
-<p>
-<b>Surname Examples</b><p>
-<li>sn=moller
-<li>sn=*moller
-</ul>
-<p>
-You may specify a configuration file if you have created a
-new one, otherwise, leave it set to "DEF".
-<hr>
-
-<pre>
- LDAP Request: <input type="text" size="40" name="LDAP_REQUEST">
-
- Config File: <input type="text" size="40" value="DEF" name="CONFIG">
-</pre>
-
-<input type="submit" name="button" value="Generate Results">
-<input type="reset" value="Reset">
-</ul>
-<p>
-</form>
-<hr>
-This is a freeware prototype application that includes the
-source code. Please study it if you need to understand how it
-works. It currenly only does simple LDAP Directory reads, however,
-an interactive application has to start somewhere.
-<p>
-Authored by: <a href="mailto:Jens@colomar.com">Jens Moller</a>.
-</body>
-</html>
-
-
+++ /dev/null
-==> web_ldap request made at: Thu Dec 10 12:17:02 1998
-
- Interactive Unix Command Line Request:
-
- Server Name: ldap.bigfoot.com
- Query: cn=jens*moller
- Passed In:
- Searchbase:
- LDAP Port: 389
- Number of Attributes: 0
-
---- Process Arguments: 2 ----
-
- argv[0]: web_ldap
- argv[1]: DEF
-
-==< Results >==
-
-** performing ldap_open at Thu Dec 10 12:17:02 1998
-
-** performing ldap_bind_s at Thu Dec 10 12:17:02 1998
-
-** performing ldap_search_s at Thu Dec 10 12:17:02 1998
-
- dn=cn="JENS MOLLER",mail=jmoller@con5097.cs.mci.com,c=US,o=con5097.cs.mci.com
- dn=cn="JENS MOLLER",mail=100321.3153@compuserve.com,c=US,o=compuserve.com
- dn=cn="jens moller",mail=jens1lund2moller@hotmail.com,c=US,o=hotmail.com
- dn=cn="Jens Moller",mail=jensklethmoller@hotmail.com,c=US,o=hotmail.com
- dn=cn="jens moller",mail=jamoller@hotmail.com,c=US,o=hotmail.com
- dn=cn="Jens Mollerup",mail=jmollerup@aki.ku.dk,c=US,o=aki.ku.dk
-
-Finished gathering results at Thu Dec 10 12:17:02 1998
-
-==< Done >==
+++ /dev/null
-<html>
-<title>web_ldap_usage</title>
-<body text="#000000"
-bgcolor="#FFFFFF">
-
-<h2>web_ldap version 1.1, OpenLDAP variant</h2>
-
-This is an OpenLDAP port of the web_ldap program.
-<p>
-<i>
-The files provided in the file set for 'web_ldap'
-were developed under the GNU General Public License (GPL).
-Under the GPL, the source code is freely-distributed and available
-to the general public. There is no warranty on the software,
-and it does not come with support, however, I would appreciate
-it if you emailed any bug-fixes you create to me
-(<a href="mailto:jens@colomar.com">jens@colomar.com</a>) and
-<a href="mailto:OpenLDAP-its@OpenLDAP.org">OpenLDAP-its@OpenLDAP.org</a>.
-<p>
-All code here is generic ISO C, allowing most Unix compilers
-to generate the required object files and executable images.
-It was tested against an Apache HTTPD server and uses no
-special HTML functionality that does not appear within V 3.x
-versions of Netscapes or Microsofts Web Browsers. The goal was
-to create a starting point example to help people build
-effective interactive HTML based LDAP clients.
-</i>
-<h3>Introduction:</h3>
-
-The 'web_ldap' package is a complete LDAP application that
-provides a functional Web Server Based client. The intent
-is to give you a working example that you can expand upon
-for your own needs. It does not solve a specific problem
-for you, rather it solves a general problem by giving
-you a functional starting point from where to begin your
-development efforts. It runs under Unix.
-<p>
-The application consists of a number of C programs, header
-files, an HTML file with form entry, a configuration file
-and a sample makefile. You will need the LDAP SDK for your
-specific Unix System (both the UofM libraries and Netscape
-libraries - which are also free - have been tested).
-<p>
-The tool allows you to specify that actions taken
-be logged to a file. This provides you a method by which
-you can build out larger applications and see what is happening.
-<p>
-The application can be run interactively (without use of
-a Web Browser) but was intended for use as an HTML LDAP Web
-page application.
-<p>
-One thing to consider when running a program of this nature
-is that there are 2 totally different sets of environments
-involved. The program is written assuming very little in
-the way of file/directory organization. As such it looks for
-files either in the directory it was run from, or where ever
-you have configured your Web Server to look for things.
-<p>
-The C CGI program will attempt to open a default configuration
-file called 'web_ldap.cfg'. If you set the debug mode on
-in the configuration file, it will also attempt to create
-a log file called 'web_ldap.log' in the same directory as
-the 'web_ldap.cfg' files appears in.
-<p>
-The 2 environments are 'Interactive' and 'Web Server'.
-<p>
-When you execute the application from a command line such as:
-<pre>
- > web_ldap DEF cn=jens moller
-</pre>
-All actions take place in the same directory that the web_ldap
-program resides in. Most people would typically build an
-application of this nature in one of their own directories and
-this would give them Read/Write access to all of the files
-associated with the program. Any file restrictions or capabilities
-that you have will be enabled as part of your session.
-<p>
-This is quite different than when you ask a Web Server to
-execute the program for you. The Web Server is typically
-using the user 'nobody'. This is not you, its a separate
-application user and it may not have access to the same
-files that you have nor the same process capabilities.
-<p>
-When your program executes from a Web Browser, you will
-see something like:
-<pre>
- http://my.system.com/cgi-bin/web_ldap
-
-</pre>
-displayed by the Web Browser as the URL that its executing.
-The Web Server is executing the program on your behalf.
-File protections normally cause initial problems, possibly
-because the Web Browser doesn't own the files or doesn't
-have execute access. For your initial testing, please set these
-files to full access - ie. 'chmod 777 web_ldap*' - You can
-adjust the file protections once you get everything working.
-If you get errors - start with this simple change.
-
-<h3>Building the application:</h3>
-
-Requires ISO C (your standard OS compiler or GCC should
-work fine).
-<p>
-Under OpenLDAP, you should build with the following commands after
-having configured and built OpenLDAP itself:
-<pre>
- cd contrib/web_ldap
- make depend
- make
-</pre>
-
-<h3>Configuration:</h3>
-
-Its a very simple tool that allows you to make LDAP requests
-to any existing LDAP Directory Server. By default, it
-attempts to connect to 'ldap.bigfoot.com', which is a
-commercial LDAP server on the Internet - usually available
-from anywhere.
-<p>
-To specify a different LDAP server, you could either modify
-the program to default elsewhere, or you could modify the
-existing 'web_ldap.cfg' file, or create another one with
-a different name.
-<p><i>
-NOTE: A '#' in the first column of any line
-in the configuration file is considered a comment.
-</i>
-<p>
-The configuration file allows you specify:
-<pre>
- server:
-</pre>
-This is the servername. For example:
-<pre>
- server:ldap.bigfoot.com,389
-</pre>
-connects you up to port 389 on the ldap server 'ldap.bigfoot.com'.
-You can specify one of your own servers here if you desire.
-<p>
-Next you will see:
-<pre>
- searchbase:
-</pre>
-This is where within a tree you want to start looking. For
-'ldap.bigfoot.com', you would leave this blank and it will
-look in all the trees. For many companies a specific tree
-structure will be defined, and you will want to specify the
-highest point in the tree structure that defines the area that
-you are interested in. For example, if you have a tree that
-starts at 'c=US', and branches at 'o=ABC, c=US' and
-'o=XYZ, c=US', you could specify:
-<pre>
- searchbase:c=US
-</pre>
-and search both 'o=ABC, c=US' and 'o=XYZ, c=US', or
-if you only wanted to search against 'o=ABC, c=US',
-you could specify:
-<pre>
- searchbase:o=ABC, c=US
-</pre>
-If you want to turn on a simple Debug mode, you can specify any number
-other than zero for 'debug:'. For example:
-<pre>
- debug:1
-</pre>
-turns on the Debug logging mode, and
-<pre>
- debug:0
-</pre>
-turns it off. Debug logging simply creates a file called
-'web_ldap.log' in the same directory that the web_ldap
-executable is located. It flushes everything after each
-event, so if it gets stuck anywhere, you will be able
-to see it. It also time-stamps most of the results, so you
-can get an idea where things are running faster and/or
-slower for different queries.
-<p>
-The remainder of the configuration file is where you list
-the attributes that you are interested in displaying.
-<p>
-You could list parameters (up to 100) like:
-<pre>
- cn
- givenname
- sn
-</pre>
-and that is all it will return. If you don't specify
-anything, it returns everything it finds. if you
-specify an attribute that the directory has never
-heard of (ie. its not a member of any object class
-anyone has defined), that attribute will simply be
-ignored. If you misspell an attribute name and wonder
-why it never gets listed in the results - this might be
-why. If you specify an attribute that some users have and
-others don't, only ones with that attribute will list
-a value for it.
-<p>
-Directory data can be multi-valued. This means that any
-attribute could have multiple values. This application will
-list all the values it finds for any given attribute.
-
-
-<h3>Where to put the files:</h3>
-
-If running this interactively (from a Unix shell prompt),
-all the files can reside in any of your home directories.
-I suggest that you test the application in your home
-directory first.
-<p>
-If running this application from a Web Server, you need
-to find out where the Web Server keeps its cgi applications
-and where it keeps its html applications. This varies
-from operating system to operating system and Web Server
-to Web Server.
-<p>
-Once you have located the cgi-bin (or equivalent) directory,
-put these 2 files there:
-<pre>
- web_ldap
- web_ldap.cfg
-</pre>
-then make sure that these files are accessible to the Web
-Server by executing the Unix shell command:
-<pre>
- > chmod 777 web_ldap*
-</pre>
-Now find the HTML source directory. Copy
-<pre>
- web_ldap.html
-</pre>
-to this directory. Make sure that this file is accessible to the Web
-Server by executing the Unix shell command:
-<pre>
- > chmod 777 web_ldap*
-</pre>
-
-<h3>Running the application:</h3>
-
-Test it in your own directory by entering:
-<pre>
- > web_ldap DEF
-</pre>
-This should connect to 'ldap.bigfoot.com' and try to find a number
-of entries (it does when I try it). You will notice that it
-outputs results in the form of an HTML file - this is what it
-is supposed to do. If you leave out the 'DEF', you will get the
-error:
-<pre>
-<p>++ Error - This script should be referenced with a METHOD of POST.
-</pre>
-as a part of your result with no LDAP data returned.
-<p>
-Interactively, the program assumes that you will always pass it at least
-the name of the Configuration file ('DEF' tells it to use the default
-configuration file). If there is no configuration file, it still will
-find 'ldap.bigfoot.com'.
-<p>
-Once you have it working there, try the version in the HTML directory.
-To do so, enter your WEB Servers URL, the cgi-bin directory reference
-and then the application name, all separated by slashes. For example,
-if your Web Server URL is 'http://my.server.com', then you will want
-to specify the URL:
-<pre>
- http://my.server.com/cgi-bin/web_ldap
-</pre>
-NOTE: You can only run cgi scripts out of a directory that the Web Server
-allows. It is unlikely that you can execute Web Server CGI applications
-from your own directory.
-<p>
-This will provide a simple Web Based form. It will have 2 user entry
-fields. The first allows you to enter an LDAP request. The second
-allows you to specify a configuration file (it defaults to 'DEF').
-<p>
-Enter a simple LDAP request, such as the ones shown and see if you
-get back a response. You should if connected to 'ldap.bigfoot.com'.
-
-
-<h3>Now that you have it working:</h3>
-
-Feel free to adapt this program to fit your needs. You will need
-to have the 'dn' in order to do updates. It is recovered within
-the program, so you can save it for use once you retrieve it
-(it is listed in the web_ldap.log file of you enable debug mode).
-<p>
-This program does not update anything. The goal was to create a very
-simple and expandable LDAP client and provide the complete source
-code for doing it. To this goal, it is successful. From here
-you should be able to experiment with the interfaces and create
-new functionality to suit your given needs.
-<p>
-This was tested against the UofM V 3.3 LDAP Libraries and the Netscape
-V 1.x and V 3.x SDK under both Irix 6.2 (Silicon Graphics) and
-Solaris 2.6 (Sun). I don't have other hardware or OS's to test
-against here.
-
-
-<h3>Usage Information:</h3>
-
-If you want to find out what attributes are being used, you can enable
-the application to tell you all that it finds. Do this by simply
-not defining any attributes within the configuration file. It will
-list all the attributes it finds. You could create a special configuration
-file specifically for this purpose.
-<p>
-If you are getting fatal errors from your Web Server when you attempt to
-execute a command, please try the same command using interactive mode. Look
-to see if the HTML being generated makes sense or not. If the HTML
-looks good, run it again interactively and pipe the results to a file, then
-attempt to submit the resulting file as the URL. If it works, it is
-likely that the environment you run is different than the one the Web
-server is using - Unix file protections frequently are a cause of these
-problems. If you can't determine what is different, discuss the problem
-with your Unix system administrator - is is likely a resource problem.
-If you add code that causes problems, but you still get a result, try the
-application in interactive mode and verify the HTML being generated. Any
-additional HTML code you add may need to to have proper termination syntax
-(tables are very touchy about this), and you may need to further enhance
-your changes to compensate.
-<p>
-When creating new applications, please test your
-results on both Netscape's Web Browser and Internet
-Explorer. Nothing is more irritating to end users than getting different
-results based on their Web Browser selection.
-<p>
-The Unix Command line will not allow you to pass some characters into
-an application unless you surround the characters or command with quotes.
-Some common examples of executing web_ldap interactively are:
-<pre>
- > web_ldap DEF "cn=j*moller"
-
- > web_ldap DEF cn=jens moller
-</pre>
-The command with the '*' in it requires quotes around it. Also note
-that the application only allows the LDAP command to use up to 3 argv
-values. This is as a limitation of the current parsing within the program
-of argc/argv parameters. You could alter the program, or simply put
-quotes around the LDAP request. Enable the debug mode within the
-configuration file if you feel that the application is losing
-arguments to see what its operating against. When operated by the Web Server,
-and passing in FORM data - you won't have this limitation, and you don't
-need quotes.
-<p>
-You can pass hidden fields from the Web Form into the web_ldap program.
-An example is shown with the name of 'FORM' having a value of '300'.
-You can create additional hidden fields, named anything you want them
-to be, with any value you want. These can be used to define existing
-options (such as which configuration file to use), or other options
-that your modified web_ldap.c program may want to have passed to it.
-<p>
-<hr>
-Jens Moller - Jens@colomar.com -
-<a href="http://www.colomar.com">COLOMAR Group</a>.<br>
-
-<a href="http://www.OpenLDAP.org/">OpenLDAP</a> - OpenLDAP-devel@OpenLDAP.org.
+++ /dev/null
-web_ldap Version 1.1, OpenLDAP variant
-
-This is an OpenLDAP port of the web_ldap program.
-
-The files provided in the file set for 'web_ldap'
-were developed under the GNU General Public License (GPL).
-Under the GPL, the source code is freely-distributed and available
-to the general public. There is no warranty on the software,
-and it does not come with support, however, I would appreciate
-it if you emailed any bug-fixes you create to me (jens@colomar.com)
-and OpenLDAP-its@OpenLDAP.org.
-
-All code here is generic ISO C, allowing most Unix compilers
-to generate the required object files and executable images.
-It was tested against an Apache HTTPD server and uses no
-special HTML functionality that does not appear within V 3.x
-versions of Netscapes or Microsofts Web Browsers. The goal was
-to create a starting point example to help people build
-effective interactive HTML based LDAP clients.
-
-Introduction:
-
-The 'web_ldap' package is a complete LDAP application that
-provides a functional Web Server Based client. The intent
-is to give you a working example that you can expand upon
-for your own needs. It does not solve a specific problem
-for you, rather it solves a general problem by giving
-you a functional starting point from where to begin your
-development efforts. It runs under Unix.
-
-The application consists of a number of C programs, header
-files, an HTML file with form entry, a configuration file
-and a sample makefile. You will need the LDAP SDK for your
-specific Unix System (both the UofM libraries and Netscape
-libraries - which are also free - have been tested).
-
-The tool allows You to specify that actions taken
-be logged to a file. This provides you a method by which
-you can build out larger applications and see what is happening.
-
-The application can be run interactively (without use of
-a Web Browser) but was intended for use as an HTML LDAP Web
-page application.
-
-One thing to consider when running a program of this nature
-is that there are 2 totally different sets of environments
-involved. The program is written assuming very little in
-the way of file/directory organization. As such it looks for
-files either in the directory it was run from, or where ever
-you have configured your Web Server to look for things.
-
-The C CGI program will attempt to open a default configuration
-file called 'web_ldap.cfg'. If you set the debug mode on
-in the configuration file, it will also attempt to create
-a log file called 'web_ldap.log' in the same directory as
-the 'web_ldap.cfg' files appears in.
-
-The 2 environments are 'Interactive' and 'Web Server'.
-
-When you execute the application from a command line such as:
-
- > web_ldap DEF cn=jens moller
-
-All actions take place in the same directory that the web_ldap
-program resides in. Most people would typically build an
-application of this nature in one of their own directories and
-this would give them Read/Write access to all of the files
-associated with the program. Any file restrictions or capabilities
-that you have will be enabled as part of your session.
-
-This is quite different than when you ask a Web Server to
-execute the program for you. The Web Server is typically
-using the user 'nobody'. This is not you, its a separate
-application user and it may not have access to the same
-files that you have nor the same process capabilities.
-
-When your program executes from a Web Browser, you will
-see something like:
-
- http://my.system.com/cgi-bin/web_ldap
-
-displayed by the Web Browser as the URL that its executing.
-The Web Server is executing the program on your behalf.
-File protections normally cause initial problems, possibly
-because the Web Browser doesn't own the files or doesn't
-have execute access. For your initial testing, please set these
-files to full access - ie. 'chmod 777 web_ldap*' - You can
-adjust the file protections once you get everything working.
-If you get errors - start with this simple change.
-
-
-Building the application:
-
-Requires ISO C (your standard OS compiler or GCC should
-work fine).
-
-Under OpenLDAP, you should build with the following commands after having
-configured and built OpenLDAP itself:
-
- cd contrib/web_ldap
- make depend
- make
-
-
-Configuration:
-
-Its a very simple tool that allows you to make LDAP requests
-to any existing LDAP Directory Server. By default, it
-attempts to connect to 'ldap.bigfoot.com', which is a
-commercial LDAP server on the Internet - usually available
-from anywhere.
-
-To specify a different LDAP server, you could either modify
-the program to default elsewhere, or you could modify the
-existing 'web_ldap.cfg' file, or create another one with
-a different name.
-
-NOTE: A '#' in the first column of any line
-in the configuration file is considered a comment.
-
-The configuration file allows you specify:
-
- server:
-
-This is the servername. For example:
-
- server:ldap.bigfoot.com,389
-
-connects you up to port 389 on the ldap server 'ldap.bigfoot.com'.
-You can specify one of your own servers here if you desire.
-
-Next you will see:
-
- searchbase:
-
-This is where within a tree you want to start looking. For
-'ldap.bigfoot.com', you would leave this blank and it will
-look in all the trees. For many companies a specific tree
-structure will be defined, and you will want to specify the
-highest point in the tree structure that defines the area that
-you are interested in. For example, if you have a tree that
-starts at 'c=US', and branches at 'o=ABC, c=US' and
-'o=XYZ, c=US', you could specify:
-
- searchbase:c=US
-
-and search both 'o=ABC, c=US' and 'o=XYZ, c=US', or
-if you only wanted to search against 'o=ABC, c=US',
-you could specify:
-
- searchbase:o=ABC, c=US
-
-If you want to turn on a simple Debug mode, you can specify any number
-other than zero for 'debug:'. For example:
-
- debug:1
-
-turns on the Debug logging mode, and
-
- debug:0
-
-turns it off. Debug logging simply creates a file called
-'web_ldap.log' in the same directory that the web_ldap
-executable is located. It flushes everything after each
-event, so if it gets stuck anywhere, you will be able
-to see it. It also time-stamps most of the results, so you
-can get an idea where things are running faster and/or
-slower for different queries.
-
-The remainder of the configuration file is where you list
-the attributes that you are interested in displaying.
-
-You could list parameters (up to 100) like:
-
- cn
- givenname
- sn
-
-and that is all it will return. If you don't specify
-anything, it returns everything it finds. if you
-specify an attribute that the directory has never
-heard of (ie. its not a member of any object class
-anyone has defined), that attribute will simply be
-ignored. If you misspell an attribute name and wonder
-why it never gets listed in the results - this might be
-why. If you specify an attribute that some users have and
-others don't, only ones with that attribute will list
-a value for it.
-
-Directory data can be multi-valued. This means that any
-attribute could have multiple values. This application will
-list all the values it finds for any given attribute.
-
-
-Where to put the files:
-
-If running this interactively (from a Unix shell prompt),
-all the files can reside in any of your home directories.
-I suggest that you test the application in your home
-directory first.
-
-If running this application from a Web Server, you need
-to find out where the Web Server keeps its cgi applications
-and where it keeps its html applications. This varies
-from operating system to operating system and Web Server
-to Web Server.
-
-Once you have located the cgi-bin (or equivalent) directory,
-put these 2 files there:
-
- web_ldap
- web_ldap.cfg
-
-then make sure that these files are accessible to the Web
-Server by executing the Unix shell command:
-
- > chmod 777 web_ldap*
-
-Now find the HTML source directory. Copy
-
- web_ldap.html
-
-to this directory. Make sure that this file is accessible to the Web
-Server by executing the Unix shell command:
-
- > chmod 777 web_ldap*
-
-
-Running the application:
-
-Test it in your own directory by entering:
-
- > web_ldap DEF
-
-This should connect to 'ldap.bigfoot.com' and try to find a number
-of entries (it does when I try it). You will notice that it
-outputs results in the form of an HTML file - this is what it
-is supposed to do. If you leave out the 'DEF', you will get the
-error:
-
-<p>++ Error - This script should be referenced with a METHOD of POST.
-
-as a part of your result with no LDAP data returned.
-
-Interactively, the program assumes that you will always pass it at least
-the name of the Configuration file ('DEF' tells it to use the default
-configuration file). If there is no configuration file, it still will
-find 'ldap.bigfoot.com'.
-
-Once you have it working there, try the version in the HTML directory.
-To do so, enter your WEB Servers URL, the cgi-bin directory reference
-and then the application name, all separated by slashes. For example,
-if your Web Server URL is 'http://my.server.com', then you will want
-to specify the URL:
-
- http://my.server.com/cgi-bin/web_ldap
-
-NOTE: You can only run cgi scripts out of a directory that the Web Server
-allows. It is unlikely that you can execute Web Server CGI applications
-from your own directory.
-
-This will provide a simple Web Based form. It will have 2 user entry
-fields. The first allows you to enter an LDAP request. The second
-allows you to specify a configuration file (it defaults to 'DEF').
-
-Enter a simple LDAP request, such as the ones shown and see if you
-get back a response. You should if connected to 'ldap.bigfoot.com'.
-
-
-Now that you have it working:
-
-Feel free to adapt this program to fit your needs. You will need
-to have the 'dn' in order to do updates. It is recovered within
-the program, so you can save it for use once you retrieve it
-(it is listed in the web_ldap.log file of you enable debug mode).
-
-This program does not update anything. The goal was to create a very
-simple and expandable LDAP client and provide the complete source
-code for doing it. To this goal, it is successful. From here
-you should be able to experiment with the interfaces and create
-new functionality to suit your given needs.
-
-This was tested against the UofM V 3.3 LDAP Libraries and the Netscape
-V 1.x and V 3.x SDK under both Irix 6.2 (Silicon Graphics) and
-Solaris 2.6 (Sun). I don't have other hardware or OS's to test
-against here.
-
-
-Usage Information:
-
-If you want to find out what attributes are being used, you can enable
-the application to tell you all that it finds. Do this by simply
-not defining any attributes within the configuration file. It will
-list all the attributes it finds. You could create a special configuration
-file specifically for this purpose.
-
-If you are getting fatal errors from your Web Server when you attempt to
-execute a command, please try the same command using interactive mode. Look
-to see if the HTML being generated makes sense or not. If the HTML
-looks good, run it again interactively and pipe the results to a file, then
-attempt to submit the resulting file as the URL. If it works, it is
-likely that the environment you run is different than the one the Web
-server is using - Unix file protections frequently are a cause of these
-problems. If you can't determine what is different, discuss the problem
-with your Unix system administrator - is is likely a resource problem.
-If you add code that causes problems, but you still get a result, try the
-application in interactive mode and verify the HTML being generated. Any
-additional HTML code you add may need to to have proper termination syntax
-(tables are very touchy about this), and you may need to further enhance
-your changes to compensate.
-
-When creating new applications, please test your results on both
-Netscape's Web Browser and Internet Explorer. Nothing is more
-irritating to end users than getting different results based on their
-Web Browser selection.
-
-The Unix Command line will not allow you to pass some characters into
-an application unless you surround the characters or command with quotes.
-Some common examples of executing web_ldap interactively are:
-
- > web_ldap DEF "cn=j*moller"
-
- > web_ldap DEF cn=jens moller
-
-The command with the '*' in it requires quotes around it. Also note
-that the application only allows the LDAP command to use up to 3 argv
-values. This is as a limitation of the current parsing within the program
-of argc/argv parameters. You could alter the program, or simply put
-quotes around the LDAP request. Enable the debug mode within the
-configuration file if you feel that the application is losing
-arguments to see what its operating against. When operated by the Web Server,
-and passing in FORM data - you won't have this limitation, and you don't
-need quotes.
-
-You can pass hidden fields from the Web Form into the web_ldap program.
-An example is shown with the name of 'FORM' having a value of '300'.
-You can create additional hidden fields, named anything you want them
-to be, with any value you want. These can be used to define existing
-options (such as which configuration file to use), or other options
-that your modified web_ldap.c program may want to have passed to it.
-
-
-Jens Moller - Jens@colomar.com - COLOMAR Group.
-OpenLDAP - OpenLDAP-devel@OpenLDAP.org.
+++ /dev/null
-This is not really a bugs list (would I admit to having bugs? :-) but a
-limitations list.
-
-This implementation attempts to implement most of the proposed whois++
-interface but those sections that conflict with the underlying X.500 service
-are not implemented. This includes such things as the indexing service. While
-it would be possible to provide this functionality it is likely that a
-production X.500 Directory will have restrictions on access to the Directory
-in order to prevent "trawling" of data. It is unlikely that such a site
-would wish to allow an indexing server carte blanche access to it's data in
-order to index it.
-
-The current version also doesn't support multiple languages, this is not
-because I don't think it's a good idea (I do), but rather due to my wish to
-get this thing out of the door! As a result of this attributes are returned
-using their X.500 attribute names rather than using "whois++" names. Once
-the code to do multi-lingual support has been integrated these attributes
-will be returned in the natural language specified by the client.
-
-Some responses are returned as system messages, and some are returned as
-normal messages (with or without a leading space). At present there is no
-real consistancy, which is a result of me coding whatever I thought was best
-at the time. The current draft lacks adequate direction (except for search
-results) as to the format of responses but once this has been fixed I will
-correct the code.
-
-I am using a beta version of the LDAP beta code (possibly not the latest
-version) to develop this code but you should be able to use any of the
-University of Michigan releases, although the patches to the main Makefile
-may need some tweaking.
-
-This program has only really been tested with Ultrix although John Farrell
-of the ISODE Consortium threw it at SunOS for me so it may work with other
-Unix variants but there are no guarantees.
-
-Mark Prior
-26 April 93
+++ /dev/null
-I assume that you have already obtained the LDAP libraries and installed
-them in the appropriate place. This kit should fit into the directory
-structure created by LDAP. You should use the root.Makefile.diffs file to
-patch the LDAP Makefile so that it knows how to build whois++. This may fail
-depending on what version of LDAP you have but the rejections should be
-trival to fix (hopefully UMich will release a new version RSN).
-
-This program makes use of a number of definitions defined in the main LDAP
-Makefile but it also has a number of it's own definitions that you will
-have to modify (all definitions are located in the Makefile).
-
-CONFIG_DIRECTORY At present the configuration directory only contains
- the template directory. The files in this directory contain the
- attribute fields to return when a template is returned. The objectClass
- of an object determines the whois++ template.
-
-HELP_DIRECTORY The server has a number of help files that it may
- display when queried by a client. These files are stored under the
- specific language.
-
-LDAPHOST Which host is running a ldap server. This program
- communicates to the X.500 Directory via LDAP so you must be able to
- identify a host that is able to provide this communication.
-
-FACILITY Some error diagnostics are reported via syslog, as is
- normal queries if logging is enabled. This variable specifies which
- facility to use. I use local3 so I can create a separate log file just
- for whois++ but you may wish to log under daemon.
-
-SYSLIBS Any additional libraries required. Ultrix requires -li
- to get the Internationalisation support. I also use -lsyslog in order
- to link with a 4.3BSD style syslog rather than the ancient syslog that
- DEC normally ship with Ultrix.
-
-INTERNATIONAL Define this is you have POSIX international support.
- At present this is only used for displaying dates so it's not really
- important but I intend to use this facility to support the language
- constraint in a future release.
- Available under Ultrix but not SunOS.
-
-RFC931 Define this if you wish to turn on rfc931 logging.
- You must have log_tcp source available.
-
-Once you have modified these variable you should be able to just type "make",
-if you are in the whois++ directory, or "make ldap-whois++" from the main
-LDAP directory. All going well there should be no problems so "make install",
-or "make inst-whois++".
-
-You should now copy the tailor file (whois++dtailor) to the ETCDIR and modify
-the base statement to indicate to whois++ where in the DIT whois++ should base
-its searches. You may also wish to define a user and password if you need to
-authenticate the server.
-
-Modify /etc/inetd.conf to include the new whois++ service with a line such as
- whois stream tcp nowait ETCDIR/whois++d whois++d
-where ETCDIR is the value of your ETCDIR variable.
-You might like to add the -l flag (if you want to log queries) and -i if you
-have an info attribute in the base entry (this will be displayed as a system
-message).
-
-Now send a HUP (or kill and restart) /etc/inetd.
-
-Note that if you turn on RFC931 lookups you will need the rfc931.c
-module from Wietse Venema's log_tcp package (archie should be able to find
-you a copy).
-
-Mark Prior
-mrp@itd.adelaide.edu.au
+++ /dev/null
-#
-# Configuration parameters, can be overridden in config file
-#
-LDAPSRC = ../..
-CONFIG_DIRECTORY = $(ETCDIR)/whois++
-HELP_DIRECTORY = /usr/local/isode/help/whois++
-LDAPHOST = "localhost"
-#
-# Where to stuff the man page
-MANDIR = /usr/local/isode/man
-MANSEC = 8
-#
-# Syslog facility to log queries under, using info serverity level
-#
-FACILITY = LOG_LOCAL3
-#
-# Additional system libraries
-# Under Ultrix I use the 4.3 syslog, hence the additional syslog library
-#
-#SYSLIBS = -li -lsyslog
-#
-# If you want POSIX international support (format of dates), on ultrix
-#
-#INTERNATIONAL = -DINTERNATIONAL
-#
-# If you want RFC931 logging you must have log_tcp source available
-#
-#RFC931DEF = -DRFC931
-#RFC931SRC = /local/src/log_tcp/rfc931.c
-
-SRCS = whois++.c command.c config.c describe.c help.c output.c template.c \
- util.c version.c $(RFC931SRC)
-HDRS = whois++.h
-OBJS = ${SRCS:.c=.o}
-HOST = `hostname`
-# This returns a date such as "26 April 1993", unfortunately SunOS doesn't
-# understand the %B abd %Y macros so you may need to change this.
-#DATE = `date +'%d %B %Y'`
-DATE = `date +'%D'` # this gives 4/26/93 format
-REVISION = 2
-
-DEFINES = -DETCDIR=\"$(ETCDIR)\" -DBUILD="\"$(USER)@$(HOST) on $(DATE)\"" \
- -DCONFIG_DIRECTORY=\"$(CONFIG_DIRECTORY)\" -DMAIN \
- -DHELP_DIRECTORY=\"$(HELP_DIRECTORY)\" -DREVISION="$(REVISION)" \
- -DPROTOCOL="\"[FIRST DRAFT - 15 April 1993]\"" -DRELEASE=\"BETA\" \
- -DFACILITY=$(FACILITY) -DDEFAULT_LDAPHOST=\"$(LDAPHOST)\" \
- $(INTERNATIONAL) $(RFC931DEF)
-
-CFLAGS = -I$(LDAPSRC)/include -I/usr/local/include $(ACFLAGS)
-LIBS = -L$(LDAPSRC)/libraries/libldap -lldap -L$(LDAPSRC)/libraries/liblber \
- -llber $(SYSLIBS) $(KRBLIBFLAG) $(KRBLIBS)
-
-all: whois++d
-
-whois++d: $(OBJS) $(LDAPSRC)/libraries/libldap/libldap.a
- $(CC) $(ALDFLAGS) -o $@ $(OBJS) $(LIBS)
-
-whois++.o: whois++.c $(HDRS)
- $(CC) $(CFLAGS) $(DEFINES) -c whois++.c
-
-install: inst-whois++
-
-inst-whois++: $(DESTDIR)$(ETCDIR)/whois++d
- -$(MKDIR) $(DESTDIR)$(CONFIG_DIRECTORY)
- cp -r templates $(DESTDIR)$(CONFIG_DIRECTORY)
- -$(MKDIR) $(DESTDIR)$(HELP_DIRECTORY)
- cp -r helpfiles/* $(DESTDIR)$(HELP_DIRECTORY)
- -$(MKDIR) $(DESTDIR)$(MANDIR)/man$(MANSEC)
- sed -e 's#ETCDIR#$(ETCDIR)#' whois++d.man > $(DESTDIR)$(MANDIR)/man$(MANSEC)/whois++d.$(MANSEC)
- @echo "Don't forget to modify and install the tailor file"
-
-$(DESTDIR)$(ETCDIR)/whois++d: whois++d
- install -c -m 755 whois++d $(DESTDIR)$(ETCDIR)
-
-lint:;
- lint $(SRCS)
-
-5lint:;
- /usr/5bin/lint $(SRCS)
-
-clean:;
- rm -f *.o core a.out whois++d
-
-depend:;
- ../mkdep $(CFLAGS) $(SRCS)
-
-# DO NOT DELETE THIS LINE -- mkdep uses it.
-# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
-
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
+++ /dev/null
-This is a DUA interface, using LDAP, that conforms to the latest (not yet)
-Internet Draft for the Whois++ Architecture. It does NOT support the indexing
-service also proposed under Whois++.
-
-It is a gateway to X.500 (similar to the finger and gopher gateways) which
-allows the user to access the directory via a mechanism that they are
-comfortable with and/or have access to. The real Directory Service (and the
-only practical large scale distributed directory service) is provided by the
-underlying X.500 service. This implementation is not an endorsement of Whois++
-but I recognise that there are users whose only interface to a directory
-service is via a whois client. It therefore attempts to service these users,
-much like the other two gateways.
-
-Comments on the Whois++ specification should be sent to the IETF Whois and
-Network Information Lookup Service (WNILS) Working Group. The e-mail address
-of the group is ietf-wnils@ucdavis.edu, to be added to the mailing list send
-a request to ietf-wnils-request@ucdavis.edu. Comments about this program
-should be directed to the discussion list ldap-whois++@itd.adelaide.edu.au,
-(send a message to ldap-whois++-request@itd.adelaide.edu.au to join). I will
-post bug fix announcements to this list.
-
-Mark Prior
-6 May 93
+++ /dev/null
- Things to do list (well the start of one anyway :-)
-
-. Test on something other than Ultrix
-. Finish the multilingual support.
-. Make the parser for the query "language" more error resistant
-. Do a real parser for the config file
-. More help files
-. Think about multi charset, although this is probably an issue for LDAP
-. Kerberos authentication
+++ /dev/null
-#if !defined(lint)
-static char copyright[] = "Copyright 1992 The University of Adelaide";
-#endif
-
-/*
- * C O M M A N D
- *
- * Author: Mark R. Prior
- * Communications and Systems Branch
- * Information Technology Division
- * The University of Adelaide
- * E-mail: mrp@itd.adelaide.edu.au
- * Date: October 1992
- * Version: 1.8
- * Description:
- * Interpret the command sent by the client
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of Adelaide. The name of the University may not
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "whois++.h"
-#include <stdlib.h>
-extern int getdtablesize (void);
-
-#define isspecial(c) ( (c) == ',' || (c) == ';' || (c) == ':' || (c) == '=' )
-
-static char **component = NULL;
-static int numberOfComponents;
-static int components = 10;
-
-static int
-getToken( char *token )
-{
- static char *buffer = NULL;
- static int idx;
- char ch;
- fd_set readfds;
- struct timeval timeout;
- int i, status, tablesize;
-
- if ( buffer == NULL ) {
- tablesize = getdtablesize();
-
-#ifdef FD_SETSIZE
- if ( tablesize > FD_SETSIZE ) {
- tablesize = FD_SETSIZE;
- }
-#endif /* FD_SETSIZE */
-
- timeout.tv_sec = 60;
- timeout.tv_usec = 0;
- FD_ZERO( &readfds );
- FD_SET( fileno( stdin ), &readfds );
-
- if ( (status = select( tablesize, &readfds, 0, 0, &timeout )) <= 0 ) {
- if ( status < 0 )
- printFormatted( lineLength, TRUE, stdout,
- "select: %s", strerror( errno ) );
- else
- printFormatted( lineLength, TRUE, stdout,
- "Connection timed out waiting for input." );
- exit( 1 );
- }
-/**/ /*
- * We really should determine how many characters are
- * waiting for us and then malloc that amount rather than
- * just guessing!
- */
- if ( ( buffer = (char *)malloc(BUFSIZ) ) == NULL
- || fgets( buffer, BUFSIZ, stdin ) == NULL ) {
- *token = '\0';
- return EOF;
- }
- idx = 0;
- i = strlen( buffer );
- while ( i-- > 0 && ( buffer[i] == '\r' || buffer[i] == '\n' ) )
- buffer[i] = '\0';
- if ( log )
- syslog( LOG_INFO, "Whois++ Query: %s", buffer );
- }
- while ( buffer[idx] != '\0' && isspace( (unsigned char) buffer[idx] ) )
- idx++;
- token[0] = buffer[idx++];
- token[1] = '\0';
- switch ( token[0] ) {
- case '\0':
- strcpy( token, "<end of line>" );
- free( buffer );
- buffer = NULL;
- return EOF;
-
- case '^':
- return TEMPLATE;
-
- case '!':
- return HANDLE;
-
- case '.':
- return ATTRIBUTE;
-
- case '#':
- return VALUE;
-
- case '*':
- return SEARCH_ALL;
-
- case '?':
- return HELP;
-
- case ':':
- return COLON;
-
- case ';':
- return SEMICOLON;
-
- case ',':
- return COMMA;
-
- case '=':
- return EQUALS;
-
- case '"':
- i = 0;
- do {
- ch = buffer[idx++];
- if ( ch == '\\' && buffer[idx] != '\0' )
- token[i++] = buffer[idx++];
- else
- token[i++] = ch;
- } while ( ch != '\0' && ch != '"' );
- if ( ch == '\0' ) {
- printFormatted( lineLength, TRUE, stdout,
- "Trailing \" missing" );
- idx--;
- }
- token[--i] = '\0';
- return SEARCH;
-
- default:
- i = 1;
- do {
- ch = buffer[idx++];
- if ( ch == '\\' && buffer[idx] != '\0' )
- token[i++] = buffer[idx++];
- else
- token[i++] = ch;
- } while ( ch != '\0' &&
- !isspace( (unsigned char) ch ) && !isspecial( ch ) );
- token[--i] = '\0';
- idx--;
-/**/ /*
- * The following is a brute force lookup, once the names
- * have settled down this should change to a hash table,
- * or something similar.
- */
- if ( EQ( token, "help" ) )
- return HELP;
- else if ( EQ( token, "list" ) )
- return LIST;
- else if ( EQ( token, "show" ) )
- return SHOW;
- else if ( EQ( token, "constraints" ) )
- return CONSTRAINTS;
- else if ( EQ( token, "describe" ) )
- return DESCRIBE;
- else if ( EQ( token, "version" ) )
- return VERSION;
- else if ( EQ( token, "template" ) )
- return TEMPLATE;
- else if ( EQ( token, "handle" ) )
- return HANDLE;
- else if ( EQ( token, "attribute" ) )
- return ATTRIBUTE;
- else if ( EQ( token, "value" ) )
- return VALUE;
- else if ( EQ( token, "full" ) )
- return FULL;
- else if ( EQ( token, "abridged" ) )
- return ABRIDGED;
- else if ( EQ( token, "summary" ) )
- return SUMMARY;
- else if ( EQ( token, "format" ) )
- return FORMAT;
- else if ( EQ( token, "hold" ) )
- return HOLD;
- else if ( EQ( token, "maxhits" ) )
- return MAXHITS;
- else if ( EQ( token, "match" ) )
- return MATCH;
- else if ( EQ( token, "linelength" ) )
- return LINE_LENGTH;
- else if ( EQ( token, "command" ) )
- return COMMAND;
- else if ( EQ( token, "trace" ) )
- return TRACE;
- else
- return SEARCH;
- }
-}
-
-static int
-term(
- int token,
- char *value,
- char *attribute,
- int *specifier,
- int *soundex
-)
-{
- char buffer[BUFSIZ], temp[BUFSIZ];
- int iterations;
-
- *soundex = FALSE;
- switch ( token ) {
- case ATTRIBUTE: /* . */
- case VALUE: /* # */
- case HANDLE: /* ! */
- case TEMPLATE: /* ^ */
- case SEARCH_ALL:/* * */
- *specifier = token;
- if ( strlen( value ) > 1 ) {
- /* fullname used, so expect an equals sign */
- if ( getToken( buffer ) != EQUALS ) {
- printFormatted( lineLength, TRUE, stdout,
- "\"=\" expected" );
- return ERROR;
- } else
- token = getToken( value );
- } else
- token = getToken( value );
- if ( token != COMMA && token != SEMICOLON && token != EQUALS
- && token != COLON && token != EOF ) {
- token = getToken( buffer );
- break;
- }
-
- case COMMA:
- case SEMICOLON:
- case EQUALS:
- case COLON:
- case EOF:
- printFormatted( lineLength, TRUE, stdout,
- "Expected search string but got \"%s\"", buffer );
- return ERROR;
-
- default:
- *specifier = SEARCH_ALL;
- if ( ( token = getToken( buffer ) ) == EQUALS ) {
- strcpy( attribute, value );
- token = getToken( value );
- if ( token == COMMA || token == SEMICOLON
- || token == COLON || token == EOF ) {
- printFormatted( lineLength, TRUE, stdout,
- "Syntax error, string expected." );
- return ERROR;
- }
- token = getToken( buffer );
- }
- }
-
- while ( token != COMMA && token != SEMICOLON && token != COLON
- && token != EOF ) {
- if ( *value != '\0' )
- strcat( value, " " );
- strcat( value, buffer );
- token = getToken( buffer );
- }
- iterations = 2;
- while ( token == COMMA ) {
- token = getToken( buffer );
- switch ( token ) {
- case MATCH:
- iterations = 0;
- if ( ( token = getToken( buffer ) ) != EQUALS ) {
- printFormatted( lineLength, TRUE, stdout,
- "\"=\" expected" );
- } else
- token = getToken( buffer );
- if ( EQ( buffer, "exact" ) )
- *soundex = FALSE;
- else if ( EQ( buffer, "fuzzy" ) )
- *soundex = TRUE;
- else
- printFormatted( lineLength, TRUE, stdout,
- "Unrecognised search type" );
- token = getToken( buffer );
- break;
-
- default:
- if ( iterations == 0 ) {
- /* obviously an unrecognised constraint */
- printFormatted( lineLength, TRUE, stdout,
- "Constraint \"%s\" not supported",
- buffer );
- while ( ( token = getToken( buffer ) ) != EOF
- && token != COMMA && token != COLON
- && token != SEMICOLON )
- ;
- } else {
- strcpy( temp, buffer );
- token = getToken( buffer );
- if ( token == EQUALS ) {
- iterations = 0;
- printFormatted( lineLength, TRUE, stdout,
- "Constraint \"%s\" not supported",
- buffer );
- }
- while ( token != EOF && token != SEMICOLON
- && token != COLON && token != COMMA ) {
- if ( iterations > 0 ) {
- strcat( temp, " " );
- strcat( temp, buffer );
- }
- token = getToken( buffer );
- }
- if ( iterations > 0 ) {
- printFormatted( lineLength, TRUE, stdout,
- "Assuming \"%s\" part of query and not an unrecognised constraint.", temp );
- strcat( value, "," );
- strcat( value, temp );
- }
- }
- break;
-
- }
- iterations--;
- }
- if ( *value == '\0' ) {
- printFormatted( lineLength, TRUE, stdout,
- "Value not specified" );
- return ERROR;
- }
- if ( *specifier == NULL )
- *specifier = SEARCH_ALL;
- return token;
-}
-
-static int
-processTerm(
- int specifier,
- int soundex,
- char *buffer,
- char *attribute,
- char *value
-)
-{
- char *s, *t;
- char query[BUFSIZ];
- char **reallocResult;
-
- switch ( specifier ) {
- case SEARCH_ALL:
- if ( numberOfComponents+3 >= components ) {
- components += 10;
- reallocResult = (char **)realloc(component, sizeof(char **)*components);
- if ( reallocResult == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Realloc failed" );
- return ERROR;
- } else
- component = reallocResult;
- }
- if ( attribute != NULL && *attribute != '\0' ) {
- /* The user obviously knows what they are doing */
- sprintf( query, "(%s%s%s)", attribute,
- (soundex)?"~=":"=", buffer );
- } else {
- if ( ( s = strchr( buffer, ',' ) ) != NULL ) {
- *s++ = '\0';
- while ( *s && isspace( (unsigned char) *s ) )
- s++;
- sprintf( query, "(sn%s%s)",
- (soundex)?"~=":"=", buffer );
- component[numberOfComponents++] = strdup( query );
- /* let's just make sure there is no title */
- if ( ( t = strrchr( s, ',' ) ) != NULL ) {
- *t++ = '\0';
- while ( *t && isspace( (unsigned char) *t ) )
- t++;
- sprintf( query, "(personalTitle%s%s)",
- (soundex)?"~=":"=", t );
- component[numberOfComponents++] = strdup( query );
- }
- sprintf( query, "%s %s", s, buffer );
- strcpy( buffer, query );
- } else if ( strncasecmp( buffer, "first ", 6 ) == 0 ) {
- sprintf( query, "%s *", &buffer[6] );
- strcpy( buffer, query );
- }
- if ( ( s = strchr( buffer, '@' ) ) != NULL ) {
- *s++ = '\0';
- if ( *buffer == '\0' ) /* no username */
- sprintf( query, "(mail=*@%s)", s );
- else if ( *s == '\0' ) /* no host */
- sprintf( query, "(|(mail=%s@*)(userid=%s))",
- buffer, buffer );
- else
- sprintf( query, "(mail=%s@%s)",
- buffer, s );
- if ( soundex )
- printFormatted( lineLength, TRUE, stdout,
- "Fuzzy matching not supported on e-mail address queries" );
- } else if ( strchr( buffer, ' ' ) == NULL ) {
- sprintf( query,
- "(|(sn%s%s)(userid%s%s)(l%s%s)(ou%s%s)\
-(&(cn%s%s)(!(objectClass=person))))",
- (soundex)?"~=":"=", buffer,
- (soundex)?"~=":"=", buffer,
- (soundex)?"~=":"=", buffer,
- (soundex)?"~=":"=", buffer,
- (soundex)?"~=":"=", buffer );
- } else {
-#if defined(UOFA)
- sprintf( query, "(|(l%s%s)(ou%s%s)(preferredName%s%s)",
- (soundex)?"~=":"=", buffer,
- (soundex)?"~=":"=", buffer,
- (soundex)?"~=":"=", buffer );
-#else
- sprintf( query, "(|(l%s%s)(ou%s%s)",
- (soundex)?"~=":"=", buffer,
- (soundex)?"~=":"=", buffer );
-#endif
- /*
- * If LDAP and/or Quipu didn't strip spaces
- * then this would be different but as it does
- * this is easy :-) but it also means we might
- * get false hits.
- */
- if ( soundex ) {
- strcat( query, "(cn~=" );
- strcat( query, buffer );
- } else {
- strcat( query, "(cn=*" );
- strcat( query, strtok( buffer, " " ) );
- while ( ( s = strtok( NULL, " " ) ) != NULL ) {
- strcat( query, " * " );
- strcat( query, s );
- }
- }
- strcat( query, "))" );
- }
- }
- component[numberOfComponents++] = strdup( query );
- break;
-
- case ATTRIBUTE:
- if ( numberOfComponents+1 >= components ) {
- components += 10;
- reallocResult = (char **)realloc(component, sizeof(char **)*components);
- if ( reallocResult == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Realloc failed" );
- return ERROR;
- } else
- component = reallocResult;
- }
- if ( *value != '\0' ) {
- sprintf( query, "(%s%s%s)", buffer,
- (soundex)?"~=":"=", value );
- component[numberOfComponents++] = strdup( query );
- *value = '\0';
- } else {
- if ( *attribute != '\0' ) {
- sprintf( query, "(%s%s*)", attribute,
- (soundex)?"~=":"=" );
- component[numberOfComponents++] = strdup( query );
- }
- strcpy( attribute, buffer );
- }
- break;
-
- case TEMPLATE:
- if ( numberOfComponents+1 >= components ) {
- components += 10;
- reallocResult = (char **)realloc(component, sizeof(char **)*components);
- if ( reallocResult == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Realloc failed" );
- return ERROR;
- } else
- component = reallocResult;
- }
- sprintf( query, "(objectClass%s%s)",
- (soundex)?"~=":"=", templateToObjectClass( buffer ) );
- component[numberOfComponents++] = strdup( query );
- break;
-
- case VALUE:
- if ( *attribute != '\0' ) {
- if ( numberOfComponents+1 >= components ) {
- components += 10;
- reallocResult = (char **)realloc(component, sizeof(char **)*components);
- if ( reallocResult == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Realloc failed" );
- return ERROR;
- } else
- component = reallocResult;
- }
- sprintf( query, "(%s%s%s)", attribute,
- (soundex)?"~=":"=", buffer );
- component[numberOfComponents++] = strdup( query );
- *attribute = '\0';
- } else {
- if ( *value != '\0' )
- printFormatted( lineLength, TRUE, stdout,
- "Ignoring old value (%s)", value );
- strcpy( value, buffer );
- }
- break;
-
- case HANDLE:
- if ( numberOfComponents+1 >= components ) {
- components += 10;
- reallocResult = (char **)realloc(component, sizeof(char **)*components);
- if ( reallocResult == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Realloc failed" );
- return ERROR;
- } else
- component = reallocResult;
- }
- component[numberOfComponents++] = strdup( buffer );
- return READ;
-
- }
- return SEARCH;
-}
-
-int
-parseCommand( char *query )
-{
- /*
- * This procedure reads the string sent by the user and breaks it
- * down into command to execute.
- */
- char buffer[BUFSIZ], attribute[BUFSIZ], objectClass[BUFSIZ],
- value[BUFSIZ];
- char **reallocResult;
- int command, specificName, length, token, i, j, specifier, soundex;
- int trace = FALSE;
-
- switch ( command = getToken( buffer ) ) {
- case COMMAND:
- case CONSTRAINTS:
- case DESCRIBE:
- case VERSION:
- /* <command> */
- token = getToken( buffer );
- break;
-
- case HELP:
- case LIST:
- /* <command> [ <string> ] */
- if ( ( token = getToken( buffer ) ) != EOF && token != COLON ) {
- strcpy( query, buffer );
- token = getToken( buffer );
- } else
- *query = '\0';
- break;
-
- case SHOW:
- /* "show" <string> */
- if ( ( token = getToken( buffer ) ) != EOF && token != COLON ) {
- strcpy( query, buffer );
- token = getToken( buffer );
- } else {
- printFormatted( lineLength, TRUE, stdout,
- "Show must have a parameter" );
- return ERROR;
- }
- break;
-
- default:
- /* <term> [ ";" <term> ] */
- *attribute = '\0';
- *value = '\0';
- soundex = FALSE;
- numberOfComponents = 0;
- if ( ( component = (char **)malloc(sizeof(char **)*components) ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Malloc failed" );
- return ERROR;
- }
- if ( ( token = term( command, buffer, attribute, &specifier,
- &soundex ) ) != ERROR )
- command = processTerm( specifier, soundex, buffer,
- attribute, value );
- else
- return ERROR;
- if ( token == SEMICOLON ) {
- if ( command == READ ) {
- printFormatted( lineLength, TRUE, stdout,
- "Multiple components on a Handle query not supported." );
- return ERROR;
- }
- do {
- soundex = FALSE;
- token = getToken( buffer );
- token = term( token, buffer, attribute,
- &specifier, &soundex );
- command = processTerm( specifier, soundex,
- buffer, attribute, value );
- if ( command == READ ) {
- printFormatted( lineLength, TRUE, stdout,
- "Multiple components on a Handle query not supported." );
- return ERROR;
- } else if ( command == ERROR )
- return ERROR;
- } while ( token == SEMICOLON );
- }
- /*
- * Need to tidy up outstanding single value or attribute terms
- */
- if ( *attribute != '\0' ) {
- if ( numberOfComponents+1 >= components ) {
- components += 10;
- reallocResult = (char **)realloc(component, sizeof(char **)*components);
- if ( reallocResult == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Realloc failed" );
- return ERROR;
- } else
- component = reallocResult;
- }
- sprintf( query, "(%s%s*)", attribute,
- (soundex)?"~=":"=" );
- component[numberOfComponents++] = strdup( query );
- }
- if ( *value != '\0' )
- if ( processTerm( SEARCH_ALL, soundex, value, NULL, NULL ) == ERROR )
- return ERROR;
- if ( numberOfComponents == 0 ) {
- printFormatted( lineLength, TRUE, stdout,
- "NULL query." );
- return ERROR;
- } else if ( numberOfComponents == 1 )
- strcpy( query, component[0] );
- else {
- strcpy( query, "(&" );
- for ( i = 0; i < numberOfComponents; i++ )
- strcat( query, component[i] );
- strcat( query, ")" );
- }
- free( component );
- break;
-
- }
- if ( token == COLON ) { /* global constraints */
- do {
- token = getToken( buffer );
- switch ( token ) {
- case FORMAT:
- if ( ( token = getToken( buffer ) ) != EQUALS ) {
- printFormatted( lineLength, TRUE, stdout, "\"=\" expected" );
- } else
- token = getToken( buffer );
- switch ( token ) {
- case FULL:
- case ABRIDGED:
- case HANDLE:
- case SUMMARY:
- if ( outputFormat != NULL )
- printFormatted( lineLength, TRUE, stdout, "Only one response format can be specified." );
- else
- outputFormat = token;
- break;
-
- default:
- printFormatted( lineLength, TRUE, stdout, "Unrecognised format specifier" );
- }
- token = getToken( buffer );
- break;
-
- case HOLD:
- holdConnection = TRUE;
- token = getToken( buffer );
- break;
-
- case MAXHITS:
- if ( ( token = getToken( buffer ) ) != EQUALS ) {
- printFormatted( lineLength, TRUE, stdout, "\"=\" expected" );
- } else
- token = getToken( buffer );
- if ( (maxHits = atoi( buffer )) < 1
- || maxHits > maximumSize ) {
- printFormatted( lineLength, TRUE, stdout, "Invalid maxhits value, defaulting to %s", maximumSize );
- maxHits = maximumSize;
- }
- token = getToken( buffer );
- break;
-
- case LANGUAGE:
- if ( ( token = getToken( buffer ) ) != EQUALS ) {
- printFormatted( lineLength, TRUE, stdout, "\"=\" expected" );
- } else
- token = getToken( buffer );
-/**/ /* need to save this value and lookup locale */
- printFormatted( lineLength, TRUE, stdout,
- "Language not currently implemented" );
- token = getToken( buffer );
- break;
-
- case LINE_LENGTH:
- if ( ( token = getToken( buffer ) ) != EQUALS ) {
- printFormatted( lineLength, TRUE, stdout, "\"=\" expected" );
- } else
- token = getToken( buffer );
- lineLength = atoi( buffer );
- if ( lineLength < MIN_LINE_LENGTH
- || lineLength > MAX_LINE_LENGTH ) {
- printFormatted( lineLength, TRUE, stdout, "Invalid line length, using default %d", DEFAULT_LINE_LENGTH );
- lineLength = DEFAULT_LINE_LENGTH;
- }
- token = getToken( buffer );
- break;
-
- case TRACE:
- trace = TRUE;
- token = getToken( buffer );
- break;
-
- default:
- printFormatted( lineLength, TRUE, stdout, "Unrecognised global constraint \"%s\"", buffer );
- while ( ( token = getToken( buffer ) ) != EOF
- && token != COMMA )
- ;
- break;
-
- }
- } while ( token == COMMA );
- }
- if ( token != EOF ) {
- printFormatted( lineLength, TRUE, stdout,
- "Data following \"%s\" ignored.", buffer );
- while ( ( token = getToken( buffer ) ) != EOF )
- ;
- }
- if ( trace && ( command == READ || command == SEARCH ) )
- switch (command) {
- case READ:
- printFormatted( lineLength, TRUE, stdout,
- "Attempting to read \"%s\"", query );
- break;
-
- case SEARCH:
- printFormatted( lineLength, TRUE, stdout,
- "Searching using LDAP query %s", query );
- break;
-
- }
- return command;
-}
+++ /dev/null
-#if !defined(lint)
-static char copyright[] = "Copyright 1992 The University of Adelaide";
-#endif
-
-/*
- * C O N F I G
- *
- * Author: Mark R. Prior
- * Communications and Systems Branch
- * Information Technology Division
- * The University of Adelaide
- * E-mail: mrp@itd.adelaide.edu.au
- * Date: October 1992
- * Version: 1.7
- * Description:
- * Process the configuration file.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of Adelaide. The name of the University may not
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "whois++.h"
-#include <stdlib.h>
-
-static struct {
- char *str;
- int cmd;
- } commands[] = {
-#define CMD_BASE 1
- "base", CMD_BASE,
-#define CMD_LDAP 2
- "ldaphost", CMD_LDAP,
-#define CMD_HELPDIR 3
- "helpdir", CMD_HELPDIR,
-#define CMD_USER 4
- "user", CMD_USER,
-#define CMD_PASSWORD 5
- "password", CMD_PASSWORD,
-#define CMD_CONFIGDIR 6
- "configdir", CMD_CONFIGDIR,
-#define CMD_CONTACT 7
- "contact", CMD_CONTACT,
-#define CMD_HOSTNAME 8
- "hostname", CMD_HOSTNAME,
-#define CMD_LANGUAGE 9
- "language", CMD_LANGUAGE,
-#define CMD_BANNER 10
- "banner", CMD_BANNER,
-#define CMD_TEMPLATE 11
- "template", CMD_TEMPLATE,
- NULL, NULL
- };
-
-static void
-nextLine( FILE *fp )
-{
- /*
- * We probably should check that the user hasn't put anything else
- * on the line but I can't be bothered!
- */
- register int c;
-
- while ((c = getc(fp)) != EOF && c != '\n')
- ;
-}
-
-/*
- * Get next word, skipping blanks & comments.
- */
-static int
-getWord( char *buffer, int size, FILE *fp )
-{
- char *cp;
- int c, string;
-
- string = 0;
- cp = buffer;
- while ((c = getc(fp)) != EOF) {
- if (c == '#') {
- while ((c = getc(fp)) != EOF && c != '\n')
- ;
- continue;
- }
- if (c == '\n') {
- if (cp != buffer)
- ungetc(c, fp);
- break;
- } else if (c == '\\') {
- c = getc(fp);
- if (c == EOF)
- c = '\n';
- } else if (c == '"') {
- string = !string;
- continue;
- }
- if (!string && isspace(c)) {
- while (isspace(c = getc(fp)) && c != '\n')
- ;
- ungetc(c, fp);
- if (cp != buffer) /* Trailing whitespace */
- break;
- continue; /* Leading whitespace */
- }
- if (cp >= buffer+size-1)
- break;
- *cp++ = c;
- }
- *cp = '\0';
- return (cp != buffer);
-}
-
-void
-readConfiguration( FILE *config )
-{
- char buffer[BUFSIZ];
- char *s;
- int i;
-
- /*
- * A procedure to read in the configuration parameters.
- * At the moment this is just a "quick hack" and it should be
- * replaced in the next version by a proper scanner.
- */
-
- while ( getWord( buffer, BUFSIZ, config ) != NULL ) {
- for ( i = 0; commands[i].str != NULL; i++ )
- if ( EQ( buffer, commands[i].str ) )
- break;
- if ( commands[i].str == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Unrecognised command <%s>", buffer );
- exit( 1 );
- }
- if ( getWord( buffer, BUFSIZ, config ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "value missing in configuration file" );
- exit( 1 );
- }
- switch ( commands[i].cmd ) {
- case CMD_BASE:
- base = strdup( buffer );
- break;
-
- case CMD_LDAP:
- ldaphost = strdup( buffer );
- break;
-
- case CMD_HELPDIR:
- helpDir = strdup( buffer );
- break;
-
- case CMD_USER:
- user = strdup( buffer );
- break;
-
- case CMD_PASSWORD:
- password = strdup( buffer );
- break;
-
- case CMD_CONFIGDIR:
- configDir = strdup( buffer );
- break;
-
- case CMD_CONTACT:
- contact = strdup( buffer );
- break;
-
- case CMD_HOSTNAME:
- hostname = strdup( buffer );
- break;
-
- case CMD_LANGUAGE:
- defaultLanguage = lowerCase( strdup( buffer ) );
- break;
-
- case CMD_BANNER:
- banner = strdup( buffer );
- break;
-
- case CMD_TEMPLATE:
- if ( templateTranslationTable == NULL
- && ( templateTranslationTable = (table *)malloc(sizeof(table)*tableSize) ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Malloc failed" );
- exit( 1 );
- } else if ( numberOfTemplates+1 == tableSize ) {
- tableSize += TABLE_INCREMENT;
- if ( ( templateTranslationTable = (table *)realloc(templateTranslationTable, sizeof(table)*tableSize) ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Realloc failed" );
- exit( 1 );
- }
- }
- templateTranslationTable[numberOfTemplates].key =
- lowerCase( strdup( buffer ) );
- if ( getWord( buffer, BUFSIZ, config ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "objectClass missing in config file" );
- exit( 1 );
- }
- templateTranslationTable[numberOfTemplates].value =
- lowerCase( strdup( buffer ) );
- numberOfTemplates++;
- break;
-
- default:
- printFormatted( lineLength, TRUE, stdout,
- "Attribute <%s> not recognised.",
- buffer );
- break;
-
- }
- nextLine( config );
- }
-}
+++ /dev/null
-#if !defined(lint)
-static char copyright[] = "Copyright 1992 The University of Adelaide";
-#endif
-
-/*
- * D E S C R I B E
- *
- * Author: Mark R. Prior
- * Communications and Systems Branch
- * Information Technology Division
- * The University of Adelaide
- * E-mail: mrp@itd.adelaide.edu.au
- * Date: October 1992
- * Version: 1.7
- * Description:
- * A module implementing the describe whois++ command.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of Adelaide. The name of the University may not
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "whois++.h"
-
-int displayDescribe( ld, organisation )
-LDAP *ld;
-char *organisation;
-{
-
- int i, len1, len2;
- LDAPMessage *result, *entry;
- char *value, *ptr;
- char **values;
- static char *masterDSA[] = { "masterDSA", NULL };
- static char *manager[] = { "manager", NULL };
- static char *roleOccupant[] = { "roleOccupant", NULL };
- static char *attributes[] = { "postalAddress", "telephoneNumber",
- "facsimileTelephoneNumber", "mail", "lastModifiedBy",
-#if defined(UOFA)
- "preferredName",
-#endif
- NULL };
- extern char *index();
-
- if ( !EQ( language, "english" ) )
- printFormatted( lineLength, TRUE, stdout,
- "The output of the DESCRIBE command must be in english \
-according to the IAFA services template." );
-
- printFormatted( lineLength, FALSE, stdout,
- "%-19s Whois++", "Service-Name:" );
- if ( hostname != NULL )
- printFormatted( lineLength, FALSE, stdout, "%-19s %s",
- "Primary-Name:", hostname );
- else
- printFormatted( lineLength, FALSE, stdout,
- "%-19s <unknown>", "Primary-Name:" );
- printFormatted( lineLength, FALSE, stdout,
- "%-19s Whois++ service using LDAP to access a Quipu based",
- "Description:" );
- printFormatted( lineLength, FALSE, stdout,
- "%-19s X.500 Directory Service.", "" );
- printFormatted( lineLength, FALSE, stdout,
- "%-19s whois++ protocol on tcp port 43", "Access-Protocol:" );
- printFormatted( lineLength, FALSE, stdout,
- "%-19s whois, x.500, ldap", "Keywords:" );
- printFormatted( lineLength, FALSE, stdout,
- "%-19s 24 hours a day, 7 days a week", "Access-Times:" );
- printFormatted( lineLength, FALSE, stdout,
- "%-19s Open Access", "Policy:" );
- printFormatted( lineLength, FALSE, stdout,
- "%-19s ", "URI:" );
- if ( contact == NULL ) {
- /*
- * The contact hasn't identified themselves in the tailor file
- * so lets try to work it out by finding out who manages the
- * DSA that masters the organisation's entry!
- */
- if ( debug > 2 )
- printFormatted( lineLength, TRUE, stdout,
- "No contact info provided, searching ..." );
- ldap_search_s( ld, organisation, LDAP_SCOPE_BASE,
- "objectclass=*", masterDSA, 0, &result );
- if ( ld->ld_errno != LDAP_SUCCESS ) {
- printFormatted( lineLength, FALSE, stdout,
- "%-19s <Unknown>", "Contact:" );
- return TRUE;
- }
- if ( debug > 2 )
- printFormatted( lineLength, TRUE, stdout,
- "Looking for the master DSA ..." );
- if ( (values = ldap_get_values( ld, result, "masterDSA" )) == NULL
- || values[0] == NULL ) {
- printFormatted( lineLength, FALSE, stdout,
- "%-19s <Unknown>", "Contact:" );
- return TRUE;
- }
- if ( debug > 2 )
- printFormatted( lineLength, TRUE, stdout,
- "Searching for the DSA manager ..." );
- ldap_search_s( ld, values[0], LDAP_SCOPE_BASE, "objectclass=*",
- manager, 0, &result );
- if ( ld->ld_errno != LDAP_SUCCESS ) {
- printFormatted( lineLength, FALSE, stdout,
- "%-19s <Unknown>", "Contact:" );
- printFormatted( lineLength, TRUE, stdout,
- "Search failed, %s",
- ldap_err2string( ld->ld_errno ) );
- return TRUE;
- }
- if ( (values = ldap_get_values( ld, result, "manager" )) == NULL ) {
- printFormatted( lineLength, FALSE, stdout,
- "%-19s <Unknown>", "Contact:" );
- return TRUE;
- }
- if ( debug > 2 )
- printFormatted( lineLength, TRUE, stdout,
- "Retrieving the DSA manager's entry ..." );
- /*
- * we have at least one manager for this DSA but which one is
- * the "correct" one to list?
- */
- len1 = strlen( organisation );
- for ( i = 0; values[i] != NULL; i++ )
- if ( strlen( values[i] ) >= len1 ) {
- len2 = strlen( values[i] );
- if ( EQ( organisation, &values[i][len2-len1] ) )
- contact = strdup( values[i] );
- }
- ldap_value_free( values );
- if ( contact == NULL ) {
- printFormatted( lineLength, FALSE, stdout,
- "%-19s <Unknown>", "Contact:" );
- if ( debug )
- printFormatted( lineLength, TRUE, stdout,
- "Cannot find a suitable manager" );
- return TRUE;
- }
- ldap_search_s( ld, contact, LDAP_SCOPE_BASE, "objectclass=*",
- roleOccupant, 0, &result );
- if ( ld->ld_errno != LDAP_SUCCESS ) {
- printFormatted( lineLength, FALSE, stdout,
- "%-19s <Unknown>", "Contact:" );
- printFormatted( lineLength, TRUE, stdout,
- "Search failed, %s",
- ldap_err2string( ld->ld_errno ) );
- return TRUE;
- }
- if ( (values = ldap_get_values( ld, result, "roleOccupant" )) != NULL
- || values[0] == NULL ) {
- free( contact );
- /* Just pick one! */
- contact = strdup( values[0] );
- ldap_value_free( values );
- }
- if ( debug > 2 )
- printFormatted( lineLength, TRUE, stdout,
- "The contact is %s", contact );
- }
- ldap_search_s( ld, contact, LDAP_SCOPE_BASE, "objectclass=*",
- attributes, 0, &result );
- if ( ld->ld_errno != LDAP_SUCCESS ) {
- printFormatted( lineLength, FALSE, stdout, "%-19s <Unknown>",
- "Contact:" );
- printFormatted( lineLength, TRUE, stdout,
- "Read for \"%s\" returned error, %s", contact,
- ldap_err2string( ld->ld_errno ) );
- }
-#if defined(UOFA)
- if ( (values = ldap_get_values( ld, result, "preferredName" )) != NULL
- && values[0] != NULL ) {
- printFormatted( lineLength, FALSE, stdout, "%-19s %s",
- "Contact:", values[0] );
- ldap_value_free( values );
- } else {
-#endif
- value = ldap_dn2ufn( ptr = ldap_get_dn( ld, result ) );
- ldap_memfree( ptr );
- if ( (ptr = index( value, ',' )) != NULL )
- *ptr = '\0';
- printFormatted( lineLength, FALSE, stdout, "%-19s %s",
- "Contact:", value );
- ldap_memfree( value );
-#if defined(UOFA)
- }
-#endif
- if ( ( values = ldap_get_values( ld, result, "postalAddress" )) != NULL ) {
- for ( i = 0; values[i] != NULL; i++ ) {
- printFormatted( lineLength, FALSE, stdout, "%-19s %s",
- "Postal-Address:",
- strtok( values[i], "$" ) );
- while ( ( ptr = strtok( NULL, "$" ) ) != NULL )
- printFormatted( lineLength, FALSE, stdout,
- "%-19s%s", "", ptr );
- }
- ldap_value_free( values );
- }
- if ( ( values = ldap_get_values( ld, result, "telephoneNumber" )) != NULL ) {
- for ( i = 0; values[i] != NULL; i++ )
- printFormatted( lineLength, FALSE, stdout, "%-19s %s",
- "Telephone:", values[i] );
- ldap_value_free( values );
- }
- if ( ( values = ldap_get_values( ld, result, "facsimileTelephoneNumber" )) != NULL ) {
- for ( i = 0; values[i] != NULL; i++ )
- printFormatted( lineLength, FALSE, stdout, "%-19s %s",
- "Fax:", values[i] );
- ldap_value_free( values );
- }
- if ( ( values = ldap_get_values( ld, result, "mail" )) != NULL ) {
- for ( i = 0; values[i] != NULL; i++ )
- printFormatted( lineLength, FALSE, stdout, "%-19s %s",
- "Electronic-Address:", values[i] );
- ldap_value_free( values );
- }
- if ( ( values = ldap_get_values( ld, result, "lastModifiedBy" )) != NULL ) {
- for ( i = 0; values[i] != NULL; i++ )
- printFormatted( lineLength, FALSE, stdout,
- "%-19s \"%s\"", "Modified-By:", values[i] );
- ldap_value_free( values );
- }
- return FALSE;
-}
+++ /dev/null
-#if !defined(lint)
-static char copyright[] = "Copyright 1992 The University of Adelaide";
-#endif
-
-/*
- * H E L P
- *
- * Author: Mark R. Prior
- * Communications and Systems Branch
- * Information Technology Division
- * The University of Adelaide
- * E-mail: mrp@itd.adelaide.edu.au
- * Date: October 1992
- * Version: 1.7
- * Description:
- * The Help module
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of Adelaide. The name of the University may not
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "whois++.h"
-
-void
-needHelp( char *reason )
-{
- char filename[MAXPATHLEN];
- char buffer[BUFSIZ];
- int i;
- DIR *dir;
- struct dirent *entry;
- FILE *help;
-
- if ( reason == NULL || *reason == '\0' ) {
- sprintf( filename, "%s/%s/general", helpDir, language );
- if ( ( help = fopen( filename, "r" ) ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Sorry cannot open general information help file" );
- return;
- }
- } else {
- sprintf( filename, "%s/%s/%s", helpDir, language,
- lowerCase( reason ) );
- if ( ( help = fopen( filename, "r" ) ) == NULL ) {
- sprintf( filename, "%s/%s/%s", helpDir, defaultLanguage,
- lowerCase( reason ) );
- if ( ( help = fopen( filename, "r" ) ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Sorry cannot open help file for topic \"%s\"",
- reason );
- return;
- } else {
- printFormatted( lineLength, TRUE, stdout,
- "Sorry no help in %s, using default language (%s).",
- language, defaultLanguage );
- }
- }
- }
- while ( fgets( buffer, BUFSIZ, help ) != NULL ) {
- i = strlen( buffer );
- while ( i-- > 0 && ( buffer[i] == '\n' || buffer[i] == '\r' ) )
- buffer[i] = '\0';
- printFormatted( lineLength, FALSE, stdout, "%s", buffer );
- }
- fclose( help );
- if ( reason == NULL || *reason == '\0' ) {
- sprintf( filename, "%s/%s", helpDir, language );
- if ( ( dir = opendir( filename ) ) == NULL )
- return;
- printFormatted( lineLength, FALSE, stdout, "" );
- printFormatted( lineLength, FALSE, stdout,
- "Further information is available on the following topics" );
- for ( entry = readdir( dir ); entry != NULL; entry = readdir( dir ) )
- if ( !EQ(entry->d_name, "." ) && !EQ(entry->d_name, ".." ) )
- printFormatted( lineLength, FALSE, stdout,
- " %s", lowerCase( entry->d_name ) );
- closedir( dir );
- }
- return;
-}
+++ /dev/null
-List the commands supported by this server.
+++ /dev/null
-The whois++ query langauge contains a number of mandatory commands which all
-servers should support but there are also a number of optional commands. In
-order that a client can find out what commands are supported by a server
-there is a mandatory command called "command" that should provide a list of
-all commands supported by the server. If you wish to use a command that is
-optional you may wish to use the "command" command to find out if the server
-supports it.
-
-This server only supports the mandatory commands.
+++ /dev/null
-Constraints are a mechanism for modifying the behaviour of the query and are
-divided into two classes (local or global) depending on the scope of the
-modification. Local contraints may appear attached to each term in a query,
-whereas global contraints apply to the entire query and so are listed after
-the actual query (separated from the query by a colon).
-
-This implementation supports the following constraints -
-1. Local constraints
- a. match=(exact|fuzzy)
- The directory is either searched for an exact match of the value
- specified or soundex style matching is attempted.
- If you wish to attempt substring matching you should include a "*" in
- your search string.
- Default=exact
-
-2. Global constraints
- a. format=(full|abridged|handle|summary)
- This specifies the format of the response returned by the query.
- Normally the format used is controlled by the number of matches but this
- constraint may be used to override the default.
- b. hold
- The connection is held open for a maximum of 60 seconds for further
- queries, normally the connection is closed after each query.
- c. language=<string>
- Return any diagnostics in the natural language specified.
- Default=english
- d. linelength=<value>
- This constraint allows you to indicate the maximum length of lines you
- can display via your client.
- Default=80
- e. maxhits=<value>
- The intent of this constraint is to limit the number of hits returned.
- Unfortunately in the context of the server communicating with an X.500
- server this is generally not possible as the DSA will define the
- maximum number of entries it wishes to return. It is still of some use
- if you wish to constrain the value to less than the value that the
- X.500 directory would normally return.
- The default value is dependant on the value configured by the Directory
- Administrator into the DSA.
+++ /dev/null
-The describe command returns information about this service, formatted
-according to the IAFA Services template. This information will include a
-description of the service, access policy, and a contract for the person
-who manages the Directory.
-
+++ /dev/null
-You have connected to a server that implements the new WHOIS++ specification.
-
-This service is provided via an underlying X.500 Directory Service and so
-this server is really only a read-only DUA interface to the X.500 Directory.
-
-A "technical" description of this service may be obtained by using the
-"describe" command, this will also list a contact for this service.
+++ /dev/null
-This is an experimental implementation of a whois++ service being proposed
-by the IETF's WNILS (Whois and Network Information Lookup Service) Working
-Group. It uses a (Quipu 8.0 based) X.500 Directory Service as it's
-information source.
-
-The whois++ server communicates with the Directory via LDAP (Lightweight
-Directory Access Protocol), using the libraries developed by the University
-of Michigan. All user search queries are transformed into LDAP queries that
-are passed to the X.500 Directory service for resolution.
-
-For "normal" whois style queries we make a number of assumptions on the
-attributes of interest depending on the format of the query. If you only
-supply a single token it is assumed that you wish to search for a family
-name or userid. Multiple tokens imply a search on a full name (commonName
-in X.500-speak). We also support e-mail lookups as described in the
-original whois RFC (RFC954) however wildcard style searches may be
-constrained by the X.500 Directory service.
-
-Example queries
-a. ng =>
- (|(sn=ng)(userid=ng)(l=ng)(ou=ng)(&(cn=ng)(!(objectClass=person))))
-b. zhongyi li =>
- (|(l=zhongyi li)(ou=zhongyi li)(preferredName=zhongyi li)\
- (cn=*zhongyi * li))
-c. mrp@ =>
- (|(mail=mrp@*)(userid=mrp))
-
-You can also use structured whois++ queries that specify the attribute to
-search as well as value. Searching using uncommon attributes attributes may
-be restricted by the X.500 Directory system.
+++ /dev/null
-The list command returns a list of the whois++ template types that may be
-returned as a result of a query. You can use the show command to return
-further information about these templates.
+++ /dev/null
-There are 4 different search styles possible when using a whois++ server.
-
-The first of these styles is the familiar whois style query, where your
-client supplies a number of tokens and these tokens are converted into a
-LDAP search query for processing by the X.500 Directory system.
-
-Example queries
-a. ng =>
- (|(sn=ng)(userid=ng)(l=ng)(ou=ng)(&(cn=ng)(!(objectClass=person))))
-
-b. Snoke, Robert Lee =>
- (&(sn=Snoke)(|(l=Robert Lee Snoke)(ou=Robert Lee Snoke)\
- (preferredName=Robert Lee Snoke)(cn=*Robert * Lee * Snoke)))
-
-c. mrp@ =>
- (|(mail=mrp@*)(userid=mrp))
-
-As you can see no attribute information was supplied by the client and so
-the server must "guess" what information is required. X.500 uses the
-attribute cn (commonName) fairly generically to name entries so this is used
-in constructing queries. It is assumed that most queries will relate to a
-search for a person so the query is composed in such a way to emphasise this
-assumption. If only one token is supplied this is assumed to be a family
-name whereas if more than one token is supplied this assumed to be the full
-name, in order to distinguish the family name you may use the "," syntax as
-per example (b).
-
-E-mail lookups as described in the original whois RFC (RFC954) are also
-supported however wildcard style searches may be constrained by the X.500
-Directory service.
-
-The other search styles involve the use of attributes, where the client
-specifies the type of the data that it wishes to search for.
+++ /dev/null
-The show command returns a list of attributes that can be returned if a
-record of that template type is returned as a result of a query.
+++ /dev/null
-The version command provides version number information and should be quoted
-when reporting any problems with the server. The information returned will
-include the version of the protocol as well as the program's revision number.
+++ /dev/null
-#if !defined(lint)
-static char copyright[] = "Copyright 1992 The University of Adelaide";
-#endif
-
-/*
- * O U T P U T
- *
- * Author: Mark R. Prior
- * Communications and Systems Branch
- * Information Technology Division
- * The University of Adelaide
- * E-mail: mrp@itd.adelaide.edu.au
- * Date: October 1992
- * Version: 1.7
- * Description:
- * The Output routines
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of Adelaide. The name of the University may not
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include <varargs.h>
-#include "whois++.h"
-
-extern char *index(), *rindex();
-
-static displayEntry();
-static printAttribute();
-
-static char *selectObjectClass( ld, entry )
-LDAP *ld;
-LDAPMessage *entry;
-
-{
- static char *objectClass[] = { "objectClass", NULL };
- LDAPMessage *result;
- char *dn, *template;
- char **val;
- int i;
-
- template = NULL;
- dn = ldap_get_dn( ld, entry );
- ldap_search_s( ld, dn, LDAP_SCOPE_BASE, "objectclass=*", objectClass,
- 0, &result );
- if ( ld->ld_errno != LDAP_SUCCESS ) {
- printFormatted( lineLength, TRUE, stdout,
- "Read on object \"%s\" failed, %s",
- dn, ldap_err2string( ld->ld_errno ) );
- ldap_memfree( dn );
- return NULL;
- } else
- ldap_memfree( dn );
- if ( ( val = ldap_get_values( ld, result, "objectClass" ) ) == NULL )
- return NULL;
- for ( i = 0 ; val[i] != NULL ; i++ )
- if ( specifyAttributes( lowerCase( val[i] ) ) != NULL ) {
- template = strdup( val[i] );
- break;
- }
- ldap_value_free( val );
- return template;
-}
-
-int displayResult( ld, result, outputFormat )
-LDAP *ld;
-LDAPMessage *result;
-int outputFormat;
-
-{
- int i, matches, number = 0;
- char *dn;
- LDAPMessage *e;
- char *objectClass;
- char **attributes, **objectClassTable;
-
- matches = ldap_count_entries( ld, result );
- if ( log )
- syslog( LOG_INFO, "%d match(es) to query", matches );
- if ( matches == 0 ) {
- printFormatted( lineLength, TRUE, stdout, "No matches found." );
- return FALSE;
- }
- if ( outputFormat == NULL ) {
- if ( matches == 1 )
- outputFormat = FULL;
- else if ( matches <= ABRIDGED_LIMIT )
- outputFormat = HANDLE;
- else
- outputFormat = SUMMARY;
- }
- switch (outputFormat) {
- case FULL:
- printFormatted( lineLength, FALSE, stdout,
- "#FULL %d", matches );
- for ( e = ldap_first_entry( ld, result ); e != NULL;
- e = ldap_next_entry( ld, e ) ) {
- objectClass = selectObjectClass( ld, e );
- dn = ldap_get_dn( ld, e );
- printFormatted( lineLength, FALSE, stdout,
- "#%s \"%s\"",
- objectClassToTemplate( objectClass ), dn );
- displayEntry( ld, dn,
- specifyAttributes( objectClass ) );
- if ( objectClass != NULL )
- free( objectClass );
- }
- printFormatted( lineLength, FALSE, stdout, "#END" );
- break;
-
- case ABRIDGED:
- /*
- * As the DN contains most of the information wanted in
- * ABRIDGED format we use HANDLE format even if the client
- * really specified ABRIDGED.
- */
- printFormatted( lineLength, TRUE, stdout,
- "Abridged format is not really supported, the handle \
-supplies most of the information specified in the abridged format description \
-so we use the handle format instead." );
-
- case HANDLE:
- printFormatted( lineLength, FALSE, stdout,
- "#HANDLE %d", matches );
- for ( e = ldap_first_entry( ld, result ); e != NULL;
- e = ldap_next_entry( ld, e ) ) {
- objectClass = selectObjectClass( ld, e );
- printFormatted( lineLength, FALSE, stdout, " \"%s\" %s",
- ldap_get_dn( ld, e ),
- objectClassToTemplate( objectClass ) );
- if ( objectClass != NULL )
- free( objectClass );
- }
- printFormatted( lineLength, FALSE, stdout, "#END" );
- break;
-
- case SUMMARY:
- printFormatted( lineLength, FALSE, stdout, "#SUMMARY" );
- printFormatted( lineLength, FALSE, stdout, " matches: %d",
- matches );
- e = ldap_first_entry( ld, result );
- objectClass = selectObjectClass( ld, e );
- if ( ( objectClassTable = (char **)malloc(sizeof(char **)*matches) ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Malloc failed" );
- break;
- }
- objectClassTable[number++] = objectClass;
- printFormatted( lineLength, FALSE, stdout, " templates: %s",
- objectClassToTemplate( objectClass ) );
- while ( ( e = ldap_next_entry( ld, e ) ) != NULL ) {
- objectClass = selectObjectClass( ld, e );
- /* have we printed this before? If not do it now */
- for ( i = 0; i < number; i++ )
- if ( EQ( objectClass, objectClassTable[i] ) )
- break;
- if ( i < number ) {
- if ( objectClass != NULL )
- free( objectClass );
- } else {
- objectClassTable[number++] = objectClass;
- printFormatted( lineLength, FALSE, stdout,
- " %s",
- objectClassToTemplate( objectClass ) );
- }
- }
- printFormatted( lineLength, FALSE, stdout, "#END" );
- for ( i = 0; i < number; i++ )
- if ( objectClassTable[i] != NULL )
- free( objectClassTable[i] );
- free( objectClassTable );
- break;
-
- }
- return TRUE;
-}
-
-static displayEntry( ld, dn, attributes )
-LDAP *ld;
-char *dn, *attributes[];
-{
- char *ufn;
- int i;
- char *s, *department;
- LDAPMessage *result, *entry;
-
- ldap_search_s( ld, dn, LDAP_SCOPE_BASE, "objectclass=*", attributes,
- 0, &result );
- if ( ld->ld_errno != LDAP_SUCCESS ) {
- printFormatted( lineLength, TRUE, stdout,
- "Read on object \"%s\" failed, %s", dn,
- ldap_err2string( ld->ld_errno ) );
- return;
- }
-
- entry = ldap_first_entry( ld, result );
-
- if ( entry == NULL ) {
- /* something very weird has happened */
- printFormatted( lineLength, TRUE, stdout,
- "Possible conflict with ACLs for \"%s\"", dn );
- return;
- }
-
- /*
- * Get the UFN version of the DN and then cut it up into
- * name and department.
- */
- ufn = ldap_dn2ufn( dn );
- if ( ( s = index( ufn, ',' ) ) != NULL ) {
- *s++ = '\0';
- while ( *s != '\0' && isspace( (unsigned char) *s ) )
- s++;
- department = s;
- while ( s != NULL && *s != '\0' && !EQ( s, organisation ) )
- if ( ( s = index( s, ',' ) ) != NULL ) {
- s++;
- while ( *s && isspace( (unsigned char) *s ) )
- s++;
- }
- if ( s != NULL )
- if ( s != department ) {
- while ( isspace( (unsigned char) *--s ) )
- ;
- *s = '\0';
- } else
- department = NULL;
- } else
- department = NULL;
-
-/**/ /*
- * Name, Organization, Department, Organization-Type, and Handle
- * should be read in from language dictionary rather than hard coded.
- */
- printFormatted( lineLength, FALSE, stdout, " %-19s %s", "Name", ufn );
- if ( department != NULL && *department != '\0' )
- printFormatted( lineLength, FALSE, stdout,
- " %-19s %s", "Department", department );
- printFormatted( lineLength, FALSE, stdout, " %-19s %s",
- "Organization", organisation );
- if ( category != NULL )
- for ( i = 0; category[i] != NULL; i++ )
- printFormatted( lineLength, FALSE, stdout, " %-19s %s",
- "Organization-type", category[i] );
- for ( i = 0; attributes != NULL && attributes[i] != NULL; i++ ) {
- printAttribute( ld, attributes[i], entry );
- }
- printFormatted( lineLength, FALSE, stdout, " %-19s \"%s\"",
- "Handle", dn );
-
- ldap_memfree( ufn );
-}
-
-char *attributeLabel( attribute )
-char *attribute;
-
-{
-/**/ /* need to get printable string from language dictionary */
- return attribute;
-}
-
-static printAttribute( ld, attribute, entry )
-LDAP *ld;
-char *attribute;
-LDAPMessage *entry;
-{
- char **val;
- char *tag, *ptr;
- int i;
-
-/**/ /*
- * We really should determine whether the attribute value needs line
- * processing or not rather than just hard coding in a couple of cases
- * but for the moment we will ignore the problem.
- */
- if ( ( val = ldap_get_values( ld, entry, attribute )) == NULL )
- return;
-
- tag = attributeLabel( attribute );
- for ( i = 0; val[i] != NULL; i++ )
- if ( EQ( attribute, "lastModifiedTime" ) )
- printFormatted( lineLength, FALSE, stdout, " %-19s %s",
- tag, convertTime( val[i], locale ) );
- else if ( EQ( attribute, "postalAddress" )
- || EQ( attribute, "homePostalAddress" ) ) {
- printFormatted( lineLength, FALSE, stdout, " %-19s %s",
- tag, strtok( val[i], "$" ) );
- while ( ( ptr = strtok( NULL, "$" ) ) != NULL )
- printFormatted( lineLength, FALSE, stdout,
- " %-19s%s", "", ptr );
- } else
- printFormatted( lineLength, FALSE, stdout, " %-19s %s",
- tag, val[i] );
-
- ldap_value_free( val );
-}
-
-printFormatted( va_alist )
-va_dcl
-{
- int lineLength, systemMessage;
- FILE *output;
- char *format;
- va_list ap;
-
- char buffer[BUFSIZ];
- char *head, *p, *q;
- char *tag;
- int count;
-
- va_start( ap );
- lineLength = va_arg( ap, int );
- systemMessage = va_arg( ap, int );
- output = va_arg( ap, FILE * );
- format = va_arg( ap, char * );
- if ( systemMessage ) {
- lineLength--;
- tag = "% ";
- } else
- tag = "";
- vsprintf( buffer, format, ap );
- va_end( ap );
-
- if ( strlen( buffer ) < lineLength )
- fprintf( output, "%s%s\r\n", tag, buffer );
- else {
- head = buffer;
- do {
- count = strlen( tag );
- for ( q = head; *q && *q != ' '; q++ )
- count++;
- if ( *q == NULL ) {
- fprintf( output, "%s%s\r\n", tag, head );
- break;
- } else if ( count > lineLength ) {
- *q++ = '\0';
- fprintf( output, "%s%s\r\n", tag, head );
- head = q;
- } else {
- do {
- p = q++;
- count++;
- for (; *q && *q != ' '; q++ )
- count++;
- } while ( *p != '\0' && count <= lineLength );
- if ( *p != '\0' )
- *p++ = '\0';
- fprintf( output, "%s%s\r\n", tag, head );
- head = p;
- }
- if ( !systemMessage )
- tag = "+ ";
- } while ( *head != NULL );
- }
-}
+++ /dev/null
-*** Makefile-dist Fri Apr 23 15:29:24 1993
---- Makefile Fri Apr 23 15:33:04 1993
-***************
-*** 86,92 ****
-
- LDIRS = libldap liblber # library directories
- SDIRS = ldapd # server directories
-! CDIRS = finger gopher ud rcpt500 whois mail500 # client directories
- ALLDIRS = $(CDIRS) $(SDIRS) $(LDIRS)
-
- VERSION = 2.0 # set this to be the same as what's in ./version
---- 86,92 ----
-
- LDIRS = libldap liblber # library directories
- SDIRS = ldapd # server directories
-! CDIRS = finger gopher ud rcpt500 whois mail500 whois++ # client directories
- ALLDIRS = $(CDIRS) $(SDIRS) $(LDIRS)
-
- VERSION = 2.0 # set this to be the same as what's in ./version
-***************
-*** 99,105 ****
-
- lib-only: lber-library ldap-library
-
-! others: ldap-finger ldap-gopher ldap-ud ldap-rcpt500 ldap-whois ldap-mail500
-
- lber-library:
- @echo "cd liblber; $(MAKE) all"
---- 99,106 ----
-
- lib-only: lber-library ldap-library
-
-! others: ldap-finger ldap-gopher ldap-ud ldap-rcpt500 ldap-whois ldap-mail500 \
-! ldap-whois++
-
- lber-library:
- @echo "cd liblber; $(MAKE) all"
-***************
-*** 181,186 ****
---- 182,194 ----
- ETCDIR=$(ETCDIR) CC=$(CC) \
- all)
-
-+ ldap-whois++:
-+ @echo "cd whois++; $(MAKE) all"
-+ @(cd whois++; $(MAKE) ACFLAGS="$(ACFLAGS)" ALDFLAGS="$(ALDFLAGS)" \
-+ KRBLIBFLAG=$(KRBLIBFLAG) KRBLIBS="$(KRBLIBS)" \
-+ ETCDIR=$(ETCDIR) CC=$(CC) \
-+ all)
-+
- #
- # rules to install the software
- #
-***************
-*** 188,194 ****
- install: inst-include inst-server inst-lberlib inst-ldaplib inst-man
-
- inst-others: inst-finger inst-gopher inst-ud inst-rcpt500 inst-whois \
-! inst-mail500
-
- inst-lib: inst-lberlib inst-ldaplib
-
---- 196,202 ----
- install: inst-include inst-server inst-lberlib inst-ldaplib inst-man
-
- inst-others: inst-finger inst-gopher inst-ud inst-rcpt500 inst-whois \
-! inst-mail500 inst-whois++
-
- inst-lib: inst-lberlib inst-ldaplib
-
-***************
-*** 231,236 ****
---- 239,248 ----
- inst-whois:
- @echo "cd whois; $(MAKE) install"
- @( cd whois; $(MAKE) ETCDIR=$(ETCDIR) install )
-+
-+ inst-whois++:
-+ @echo "cd whois++; $(MAKE) inst-whois++"
-+ @( cd whois++; $(MAKE) ETCDIR=$(ETCDIR) inst-whois++ )
-
- inst-mail500:
- @echo "cd mail500; $(MAKE) install"
+++ /dev/null
-#if !defined(lint)
-static char copyright[] = "Copyright 1992 The University of Adelaide";
-#endif
-
-/*
- * T E M P L A T E
- *
- * Author: Mark R. Prior
- * Communications and Systems Branch
- * Information Technology Division
- * The University of Adelaide
- * E-mail: mrp@itd.adelaide.edu.au
- * Date: October 1992
- * Version: 1.7
- * Description:
- * This module deals with whois++ templates
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of Adelaide. The name of the University may not
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "whois++.h"
-#include <stdlib.h>
-
-
-void
-showTemplate( char *template )
-{
- char filename[MAXPATHLEN], buffer[BUFSIZ];
- FILE *description;
- int i;
-
- if ( template == NULL || *template == '\0' )
- return;
- sprintf( filename, "%s/templates/%s", configDir, template );
- if ( ( description = fopen( filename, "r" ) ) == NULL )
- printFormatted( lineLength, TRUE, stdout,
- "Cannot find template %s", template );
- else {
- while ( fgets( buffer, BUFSIZ, description ) != NULL ) {
- i = strlen( buffer );
- while ( i-- > 0 &&
- ( buffer[i] == '\n' || buffer[i] == '\r' ) )
- buffer[i] = '\0';
- printFormatted( lineLength, FALSE, stdout,
- " %s", buffer );
- }
- fclose( description );
- }
-}
-
-void
-listTemplates( char *query )
-{
- char filename[MAXPATHLEN];
- DIR *dir;
- struct dirent *entry;
-
- if ( query == NULL || *query == '\0' ) {
- sprintf( filename, "%s/templates", configDir );
- if ( ( dir = opendir( filename ) ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Cannot access template descriptions - %s",
- strerror( errno ) );
- return;
- }
- for ( entry = readdir( dir ); entry != NULL; entry = readdir( dir ) )
- if ( !EQ(entry->d_name, "." ) && !EQ(entry->d_name, ".." ) )
- printFormatted( lineLength, FALSE, stdout,
- " %s", lowerCase( entry->d_name ) );
- closedir( dir );
- } else {
- sprintf( filename, "%s/templates/%s", configDir, query );
- if ( fopen( filename, "r" ) == NULL )
- printFormatted( lineLength, TRUE, stdout,
- "No such template (%s)", query );
- else
- printFormatted( lineLength, FALSE, stdout,
- " %s", query );
- }
-}
-
-char **
-specifyAttributes( char *objectClass )
-{
- FILE *description;
- char filename[MAXPATHLEN], buffer[BUFSIZ];
- char **attributes;
- int max = ATTRIBUTE_INCREMENT;
- int i, number = 0;
-
- if ( objectClass == NULL || *objectClass == '\0' )
- return NULL;
- sprintf( filename, "%s/templates/%s", configDir,
- lowerCase( objectClass ) );
- if ( ( description = fopen( filename, "r" ) ) == NULL )
- return NULL;
- if ( ( attributes = (char **)malloc( max*sizeof(char *) ) ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Error while attempting to create attribute list - %s",
- strerror( errno ) );
- return NULL;
- }
- while ( fgets( buffer, BUFSIZ, description ) != NULL ) {
- i = strlen( buffer );
- while ( i-- > 0 && ( buffer[i] == '\n' || buffer[i] == '\r' ) )
- buffer[i] = '\0';
- attributes[number++] = strdup( buffer );
- if ( number == max ) {
- max += ATTRIBUTE_INCREMENT;
- if ( ( attributes = (char **)realloc( attributes, max*sizeof(char *)) ) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Error while attempting to extend attribute list - %s",
- strerror( errno ) );
- return NULL;
- }
- }
- }
- attributes[number] = NULL;
- fclose( description );
- return attributes;
-}
-
-char *
-templateToObjectClass( char *template )
-{
- int i;
-
- if ( template == NULL || *template == '\0' ) {
- printFormatted( lineLength, TRUE, stdout,
- "Unrecognised template" );
- return "unrecognised";
- }
- for ( i = 0; i < numberOfTemplates; i++ )
- if ( EQ( template, templateTranslationTable[i].key ) )
- return templateTranslationTable[i].value;
- printFormatted( lineLength, TRUE, stdout,
- "Template (%s) not recognised, assuming that it is already an objectClass",
- template );
- return template;
-}
-
-char *
-objectClassToTemplate( char *objectClass )
-{
- int i;
-
- if ( objectClass == NULL || *objectClass == '\0' ) {
- printFormatted( lineLength, TRUE, stdout,
- "Unrecognised template" );
- return "unrecognised";
- }
- for ( i = 0; i < numberOfTemplates; i++ )
- if ( EQ( objectClass, templateTranslationTable[i].value ) )
- return templateTranslationTable[i].key;
- return objectClass;
-}
+++ /dev/null
-description
-lastModifiedBy
+++ /dev/null
-roleOccupant
+++ /dev/null
-telephoneNumber
-facsimileTelephoneNumber
+++ /dev/null
-telephoneNumber
-streetAddress
-facsimileTelephoneNumber
-roomNumber
-title
-mail
-info
-lastModifiedBy
-lastModifiedTime
-homePhone
-homePostalAddress
-preferredName
+++ /dev/null
-#if !defined(lint)
-static char copyright[] = "Copyright 1992 The University of Adelaide";
-#endif
-
-/*
- * U T I L
- *
- * Author: Mark R. Prior
- * Communications and Systems Branch
- * Information Technology Division
- * The University of Adelaide
- * E-mail: mrp@itd.adelaide.edu.au
- * Date: November 1992
- * Version: 1.7
- * Description:
- * Some routines that I use in most my LDAP playthings :-)
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of Adelaide. The name of the University may not
- * be used to endorse or promote products derived from this software\
- * without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "portable.h"
-
-#include <stdio.h>
-#include <signal.h>
-#include <ctype.h>
-#if defined(SYS5) || defined(XOS_2)
-#include <termio.h>
-#else
-#include <sgtty.h>
-#endif
-#include <time.h>
-#if defined(INTERNATIONAL)
-#include <langinfo.h>
-#include <locale.h>
-#endif
-#include <ac/unistd.h>
-
-static void handler(int sig);
-
-char *
-lowerCase( char *string )
-{
- char *s;
-
- for ( s = string; s != NULL && *s != '\0'; s++ )
- if ( isupper( (unsigned char) *s ) )
- *s = tolower( (unsigned char) *s );
- return string;
-}
-
-char *
-convertTime( char *date, char *locale )
-{
- /*
- * A quick hack to convert the time from the format Quipu uses into
- * a more normal representation.
- */
- struct tm *tm;
- time_t time;
- static char result[BUFSIZ];
- int UTCOffset;
-
- /*
- * Get local timezone information, we need to apply this to the
- * zulu time that Quipu uses later.
- */
- time = 0;
- tm = localtime(&time);
- UTCOffset = tm->tm_gmtoff;
- sscanf( date, "%2d%2d%2d%2d%2d%2dZ",
- &tm->tm_year, &tm->tm_mon, &tm->tm_mday,
- &tm->tm_hour, &tm->tm_min, &tm->tm_sec );
- tm->tm_mon--;
- tm->tm_isdst = 0;
- tm->tm_gmtoff = 0;
- time = mktime(tm);
- time += UTCOffset;
- tm = localtime(&time);
-#if defined(INTERNATIONAL)
- setlocale(LC_TIME, locale);
- strftime(result, sizeof(result), nl_langinfo(D_T_FMT), tm);
-#else
- strftime(result, sizeof(result), "%c", tm);
-#endif
- return result;
-}
-
-static long interrupt;
-
-char *
-getPassword( char *prompt )
-{
-#if defined(SYS5) || defined(XOS_2)
- struct termios ttyb;
-#else
- struct sgttyb ttyb;
-#endif
- FILE *input;
- struct sigvec ovec, vec;
- unsigned long flags;
- int c, idx;
- static char buffer[BUFSIZ + 1];
-
- if ( ( input = fopen( "/dev/tty", "r" ) ) == NULL )
- input = stdin;
- else
- setbuf( input, (char *) NULL );
- vec.sv_handler = handler;
- vec.sv_mask = 0;
- vec.sv_flags = SV_INTERRUPT;
- sigvec( SIGINT, &vec, &ovec );
- interrupt = 0;
-#if defined(SYS5) || defined(XOS_2)
- ioctl( fileno( input ), TCGETS, &ttyb );
- flags = ttyb.c_lflag;
- ttyb.c_lflags &= ~ ( ECHO | ECHOE | ECHOK | ECHONL );
- ioctl( fileno( input ), TCSETSF, &ttyb );
-#else
- ioctl( fileno( input ), TIOCGETP, &ttyb );
- flags = ttyb.sg_flags;
- ttyb.sg_flags &= ~ ECHO;
- ioctl( fileno( input ), TIOCSETN, &ttyb );
-#endif
- fputs( prompt, stderr );
- idx = 0;
- while ( !interrupt && ( c = getc( input ) ) != EOF ) {
- if ( c == '\n' || c == '\r' )
- break;
- if ( idx < BUFSIZ )
- buffer[idx++] = c;
- }
- if ( interrupt )
- buffer[0] = '\0';
- else
- buffer[idx] = '\0';
-#if defined(SYS5) || defined(XOS_2)
- ttyb.c_lflag = flags;
- ioctl( fileno( input ), TCSETSW, &ttyb );
-#else
- ttyb.sg_flags = flags;
- ioctl( fileno( input ), TIOCSETN, &ttyb );
-#endif
- putc( '\n', stderr );
- sigvec( SIGINT, &ovec, (struct sigvec *) NULL );
- if ( input != stdin )
- fclose( input );
- if ( interrupt )
- kill( getpid(), SIGINT );
- return buffer;
-}
-
-static void
-handler( int sig )
-{
- ++interrupt;
-}
+++ /dev/null
-#if !defined(lint)
-static char copyright[] = "Copyright 1992 The University of Adelaide";
-#endif
-
-/*
- * V E R S I O N
- *
- * Author: Mark R. Prior
- * Communications and Systems Branch
- * Information Technology Division
- * The University of Adelaide
- * E-mail: mrp@itd.adelaide.edu.au
- * Date: October 1992
- * Version: 1.7
- * Description:
- * Provide a minor revision number
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of Adelaide. The name of the University may not
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-char *version( void )
-{
- return "1.7";
-}
+++ /dev/null
-#if !defined(lint)
-static char copyright[] = "Copyright 1992 The University of Adelaide";
-#endif
-
-/*
- * W H O I S + +
- *
- * Author: Mark R. Prior
- * Communications and Systems Branch
- * Information Technology Division
- * The University of Adelaide
- * E-mail: mrp@itd.adelaide.edu.au
- * Date: October 1992
- * Version: 1.7
- * Description:
- * This is an experimental implementation of the proposed IETF
- * WNILS WG update to the whois/nicname protocol (whois++).
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of Adelaide. The name of the University may not
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "whois++.h"
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-static initialise();
-
-main( argc, argv )
-int argc;
-char **argv;
-{
- FILE *tailorFile, *bannerFile;
- char tailor[MAXPATHLEN];
- char query[BUFSIZ], buffer[BUFSIZ];
- char *s, *hostname, *remote;
- char **info;
- int i, printInfo = FALSE;
- extern char *optarg;
- LDAP *ld;
- LDAPMessage *result, *entry;
- int timelimit = DEFAULT_TIMELIMIT;
- struct hostent *hp;
- static struct sockaddr sa;
- struct sockaddr_in *sin = (struct sockaddr_in *) (&sa);
- /* #### length should be socklen_t when we include portable.h #### */
- int length = sizeof(sa);
- static char options[] = "[-b searchbase] [-d debug ] \
-[-h ldaphost ] [-i] [-l] [-s sizelimit] [-t timelimit] [-T tailorfile ] \
-[-u user] [-v]";
- static char *attributes[] =
- { "businessCategory", "info", NULL };
-
- if ( (program = strrchr( argv[0], '/' )) == NULL )
- program = strdup( argv[0] );
- else
- program = strdup( program + 1 );
-
-#if defined(LOG_DAEMON)
- openlog(program, LOG_PID, FACILITY );
-#else
- openlog(program, LOG_PID );
-#endif
-
- initialise();
-
- sprintf( tailor, "%s/%stailor", ETCDIR, program );
- if ( (tailorFile = fopen( tailor, "r" )) != NULL ) {
- readConfiguration( tailorFile );
- fclose( tailorFile );
- }
-
- while ( (i = getopt( argc, argv, "b:d:h:ils:t:T:u:v?" )) != EOF ) {
- switch ( i ) {
- case 'b': /* search base */
- base = strdup( optarg );
- break;
-
- case 'd': /* debug */
- debug = atoi( optarg );
- break;
-
- case 'h': /* ldap host */
- ldaphost = strdup( optarg );
- break;
-
- case 'i': /* print info attribute */
- printInfo = TRUE;
- break;
-
- case 'l': /* enable logging via syslog */
- log = TRUE;
- break;
-
- case 's': /* size limit */
- if ( ( maxHits = atoi( optarg ) ) < 1 ) {
- fprintf( stderr, "%s: Invalid maxhits value\n",
- program );
- syslog( LOG_ERR, "Invalid maxhits value" );
- exit( 1 );
- }
- maximumSize = maxHits;
- break;
-
- case 't': /* time limit */
- timelimit = atoi( optarg );
- break;
-
- case 'T': /* tailor file */
- if ( (tailorFile = fopen( optarg, "r" )) != NULL ) {
- readConfiguration( tailorFile );
- fclose( tailorFile );
- } else {
- perror( program );
- exit( 1 );
- }
- break;
-
- case 'u': /* user to bind as */
- user = strdup( optarg );
- break;
-
- case 'v': /* version */
- fprintf( stderr, "%s: %s %d.%s\n",
- program, RELEASE, REVISION, version() );
- exit( 0 );
-
- default: /* usage message, don't "fail" if ? */
- fprintf( stderr, "usage: %s %s\n", program, options );
- exit( i != '?' );
- }
- }
-
- language = defaultLanguage;
-
- /*
- * We can cope without knowing most things but we do need to know
- * where to start looking!
- */
- if ( base == NULL ) {
- syslog( LOG_ERR, "No base specified" );
- fprintf( stderr, "%s: No base specified.\n", program );
- exit( 1 );
- }
-
- if ( ! debug ) {
- if ( getpeername(0, &sa, &length) < 0) {
- perror( "getpeername" );
- exit( 1 );
- }
- if ( log ) {
- if ( ( hp = gethostbyaddr((char *) &sin->sin_addr,
- sizeof(sin->sin_addr), AF_INET) ) != 0 ) {
- hostname = strdup( hp->h_name );
- if ( ( hp = gethostbyname( hostname ) ) == 0 ) {
- free( hostname );
- hostname = strdup( inet_ntoa(sin->sin_addr) );
- }
- } else
- hostname = strdup( inet_ntoa(sin->sin_addr) );
-#if defined(RFC931)
- remote = rfc931_name( sin );
-#else
- remote = NULL;
-#endif
- syslog( LOG_INFO, "Connection from %s%s%s [%s]",
- (remote)?remote:"", (remote)?"@":"",
- hostname, inet_ntoa(sin->sin_addr) );
- }
- }
-
- if ( (ld = ldap_init( ldaphost, LDAP_PORT )) == NULL ) {
- printFormatted( lineLength, TRUE, stdout,
- "Connection to LDAP port on %s has failed", ldaphost );
- syslog( LOG_ERR, "Initialization of LDAP session (%s)",
- ldaphost );
- exit( 1 );
- }
- ld->ld_timelimit = timelimit;
- ld->ld_sizelimit = maxHits;
- ld->ld_deref = LDAP_DEREF_FINDING;
-
- ldap_simple_bind_s( ld, user, password );
- switch ( ld->ld_errno ) {
- case LDAP_SUCCESS:
- break;
-
- default:
- printFormatted( lineLength, TRUE, stdout,
- "Bind to Directory failed, %s",
- ldap_err2string( ld->ld_errno ) );
- syslog( LOG_ERR, "Bind to Directory failed, %s",
- ldap_err2string( ld->ld_errno ) );
- exit( 1 );
-
- }
-
- ldap_search_s( ld, base, LDAP_SCOPE_BASE, "objectclass=*",
- attributes, 0, &result );
- if ( ld->ld_errno != LDAP_SUCCESS ) {
- printFormatted( lineLength, TRUE, stdout,
- "Read of entry \"%s\" failed, %s",
- base, ldap_err2string( ld->ld_errno ) );
- exit( 1 );
- }
- entry = ldap_first_entry( ld, result );
- organisation = ldap_dn2ufn( ldap_get_dn( ld, entry ) );
- category = ldap_get_values( ld, entry, "businessCategory" );
-
- printFormatted( lineLength, FALSE, stdout,
- "Whois++ Service at %s.", ldap_dn2ufn( base ) );
- printFormatted( lineLength, FALSE, stdout,
- "For more information about this service send the \"help\" command." );
-
- if ( printInfo && ( info = ldap_get_values( ld, entry, "info" ) ) != NULL ) {
- for ( i = 0; info[i] != NULL; i++ ) {
- printFormatted( lineLength, FALSE, stdout, "" );
- printFormatted( lineLength, TRUE, stdout,
- "%s", info[i] );
- }
- ldap_value_free( info );
- }
- if ( banner != NULL && ( bannerFile = fopen( banner, "r" ) ) != NULL ) {
- printFormatted( lineLength, FALSE, stdout, "" );
- while ( fgets( buffer, BUFSIZ, bannerFile ) != NULL ) {
- i = strlen( buffer );
- while ( i-- > 0 && ( buffer[i] == '\n' || buffer[i] == '\r' ) )
- buffer[i] = '\0';
- printFormatted( lineLength, TRUE, stdout, "%s", buffer );
- }
- fclose( bannerFile );
- }
- printFormatted( lineLength, FALSE, stdout, "" );
-
- do {
- *query = '\0';
- holdConnection = FALSE;
- switch ( parseCommand( query ) ) {
- case READ:
- /* No need to search, just read the entry given! */
- ldap_search_s( ld, query, LDAP_SCOPE_BASE,
- "objectclass=*", NULL, 0, &result );
- switch( ld->ld_errno ) {
- case LDAP_SUCCESS:
- break;
-
- case LDAP_NO_SUCH_OBJECT:
-/**/ /* PROBABLY WANT SPECIAL PROCESSING HERE */
-
- default:
- printFormatted( lineLength, TRUE, stdout,
- "Read failed, %s",
- ldap_err2string( ld->ld_errno ) );
- return 1;
-
- }
- displayResult( ld, result, outputFormat );
- break;
-
- case SEARCH:
- if ( debug > 2 )
- fprintf( stderr, "LDAP Query %s\n", query );
- if ( log )
- syslog( LOG_INFO, "LDAP Query %s", query );
-
- ld->ld_sizelimit = maxHits;
- ldap_search_s( ld, base, LDAP_SCOPE_SUBTREE, query,
- NULL, 0, &result );
- switch ( ld->ld_errno ) {
- case LDAP_SUCCESS:
- break;
-
- case LDAP_SIZELIMIT_EXCEEDED:
- printFormatted( lineLength, TRUE, stdout,
- "Partial results only - a size limit \
-was exceeded, only %d entries returned", ldap_count_entries( ld, result ) );
- break;
-
- case LDAP_TIMELIMIT_EXCEEDED:
- printFormatted( lineLength, TRUE, stdout,
- "Partial results only - a time limit \
-was exceeded." );
- break;
-
- default:
- printFormatted( lineLength, TRUE, stdout,
- "Search failed, %s",
- ldap_err2string( ld->ld_errno ) );
- exit( 1 );
-
- }
- displayResult( ld, result, outputFormat );
- break;
-
- case HELP:
- needHelp( lowerCase( query ) );
- break;
-
- case DESCRIBE:
- displayDescribe( ld, base );
- break;
-
- case VERSION:
- printFormatted( lineLength, TRUE, stdout,
- "Whois++ Protocol version %s", PROTOCOL );
- printFormatted( lineLength, TRUE, stdout,
- "Program version %s %d.%s",
- RELEASE, REVISION, version() );
- printFormatted( lineLength, TRUE, stdout,
- "Default language is %s", defaultLanguage );
- printFormatted( lineLength, TRUE, stdout,
- "Built by %s", BUILD );
- break;
-
- case LIST:
- listTemplates( lowerCase( query ) );
- break;
-
- case SHOW:
- showTemplate( lowerCase( query ) );
- break;
-
- case CONSTRAINTS:
- printFormatted( lineLength, TRUE, stdout,
- "This implementation supports the following constraints." );
- printFormatted( lineLength, TRUE, stdout,
- "Local constraints are" );
- printFormatted( lineLength, TRUE, stdout,
- " match=(exact|fuzzy)" );
- printFormatted( lineLength, TRUE, stdout,
- "Global constraints are" );
- printFormatted( lineLength, TRUE, stdout,
- " format=(full|abridged|handle|summary)" );
- printFormatted( lineLength, TRUE, stdout,
- " hold" );
- printFormatted( lineLength, TRUE, stdout,
- " language=<string>" );
- printFormatted( lineLength, TRUE, stdout,
- " linelength=<number>" );
- printFormatted( lineLength, TRUE, stdout,
- " maxhits=<number>" );
- break;
-
- case COMMAND:
- printFormatted( lineLength, TRUE, stdout,
- "Commands supported by this implementation are" );
- printFormatted( lineLength, TRUE, stdout,
- " command" );
- printFormatted( lineLength, TRUE, stdout,
- " constraints" );
- printFormatted( lineLength, TRUE, stdout,
- " describe" );
- printFormatted( lineLength, TRUE, stdout,
- " help" );
- printFormatted( lineLength, TRUE, stdout,
- " list" );
- printFormatted( lineLength, TRUE, stdout,
- " show" );
- printFormatted( lineLength, TRUE, stdout,
- " version" );
- break;
-
- case ERROR:
- break;
-
- }
- } while ( holdConnection );
- closelog();
- ldap_unbind( ld );
-}
-
-static initialise()
-
-{
- char buffer[BUFSIZ];
-
- debug = FALSE;
- maxHits = DEFAULT_SIZELIMIT;
- maximumSize = maxHits;
- outputFormat = NULL;
- lineLength = DEFAULT_LINE_LENGTH;
- ldaphost = DEFAULT_LDAPHOST;
- defaultLanguage = DEFAULT_LANGUAGE;
- locale = "";
- base = NULL;
- contact = NULL;
- if ( gethostname( buffer, BUFSIZ ) == 0 )
- hostname = strdup( buffer );
- else
- hostname = NULL;
- user = NULL;
- password = NULL;
- helpDir = HELP_DIRECTORY;
- configDir = CONFIG_DIRECTORY;
- organisation = NULL;
- banner = NULL;
- log = FALSE;
- numberOfTemplates = 0;
- tableSize = TABLE_INCREMENT;
- templateTranslationTable = NULL;
-}
+++ /dev/null
-/*
- * W H O I S + +
- *
- * Author: Mark R. Prior
- * Communications and Systems Branch
- * Information Technology Division
- * The University of Adelaide
- * E-mail: mrp@itd.adelaide.edu.au
- * Date: October 1992
- * Copyright: (C) 1992, The University of Adelaide
- * Version: 1.7
- * Description:
- * This is an experimental implementation of the proposed IETF
- * WNILS WG update to the whois/nicname protocol (whois++).
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of Adelaide. The name of the University may not
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <dirent.h>
-#if defined(INTERNATIONAL)
-#include <langinfo.h>
-#include <locale.h>
-#include <nl_types.h>
-#endif
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <netinet/in.h>
-#include "syslog.h"
-#include <ldap.h>
-
-#define EQ(x,y) (strcasecmp(x,y) == 0)
-
-#if defined(sun)
-extern int sys_nerr;
-extern char *sys_errlist[];
-#define strerror(_e) ( ( ( (_e) >= 0 ) && ( (_e) < sys_nerr ) ) ? \
- sys_errlist[(_e)] : "Undocumented error code" )
-#endif
-
-#if !defined(TRUE)
-#define TRUE 1
-#define FALSE 0
-#endif
-
-#if defined(MAIN)
-#define EXTERN
-#else
-#define EXTERN extern
-#endif
-
-#if !defined(ABRIDGED_LIMIT)
-#define ABRIDGED_LIMIT 10
-#endif
-#if !defined(DEFAULT_LDAPHOST)
-#define DEFAULT_LDAPHOST "localhost"
-#endif
-#if !defined(DEFAULT_SIZELIMIT)
-#define DEFAULT_SIZELIMIT 50
-#endif
-#if !defined(DEFAULT_TIMELIMIT)
-#define DEFAULT_TIMELIMIT 60
-#endif
-#if !defined(HELP_DIRECTORY)
-#define HELP_DIRECTORY "/usr/local/isode/help/whois++"
-#endif
-#if !defined(CONFIG_DIRECTORY)
-#define CONFIG_DIRECTORY "/usr/local/isode/etc/whois++"
-#endif
-#if !defined(DEFAULT_LANGUAGE)
-#define DEFAULT_LANGUAGE "english"
-#endif
-
-#define ATTRIBUTE_INCREMENT 10
-#define TABLE_INCREMENT 10
-#define DEFAULT_LINE_LENGTH 80
-#define MIN_LINE_LENGTH 40
-#define MAX_LINE_LENGTH 200
-
-/*
- * Tokens
- */
-#define HELP 1
-#define LIST 2
-#define DESCRIBE 3
-#define VERSION 4
-#define SHOW 5
-#define CONSTRAINTS 6
-#define SEARCH 7
-#define TEMPLATE 8
-#define HANDLE 9
-#define ATTRIBUTE 10
-#define VALUE 11
-#define SEARCH_ALL 12
-#define COMMA 13
-#define ERROR 14
-#define EQUALS 15
-#define COLON 16
-#define SEMICOLON 17
-#define FULL 18
-#define ABRIDGED 19
-#define SUMMARY 20
-#define READ 21
-#define LANGUAGE 22
-#define FORMAT 23
-#define HOLD 24
-#define MAXHITS 25
-#define MATCH 26
-#define LINE_LENGTH 27
-#define COMMAND 28
-#define TRACE 29
-
-typedef struct {
- char *key;
- char *value;
- } table;
-
-EXTERN int debug, outputFormat, lineLength, holdConnection, log;
-EXTERN int maxHits, numberOfTemplates, tableSize, maximumSize;
-EXTERN char *program, *ldaphost, *language, *locale, *base;
-EXTERN char *contact, *hostname, *user, *password, *helpDir;
-EXTERN char *configDir, *organisation, *defaultLanguage;
-EXTERN char *banner;
-EXTERN char **category;
-EXTERN table *templateTranslationTable;
-
-extern int displayDescribe(), parseCommand(char *query);
-extern void needHelp(char *reason);
-extern void showTemplate(char *template), listTemplates(char *query);
-extern char **specifyAttributes(char *objectClass);
-extern char *lowerCase(char *string), *version(void), *attributeLabel();
-extern char *rfc931_name();
-extern char *templateToObjectClass(char *template);
+++ /dev/null
-.\" Copyright (c) 1993 The University of Adelaide.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms are permitted
-.\" provided that the above copyright notice and this paragraph are
-.\" duplicated in all such forms and that any documentation,
-.\" advertising materials, and other materials related to such
-.\" distribution and use acknowledge that the software was developed
-.\" by the University of Adelaide. The name of the University may not
-.\" be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-.\"
-.\" @(#)whois++d.man 1.5
-.\"
-.TH WHOIS++D 8 "26 April 1993"
-.SH NAME
-whois++d \- Whois++ white pages server
-.SH SYNOPSIS
-.B whois++d
-[
-.B \-b
-.I basename
-] [
-.B \-d
-.I debuglevel
-] [
-.B \-h
-.I ldaphost
-] [
-.B \-i
-] [
-.B \-l
-] [
-.B \-s
-.I maxhits
-] [
-.B \-t
-.I timelimit
-] [
-.B \-T
-.I tailorfile
-] [
-.B \-u
-.I user
-] [
-.B \-v
-] [
-.B \-?
-]
-.SH DESCRIPTION
-.I Whois++d
-is an implementation of the new whois++ white pages server. The server is in
-reality a DUA interface that uses the lightweight directory access protocol
-[RFC????] to communicate with an X.500 Directory System Agent (DSA) via a
-.MS ldapd 8
-server. The whois++ architecture (and command format) is described in an
-Internet Draft of the IETF's WNILS Working Group.
-
-By default
-.I whois++d
-reads it's configuration information from a tailor file (whois++dtailor)
-located in the
-.IR ETCDIR
-but this may be supplemented by command line options, including the
-specification of a secondary tailor file.
-.PP
-Options are:
-.TP
-.B \-b
-Specify the base for all queries, this must be specified either via the
-commandline or (more normally) via the tailor file.
-.TP
-.B \-d
-Print debugging information.
-A number after the ``d'' determines the level of messages printed.
-.TP
-.B \-h
-Specify the host running the
-.MS ldapd 8
-server.
-.TP
-.B \-i
-If the entry for the ``base'' of the searches has an info attribute then
-print it as part of the welcome banner.
-.TP
-.B \-l
-Enable logging of queries via syslog.
-.TP
-.B \-s
-Specify the maximum number of entries you wish returned as a result of a
-search. This is normally controlled by the DSA but if this is not possible
-then it can be restricted via this option.
-.TP
-.B \-t
-Specify a timelimit for queries to the DSA. Note this is
-.B not
-the timeout limit between queries when using the
-.I hold
-constraint.
-.TP
-.B \-T
-Specify an additional tailor file. Useful if you only have a binary and the
-default location is not what you consider to be a ``normal'' place.
-.TP
-.B \-u
-Specify the user's DN to use when binding to the directory.
-.TP
-.B \-v
-Return the version number of this server and then exit.
-.TP
-.B \-?
-Print a list of valid commandline options and then exit.
-.SH "CONFIGURATION FILE"
-When started
-.B whois++d
-reads it's configuration file before processing any command line options.
-The configuration commands that may be included in this tailor file are
-.IP banner
-Specify a file to display as a welcome message.
-.IP base
-This specifies the entry within the DIT where searches will commence. This is
-normally set to the organisation's entry.
-.IP configdir
-Identifies where the configuration files may be found, currently only used
-for the template descriptions.
-.IP contact
-This is the distinguished name of the person responsible for this service, and
-whose entry will be displayed if the client uses the `describe' query. If this
-is not defined in the configuration file it defaults to the DSA manager.
-.IP helpdir
-This directory contains the multi-lingual help files. There should be a
-subdirectory for each language supported and within these subdirectories
-are helpfiles that are displayed by the server. At a minimum there should be
-an english directory containing a `general' helpfile (which contains
-introductory information).
-.IP hostname
-Used when the server is queried using the `describe' command. If not specified
-it will default to the local hostname.
-.IP language
-Specify the default language to be used when producing diagnostic messages.
-.IP ldaphost
-This specifies the host running a ldap server which can be used to communicate
-with the X.500 DSA.
-.IP password
-The password to use then binding to the X.500 DSA.
-.IP template
-The whois++ template name is not always the same as the X.500 object class
-so this option allows the two values to be associated with each other. The
-two values are template-name and objectclass-name.
-.IP user
-The LDAP distinguished name of the user to use when binding to the directory.
-This is optional but the DSA may restrict the information available to the
-whois++ server unless it authenticates itself.
-.NT
-Multi-lingual support is not available yet.
-.SH FILES
-ETCDIR/whois++dtailor whois++ server tailor file
-.SH "SEE ALSO"
-ldapd(8)
+++ /dev/null
-base "o=The University of Adelaide, c=AU"
-template user person
-template service applicationEntity
-template department organizationalUnit
-template role organizationalRole