mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Raphael Cohn <raphael.cohn@stormmq.com>
To: musl@lists.openwall.com
Subject: Re: Patch to musl to provide wtmp for Linux PAM
Date: Wed, 4 Dec 2013 16:40:51 +0000	[thread overview]
Message-ID: <CACCP0Goz5PMtgdBq06oMyYkWAjmRYNu1xoViXEiKp0=2SQjOww@mail.gmail.com> (raw)
In-Reply-To: <20131204162046.GX1685@port70.net>

[-- Attachment #1: Type: text/plain, Size: 2475 bytes --]

Thanks for the reply - I realise udpwtmp is a stub, but if it ever
changes... although policy would seem to make that unlikely. The only
reason I can really see to deviate from this policy is to support the
various security / monitoring tools. From memory, things like splunk might
use it.

As an aside, I actually used the *tmp files to debug random restarts of
Azure linux instances earlier this year... (for the list, the problem was
with Azure).

Given the policy I'm minded to write a private patch for updwtmp captures
some of these details and sends them to authpriv. Other things are more
pressing though...

On 4 December 2013 16:20, Szabolcs Nagy <nsz@port70.net> wrote:

> * Raphael Cohn <raphael.cohn@stormmq.com> [2013-12-04 14:49:32 +0000]:
> > By the way, are there any plans to support writing to lastlog / wtmp /
> etc?
> > If not, I might create a private patch to redirect the writes to syslog.
> In
> > my view, this is where information like this belongs...
>
> http://www.openwall.com/lists/musl/2012/03/04/4
>
> i think the policy hasn't changed since
>
> > --- musl-0.9.14.orig/include/utmpx.h    2013-09-23 22:01:11.000000000
> +0100
> > +++ musl-0.9.14/include/utmpx.h    2013-12-04 10:32:20.000000000 +0000
> > @@ -13,6 +13,8 @@
> >  #include <bits/alltypes.h>
> >
> >  #define UT_LINESIZE 32
> > +#define UT_NAMESIZE 32
> > +#define UT_HOSTSIZE 256
> >
>
> note that utmpx.h is defined in posix (part of the XSI option)
> and UT_ is not reserved prefix for it so even the UT_LINESIZE
> is a namespace violation (although a rather harmless one)
>
> i attach a current list of namespace violations in musl based on
> http://port70.net/~nsz/c/posix/reserved.txt
>
> > +++ musl-0.9.14/src/legacy/utmp.c    2013-12-04 14:25:40.000000000 +0000
> > @@ -0,0 +1,20 @@
> > +#include <utmp.h>
> > +#include <string.h>
> > +#include <unistd.h>
> > +#include <sys/time.h>
> > +#include "libc.h"
> > +
> > +void logwtmp(const char * line, const char * name, const char * host)
> > +{
> > +    struct utmp u;
> > +    memset(&u, 0, sizeof(u));
> > +
> > +    u.ut_pid = getpid();
> > +    u.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS;
> > +    strncpy(u.ut_line, line, sizeof(u.ut_line));
> > +    strncpy(u.ut_name, name, sizeof(u.ut_name));
> > +    strncpy(u.ut_host, host, sizeof(u.ut_host));
> > +    gettimeofday(&(u.ut_tv), NULL);
> > +
> > +    updwtmp(_PATH_WTMP, &u);
> > +}
>
> note that updwtmp is just a stub so this logwtmp does not do much
>

[-- Attachment #2: Type: text/html, Size: 3448 bytes --]

      reply	other threads:[~2013-12-04 16:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04 14:49 Raphael Cohn
2013-12-04 16:20 ` Szabolcs Nagy
2013-12-04 16:40   ` Raphael Cohn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACCP0Goz5PMtgdBq06oMyYkWAjmRYNu1xoViXEiKp0=2SQjOww@mail.gmail.com' \
    --to=raphael.cohn@stormmq.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).