rpms/nss_db/devel nss_db-2.2.3-automake.patch, NONE, 1.1 nss_db-2.2.3-external.patch, NONE, 1.1 nss_db-2.2.3-selinux.patch, NONE, 1.1 nss_db.spec, 1.47, 1.48 nss_db-2.2-automake.patch, 1.1, NONE nss_db-2.2-external.patch, 1.2, NONE nss_db-2.2-selinux.patch, 1.4, NONE

Nalin Dahyabhai nalin at fedoraproject.org
Mon Jan 25 23:13:40 UTC 2010


Author: nalin

Update of /cvs/extras/rpms/nss_db/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14419

Modified Files:
	nss_db.spec 
Added Files:
	nss_db-2.2.3-automake.patch nss_db-2.2.3-external.patch 
	nss_db-2.2.3-selinux.patch 
Removed Files:
	nss_db-2.2-automake.patch nss_db-2.2-external.patch 
	nss_db-2.2-selinux.patch 
Log Message:
- update to 2.2.3pre1, which you can still get from upstream
- build with -fno-strict-aliasing to avoid problems triggered by strict aliasing
- package the translations


nss_db-2.2.3-automake.patch:
 Makefile.am |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- NEW FILE nss_db-2.2.3-automake.patch ---
Automake doesn't know how to compile a single file both with and without
libtool.  So fake it.
--- nss_db-2.2.3/src/Makefile.am	2003-12-02 16:21:00.000000000 -0500
+++ nss_db-2.2.3/src/Makefile.am	2003-12-02 16:20:55.000000000 -0500
@@ -27,8 +27,11 @@
 libnss_db_la_LIBADD = @DB_LIBS@ -lnss_files
 
 bin_PROGRAMS = makedb
-makedb_SOURCES = makedb.c db-compat.c
+makedb_SOURCES = makedb.c db-compat-copy-makedb.c
 makedb_LDADD = @DB_LIBS@ @INTLLIBS@
+db-compat-copy-makedb.c: db-compat.c
+	cp $^ $@
+	chmod -w $@
 
 # To mimmick the old glibc installation as closely as possible, we
 # shuffle the installed library and the links to it around a bit,

nss_db-2.2.3-external.patch:
 Makefile.am |    2 +-
 db-XXX.c    |   21 ++++++++++-----------
 db-alias.c  |   21 ++++++++++-----------
 db-netgrp.c |   16 ++++++++--------
 db-open.c   |    4 ++--
 5 files changed, 31 insertions(+), 33 deletions(-)

--- NEW FILE nss_db-2.2.3-external.patch ---
nss_db is now external to libc, so it doesn't get to use internal interfaces.

--- nss_db-2.2.3/src/Makefile.am	2010-01-25 14:11:27.000000000 -0500
+++ nss_db-2.2.3/src/Makefile.am	2010-01-25 14:11:41.000000000 -0500
@@ -11,7 +11,7 @@
 
 noinst_HEADERS = db-compat.h netgroup.h nss_db.h
 
-INCLUDES = @DB_CFLAGS@ -D_LIBC -D_GNU_SOURCE \
+INCLUDES = @DB_CFLAGS@ -D_GNU_SOURCE \
 	-I../intl -DLOCALEDIR=\"$(localedir)\"
 
 EXTRA_DIST = libnss_db.map
--- nss_db-2.2.3/src/db-XXX.c	Wed Aug  9 09:46:39 2000
+++ nss_db-2.2.3/src/db-XXX.c	Tue Apr  2 15:27:03 2002
@@ -21,11 +21,10 @@
 #include <ctype.h>
 #include <db.h>
 #include <netdb.h>
+#include <pthread.h>
 #include <stdio.h>
 #include <string.h>
 
-#include <bits/libc-lock.h>
-
 #include "nss_db.h"
 
 /* These symbols are defined by the including source file:
@@ -53,7 +52,7 @@
 #endif
 
 /* Locks the static variables in this file.  */
-__libc_lock_define_initialized (static, lock)
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 
 /* Maintenance of the shared handle open on the database.  */
 
@@ -68,7 +67,7 @@
 {
   enum nss_status status;
 
-  __libc_lock_lock (lock);
+  pthread_mutex_lock (&lock);
 
   status = internal_setent (DBFILE, &db);
 
@@ -78,7 +77,7 @@
   /* Reset the sequential index.  */
   entidx = 0;
 
-  __libc_lock_unlock (lock);
+  pthread_mutex_unlock (&lock);
 
   return status;
 }
