The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

tklkup - A script to do LDAP directory lookups and displaying directory schema information.

SYNOPSIS

This script is used to lookup information from a LDAP directory server. It is GUI based with several buttons for selecting directory servers, search bases, attributes and for enabling the Directory Schema Search window.

This script has been tested on Solaris, RedHat 6.0 Linux, and Mandrake 6.5 but should work with any system that has PERL and the required modules installed in it.

There are 2 files associated with the tklkup program in this tar file; dot.tklkup, and tklkup.

About the files.

dot.tklkup

dot.tklkup - This is the initialization file that should be put into each users home directory as .tklkup.

This file will have to be setup properly before the user can expect the tklkup script to work properly. The odds of this initialization file being setup correctly for anyone is ZERO. However the script can be run with this file to get a feel for how the script will look.

It allows the user to customize how tklkup will look and work for them. If the .tklkup files does not exist in a users home directory the program has a set of built-in defaults that it will use.

To be used this file must have user read permission.

There are 5 commands that can be used with this file; hand, attribute, server, limit, and port.

 hand -> values: left or right.  Defines where the 
                 attribute label box will be place.

 limit -> value: default is 30.  Limits the number of 
                 search base(s) detected.

 port -> value: default is 389.  User should set this
                 to match their needs.

 attribute -> attribute upon which the data search will be
              based.  One attribute per line.

 server -> name of the directory server that you wish
           to conduct the data search. 
           One server per line.
           Each line can have one of two formats
           server: server name
                  or
           server: server name: base 

           The I<server: server name> format will try to use the 
           root_dse function to define the base.
           It the root_dse returns the namingContexts attribute,
           that information will be use to determine the search
           base(s).
           If the root_dse returns undefined or has no namingContexts
           attribute, a null string will be the search base.
           In this case the user will have to define a search base
           in the server command of the .tklkup file.

           The I<server: server name: base> format will 
           cause each of the defined servers to have it's 
           own special initial search base and use this initial
           search base to find all of the other search bases.
           This is an attempt to do auto search base detection.
           Using this method has one I<draw back>, when changing
           to a different directory server there is a possible
           I<delay> on displaying the new server name and 
           search base.  This is due to the fact that TK and 
           it's MainLoop() process are not multi-tasking.
           The new search base has to be accquired and setup before 
           MainLoop() takes control of the process.
           Depending on the number of search bases this time period
           can be quite a few seconds.  

           When switching between servers with the same base, the 
           search base will I<not> be updated.  This too can have 
           a I<draw back> if there are new search bases in the 
           new server but it saves time.

           None of this is a problem if all of your servers have 
           the same DIT layouts. Just define them with the 
           same search base, there should be little or no delay
           when switching to the new server.          
           
 Now a word about directory branch, or search base, detection.  There 
 are many things that can prevent this function from working properly. 
 Several version 2 LDAP servers that this was tested on required 
 that you be bound to the server.
 None of the version 3 LDAP servers required this. 
 If this function does not work for you, provide a bind DN and 
 password.  The normal mode of operation for this function is an 
 anonymous bind situation. 
 Some of the ldap servers I worked with would never return the 
 information I expected, auto detection never functioned on these
 systems.
 There is one college ldap server on the internet that has so 
 many bases that it takes over an hour to figure out all the 
 search bases.  The only way the operator knows that the 
 script is still working is because search limit exceeded messages
 are displayed on the console that initiated the tklkup script.
 Who wants to wait a hour while the script figures this out.
 
 If you decide to use auto search base detection you will just have
 to try it and hope it works.

tklkup

tklkup - PERL executable file.

You may need to change the first line of the PERL tklkup script to point to your file pathname of perl.

When executed tklkup will display a window on your computer. The graphical user interface, GUI, has several sections to it.

Exit button. At the top of the GUI is the "Exit" button. When a mouse click is done on the "Exit" button the program will terminate.

The SET LDAP VERSION "RadioButton" diamond will select the LDAP protocol version. When selected the "RadioButton" diamond will be red in color. This indicates that the ldap connection will use the version 3 protocol. To use ldap version 2 protocol press the "RadioButton" diamond so that it becomes a gray color.

The SELECT SERVER button will activate a drop down menu. From the menu the user will select the "RadioButton" that corresponds to the directory server the user wishes to use. When selected the "RadioButton" diamond will turn red in color. This menu is a designed to be a "tear off" menu, selecting the "---------------" line will cause the pull down menu to become a separate window that is still somewhat controlled by the GUI. The DIRECTORY SERVER text box will display the directory name that is selected. If the GUI is icon-ed or exited, the tear off window will follow the actions of the GUI. All other actions like moving or closing just the torn off window must be done by the user's window manager.

The BIND TO DIRECTORY button will activate a window that is separate from the main window.

The new window contains two buttons and two text boxs. For security reasons nothing is initially displayed in the text boxes. Pressing the accept button with this setup will cause the bind DN and password to be set to null strings.

