Project

General

Profile

Revision 8177

Added by Jing Tao over 7 years ago

Fixed a bug in creating a subtree.

View differences:

ldapweb.cgi
869 869
sub createTemporaryAccount {
870 870
    my $allParams = shift;
871 871
    #my $org = $query->param('o'); 
872
    my $org = 'LTER';
872
    my $org = 'unaffiliated';
873 873
    my $ou = $query->param('ou');
874 874
    #my $ou = 'LTER';
875 875
    my $uid = $query->param('uid');
......
901 901
        debug("LDAP connection to $ldapurl...");    
902 902
        #if main ldap server is down, a html file containing warning message will be returned
903 903
        my $ldap = Net::LDAP->new($ldapurl, timeout => $timeout) or handleLDAPBindFailure($ldapurl);
904
        
904
        my $dn;
905 905
        if ($ldap) {
906 906
            $ldap->start_tls( verify => 'none');
907 907
            debug("Attempting to bind to LDAP server with dn = $ldapUsername, pwd = $ldapPassword");
......
914 914
                'o'   => $org,
915 915
                'objectclass' => ['top', 'organization']
916 916
                ];
917
                $dn='o=' . $org . ',' . $tmpSearchBase;
917 918
             } else {
918 919
                $additions = [ 
919 920
                'ou'   => $ou,
920 921
                'objectclass' => ['top', 'organizationalUnit']
921 922
                ];
923
                $dn='ou=' . $ou . ',' . $tmpSearchBase;
922 924
             }
923 925
            
924
            my $result = $ldap->add ( 'dn' => $tmpSearchBase, 'attr' => [ @$additions ]);
926
            my $result = $ldap->add ( 'dn' => $dn, 'attr' => [ @$additions ]);
925 927
            if ($result->code()) {
926 928
                fullTemplate( ['registerFailed', 'register'], { stage => "register",
927 929
                                                            allParams => $allParams,
......
975 977

  
976 978
        my $searchBase = $ldapConfig->{$o}{'base'};
977 979
        my $dnBase = $ldapConfig->{$o}{'dn'};
980
        debug("the dn is " . $dnBase);
978 981
        my $ldapUsername = $ldapConfig->{$o}{'user'};
979 982
        my $ldapPassword = $ldapConfig->{$o}{'password'};
980 983
        debug("LDAP connection to $ldapurl...");    

Also available in: Unified diff