@@ -88,14 +87,14 @@
 enum nss_status
 CONCAT(_nss_db_end,ENTNAME) (void)
 {
-  __libc_lock_lock (lock);
+  pthread_mutex_lock (&lock);
 
   internal_endent (&db);
 
   /* Reset STAYOPEN flag.  */
   keep_db = 0;
 
-  __libc_lock_unlock (lock);
+  pthread_mutex_unlock (&lock);
 
   return NSS_STATUS_SUCCESS;
 }
@@ -227,10 +226,10 @@
   key.data = alloca (size);						      \
   key.size = KEYPRINTF keypattern;					      \
   key.flags = 0;							      \
-  __libc_lock_lock (lock);						      \
+  pthread_mutex_lock (&lock);						      \
   status = lookup (&key, result, buffer, buflen, errnop H_ERRNO_ARG	      \
 		   EXTRA_ARGS_VALUE);					      \
-  __libc_lock_unlock (lock);						      \
+  pthread_mutex_unlock (&lock);					      \
   return status;							      \
 }
 
@@ -249,7 +248,7 @@
   char buf[20];
   DBT key;
 
-  __libc_lock_lock (lock);
+  pthread_mutex_lock (&lock);
 
   /* Loop until we find a valid entry or hit EOF.  See above for the
      special meaning of the status value.  */
@@ -270,7 +269,7 @@
     }
   while (status == NSS_STATUS_RETURN);
 
-  __libc_lock_unlock (lock);
+  pthread_mutex_unlock (&lock);
 
   return status;
 }
diff -uNr nss_db-2.2.3/src/db-alias.c nss_db-2.2.3/src/db-alias.c
--- nss_db-2.2.3/src/db-alias.c	Tue Aug  8 12:47:33 2000
+++ nss_db-2.2.3/src/db-alias.c	Tue Apr  2 15:25:37 2002
@@ -23,15 +23,14 @@
 #include <ctype.h>
 #include <errno.h>
 #include <paths.h>
+#include <pthread.h>
 #include <stdio.h>
 #include <string.h>
 
-#include <bits/libc-lock.h>
-
 #include "nss_db.h"
 
 /* Locks the static variables in this file.  */
-__libc_lock_define_initialized (static, lock)
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 
 /* Maintenance of the shared handle open on the database.  */
 
@@ -46,7 +45,7 @@
 {
   enum nss_status status;
 
-  __libc_lock_lock (lock);
+  pthread_mutex_lock (&lock);
 
   status = internal_setent (_PATH_VARDB "aliases.db", &db);
 
@@ -57,7 +56,7 @@
   /* Reset the sequential index.  */
   entidx = 0;
 
-  __libc_lock_unlock (lock);
+  pthread_mutex_unlock (&lock);
 
   return status;
 }
@@ -67,14 +66,14 @@
 enum nss_status
 _nss_db_endaliasent (void)
 {
-  __libc_lock_lock (lock);
+  pthread_mutex_lock (&lock);
 
   internal_endent (&db);
 
   /* Reset STAYOPEN flag.  */
   keep_db = 0;
 
-  __libc_lock_unlock (lock);
+  pthread_mutex_unlock (&lock);
 
   return NSS_STATUS_SUCCESS;
 }
@@ -180,14 +179,14 @@
   char buf[20];
   DBT key;
 
-  __libc_lock_lock (lock);
+  pthread_mutex_lock (&lock);
   key.size = snprintf (key.data = buf, sizeof buf, "0%u", entidx++);
   key.flags = 0;
   status = lookup (&key, result, buffer, buflen, errnop);
   if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
     /* Give the user a chance to get the same entry with a larger buffer.  */
     --entidx;
-  __libc_lock_unlock (lock);
+  pthread_mutex_unlock (&lock);
 
   return status;
 }
@@ -207,9 +206,9 @@
   memcpy (&((char *) key.data)[1], name, key.size - 1);
   key.flags = 0;
 
-  __libc_lock_lock (lock);
+  pthread_mutex_lock (&lock);
   status = lookup (&key, result, buffer, buflen, errnop);
-  __libc_lock_unlock (lock);
+  pthread_mutex_unlock (&lock);
 
   return status;
 }
diff -uNr nss_db-2.2.3/src/db-netgrp.c nss_db-2.2.3/src/db-netgrp.c
--- nss_db-2.2.3/src/db-netgrp.c	Tue Aug  8 13:05:01 2000
+++ nss_db-2.2.3/src/db-netgrp.c	Tue Apr  2 15:26:03 2002
@@ -21,8 +21,8 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <netgroup.h>
+#include <pthread.h>
 #include <string.h>
-#include <bits/libc-lock.h>
 #include <paths.h>
 
 #include "nss_db.h"