At the top of the window is a Cancel button, pressing this button will cancel the operation of setting the bind DN and password.

The DN text box is where the user will enter the DN to bind with.

The PASSWORD text box is where the user will enter the password for the DN. Star "*" will be shown for the characters as they are typed into the text box.

At the bottom of the window is the Accept button, pressing this button will set the bind DN and the password.

The SELECT BASE button will activate a drop down menu. From the menu the user will select the "RadioButton" that corresponds to the search base the user wishes to use in the directory search. When selected the "RadioButton" diamond will turn red in color. The DIRECTORY SEARCH BASE text box will display the directory search base that is selected. This menu is a designed to be a "tear off" menu, selecting the "---------------" line will cause the pull down menu to become a separate window that is still somewhat controlled by the GUI. If the GUI is icon-ed or exited, the tear off window will follow the actions of the GUI. All other actions like moving or closing just the torn off window must be done by the user's window manager.

The SELECT ADDITIONAL ATTRIBUTES button will activate a drop down menu. From the menu the user will select the "RadioButton" that corresponds to the attribute the user wishes to use in the directory search. When selected the "RadioButton" diamond will turn red in color. This menu is a designed to be a "tear off" menu, selecting the "---------------" line will cause the pull down menu to become a separate window that is still somewhat controlled by the GUI. If the GUI is icon-ed or exited, the tear off window will follow the actions of the GUI. All other actions like moving or closing just the torn off window must be done by the user's window manager.

The CLEAR ATTRIBUTE DATA button will clear out the text that appears in the Attribute Data text box.

The ATTRIBUTE DATA text box is where the user will enter the data to be searched for.

The DIRECTORY PORT button will activate a window that is separate from the main window.

The new window contains two buttons and one text box. If the user needs to change the TCP connection port, this is where it is done.

At the top of the window is a Cancel button, pressing this button will cancel the operation of setting the port number.

The text box is where the user will enter the port number to connect. Display in the text box is the current port number.

At the bottom of the window is the Accept button, pressing this button will set the port number.

The EXPLORE DIRECTORY SCHEMA button will activate the Directory Schema Search Window. For information about this window see the Schema section of the manual.

SEARCH button. At the bottom of the GUI is the "Search" button. When a mouse click is done on the "Search" button the program will execute a ldap search.

-------------------------------------------------------------------

Display Search Results

When the SEARCH DIRECTORY button is pressed the Display Search Results window will be displayed.

At the top of the window is the Close Display Search Result Window button. Pressing the button will

At the top of the GUI is the "Close Display Search Result Window" button. When a mouse click is done on the "Close Display Search Result Window" button the Display Search Result window will be withdrawn. The window is not distroyed, it just made invisiable and disabled.

The Display Search Result window can be destroyed by enabling the proper window manager destroy function.

The Directory Data text box is where the results of the directory search will be displayed. With the cursor in the Directory Data text box you have access to additional functions when you depress the mouse "action" button. When the "action" mouse button is depressed a small text box with 4 additional functions will be displayed inside the Directory Data text box. These 4 functions are;

 File -> This function exits the program.  You can not edit
         the Directory Data text box because it is created 
         as a read only text box.

 Edit -> This function gives the user 3 additional functions;
         Copy -> I do not know what this function does.
         Select All -> Highlights/Selects all of the text in
         the Directory Data text box.
         Unselect All -> Unselects all of the text in 
         the Directory Data text box.
         Select/Unselect are used in-conjunction with the 
         Copy function.

 Search -> This function gives the user 4 additional
         functions.
         Find, Find Next, Find Previous -> These functions
         find text in the Directory Data text box.
         Replace -> This function allows you to replace the
         text that is selected.  However this is just 
         a fake replacement as you can not edit the 
         Directory Data text box because it is created 
         as a read only text box.

 View -> This function gives the user 3 additional 
         functions.
         Goto Line ->  When selected will prompt the
         user for a line number, the line number being
         the line number the user wishes to see.
         What Line ->  When selected will tell the user
         what line number the cursor is on.
         Wrap ->  When selected will prompt the user
         to choose how to do line wrapping in the 
         Directory Data text box.
  

Associated with the Directory Data text box is the "RadioButton" that determines how often the data in the directory text box is cleared. If the "CheckButton" is selected, colored red, the directory data text box will be cleared out before each directory query. If the "CheckButton" is not selected the directory data text box will NOT be cleared out until the Clear Data button in clicked or the CLEAR DIRECTORY DATA ON EACH QUERY "RadioButton" is selected.

The CLEAR DATA button will clear out the text that appears in the Directory Data text box.

-------------------------------------------------------------------

Schema Window.

Directory Schema Search Window

This function is used to lookup schema information from a LDAP directory server. The directory server to be searched is selected from the Directory Search window.

Directory Schema Search Window Operation

When the Explore Directory Schema button is pressed in the Directory Search window, the Directory Schema Search window will be displayed on your computer. The graphical user interface, GUI, has several sections to it.

