aboutsummaryrefslogtreecommitdiff
path: root/login/programs
diff options
context:
space:
mode:
Diffstat (limited to 'login/programs')
-rw-r--r--login/programs/database.c28
-rw-r--r--login/programs/request.c7
-rw-r--r--login/programs/utmpd-private.h3
-rw-r--r--login/programs/utmpd.c15
4 files changed, 20 insertions, 33 deletions
diff --git a/login/programs/database.c b/login/programs/database.c
index e31e0d9dae..3138ae605c 100644
--- a/login/programs/database.c
+++ b/login/programs/database.c
@@ -42,7 +42,6 @@ static int replace_entry (utmp_database *database, int old_position,
int new_position, const struct utmp *entry);
static int store_entry (utmp_database *database, int position,
const struct utmp *entry);
-static int proc_utmp_eq (const struct utmp *entry, const struct utmp *match);
static int get_mtime (const char *file, time_t *timer);
@@ -473,33 +472,6 @@ store_entry (utmp_database *database, int position,
}
-/* This function is identical to the one in login/utmp_file.c. */
-static int
-proc_utmp_eq (const struct utmp *entry, const struct utmp *match)
-{
- return
- (
-#if _HAVE_UT_TYPE - 0
- (entry->ut_type == INIT_PROCESS
- || entry->ut_type == LOGIN_PROCESS
- || entry->ut_type == USER_PROCESS
- || entry->ut_type == DEAD_PROCESS)
- &&
- (match->ut_type == INIT_PROCESS
- || match->ut_type == LOGIN_PROCESS
- || match->ut_type == USER_PROCESS
- || match->ut_type == DEAD_PROCESS)
- &&
-#endif
-#if _HAVE_UT_ID - 0
- strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
-#else
- strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0
-#endif
- );
-}
-
-
/* Get modification time of FILE and put it in TIMER. returns 0 if
successful, -1 if not. */
static int
diff --git a/login/programs/request.c b/login/programs/request.c
index 0f68b8ae79..d2c12e68cf 100644
--- a/login/programs/request.c
+++ b/login/programs/request.c
@@ -39,7 +39,6 @@ static int do_getutid (client_connection *connection);
static int do_pututline (client_connection *connection);
static int do_updwtmp (client_connection *connection);
-static int proc_utmp_eq (const struct utmp *entry, const struct utmp *match);
static int internal_getut_r (client_connection *connection,
const struct utmp *id, struct utmp *buffer);
@@ -571,7 +570,7 @@ return_error:
/* This function is identical to the one in login/utmp_file.c. */
-static int
+int
proc_utmp_eq (const struct utmp *entry, const struct utmp *match)
{
return
@@ -589,7 +588,9 @@ proc_utmp_eq (const struct utmp *entry, const struct utmp *match)
&&
#endif
#if _HAVE_UT_ID - 0
- strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
+ (entry->ut_id[0] && match->ut_id[0]
+ ? strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
+ : strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0)
#else
strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0
#endif
diff --git a/login/programs/utmpd-private.h b/login/programs/utmpd-private.h
index 4a9cdb921e..b22e58f700 100644
--- a/login/programs/utmpd-private.h
+++ b/login/programs/utmpd-private.h
@@ -100,8 +100,11 @@ void close_connection (client_connection *connection);
int read_data (client_connection *connection);
int write_data (client_connection *connection);
+int proc_utmp_eq (const struct utmp *entry, const struct utmp *match);
+
void error (int status, int errnum, const char *message, ...);
void warning (int errnum, const char *message, ...);
+
#endif /* utmpd-private.h */
diff --git a/login/programs/utmpd.c b/login/programs/utmpd.c
index e11218151c..ca310a21de 100644
--- a/login/programs/utmpd.c
+++ b/login/programs/utmpd.c
@@ -21,6 +21,7 @@
#include <fcntl.h>
#include <getopt.h>
#include <libintl.h>
+#include <locale.h>
#include <pwd.h>
#include <stddef.h>
#include <stdio.h>
@@ -38,10 +39,14 @@
#include "utmpd.h"
#include "utmpd-private.h"
+#ifndef DEFAULT_USER
+#define DEFAULT_USER "daemon"
+#endif
+
/* Get libc version number. */
#include "../../version.h"
-#define PACKAGE "libc"
+#define PACKAGE _libc_intl_domainname
/* Long options. */
static const struct option long_options[] =
@@ -81,6 +86,12 @@ main (int argc, char *argv[])
int do_version;
int opt;
+ /* Set locale via LC_ALL. */
+ setlocale (LC_ALL, "");
+
+ /* Set the text message domain. */
+ textdomain (PACKAGE);
+
/* Initialize local variables. */
debug = 0;
do_help = 0;
@@ -197,7 +208,7 @@ drop_priviliges (void)
{
struct passwd *pw;
- pw = getpwnam ("daemon");
+ pw = getpwnam (DEFAULT_USER);
if (pw)
{
seteuid (pw->pw_uid);