@@ -32,7 +32,7 @@
 
 
 /* Locks the static variables in this file.  */
-__libc_lock_define_initialized (static, lock)
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 
 /* Maintenance of the shared handle open on the database.  */
 static DB *db;
@@ -44,7 +44,7 @@
 {
   enum nss_status status;
 
-  __libc_lock_lock (lock);
+  pthread_mutex_lock (&lock);
 
   status = internal_setent (DBFILE, &db);
 
@@ -60,7 +60,7 @@
 	cursor = entry = value.data;
     }
 
-  __libc_lock_unlock (lock);
+  pthread_mutex_unlock (&lock);
 
   return status;
 
@@ -70,11 +70,11 @@
 enum nss_status
 _nss_db_endnetgrent (void)
 {
-  __libc_lock_lock (lock);
+  pthread_mutex_lock (&lock);
 
   internal_endent (&db);
 
-  __libc_lock_unlock (lock);
+  pthread_mutex_unlock (&lock);
 
   return NSS_STATUS_SUCCESS;
 }
@@ -91,11 +91,11 @@
 {
   int status;
 
-  __libc_lock_lock (lock);
+  pthread_mutex_lock (&lock);
 
   status = _nss_netgroup_parseline (&cursor, result, buffer, buflen, errnop);
 
-  __libc_lock_unlock (lock);
+  pthread_mutex_unlock (&lock);
 
   return status;
 }
--- nss_db-2.2.3/src/db-open.c	Mon Apr 15 10:45:12 2002
+++ nss_db-2.2.3/src/db-open.c	Mon Apr 15 10:45:28 2002
@@ -58,7 +58,7 @@
   if (err != 0)
     {
       if (err > 0)
-	__set_errno (err);
+	errno = err;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -75,7 +75,7 @@
  fail:
   db->close (db, 0);
   if (err > 0)
-    __set_errno (err);
+    errno = err;
   return NSS_STATUS_UNAVAIL;
 }
 

nss_db-2.2.3-selinux.patch:
 nss_db-2.2.3/src/Makefile.am |    2 -
 nss_db-2.2.3/src/makedb.c    |   64 +++++++++++++++++++++++++++++++++++++++++++
 nss_db-2.2/configure.in      |   38 +++++++++++++++++++++++++
 3 files changed, 103 insertions(+), 1 deletion(-)

--- NEW FILE nss_db-2.2.3-selinux.patch ---
Set the SELinux file creation context when opening databases for write access.
Note that this does *not* change the context of existing files.

--- nss_db-2.2/configure.in	2004-10-20 13:41:04.301436568 -0400
+++ nss_db-2.2/configure.in	2004-10-20 13:51:52.913832496 -0400
@@ -73,6 +73,43 @@
 *** Unsupported Berkeley DB version detected.])
 fi
 
+AC_ARG_WITH(selinux,AC_HELP_STRING(--with-selinux,[enable SELinux support [[default=auto]]]),
+selinux=$withval,
+selinux=auto)
+
+libsave="$LIBS"
+if test x$selinux != no ; then
+  AC_CHECK_HEADERS(selinux/selinux.h)
+  if test x$ac_cv_header_selinux_selinux_h = xno ; then
+    if test x$selinux = xyes ; then
+      AC_MSG_ERROR([SELinux not detected])
+    else
+      AC_MSG_WARN([SELinux not detected])
+      selinux=no
+    fi
+  fi
+fi
+
+if test x$selinux != no ; then
+  AC_CHECK_FUNC(setfscreatecon,,[AC_CHECK_LIB(selinux,setfscreatecon)])
+  if test x$ac_cv_func_setfscreatecon = xno ; then
+    if test x$ac_cv_lib_selinux_setfscreatecon = xno ; then
+      if test x$selinux = xyes ; then
+        AC_MSG_ERROR([SELinux not detected])
+      else
+        AC_MSG_WARN([SELinux not detected])
+        selinux=no
+      fi
+    fi
+  fi
+fi
+if test x$selinux != no ; then
+  AC_DEFINE(SELINUX,1,[Define to have makedb set SELinux file contexts on created files.])
+fi
+
+SELINUX_LIBS="$LIBS"
+LIBS="$libsave"
+
 AC_CANONICAL_HOST
 slibdir=NONE
 case "$host" in
@@ -100,6 +137,7 @@
 
 AC_SUBST(DB_CFLAGS)
 AC_SUBST(DB_LIBS)
+AC_SUBST(SELINUX_LIBS)
 AC_SUBST(slibdir)
 
 dnl Internationalization macros.