At the top of the GUI is the "Close Schema Search Window" button. When a mouse click is done on the "Close Schema Search Window" button the schema window will be withdraw. The window is not distroyed, it just made invisiable and disabled.

The Directory Schema Search window can be destroyed by enabling the proper window manager destroy function.

When the Write Data To File RadioButton is selected the LDAP Schema data will be written to the file listed in the text box below the RadioButton text. Once the data has been written to the file a message will be written to the DIRECTORY SCHEMA DATA text box stating that the data has been written to a file and will list the file name. Upon completion of the schema dump operation the RadioButton and text in the file name text box will be reset.

Associated with the Directory Schema Data text box is the "CheckButton" that determines how often the data in the directory text box is cleared. If the "CheckButton" is selected, colored red, the directory data text box will be cleared out before each directory query. If the "CheckButton" is not selected the directory data text box will NOT be cleared out until the Clear Data button in clicked or the CLEAR DIRECTORY DATA ON EACH QUERY "CheckButton" is selected. By default the CheckButton is select to clear out the data in the Directory Schema Data text box on each query.

Associated with the Directory Schema Data text box is a series of "CheckButtons" that determines what of the schema objects will be displayed. There are 4 Checkbuttons; ALL, objectClass, matchingRules, and attributeTypes. If the "CheckButton" is selected, colored red, then schema objects of that type will be displayed in the Directory Schema Data text box. If the "CheckButton" is not selected, gray in color, then schema objects of this type will not be displayed in the Directory Schema Data text box. By default the ALL CheckButton is select.

The Directory Schema Data text box is where the results of the directory search will be displayed. With the cursor in the Directory Data text box you have access to additional functions when you depress the mouse "action" button. When the "action" mouse button is depressed a small text box with 4 additional functions will be displayed inside the Directory Data text box. These 4 functions are;

 File -> This function exits the program.  You can not edit
         the Directory Data text box because it is created 
         as a read only text box.

 Edit -> This function gives the user 3 additional functions;
         Copy -> I do not know what this function does.
         Select All -> Highlights/Selects all of the text in
         the Directory Data text box.
         Unselect All -> Unselects all of the text in 
         the Directory Data text box.
         Select/Unselect are used in-conjunction with the 
         Copy function.

 Search -> This function gives the user 4 additional
         functions.
         Find, Find Next, Find Previous -> These functions
         find text in the Directory Data text box.
         Replace -> This function allows you to replace the
         text that is selected.  However this is just 
         a fake replacement as you can not edit the 
         Directory Data text box because it is created 
         as a read only text box.

 View -> This function gives the user 3 additional 
         functions.
         Goto Line ->  When selected will prompt the
         user for a line number, the line number being
         the line number the user wishes to see.
         What Line ->  When selected will tell the user
         what line number the cursor is on.
         Wrap ->  When selected will prompt the user
         to choose how to do line wrapping in the 
         Directory Data text box.
  

The Clear Data button will clear out the text that appears in the Directory Schema Data text box.

At the bottom of the GUI is the "Retrieve Directory Schema" button. When a mouse click is done on the "Retrieve Directory Schema" button the script will query the directory server for schema information.

-------------------------------------------------------------------

REQUIREMENTS

To use this program you will need the following.

At least PERL version 5.004. You can get a stable version of PERL from the following URl; http://cpan.org/src/index.html

Perl Tk800.015 module. You can get this from the following URl; ftp://ftp.duke.edu/pub/CPAN/modules/by-module/Tk/

Perl LDAP module. You can get this from the following URl; ftp://ftp.duke.edu/pub/CPAN/modules/by-module/Net/

Depending on the modules loaded in your PERL system, you may need to load the following 2 PERL modules.

Perl Convert-Berr module. You can get this from the following URl; ftp://ftp.duke.edu/pub/CPAN/modules/by-module/Convert/

Perl Digest-MD5 module. You can get this from the following URl; ftp://ftp.duke.edu/pub/CPAN/modules/by-module/MD5/

Bundled inside each PERL module is instructions on how to install the module into your PERL system.

-------------------------------------------------------------------

INSTALLING THE SCRIPT

Install the tklkup script anywhere you wish, I suggest /usr/local/bin/tklkup.

Install the dot.tklkup file in each users home directory as .tklkup. It is possible to use a central copy and create a link in the user home directory to the central copy.

-------------------------------------------------------------------

Since the script is in PERL, feel free to modify it if it does not meet your needs. This is one of the main reasons I did it in PERL. If you make an addition to the code that you feel other individuals could use let me know about it. I may incorporate your code into my code.

AUTHOR

Clif Harden <charden@pobox.com> If you find any errors in the code please let me know at charden@pobox.com.

COPYRIGHT

Copyright (c) 1999-2001 Clif Harden. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 2029:

=back doesn't take any parameters, but you said =back 4 -------------------------------------------------------------------