[imp] howto block the creation of new "personal information"

Andrew Morgan morgan at orst.edu
Fri May 21 18:39:59 UTC 2010


On Fri, 21 May 2010, Gottschalk, David wrote:

> This is good information.
>
> I need though the ability to block users from changing their from 
> address. We have lots of issues with user's account being compromised 
> and spammers using IMP to spam the Internet.
>
> Does anyone know if this is possible? I looked heavily through the prefs 
> file, but it seems the from address setting cannot be removed?

in horde/config/prefs.php:

// user preferred email address for From: line
// If you lock this preference, you must specify a value or a hook for it in
// horde/config/hooks.php.
$_prefs['from_addr'] = array(
     'value' => '',
     'locked' => true,
     'hook' => true,
     'shared' => true,
     'type' => 'text',
     'desc' =>  _("Your From: address:")
);

I think you must set a hook for from_addr in horde/config/hooks.php if you 
lock this preference.  I use a simple one that lets me override the From 
address in a local file:

if (!function_exists('_prefs_hook_from_addr')) {
         function _prefs_hook_from_addr($user = null) {
                 include HORDE_BASE . '/config/from_map.php';
                 $from = '';
                 if (array_key_exists($user, $from_map)) {
                         $from = $from_map[$user];
                 }
                 return (empty($from) ? $user : $from);
         }
}


In my system, $user is a fully qualified value, such as 
"fred at onid.orst.edu".  So when nothing is found in the from_map.php file, 
it just returns $user.  If your users are not fully qualified, then the 
from_addr hook probably needs to append your domain name and return that.

 	Andy


More information about the imp mailing list