--- nss_db-2.2.3/src/Makefile.am	2004-10-20 13:47:22.207986040 -0400
+++ nss_db-2.2.3/src/Makefile.am	2004-10-20 13:48:46.242210896 -0400
@@ -28,7 +28,7 @@
 
 bin_PROGRAMS = makedb
 makedb_SOURCES = makedb.c db-compat-copy-makedb.c
-makedb_LDADD = @DB_LIBS@ @INTLLIBS@
+makedb_LDADD = @DB_LIBS@ @SELINUX_LIBS@ @INTLLIBS@
 db-compat-copy-makedb.c: db-compat.c
 	cp $^ $@
 	chmod -w $@
--- nss_db-2.2.3/src/makedb.c	2004-10-20 13:52:02.814327392 -0400
+++ nss_db-2.2.3/src/makedb.c	2004-10-20 14:06:07.605899552 -0400
@@ -32,6 +32,10 @@
 #include <string.h>
 #include <sys/stat.h>
 
+#ifdef SELINUX
+#include <selinux/selinux.h>
+#endif
+
 #include "db-compat.h"
 
 #define N_(Text) Text
@@ -95,6 +99,12 @@
 			  int to_lowercase, int be_quiet);
 static int print_database (DB *db);
 
+#ifdef SELINUX
+/* Set the SELinux file creation context for the given file. */
+static void set_file_creation_context (const char *outname, mode_t mode);
+#else
+#define set_file_creation_context(_outname,_mode)
+#endif
 
 int
 main (int argc, char *argv[])
@@ -176,8 +186,10 @@
 
   /* Open output file.  This must not be standard output so we don't
      handle "-" and "/dev/stdout" special.  */
+  set_file_creation_context (output_name, mode);
   status = db_open (output_name, DB_BTREE, DB_CREATE | DB_TRUNCATE, mode,
 		    NULL, NULL, &db_file);
+  set_file_creation_context (NULL, 0);
   if (status)
     error (EXIT_FAILURE, 0, gettext ("cannot open output file `%s': %s"),
 	   output_name, db_strerror (status));
@@ -388,3 +400,55 @@
 
   return EXIT_SUCCESS;
 }
+
+
+#ifdef SELINUX
+static void
+set_file_creation_context (const char *outname, mode_t mode)
+{
+  static int enabled = -1, enforcing = -1;
+  security_context_t ctx;
+  /* Handle the "reset the context" case. */
+  if (outname == NULL)
+    {
+      setfscreatecon (NULL);
+      return;
+    }
+  /* Check if SELinux is enabled, and remember. */
+  if (enabled == -1)
+    {
+      enabled = is_selinux_enabled ();
+    }
+  if (enabled == 0)
+    {
+      return;
+    }
+  /* Check if SELinux is enforcing, and remember. */
+  if (enforcing == -1)
+    {
+      enforcing = security_getenforce();
+    }
+  /* Determine the context which the file should have. */
+  ctx = NULL;
+  if ((matchpathcon (outname, S_IFREG | mode, &ctx) == 0) &&
+      (ctx != NULL))
+    {
+      if (setfscreatecon (ctx) != 0)
+        {
+          if (enforcing)
+            {
+              error (EXIT_FAILURE, 0,
+                     gettext ("cannot set file creation context for `%s'"),
+                     outname);
+            }
+          else
+            {
+              error (0, 0,
+                     gettext ("cannot set file creation context for `%s'"),
+                     outname);
+            }
+        }
+      freecon (ctx);
+    }
+}
+#endif


Index: nss_db.spec
===================================================================
RCS file: /cvs/extras/rpms/nss_db/devel/nss_db.spec,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -p -r1.47 -r1.48
--- nss_db.spec	25 Jan 2010 18:29:57 -0000	1.47
+++ nss_db.spec	25 Jan 2010 23:13:40 -0000	1.48
@@ -3,17 +3,17 @@
 %define db_version 4.6.21.NC
 Summary: An NSS library for the Berkeley DB
 Name: nss_db
-Version: 2.2
-Release: 46%{?dist}
-Source: ftp://sources.redhat.com/pub/glibc/releases/nss_db-%{version}.tar.gz
+Version: 2.2.3
+Release: 0.1.pre1%{?dist}
+Source: ftp://sources.redhat.com/pub/glibc/old-releases/nss_db-%{version}pre1.tar.gz
 Source1: http://download.oracle.com/berkeley-db/db-%{db_version}.tar.gz
 Source2: db-getent-Makefile
 Source3: fail-setfscreatecon.c
 URL: http://sources.redhat.com/glibc/
