1 |
commit: c94180900d99e4deb4d47d21e92224e05d80be0f |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jun 20 20:41:40 2014 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jun 20 20:41:40 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=c9418090 |
7 |
|
8 |
sys-libs/libutempter: remove assumption that libc = glibc |
9 |
|
10 |
Package-Manager: portage-2.2.8-r1 |
11 |
Manifest-Sign-Key: 0xF52D4BBA |
12 |
|
13 |
--- |
14 |
.../libutempter-remove-glibc-assumption.patch | 81 ++++++++++++++++++++++ |
15 |
sys-libs/libutempter/libutempter-1.1.6-r99.ebuild | 72 +++++++++++++++++++ |
16 |
sys-libs/libutempter/metadata.xml | 6 ++ |
17 |
3 files changed, 159 insertions(+) |
18 |
|
19 |
diff --git a/sys-libs/libutempter/files/libutempter-remove-glibc-assumption.patch b/sys-libs/libutempter/files/libutempter-remove-glibc-assumption.patch |
20 |
new file mode 100644 |
21 |
index 0000000..6ed9335 |
22 |
--- /dev/null |
23 |
+++ b/sys-libs/libutempter/files/libutempter-remove-glibc-assumption.patch |
24 |
@@ -0,0 +1,81 @@ |
25 |
+diff -Naur libutempter-1.1.6.orig/utempter.c libutempter-1.1.6/utempter.c |
26 |
+--- libutempter-1.1.6.orig/utempter.c 2010-11-04 13:14:53.000000000 -0400 |
27 |
++++ libutempter-1.1.6/utempter.c 2014-06-20 16:37:09.762403323 -0400 |
28 |
+@@ -34,13 +34,7 @@ |
29 |
+ #include <sys/stat.h> |
30 |
+ #include <utmp.h> |
31 |
+ |
32 |
+-#ifdef __GLIBC__ |
33 |
+ # include <pty.h> |
34 |
+-#elif defined(__FreeBSD__) |
35 |
+-# include <libutil.h> |
36 |
+-#else |
37 |
+-# error Unsupported platform |
38 |
+-#endif /* __GLIBC__ || __FreeBSD__ */ |
39 |
+ |
40 |
+ #define DEV_PREFIX "/dev/" |
41 |
+ #define DEV_PREFIX_LEN (sizeof(DEV_PREFIX)-1) |
42 |
+@@ -106,17 +100,12 @@ |
43 |
+ |
44 |
+ static int |
45 |
+ write_uwtmp_record(const char *user, const char *term, const char *host, |
46 |
+-#ifdef __GLIBC__ |
47 |
+ pid_t pid, |
48 |
+-#endif |
49 |
+ int add) |
50 |
+ { |
51 |
+ struct utmp ut; |
52 |
+ struct timeval tv; |
53 |
+- |
54 |
+-#ifdef __GLIBC__ |
55 |
+ size_t offset; |
56 |
+-#endif |
57 |
+ |
58 |
+ memset(&ut, 0, sizeof(ut)); |
59 |
+ |
60 |
+@@ -128,8 +117,6 @@ |
61 |
+ if (host) |
62 |
+ strncpy(ut.ut_host, host, sizeof(ut.ut_host)); |
63 |
+ |
64 |
+-#ifdef __GLIBC__ |
65 |
+- |
66 |
+ offset = (strlen(term) <= sizeof(ut.ut_id)) ? 0 : |
67 |
+ strlen(term) - sizeof(ut.ut_id); |
68 |
+ strncpy(ut.ut_id, term + offset, sizeof(ut.ut_id)); |
69 |
+@@ -156,27 +143,6 @@ |
70 |
+ |
71 |
+ (void) updwtmp(_PATH_WTMP, &ut); |
72 |
+ |
73 |
+-#elif defined(__FreeBSD__) |
74 |
+- |
75 |
+- ut.ut_time = tv.tv_sec; |
76 |
+- |
77 |
+- if (add) |
78 |
+- { |
79 |
+- login(&ut); |
80 |
+- } else |
81 |
+- { |
82 |
+- if (logout(term) != 1) |
83 |
+- { |
84 |
+-#ifdef UTEMPTER_DEBUG |
85 |
+- fprintf(stderr, "utempter: logout: %s\n", |
86 |
+- strerror(errno)); |
87 |
+-#endif |
88 |
+- exit(EXIT_FAILURE); |
89 |
+- } |
90 |
+- } |
91 |
+- |
92 |
+-#endif /* __GLIBC__ || __FreeBSD__ */ |
93 |
+- |
94 |
+ #ifdef UTEMPTER_DEBUG |
95 |
+ fprintf(stderr, |
96 |
+ "utempter: DEBUG: utmp/wtmp record %s for terminal '%s'\n", |
97 |
+@@ -255,8 +221,6 @@ |
98 |
+ validate_device(device); |
99 |
+ |
100 |
+ return write_uwtmp_record(pw->pw_name, device + DEV_PREFIX_LEN, host, |
101 |
+-#ifdef __GLIBC__ |
102 |
+ pid, |
103 |
+-#endif |
104 |
+ add); |
105 |
+ } |
106 |
|
107 |
diff --git a/sys-libs/libutempter/libutempter-1.1.6-r99.ebuild b/sys-libs/libutempter/libutempter-1.1.6-r99.ebuild |
108 |
new file mode 100644 |
109 |
index 0000000..65dcc7c |
110 |
--- /dev/null |
111 |
+++ b/sys-libs/libutempter/libutempter-1.1.6-r99.ebuild |
112 |
@@ -0,0 +1,72 @@ |
113 |
+# Copyright 1999-2014 Gentoo Foundation |
114 |
+# Distributed under the terms of the GNU General Public License v2 |
115 |
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/libutempter/libutempter-1.1.6-r2.ebuild,v 1.1 2014/05/06 12:52:04 chainsaw Exp $ |
116 |
+ |
117 |
+EAPI="4" |
118 |
+ |
119 |
+inherit eutils user multilib flag-o-matic |
120 |
+ |
121 |
+DESCRIPTION="Library that allows non-privileged apps to write utmp (login) info, which need root access" |
122 |
+HOMEPAGE="http://altlinux.org/index.php?module=sisyphus&package=libutempter" |
123 |
+SRC_URI="ftp://ftp.altlinux.org/pub/people/ldv/${PN}/${P}.tar.bz2" |
124 |
+ |
125 |
+LICENSE="LGPL-2.1" |
126 |
+SLOT="0" |
127 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux" |
128 |
+IUSE="static-libs elibc_FreeBSD" |
129 |
+ |
130 |
+RDEPEND="!sys-apps/utempter" |
131 |
+ |
132 |
+pkg_setup() { |
133 |
+ enewgroup utmp 406 |
134 |
+} |
135 |
+ |
136 |
+src_prepare() { |
137 |
+ local args=( |
138 |
+ -e "/^libdir /s:/usr/lib:${EPREFIX}/usr/$(get_libdir):" |
139 |
+ -e '/^libexecdir /s:=.*:= $(libdir)/misc:' |
140 |
+ -e '/^CFLAGS = $(RPM_OPT_FLAGS)/d' |
141 |
+ -e 's:,-stats::' |
142 |
+ -e "/^includedir /s:/usr/include:${EPREFIX}/usr/include:" |
143 |
+ -e "/^mandir /s:=.*:= ${EPREFIX}/usr/share/man:" |
144 |
+ ) |
145 |
+ use static-libs || args+=( |
146 |
+ -e '/^STATICLIB/d' |
147 |
+ -e '/INSTALL.*STATICLIB/d' |
148 |
+ ) |
149 |
+ sed -i "${args[@]}" Makefile || die |
150 |
+ |
151 |
+ epatch "${FILESDIR}"/${PN}-remove-glibc-assumption.patch |
152 |
+} |
153 |
+ |
154 |
+src_configure() { |
155 |
+ use elibc_FreeBSD && append-libs -lutil |
156 |
+ tc-export AR CC |
157 |
+} |
158 |
+ |
159 |
+src_compile() { |
160 |
+ emake LDLIBS="${LIBS}" |
161 |
+} |
162 |
+ |
163 |
+src_install() { |
164 |
+ default |
165 |
+ |
166 |
+ if ! use prefix ; then |
167 |
+ fowners root:utmp /usr/$(get_libdir)/misc/utempter/utempter |
168 |
+ fperms 2755 /usr/$(get_libdir)/misc/utempter/utempter |
169 |
+ fi |
170 |
+ dodir /usr/sbin |
171 |
+ dosym ../$(get_libdir)/misc/utempter/utempter /usr/sbin/utempter |
172 |
+} |
173 |
+ |
174 |
+pkg_postinst() { |
175 |
+ if [ -f "${EROOT}/var/log/wtmp" ] ; then |
176 |
+ chown root:utmp "${EROOT}/var/log/wtmp" |
177 |
+ chmod 664 "${EROOT}/var/log/wtmp" |
178 |
+ fi |
179 |
+ |
180 |
+ if [ -f "${EROOT}/var/run/utmp" ] ; then |
181 |
+ chown root:utmp "${EROOT}/var/run/utmp" |
182 |
+ chmod 664 "${EROOT}/var/run/utmp" |
183 |
+ fi |
184 |
+} |
185 |
|
186 |
diff --git a/sys-libs/libutempter/metadata.xml b/sys-libs/libutempter/metadata.xml |
187 |
new file mode 100644 |
188 |
index 0000000..5aafc10 |
189 |
--- /dev/null |
190 |
+++ b/sys-libs/libutempter/metadata.xml |
191 |
@@ -0,0 +1,6 @@ |
192 |
+<?xml version="1.0" encoding="UTF-8"?> |
193 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
194 |
+<pkgmetadata> |
195 |
+ <herd>base-system</herd> |
196 |
+ <herd>x11</herd> |
197 |
+</pkgmetadata> |