diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2022-03-20 20:15:03 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2022-03-20 20:15:03 +0000 |
commit | 40aafbcda2b0373ba0f2d306141af477e3273fe1 (patch) | |
tree | 7fbd864021909f2340b5f429dd6c623697ee5a09 | |
parent | a7b0b9a99bee135a57aa696d7057226a0f8105ff (diff) | |
download | utmps-40aafbcda2b0373ba0f2d306141af477e3273fe1.tar.xz |
Prepare for 0.1.2.0; add file arg to utmps-wtmpd
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | INSTALL | 4 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | doc/index.html | 6 | ||||
-rw-r--r-- | doc/upgrade.html | 9 | ||||
-rw-r--r-- | doc/utmps-wtmpd.html | 8 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/utmps/utmps-wtmpd.c | 22 |
8 files changed, 43 insertions, 15 deletions
@@ -6,3 +6,4 @@ /libutmps.so.xyzzy /utmps-utmpd /utmps-wtmpd +/utmps-write @@ -6,8 +6,8 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 3.81 or later - - skalibs version 2.11.1.0 or later: https://skarnet.org/software/skalibs/ - - s6 version 2.11.0.1 or later: https://skarnet.org/software/s6/ + - skalibs version 2.11.2.0 or later: https://skarnet.org/software/skalibs/ + - s6 version 2.11.1.0 or later: https://skarnet.org/software/s6/ (this is only a run-time requirement, not a build-time one) This software will run on any operating system that implements @@ -1,5 +1,11 @@ Changelog for utmps. +In 0.1.2.0 +---------- + + - Make the wtmp file name configurable. + + In 0.1.1.0 ---------- diff --git a/doc/index.html b/doc/index.html index f22082d..80999f4 100644 --- a/doc/index.html +++ b/doc/index.html @@ -56,11 +56,11 @@ running utmp functions are just clients to this daemon. <li> A POSIX-compliant system with a standard C development environment </li> <li> GNU make, version 3.81 or later </li> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version -2.11.1.0 or later. It's a build-time requirement. It's also a run-time +2.11.2.0 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library. </li> <li> <a href="//skarnet.org/software/s6/">s6</a> version -2.11.0.1 or later. It's a <em>run-time</em> requirement only, to run +2.11.1.0 or later. It's a <em>run-time</em> requirement only, to run the utmpd and wtmpd services (and can be done without if you have a suitable replacement for <a href="//skarnet.org/software/s6/s6-ipcserver.html">s6-ipcserver</a>). </li> @@ -76,7 +76,7 @@ suitable replacement for <h3> Download </h3> <ul> - <li> The current released version of utmps is <a href="utmps-0.1.1.0.tar.gz">0.1.1.0</a>. </li> + <li> The current released version of utmps is <a href="utmps-0.1.2.0.tar.gz">0.1.2.0</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/utmps/">utmps git repository</a>: diff --git a/doc/upgrade.html b/doc/upgrade.html index 4495d42..95681a2 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,15 @@ <h1> What has changed in utmps </h1> +<h2> in 0.1.2.0 </h2> + +<ul> + <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> +dependency bumped to 2.11.2.0. </li> + <li> <a href="//skarnet.org/software/s6/">s6</a> run-time +dependency bumped to 2.11.1.0. </li> +</ul> + <h2> in 0.1.1.0 </h2> <ul> diff --git a/doc/utmps-wtmpd.html b/doc/utmps-wtmpd.html index d8a3b7c..898899f 100644 --- a/doc/utmps-wtmpd.html +++ b/doc/utmps-wtmpd.html @@ -34,7 +34,7 @@ a script as a part of a "wtmpd" on how to run such a service. The simplest way to do so, for testing purposes, is a command line such as: </p> -<pre>s6-ipcserver .wtmpd-socket utmps-wtmpd</pre> +<pre>s6-ipcserver .wtmpd-socket utmps-wtmpd wtmp</pre> <p> while being in the <tt>/run/utmps</tt> directory. </p> @@ -74,5 +74,11 @@ utmps-wtmpd and superserver as this user and group. </p> +<p> + If no argument is given to utmps-wtmpd, wtmp logs will be added to the <tt>wtmp</tt> +file in utmps-wtmpd's working directory. If an argument is given, wtmp logs +will be added to that file instead. +</p> + </body> </html> diff --git a/package/info b/package/info index fc959f2..4d5b1f3 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=utmps -version=0.1.1.0 +version=0.1.2.0 category=admin package_macro_name=UTMPS diff --git a/src/utmps/utmps-wtmpd.c b/src/utmps/utmps-wtmpd.c index 7ca3eff..b19f997 100644 --- a/src/utmps/utmps-wtmpd.c +++ b/src/utmps/utmps-wtmpd.c @@ -25,9 +25,10 @@ static void answer (int e) write(1, (char *)&c, 1) ; } -int main (void) +int main (int argc, char const *const *argv) { struct utmpx b ; + char const *file = "wtmp" ; char const *x ; tain deadline ; size_t w ; @@ -37,9 +38,10 @@ int main (void) PROG = "utmps-wtmpd" ; x = ucspi_get("REMOTEEUID") ; - if (!x) strerr_diefu1x(100, "get $IPCREMOTEEUID from environment") ; + if (!x) strerr_diefu1x(100, "get PROTO or IPCREMOTEEUID from environment") ; if (!uid0_scan(x, &uid)) strerr_dieinvalid(100, "IPCREMOTEEUID") ; if (ndelay_on(0) < 0) strerr_diefu1sys(111, "set stdin non-blocking") ; + if (argc >= 2 && argv[1]) file = argv[1] ; tain_now_set_stopwatch_g() ; tain_ulong(&deadline, 30) ; tain_add_g(&deadline, &deadline) ; @@ -48,7 +50,11 @@ int main (void) if (!w) strerr_diefu1sys(111, "read from stdin") ; if (buf[0] != '+') { errno = EPROTO ; strerr_diefu1sys(111, "read command") ; } w = buffer_timed_get_g(buffer_0small, buf, sizeof(struct utmpx), &deadline) ; - if (w < sizeof(struct utmpx)) strerr_diefu1sys(111, "read from stdin") ; + if (w < sizeof(struct utmpx)) + { + errno = EPIPE ; + strerr_diefu1sys(111, "read from stdin") ; + } utmps_utmpx_unpack(buf, &b) ; b.ut_user[UTMPS_UT_NAMESIZE - 1] = 0 ; if (uid) @@ -76,21 +82,21 @@ int main (void) } } - fd = open_append("wtmp") ; + fd = open_append(file) ; if (fd < 0) { answer(errno) ; - strerr_diefu2sys(111, "open", " wtmp") ; + strerr_diefu2sys(111, "open ", file) ; } if (fd_lock(fd, 1, 0) < 1) { answer(errno) ; - strerr_diefu2sys(111, "lock", " wtmp") ; + strerr_diefu2sys(111, "lock ", file) ; } if (lseek(fd, 0, SEEK_END) < 0) { answer(errno) ; - strerr_diefu2sys(111, "lseek on", " wtmp") ; + strerr_diefu2sys(111, "lseek on ", file) ; } w = allwrite(fd, buf, sizeof(struct utmpx)) ; if (w < sizeof(struct utmpx)) @@ -104,7 +110,7 @@ int main (void) fd_unlock(fd) ; answer(e) ; errno = e ; - strerr_diefu2sys(111, "append to", " wtmp") ; + strerr_diefu2sys(111, "append to ", file) ; } fsync(fd) ; fd_unlock(fd) ; |