Ldap authentication only supports Novell?

Ldap authentication only supports Novell?

by Sergi Tur Badenas -
Number of replies: 2
After successfully configuring moodle for ldap authentication I realized that Moodle doesn't have support for Openldap ("rfc2307") for email confirmation when using ldap. After filling the user form I have the following error:

auth: ldap auth_user_create() does not support selected usertype:"rfc2307" (..yet)

I use version 1.6.1+.

Is there support in newer versions? if not were is exepected to have support for this?
Average of ratings: -
In reply to Sergi Tur Badenas

Re: Ldap authentication only supports Novell?

by Andrej Bagon -
No creations of user accounts into ldap. We created a little script, that user inserts info and then the data is inserted into ldap. All you need to do is to put a link on the right side of login to point to login.php

Something like this:
login.php
<form action="ldap.php" method="POST">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="geslo"><br>
Ime: <input type="text" name="ime"><br>
Priimek: <input type="text" name="priimek"><br>
Email: <input type="text" name="email"><br>

<input type="submit" value="Prijava">
</form>

ldap.php
<html>
<head>
<title>
Nas user
</title>
</head>
<body>
<h1>Nas user</h1>
<?
    $ldapserver=ldap_connect("localhost");
    if(!$ldapserver)
    {
        print "System Error";
        exit(0);
    }
    $bind = ldap_bind($ldapserver,"cn=root,dc=who,dc=will,dc=know","supersecret");
    if(!$bind)
    {
        print "System Error";
        exit(0);
    }
    $base_dn = 'uid='.$_POST['username'].",dc=who,dc=will,dc=know";
    // prepare data
    $info["objectClass"][0] = "top";
    $info["objectClass"][1] = "inetOrgPerson";
    $info["uid"] = $_POST['username'];
    $info["cn"] = $_POST['ime'].' '.$_POST['priimek'] ;
    $info["givenName"] = $_POST['ime'];
    $info["sn"] = $_POST['priimek'];
    $info["displayName"] = $_POST['ime'].' '.$_POST['priimek'];
    $info["userPassword"] = $_POST['geslo'];
  
        echo('<pre>');
        print_r($info);
        echo('</pre>');
        // add data to directory
        $r = ldap_add($ldapserver, $base_dn, $info);
        ldap_close($ldapserver);
?>

It has no authentication via email. But with ease you can put first data into a database table and then send via mail function an email and when the users confirms you copy his entry from database into ldap.
In reply to Andrej Bagon

Re: Ldap authentication only supports Novell?

by Sergi Tur Badenas -
Thanks a lot!

First of all sorry for my english...

Nice script but I finally found a solution for my problem... What I want is combine ldap authentication with email confirmation. First I tried using the option ldap_create_context but then I realized that there is no support for Openldap (posixAccount rfc2307).

But then Iñaki in another post tell me about the auth_ldap_sync_users.php an I started to test some things and I realized that after configuring ldap authentication succesfully I can return to email confirmation authentication mode and then users from ldap can login and new users could user email confirmation just combining the two ways.

Thats perfect but I found no documentation about this.... It could be a good idea to explain the possibility of combining authentication modes in section authentication options...