--- /dev/null
+--- libutempter-1.1.5/utempter.c.org 2010-09-21 14:12:11.474543375 +0200
++++ libutempter-1.1.5/utempter.c 2010-09-21 14:13:35.669584497 +0200
+@@ -113,20 +113,27 @@
+ {
+ struct utmp ut;
+ struct timeval tv;
++ int fd;
++ struct lastlog ll;
+
+ #ifdef __GLIBC__
+ int offset;
+ #endif
+
+ memset(&ut, 0, sizeof(ut));
++ memset(&ll, 0, sizeof(ll));
+
+ memset(&tv, 0, sizeof(tv));
+ (void) gettimeofday(&tv, 0);
++ ll.ll_time = time(NULL);
+
+ strncpy(ut.ut_name, user, sizeof(ut.ut_name));
+ strncpy(ut.ut_line, term, sizeof(ut.ut_line));
+- if (host)
++ strncpy(ll.ll_line, term, sizeof(ll.ll_line));
++ if (host) {
+ strncpy(ut.ut_host, host, sizeof(ut.ut_host));
++ strncpy(ll.ll_host, host, sizeof(ll.ll_host));
++ }
+
+ #ifdef __GLIBC__
+
+@@ -156,6 +163,11 @@
+ endutent();
+
+ (void) updwtmp(_PATH_WTMP, &ut);
++ if ((fd = open(_PATH_LASTLOG, O_RDWR)) != -1) {
++ lseek(fd, (off_t) ((long)pw->pw_uid * sizeof(ll)), SEEK_SET);
++ write(fd, &ll, sizeof(ll));
++ close(fd);
++ }
+
+ #elif defined(__FreeBSD__)
+
-diff -urN utempter-0.5.3.org/Makefile utempter-0.5.3/Makefile
---- utempter-0.5.3.org/Makefile 2003-12-18 23:33:32.081092612 +0100
-+++ utempter-0.5.3/Makefile 2003-12-18 23:34:17.941588864 +0100
-@@ -11,12 +11,12 @@
+--- libutempter-1.1.5/Makefile~ 2007-02-19 13:14:08.000000000 +0100
++++ libutempter-1.1.5/Makefile 2010-09-21 14:16:43.025917709 +0200
+@@ -27,7 +27,7 @@
+ STATICLIB = lib$(PROJECT).a
+ MAP = lib$(PROJECT).map
- CFLAGS = -Wall $(RPM_OPT_FLAGS)
+-TARGETS = $(PROJECT) $(SHAREDLIB) $(STATICLIB)
++TARGETS = $(PROJECT) $(SHAREDLIB) $(STATICLIB) utmp-cleanup
--TARGETS = $(NAME) utmp $(SHAREDLIB)
-+TARGETS = $(NAME) utmp $(SHAREDLIB) utmp-cleanup
-
- all: $(TARGETS)
+ INSTALL = install
+ libdir = /usr/lib
+@@ -70,8 +70,9 @@
+ $(INSTALL) -p -m644 $(PROJECT).h $(DESTDIR)$(includedir)/
+ $(INSTALL) -p -m755 $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SHAREDLIB).$(VERSION)
+ $(INSTALL) -p -m644 $(STATICLIB) $(DESTDIR)$(libdir)/
++ $(INSTALL) -p -m755 utmp-cleanup $(DESTDIR)$(libexecdir)/$(PROJECT)/
+ ln -s $(SHAREDLIB).$(VERSION) $(DESTDIR)$(libdir)/$(SONAME)
+ ln -s $(SONAME) $(DESTDIR)$(libdir)/$(SHAREDLIB)
clean:
-- rm -f *.so utempter utmp *.os
-+ rm -f *.so utempter utmp *.os utmp-cleanup
-
- %.os : %.c
- $(CC) -c $(CFLAGS) -fPIC $< -o $@
-@@ -26,6 +26,7 @@
- mkdir -p $(RPM_BUILD_ROOT)/$(LIBDIR)
- mkdir -p $(RPM_BUILD_ROOT)/usr/include
- install -m 4755 utempter $(RPM_BUILD_ROOT)/usr/sbin
-+ install -m 755 utmp-cleanup $(RPM_BUILD_ROOT)/usr/sbin
- install -m 644 utempter.h $(RPM_BUILD_ROOT)/usr/include
- install -m 644 $(SHAREDLIB) $(RPM_BUILD_ROOT)/$(LIBDIR)/$(SHAREDLIB).$(VERSION)
- ln -sf $(SHAREDLIB).$(VERSION) $(RPM_BUILD_ROOT)/$(LIBDIR)/$(SHAREDLIB)
+- $(RM) $(TARGETS) iface.o iface.os core *~
++ $(RM) $(TARGETS) iface.o iface.os core *~ utmp-cleanup
diff -urN utempter-0.5.3.org/utmp-cleanup.c utempter-0.5.3/utmp-cleanup.c
--- utempter-0.5.3.org/utmp-cleanup.c 1970-01-01 01:00:00.000000000 +0100
+++ utempter-0.5.3/utmp-cleanup.c 2003-12-18 23:33:51.996966369 +0100
Summary(pt_BR.UTF-8): Programa para atualização do utmp/wtmp
Summary(ru.UTF-8): Привилегированная программа для изменений в utmp/wtmp
Summary(uk.UTF-8): Привілейована програма для внесення змін до utmp/wtmp
-Name: utempter
-Version: 0.5.5
-Release: 10
+%define utempter_compat_ver 0.5.5
+Name: libutempter
+Version: 1.1.5
+Release: 0.1
License: MIT or LGPL
Group: Base
-Source0: %{name}-%{version}.tar.gz
-# Source0-md5: a628f149132e2f729bc4601e6a4f6c29
+Source0: ftp://ftp.altlinux.org/pub/people/ldv/utempter/%{name}-%{version}.tar.bz2
+# Source0-md5: d62a93ba9f3796a91cf03be5ef25a9a1
Patch0: %{name}-lastlog.patch
Patch1: %{name}-utmp-cleanup.patch
-Patch2: %{name}-64bit_timeval.patch
BuildRequires: rpmbuild(macros) >= 1.202
Requires(pre): /usr/bin/getgid
Requires(pre): /usr/sbin/groupadd
Requires(post,postun): /sbin/ldconfig
Requires(postun): /usr/sbin/groupdel
Provides: group(utmp)
+Provides: utempter = %{utempter_compat_ver}
Obsoletes: libutempter0
+Obsoletes: utempter
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Obsoletes: libutempter0-devel
+Obsoletes: utempter-devel
%description devel
Header file for utempter library.
%setup -q
%patch0 -p1
%patch1 -p1
-%patch2 -p1
%build
%{__make} \
CC="%{__cc}" \
- RPM_OPT_FLAGS="%{rpmcflags}"
+ RPM_OPT_FLAGS="%{rpmcppflags} %{rpmcflags}" \
+ libdir="%{_libdir}" \
+ libexecdir="%{_libexecdir}"
%install
rm -rf $RPM_BUILD_ROOT
%{__make} install \
- LIBDIR="%{_libdir}" \
- RPM_BUILD_ROOT=$RPM_BUILD_ROOT
+ libdir="%{_libdir}" \
+ libexecdir="%{_libexecdir}" \
+ DESTDIR=$RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/var/run
:> $RPM_BUILD_ROOT/var/run/utmpx
+++ /dev/null
---- utempter-0.5.5/utempter.c.orig 2010-02-28 21:06:00.395478197 +0100
-+++ utempter-0.5.5/utempter.c 2010-02-28 21:06:52.294473115 +0100
-@@ -91,6 +91,7 @@
- char * id;
- int fd;
- struct lastlog ll;
-+ struct timeval tv;
-
- if (argc < 3) usage();
-
-@@ -158,7 +159,9 @@
-
- strncpy(utx.ut_id, id, sizeof(utx.ut_id));
-
-- gettimeofday(&utx.ut_tv, NULL);
-+ gettimeofday(&tv, NULL);
-+ utx.ut_tv.tv_sec = tv.tv_sec;
-+ utx.ut_tv.tv_usec = tv.tv_usec;
- ll.ll_time = time(NULL);
-
- pututxline(&utx);
+++ /dev/null
-diff -ur utempter-0.5.2.orig/utempter.c utempter-0.5.2/utempter.c
---- utempter-0.5.2.orig/utempter.c Thu Apr 8 18:19:36 1999
-+++ utempter-0.5.2/utempter.c Fri May 5 04:19:51 2000
-@@ -88,6 +88,8 @@
- int i;
- struct stat sb;
- char * id;
-+ int fd;
-+ struct lastlog ll;
-
- if (argc < 3) usage();
-
-@@ -115,6 +117,7 @@
- host = NULL;
- }
-
-+ memset(&ll, 0, sizeof(ll));
- memset(&utx, 0, sizeof(utx));
- if (add)
- utx.ut_type = USER_PROCESS;
-@@ -130,6 +133,7 @@
- checkDevice(device);
-
- strncpy(utx.ut_line, device + 5, sizeof(utx.ut_line));
-+ strncpy(ll.ll_line, device + 5, sizeof(ll.ll_line));
-
- pw = getpwuid(getuid());
- if (!pw) {
-@@ -139,8 +143,10 @@
-
- strncpy(utx.ut_user, pw->pw_name, sizeof(utx.ut_user));
-
-- if (host)
-+ if (host) {
- strncpy(utx.ut_host, host, sizeof(utx.ut_host));
-+ strncpy(ll.ll_host, host, sizeof(ll.ll_host));
-+ }
-
- if (!strncmp("pts/", utx.ut_line, 4)) {
- id = utx.ut_line + 3;
-@@ -152,9 +158,16 @@
- strncpy(utx.ut_id, id, sizeof(utx.ut_id));
-
- gettimeofday(&utx.ut_tv, NULL);
-+ ll.ll_time = time(NULL);
-
- pututxline(&utx);
- updwtmpx(_PATH_WTMP, &utx);
-+
-+ if ((fd = open(_PATH_LASTLOG, O_RDWR)) != -1) {
-+ lseek(fd, (off_t) ((long)pw->pw_uid * sizeof(ll)), SEEK_SET);
-+ write(fd, &ll, sizeof(ll));
-+ close(fd);
-+ }
-
- return 0;
- }