packages: libutempter/libutempter.spec, libutempter/libutempter-lastlog.pat...
arekm
arekm at pld-linux.org
Tue Sep 21 14:19:37 CEST 2010
Author: arekm Date: Tue Sep 21 12:19:37 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- replacement for utempter (unfinished)
---- Files affected:
packages/libutempter:
libutempter.spec (1.62 -> 1.63) , libutempter-lastlog.patch (NONE -> 1.1) (NEW), libutempter-utmp-cleanup.patch (NONE -> 1.1) (NEW), utempter-64bit_timeval.patch (1.1 -> NONE) (REMOVED), utempter-lastlog.patch (1.1 -> NONE) (REMOVED), utempter-utmp-cleanup.patch (1.2 -> NONE) (REMOVED)
---- Diffs:
================================================================
Index: packages/libutempter/libutempter.spec
diff -u packages/libutempter/libutempter.spec:1.62 packages/libutempter/libutempter.spec:1.63
--- packages/libutempter/libutempter.spec:1.62 Tue Sep 21 13:47:57 2010
+++ packages/libutempter/libutempter.spec Tue Sep 21 14:19:31 2010
@@ -5,23 +5,25 @@
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
@@ -61,6 +63,7 @@
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Obsoletes: libutempter0-devel
+Obsoletes: utempter-devel
%description devel
Header file for utempter library.
@@ -72,19 +75,21 @@
%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
@@ -128,181 +133,7 @@
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
-Revision 1.62 2010/09/21 11:47:57 baggins
-- rel 10
-- added type size fix for utmpx.ut_tv by Adam Osuchowski <adwol * zonk.pl>
+Revision 1.63 2010/09/21 12:19:31 arekm
+- replacement for utempter (unfinished)
-Revision 1.61 2008/11/19 02:36:44 glen
-- release 9
-Revision 1.60 2007/09/05 13:44:37 baggins
-- rel 8
-
-Revision 1.59 2007/02/12 22:09:19 glen
-- tabs in preamble
-
-Revision 1.58 2007/02/12 01:06:35 baggins
-- converted to UTF-8
-
-Revision 1.57 2006/11/08 08:15:52 qboosh
-- added groupadd/groupdel deps
-
-Revision 1.56 2006/11/07 06:21:52 glen
-- create utmp group by our own, not to depend on SysVinit just for group(utmp); rel 7
-
-Revision 1.55 2005/12/03 02:18:27 glen
-- rel 6
-
-Revision 1.54 2005/07/12 18:31:48 qboosh
-- use modern chown syntax, cosmetics
-
-Revision 1.53 2005/07/12 17:16:30 glen
-- create utmpx in %post, so no reboot is needed for file to be created
- (consider cases when admin boots from livecd and starts installing pld over ssh)
-
-Revision 1.52 2005/05/13 16:53:11 baggins
-- release 5
-- prereq group(utmp) instead of SysVinit
-
-Revision 1.51 2004/09/29 17:34:16 undefine
-- fix user, utmp is not needed..
-
-Revision 1.50 2004/09/29 17:33:40 undefine
-- release 4 for AC
-
-Revision 1.49 2004/09/29 17:31:42 undefine
-- don't give sgid to utmp-cleanup! it allow clean utmp files for anybody...
- and with restricted proc simply clean all entries
-- release 3 (for RA)
-
-Revision 1.48 2004/06/07 18:19:50 blues
-- release 2
-
-Revision 1.47 2004/05/13 17:16:00 pluto
-- updated to 0.5.5.
-
-Revision 1.46 2004/04/20 09:20:27 qboosh
-- strict internal deps, fixed -devel desc
-
-Revision 1.45 2004/04/20 09:11:21 qboosh
-- added path-sec patch (fixes CAN-2004-0233); release 2
-
-Revision 1.44 2003/12/20 13:42:12 qboosh
-- acc. to included spec it's dual-licensed now (MIT/LGPL)
-- don't include autogenerated symlink
-
-Revision 1.43 2003/12/18 22:37:19 arekm
-- updated to 0.5.3 (tarball from fedora)
-
-Revision 1.42 2003/08/30 22:45:40 mmazur
-- rel 10 for ac
-
-Revision 1.41 2003/05/25 11:01:15 malekith
-- massive attack, adding Source-md5
-
-Revision 1.40 2003/05/25 06:27:35 misi3k
-- massive attack s/pld.org.pl/pld-linux.org/
-
-Revision 1.39 2002/06/15 12:19:10 undefine
-- release 9.
-
-Revision 1.38 2002/05/31 21:00:30 undefine
-- add utempter-utmp-cleanup.patch which add utmp-cleanup program to clean
- utmp base (by Andrzej Szombierski<anszom at v-lo.krakow.pl>)
-- release 8.1
-
-Revision 1.37 2002/04/10 21:43:47 kloczek
-- libutempter0{,-devel} added to Obsoletes for allow upgrade from MDK.
-
-Revision 1.36 2002/04/10 21:42:13 kloczek
-- release 8: merge translations from KSI and Conectiva.
-
-Revision 1.35 2002/02/22 23:29:50 kloczek
-- removed all Group fields translations (oure rpm now can handle translating
- Group field using gettext).
-
-Revision 1.34 2002/02/18 13:02:30 gotar
-- removed Prereq: /sbin/ldconfig (glibc content).
-
-Revision 1.33 2002/01/18 02:15:16 kloczek
-- perl -pi -e "s/pld-list\@pld.org.pl/feedback\@pld.org.pl/"
-
-Revision 1.32 2001/11/29 23:53:35 gotar
-- %description changes/adds.
-
-Revision 1.31 2001/11/24 02:11:30 kloczek
-- release 6.
-
-Revision 1.30 2001/10/30 23:10:57 qboosh
-- adapterized, cosmetics, fixed spelling, added reaining pl translations
-
-Revision 1.29 2001/10/30 18:34:16 gotar
-- some useless cosmetics.
-
-Revision 1.28 2001/05/27 17:07:05 kloczek
-- release 5.
-
-Revision 1.27 2001/05/03 01:14:04 qboosh
-- adapterized and made spec %debug ready or added using %rpm*flags macros
-
-Revision 1.26 2000/06/09 07:24:01 kloczek
-- added using %{__make} macro.
-
-Revision 1.25 2000/06/07 04:41:53 kloczek
-- spec adapterized.
-
-Revision 1.24 2000/05/10 17:37:48 kloczek
-- release 3 (to allow upgrade from RH 6.2).
-
-Revision 1.23 2000/05/09 14:52:05 baggins
-- updated to 0.5.2
-- added patch for lastlog logging
-
-Revision 1.22 2000/04/25 19:36:49 zagrodzki
-- removed almost everything from %post
-
-Revision 1.21 2000/04/25 19:18:08 zagrodzki
-- Prereq: make, fileutils
-
-Revision 1.20 2000/04/15 15:27:21 mis
-- moved creation of utmp group to SysVinit (to avoid requirements loop)
-
-Revision 1.19 2000/04/01 11:15:50 zagrodzki
-- changed all BuildRoot definitons
-- removed all applnkdir defs
-- changed some prereqs/requires
-- removed duplicate empty lines
-
-Revision 1.18 2000/03/28 16:55:08 baggins
-- translated kloczkish into english
-
-Revision 1.17 1999/12/15 21:05:08 kloczek
-- release 4,
-- added "rm -f /var/run/utmp" in %post.
-
-Revision 1.16 1999/12/02 12:28:20 kloczek
-- updated to 0.5.1,
-- changed permission on sgid binary to 2755.
-
-Revision 1.15 1999/08/01 23:07:27 kloczek
-- fixed groupadd parameters.
-
-Revision 1.14 1999/08/01 23:05:35 kloczek
-- ops: /sbin/ldconfig can not be runed as -p parameter,
-- Prereq: /sbin/ldconfig rules added.
-
-Revision 1.13 1999/08/01 23:01:01 kloczek
-- more utmpx -> utmp group fixes.
-
-Revision 1.12 1999/08/01 22:55:43 kloczek
-- utmpx group changed to utmp (for compatybility with RH).
-
-Revision 1.11 1999/08/01 22:52:55 kloczek
-- /sbin/ldconfig as %post -p parameter,
-- cosmetics.
-
-Revision 1.10 1999/07/18 14:53:24 baggins
-- fixed bogus Group: field
-
-Revision 1.9 1999/07/12 23:06:16 kloczek
-- added using CVS keywords in %changelog (for automating them).
================================================================
Index: packages/libutempter/libutempter-lastlog.patch
diff -u /dev/null packages/libutempter/libutempter-lastlog.patch:1.1
--- /dev/null Tue Sep 21 14:19:37 2010
+++ packages/libutempter/libutempter-lastlog.patch Tue Sep 21 14:19:31 2010
@@ -0,0 +1,43 @@
+--- 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__)
+
================================================================
Index: packages/libutempter/libutempter-utmp-cleanup.patch
diff -u /dev/null packages/libutempter/libutempter-utmp-cleanup.patch:1.1
--- /dev/null Tue Sep 21 14:19:37 2010
+++ packages/libutempter/libutempter-utmp-cleanup.patch Tue Sep 21 14:19:31 2010
@@ -0,0 +1,95 @@
+--- 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
+
+-TARGETS = $(PROJECT) $(SHAREDLIB) $(STATICLIB)
++TARGETS = $(PROJECT) $(SHAREDLIB) $(STATICLIB) utmp-cleanup
+
+ 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) $(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
+@@ -0,0 +1,69 @@
++#include <unistd.h>
++#include <fcntl.h>
++#include <stdio.h>
++#include <utmp.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#include <pwd.h>
++
++int check_entry(struct utmp * ut)
++{
++char buf[100];
++struct stat st;
++struct passwd * pwd;
++int s;
++
++pwd=getpwnam(ut->ut_user);
++ if(!pwd)return 1;
++
++snprintf(buf,100,"/proc/%d/",ut->ut_pid);
++s=stat(buf,&st);
++ if(s)return 2;
++
++ if(st.st_uid!=pwd->pw_uid && st.st_uid!=0)return 3;
++return 0;
++}
++
++char * msgs[]={"","Nonexistent user","Dead process","Owner mismatch"};
++
++int main(int ac, char ** av)
++{
++int clean=1;
++int justcheck=0;
++int fd;
++char * file="/var/run/utmpx";
++ if(ac>1)file=av[1];
++fd=open(file,O_RDWR,0);
++ if(fd<0){
++ fd=open(file,O_RDONLY,0);
++ justcheck=1;
++ printf("Warning: opening %s read-only\n",file);
++ }
++
++ if(fd<0){
++ perror("open"); exit(1);
++ }
++
++ while(1){
++ struct utmp ut;
++ int r=read(fd,&ut,sizeof(ut));
++ if(r!=sizeof(ut))break;
++
++ if(ut.ut_type==USER_PROCESS){
++ int i;
++ if((i=check_entry(&ut))){
++ clean=0;
++ printf("%s: %d (%s)\n",msgs[i],ut.ut_pid,ut.ut_name);
++ if(justcheck)continue;
++ lseek(fd,-sizeof(ut),SEEK_CUR);
++ bzero(&ut,sizeof(ut));
++ ut.ut_type=DEAD_PROCESS;
++ write(fd,&ut,sizeof(ut));
++ }
++ }
++
++ }
++
++ if(clean)printf("%s is clean\n",file);
++return 0;
++}
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/libutempter/libutempter.spec?r1=1.62&r2=1.63&f=u
More information about the pld-cvs-commit
mailing list