about summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
Diffstat (limited to 'login')
-rw-r--r--login/Makefile3
-rw-r--r--login/getutent_r.c8
-rw-r--r--login/libutil.map7
-rw-r--r--login/login.c3
-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
-rw-r--r--login/utmp_daemon.c4
-rw-r--r--login/utmp_file.c9
-rw-r--r--login/utmpname.c8
11 files changed, 32 insertions, 63 deletions
diff --git a/login/Makefile b/login/Makefile
index a94c5cb14d..f75632a023 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -29,7 +29,7 @@ routines := getutent getutent_r getutid getutline getutid_r getutline_r \
 
 others = utmpd
 install-sbin = utmpd
-utmpd-routines := utmpd connection database error request xtmp
+utmpd-routines := connection database error request xtmp
 extra-objs := $(utmpd-routines:=.o)
 
 distribute := utmp-private.h programs/xtmp.h programs/utmpd.h \
@@ -43,6 +43,7 @@ extra-libs      := libutil
 extra-libs-others := $(extra-libs)
 
 libutil-routines:= login login_tty logout logwtmp pty updwtmp
+libutil-map	:= libutil.map
 
 include ../Rules
 
diff --git a/login/getutent_r.c b/login/getutent_r.c
index 3cc46da96c..9e1d4e8768 100644
--- a/login/getutent_r.c
+++ b/login/getutent_r.c
@@ -19,15 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <assert.h>
-#if _LIBC
 #include <libc-lock.h>
-#else
-#define __libc_lock_lock(lock)		((void) 0)
-#define __libc_lock_unlock(lock)	((void) 0)
-#define __libc_lock_define_initialized(CLASS,NAME)
-#define weak_alias(name, aliasname) \
-  extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); 
-#endif
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/login/libutil.map b/login/libutil.map
new file mode 100644
index 0000000000..46064a63a3
--- /dev/null
+++ b/login/libutil.map
@@ -0,0 +1,7 @@
+GLIBC_2.0 {
+  global:
+    forkpty; login; login_tty; logout; logwtmp; openpty; updwtmp;
+
+  local:
+    *;
+};
\ No newline at end of file
diff --git a/login/login.c b/login/login.c
index 6bd0e6eaef..c148893c88 100644
--- a/login/login.c
+++ b/login/login.c
@@ -24,9 +24,6 @@
 #include <stdlib.h>
 #include <utmp.h>
 
-#ifndef _LIBC
-#define __set_errno(val) errno = (val)
-#endif
 
 /* Return the result of ttyname in the buffer pointed to by TTY, which should
    be of length BUF_LEN.  If it is too long to fit in this buffer, a
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);
diff --git a/login/utmp_daemon.c b/login/utmp_daemon.c
index 9e02f24524..705c8b3de9 100644
--- a/login/utmp_daemon.c
+++ b/login/utmp_daemon.c
@@ -29,10 +29,6 @@
 #include "utmp-private.h"
 #include "programs/utmpd.h"
 
-#ifndef _LIBC
-#define __set_errno(val) errno = (val)
-#endif
-
 
 /* Descriptor for the socket.  */
 static int daemon_sock = INT_MIN;
diff --git a/login/utmp_file.c b/login/utmp_file.c
index 1366f38d75..2026070f14 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -31,11 +31,6 @@
 
 #include "utmp-private.h"
 
-#ifndef _LIBC
-#define _(msg) (msg)
-#define __set_errno(val) errno = (val)
-#endif
-
 
 /* Descriptor for the file and position.  */
 static int file_fd = INT_MIN;
@@ -230,7 +225,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/utmpname.c b/login/utmpname.c
index 81e857a2bc..2692b71ff9 100644
--- a/login/utmpname.c
+++ b/login/utmpname.c
@@ -17,15 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#if _LIBC
 #include <libc-lock.h>
-#else
-#define __libc_lock_lock(NAME)		((void) 0)
-#define __libc_lock_unlock(NAME)	((void) 0)
-#define __libc_lock_define(CLASS,NAME)
-#define weak_alias(name, aliasname) \
-  extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); 
-#endif
 #include <stdlib.h>
 #include <string.h>
 #include <utmp.h>