Re: comsat-biff issue

2015-07-07 Thread Walter Alejandro Iglesias
Upgraded to latest snapshot and Biff is alive and barking again ;-).

Thanks Todd.


Walter



Re: comsat-biff issue

2015-07-06 Thread Todd C. Miller
On Mon, 06 Jul 2015 16:53:27 +0200, Walter Alejandro Iglesias wrote:

> Till you mentioned about it I've ignored the existence of
> /usr/libexec/mail.local. :-)  I'm a new to OpenBSD.  Is it some kind of
> procmail's alike functionality?

It's what delivers messages to /var/mail/username when invoked by
the MTA.

> I tried modifying the comsat line in inetd.conf, using just udp4,
> removing the ip limit prefix, etc.  I've tried installing procmail
> (telling smtpd to use it).  I did some tests stopping /etc/rc.d/inetd
> and running inetd -d form the command line.

It turns out mail.local only supported udp4 anyway (though I've
just committed a fix for that).

> With the default inetd.conf, after sending a mail to myself:
> 
> # inetd -d
> ADD: 127.0.0.1:comsat proto=udp, wait.max=1.256 user:group=root:wheel builtin
> =0 server=/usr/libexec/comsat
> ADD: ::1:comsat proto=udp6, wait.max=1.256 user:group=root:wheel builtin=0 se
> rver=/usr/libexec/comsat
> ADD: daytime proto=tcp, wait.max=0.256 user:group=root:wheel builtin=1959e0e0
> 8630 server=internal
> ADD: daytime proto=tcp6, wait.max=0.256 user:group=root:wheel builtin=1959e0e
> 08630 server=internal
> someone wants comsat
> 14937 execv /usr/libexec/comsat
> 
> The last two lines appeared right after sending the email.  I understand
> (in my ignorance) that means inetd *receives* the notification (from
> mail.local?).  And the following is what netstat shows:

Correct, mail.local sends a message to the comsat port which inetd
listens on.  Then inetd will exec comsat with the socket hooked up
to standard input and output.

> I know biff isn't a big concern but I insisted because I thought it
> could be a symptom of some other more important issue.

The root cause was that mail.local sends a newline character after
the spool file offset which comsat was not expecting.  This used
to work but got broken by the conversion to strtonum().  I've
committed a fix for comsat similar to the diff I send earlier.

 - todd



Re: comsat-biff issue

2015-07-06 Thread Todd C. Miller
It looks like this is fallout from the strtonum() conversion in
comsat.  The issue is that mail.local writes a trailing newline
after the offset that we need to trim.  This fixes it.

 - todd

Index: libexec/comsat/comsat.c
===
RCS file: /cvs/src/libexec/comsat/comsat.c,v
retrieving revision 1.39
diff -u -p -u -r1.39 comsat.c
--- libexec/comsat/comsat.c 18 Apr 2015 18:28:37 -  1.39
+++ libexec/comsat/comsat.c 6 Jul 2015 14:56:23 -
@@ -191,6 +191,7 @@ doreadutmp(void)
}
(void)lseek(uf, 0, SEEK_SET);
nutmp = read(uf, utmp, statbf.st_size)/sizeof(struct utmp);
+   dsyslog(LOG_DEBUG, "read %d utmp entries", nutmp);
}
(void)alarm(15);
 }
@@ -204,15 +205,22 @@ mailfor(char *name)
char *cp;
off_t offset;
 
+   dsyslog(LOG_DEBUG, "mail for '%s'", name);
+   cp = name + strlen(name) - 1;
+   while (cp > name && isspace((unsigned char)*cp))
+   *cp-- = '\0';
if (!(cp = strchr(name, '@')))
return;
*cp = '\0';
offset = strtonum(cp + 1, 0, LLONG_MAX, &errstr);
-   if (errstr)
+   if (errstr) {
+   syslog(LOG_ERR, "'%s' is %s", cp + 1, errstr);
return;
+   }
while (--utp >= utmp) {
memcpy(utname, utp->ut_name, UT_NAMESIZE);
utname[UT_NAMESIZE] = '\0';
+   dsyslog(LOG_DEBUG, "check %s against %s", name, utname);
if (!strncmp(utname, name, UT_NAMESIZE))
notify(utp, offset);
}



Re: comsat-biff issue

