[Dovecot] Work with auth socket

Steffen Kaiser skdovecot at smail.inf.fh-brs.de
Tue Jun 29 17:49:06 EEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 29 Jun 2010, Неворотин Вадим wrote:

> my $base64 = encode_base64("\0$login\0$passwd");
> $sock->send("AUTH\t1\tPLAIN\tservice=$service\tsecured\tresp=$base64\n") or
> die "Can't write to $socket";

There is a wicked side effect of encode_base64(), use this:

my $base64 = encode_base64("\0$login\0$passwd", '');

Try strace -s99 -e recvfrom,sendto,send,recv perl ...

or similiar command of your system to see the difference.

> my $i = 10;
> while ($i--) {
> $sel->can_read($timeout) or last; # "Timed out while waiting for response";

If Dovecot starts to answer in less than 1s, the loop terminates.
IMHO you should try with a longer timeout the 1st time can_read() is 
called.

Regards,

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iQEVAwUBTCoH5L+Vh58GPL/cAQKbLQgApMqn+QDNLJnDksrp1/Qb7lbGji8Qxp1+
BkZTy2Pp/hld4jwr0R6MQgF10MNgt7luatSo3WzvL1KS/zINCoiAMxL3CIcNIIjQ
RW57LhsdBiFUpKvmwrMaHrV+VJM2gDONTPMXRTfLkpTsSYSnVfvGZMDgLr7rPMid
GRT+dLyXuUMxmqSWH4XPPohSuQam1E2g5cNKXp+VHUikxunz0NbPHA5ni0byCmwR
vVx4R0DEjTPw9ydcWPOCPxHwAS48eXrcpo8/1QD5Bp5S7x9CKre6PA+wdcWmHmOk
p17tAG12vGG7MGXy0f7jmI476Dp+fi0han9Z2d7QbtbI1f0yOpfMsw==
=FHUX
-----END PGP SIGNATURE-----


More information about the dovecot mailing list