[imp] virtual hosting based on ldap info
Caylan Van Larson
caylan at cs.und.edu
Tue Jul 29 13:53:59 PDT 2003
A little more, shall we say pimpin' aproach IMO would be this:
FILE: horde/templates/login/user.inc
ADD:
--SNIP
<?php
$fullname =3D imp_set_fullname($imp);
?>
<b><?php echo sprintf(_("Welcome, %s"), $fullname) ?></b>
--SNAP
Caylan
On Tue, 29 Jul 2003, [iso-8859-1] Alex=E1nder Murillo Herrera wrote:
> Replace de function "imp_expand_fromaddress" in file imp/config/conf.php
>=20
> And assign the function to $conf['hooks']['from']
>=20
> Best regards,
> Alex=E1nder M.
>=20
> -----Original Message-----
> From: imp-bounces at lists.horde.org [mailto:imp-bounces at lists.horde.org]
> On Behalf Of Caylan Van Larson
> Sent: Tuesday, July 29, 2003 1:34 PM
> To: imp at lists.horde.org
> Subject: [imp] virtual hosting based on ldap info
>=20
>=20
> Hi,
>=20
> Here at school we have user at cs.und.edu and user at aero.und.edu accounts. =
=20
> The previous two addresses are identical and mail is accepted for both=20
> addresses and delivered to "user."
>=20
> Most users dont care to understand this concept and think that their
> email=20
> address is "wrong" when the domain is not as expected. Thus, I have to=
=20
> come up with a way to have their from address (maildomain/realm) change=
=20
> based on some ldap information, easiest being their home directories=20
> because of how we split compsci and avit students.
>=20
> Code placed in imp/config/servers.php will allow me to change=20
> maildomain/realm based on variables available *before* a user ever types
>=20
> in their username.
>=20
> Here is my code:
> --SNIP
> // Connect to the ldap server.
> ....
>=20
> // Identifiers and vdomains.
> $vdomains['Sirius'] =3D 'aero.und.edu';
> $vdomains['Agassiz'] =3D 'cs.und.edu';
>=20
> // Default vdomain
> $vdomain =3D 'aero.und.edu';
>=20
> if( $hack_ldap_resource )
> {
> $hack_ldap_user =3D $_REQUEST['imapuser'];
> $hack_ldap_basedn =3D 'ou=3Dpeople,dc=3Daero,dc=3Dund,dc=3Dedu';
> $hack_ldap_search =3D 'uid=3D'.$hack_ldap_user;
> $hack_ldap_results =3D ldap_search($hack_ldap, $hack_ldap_basedn,
> $hack_ldap_search);
> $hack_ldap_info =3D ldap_get_entries($hack_ldap, $hack_ldap_results);
> $hack_ldap_homedir =3D $hack_ldap_info[0]['homedirectory'][0];
>=20
> foreach( $vdomains as $vdomain_key =3D> $vdomain_value )
> {
> //echo "Searching for $vdomain_key in $hack_ldap_homedir...";
> if( preg_match("/$vdomain_key/", $hack_ldap_homedir) )
> {
> //echo "FOUND!<br>";
> $vdomain =3D $vdomains[$vdomain_key];
> //echo "Vdomain set to $vdomain<br>";
> break;
> }
> //echo "<br>";
> }
> }
> --SNAP
>=20
> So here are two questions:
>=20
> 1) Where can I put this code so I can effectively change
> maildomain/realm=20
> while still being able to access the username provided at the initial
> form?
>=20
> 2) Instead, is there a configuration that will only allow usernames in
> the=20
> form "username at example.com" then set the maildomain/realm according to
> the=20
> address provided? (And only allow a certain set of domains?)
>=20
> The trouble with #2 is students will have access to both type of
> accounts=20
> because horde/imp stores them under different accounts thus different=20
> preferences for the same email address.
>=20
> Thanks,
>=20
>=20
>=20
> Caylan Van Larson
> Unix Administrator - Systems Team Member
> University of North Dakota (Aerospace College) caylan at cs.und.edu
> 701-777-6151 (work)
>=20
>=20
> --=20
> IMP mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: imp-unsubscribe at lists.horde.org
>=20
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.488 / Virus Database: 287 - Release Date: 6/5/2003
> =20
>=20
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.488 / Virus Database: 287 - Release Date: 6/5/2003
> =20
>=20
>=20
More information about the imp
mailing list