2015-07-06 Thread Walter Alejandro Iglesias
Hello Todd,

On Mon, Jul 06, 2015 at 06:37:24AM -0600, Todd C. Miller wrote:
> Is your mail being delivered to /var/mail/yourname or do you have
> a .forward file?  The comsat daemon is notified by mail.local which
> delivers mail to the local mail spool.  If you have a .forward file,
> mail.local is not used and you won't get a biff notification.

Till you mentioned about it I've ignored the existence of
/usr/libexec/mail.local. :-)  I'm a new to OpenBSD.  Is it some kind of
procmail's alike functionality?

My configuration is almost the after-install defaults.  There's just
a /root/.forward created at install time pointing to my user.  I thought
about it, I tried removing that .forward file and removing aliases I'd
added later and logged in *only* root user I sent email from root to root
to find out if some variable set in my ~/.kshrc or ~/.profile could be
interfering.

I tried modifying the comsat line in inetd.conf, using just udp4,
removing the ip limit prefix, etc.  I've tried installing procmail
(telling smtpd to use it).  I did some tests stopping /etc/rc.d/inetd
and running inetd -d form the command line.

With the default inetd.conf, after sending a mail to myself:

# inetd -d
ADD: 127.0.0.1:comsat proto=udp, wait.max=1.256 user:group=root:wheel builtin=0 
server=/usr/libexec/comsat
ADD: ::1:comsat proto=udp6, wait.max=1.256 user:group=root:wheel builtin=0 
server=/usr/libexec/comsat
ADD: daytime proto=tcp, wait.max=0.256 user:group=root:wheel 
builtin=1959e0e08630 server=internal
ADD: daytime proto=tcp6, wait.max=0.256 user:group=root:wheel 
builtin=1959e0e08630 server=internal
someone wants comsat
14937 execv /usr/libexec/comsat

The last two lines appeared right after sending the email.  I understand
(in my ignorance) that means inetd *receives* the notification (from
mail.local?).  And the following is what netstat shows:

# netstat -a -p udp
Active Internet connections (including servers)
Proto   Recv-Q Send-Q  Local Address  Foreign Address(state)
udp  0  0  localhost.biff *.*
udp  0  0  *.syslog   *.*
Active Internet connections (including servers)
Proto   Recv-Q Send-Q  Local Address  Foreign Address(state)
udp6 0  0  localhost.biff *.*
udp6 0  0  *.syslog   *.*


And that's all that came to my mind (I've tried also opening and closing
my living room's window several times :-)).

I know biff isn't a big concern but I insisted because I thought it
could be a symptom of some other more important issue.


>
>  - todd


Walter



-- 
PLEASE, LET'S PRESERVE GOOD EMAIL PRACTICES
- Use plain text (no HTML please).
- Separate paragraphs with empty lines.
- Use hard wrapped lines at no more than 72 columns.
- Avoid top-posting.
- You'll find the above easy to accomplish by using a decent email
  client (i.e. Thunderbird, Claws mail, Mutt).



Re: comsat-biff issue

2015-07-06 Thread Todd C. Miller
Is your mail being delivered to /var/mail/yourname or do you have
a .forward file?  The comsat daemon is notified by mail.local which
delivers mail to the local mail spool.  If you have a .forward file,
mail.local is not used and you won't get a biff notification.

 - todd



comsat-biff issue

2015-07-04 Thread Walter Alejandro Iglesias
Hello,

After running:

# cp /etc/example/inetd.conf /etc/
# /etc/rc.d/inetd -f start
$ biff y
$ echo Hello | mail -s 'testing biff' `whoami`

Biff should print its message and beep in login shells.  But nothing
happens.

Now I have installed:

OpenBSD 5.8-beta (GENERIC.MP) #1116: Wed Jul  1 12:50:20 MDT 2015
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

With 5.7 amd64 release and older amd64 snapshots it didn't work either.
However it works ok in FuguIta (i386).


Walter



-- 
PLEASE, LET'S PRESERVE GOOD EMAIL PRACTICES
- Use plain text (no HTML please).
- Separate paragraphs with empty lines.
- Use hard wrapped lines at no more than 72 columns.
- Avoid top-posting.
- You'll find the above easy to accomplish by using a decent email
  client (i.e. Thunderbird, Claws mail, Mutt).