summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-libs/nss-db
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-libs/nss-db')
-rw-r--r--sys-libs/nss-db/Manifest4
-rw-r--r--sys-libs/nss-db/files/db3.patch43
-rw-r--r--sys-libs/nss-db/files/nss-db-2.2.3_pre1-root-upgrade-only.patch27
-rw-r--r--sys-libs/nss-db/files/nss-db-2.2.3_pre1-symlinkvuln.patch262
-rw-r--r--sys-libs/nss-db/files/remake-all-db6
-rw-r--r--sys-libs/nss-db/files/sandbox.d_50nss-db1
-rw-r--r--sys-libs/nss-db/metadata.xml5
-rw-r--r--sys-libs/nss-db/nss-db-2.2.3_pre1-r2.ebuild107
-rw-r--r--sys-libs/nss-db/nss-db-2.2.3_pre1-r3.ebuild111
-rw-r--r--sys-libs/nss-db/nss-db-2.2.3_pre1-r4.ebuild112
10 files changed, 678 insertions, 0 deletions
diff --git a/sys-libs/nss-db/Manifest b/sys-libs/nss-db/Manifest
new file mode 100644
index 000000000000..6415d1c5c6d5
--- /dev/null
+++ b/sys-libs/nss-db/Manifest
@@ -0,0 +1,4 @@
+DIST nss_db-2.2.3pre1-dbopen.patch.bz2 258 SHA256 9d7bf1ef17ca91c59c234bfa96d4b9e3f866a792c609a02cc6d9daa601dee1d3 SHA512 59c9c375150f217e5d98d6f12cde5f9227a4734721b1352bd8bae33579bccfc208cfe43af57e20081a25fb7c32b5926fe0344a16fab497cb7a0de0a2b37c9a60 WHIRLPOOL f1dfc1355bc6f40cbf3414665cf3704e751db56376d8e26dec64f59505ca224e87889064997201c9a3b135167819ca292731e51bdef7baf692fbf69560157639
+DIST nss_db-2.2.3pre1-dbupgrade.patch.bz2 263 SHA256 31052eb79cc4aa60f639a3a57d9225630327ee6c728d62eda1d9c91ea7d70dc3 SHA512 f3c787d2ccec66039e2af08d18f69890192aa95670c9e26066d94249f1f6f3a3f2df17c35b6ba214f9ac9522642c3adce8a9bea98562f33efc907b16334c2512 WHIRLPOOL 73cda93849598dd9b3b86a391dbab7679358eb4084f82d723a58812726c2c9215c7636aeef3756ea0e129efd5fb7d90b4193f2428b094cc5790e946f091a5313
+DIST nss_db-2.2.3pre1-external.patch.bz2 1870 SHA256 dbc45a4dc7c977fae2193e0a14fdb862a5f42479ac40da0d4772d5d66e95ade0 SHA512 6f1c6ed373130c9fa5e4ba7c57d110f42be235b20a30f2fe971de09f8be255e59ac319bd95cc46af50f0ce11e0af482f496cdd6db2318028ad2e7ac2ed4fdc3e WHIRLPOOL de050b229134d60d1c24efdff36c0625b7ffc8f256521a2f3380c6a4dcf3e136e99df5ae41319a7e3a1626477c84dabdfd463cf7aa7f6c41003fd62ce3641092
+DIST nss_db-2.2.3pre1.tar.gz 235360 SHA256 0c5d677a49c7bf6b9318bf40adf335839a668d1c7509e9b1915bd22a9e0ac694 SHA512 f8839cd0bea11e349be1afd7189560993b320d33f9c70da25c8aae03bae91cd6a48b597462d636021cf0e4e477c2bdb37952100bc6b871049c2650d5ee7853ae WHIRLPOOL 3695650757a9f6c5b3cd28f866c0bd0334d686aac2770b1567d0be9658797b32e3bdc4a5e3774fadddbffd9e9eedf40b6eb86058e1b0789dad6925275ccde0a0
diff --git a/sys-libs/nss-db/files/db3.patch b/sys-libs/nss-db/files/db3.patch
new file mode 100644
index 000000000000..2da6ecbd5550
--- /dev/null
+++ b/sys-libs/nss-db/files/db3.patch
@@ -0,0 +1,43 @@
+diff -u nss_db-2.2.orig/configure.in nss_db-2.2/configure.in
+--- nss_db-2.2.orig/configure.in 2003-06-27 11:41:13.000000000 +0200
++++ nss_db-2.2/configure.in 2003-06-27 11:44:30.000000000 +0200
+@@ -43,22 +43,28 @@
+ AC_CHECK_HEADER(db.h,, AC_MSG_ERROR([
+ *** Could not find Berkeley DB headers.]))
+
+-AC_CHECK_LIB(db, db_version,, AC_MSG_ERROR([
++
++AC_CHECK_LIB(db-3, db_version,,
++ AC_CHECK_LIB(db, db_version,,AC_MSG_ERROR([
+ *** Could not find Berkeley DB library.]))
++)
+
+ AC_CACHE_CHECK([Berkeley DB version], nss_db_cv_db_version,
+ [AC_TRY_CPP(
+ [
+-# include <db.h>
+-# ifndef DB_VERSION_STRING
+-# error "Unknown"
+-# endif
+-# if DB_VERSION_MAJOR < 2
+-# error "Too old"
+-# endif
+-# if DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR < 4
+-# error "Too old"
+-# endif
++ include <db.h>
++ ifndef DB_VERSION_STRING
++ error "Unknown"
++ endif
++ if DB_VERSION_MAJOR < 2
++ error "Too old"
++ endif
++ if DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR < 4
++ error "Too old"
++ endif
++ if DB_VERSION_MAJOR >= 4
++ error "Too new"
++ endif
+ ],
+ nss_db_cv_db_version="ok",
+ nss_db_cv_db_version="not ok")
diff --git a/sys-libs/nss-db/files/nss-db-2.2.3_pre1-root-upgrade-only.patch b/sys-libs/nss-db/files/nss-db-2.2.3_pre1-root-upgrade-only.patch
new file mode 100644
index 000000000000..e2db2342e2a4
--- /dev/null
+++ b/sys-libs/nss-db/files/nss-db-2.2.3_pre1-root-upgrade-only.patch
@@ -0,0 +1,27 @@
+diff -NuarwbB nss_db-2.2.3pre1.orig/src/db-compat.c nss_db-2.2.3pre1/src/db-compat.c
+--- nss_db-2.2.3pre1.orig/src/db-compat.c 2005-06-07 00:08:39.000000000 -0700
++++ nss_db-2.2.3pre1/src/db-compat.c 2005-06-07 00:53:00.000000000 -0700
+@@ -20,6 +20,9 @@
+ #include <assert.h>
+ #include <db.h>
+ #include <fcntl.h>
++#include <unistd.h>
++#include <sys/types.h>
++
+
+ #if DB_VERSION_MAJOR > 2
+
+@@ -39,8 +42,13 @@
+ if (err)
+ return err;
+
++ uid_t uid = geteuid();
++
++ if(uid == 0) {
+ /* Make sure we upgrade, in case this is an older database */
++ /* However we need root access to do so */
+ db->upgrade(db, file, 0);
++ }
+
+ err = db->open (db, NULL, file, NULL, type, flags, mode);
+ if (err)
diff --git a/sys-libs/nss-db/files/nss-db-2.2.3_pre1-symlinkvuln.patch b/sys-libs/nss-db/files/nss-db-2.2.3_pre1-symlinkvuln.patch
new file mode 100644
index 000000000000..54a67b58499b
--- /dev/null
+++ b/sys-libs/nss-db/files/nss-db-2.2.3_pre1-symlinkvuln.patch
@@ -0,0 +1,262 @@
+diff -urNad libnss-db-2.2.3pre1~/src/db-XXX.c libnss-db-2.2.3pre1/src/db-XXX.c
+--- libnss-db-2.2.3pre1~/src/db-XXX.c 2010-03-30 10:41:48.026483855 -0700
++++ libnss-db-2.2.3pre1/src/db-XXX.c 2010-03-30 10:41:48.216484130 -0700
+@@ -56,6 +56,7 @@
+
+ /* Maintenance of the shared handle open on the database. */
+
++static DB_ENV *dbenv;
+ static DB *db;
+ static int keep_db;
+ static int entidx;
+@@ -69,7 +70,7 @@
+
+ pthread_mutex_lock (&lock);
+
+- status = internal_setent (DBFILE, &db);
++ status = internal_setent (DBFILE, &db, &dbenv);
+
+ /* Remember STAYOPEN flag. */
+ if (db != NULL)
+@@ -89,7 +90,7 @@
+ {
+ pthread_mutex_lock (&lock);
+
+- internal_endent (&db);
++ internal_endent (&db, &dbenv);
+
+ /* Reset STAYOPEN flag. */
+ keep_db = 0;
+@@ -112,7 +113,7 @@
+ /* Open the database. */
+ if (db == NULL)
+ {
+- status = internal_setent (DBFILE, &db);
++ status = internal_setent (DBFILE, &db, &dbenv);
+ if (status != NSS_STATUS_SUCCESS)
+ {
+ *errnop = errno;
+@@ -194,7 +195,7 @@
+ }
+
+ if (! keep_db)
+- internal_endent (&db);
++ internal_endent (&db, &dbenv);
+
+ return status;
+ }
+diff -urNad libnss-db-2.2.3pre1~/src/db-alias.c libnss-db-2.2.3pre1/src/db-alias.c
+--- libnss-db-2.2.3pre1~/src/db-alias.c 2010-03-30 10:41:47.996483420 -0700
++++ libnss-db-2.2.3pre1/src/db-alias.c 2010-03-30 10:41:48.216484130 -0700
+@@ -34,6 +34,7 @@
+
+ /* Maintenance of the shared handle open on the database. */
+
++static DB_ENV *dbenv;
+ static DB *db;
+ static int keep_db;
+ static unsigned int entidx; /* Index for `getaliasent_r'. */
+@@ -47,7 +48,7 @@
+
+ pthread_mutex_lock (&lock);
+
+- status = internal_setent (_PATH_VARDB "aliases.db", &db);
++ status = internal_setent (_PATH_VARDB "aliases.db", &db, &dbenv);
+
+ /* Remember STAYOPEN flag. */
+ if (db != NULL)
+@@ -68,7 +69,7 @@
+ {
+ pthread_mutex_lock (&lock);
+
+- internal_endent (&db);
++ internal_endent (&db, &dbenv);
+
+ /* Reset STAYOPEN flag. */
+ keep_db = 0;
+@@ -92,7 +93,7 @@
+ /* Open the database. */
+ if (db == NULL)
+ {
+- status = internal_setent (_PATH_VARDB "aliases.db", &db);
++ status = internal_setent (_PATH_VARDB "aliases.db", &db, &dbenv);
+ if (status != NSS_STATUS_SUCCESS)
+ {
+ *errnop = errno;
+@@ -165,7 +166,7 @@
+ status = NSS_STATUS_NOTFOUND;
+
+ if (! keep_db)
+- internal_endent (&db);
++ internal_endent (&db, &dbenv);
+
+ return status;
+ }
+diff -urNad libnss-db-2.2.3pre1~/src/db-compat.c libnss-db-2.2.3pre1/src/db-compat.c
+--- libnss-db-2.2.3pre1~/src/db-compat.c 2010-03-30 10:41:47.956483550 -0700
++++ libnss-db-2.2.3pre1/src/db-compat.c 2010-03-30 10:41:48.216484130 -0700
+@@ -27,15 +27,14 @@
+
+ int
+ db_open (const char *file, DBTYPE type, u_int32_t flags, int mode,
+- void *dbenv, void *dbinfo, DB **dbp)
++ DB_ENV *dbenv, void *dbinfo, DB **dbp)
+ {
+ DB *db;
+ int err;
+
+- assert (dbenv == NULL);
+ assert (dbinfo == NULL);
+
+- err = db_create (&db, NULL, 0);
++ err = db_create (&db, dbenv, 0);
+ if (err)
+ return err;
+
+diff -urNad libnss-db-2.2.3pre1~/src/db-compat.h libnss-db-2.2.3pre1/src/db-compat.h
+--- libnss-db-2.2.3pre1~/src/db-compat.h 2001-04-29 18:07:41.000000000 -0700
++++ libnss-db-2.2.3pre1/src/db-compat.h 2010-03-30 10:41:48.216484130 -0700
+@@ -2,5 +2,5 @@
+
+ #if DB_VERSION_MAJOR > 2
+ extern int db_open (const char *__file, DBTYPE __type, u_int32_t __flags,
+- int __mode, void *__dbenv, void *__dbinfo, DB **__dbp);
++ int __mode, DB_ENV *dbenv, void *__dbinfo, DB **__dbp);
+ #endif
+diff -urNad libnss-db-2.2.3pre1~/src/db-netgrp.c libnss-db-2.2.3pre1/src/db-netgrp.c
+--- libnss-db-2.2.3pre1~/src/db-netgrp.c 2010-03-30 10:41:47.996483420 -0700
++++ libnss-db-2.2.3pre1/src/db-netgrp.c 2010-03-30 10:41:48.216484130 -0700
+@@ -35,6 +35,7 @@
+ static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
+ /* Maintenance of the shared handle open on the database. */
++static DB_ENV *dbenv;
+ static DB *db;
+ static char *entry;
+ static char *cursor;
+@@ -46,7 +47,7 @@
+
+ pthread_mutex_lock (&lock);
+
+- status = internal_setent (DBFILE, &db);
++ status = internal_setent (DBFILE, &db, &dbenv);
+
+ if (status == NSS_STATUS_SUCCESS)
+ {
+@@ -72,7 +73,7 @@
+ {
+ pthread_mutex_lock (&lock);
+
+- internal_endent (&db);
++ internal_endent (&db, &dbenv);
+
+ pthread_mutex_unlock (&lock);
+
+diff -urNad libnss-db-2.2.3pre1~/src/db-open.c libnss-db-2.2.3pre1/src/db-open.c
+--- libnss-db-2.2.3pre1~/src/db-open.c 2010-03-30 10:41:47.996483420 -0700
++++ libnss-db-2.2.3pre1/src/db-open.c 2010-03-30 10:42:24.127733451 -0700
+@@ -21,6 +21,9 @@
+ #include <db.h>
+ #include <errno.h>
+ #include <fcntl.h>
++#include <stdlib.h>
++#include <string.h>
++#include <libgen.h>
+
+ #include "db-compat.h"
+
+@@ -45,35 +48,46 @@
+ handle in *DBP and return NSS_STATUS_SUCCESS. On failure, return
+ the appropriate lookup status. */
+ enum nss_status
+-internal_setent (const char *file, DB **dbp)
++internal_setent (const char *file, DB **dbp, DB_ENV **dbenvp)
+ {
+- DB *db;
++ char *filecopy = NULL, *home;
++ DB_ENV *dbenv = NULL;
++ DB *db = NULL;
+ int err;
+ int fd;
+
+ if (*dbp)
+ return NSS_STATUS_SUCCESS;
+
+- err = db_open (file, DB_BTREE, DB_RDONLY, 0, NULL, NULL, &db);
++ err = db_env_create(&dbenv, 0);
+ if (err != 0)
+- {
+- if (err > 0)
+- errno = err;
+- return NSS_STATUS_UNAVAIL;
+- }
++ goto fail;
++ filecopy = strdup(file);
++ home = dirname(filecopy);
++ err = dbenv->open(dbenv, home, DB_INIT_MPOOL | DB_CREATE | DB_PRIVATE, 0);
++ if (err != 0)
++ goto fail_env;
++ err = db_open (file, DB_BTREE, DB_RDONLY, 0, dbenv, NULL, &db);
++ if (err != 0)
++ goto fail_env;
+
+ /* We have to make sure the file is `closed on exec'. */
+ err = db->fd (db, &fd);
+ if (err)
+- goto fail;
++ goto fail_db;
+ if (set_cloexec_flag (fd) < 0)
+- goto fail;
++ goto fail_db;
+
++ *dbenvp = dbenv;
+ *dbp = db;
+ return NSS_STATUS_SUCCESS;
+
+- fail:
++ fail_db:
+ db->close (db, 0);
++ fail_env:
++ dbenv->close (dbenv, 0);
++ fail:
++ if (filecopy) free(filecopy);
+ if (err > 0)
+ errno = err;
+ return NSS_STATUS_UNAVAIL;
+@@ -81,8 +95,9 @@
+
+ /* Close the database *DBP. */
+ void
+-internal_endent (DB **dbp)
++internal_endent (DB **dbp, DB_ENV **dbenvp)
+ {
++ DB_ENV *dbenv = *dbenvp;
+ DB *db = *dbp;
+
+ if (db != NULL)
+@@ -90,4 +105,9 @@
+ db->close (db, 0);
+ *dbp = NULL;
+ }
++ if (dbenv != NULL)
++ {
++ dbenv->close (dbenv, 0);
++ *dbenvp = NULL;
++ }
+ }
+diff -urNad libnss-db-2.2.3pre1~/src/nss_db.h libnss-db-2.2.3pre1/src/nss_db.h
+--- libnss-db-2.2.3pre1~/src/nss_db.h 2001-04-29 18:07:41.000000000 -0700
++++ libnss-db-2.2.3pre1/src/nss_db.h 2010-03-30 10:41:48.216484130 -0700
+@@ -26,9 +26,9 @@
+ /* Open the database stored in FILE. If succesful, store the database
+ handle in *DBP and return NSS_STATUS_SUCCESS. On failure, return
+ the appropriate lookup status. */
+-extern enum nss_status internal_setent (const char *file, DB **dbp);
++extern enum nss_status internal_setent (const char *file, DB **dbp, DB_ENV **dbenvp);
+
+ /* Close the database *DBP. */
+-extern void internal_endent (DB **dbp);
++extern void internal_endent (DB **dbp, DB_ENV **dbenvp);
+
+ #endif /* nss_db.h */
+
diff --git a/sys-libs/nss-db/files/remake-all-db b/sys-libs/nss-db/files/remake-all-db
new file mode 100644
index 000000000000..eab57a5e7ed8
--- /dev/null
+++ b/sys-libs/nss-db/files/remake-all-db
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Written by Robin H. Johnson <robbat2@gentoo.org>
+# 16 Feb 2004
+/usr/bin/make -f /usr/share/nss-db/db-Makefile all
diff --git a/sys-libs/nss-db/files/sandbox.d_50nss-db b/sys-libs/nss-db/files/sandbox.d_50nss-db
new file mode 100644
index 000000000000..f8cfba24dd74
--- /dev/null
+++ b/sys-libs/nss-db/files/sandbox.d_50nss-db
@@ -0,0 +1 @@
+SANDBOX_PREDICT="/var/db/aliases.db:/var/db/automount.db:/var/db/bootparams.db:/var/db/ethers.db:/var/db/group.db:/var/db/hosts.db:/var/db/netgroup.db:/var/db/netmasks.db:/var/db/networks.db:/var/db/passwd.db:/var/db/protocols.db:/var/db/rpc.db:/var/db/services.db:/var/db/shadow.db"
diff --git a/sys-libs/nss-db/metadata.xml b/sys-libs/nss-db/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-libs/nss-db/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-libs/nss-db/nss-db-2.2.3_pre1-r2.ebuild b/sys-libs/nss-db/nss-db-2.2.3_pre1-r2.ebuild
new file mode 100644
index 000000000000..75e9a7bd7922
--- /dev/null
+++ b/sys-libs/nss-db/nss-db-2.2.3_pre1-r2.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator multilib autotools
+
+MY_PN="${PN/-/_}"
+MY_PV="${PV/_}"
+MY_P="${MY_PN}-${MY_PV}"
+
+DESCRIPTION="Allows important system files to be stored in a fast database file rather than plain text"
+HOMEPAGE="http://sources.redhat.com/glibc/"
+SRC_URI="ftp://sources.redhat.com/pub/glibc/old-releases/${MY_P}.tar.gz
+ mirror://gentoo/${MY_P}-external.patch.bz2
+ mirror://gentoo/${MY_P}-dbupgrade.patch.bz2
+ mirror://gentoo/${MY_P}-dbopen.patch.bz2"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="nls"
+
+# awk and make ARE needed at runtime!
+# and this didn't compile on BSD libc either
+RDEPEND=">=sys-libs/db-4
+ sys-devel/make
+ >=sys-libs/glibc-2.3
+ !>=sys-libs/glibc-2.15"
+# We really do need gettext to compile always :-(
+DEPEND="${RDEPEND}
+ sys-devel/gettext"
+
+S="${WORKDIR}/${MY_P}"
+
+db_getver() {
+ local DBPKG
+ DBPKG="$(best_version '>=sys-libs/db-4')"
+ echo "${DBPKG//sys-libs\/db-}"
+}
+
+db_getversym() {
+ local DBVER DBSYMSUFFIX
+ [ -n "${1}" ] && DBVER="${1}" || DBVER="$(db_getver)"
+ DBVER=($(get_version_components "${DBVER}"))
+ if has_version '>=sys-libs/db-4.3'; then
+ DBSYMSUFFIX=""
+ else
+ let DBSYMSUFFIX=(${DBVER[0]}*1000)+${DBVER[1]}
+ DBSYMSUFFIX=_${DBSYMSUFFIX}
+ fi
+ echo "${DBSYMSUFFIX}"
+}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-external.patch.bz2
+ EPATCH_OPTS="-p0 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbupgrade.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbopen.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/${P}-root-upgrade-only.patch
+
+ # make sure we use the correct version of DB
+ cd "${S}"
+ DB_PV="$(db_getver)"
+ DB_SYM="$(db_getversym ${DB_PV})"
+ DB_PV_MAJORMINOR="$(get_version_component_range 1-2 ${DB_PV})"
+ sed -i configure.in \
+ -e "s!db.h!db${DB_PV_MAJORMINOR}/db.h!g" \
+ -e "s!db, db_version!db-${DB_PV_MAJORMINOR}, db_version${DB_SYM}!g"
+
+ # fix ancient broken-ness
+ for f in po/Makefile.in.in ./intl/Makefile.in; do
+ egrep -q '^mkinstalldirs = .*case.*esac' ${f} && \
+ sed -i ${f} \
+ -e '/^mkinstalldirs = /s,\(mkinstalldirs =\).*,\1 $(top_builddir)/./mkinstalldirs,'
+ done
+
+ # Fixes thanks to Flameeyes
+ cp /usr/share/gettext/config.rpath . # missing
+ sed -i -e '/makedb_LDADD/i makedb_CFLAGS=$(AM_CFLAGS)' src/Makefile.am
+ sed -i -e '/AC_PROG_CC/a AC_PROG_CC_C_O' configure.in
+ eautoreconf
+
+ # This is an evil target and we don't like it
+ sed -i -e '/^install-data-am:.*install-data-local/s,install-data-local,,g' "${S}"/src/Makefile.in
+}
+
+src_compile() {
+ econf -C --libdir=/$(get_libdir) `use_enable nls` || die
+ emake || die
+}
+
+src_install() {
+ emake -j1 DESTDIR="${D}" slibdir="/$(get_libdir)" install || \
+ die "failed emake install"
+
+ into /usr
+ insinto /usr/share/${PN}
+ doins db-Makefile
+
+ dosbin "${FILESDIR}"/remake-all-db
+
+ dodoc AUTHORS COPYING* ChangeLog INSTALL NEWS README THANKS
+
+ dodir /usr/$(get_libdir)/
+ mv "${D}"/$(get_libdir)/*.la "${D}"/usr/$(get_libdir)/ || \
+ die "failed to set up .la"
+}
diff --git a/sys-libs/nss-db/nss-db-2.2.3_pre1-r3.ebuild b/sys-libs/nss-db/nss-db-2.2.3_pre1-r3.ebuild
new file mode 100644
index 000000000000..69d8766567f6
--- /dev/null
+++ b/sys-libs/nss-db/nss-db-2.2.3_pre1-r3.ebuild
@@ -0,0 +1,111 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator multilib autotools
+
+MY_PN="${PN/-/_}"
+MY_PV="${PV/_}"
+MY_P="${MY_PN}-${MY_PV}"
+
+DESCRIPTION="Allows important system files to be stored in a fast database file rather than plain text"
+HOMEPAGE="http://sources.redhat.com/glibc/"
+SRC_URI="ftp://sources.redhat.com/pub/glibc/old-releases/${MY_P}.tar.gz
+ mirror://gentoo/${MY_P}-external.patch.bz2
+ mirror://gentoo/${MY_P}-dbupgrade.patch.bz2
+ mirror://gentoo/${MY_P}-dbopen.patch.bz2"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="nls"
+
+# awk and make ARE needed at runtime!
+# and this didn't compile on BSD libc either
+RDEPEND=">=sys-libs/db-4
+ sys-devel/make
+ >=sys-libs/glibc-2.3
+ !>=sys-libs/glibc-2.15"
+# We really do need gettext to compile always :-(
+DEPEND="${RDEPEND}
+ sys-devel/gettext"
+
+S="${WORKDIR}/${MY_P}"
+
+db_getver() {
+ local DBPKG
+ DBPKG="$(best_version '>=sys-libs/db-4')"
+ echo "${DBPKG//sys-libs\/db-}"
+}
+
+db_getversym() {
+ local DBVER DBSYMSUFFIX
+ [ -n "${1}" ] && DBVER="${1}" || DBVER="$(db_getver)"
+ DBVER=($(get_version_components "${DBVER}"))
+ if has_version '>=sys-libs/db-4.3'; then
+ DBSYMSUFFIX=""
+ else
+ let DBSYMSUFFIX=(${DBVER[0]}*1000)+${DBVER[1]}
+ DBSYMSUFFIX=_${DBSYMSUFFIX}
+ fi
+ echo "${DBSYMSUFFIX}"
+}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-external.patch.bz2
+ EPATCH_OPTS="-p0 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbupgrade.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbopen.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/${P}-root-upgrade-only.patch
+
+ # make sure we use the correct version of DB
+ cd "${S}"
+ DB_PV="$(db_getver)"
+ DB_SYM="$(db_getversym ${DB_PV})"
+ DB_PV_MAJORMINOR="$(get_version_component_range 1-2 ${DB_PV})"
+ sed -i configure.in \
+ -e "s!db.h!db${DB_PV_MAJORMINOR}/db.h!g" \
+ -e "s!db, db_version!db-${DB_PV_MAJORMINOR}, db_version${DB_SYM}!g"
+
+ # fix ancient broken-ness
+ for f in po/Makefile.in.in ./intl/Makefile.in; do
+ egrep -q '^mkinstalldirs = .*case.*esac' ${f} && \
+ sed -i ${f} \
+ -e '/^mkinstalldirs = /s,\(mkinstalldirs =\).*,\1 $(top_builddir)/./mkinstalldirs,'
+ done
+
+ # Fixes thanks to Flameeyes
+ # missing
+ cp /usr/share/gettext/config.rpath .
+ sed -i -e '/makedb_LDADD/i makedb_CFLAGS=$(AM_CFLAGS)' src/Makefile.am
+ sed -i -e '/AC_PROG_CC/a AC_PROG_CC_C_O' configure.in
+ eautoreconf
+
+ # This is an evil target and we don't like it
+ sed -i -e '/^install-data-am:.*install-data-local/s,install-data-local,,g' "${S}"/src/Makefile.in
+}
+
+src_compile() {
+ econf -C --libdir=/$(get_libdir) `use_enable nls` || die
+ emake || die
+}
+
+src_install() {
+ emake -j1 DESTDIR="${D}" slibdir="/$(get_libdir)" install || \
+ die "failed emake install"
+
+ into /usr
+ insinto /usr/share/${PN}
+ doins db-Makefile
+
+ dosbin "${FILESDIR}"/remake-all-db
+
+ dodoc AUTHORS COPYING* ChangeLog INSTALL NEWS README THANKS
+
+ dodir /usr/$(get_libdir)/
+ mv "${D}"/$(get_libdir)/*.la "${D}"/usr/$(get_libdir)/ || \
+ die "failed to set up .la"
+
+ insinto /etc/sandbox.d/
+ newins "${FILESDIR}"/sandbox.d_50nss-db 50nss-db
+}
diff --git a/sys-libs/nss-db/nss-db-2.2.3_pre1-r4.ebuild b/sys-libs/nss-db/nss-db-2.2.3_pre1-r4.ebuild
new file mode 100644
index 000000000000..7c4d2abc982b
--- /dev/null
+++ b/sys-libs/nss-db/nss-db-2.2.3_pre1-r4.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils versionator multilib autotools
+
+MY_PN="${PN/-/_}"
+MY_PV="${PV/_}"
+MY_P="${MY_PN}-${MY_PV}"
+
+DESCRIPTION="Allows important system files to be stored in a fast database file rather than plain text"
+HOMEPAGE="http://sources.redhat.com/glibc/"
+SRC_URI="ftp://sources.redhat.com/pub/glibc/old-releases/${MY_P}.tar.gz
+ mirror://gentoo/${MY_P}-external.patch.bz2
+ mirror://gentoo/${MY_P}-dbupgrade.patch.bz2
+ mirror://gentoo/${MY_P}-dbopen.patch.bz2"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="nls"
+
+# awk and make ARE needed at runtime!
+# and this didn't compile on BSD libc either
+RDEPEND=">=sys-libs/db-4
+ sys-devel/make
+ >=sys-libs/glibc-2.3
+ !>=sys-libs/glibc-2.15"
+# We really do need gettext to compile always :-(
+DEPEND="${RDEPEND}
+ sys-devel/gettext"
+
+S="${WORKDIR}/${MY_P}"
+
+db_getver() {
+ local DBPKG
+ DBPKG="$(best_version '>=sys-libs/db-4')"
+ echo "${DBPKG//sys-libs\/db-}"
+}
+
+db_getversym() {
+ local DBVER DBSYMSUFFIX
+ [ -n "${1}" ] && DBVER="${1}" || DBVER="$(db_getver)"
+ DBVER=($(get_version_components "${DBVER}"))
+ if has_version '>=sys-libs/db-4.3'; then
+ DBSYMSUFFIX=""
+ else
+ let DBSYMSUFFIX=(${DBVER[0]}*1000)+${DBVER[1]}
+ DBSYMSUFFIX=_${DBSYMSUFFIX}
+ fi
+ echo "${DBSYMSUFFIX}"
+}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-external.patch.bz2
+ EPATCH_OPTS="-p0 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbupgrade.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${MY_P}-dbopen.patch.bz2
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/${P}-root-upgrade-only.patch
+ EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/${P}-symlinkvuln.patch
+ # make sure we use the correct version of DB
+ cd "${S}"
+ DB_PV="$(db_getver)"
+ DB_SYM="$(db_getversym ${DB_PV})"
+ DB_PV_MAJORMINOR="$(get_version_component_range 1-2 ${DB_PV})"
+ sed -i configure.in \
+ -e "s!db.h!db${DB_PV_MAJORMINOR}/db.h!g" \
+ -e "s!db, db_version!db-${DB_PV_MAJORMINOR}, db_version${DB_SYM}!g"
+
+ # fix ancient broken-ness
+ for f in po/Makefile.in.in ./intl/Makefile.in; do
+ egrep -q '^mkinstalldirs = .*case.*esac' ${f} && \
+ sed -i ${f} \
+ -e '/^mkinstalldirs = /s,\(mkinstalldirs =\).*,\1 $(top_builddir)/./mkinstalldirs,'
+ done
+
+ # Fixes thanks to Flameeyes
+ # missing
+ cp /usr/share/gettext/config.rpath .
+ sed -i -e '/makedb_LDADD/i makedb_CFLAGS=$(AM_CFLAGS)' src/Makefile.am
+ sed -i -e '/AC_PROG_CC/a AC_PROG_CC_C_O' configure.in
+ eautoreconf
+
+ # This is an evil target and we don't like it
+ sed -i -e '/^install-data-am:.*install-data-local/s,install-data-local,,g' "${S}"/src/Makefile.in
+}
+
+src_compile() {
+ econf -C --libdir=/$(get_libdir) `use_enable nls` || die
+ emake || die
+}
+
+src_install() {
+ emake -j1 DESTDIR="${D}" slibdir="/$(get_libdir)" install || \
+ die "failed emake install"
+
+ into /usr
+ insinto /usr/share/${PN}
+ doins db-Makefile
+
+ exeinto /usr/sbin
+ dosbin "${FILESDIR}"/remake-all-db
+
+ dodoc AUTHORS COPYING* ChangeLog INSTALL NEWS README THANKS
+
+ dodir /usr/$(get_libdir)/
+ mv "${D}"/$(get_libdir)/*.la "${D}"/usr/$(get_libdir)/ || \
+ die "failed to set up .la"
+
+ insinto /etc/sandbox.d/
+ newins "${FILESDIR}"/sandbox.d_50nss-db 50nss-db
+}