You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2010-12-19 22:20:10

jjulian
Member
Registered: 2010-12-19
Posts: 7

IMAP/POP Authentication issue

In Authentication Setup for IMAP/POP authentication, if the hostname is entered for the "host" field, users should be able to be authenticated by entering their username into the login screen. The imap authentication should authenticate against username@host but it's not and is silently ignoring the host parameter.

This patch fixes that:

=== modified file 'inc/authmail.class.php'
--- inc/authmail.class.php    2010-10-29 11:47:05 +0000
+++ inc/authmail.class.php    2010-12-19 19:37:51 +0000
@@ -260,7 +260,8 @@
    static function testAuth($connect_string, $login, $password) {
 
       $auth = new Auth();
-      return $auth->connection_imap($connect_string, decodeFromUtf8($login),
+      $auth->user->getFromIMAP($mail_method,decodeFromUtf8($login));
+      return $auth->connection_imap($connect_string,$auth->user->fields["email"],
                                     decodeFromUtf8($password));
    }
 
@@ -277,13 +278,13 @@
    static function mailAuth($auth, $login, $password, $mail_method) {
 
       if (isset($mail_method["connect_string"]) && !empty ($mail_method["connect_string"])) {
+         $auth->user->getFromIMAP($mail_method, decodeFromUtf8($login));
          $auth->auth_succeded = $auth->connection_imap($mail_method["connect_string"],
-                                                       decodeFromUtf8($login),
+                                                       $auth->user->fields["email"],
                                                        decodeFromUtf8($password));
          if ($auth->auth_succeded) {
             $auth->extauth = 1;
             $auth->user_present = $auth->user->getFromDBbyName(addslashes($login));
-            $auth->user->getFromIMAP($mail_method, decodeFromUtf8($login));
             //Update the authentication method for the current user
             $auth->user->fields["authtype"] = Auth::MAIL;
             $auth->user->fields["auths_id"] = $mail_method["id"];

Offline

#2 2010-12-20 09:55:54

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: IMAP/POP Authentication issue

I do not really understand that you patch do. And which case cause troubles.

Could you explain more ? (with example ?)


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#3 2010-12-23 10:54:31

jjulian
Member
Registered: 2010-12-19
Posts: 7

Re: IMAP/POP Authentication issue

For this bug, the IMAP server authentication requires full email address: jaques@thebeanstalk.com
GLPI should only require the username: jaques

In Setup, Authentication, IMAP/POP Add:
Name: thebeanstalk.com
IMAP/POP Host Name (users email will be login@thishost) : thebeanstalk.com
Server: imap.thebeanstalk.com
(the rest of the options are irrelevant)

Now try logging in as jaques

It won't work. It doesn't work because the imap request sends "jaques" as the username instead of "jaquest@thebeanstalk.com".

This patch retrieves the correct user email identifier using the getFromIMAP method. If host is empty, $auth->user->fields["email"] will be filled with just the username, "jaques".  If host is not empty, it fills with the entire email address, "jaques@thebeanstalk.com".

Last edited by jjulian (2010-12-23 10:55:07)

Offline

#4 2011-10-13 19:17:05

jjulian
Member
Registered: 2010-12-19
Posts: 7

Re: IMAP/POP Authentication issue

I've been putting off upgrading since I filed this bug but last night I upgraded to 0.80.4 and this feature is still broken. Users still cannot login with only their name even though "Email domain Name" is set for the email server under email authentication.

Offline

#5 2011-10-18 16:49:27

madpd97
Member
From: Maine
Registered: 2011-03-31
Posts: 34
Website

Re: IMAP/POP Authentication issue

We had a similar issue with authenticating through Google Apps. Google requires the whole e-mail address when authenticating rather than just the standard GLPI Username. My fix to that was going into the SQL database and changing every user's username to their actual e-mail address. This resolved our issue. From what I'm reading, yours seems to be the same. This may or may not help you out.

Offline

#6 2011-10-18 16:56:15

jjulian
Member
Registered: 2010-12-19
Posts: 7

Re: IMAP/POP Authentication issue

Thanks for the work around. The patch I submitted is still the correct fix, it no longer applies cleanly, though, since the context line have been broken up.

Offline

#7 2011-10-25 08:34:26

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: IMAP/POP Authentication issue

Patch not applied because we do not understand why we need to integrate it.
Imap auth is based on a login.
If it login is an email users need to enter the email but several IMAP auth are only based on standard login not email. So your patch is not working for them.


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#8 2011-10-25 08:39:07

jjulian
Member
Registered: 2010-12-19
Posts: 7

Re: IMAP/POP Authentication issue

Hmm, good point, I'll double check that.

The way it should work is that people who authenticate without domain name should be leaving "IMAP/POP Host Name (users email will be login@thishost) :" empty, which should provide a username with no domain attached for imap authentication.

Offline

Board footer

Powered by FluxBB