Diff for /servers/slapd/back-perl/SampleLDAP.pm between versions 1.4 and 1.5

version 1.4, 2002/04/16 01:47:39 version 1.5, 2002/04/29 18:24:30
Line 1 Line 1
   # This is a sample Perl module for the OpenLDAP server slapd.
 =head1 Introduction  #
   # $OpenLDAP$
 This is a sample Perl module for the OpenLDAP server slapd.  #
 It also contains the documentation that you will need to  # Usage: Add something this to slapd.conf:
 get up and going.  #
   #       database        perl
 WARNING: the interfaces of this backen to the perl module  #       suffix          "o=AnyOrg, c=US"
 MAY change.  Any suggestions would greatly be appreciated.  #       perlModulePath  /path/to/this/file
   #       perlModule      SampleLDAP
   
 =head1 Overview  
   
 The Perl back end works by embedding a Perl interpreter into  
 the slapd backend. Then when the configuration file indicates  
 that we are going to be using a Perl backend it will get an  
 option that tells it what module to use.  It then creates a   
 new Perl object that handles all the request for that particular  
 instance of the back end.  
   
   
 =head1 Interface  
   
 You will need to create a method for each one of the  
 following actions that you wish to handle.  
   
    * new        # Creates a new object.  
    * search     # Performs the ldap search  
    * compare    # does a compare  
    * modify     # modify's and entry  
    * add        # adds an entry to back end  
    * modrdn     # modifies a an entries rdn  
    * delete     # deletes an ldap entry  
    * config     # process unknown config file lines  
    * init       # called after backend is initialized  
   
 =head2 new  
   
 This method is called when the config file encounters a   
 B<perlmod> line. The module in that line is then effectively  
 used into the perl interpreter, then the new method is called  
 to create a new object.  Note that multiple instances of that  
 object may be instantiated, as with any perl object.  
   
 The new method doesn't receive any arguments other than the  
 class name.  
   
 RETURN:   
   
 =head2 search  
   
 This method is called when a search request comes from a client.  
 It arguments are as follow.  
   
   * obj reference  
   * base DN  
   * scope  
   * alias deferencing policy  
   * size limit  
   * time limit  
   * filter string  
   * attributes only flag ( 1 for yes )  
   * list of attributes that are to be returned. (could be empty)  
   
 RETURN:  
   
 =head2 compare  
   
 This method is called when a compare request comes from a client.  
 Its arguments are as follows.  
   
   * obj reference  
   * dn  
   * attribute assertion string  
   
 RETURN:  
   
 =head2 modify  
   
 This method is called when a modify request comes from a client.  
 Its arguments are as follows.  
   
   * obj reference  
   * dn  
   * lists formatted as follows  
    { ADD | DELETE | REPLACE }, key, value  
   
 RETURN:  
   
 =head2 add  
   
 This method is called when a add request comes from a client.  
 Its arguments are as follows.  
   
   * obj reference  
   * entry in string format.  
   
 RETURN:  
   
 =head2 modrdn  
   
 This method is called when a modrdn request comes from a client.  
 Its arguments are as follows.  
   
   * obj reference  
   * dn  
   * new rdn  
   * delete old dn flage ( 1 means yes )  
   
 RETURN:  
   
 =head2 delete  
   
 This method is called when a delete request comes from a client.  
 Its arguments are as follows.  
   
   * obj reference  
   * dn  
   
 RETURN:  
   
 =head2 config  
   
   * obj reference  
   * arrray of arguments on line  
   
 RETURN: non zero value if this is not a valid option.  
   
 =head2 init  
   
   * obj reference  
   
 RETURN: non zero value if initialization failed.  
   
 =head1 Configuration  
   
 The perl section of the config file recognizes the following   
 options.  It should also be noted that any option not recoginized  
 will be sent to the B<config> method of the perl module as noted  
 above.  
   
   database perl         # startn section for the perl database  
   
   suffix          "o=AnyOrg, c=US"  
   
   perlModulePath /path/to/libs  # addes the path to @INC variable same  
                              # as "use lib '/path/to/libs'"  
   
   perlModule ModName       # use the module name ModName from ModName.pm  
   
   filterSearchResults      # search results are candidates that need to be  
                            # filtered, rather than search results to be   
                            # returned directly to the client  
   
 =cut  
   
 package SampleLDAP;  package SampleLDAP;
   
Line 169  sub new Line 24  sub new
         return $this;          return $this;
 }  }
   
   sub init
   {
           return 0;
   }
   
 sub search  sub search
 {  {
         my $this = shift;          my $this = shift;
Line 247  sub add Line 107  sub add
         my ( $dn ) = ( $entryStr =~ /dn:\s(.*)$/m );          my ( $dn ) = ( $entryStr =~ /dn:\s(.*)$/m );
   
         #          #
         # This needs to be here untill a normalize dn is          # This needs to be here until a normalized dn is
         # passed to this routine.          # passed to this routine.
         #          #
         $dn = uc( $dn );          $dn = uc( $dn );
Line 296  sub config Line 156  sub config
 }  }
   
 1;  1;
   
   

Removed from v.1.4  
changed lines
  Added in v.1.5


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org