Sleepy - thanks - anyway, cant hurt
I had to or i couldnt log in...
Also i would only be interested in more.groupware if i can intergrate the acco8unts...
Any ldap gurus out there?
The following is the LDAP auth stuff from the config of more.gw - even though this is enabled, i can use the below settings to log into the ldap server remotely using softera ldap browser, but users in the ldap irectory cant log into more.gw and new users crated in more.gw cant log into SME...anyone got any ideas?
Two problems:
1. The e-smith LDAP does not authenticate passwords. You can only bind anonymously and check that a user exists. That had me scratching my head for a while.
2. LDAP authentication within moregroupware has some glaring holes in it. It does not appear to be complete and working.
You can get around the first problem by authenticating against IMAP instead. This works at the end of my ldap.inc.php:
$mbox = imap_open('{localhost:143/notls}INBOX', $dn, $pass, OP_HALFOPEN);
if (!empty($mbox)) {
return true;
} else {
return false;
}
You also need to ensure moregroupware does not encrypt the password that is sent (the $appconf['encrypt_pwd'] option seems to ne the back-to-front, set it to '1' to prevent encryption).
Within ldap.inc.php you can capture the LDAP details for the user and use those details to update the user in the database:
global $external_user_details;
$external_user_details = array(
'fullname' => $result[0]['cn'][0],
'surname' => $result[0]['sn'][0],
'givenname' => $result[0]['givenname'][0],
'fullname' => $result[0]['cn'][0],
'telephone' => $result[0]['telephonenumber'][0],
'ou' => $result[0]['ou'][0], // division
'o' => $result[0]['o'][0], // organisation
'mail' => $result[0]['mail'][0],
'street' => $result[0]['street'][0], // address 1
'l' => $result[0]['l'][0] // town
);
Then in index.php, just after it has created a new user (upon encountering a new authenticated user), do the update:
...
create_user_account($login);
$row = get_user_info($login);
global $external_user_details;
if (!empty($external_user_details)) {
$sql = 'UPDATE mgw_users '
.' SET lastname=' . $conn->QMagic($external_user_details['surname'])
.' , firstname=' . $conn->QMagic($external_user_details['givenname'])
.' , email=' . $conn->QMagic($external_user_details['mail'])
.' , telephone=' . $conn->QMagic($external_user_details['telephone'])
.' WHERE username='.$conn->QMagic($login);
if (($res = $conn->GetRow($sql))===false) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
}
...
Sorry it is all a bit of a hack - you will need to know what you are doing before attempting this, but it does work nicely. When the user first logs in, their name, e-mail etc. are copied from LDAP into the moregroupware user table. There is no synchronising after that, but it gets the basics in there.
Hope that helps.
-- Jason