[imp] Providing alternative credentials for automatic IMP authentication

canobi at irantthereforeiam.com canobi at irantthereforeiam.com
Wed Apr 13 03:03:48 PDT 2005


  Hey people,

  I'm working on deploying Horde+IMP on a site that needs 
different logins for Horde and IMP but also needs automatic IMP 
authentication (a problem that would be solved by 'hordeauth' 
flag in server definition if the logins for Horde and IMP were 
the same). Since currently there isn't a way to do that, I was 
thinking of doing these few simple changes:
1. add another possible value to 'hordeauth' server flag (let's 
say the value would be 'alt' - for 'alternative')
2. change Auth_imp::authenticate to check for that value and if
$ptr['hordeauth'] == 'alt' then fill in $imapuser and $pass local 
variables from Auth::getCredential('impusername') and 
Auth::getCredential('imppassword'). The global credentials would 
be placeholders to be filled in by custom Horde Auth modules 
(I'll also have to code one specific to my deployment).
  Is the described way the "right" way to do it in Horde and IMP? 
If not, how do you suggest I go about implementig the required 
functionality?
If yes, would you accept the patch I make for inclusion in the 
official release versions, or is it too specific?
And, just out of curiosity, what is the more "Horde" way of 
checking multiple predefined values:

if (strcasecmp($ptr['hordeauth'], 'full') == 0) {
  $imapuser = Auth::getAuth();
} else if (strcasecmp($ptr['hordeauth'], 'alt') == 0) {
  ...
}
else {
  ...
}

or

switch (strtolower($ptr['hordeauth']))
{
  case 'full':
    ...
    break;

  case 'alt':
    ...
    break;

  default:
    ...
}


  I rather prefer the second option, but maybe there are some 
objective reasons for the first one, so I'm asking, just in case 
I'm not aware of them :-)


More information about the imp mailing list