Arkadiusz Miskiewicz wrote:
> ... a jak się komuś chce to rm -rf utempter i dokończyć libutempter.spec

Trochę poprawione pliki w załączniku (przynajmniej się kompiluje).
# $Revision: 1.63 $, $Date: 2010/09/21 12:19:31 $
Summary:        Privileged helper for utmpx updates
Summary(es.UTF-8):      Programa para actualizaciĂłn del utmp/wtmp
Summary(pl.UTF-8):      Program pozwalający na zapisywanie w utmpx
Summary(pt_BR.UTF-8):   Programa para atualização do utmp/wtmp
Summary(ru.UTF-8):      Привилегированная программа 
для изменений в utmp/wtmp
Summary(uk.UTF-8):      Привілейована програма для 
внесення змін до utmp/wtmp
%define utempter_compat_ver     0.5.5
Name:           libutempter
Version:        1.1.5
Release:        0.1
License:        MIT or LGPL
Group:          Base
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
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
Utempter is a utility which allows programs to log information to a
privileged file (/var/run/utmpx), without compromising system
security. It accomplishes this task by acting as a buffer between root
and the programs.

%description -l es.UTF-8
Programa para actualizaciĂłn del utmp/wtmp.

%description -l pl.UTF-8
Utempter jest programem pozwalającym użytkownikom na zapisywanie do
pliku /var/run/utmpx bez naruszania bezpieczeństwa systemu.

%description -l pt_BR.UTF-8
O Utempter Ê um utilitårios que permite a programas guardar informação
à arquivos privilegiados (/var/run/utmp), sem comprometer a segurança
do sistema. Ele faz esta tarefa atuando como um "buffer" entre o
usuĂĄrio root e os programas.

%description -l ru.UTF-8
Utempter - это утилита, которая позволяет 
программам записывать
информацию в привилегированный файл 
(/var/run/utmp) без нарушения
системной безопасности. Она исполняет эту 
задачу, выступая буфером
между root'ом и пользовательскими 
программами.

%description -l uk.UTF-8
Utempter - це утиліта, що дозволяє програмам 
записувати інформацію в
привілейований файл (/var/run/utmp) без порушення 
системної безпеки.
Вона виконує цю задачу, виступаючи буфером 
між root'ом та програмами
користувача.

%package devel
Summary:        Header file for utempter library
Summary(pl.UTF-8):      Plik nagłówkowy biblioteki utemptera
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}
Obsoletes:      libutempter0-devel
Obsoletes:      utempter-devel

%description devel
Header file for utempter library.

%description devel -l pl.UTF-8
Plik nagłówkowy biblioteki utemptera.

%package static
Summary:        Static utempter library
Summary(pl.UTF-8):      Statyczna biblioteka utemptera
Group:          Development/Libraries
Requires:       %{name}-devel = %{version}-%{release}

%description static
Static utempter library.

%description static -l pl.UTF-8
Statyczna biblioteka utemptera

%prep
%setup -q
%patch0 -p1
%patch1 -p1

%build
%{__make} \
        CC="%{__cc}" \
        RPM_OPT_FLAGS="%{rpmcppflags} %{rpmcflags}" \
        libdir="%{_libdir}" \
        libexecdir="%{_libexecdir}"

%install
rm -rf $RPM_BUILD_ROOT

%{__make} install \
        libdir="%{_libdir}" \
        libexecdir="%{_libexecdir}" \
        DESTDIR=$RPM_BUILD_ROOT

install -d $RPM_BUILD_ROOT%{_sbindir}
ln -s %{_libdir}/utempter/utempter $RPM_BUILD_ROOT%{_sbindir}
ln -s %{_libdir}/utempter/utmp-cleanup $RPM_BUILD_ROOT%{_sbindir}

install -d $RPM_BUILD_ROOT/var/run
:> $RPM_BUILD_ROOT/var/run/utmpx

%clean
rm -rf $RPM_BUILD_ROOT

%pre
%groupadd -g 22 utmp

%post
/sbin/ldconfig
if [ ! -f /var/run/utmpx ]; then
        umask 002
        touch /var/run/utmpx
        chown root:utmp /var/run/utmpx
        chmod 0664 /var/run/utmpx
fi

%postun
/sbin/ldconfig
if [ "$1" = "0" ]; then
        %groupremove utmp
fi

%files
%defattr(644,root,root,755)
%dir %{_libdir}/utempter
%attr(2755,root,utmp) %{_libdir}/utempter/utempter
%{_sbindir}/utempter
%attr(755,root,root) %{_libdir}/utempter/utmp-cleanup
%{_sbindir}/utmp-cleanup
%attr(755,root,root) %{_libdir}/lib*.so.*.*.*
%attr(755,root,root) %ghost %{_libdir}/lib*.so.0
%attr(664,root,utmp) %ghost /var/run/utmpx

%files devel
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/lib*.so
%{_includedir}/utempter.h

%files static
%defattr(644,root,root,755)
%{_libdir}/lib*.a

%define date    %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
%changelog
* %{date} PLD Team <[email protected]>
All persons listed below can be reached at <cvs_login>@pld-linux.org

$Log: libutempter.spec,v $
Revision 1.63  2010/09/21 12:19:31  arekm
- replacement for utempter (unfinished)


--- 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)getuid() * sizeof(ll)), SEEK_SET);
+               write(fd, &ll, sizeof(ll));
+               close(fd);
+       }
 
 #elif defined(__FreeBSD__)
 
_______________________________________________
pld-devel-pl mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-devel-pl

Odpowiedź listem elektroniczym