[imp] Help on a custom hook

Errol Neal eneal at dfi-intl.com
Wed Jan 31 16:07:45 PST 2007


Heya folks. I'm trying to write  custom hook that gets triggered at
login. Essentially, because my usernames are formatted user.domain.tld,
the email address that gets associated with the default identity for the
user is unusable. By the way, I am using IMAP authentication with IMP
Essentially, all I need to do is connect to a mysql db, run a query, and
the result of that will be the username that imp should pass to the
backend. I saw that there was a _passwd_hook_username function, but it
did not appear to be implemented in the horde or imp code. 
Because I'm not that familiar with the underpinnings of IMP or the horde
framework, I essentially replaced the imp_hook_vinfo function in
Session.php with my function. 
My issue is that although the query gets executed and the code works, I
can tell that imp doesn't know what to with it. I've used wireshark to
dump the data on the wire to see what's actually occurring and I get a
connection from my web server running IMP/Horde, it executes the query
which is;

 	 select alias from virtual where username =
'$_SESSION['imp']['user']; ('$_**, substitue with the real
user, in this case
'test at k2share.com')

I see a result returned but then, when Imp logs into the imap server,
this is what I see on the wire:

* OK servername Cyrus IMAP4 v2.2.12-Invoca-RPM-2.2.12-3.RHEL4.1 server
ready 00000000 CAPABILITY 
* CAPABILITY IMAP4 IMAP4rev1 ACL QUOTA LITERAL+ MAILBOX-REFERRALS
NAMESPACE UIDPLUS ID NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND
BINARY SORT THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE IDLE
STARTTLS AUTH=ANONYMOUS SASL-IR LISTEXT LIST-SUBSCRIBED X-NETSCAPE 
00000000 OK Completed 
00000001 LOGIN "Resource id #58" test 
	
Okay, where did it grab that username from?

Now even though I'm intested in the above answer, I realize that I may
NOT have put my function where it should have been executed. So I'd
rather not ask questions that don't lead down the path to the result I
want. So can I start by asking where should I call my dinky little
function in the IMP code? Any thoughts from folks more knowledeable than
me on the issue? 

Thanks in advance, 

Errol Neal
__________________________________________
Errol Uriel Neal Jr.
Senior Systems Engineer
DFI Government Services
1717 Pennsylvania Ave NW, Suite 1200
Washington, DC  20006
Tel (202)452-6955
Fax (202)452-6910
eneal at dfi-intl.com
www.dfigov.com


More information about the imp mailing list