mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Patch to musl to provide wtmp for Linux PAM
Date: Wed, 4 Dec 2013 17:20:46 +0100	[thread overview]
Message-ID: <20131204162046.GX1685@port70.net> (raw)
In-Reply-To: <CACCP0Gqs37BxFzkExEDyQr7pTdZpM1T=XHsnrCzkBGs5u+X1dw@mail.gmail.com>

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

* 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: nsbug.txt --]
[-- Type: text/plain, Size: 2231 bytes --]

arpa/inet.h accept4
arpa/inet.h gid
arpa/inet.h imr_address
arpa/inet.h imr_ifindex
arpa/inet.h imr_interface
arpa/inet.h imr_multiaddr
arpa/inet.h imr_sourceaddr
arpa/inet.h imsf_fmode
arpa/inet.h imsf_interface
arpa/inet.h imsf_multiaddr
arpa/inet.h imsf_numsrc
arpa/inet.h imsf_slist
arpa/inet.h ip6_mtuinfo
arpa/inet.h ip6m_addr
arpa/inet.h ip6m_mtu
arpa/inet.h ipi6_addr
arpa/inet.h ipi6_ifindex
arpa/inet.h ipi_addr
arpa/inet.h ipi_ifindex
arpa/inet.h ipi_spec_dst
arpa/inet.h pid
arpa/inet.h quot
arpa/inet.h rem
arpa/inet.h ucred
arpa/inet.h uid
complex.h CMPLX
complex.h CMPLXF
complex.h CMPLXL
float.h DBL_TRUE_MIN
float.h FLT_TRUE_MIN
float.h LDBL_TRUE_MIN
inttypes.h quot
inttypes.h rem
netdb.h accept4
netdb.h gid
netdb.h imr_address
netdb.h imr_ifindex
netdb.h imr_interface
netdb.h imr_multiaddr
netdb.h imr_sourceaddr
netdb.h imsf_fmode
netdb.h imsf_interface
netdb.h imsf_multiaddr
netdb.h imsf_numsrc
netdb.h imsf_slist
netdb.h ip6_mtuinfo
netdb.h ip6m_addr
netdb.h ip6m_mtu
netdb.h ipi6_addr
netdb.h ipi6_ifindex
netdb.h ipi_addr
netdb.h ipi_ifindex
netdb.h ipi_spec_dst
netdb.h pid
netdb.h quot
netdb.h rem
netdb.h ucred
netdb.h uid
netinet/in.h accept4
netinet/in.h gid
netinet/in.h imr_address
netinet/in.h imr_ifindex
netinet/in.h imr_interface
netinet/in.h imr_multiaddr
netinet/in.h imr_sourceaddr
netinet/in.h imsf_fmode
netinet/in.h imsf_interface
netinet/in.h imsf_multiaddr
netinet/in.h imsf_numsrc
netinet/in.h imsf_slist
netinet/in.h ip6_mtuinfo
netinet/in.h ip6m_addr
netinet/in.h ip6m_mtu
netinet/in.h ipi6_addr
netinet/in.h ipi6_ifindex
netinet/in.h ipi_addr
netinet/in.h ipi_ifindex
netinet/in.h ipi_spec_dst
netinet/in.h pid
netinet/in.h quot
netinet/in.h rem
netinet/in.h ucred
netinet/in.h uid
stdio.h P_tmpdir
stdlib.h aligned_alloc
stdlib.h at_quick_exit
stdlib.h mkostemp
stdlib.h quick_exit
stdlib.h quot
stdlib.h rem
stropts.h RPROTMASK
sys/shm.h used_ids
sys/socket.h accept4
sys/socket.h gid
sys/socket.h pid
sys/socket.h ucred
sys/socket.h uid
sys/uio.h UIO_MAXIOV
termios.h CBAUDEX
termios.h CRTSCTS
termios.h EXTPROC
termios.h XTABS
tgmath.h CMPLX
tgmath.h CMPLXF
tgmath.h CMPLXL
unistd.h dup3
unistd.h pipe2
utmpx.h UT_LINESIZE
utmpx.h e_exit
utmpx.h e_termination
utmpx.h updwtmpx

  reply	other threads:[~2013-12-04 16:20 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 [this message]
2013-12-04 16:40   ` Raphael Cohn

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=20131204162046.GX1685@port70.net \
    --to=nsz@port70.net \
    --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).