Article Figure 1 Figure 2 Figure 3 Listing 1
Listing 2 Listing 3 may2005.tar

Listing 1 Schema of backend perl object

1. package PerlBackend;
2. use POSIX;
3. use strict;

4. sub new {
5.     my $class = shift; 
6.     my $this = { Host   => undef,
7.                  Port   => undef,
8.                  # declare all needed Data here . . .
9.                 } ;
10.     bless ( $this,$class);
11.     return ($this);
12. }

13. sub init {
14.     my $this = shift;
15.     my $retValue;
16.     # this function is called after the object is created ..
17.     #  retValue encoded following LDAP standard
18.     # 0 means success
19.     return( $retValue );
20. }

21. sub config {
22.     my $this = shift;
23.     my $retValue;
24.     my ( $ParameterName, $ParameterValue ) = @_ ;
25.     # This function is called for EVERY line in the Config File
26.     # of the Ldap Backend.
27.     # the format is :     ParameterName    Value
28.     # example:        Host            www.LdapAbc.org
29.     #            Port            489
30.     #  retValue encoded following LDAP standard
31.     # 0 means success
32.     return( $retValue );
33. }

34. sub bind {
35.     my $this = shift;
36.     my $retValue;

37.     my ($UserDN,$UserCredentials) = @_ ;
38.     # Authentication will be done here . . . 
           
39.     #  retValue encoded following LDAP standard
40.     # 0 means success
41.     return( $retValue );
42. }

43. sub search {
44.     my $this = shift;
45.     my $retValue;
46.     my (    
47.          $base, 
48.          $scope, 
49.          $deref, 
50.          $sizeLimit, 
51.          $timeLimit, 
52.          $filterString,
53.          $attrOnly,
54.          @attrs ) = @_ ;
55.          # Construct result set in LDIF Format @ldifQueryResult
56.          #  retValue encoded following LDAP standard
57.          # 0 means success
58.      return( $retValue, @ldifQueryResult);
59. }

60. sub compare {
61.     my $this = shift;
62.     my $retValue;

63.     my ( $DN, $avaString) = @_ ;

64.     # evaluate compare . . .
65.     # Return 5 if compare False
66.     # Return 6 if compare True
67.     # following LDAP standard 
68.     return( $retValue );
69. }

70. sub modify {
71.     my $this = shift;
72.     my $retValue;

73.     my ( $dn, @toDoList ) = @_ ;

74.     while (@toDoList > 0 ) {

75.        my $action     = shift (@toDoList);
76.        my $key    = shift (@toDoList) ;
77.        my $value    = shift (@toDoList) ;
78.        if ( $action eq ìADDî ) {
79.           # perform ìadd of $key, $value ì
80.           # set retValue
81.        }
82.        elsif ( $action eq ìDELETEî ) {
83.           # perform ìdelete of $key, $valueî
84.           # set retValue
85.        }

86.      }
87.      return( $retValue );
88. }

89. sub add {
90.     my $this = shift;
91.     my $retValue;
92.     my ( @inputLDIF ) = @_ ;
93.     # simple LDAP add instruction in the LDIF format
94.     # convert into Perl Objects if needed 
95.     # following LDAP standard 
96.     return( $retValue );
97. }

98. sub delete {
99.      my $this = shift;
100.      my $retValue;
101.      my ( $dn ) = shift ;

102.    # Simply try to delete Object with DN : $dn
103.    # set $retValue using the LDAP standard 
104.    return( $retValue );
105. }

106. sub modrdn {
107.     my $this = shift;
108.     my $retValue;

109.     my ( $dn, $newdn, $Flag ) = shift ;

110.    # Simply try to set ìoldî $dn to $newdn 
111.    # set $retValue using the LDAP standard 
112.    return( $retValue );
113. }