summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authormartin <martin@pkgsrc.org>2012-05-03 08:31:05 +0000
committermartin <martin@pkgsrc.org>2012-05-03 08:31:05 +0000
commitcbf95bd5713f2428ae415e71c813f9dc33b53325 (patch)
tree9d2581c5d98f3d311e0be891ba0f04fd5a09135a /security
parent743188f95f9eb9334ba8d7810f0867d1878b9ff8 (diff)
downloadpkgsrc-cbf95bd5713f2428ae415e71c813f9dc33b53325.tar.gz
Let the compiler handle the alignement for cached passwd entries, fixes
a bus error on sparc (since 64 bit time_t).
Diffstat (limited to 'security')
-rw-r--r--security/sudo/Makefile4
-rw-r--r--security/sudo/distinfo3
-rw-r--r--security/sudo/patches/patch-pwutil.c64
3 files changed, 68 insertions, 3 deletions
diff --git a/security/sudo/Makefile b/security/sudo/Makefile
index 465e1430381..49bdc6071c8 100644
--- a/security/sudo/Makefile
+++ b/security/sudo/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.134 2012/03/14 14:20:38 wiz Exp $
+# $NetBSD: Makefile,v 1.135 2012/05/03 08:31:05 martin Exp $
#
DISTNAME= sudo-1.7.8p1
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= security
MASTER_SITES= http://www.sudo.ws/dist/ \
ftp://ftp.sudo.ws/pub/sudo/ \
diff --git a/security/sudo/distinfo b/security/sudo/distinfo
index 3e33150cbe4..f5d44b9d058 100644
--- a/security/sudo/distinfo
+++ b/security/sudo/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.75 2011/11/01 15:09:17 taca Exp $
+$NetBSD: distinfo,v 1.76 2012/05/03 08:31:05 martin Exp $
SHA1 (sudo-1.7.8p1.tar.gz) = e5d9016b7d3a4449b724483fe165dc13198ce44c
RMD160 (sudo-1.7.8p1.tar.gz) = a89e0c2d709cc8d8cbe4360f3e08d7459bca0a4c
@@ -7,3 +7,4 @@ SHA1 (patch-aa) = 70aa1a1da2d0cd9c8c8d9cbeab747b85028511f7
SHA1 (patch-af) = 0dce4ebbc82ab644565f71e8f472c407ddbaabf5
SHA1 (patch-ag) = fe8409164b61bdb229ca81d391de96898436ea0b
SHA1 (patch-logging.c) = 26608d7423b77f71f17b37cc87f4b2e75978d7cb
+SHA1 (patch-pwutil.c) = 6bc092fea6cd9e5e4c734e392cc4bb6e724b23bb
diff --git a/security/sudo/patches/patch-pwutil.c b/security/sudo/patches/patch-pwutil.c
new file mode 100644
index 00000000000..bd74dac2cb5
--- /dev/null
+++ b/security/sudo/patches/patch-pwutil.c
@@ -0,0 +1,64 @@
+$NetBSD: patch-pwutil.c,v 1.1 2012/05/03 08:31:05 martin Exp $
+
+# NetBSD uses 64bit time_t, even on 32bit architectures.
+# This makes struct passwd require 8 byte-alginement on, for example,
+# 32bit sparc. Curiously it all worked out naturally for sparc64 ;-)
+# To not add to the magic, let the compiler design proper alignement
+# by declaring a helper struct which holds the cache entry header as
+# well as struct passwd.
+
+--- pwutil.c.orig 2011-10-21 15:18:38.000000000 +0200
++++ pwutil.c 2012-05-03 10:05:28.000000000 +0200
+@@ -84,6 +84,16 @@
+ };
+
+ /*
++ * To give the compiler a chance to properly align things, we declare this
++ * dummy structure to ease our size/offset calculations.
++ */
++struct cache_and_passwd {
++ struct cache_item cache;
++ struct passwd pw;
++};
++
++
++/*
+ * Compare by uid.
+ */
+ static int
+@@ -144,6 +154,7 @@
+ size_t nsize, psize, csize, gsize, dsize, ssize, total;
+ struct cache_item *item;
+ struct passwd *newpw;
++ struct cache_and_passwd *cnp;
+
+ /* If shell field is empty, expand to _PATH_BSHELL. */
+ pw_shell = (pw->pw_shell == NULL || pw->pw_shell[0] == '\0')
+@@ -151,7 +162,7 @@
+
+ /* Allocate in one big chunk for easy freeing. */
+ nsize = psize = csize = gsize = dsize = ssize = 0;
+- total = sizeof(struct cache_item) + sizeof(struct passwd);
++ total = sizeof(struct cache_and_passwd);
+ FIELD_SIZE(pw, pw_name, nsize);
+ FIELD_SIZE(pw, pw_passwd, psize);
+ #ifdef HAVE_LOGIN_CAP_H
+@@ -168,15 +179,15 @@
+ /* Allocate space for struct item, struct passwd and the strings. */
+ if ((item = malloc(total)) == NULL)
+ return NULL;
+- cp = (char *) item + sizeof(struct cache_item);
++ cnp = (struct cache_and_passwd*)item;
+
+ /*
+ * Copy in passwd contents and make strings relative to space
+ * at the end of the buffer.
+ */
+- newpw = (struct passwd *) cp;
++ newpw = &cnp->pw;
+ memcpy(newpw, pw, sizeof(struct passwd));
+- cp += sizeof(struct passwd);
++ cp = (char*)&cnp[1];
+ FIELD_COPY(pw, newpw, pw_name, nsize);
+ FIELD_COPY(pw, newpw, pw_passwd, psize);
+ #ifdef HAVE_LOGIN_CAP_H