-Patch0: nss_db-2.2-external.patch
-Patch1: nss_db-2.2-automake.patch
+Patch0: nss_db-2.2.3-external.patch
+Patch1: nss_db-2.2.3-automake.patch
 Patch2: nss_db-2.2-uniqdb.patch
-Patch4: nss_db-2.2-selinux.patch
+Patch4: nss_db-2.2.3-selinux.patch
 Patch5: nss_db-2.2-db-4.3.patch
 Patch6: nss_db-2.2-enoent.patch
 Patch7: nss_db-2.2-initialize.patch
@@ -30,7 +30,7 @@ Patch104: http://www.oracle.com/technolo
 # nss_db is under the LGPLv2+ license.
 License: Sleepycat and LGPLv2+
 Group: System Environment/Libraries
-BuildRequires: autoconf, automake15, ed, libtool, libselinux-devel
+BuildRequires: autoconf, automake15, ed, gettext-devel, libtool, libselinux-devel
 Conflicts: glibc < 2.2
 Requires: glibc >= 2.3.3-52
 Requires: make
@@ -47,20 +47,24 @@ networks, protocol, users, RPCs, service
 if your flat name service files are too large and lookups are slow.
 
 %prep
-%setup -q -a 1
+%setup -q -a 1 -n nss_db-%{version}pre1
 cp %{SOURCE2} .
 %patch0 -p1 -b .external
 %patch1 -p1 -b .automake
 %patch2 -p1 -b .uniqdb
 %patch4 -p1 -b .selinux
+pushd src
 %patch5 -p1 -b .db-4.3
 %patch6 -p1 -b .enoent
 %patch7 -p1 -b .initialize
 %patch8 -p1 -b .order
+popd
 %patch9 -p1 -b .lib64
+pushd src
 %patch10 -p1 -b .glibc
 %patch11 -p1 -b .makedb-atomic
-rm -f config.guess config.sub ltmain.sh
+popd
+cp %{_datadir}/gettext/config.rpath .
 autoreconf -i
 
 pushd db-%{db_version}
@@ -75,7 +79,7 @@ mkdir db-build
 
 %build
 dbdir=`pwd`/db-instroot
-CFLAGS="$RPM_OPT_FLAGS" ; export CFLAGS
+CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" ; export CFLAGS
 
 pushd db-build
 echo db_cv_mutex=UNIX/fcntl > config.cache
@@ -105,15 +109,14 @@ LDFLAGS=-L${dbdir}/lib ; export LDFLAGS
 make
 
 %install
-[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
+rm -rf ${RPM_BUILD_ROOT}
 install -m755 -d ${RPM_BUILD_ROOT}/{%{_lib},/var/db,%{_bindir}}
 install -m644 -p db-Makefile ${RPM_BUILD_ROOT}/var/db/Makefile
-install -m755 makedb ${RPM_BUILD_ROOT}/%{_bindir}/
-make install DESTDIR=$RPM_BUILD_ROOT
-# Create soname links.
-rm -f $RPM_BUILD_ROOT/%{_lib}/*.so.?
+make install DESTDIR=$RPM_BUILD_ROOT MKINSTALLDIRS='$(srcdir)/mkinstalldirs'
 /sbin/ldconfig -n $RPM_BUILD_ROOT/%{_lib} $RPM_BUILD_ROOT/%{_libdir}
 
+%{find_lang} %{name}
+
 %clean
 rm -rf ${RPM_BUILD_ROOT}
 
@@ -121,7 +124,7 @@ rm -rf ${RPM_BUILD_ROOT}
 
 %postun -p /sbin/ldconfig
 
-%files
+%files -f %{name}.lang
 %defattr(-,root,root)
 %doc AUTHORS COPYING* ChangeLog NEWS README THANKS db-getent-Makefile
 /%{_lib}/libnss_db-%{version}.so
@@ -131,6 +134,11 @@ rm -rf ${RPM_BUILD_ROOT}
 %config(noreplace) /var/db/Makefile
 
 %changelog
+* Mon Jan 25 2010 Nalin Dahyabhai <nalin at redhat.com> - 2.2.3-0.1.pre1
+- update to 2.2.3pre1, which you can still get from upstream
+- build with -fno-strict-aliasing to avoid problems triggered by strict aliasing
+- package the translations
+
 * Mon Jan 25 2010 Nalin Dahyabhai <nalin at redhat.com> - 2.2-46
 - update to DB 4.6.21, which you can still get from upstream
 


--- nss_db-2.2-automake.patch DELETED ---


--- nss_db-2.2-external.patch DELETED ---


--- nss_db-2.2-selinux.patch DELETED ---



More information about the scm-commits mailing list