Re: [Dovecot] whoson plugin for 2.0

2012-11-22 Thread Timo Sirainen
On 18.11.2012, at 18.04, Chuck Cochems wrote:

> On 11/16/2012 4:43 PM, Pascal Volk wrote:
>> On 11/16/2012 11:21 PM Chuck Cochems wrote:
>>> …
>>> I need to return both the IP and the email address as a string to drop
>>> it into the old code.
>>> …
>> 
>> You could check the code of the `doveadm who` command
>> . It shows both, the user
>> name and the IP address.
> 
> That's not much better...
> 
> I just want the bare minimum of code to do this. The 1.x code was so simple, 
> and i just want a 2.0 equivalent. is that so wrong? :)  WHy the heck did they 
> remove those incredibly useful environment variables anyway?

Because a single process can now handle multiple connections with different 
IPs/usernames.



Re: [Dovecot] whoson plugin for 2.0

2012-11-19 Thread Chuck Cochems

On 11/16/2012 4:43 PM, Pascal Volk wrote:

On 11/16/2012 11:21 PM Chuck Cochems wrote:

…
I need to return both the IP and the email address as a string to drop
it into the old code.
…


You could check the code of the `doveadm who` command
. It shows both, the user
name and the IP address.


Regards,
Pascal



Problem solved.

i finally found a working verion. i told the author to switch from 
strlcpy (which is not part of glibc) to i_strocpy (which dovecot 
provides). hopefulyl he will listen. if not, that's how to fix it.


http://ftp.ufanet.ru/pub/boco/dovecot/whoson-plugin-2/

someone update the 2.0 wiki link. :)



Re: [Dovecot] whoson plugin for 2.0

2012-11-18 Thread Chuck Cochems

On 11/16/2012 4:43 PM, Pascal Volk wrote:

On 11/16/2012 11:21 PM Chuck Cochems wrote:

…
I need to return both the IP and the email address as a string to drop
it into the old code.
…


You could check the code of the `doveadm who` command
. It shows both, the user
name and the IP address.


That's not much better...

I just want the bare minimum of code to do this. The 1.x code was so 
simple, and i just want a 2.0 equivalent. is that so wrong? :)  WHy the 
heck did they remove those incredibly useful environment variables anyway?




Re: [Dovecot] whoson plugin for 2.0

2012-11-16 Thread Pascal Volk
On 11/16/2012 11:21 PM Chuck Cochems wrote:
> …
> I need to return both the IP and the email address as a string to drop 
> it into the old code.
> …

You could check the code of the `doveadm who` command
. It shows both, the user
name and the IP address.


Regards,
Pascal
-- 
The trapper recommends today: c01dcafe.1232...@localdomain.org


Re: [Dovecot] whoson plugin for 2.0

2012-11-16 Thread Chuck Cochems

On 11/16/2012 11:53 AM, Pascal Volk wrote:

On 11/16/2012 04:27 AM Chuck Cochems wrote:

…
this is, of course, because getenv() no longer functions lie it used to
in plugins.

so i need a replacement for getenv("IP") and getenv("USER") to make this
work.


AFAIR: getenv was replaced by mail_user_plugin_getenv

,--[ lib-storage/mail-user.h ]--
| /* If name exists in plugin_envs, return its value. */
| const char *mail_user_plugin_getenv(struct mail_user *user, const char *name);
`--


Ye, but it requires the user struct to be passed as a parameter, which 
this plugin doesn't even use.


Also, it seems the ip address is stored in a different format than used 
by the old getenv("IP") (which was a string)


I need to return both the IP and the email address as a string to drop 
it into the old code.


I attempted to use the drac plugin as a base (the new 2.0 compatible 
one) but i found the code hard to follow, and also DRAC seems to just 
use the IP, while whoson also uses the email address.


Re: [Dovecot] whoson plugin for 2.0

2012-11-16 Thread Pascal Volk
On 11/16/2012 04:27 AM Chuck Cochems wrote:
> …
> this is, of course, because getenv() no longer functions lie it used to 
> in plugins.
> 
> so i need a replacement for getenv("IP") and getenv("USER") to make this 
> work.

AFAIR: getenv was replaced by mail_user_plugin_getenv

,--[ lib-storage/mail-user.h ]--
| /* If name exists in plugin_envs, return its value. */
| const char *mail_user_plugin_getenv(struct mail_user *user, const char *name);
`--


Regards,
Pascal
-- 
The trapper recommends today: cafefeed.1232...@localdomain.org


[Dovecot] whoson plugin for 2.0

2012-11-15 Thread Chuck Cochems

I have found a plugin at

ftp://ftp.ufanet.ru/pub/boco/dovecot/whoson-plugin/

I was able to make it function on a dovecot 1.2.8 server, by changing 
__attr_unused__ to ATTR_UNUSED and strlcpy to i_strocpy (since glibc 
doesn't HAVE strlcpy, on purpose).


However, it doesn't work with 2.1

this is, of course, because getenv() no longer functions lie it used to 
in plugins.


so i need a replacement for getenv("IP") and getenv("USER") to make this 
work.


i know, pop before SMTP is stupid, but the isp i'm doing this for hs 
customers that have used pop before smtp for ages.


so I MUST make a whoson plugin.

as i said, the remote ip and the email address are required to interface 
with whoson. (this is superior to DRAC, which just opens the IP)