]> git.ipfire.org Git - people/pmueller/ipfire-3.x.git/commitdiff
Merge branch 'dhcp'
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 3 Oct 2012 17:40:43 +0000 (17:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 3 Oct 2012 17:40:43 +0000 (17:40 +0000)
149 files changed:
bash-completion/bash-completion.nm
collecty/collecty.nm [new file with mode: 0644]
collecty/patches/0001-Install-daemon-to-usr-sbin.patch [new file with mode: 0644]
compat-gdbm/compat-gdbm.nm [new file with mode: 0644]
compat-gdbm/patches/gdbm-1.8.3-fhs.patch [new file with mode: 0644]
compat-gdbm/patches/gdbm-1.8.3-filestruct.patch [new file with mode: 0644]
compat-gdbm/patches/gdbm-1.8.3-ndbmlock.patch [new file with mode: 0644]
compat-gdbm/patches/gdbm-1.8.3-shortread.patch [new file with mode: 0644]
compat-gdbm/patches/gdbm-1.8.3-zeroheaders.patch [new file with mode: 0644]
coreutils/DIR_COLORS [new file with mode: 0644]
coreutils/DIR_COLORS.256color [new file with mode: 0644]
coreutils/DIR_COLORS.lightbgcolor [new file with mode: 0644]
coreutils/coreutils.nm
coreutils/profile.d/term256.sh [new file with mode: 0644]
cups/cups.nm
cups/patches/001_cups-no-gzip-man.patch [new file with mode: 0644]
cups/patches/002_cups-system-auth.patch [moved from cups/patches/cups-1.1.16-system-auth.patch with 59% similarity]
cups/patches/003_cups-multilib.patch [moved from cups/patches/cups-multilib.patch with 62% similarity]
cups/patches/004_cups-banners.patch [new file with mode: 0644]
cups/patches/005_cups-serverbin-compat.patch [moved from cups/patches/cups-serverbin-compat.patch with 56% similarity]
cups/patches/006_cups-no-export-ssllibs.patch [new file with mode: 0644]
cups/patches/007_cups-direct-usb.patch [moved from cups/patches/cups-direct-usb.patch with 56% similarity]
cups/patches/008_cups-lpr-help.patch [moved from cups/patches/cups-lpr-help.patch with 66% similarity]
cups/patches/009_cups-peercred.patch [new file with mode: 0644]
cups/patches/010_cups-pid.patch [moved from cups/patches/cups-pid.patch with 64% similarity]
cups/patches/011_cups-eggcups.patch [moved from cups/patches/cups-eggcups.patch with 72% similarity]
cups/patches/012_cups-driverd-timeout.patch [moved from cups/patches/cups-driverd-timeout.patch with 54% similarity]
cups/patches/013_cups-strict-ppd-line-length.patch [moved from cups/patches/cups-strict-ppd-line-length.patch with 56% similarity]
cups/patches/014_cups-logrotate.patch [moved from cups/patches/cups-logrotate.patch with 77% similarity]
cups/patches/015_cups-usb-paperout.patch [moved from cups/patches/cups-usb-paperout.patch with 73% similarity]
cups/patches/016_cups-res_init.patch [new file with mode: 0644]
cups/patches/017_cups-filter-debug.patch [moved from cups/patches/cups-filter-debug.patch with 71% similarity]
cups/patches/018_cups-uri-compat.patch [moved from cups/patches/cups-uri-compat.patch with 77% similarity]
cups/patches/019_cups-cups-get-classes.patch [moved from cups/patches/cups-cups-get-classes.patch with 76% similarity]
cups/patches/020_cups-str3382.patch [moved from cups/patches/cups-str3382.patch with 82% similarity]
cups/patches/021_cups-0755.patch [new file with mode: 0644]
cups/patches/022_cups-hp-deviceid-oid.patch [moved from cups/patches/cups-hp-deviceid-oid.patch with 71% similarity]
cups/patches/023_cups-dnssd-deviceid.patch [new file with mode: 0644]
cups/patches/024_cups-ricoh-deviceid-oid.patch [moved from cups/patches/cups-ricoh-deviceid-oid.patch with 73% similarity]
cups/patches/025_cups-systemd-socket.patch [new file with mode: 0644]
cups/patches/026_cups-lspp.patch [moved from cups/patches/cups-x-lspp.patch with 62% similarity]
cups/patches/cups-0755.patch [deleted file]
cups/patches/cups-EAI_AGAIN.patch [deleted file]
cups/patches/cups-autotype-crash.patch [deleted file]
cups/patches/cups-avahi.patch [deleted file]
cups/patches/cups-banners.patch [deleted file]
cups/patches/cups-build.patch [deleted file]
cups/patches/cups-dnssd-deviceid.patch [deleted file]
cups/patches/cups-force-gnutls.patch [deleted file]
cups/patches/cups-getpass.patch [deleted file]
cups/patches/cups-hostnamelookups.patch [deleted file]
cups/patches/cups-no-export-ssllibs.patch [deleted file]
cups/patches/cups-no-gzip-man.patch [deleted file]
cups/patches/cups-page-label.patch [deleted file]
cups/patches/cups-peercred.patch [deleted file]
cups/patches/cups-res_init.patch [deleted file]
cups/patches/cups-serial.patch [deleted file]
cups/patches/cups-serialize-gnutls.patch [deleted file]
cups/patches/cups-snmp-quirks.patch [deleted file]
cups/patches/cups-str3754.patch [deleted file]
cups/patches/cups-texttops-rotate-page.patch [deleted file]
cups/systemd/cups.service
expat/expat.nm
gcc/gcc.nm
gcc/patches/gcc-4.7.0-piepatch-20120518.patch
gdbm/gdbm.nm
gdbm/patches/gdbm-1.10-fedora.patch [new file with mode: 0644]
gdbm/patches/gdbm-1.10-zeroheaders.patch [new file with mode: 0644]
gnutls/gnutls.nm
harfbuzz/harfbuzz.nm [new file with mode: 0644]
hplip/hplip.nm
initscripts/initscripts.nm
initscripts/patches/0001-ipcalc-Enhance-to-implode-explode-IPv6-addresses.patch [new file with mode: 0644]
initscripts/patches/0001-ipcalc-Implement-prefix-for-IPv6.patch [new file with mode: 0644]
iptraf-ng/iptraf-ng.nm [new file with mode: 0644]
iptraf-ng/patches/0001-token-ring-kernel-v3.5-kill-off-token-ring-support.patch [new file with mode: 0644]
isdn4k-utils/isdn4k-utils.nm
isdn4k-utils/patches/001-isdn4k-utils-0202131200-true.patch [moved from isdn4k-utils/patches/isdn4k-utils-0202131200-true.patch with 100% similarity]
isdn4k-utils/patches/002-isdn4k-utils-CVS-2004-11-18-autoconf25x.patch [moved from isdn4k-utils/patches/isdn4k-utils-CVS-2004-11-18-autoconf25x.patch with 100% similarity]
isdn4k-utils/patches/003-isdn4k-utils-CVS-2006-07-20-capi.patch [moved from isdn4k-utils/patches/isdn4k-utils-CVS-2006-07-20-capi.patch with 100% similarity]
isdn4k-utils/patches/004-isdn4k-utils-CVS-2009-10-20-ipfire.patch [moved from isdn4k-utils/patches/isdn4k-utils-CVS-2009-10-20-ipfire.patch with 100% similarity]
isdn4k-utils/patches/005-isdn4k-utils-CVS-2010-05-01-capi.patch [moved from isdn4k-utils/patches/isdn4k-utils-CVS-2010-05-01-capi.patch with 100% similarity]
isdn4k-utils/patches/006-isdn4k-utils-CVS-2010-05-01-capi-soname.patch [moved from isdn4k-utils/patches/isdn4k-utils-CVS-2010-05-01-capi-soname.patch with 100% similarity]
isdn4k-utils/patches/007-isdn4k-utils-autoconf-2.6.4-quoting.patch [moved from isdn4k-utils/patches/isdn4k-utils-autoconf-2.6.4-quoting.patch with 100% similarity]
isdn4k-utils/patches/008-isdn4k-utils-capiinit.patch [moved from isdn4k-utils/patches/isdn4k-utils-capiinit.patch with 100% similarity]
isdn4k-utils/patches/009-isdn4k-utils-man.patch [moved from isdn4k-utils/patches/isdn4k-utils-man.patch with 100% similarity]
isdn4k-utils/patches/010-isdn4k-utils-misc-overflow-in-capi-subsystem.patch [moved from isdn4k-utils/patches/isdn4k-utils-misc-overflow-in-capi-subsystem.patch with 100% similarity]
isdn4k-utils/patches/011-isdn4k-utils-pppcapiplugin-libdir.patch [moved from isdn4k-utils/patches/isdn4k-utils-pppcapiplugin-libdir.patch with 100% similarity]
isdn4k-utils/patches/012-isdn4k-utils-sh-linux.patch [moved from isdn4k-utils/patches/isdn4k-utils-sh-linux.patch with 100% similarity]
isdn4k-utils/patches/013-isdn4k-utils-statfs.patch [moved from isdn4k-utils/patches/isdn4k-utils-statfs.patch with 100% similarity]
isdn4k-utils/patches/014-ppp-userpass.patch [moved from isdn4k-utils/patches/ppp-userpass.patch with 100% similarity]
isdn4k-utils/patches/015-isdn4k-utils-fix-ipppd.patch [new file with mode: 0644]
kernel/kernel.nm
kernel/patches/grsecurity-2.9.1-3.5.3-201209062131.patch [moved from kernel/patches/grsecurity-2.9.1-3.5.1-201208112021.patch with 98% similarity]
mesa/mesa.nm
mtr/mtr.nm [new file with mode: 0644]
openldap/openldap.nm
openldap/systemd/openldap.service
openssh/openssh.nm
pakfire/pakfire.nm
pakfire/patches/0001-Rework-parallelism-decision-function-and-move-it-int.patch [new file with mode: 0644]
pakfire/patches/0002-lexer-Add-shell-commands-with-echo-123.patch [new file with mode: 0644]
pakfire/patches/0003-macros-Add-python-variables.patch [new file with mode: 0644]
pakfire/patches/0004-macros-Add-templates-for-python-packages.patch [new file with mode: 0644]
pakfire/patches/0005-Fix-caching-scriptlets.patch [new file with mode: 0644]
pakfire/patches/0006-python-Byte-compile-all-files-in-sitelib.patch [new file with mode: 0644]
pango/pango.nm
patch/patch.nm
patch/patches/patch-2.5.4-sigsegv.patch [deleted file]
patch/patches/patch-2.6.1-CVE-2010-4651.patch [deleted file]
patch/patches/patch-2.6.1-backup-if-mismatch.patch [deleted file]
patch/patches/patch-2.6.1-get-arg.patch [deleted file]
patch/patches/patch-selinux.patch [deleted file]
pdns/pdns.conf [new file with mode: 0644]
pdns/pdns.nm
pdns/pdns.table [new file with mode: 0644]
pdns/pdns.tmpfiles [new file with mode: 0644]
pkg-config/patches/pkg-config-0.25-autoconf-1.patch [deleted file]
pkg-config/pkg-config.nm
python3/patches/00003-remove-mimeaudio-tests.patch [new file with mode: 0644]
python3/patches/00104-lib64-fix-for-test_install.patch [new file with mode: 0644]
python3/patches/00111-no-static-lib.patch [new file with mode: 0644]
python3/patches/00113-more-configuration-flags.patch [new file with mode: 0644]
python3/patches/00114-statvfs-f_flag-constants.patch [new file with mode: 0644]
python3/patches/00125-less-verbose-COUNT_ALLOCS.patch [new file with mode: 0644]
python3/patches/00131-disable-tests-in-test_io.patch [new file with mode: 0644]
python3/patches/00132-add-rpmbuild-hooks-to-unittest.patch [new file with mode: 0644]
python3/patches/00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch [new file with mode: 0644]
python3/patches/00135-fix-test-within-test_weakref-in-debug-build.patch [new file with mode: 0644]
python3/patches/00137-skip-distutils-tests-that-fail-in-rpmbuild.patch [new file with mode: 0644]
python3/patches/00139-skip-test_float-known-failure-on-arm.patch [new file with mode: 0644]
python3/patches/00141-fix-test_gc_with_COUNT_ALLOCS.patch [new file with mode: 0644]
python3/patches/00142-skip-failing-pty-tests-in-rpmbuild.patch [new file with mode: 0644]
python3/patches/00153-fix-test_gdb-noise.patch [new file with mode: 0644]
python3/patches/00155-avoid-ctypes-thunks.patch [new file with mode: 0644]
python3/patches/00156-gdb-autoload-safepath.patch [new file with mode: 0644]
python3/patches/00157-uid-gid-overflows.patch [new file with mode: 0644]
python3/patches/00160-disable-test_fs_holes-in-rpm-build.patch [new file with mode: 0644]
python3/patches/00163-disable-parts-of-test_socket-in-rpm-build.patch [new file with mode: 0644]
python3/patches/00164-disable-interrupted_write-tests-on-ppc.patch [new file with mode: 0644]
python3/patches/05000-autotool-intermediates.patch [new file with mode: 0644]
python3/patches/Python-3.1.1-rpath.patch [new file with mode: 0644]
python3/patches/python-3.2.1-fix-test-subprocess-with-nonreadable-path-dir.patch [new file with mode: 0644]
python3/python-3.3.0b1-lib64.patch [new file with mode: 0644]
python3/python3.nm [new file with mode: 0644]
setup/bashrc
setup/setup.nm
wpa_supplicant/systemd/wpa_supplicant@.service [new file with mode: 0644]
wpa_supplicant/wpa_supplicant.nm

index 6e0eda416b9ec918b4a39a4334ad3accc9bc876c..2648f96647e334ad2379597250e63d493dd67edd 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = bash-completion
 version    = 1.99
-release    = 1
+release    = 2
 arch       = noarch
 
 groups     = Development/Languages
@@ -32,8 +32,10 @@ end
 
 packages
        package %{name}
+               groups += Base
 
-       requires
-               bash >= 4.1
+               requires
+                       bash >= 4.1
+               end
        end
 end
diff --git a/collecty/collecty.nm b/collecty/collecty.nm
new file mode 100644 (file)
index 0000000..deb7fb4
--- /dev/null
@@ -0,0 +1,40 @@
+###############################################################################
+# IPFire.org    - An Open Source Firewall Solution                            #
+# Copyright (C) - IPFire Development Team <info@ipfire.org>                   #
+###############################################################################
+
+name       = collecty
+version    = 0.0.2
+release    = 1
+
+maintainer = Michael Tremer <michael.tremer@ipfire.org>
+groups     = System/Monitoring
+url        = http://git.ipfire.org/?p=oddments/collecty.git;a=summary
+license    = GPLv3+
+summary    = A system data collecting daemon.
+
+description
+       collecty is a daemon which collects data from the
+       system like CPU usage and many more.
+       It has been designed with power efficiency in mind.
+end
+
+source_dl  = http://source.ipfire.org/releases/collecty/
+
+build
+       requires
+               gettext
+               python
+       end
+
+       install
+               mkdir -pv %{BUILDROOT}%{bindir}
+               make install DESTDIR=%{BUILDROOT}
+       end
+end
+
+packages
+       package %{name}
+               groups += Base
+       end
+end
diff --git a/collecty/patches/0001-Install-daemon-to-usr-sbin.patch b/collecty/patches/0001-Install-daemon-to-usr-sbin.patch
new file mode 100644 (file)
index 0000000..cc5cac2
--- /dev/null
@@ -0,0 +1,49 @@
+From 82c136f87bb13aea4f27b669ee98ff7e798ad8b3 Mon Sep 17 00:00:00 2001
+From: Michael Tremer <michael.tremer@ipfire.org>
+Date: Sat, 1 Sep 2012 18:56:19 +0000
+Subject: [PATCH] Install daemon to /usr/sbin.
+
+---
+ Makefile         |    5 ++++-
+ collecty.service |    2 +-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 7d679af..6fcc787 100644
+--- a/Makefile
++++ b/Makefile
+@@ -24,6 +24,7 @@ PACKAGE_VERSION = 0.0.2
+ DESTDIR    =
+ PREFIX     = /usr
+ BINDIR     = $(PREFIX)/bin
++SBINDIR    = $(PREFIX)/sbin
+ LOCALEDIR  = $(PREFIX)/share/locale
+ UNITDIR    = $(PREFIX)/lib/systemd/system
+@@ -55,7 +56,9 @@ dist:
+ install: $(MO_FILES)
+       -mkdir -pv $(PYTHON_DIR)
+       cp -rvf collecty $(PYTHON_DIR)
+-      install -v -m 755 collectyd $(DESTDIR)$(BINDIR)
++
++      -mkdir -pv $(DESTDIR)$(SBINDIR)
++      install -v -m 755 collectyd $(DESTDIR)$(SBINDIR)
+       # Install configuration
+       -mkdir -pv $(DESTDIR)/etc/$(PACKAGE_NAME)
+diff --git a/collecty.service b/collecty.service
+index ac4a893..78bd26e 100644
+--- a/collecty.service
++++ b/collecty.service
+@@ -2,7 +2,7 @@
+ Description=collecty - A system data collecting daemon
+ [Service]
+-ExecStart=/usr/bin/collectyd
++ExecStart=/usr/sbin/collectyd
+ ExecReload=/bin/kill -HUP $MAINPID
+ [Install]
+-- 
+1.7.8.2
+
diff --git a/compat-gdbm/compat-gdbm.nm b/compat-gdbm/compat-gdbm.nm
new file mode 100644 (file)
index 0000000..e00b58f
--- /dev/null
@@ -0,0 +1,82 @@
+###############################################################################
+# IPFire.org    - An Open Source Firewall Solution                            #
+# Copyright (C) - IPFire Development Team <info@ipfire.org>                   #
+###############################################################################
+
+name       = compat-gdbm
+version    = 1.8.3
+release    = 1
+thisapp    = gdbm-%{version}
+
+groups     = Development/Tools
+url        = http://www.gnu.org/software/gdbm/
+license    = GPLv2+
+summary    = The GDBM package contains the GNU Database Manager.
+
+description
+       The GDBM package contains the GNU Database Manager. This is a disk file \
+       format database which stores key/data-pairs in single files. The actual \
+       data of any record being stored is indexed by a unique key, which can be \
+       retrieved in less time than if it was stored in a text file.
+end
+
+source_dl  = http://ftp.gnu.org/gnu/gdbm/
+
+build
+       requires
+               autoconf
+               automake
+               libtool
+       end
+
+       prepare_cmds
+               libtoolize --force --copy
+               aclocal
+               autoconf
+
+               # Don't use flock, because it doesn't work on NFS.
+               # Use fcntl instead.
+               echo "#undef HAVE_FLOCK" >> autoconf.h.in
+       end
+
+       PARALLELISMFLAGS = # Not supported.
+
+       install
+               make install install-compat \
+                       prefix=%{BUILDROOT}%{prefix} \
+                       libdir=%{BUILDROOT}%{libdir} \
+                       includedir=%{BUILDROOT}%{includedir} \
+                       mandir=%{BUILDROOT}%{mandir} \
+                       infodir=%{BUILDROOT}%{infodir}
+
+               mkdir -pv %{BUILDROOT}%{includedir}/gdbm
+               ln -svf gdbm/gdbm.h %{BUILDROOT}%{includedir}/gdbm.h
+
+               # Remove all man pages provided by gdbm-devel.
+               rm -rfv %{BUILDROOT}%{mandir}/man3
+       end
+end
+
+packages
+       package %{name}
+               conflicts
+                       gdbm <= %{version}
+               end
+       end
+
+       package %{name}-devel
+               template DEVEL
+
+               requires
+                       compat-gdbm = %{thisver}
+               end
+
+               conflicts
+                       gdbm-devel
+               end
+       end
+
+       package %{name}-debuginfo
+               template DEBUGINFO
+       end
+end
diff --git a/compat-gdbm/patches/gdbm-1.8.3-fhs.patch b/compat-gdbm/patches/gdbm-1.8.3-fhs.patch
new file mode 100644 (file)
index 0000000..58ce4de
--- /dev/null
@@ -0,0 +1,138 @@
+diff -up gdbm-1.8.3/Makefile.in.fhs gdbm-1.8.3/Makefile.in
+--- gdbm-1.8.3/Makefile.in.fhs 2002-10-08 18:09:12.000000000 +0200
++++ gdbm-1.8.3/Makefile.in     2010-03-10 15:41:01.516025096 +0100
+@@ -1,7 +1,7 @@
+ #### Start of system configuration section. ####
+ srcdir = @srcdir@
+-top_builddir = .
++top_builddir = @top_builddir@
+ VPATH = @srcdir@
+ CC = @CC@
+@@ -14,17 +14,13 @@ INSTALL = @INSTALL@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_DATA = @INSTALL_DATA@
+-# File ownership and group
+-BINOWN = bin
+-BINGRP = bin
+-
+ MAKEINFO = makeinfo
+ TEXI2DVI = texi2dvi
+-DEFS =
++DEFS = @DEFS@
+ # Where the system [n]dbm routines are...
+-LIBS = @LIBS@ -lc
++LIBS = @LIBS@
+ CFLAGS = @CFLAGS@
+ LDFLAGS = @LDFLAGS@
+@@ -32,16 +28,17 @@ LDFLAGS = @LDFLAGS@
+ # Common prefix for installation directories
+ prefix = @prefix@
+ exec_prefix = @exec_prefix@
+-binprefix = $(exec_prefix)
+-manprefix = $(prefix)
++datarootdir = @datarootdir@
+ # Directory in which to put libgdbm.a.
+ libdir = @libdir@
+ # The include directory for gdbm.h and dbm.h.
+ includedir = @includedir@
++pkgincludedir = $(includedir)/gdbm
+ # Info and man directories.
+ infodir = @infodir@
+-man3dir = @mandir@/man3
++mandir = @mandir@
++man3dir = $(mandir)/man3
+ manext = 3
+ #### End of system configuration section. ####
+@@ -57,7 +54,7 @@ manext = 3
+ SHELL = /bin/sh
+-PROGS = libgdbm.la testgdbm testdbm testndbm tndbm tdbm conv2gdbm
++PROGS = libgdbm.la testgdbm testdbm testndbm conv2gdbm
+ DBM_CF = dbminit.c delete.c fetch.c store.c seq.c close.c
+@@ -127,26 +124,17 @@ all: libgdbm.la libgdbm_compat.la
+ progs: $(PROGS)
+ install: libgdbm.la gdbm.h gdbm.info
+-      $(srcdir)/mkinstalldirs $(INSTALL_ROOT)$(libdir) \
+-              $(INSTALL_ROOT)$(includedir) $(INSTALL_ROOT)$(man3dir) \
+-              $(INSTALL_ROOT)$(infodir)
+-      $(LIBTOOL) $(INSTALL) -c libgdbm.la $(INSTALL_ROOT)$(libdir)/libgdbm.la
+-      $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) gdbm.h \
+-              $(INSTALL_ROOT)$(includedir)/gdbm.h
+-      $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.3 \
+-              $(INSTALL_ROOT)$(man3dir)/gdbm.3
+-      $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.info \
+-              $(INSTALL_ROOT)$(infodir)/gdbm.info
++      $(srcdir)/mkinstalldirs $(libdir) $(pkgincludedir) $(man3dir) $(infodir)
++      $(LIBTOOL) install install libgdbm.la $(libdir)/libgdbm.la
++      $(INSTALL_DATA) gdbm.h $(pkgincludedir)/gdbm.h
++      $(INSTALL_DATA) $(srcdir)/gdbm.3 $(man3dir)/gdbm.3
++      $(INSTALL_DATA) $(srcdir)/gdbm.info $(infodir)/gdbm.info
+ install-compat:
+-      $(srcdir)/mkinstalldirs $(INSTALL_ROOT)$(libdir) \
+-              $(INSTALL_ROOT)$(includedir)
+-      $(LIBTOOL) $(INSTALL) -c libgdbm_compat.la \
+-              $(INSTALL_ROOT)$(libdir)/libgdbm_compat.la
+-      $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/dbm.h \
+-              $(INSTALL_ROOT)$(includedir)/dbm.h
+-      $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/ndbm.h \
+-              $(INSTALL_ROOT)$(includedir)/ndbm.h
++      $(srcdir)/mkinstalldirs $(libdir) $(pkgincludedir)
++      $(LIBTOOL) install install libgdbm_compat.la $(libdir)/libgdbm_compat.la
++      $(INSTALL_DATA) $(srcdir)/dbm.h $(pkgincludedir)/dbm.h
++      $(INSTALL_DATA) $(srcdir)/ndbm.h $(pkgincludedir)/ndbm.h
+ #libgdbm.a: $(OBJS) gdbm.h
+ #     rm -f libgdbm.a
+@@ -161,7 +149,7 @@ libgdbm.la: $(LOBJS) gdbm.h
+ libgdbm_compat.la: $(C_LOBJS) gdbm.h
+       rm -f libgdbm_compat.la
+       $(LIBTOOL) --mode=link $(CC) -o libgdbm_compat.la -rpath $(libdir) \
+-              -version-info $(SHLIB_VER) $(C_LOBJS)
++              -version-info $(SHLIB_VER) $(C_LOBJS) -lgdbm
+ gdbm.h:       gdbm.proto gdbmerrno.h gdbm.proto2
+       rm -f gdbm.h
+@@ -172,10 +160,10 @@ gdbm.h:  gdbm.proto gdbmerrno.h gdbm.prot
+       chmod -w gdbm.h
+ testgdbm: testgdbm.o libgdbm.la @LIBOBJS@
+-      $(LIBTOOL) $(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.la @LIBOBJS@
++      $(LIBTOOL) link $(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.la @LIBOBJS@
+ testdbm: testdbm.o libgdbm.la libgdbm_compat.la
+-      $(LIBTOOL) $(CC) $(LDFLAGS) -o testdbm testdbm.o libgdbm.la libgdbm_compat.la
++      $(LIBTOOL) link $(CC) $(LDFLAGS) -o testdbm testdbm.o $(LIBS) libgdbm_compat.la
+ tdbm: testdbm.o
+       $(CC) $(LDFLAGS) -o tdbm testdbm.o $(LIBS)
+@@ -184,7 +172,7 @@ testndbm.o: testndbm.c
+       $(CC) -c -I. -I$(srcdir) $(CFLAGS) $(DEFS) -DGNU $(srcdir)/testndbm.c
+ testndbm: testndbm.o libgdbm.la libgdbm_compat.la
+-      $(LIBTOOL) $(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm.la libgdbm_compat.la
++      $(LIBTOOL) link $(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm_compat.la
+ tndbm.o: testndbm.c
+       cp $(srcdir)/testndbm.c ./tndbm.c
+@@ -195,7 +183,7 @@ tndbm: tndbm.o
+       $(CC) $(LDFLAGS) -o tndbm tndbm.o $(LIBS)
+ conv2gdbm: conv2gdbm.o libgdbm.la @LIBOBJS@
+-      $(LIBTOOL) $(CC) $(LDFLAGS) -o conv2gdbm conv2gdbm.o $(LIBS) libgdbm.la @LIBOBJS@
++      $(LIBTOOL) link $(CC) $(LDFLAGS) -o conv2gdbm conv2gdbm.o $(LIBS) libgdbm_compat.la @LIBOBJS@
+ lintgdbm: 
+       lint $(DEFS) $(LFLAGS) $(DBM_CF) $(NDBM_CF) $(GDBM_CF) testgdbm.c
diff --git a/compat-gdbm/patches/gdbm-1.8.3-filestruct.patch b/compat-gdbm/patches/gdbm-1.8.3-filestruct.patch
new file mode 100644 (file)
index 0000000..3e27db8
--- /dev/null
@@ -0,0 +1,12 @@
+diff -up gdbm-1.8.3/gdbm.proto.filestruct gdbm-1.8.3/gdbm.proto
+--- gdbm-1.8.3/gdbm.proto.filestruct   2011-01-13 09:54:03.004907454 +0100
++++ gdbm-1.8.3/gdbm.proto      2011-01-13 09:54:24.881714834 +0100
+@@ -60,7 +60,7 @@ typedef struct {
+ /* The file information header. This is good enough for most applications. */
+-typedef struct {int dummy[10];} *GDBM_FILE;
++typedef struct __GDBM_FILE_STRUC {int dummy[10];} *GDBM_FILE;
+ /* Determine if the C(++) compiler requires complete function prototype  */
+ #ifndef __P
diff --git a/compat-gdbm/patches/gdbm-1.8.3-ndbmlock.patch b/compat-gdbm/patches/gdbm-1.8.3-ndbmlock.patch
new file mode 100644 (file)
index 0000000..7bc86c3
--- /dev/null
@@ -0,0 +1,94 @@
+diff -up gdbm-1.8.3/dbmopen.c.dbmlock gdbm-1.8.3/dbmopen.c
+--- gdbm-1.8.3/dbmopen.c.dbmlock       1999-05-19 02:16:05.000000000 +0200
++++ gdbm-1.8.3/dbmopen.c       2011-01-03 16:17:13.847173371 +0100
+@@ -35,6 +35,28 @@
+ #include "gdbmerrno.h"
+ #include "extern.h"
++static int
++get_env_bool(env_var, def)
++      const char *env_var;
++      int def;
++{
++  const char *v = getenv(env_var);
++  if (!v)
++    return def;
++
++  if (!strcasecmp(v, "yes") ||
++      !strcasecmp(v, "true") ||
++      !strcasecmp(v, "on"))
++    return 1;
++
++  if (!strcasecmp(v, "no") ||
++      !strcasecmp(v, "false") ||
++      !strcasecmp(v, "off"))
++    return 0;
++
++  return !!atoi(v);
++}
++
+ /* Initialize ndbm system.  FILE is a pointer to the file name.  In
+    standard dbm, the database is found in files called FILE.pag and
+    FILE.dir.  To make gdbm compatable with dbm using the dbminit call,
+@@ -62,7 +84,7 @@ dbm_open (file, flags, mode)
+   char* dir_file;         /* Used to construct "file.dir". */
+   struct stat dir_stat;           /* Stat information for "file.dir". */
+   gdbm_file_info *temp_dbf;  /* Temporary file pointer storage. */
+-
++  int gdbm_mode = 0;
+   /* Prepare the correct names of "file.pag" and "file.dir". */
+   pag_file = (char *) malloc (strlen (file)+5);
+@@ -77,26 +99,22 @@ dbm_open (file, flags, mode)
+   strcat (pag_file, ".pag");
+   strcpy (dir_file, file);
+   strcat (dir_file, ".dir");
+-  
++
++  if (!get_env_bool("NDBM_LOCK", 1))
++      gdbm_mode |= GDBM_NOLOCK;
+   /* Call the actual routine, saving the pointer to the file information. */
+   flags &= O_RDONLY | O_RDWR | O_CREAT | O_TRUNC;
+   if (flags == O_RDONLY)
+-    {
+-      temp_dbf = gdbm_open (pag_file, 0, GDBM_READER, 0, NULL);
+-    }
++    gdbm_mode |= GDBM_READER;
+   else if (flags == (O_RDWR | O_CREAT))
+-    {
+-      temp_dbf = gdbm_open (pag_file, 0, GDBM_WRCREAT, mode, NULL);
+-    }
+-  else if ( (flags & O_TRUNC) == O_TRUNC)
+-    {
+-      temp_dbf = gdbm_open (pag_file, 0, GDBM_NEWDB, mode, NULL);
+-    }
++    gdbm_mode |= GDBM_WRCREAT;
++  else if ((flags & O_TRUNC) == O_TRUNC)
++    gdbm_mode |= GDBM_NEWDB;
+   else
+-    {
+-      temp_dbf = gdbm_open (pag_file, 0, GDBM_WRITER, 0, NULL);
+-    }
++    gdbm_mode |= GDBM_WRITER;
++
++  temp_dbf = gdbm_open (pag_file, 0, gdbm_mode, mode, NULL);
+   /* Did we successfully open the file? */
+   if (temp_dbf == NULL)
+diff -up gdbm-1.8.3/gdbm.3.dbmlock gdbm-1.8.3/gdbm.3
+--- gdbm-1.8.3/gdbm.3.dbmlock  2011-01-03 15:59:15.684729255 +0100
++++ gdbm-1.8.3/gdbm.3  2011-01-03 16:17:49.957570637 +0100
+@@ -543,7 +543,11 @@ you must link in the \fIgdbm_compat\fR l
+ .sp
+       gcc -o prog proc.c -lgdbm -lgdbm_compat
+-.SH BUGS
++.SH "ENVIRONMENT VARIABLES"
++\fINDBM_LOCK\fR - When the NDBM interface is used, the database file
++is locked by default. Locking might degrade performance when used on a
++NFS share. This environment variable can be set to false to tell GDBM
++not to lock the database file.
+ .SH "SEE ALSO"
+ dbm, ndbm
diff --git a/compat-gdbm/patches/gdbm-1.8.3-shortread.patch b/compat-gdbm/patches/gdbm-1.8.3-shortread.patch
new file mode 100644 (file)
index 0000000..5b6455b
--- /dev/null
@@ -0,0 +1,113 @@
+05_handle-short-read.patch
+
+diff -urNad a/bucket.c b/bucket.c
+--- a/bucket.c 1999-05-19 01:16:05.000000000 +0100
++++ b/bucket.c 2006-04-24 03:18:01.000000000 +0100
+@@ -31,7 +31,7 @@
+ #include "autoconf.h"
+ #include "gdbmdefs.h"
+-
++#include <errno.h>
+ /* Initializing a new hash buckets sets all bucket entries to -1 hash value. */
+ void
+@@ -68,7 +68,8 @@
+      int dir_index;
+ {
+   off_t bucket_adr;   /* The address of the correct hash bucket.  */
+-  int   num_bytes;    /* The number of bytes read. */
++  int   num_bytes = 0; /* The total number of bytes read. */
++  int   bytes_read;    /* Number of bytes read in this syscall */
+   off_t       file_pos;       /* The return address for lseek. */
+   register int index; /* Loop index. */
+@@ -111,7 +112,12 @@
+       if (file_pos != bucket_adr)
+       _gdbm_fatal (dbf, "lseek error");
+-      num_bytes = read (dbf->desc, dbf->bucket, dbf->header->bucket_size);
++      do
++        {
++          bytes_read = read (dbf->desc, dbf->bucket+num_bytes, dbf->header->bucket_size-num_bytes);
++          if (bytes_read > 0) num_bytes += bytes_read;
++        }
++      while ((bytes_read > 0 || (bytes_read == -1 && errno == EINTR)) && num_bytes < dbf->header->bucket_size);
+       if (num_bytes != dbf->header->bucket_size)
+       _gdbm_fatal (dbf, "read error");
+     }
+diff -urNad a/falloc.c b/falloc.c
+--- a/falloc.c 2006-04-24 03:17:54.000000000 +0100
++++ b/falloc.c 2006-04-24 03:18:01.000000000 +0100
+@@ -31,7 +31,7 @@
+ #include "autoconf.h"
+ #include "gdbmdefs.h"
+-
++#include <errno.h>
+ /* The forward definitions for this file.  See the functions for
+    the definition of the function. */
+@@ -174,7 +174,8 @@
+ pop_avail_block (dbf)
+      gdbm_file_info *dbf;
+ {
+-  int  num_bytes;             /* For use with the read system call. */
++  int  num_bytes = 0;          /* For use with the read system call. */
++  int  bytes_read;             /* For use with the read system call. */
+   off_t file_pos;             /* For use with the lseek system call. */
+   avail_elem new_el;
+   avail_block *new_blk;
+@@ -199,7 +200,12 @@
+   /* Read the block. */
+   file_pos = lseek (dbf->desc, new_el.av_adr, L_SET);
+   if (file_pos != new_el.av_adr)  _gdbm_fatal (dbf, "lseek error");
+-  num_bytes = read (dbf->desc, new_blk, new_el.av_size);
++  do
++    {
++      bytes_read = read (dbf->desc, new_blk+num_bytes, new_el.av_size-num_bytes);
++      if (bytes_read > 0) num_bytes += bytes_read;
++    }
++  while ((bytes_read > 0 || (bytes_read == -1 && errno == EINTR)) && num_bytes < new_el.av_size);
+   if (num_bytes != new_el.av_size) _gdbm_fatal (dbf, "read error");
+   /* Add the elements from the new block to the header. */
+diff -urNad a/findkey.c b/findkey.c
+--- a/findkey.c        1999-05-19 01:16:06.000000000 +0100
++++ b/findkey.c        2006-04-24 03:18:01.000000000 +0100
+@@ -31,6 +31,7 @@
+ #include "autoconf.h"
+ #include "gdbmdefs.h"
++#include <errno.h>
+ /* Read the data found in bucket entry ELEM_LOC in file DBF and
+@@ -41,11 +42,12 @@
+      gdbm_file_info *dbf;
+      int elem_loc;
+ {
+-  int num_bytes;              /* For seeking and reading. */
++  int num_bytes = 0;           /* For seeking and reading. */
+   int key_size;
+   int data_size;
+   off_t file_pos;
+   data_cache_elem *data_ca;
++  int bytes_read;
+   /* Is it already in the cache? */
+   if (dbf->cache_entry->ca_data.elem_loc == elem_loc)
+@@ -74,7 +76,12 @@
+                   dbf->bucket->h_table[elem_loc].data_pointer, L_SET);
+   if (file_pos != dbf->bucket->h_table[elem_loc].data_pointer)
+     _gdbm_fatal (dbf, "lseek error");
+-  num_bytes = read (dbf->desc, data_ca->dptr, key_size+data_size);
++  do
++    {
++      bytes_read = read (dbf->desc, data_ca->dptr+num_bytes, key_size+data_size-num_bytes);
++      if (bytes_read > 0) num_bytes += bytes_read;
++    }
++  while ((bytes_read > 0 || (bytes_read == -1 && errno == EINTR)) && num_bytes < key_size+data_size);
+   if (num_bytes != key_size+data_size) _gdbm_fatal (dbf, "read error");
+   
+   return data_ca->dptr;
diff --git a/compat-gdbm/patches/gdbm-1.8.3-zeroheaders.patch b/compat-gdbm/patches/gdbm-1.8.3-zeroheaders.patch
new file mode 100644 (file)
index 0000000..088956a
--- /dev/null
@@ -0,0 +1,44 @@
+02_zero-headers.patch by Jeff Johnson <jbj@redhat.com> and Colin Watson <cjwatson@debian.org>
+
+diff -urNad a/falloc.c b/falloc.c
+--- a/falloc.c 2001-02-28 06:52:33.000000000 +0000
++++ b/falloc.c 2003-09-08 23:58:43.000000000 +0100
+@@ -272,7 +272,7 @@
+   /* Split the header block. */
+-  temp = (avail_block *) malloc (av_size);
++  temp = (avail_block *) calloc (1, av_size);
+   if (temp == NULL) _gdbm_fatal (dbf, "malloc error");
+   /* Set the size to be correct AFTER the pop_avail_block. */
+   temp->size = dbf->header->avail.size;
+diff -urNad a/gdbmopen.c b/gdbmopen.c
+--- a/gdbmopen.c       2003-09-08 23:58:01.000000000 +0100
++++ b/gdbmopen.c       2003-09-08 23:58:43.000000000 +0100
+@@ -212,7 +212,7 @@
+       file_block_size = block_size;
+       /* Get space for the file header. */
+-      dbf->header = (gdbm_file_header *) malloc (file_block_size);
++      dbf->header = (gdbm_file_header *) calloc (1, file_block_size);
+       if (dbf->header == NULL)
+       {
+         gdbm_close (dbf);
+@@ -256,7 +256,7 @@
+       (dbf->header->block_size - sizeof (hash_bucket))
+       / sizeof (bucket_element) + 1;
+       dbf->header->bucket_size  = dbf->header->block_size;
+-      dbf->bucket = (hash_bucket *) malloc (dbf->header->bucket_size);
++      dbf->bucket = (hash_bucket *) calloc (1, dbf->header->bucket_size);
+       if (dbf->bucket == NULL)
+       {
+         gdbm_close (dbf);
+@@ -420,7 +420,7 @@
+       for(index = 0; index < size; index++)
+         {
+           (dbf->bucket_cache[index]).ca_bucket
+-            = (hash_bucket *) malloc (dbf->header->bucket_size);
++            = (hash_bucket *) calloc (1, dbf->header->bucket_size);
+           if ((dbf->bucket_cache[index]).ca_bucket == NULL)
+           {
+               gdbm_errno = GDBM_MALLOC_ERROR;
diff --git a/coreutils/DIR_COLORS b/coreutils/DIR_COLORS
new file mode 100644 (file)
index 0000000..5683e39
--- /dev/null
@@ -0,0 +1,248 @@
+# Configuration file for the color ls utility
+# Synchronized with coreutils 8.5 dircolors
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+
+# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
+# pipes. 'all' adds color characters to all output. 'none' shuts colorization
+# off.
+COLOR tty
+
+# Extra command line options for ls go here.
+# Basically these ones are:
+#  -F = show '/' for dirs, '*' for executables, etc.
+#  -T 0 = don't trust tab spacing when formatting ls output.
+OPTIONS -F -T 0
+
+# Below, there should be one TERM entry for each termtype that is colorizable
+TERM Eterm
+TERM ansi
+TERM color-xterm
+TERM con132x25
+TERM con132x30
+TERM con132x43
+TERM con132x60
+TERM con80x25
+TERM con80x28
+TERM con80x30
+TERM con80x43
+TERM con80x50
+TERM con80x60
+TERM cons25
+TERM console
+TERM cygwin
+TERM dtterm
+TERM eterm-color
+TERM gnome
+TERM gnome-256color
+TERM jfbterm
+TERM konsole
+TERM kterm
+TERM linux
+TERM linux-c
+TERM mach-color
+TERM mlterm
+TERM putty
+TERM rxvt
+TERM rxvt-256color
+TERM rxvt-cygwin
+TERM rxvt-cygwin-native
+TERM rxvt-unicode
+TERM rxvt-unicode-256color
+TERM rxvt-unicode256
+TERM screen
+TERM screen-256color
+TERM screen-256color-bce
+TERM screen-bce
+TERM screen-w
+TERM screen.rxvt
+TERM screen.linux
+TERM terminator
+TERM vt100
+TERM xterm
+TERM xterm-16color
+TERM xterm-256color
+TERM xterm-88color
+TERM xterm-color
+TERM xterm-debian
+
+# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
+EIGHTBIT 1
+
+# Below are the color init strings for the basic file types. A color init
+# string consists of one or more of the following numeric codes:
+# Attribute codes:
+# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
+# Text color codes:
+# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
+# Background color codes:
+# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
+#NORMAL 00     # no color code at all
+#FILE 00       # normal file, use no color at all
+RESET 0 # reset to "normal" color
+DIR 01;34      # directory
+LINK 01;36     # symbolic link (If you set this to 'target' instead of a
+               # numerical value, the color is as for the file pointed to.)
+MULTIHARDLINK 00       # regular file with more than one link
+FIFO 40;33     # pipe
+SOCK 01;35     # socket
+DOOR 01;35     # door
+BLK 40;33;01   # block device driver
+CHR 40;33;01   # character device driver
+ORPHAN 40;31;01  # symlink to nonexistent file, or non-stat'able file
+MISSING 01;05;37;41 # ... and the files they point to
+SETUID 37;41   # file that is setuid (u+s)
+SETGID 30;43   # file that is setgid (g+s)
+CAPABILITY 30;41       # file with capability
+STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
+OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
+STICKY 37;44   # dir with the sticky bit set (+t) and not other-writable
+
+# This is for files with execute permission:
+EXEC 01;32
+
+# List any file extensions like '.gz' or '.tar' that you would like ls
+# to colorize below. Put the extension, a space, and the color init string.
+# (and any comments you want to add after a '#')
+# executables (bright green)
+#.cmd 01;32
+#.exe 01;32
+#.com 01;32
+#.btm 01;32
+#.bat 01;32
+#.sh  01;32
+#.csh 01;32
+ # archives or compressed (bright red)
+.tar 01;31
+.tgz 01;31
+.arj 01;31
+.taz 01;31
+.lzh 01;31
+.lzma 01;31
+.tlz 01;31
+.txz 01;31
+.zip 01;31
+.z   01;31
+.Z   01;31
+.dz  01;31
+.gz  01;31
+.lz  01;31
+.xz  01;31
+.bz2 01;31
+.tbz 01;31
+.tbz2 01;31
+.bz  01;31
+.tz  01;31
+.deb 01;31
+.rpm 01;31
+.jar 01;31
+.war 01;31
+.ear 01;31
+.sar 01;31
+.rar 01;31
+.ace 01;31
+.zoo 01;31
+.cpio 01;31
+.7z  01;31
+.rz  01;31
+
+# image formats (magenta)
+.jpg 01;35
+.jpeg 01;35
+.gif 01;35
+.bmp 01;35
+.pbm 01;35
+.pgm 01;35
+.ppm 01;35
+.tga 01;35
+.xbm 01;35
+.xpm 01;35
+.tif 01;35
+.tiff 01;35
+.png 01;35
+.svg 01;35
+.svgz 01;35
+.mng 01;35
+.pcx 01;35
+.mov 01;35
+.mpg 01;35
+.mpeg 01;35
+.m2v 01;35
+.mkv 01;35
+.ogm 01;35
+.mp4 01;35
+.m4v 01;35
+.mp4v 01;35
+.vob 01;35
+.qt  01;35
+.nuv 01;35
+.wmv 01;35
+.asf 01;35
+.rm  01;35
+.rmvb 01;35
+.flc 01;35
+.avi 01;35
+.fli 01;35
+.flv 01;35
+.gl 01;35
+.dl 01;35
+.xcf 01;35
+.xwd 01;35
+.yuv 01;35
+.cgm 01;35
+.emf 01;35
+
+# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+.axv 01;35
+.anx 01;35
+.ogv 01;35
+.ogx 01;35
+
+# audio formats (cyan)
+.aac 01;36
+.au 01;36
+.flac 01;36
+.mid 01;36
+.midi 01;36
+.mka 01;36
+.mp3 01;36
+.mpc 01;36
+.ogg 01;36
+.ra 01;36
+.wav 01;36
+
+# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+.axa 01;36
+.oga 01;36
+.spx 01;36
+.xspf 01;36
+
+# colorize binary documents (brown)
+#.pdf 00;33
+#.ps 00;33
+#.ps.gz 00;33
+#.tex 00;33
+#.xls 00;33
+#.xlsx 00;33
+#.ppt 00;33
+#.pptx 00;33
+#.rtf 00;33
+#.doc 00;33
+#.docx 00;33
+#.odt 00;33
+#.ods 00;33
+#.odp 00;33
+#.epub 00;33
+#.abw 00;33
+#.wpd 00;33
+#
+# colorize text documents (brown)
+#.txt 00;33
+#.patch 00;33
+#.diff 00;33
+#.log 00;33
+#.htm 00;33
+#.html 00;33
+#.shtml 00;33
+#.xml 00;33
diff --git a/coreutils/DIR_COLORS.256color b/coreutils/DIR_COLORS.256color
new file mode 100644 (file)
index 0000000..14e27d4
--- /dev/null
@@ -0,0 +1,221 @@
+# Configuration file for the 256color ls utility
+# This file goes in the /etc directory, and must be world readable.
+# Synchronized with coreutils 8.5 dircolors
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+# In the case that you are not satisfied with supplied colors, please
+# submit your color configuration or attach your file with colors readable
+# on ALL color background schemas (white,gray,black) to RedHat Bugzilla
+# ticket on https://bugzilla.redhat.com/show_bug.cgi?id=429121 . TIA.
+# Please just keep ls color conventions from 8 color scheme.
+
+# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
+# pipes. 'all' adds color characters to all output. 'none' shuts colorization
+# off.
+COLOR tty
+
+# Extra command line options for ls go here.
+# Basically these ones are:
+#  -F = show '/' for dirs, '*' for executables, etc.
+#  -T 0 = don't trust tab spacing when formatting ls output.
+OPTIONS -F -T 0
+
+# Below, there should be one TERM entry for each termtype that is colorizable
+TERM putty-256color
+TERM rxvt-256color
+TERM rxvt-unicode-256color
+TERM rxvt-unicode256
+TERM screen-256color
+TERM xterm-256color
+TERM gnome-256color
+
+# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
+EIGHTBIT 1
+
+# Below are the color init strings for the basic file types. A color init
+# string consists of one or more of the following numeric codes:
+# Attribute codes:
+# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
+# Text color(8 colors mode) codes:
+# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
+# Background color(8 colors mode) codes:
+# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
+# Text color(256 colors mode) codes:
+# Valid syntax for text 256color is 38;5;<color number> , where color number
+# is number between 0 and 255.
+# You may find following command useful to search the best one for you:
+# for ((x=0; x<=255; x++));do echo -e "${x}:\033[38;5;${x}mcolor\033[000m";done
+# Background color(256 colors mode) codes:
+# Valid syntax for background 256color is 48;5;<color number> , where
+# color number is number between 0 and 255.
+# You may find following command useful to search the best one for you:
+# for ((x=0; x<=255; x++));do echo -e "${x}:\033[48;5;${x}mcolor\033[000m";done
+
+#NORMAL 00     # global default, no color code at all
+#FILE 00       # normal file, use no color at all
+RESET 0 # reset to "normal" color
+DIR 38;5;27    # directory
+LINK 38;5;51   # symbolic link (If you set this to 'target' instead of a
+               # numerical value, the color is as for the file pointed to.)
+MULTIHARDLINK 44;38;5;15 # regular file with more than one link
+FIFO 40;38;5;11        # pipe
+SOCK 38;5;13   # socket
+DOOR 38;5;5    # door
+BLK 48;5;232;38;5;11   # block device driver
+CHR 48;5;232;38;5;3    # character device driver
+ORPHAN 48;5;232;38;5;9  # symlink to nonexistent file, or non-stat'able file
+MISSING 05;48;5;232;38;5;15 # ... and the files they point to
+SETUID 48;5;196;38;5;15        # file that is setuid (u+s)
+SETGID 48;5;11;38;5;16 # file that is setgid (g+s)
+CAPABILITY 48;5;196;38;5;226   # file with capability
+STICKY_OTHER_WRITABLE 48;5;10;38;5;16 # dir that is sticky and other-writable (+t,o+w)
+OTHER_WRITABLE 48;5;10;38;5;21 # dir that is other-writable (o+w) and not sticky
+STICKY 48;5;21;38;5;15 # dir with the sticky bit set (+t) and not other-writable
+
+# This is for files with execute permission:
+EXEC 38;5;34
+
+# List any file extensions like '.gz' or '.tar' that you would like ls
+# to colorize below. Put the extension, a space, and the color init string.
+# (and any comments you want to add after a '#')
+# executables (bright green)
+#.cmd 38;5;34
+#.exe 38;5;34
+#.com 38;5;34
+#.btm 38;5;34
+#.bat 38;5;34
+#.sh  38;5;34
+#.csh 38;5;34
+ # archives or compressed (bright red)
+.tar 38;5;9
+.tgz 38;5;9
+.arj 38;5;9
+.taz 38;5;9
+.lzh 38;5;9
+.lzma 38;5;9
+.tlz 38;5;9
+.txz 38;5;9
+.zip 38;5;9
+.z   38;5;9
+.Z   38;5;9
+.dz  38;5;9
+.gz  38;5;9
+.lz  38;5;9
+.xz  38;5;9
+.bz2 38;5;9
+.tbz 38;5;9
+.tbz2 38;5;9
+.bz  38;5;9
+.tz  38;5;9
+.deb 38;5;9
+.rpm 38;5;9
+.jar 38;5;9
+.war 38;5;9
+.ear 38;5;9
+.sar 38;5;9
+.rar 38;5;9
+.ace 38;5;9
+.zoo 38;5;9
+.cpio 38;5;9
+.7z  38;5;9
+.rz  38;5;9
+
+# image formats (magenta)
+.jpg 38;5;13
+.jpeg 38;5;13
+.gif 38;5;13
+.bmp 38;5;13
+.pbm 38;5;13
+.pgm 38;5;13
+.ppm 38;5;13
+.tga 38;5;13
+.xbm 38;5;13
+.xpm 38;5;13
+.tif 38;5;13
+.tiff 38;5;13
+.png 38;5;13
+.svg 38;5;13
+.svgz 38;5;13
+.mng 38;5;13
+.pcx 38;5;13
+.mov 38;5;13
+.mpg 38;5;13
+.mpeg 38;5;13
+.m2v 38;5;13
+.mkv 38;5;13
+.ogm 38;5;13
+.mp4 38;5;13
+.m4v 38;5;13
+.mp4v 38;5;13
+.vob 38;5;13
+.qt  38;5;13
+.nuv 38;5;13
+.wmv 38;5;13
+.asf 38;5;13
+.rm  38;5;13
+.rmvb 38;5;13
+.flc 38;5;13
+.avi 38;5;13
+.fli 38;5;13
+.flv 38;5;13
+.gl 38;5;13
+.dl 38;5;13
+.xcf 38;5;13
+.xwd 38;5;13
+.yuv 38;5;13
+.cgm 38;5;13
+.emf 38;5;13
+
+# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+.axv 38;5;13
+.anx 38;5;13
+.ogv 38;5;13
+.ogx 38;5;13
+
+# audio formats (cyan)
+.aac 38;5;45
+.au 38;5;45
+.flac 38;5;45
+.mid 38;5;45
+.midi 38;5;45
+.mka 38;5;45
+.mp3 38;5;45
+.mpc 38;5;45
+.ogg 38;5;45
+.ra 38;5;45
+.wav 38;5;45
+
+# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+.axa 38;5;45
+.oga 38;5;45
+.spx 38;5;45
+.xspf 38;5;45
+
+# colorize binary documents (brown)
+#.pdf 00;33
+#.ps 00;33
+#.ps.gz 00;33
+#.tex 00;33
+#.xls 00;33
+#.xlsx 00;33
+#.ppt 00;33
+#.pptx 00;33
+#.rtf 00;33
+#.doc 00;33
+#.docx 00;33
+#.odt 00;33
+#.ods 00;33
+#.odp 00;33
+#.epub 00;33
+#.abw 00;33
+#.wpd 00;33
+#
+# colorize text documents (brown)
+#.txt 00;33
+#.patch 00;33
+#.diff 00;33
+#.log 00;33
+#.htm 00;33
+#.html 00;33
+#.shtml 00;33
+#.xml 00;33
diff --git a/coreutils/DIR_COLORS.lightbgcolor b/coreutils/DIR_COLORS.lightbgcolor
new file mode 100644 (file)
index 0000000..ac46288
--- /dev/null
@@ -0,0 +1,224 @@
+# Configuration file for the color ls utility - modified for gray backgrounds
+# Synchronized with coreutils 8.5 dircolors
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+
+# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
+# pipes. 'all' adds color characters to all output. 'none' shuts colorization
+# off.
+COLOR tty
+
+# Extra command line options for ls go here.
+# Basically these ones are:
+#  -F = show '/' for dirs, '*' for executables, etc.
+#  -T 0 = don't trust tab spacing when formatting ls output.
+OPTIONS -F -T 0
+
+# Below, there should be one TERM entry for each termtype that is colorizable
+TERM linux
+TERM console
+TERM con132x25
+TERM con132x30
+TERM con132x43
+TERM con132x60
+TERM con80x25
+TERM con80x28
+TERM con80x30
+TERM con80x43
+TERM con80x50
+TERM con80x60
+TERM cons25
+TERM xterm
+TERM xterm-16color
+TERM xterm-88color
+TERM xterm-256color
+TERM rxvt
+TERM rxvt-256color
+TERM rxvt-unicode
+TERM rxvt-unicode-256color
+TERM rxvt-unicode256
+TERM xterm-color
+TERM color-xterm
+TERM vt100
+TERM dtterm
+TERM color_xterm
+
+# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
+EIGHTBIT 1
+
+# Below are the color init strings for the basic file types. A color init
+# string consists of one or more of the following numeric codes:
+# Attribute codes:
+# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
+# Text color codes:
+# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
+# Background color codes:
+# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
+#NORMAL 00     # no color code at all
+#FILE 00       # normal file, use no color at all
+RESET 0
+DIR 00;34      # directory
+LINK 00;36     # symbolic link (If you set this to 'target' instead of a
+               # numerical value, the color is as for the file pointed to.)
+MULTIHARDLINK 00 # regular file with more than one link
+FIFO 40;33     # pipe
+SOCK 00;35     # socket
+DOOR 00;35     # door
+BLK 40;33;01   # block device driver
+CHR 40;33;01   # character device driver
+ORPHAN 40;31;01  # symlink to nonexistent file, or non-stat'able file
+MISSING 01;05;37;41 # ... and the files they point to
+SETUID 37;41   # file that is setuid (u+s)
+SETGID 30;43   # file that is setgid (g+s)
+CAPABILITY 30;41       # file with capability
+STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
+OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
+STICKY 37;44   # dir with the sticky bit set (+t) and not other-writable
+
+
+# This is for files with execute permission:
+EXEC 00;32
+
+# List any file extensions like '.gz' or '.tar' that you would like ls
+# to colorize below. Put the extension, a space, and the color init string.
+# (and any comments you want to add after a '#')
+#.cmd 00;32 # executables (green)
+#.exe 00;32
+#.com 00;32
+#.btm 00;32
+#.bat 00;32
+#.sh  00;32
+#.csh 00;32
+ # archives or compressed (red)
+.tar 00;31
+.tgz 00;31
+.arj 00;31
+.taz 00;31
+.lzh 00;31
+.lzma 00;31
+.tlz 00;31
+.txz 00;31
+.zip 00;31
+.z   00;31
+.Z   00;31
+.dz  00;31
+.gz  00;31
+.lz  00;31
+.xz  00;31
+.bz2 00;31
+.tbz 00;31
+.tbz2 00;31
+.bz  00;31
+.tz  00;31
+.deb 00;31
+.rpm 00;31
+.jar 00;31
+.war 00;31
+.ear 00;31
+.sar 00;31
+.rar 00;31
+.ace 00;31
+.zoo 00;31
+.cpio 00;31
+.7z  00;31
+.rz  00;31
+# image formats (magenta)
+.jpg 00;35
+.jpeg 00;35
+.gif 00;35
+.bmp 00;35
+.pbm 00;35
+.pgm 00;35
+.ppm 00;35
+.tga 00;35
+.xbm 00;35
+.xpm 00;35
+.tif 00;35
+.tiff 00;35
+.png 00;35
+.svg 00;35
+.svgz 00;35
+.mng 00;35
+.pcx 00;35
+.mov 00;35
+.mpg 00;35
+.mpeg 00;35
+.m2v 00;35
+.mkv 00;35
+.ogm 00;35
+.mp4 00;35
+.m4v 00;35
+.mp4v 00;35
+.vob 00;35
+.qt  00;35
+.nuv 00;35
+.wmv 00;35
+.asf 00;35
+.rm  00;35
+.rmvb 00;35
+.flc 00;35
+.avi 00;35
+.fli 00;35
+.flv 00;35
+.gl 00;35
+.dl 00;35
+.xcf 00;35
+.xwd 00;35
+.yuv 00;35
+.cgm 00;35
+.emf 00;35
+
+# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+.axv 00;35
+.anx 00;35
+.ogv 00;35
+.ogx 00;35
+
+# audio formats (cyan)
+.aac 00;36
+.au 00;36
+.flac 00;36
+.mid 00;36
+.midi 00;36
+.mka 00;36
+.mp3 00;36
+.mpc 00;36
+.ogg 00;36
+.ra 00;36
+.wav 00;36
+
+# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
+.axa 00;36
+.oga 00;36
+.spx 00;36
+.xspf 00;36
+
+# colorize binary documents (brown)
+#.pdf 00;33
+#.ps 00;33
+#.ps.gz 00;33
+#.tex 00;33
+#.xls 00;33
+#.xlsx 00;33
+#.ppt 00;33
+#.pptx 00;33
+#.rtf 00;33
+#.doc 00;33
+#.docx 00;33
+#.odt 00;33
+#.ods 00;33
+#.odp 00;33
+#.epub 00;33
+#.abw 00;33
+#.wpd 00;33
+#
+# colorize text documents (brown)
+#.txt 00;33
+#.patch 00;33
+#.diff 00;33
+#.log 00;33
+#.htm 00;33
+#.html 00;33
+#.shtml 00;33
+#.xml 00;33
index 9cdc44505e908fd7c1e2cc5cf5a8ec49578a3018..eb0b9621ed9bc1903b4d8751aae8efd4892fc795 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = coreutils
 version    = 8.17
-release    = 1
+release    = 2
 
 groups     = System/Base
 url        = http://www.gnu.org/software/coreutils/
@@ -72,7 +72,9 @@ build
 
                # Dump /etc/DIR_COLORS
                mkdir -pv %{BUILDROOT}%{sysconfdir}
-               dircolors -p > %{BUILDROOT}/etc/DIR_COLORS
+               for i in DIR_COLORS DIR_COLORS.256color DIR_COLORS.lightbgcolor; do
+                       install -m 644 %{DIR_SOURCE}/${i} %{BUILDROOT}%{sysconfdir}
+               done
 
                # Install profile.d.
                mkdir -pv %{BUILDROOT}%{sysconfdir}/profile.d/
diff --git a/coreutils/profile.d/term256.sh b/coreutils/profile.d/term256.sh
new file mode 100644 (file)
index 0000000..546f67b
--- /dev/null
@@ -0,0 +1,26 @@
+# Enable 256 color capabilities for appropriate terminals
+
+# Set this variable in your local shell config (such as ~/.bashrc)
+# if you want remote xterms connecting to this system, to be sent 256 colors.
+# This must be set before reading global initialization such as /etc/bashrc.
+#   SEND_256_COLORS_TO_REMOTE=1
+
+# Terminals with any of the following set, support 256 colors (and are local)
+local256="$COLORTERM$XTERM_VERSION$ROXTERM_ID$KONSOLE_DBUS_SESSION"
+
+if [ -n "$local256" ] || [ -n "$SEND_256_COLORS_TO_REMOTE" ]; then
+
+  case "$TERM" in
+    'xterm') TERM=xterm-256color;;
+    'screen') TERM=screen-256color;;
+    'Eterm') TERM=Eterm-256color;;
+  esac
+  export TERM
+
+  if [ -n "$TERMCAP" ] && [ "$TERM" = "screen-256color" ]; then
+    TERMCAP=$(echo "$TERMCAP" | sed -e 's/Co#8/Co#256/g')
+    export TERMCAP
+  fi
+fi
+
+unset local256
index 39225947d531d30c27a1dc27cd55995967284dc5..3b5672b8b3cdd7cddb48eb4538db9d7cb1078ad1 100644 (file)
@@ -4,8 +4,8 @@
 ###############################################################################
 
 name       = cups
-version    = 1.4.5
-release    = 7
+version    = 1.6.1
+release    = 1
 
 groups     = Applications/Printing
 url        = http://cups.org/software.php
diff --git a/cups/patches/001_cups-no-gzip-man.patch b/cups/patches/001_cups-no-gzip-man.patch
new file mode 100644 (file)
index 0000000..cabfcf1
--- /dev/null
@@ -0,0 +1,18 @@
+diff -up cups-1.6b1/config-scripts/cups-manpages.m4.no-gzip-man cups-1.6b1/config-scripts/cups-manpages.m4
+--- cups-1.6b1/config-scripts/cups-manpages.m4.no-gzip-man     2012-04-23 19:26:57.000000000 +0200
++++ cups-1.6b1/config-scripts/cups-manpages.m4 2012-05-25 14:57:01.959845267 +0200
+@@ -69,10 +69,10 @@ case "$uname" in
+               ;;
+       Linux* | GNU* | Darwin*)
+               # Linux, GNU Hurd, and OS X
+-              MAN1EXT=1.gz
+-              MAN5EXT=5.gz
+-              MAN7EXT=7.gz
+-              MAN8EXT=8.gz
++              MAN1EXT=1
++              MAN5EXT=5
++              MAN7EXT=7
++              MAN8EXT=8
+               MAN8DIR=8
+               ;;
+       *)
similarity index 59%
rename from cups/patches/cups-1.1.16-system-auth.patch
rename to cups/patches/002_cups-system-auth.patch
index 7ce17e5dfd8dee1f66e734cd84a7c4c452d93a3d..60117a9c833a6e3062ef62739addabf1930356f8 100644 (file)
@@ -1,22 +1,21 @@
-diff -up /dev/null cups-1.4.2/conf/cups.password-auth
---- /dev/null  2009-11-10 09:17:06.284031490 +0000
-+++ cups-1.4.2/conf/cups.password-auth 2009-11-10 11:15:42.750666738 +0000
+diff -up cups-1.5b1/conf/cups.password-auth.system-auth cups-1.5b1/conf/cups.password-auth
+--- cups-1.5b1/conf/cups.password-auth.system-auth     2011-05-23 17:27:27.000000000 +0200
++++ cups-1.5b1/conf/cups.password-auth 2011-05-23 17:27:27.000000000 +0200
 @@ -0,0 +1,4 @@
 +#%PAM-1.0
 +# Use password-auth common PAM configuration for the daemon
 +auth        include     password-auth
 +account     include     password-auth
-diff -up cups-1.4.2/conf/cups.system-auth cups-1.4.2/conf/cups
-diff -up /dev/null cups-1.4.2/conf/cups.system-auth
---- /dev/null  2009-11-10 09:17:06.284031490 +0000
-+++ cups-1.4.2/conf/cups.system-auth   2009-11-10 11:15:42.750666738 +0000
+diff -up cups-1.5b1/conf/cups.system-auth.system-auth cups-1.5b1/conf/cups.system-auth
+--- cups-1.5b1/conf/cups.system-auth.system-auth       2011-05-23 17:27:27.000000000 +0200
++++ cups-1.5b1/conf/cups.system-auth   2011-05-23 17:27:27.000000000 +0200
 @@ -0,0 +1,3 @@
 +#%PAM-1.0
 +auth  include         system-auth
 +account       include         system-auth
-diff -up cups-1.4.2/conf/Makefile.system-auth cups-1.4.2/conf/Makefile
---- cups-1.4.2/conf/Makefile.system-auth       2009-09-22 22:53:31.000000000 +0100
-+++ cups-1.4.2/conf/Makefile   2009-11-10 11:18:44.188791989 +0000
+diff -up cups-1.5b1/conf/Makefile.system-auth cups-1.5b1/conf/Makefile
+--- cups-1.5b1/conf/Makefile.system-auth       2011-05-12 07:21:56.000000000 +0200
++++ cups-1.5b1/conf/Makefile   2011-05-23 17:27:27.000000000 +0200
 @@ -90,10 +90,16 @@ install-data:
        done
        -if test x$(PAMDIR) != x; then \
similarity index 62%
rename from cups/patches/cups-multilib.patch
rename to cups/patches/003_cups-multilib.patch
index 21db4cb7a5e3323d45de176c54386844a3c5b89b..3c6bc397ab9d41d77ef98098542216e0b4b9b205 100644 (file)
@@ -1,6 +1,7 @@
---- cups-1.2.3/cups-config.in.multilib 2006-08-03 01:54:38.000000000 +0100
-+++ cups-1.2.3/cups-config.in  2006-08-30 15:47:35.000000000 +0100
-@@ -30,8 +30,10 @@
+diff -up cups-1.5b1/cups-config.in.multilib cups-1.5b1/cups-config.in
+--- cups-1.5b1/cups-config.in.multilib 2010-06-16 02:48:25.000000000 +0200
++++ cups-1.5b1/cups-config.in  2011-05-23 17:33:31.000000000 +0200
+@@ -22,8 +22,10 @@ prefix=@prefix@
  exec_prefix=@exec_prefix@
  bindir=@bindir@
  includedir=@includedir@
diff --git a/cups/patches/004_cups-banners.patch b/cups/patches/004_cups-banners.patch
new file mode 100644 (file)
index 0000000..aa19282
--- /dev/null
@@ -0,0 +1,12 @@
+diff -up cups-1.5b1/scheduler/banners.c.banners cups-1.5b1/scheduler/banners.c
+--- cups-1.5b1/scheduler/banners.c.banners     2011-05-20 05:49:49.000000000 +0200
++++ cups-1.5b1/scheduler/banners.c     2011-05-23 17:35:30.000000000 +0200
+@@ -110,6 +110,8 @@ cupsdLoadBanners(const char *d)            /* I - 
+     if ((ext = strrchr(dent->filename, '.')) != NULL)
+       if (!strcmp(ext, ".bck") ||
+           !strcmp(ext, ".bak") ||
++          !strcmp(ext, ".rpmnew") ||
++          !strcmp(ext, ".rpmsave") ||
+         !strcmp(ext, ".sav"))
+       continue;
similarity index 56%
rename from cups/patches/cups-serverbin-compat.patch
rename to cups/patches/005_cups-serverbin-compat.patch
index 44a78942bfa1b6fe54b3e9de40ce36478cb10ccf..0ca72fd370d53eb6f3f16656bb364c2a01dae9ae 100644 (file)
@@ -1,7 +1,7 @@
-diff -up cups-1.4.4/scheduler/conf.c.serverbin-compat cups-1.4.4/scheduler/conf.c
---- cups-1.4.4/scheduler/conf.c.serverbin-compat       2010-04-23 19:56:34.000000000 +0100
-+++ cups-1.4.4/scheduler/conf.c        2010-09-15 13:20:41.339960335 +0100
-@@ -488,6 +488,9 @@ cupsdReadConfiguration(void)
+diff -up cups-1.5b1/scheduler/conf.c.serverbin-compat cups-1.5b1/scheduler/conf.c
+--- cups-1.5b1/scheduler/conf.c.serverbin-compat       2011-05-20 06:24:54.000000000 +0200
++++ cups-1.5b1/scheduler/conf.c        2011-05-23 17:20:33.000000000 +0200
+@@ -491,6 +491,9 @@ cupsdReadConfiguration(void)
    cupsdClearString(&ServerName);
    cupsdClearString(&ServerAdmin);
    cupsdSetString(&ServerBin, CUPS_SERVERBIN);
@@ -11,7 +11,7 @@ diff -up cups-1.4.4/scheduler/conf.c.serverbin-compat cups-1.4.4/scheduler/conf.
    cupsdSetString(&RequestRoot, CUPS_REQUESTS);
    cupsdSetString(&CacheDir, CUPS_CACHEDIR);
    cupsdSetString(&DataDir, CUPS_DATADIR);
-@@ -1318,7 +1321,12 @@ cupsdReadConfiguration(void)
+@@ -1378,7 +1381,12 @@ cupsdReadConfiguration(void)
      * Read the MIME type and conversion database...
      */
  
@@ -23,10 +23,10 @@ diff -up cups-1.4.4/scheduler/conf.c.serverbin-compat cups-1.4.4/scheduler/conf.
 +#endif
      snprintf(mimedir, sizeof(mimedir), "%s/mime", DataDir);
  
-     MimeDatabase = mimeLoadTypes(NULL, mimedir);
-diff -up cups-1.4.4/scheduler/conf.h.serverbin-compat cups-1.4.4/scheduler/conf.h
---- cups-1.4.4/scheduler/conf.h.serverbin-compat       2010-04-23 19:56:34.000000000 +0100
-+++ cups-1.4.4/scheduler/conf.h        2010-09-15 13:20:41.340959464 +0100
+     MimeDatabase = mimeNew();
+diff -up cups-1.5b1/scheduler/conf.h.serverbin-compat cups-1.5b1/scheduler/conf.h
+--- cups-1.5b1/scheduler/conf.h.serverbin-compat       2011-04-22 19:47:03.000000000 +0200
++++ cups-1.5b1/scheduler/conf.h        2011-05-23 15:34:25.000000000 +0200
 @@ -105,6 +105,10 @@ VAR char          *ConfigurationFile      VALUE(NULL)
                                        /* Root directory for scheduler */
                        *ServerBin              VALUE(NULL),
@@ -38,27 +38,27 @@ diff -up cups-1.4.4/scheduler/conf.h.serverbin-compat cups-1.4.4/scheduler/conf.
                        *StateDir               VALUE(NULL),
                                        /* Root directory for state data */
                        *RequestRoot            VALUE(NULL),
-diff -up cups-1.4.4/scheduler/env.c.serverbin-compat cups-1.4.4/scheduler/env.c
---- cups-1.4.4/scheduler/env.c.serverbin-compat        2009-06-15 18:13:52.000000000 +0100
-+++ cups-1.4.4/scheduler/env.c 2010-09-15 13:20:41.341959587 +0100
-@@ -87,8 +87,13 @@ cupsdInitEnv(void)
-   cupsdSetEnv("LD_LIBRARY_PATH", NULL);
-   cupsdSetEnv("LD_PRELOAD", NULL);
-   cupsdSetEnv("NLSPATH", NULL);
+diff -up cups-1.5b1/scheduler/env.c.serverbin-compat cups-1.5b1/scheduler/env.c
+--- cups-1.5b1/scheduler/env.c.serverbin-compat        2011-01-11 04:48:42.000000000 +0100
++++ cups-1.5b1/scheduler/env.c 2011-05-23 17:07:17.000000000 +0200
+@@ -218,8 +218,13 @@ cupsdUpdateEnv(void)
+   set_if_undefined("LD_PRELOAD", NULL);
+   set_if_undefined("NLSPATH", NULL);
+   if (find_env("PATH") < 0)
 +#ifdef __x86_64__
-+  cupsdSetEnvf("PATH", "%s/filter:%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR
-+                       ":/bin:/usr/bin", ServerBin, ServerBin_compat);
++    cupsdSetEnvf("PATH", "%s/filter:%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR
++                         ":/bin:/usr/bin", ServerBin, ServerBin_compat);
 +#else /* ! defined(__x86_64__) */
-   cupsdSetEnvf("PATH", "%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR
-                        ":/bin:/usr/bin", ServerBin);
+     cupsdSetEnvf("PATH", "%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR
+                        ":/bin:/usr/bin", ServerBin);
 +#endif
-   cupsdSetEnv("SERVER_ADMIN", ServerAdmin);
-   cupsdSetEnv("SHLIB_PATH", NULL);
-   cupsdSetEnv("SOFTWARE", CUPS_MINIMAL);
-diff -up cups-1.4.4/scheduler/ipp.c.serverbin-compat cups-1.4.4/scheduler/ipp.c
---- cups-1.4.4/scheduler/ipp.c.serverbin-compat        2010-04-23 19:56:34.000000000 +0100
-+++ cups-1.4.4/scheduler/ipp.c 2010-09-15 13:20:41.359835378 +0100
-@@ -2615,9 +2615,18 @@ add_printer(cupsd_client_t  *con,       /* I -
+   set_if_undefined("SERVER_ADMIN", ServerAdmin);
+   set_if_undefined("SHLIB_PATH", NULL);
+   set_if_undefined("SOFTWARE", CUPS_MINIMAL);
+diff -up cups-1.5b1/scheduler/ipp.c.serverbin-compat cups-1.5b1/scheduler/ipp.c
+--- cups-1.5b1/scheduler/ipp.c.serverbin-compat        2011-05-20 05:49:49.000000000 +0200
++++ cups-1.5b1/scheduler/ipp.c 2011-05-23 16:09:57.000000000 +0200
+@@ -2586,9 +2586,18 @@ add_printer(cupsd_client_t  *con,       /* I -
          * Could not find device in list!
        */
  
@@ -68,8 +68,8 @@ diff -up cups-1.4.4/scheduler/ipp.c.serverbin-compat cups-1.4.4/scheduler/ipp.c
 +      if (access(srcfile, X_OK))
 +      {
 +#endif /* __x86_64__ */
-       send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri scheme \"%s\"!"),
-                       scheme);
+       send_ipp_status(con, IPP_NOT_POSSIBLE,
+                         _("Bad device-uri scheme \"%s\"."), scheme);
        return;
 +#ifdef __x86_64__
 +      }
@@ -77,10 +77,10 @@ diff -up cups-1.4.4/scheduler/ipp.c.serverbin-compat cups-1.4.4/scheduler/ipp.c
        }
      }
  
-diff -up cups-1.4.4/scheduler/job.c.serverbin-compat cups-1.4.4/scheduler/job.c
---- cups-1.4.4/scheduler/job.c.serverbin-compat        2010-03-30 23:07:33.000000000 +0100
-+++ cups-1.4.4/scheduler/job.c 2010-09-15 13:20:41.366836134 +0100
-@@ -972,8 +972,32 @@ cupsdContinueJob(cupsd_job_t *job)        /* I 
+diff -up cups-1.5b1/scheduler/job.c.serverbin-compat cups-1.5b1/scheduler/job.c
+--- cups-1.5b1/scheduler/job.c.serverbin-compat        2011-05-20 05:49:49.000000000 +0200
++++ cups-1.5b1/scheduler/job.c 2011-05-23 16:18:57.000000000 +0200
+@@ -1047,8 +1047,32 @@ cupsdContinueJob(cupsd_job_t *job)      /* I 
         i ++, filter = (mime_filter_t *)cupsArrayNext(filters))
    {
      if (filter->filter[0] != '/')
@@ -115,21 +115,21 @@ diff -up cups-1.4.4/scheduler/job.c.serverbin-compat cups-1.4.4/scheduler/job.c
      else
        strlcpy(command, filter->filter, sizeof(command));
  
-@@ -1119,6 +1143,28 @@ cupsdContinueJob(cupsd_job_t *job)      /* I 
-       cupsdClosePipe(job->print_pipes);
+@@ -1199,6 +1223,28 @@ cupsdContinueJob(cupsd_job_t *job)      /* I 
+     {
        cupsdClosePipe(job->back_pipes);
        cupsdClosePipe(job->side_pipes);
 +#ifdef __x86_64__
 +      if (access(command, F_OK))
 +      {
 +        snprintf(command, sizeof(command), "%s/backend/%s", ServerBin_compat,
-+                 method);
++                 scheme);
 +        if (!access(command, F_OK))
 +          {
 +            /* Not in the correct directory, but we found it in the compat
 +             * directory.  Issue a warning. */
 +            cupsdLogMessage(CUPSD_LOG_INFO,
-+                            "Backend '%s' not in %s/backend!", method,
++                            "Backend '%s' not in %s/backend!", scheme,
 +                            ServerBin);
 +          }
 +        else
@@ -137,17 +137,17 @@ diff -up cups-1.4.4/scheduler/job.c.serverbin-compat cups-1.4.4/scheduler/job.c
 +            /* Not in the compat directory either; make any error
 +               messages use the correct directory name then. */
 +            snprintf(command, sizeof(command), "%s/backend/%s", ServerBin,
-+                     method);
++                     scheme);
 +          }
 +      }
 +#endif /* __x86_64__ */
  
        close(job->status_pipes[1]);
        job->status_pipes[1] = -1;
-diff -up cups-1.4.4/scheduler/printers.c.serverbin-compat cups-1.4.4/scheduler/printers.c
---- cups-1.4.4/scheduler/printers.c.serverbin-compat   2010-04-23 21:53:38.000000000 +0100
-+++ cups-1.4.4/scheduler/printers.c    2010-09-15 13:21:39.627960657 +0100
-@@ -1059,9 +1059,19 @@ cupsdLoadAllPrinters(void)
+diff -up cups-1.5b1/scheduler/printers.c.serverbin-compat cups-1.5b1/scheduler/printers.c
+--- cups-1.5b1/scheduler/printers.c.serverbin-compat   2011-05-20 05:49:49.000000000 +0200
++++ cups-1.5b1/scheduler/printers.c    2011-05-23 17:09:04.000000000 +0200
+@@ -1030,9 +1030,19 @@ cupsdLoadAllPrinters(void)
            * Backend does not exist, stop printer...
            */
  
@@ -167,28 +167,24 @@ diff -up cups-1.4.4/scheduler/printers.c.serverbin-compat cups-1.4.4/scheduler/p
          }
          }
  
-@@ -3603,6 +3613,14 @@ add_printer_filter(
+@@ -3621,8 +3631,20 @@ add_printer_filter(
+     else
+       snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin, program);
  
-     if (stat(filename, &fileinfo))
-     {
 +#ifdef __x86_64__
++    if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser,
++                       cupsdLogFCMessage, p) == _CUPS_FILE_CHECK_MISSING) {
 +      snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin_compat,
-+             program);
-+      if (stat(filename, &fileinfo))
-+      {
++               program);
++      if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser,
++                         cupsdLogFCMessage, p) == _CUPS_FILE_CHECK_MISSING)
 +        snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin,
 +                 program);
-+#endif /* __x86_64__ */
-       memset(&fileinfo, 0, sizeof(fileinfo));
-       snprintf(p->state_message, sizeof(p->state_message),
-@@ -3611,6 +3629,9 @@ add_printer_filter(
-       cupsdSetPrinterReasons(p, "+cups-missing-filter-warning");
-       cupsdLogMessage(CUPSD_LOG_ERROR, "%s", p->state_message);
-+#ifdef __x86_64__
-+      }
-+#endif /* __x86_64__ */
-     }
++    }
++#else /* ! defined(__x86_64__) */
+     _cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser,
+                    cupsdLogFCMessage, p);
++#endif 
+   }
  
-    /*
+  /*
diff --git a/cups/patches/006_cups-no-export-ssllibs.patch b/cups/patches/006_cups-no-export-ssllibs.patch
new file mode 100644 (file)
index 0000000..de277d8
--- /dev/null
@@ -0,0 +1,12 @@
+diff -up cups-1.5.3/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1.5.3/config-scripts/cups-ssl.m4
+--- cups-1.5.3/config-scripts/cups-ssl.m4.no-export-ssllibs    2012-03-21 05:45:48.000000000 +0100
++++ cups-1.5.3/config-scripts/cups-ssl.m4      2012-05-15 16:47:13.753314620 +0200
+@@ -173,7 +173,7 @@ AC_SUBST(IPPALIASES)
+ AC_SUBST(SSLFLAGS)
+ AC_SUBST(SSLLIBS)
+-EXPORT_SSLLIBS="$SSLLIBS"
++EXPORT_SSLLIBS=""
+ AC_SUBST(EXPORT_SSLLIBS)
+ dnl
similarity index 56%
rename from cups/patches/cups-direct-usb.patch
rename to cups/patches/007_cups-direct-usb.patch
index 2724fad83d1df027e7777e7a96582662a7d647ca..4e25ce7db4556f8c5322e9b28d50f15f25c76913 100644 (file)
@@ -1,8 +1,8 @@
-diff -up cups-1.3.7/backend/usb-unix.c.direct-usb cups-1.3.7/backend/usb-unix.c
---- cups-1.3.7/backend/usb-unix.c.direct-usb   2008-03-26 16:02:45.000000000 +0000
-+++ cups-1.3.7/backend/usb-unix.c      2008-07-15 13:25:56.000000000 +0100
-@@ -94,6 +94,9 @@ print_device(const char *uri,                /* I - De
-              strncasecmp(hostname, "Minolta", 7);
+diff -up cups-1.5b1/backend/usb-unix.c.direct-usb cups-1.5b1/backend/usb-unix.c
+--- cups-1.5b1/backend/usb-unix.c.direct-usb   2011-05-20 05:49:49.000000000 +0200
++++ cups-1.5b1/backend/usb-unix.c      2011-05-23 17:52:14.000000000 +0200
+@@ -102,6 +102,9 @@ print_device(const char *uri,              /* I - De
+              _cups_strncasecmp(hostname, "Minolta", 7);
  #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
  
 +    if (use_bc && !strncmp(uri, "usb:/dev/", 9))
@@ -11,7 +11,7 @@ diff -up cups-1.3.7/backend/usb-unix.c.direct-usb cups-1.3.7/backend/usb-unix.c
      if ((device_fd = open_device(uri, &use_bc)) == -1)
      {
        if (getenv("CLASS") != NULL)
-@@ -320,12 +323,7 @@ open_device(const char *uri,              /* I - Dev
+@@ -331,12 +334,7 @@ open_device(const char *uri,              /* I - Dev
    if (!strncmp(uri, "usb:/dev/", 9))
  #ifdef __linux
    {
similarity index 66%
rename from cups/patches/cups-lpr-help.patch
rename to cups/patches/008_cups-lpr-help.patch
index 1a682975b05986d04d5263c2233ce4923487f755..c42434dbcf93b135d6cd634cfb4ee5327017ff73 100644 (file)
@@ -1,8 +1,8 @@
-diff -up cups-1.4b1/berkeley/lpr.c.lpr-help cups-1.4b1/berkeley/lpr.c
---- cups-1.4b1/berkeley/lpr.c.lpr-help 2008-07-11 23:46:21.000000000 +0100
-+++ cups-1.4b1/berkeley/lpr.c  2008-11-11 16:20:32.000000000 +0000
-@@ -30,6 +30,31 @@
- #include <cups/i18n.h>
+diff -up cups-1.5b1/berkeley/lpr.c.lpr-help cups-1.5b1/berkeley/lpr.c
+--- cups-1.5b1/berkeley/lpr.c.lpr-help 2011-03-21 23:02:00.000000000 +0100
++++ cups-1.5b1/berkeley/lpr.c  2011-05-23 17:58:06.000000000 +0200
+@@ -24,6 +24,31 @@
+ #include <cups/cups-private.h>
  
  
 +static void
@@ -33,15 +33,7 @@ diff -up cups-1.4b1/berkeley/lpr.c.lpr-help cups-1.4b1/berkeley/lpr.c
  /*
   * 'main()' - Parse options and send files for printing.
   */
-@@ -54,7 +79,6 @@ main(int  argc,                              /* I - Number of comm
-   int         deletefile;             /* Delete file after print? */
-   char                buffer[8192];           /* Copy buffer */
--
-   _cupsSetLocale(argv);
-   deletefile  = 0;
-@@ -282,6 +306,12 @@ main(int  argc,                           /* I - Number of comm
+@@ -270,6 +294,12 @@ main(int  argc,                           /* I - Number of comm
            break;
  
        default :
@@ -52,5 +44,5 @@ diff -up cups-1.4b1/berkeley/lpr.c.lpr-help cups-1.4b1/berkeley/lpr.c
 +          }
 +
            _cupsLangPrintf(stderr,
-                           _("%s: Error - unknown option \'%c\'!\n"),
-                           argv[0], argv[i][1]);
+                           _("%s: Error - unknown option \"%c\"."), argv[0],
+                           argv[i][1]);
diff --git a/cups/patches/009_cups-peercred.patch b/cups/patches/009_cups-peercred.patch
new file mode 100644 (file)
index 0000000..a106abb
--- /dev/null
@@ -0,0 +1,11 @@
+diff -up cups-1.5b1/scheduler/auth.c.peercred cups-1.5b1/scheduler/auth.c
+--- cups-1.5b1/scheduler/auth.c.peercred       2011-05-20 05:49:49.000000000 +0200
++++ cups-1.5b1/scheduler/auth.c        2011-05-23 18:00:18.000000000 +0200
+@@ -52,6 +52,7 @@
+  * Include necessary headers...
+  */
++#define _GNU_SOURCE
+ #include "cupsd.h"
+ #include <grp.h>
+ #ifdef HAVE_SHADOW_H
similarity index 64%
rename from cups/patches/cups-pid.patch
rename to cups/patches/010_cups-pid.patch
index ab4ff849991784bf993264a3b0fc416ae9a18ff1..23ffd47064334964a3c36a11277ead1a0647afa8 100644 (file)
@@ -1,6 +1,7 @@
---- cups-1.1.21/scheduler/main.c.pid   2004-09-24 11:29:05.073748138 +0100
-+++ cups-1.1.21/scheduler/main.c       2004-09-24 11:44:35.826446564 +0100
-@@ -349,6 +349,8 @@
+diff -up cups-1.5b1/scheduler/main.c.pid cups-1.5b1/scheduler/main.c
+--- cups-1.5b1/scheduler/main.c.pid    2011-05-18 22:44:16.000000000 +0200
++++ cups-1.5b1/scheduler/main.c        2011-05-23 18:01:20.000000000 +0200
+@@ -311,6 +311,8 @@ main(int  argc,                            /* I - Number of comm
      * Setup signal handlers for the parent...
      */
  
@@ -9,7 +10,7 @@
  #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
      sigset(SIGUSR1, parent_handler);
      sigset(SIGCHLD, parent_handler);
-@@ -372,7 +374,7 @@
+@@ -334,7 +336,7 @@ main(int  argc,                            /* I - Number of comm
      signal(SIGHUP, SIG_IGN);
  #endif /* HAVE_SIGSET */
  
@@ -18,7 +19,7 @@
      {
       /*
        * OK, wait for the child to startup and send us SIGUSR1 or to crash
-@@ -384,7 +386,15 @@
+@@ -346,7 +348,15 @@ main(int  argc,                           /* I - Number of comm
          sleep(1);
  
        if (parent_signal == SIGUSR1)
similarity index 72%
rename from cups/patches/cups-eggcups.patch
rename to cups/patches/011_cups-eggcups.patch
index fde1e0796ab2e1cc3b4ae81afee6f74b97a0a4a5..981d92017267b56aa1646ddcbe202219e71596f1 100644 (file)
@@ -1,9 +1,9 @@
-diff -up cups-1.4b1/backend/ipp.c.eggcups cups-1.4b1/backend/ipp.c
---- cups-1.4b1/backend/ipp.c.eggcups   2008-10-15 19:27:45.000000000 +0100
-+++ cups-1.4b1/backend/ipp.c   2008-11-11 15:43:30.000000000 +0000
-@@ -51,6 +51,70 @@ static char pstmpname[1024] = "";   /* Tem
- static char   tmpfilename[1024] = ""; /* Temporary spool file name */
static int    job_cancelled = 0;      /* Job cancelled? */
+diff -up cups-1.5.3/backend/ipp.c.eggcups cups-1.5.3/backend/ipp.c
+--- cups-1.5.3/backend/ipp.c.eggcups   2012-05-05 01:00:01.000000000 +0200
++++ cups-1.5.3/backend/ipp.c   2012-05-15 16:50:41.142868986 +0200
+@@ -138,6 +138,70 @@ static cups_array_t       *state_reasons; /* A
+ static char           tmpfilename[1024] = "";
                                      /* Temporary spool file name */
  
 +#if HAVE_DBUS
 +#include <dbus/dbus.h>
@@ -72,8 +72,8 @@ diff -up cups-1.4b1/backend/ipp.c.eggcups cups-1.4b1/backend/ipp.c
  
  /*
   * Local functions...
-@@ -1058,6 +1122,15 @@ main(int  argc,                         /* I - Number of comm
-                       job_id);
+@@ -1520,6 +1584,15 @@ main(int  argc,                         /* I - Number of comm
+                            _("Print file accepted - job ID %d."), job_id);
      }
  
 +#if HAVE_DBUS
@@ -85,25 +85,25 @@ diff -up cups-1.4b1/backend/ipp.c.eggcups cups-1.4b1/backend/ipp.c
 +                                getenv ("PRINTER"));
 +#endif /* HAVE_DBUS */
 +
+     fprintf(stderr, "DEBUG: job-id=%d\n", job_id);
      ippDelete(response);
  
-     if (job_cancelled)
-diff -up cups-1.4b1/backend/Makefile.eggcups cups-1.4b1/backend/Makefile
---- cups-1.4b1/backend/Makefile.eggcups        2008-10-06 22:08:27.000000000 +0100
-+++ cups-1.4b1/backend/Makefile        2008-11-11 15:45:31.000000000 +0000
-@@ -188,7 +188,7 @@ dnssd:     dnssd.o ../cups/$(LIBCUPS) libbac
+diff -up cups-1.5.3/backend/Makefile.eggcups cups-1.5.3/backend/Makefile
+--- cups-1.5.3/backend/Makefile.eggcups        2012-04-23 19:42:12.000000000 +0200
++++ cups-1.5.3/backend/Makefile        2012-05-15 16:48:17.253871982 +0200
+@@ -212,7 +212,7 @@ dnssd:     dnssd.o ../cups/$(LIBCUPS) libbac
  
  ipp:  ipp.o ../cups/$(LIBCUPS) libbackend.a
        echo Linking $@...
 -      $(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
-+      $(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) $(CUPSDLIBS)
++      $(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) $(SERVERLIBS)
        $(RM) http
        $(LN) ipp http
  
-diff -up cups-1.4b1/scheduler/subscriptions.c.eggcups cups-1.4b1/scheduler/subscriptions.c
---- cups-1.4b1/scheduler/subscriptions.c.eggcups       2008-08-01 22:11:55.000000000 +0100
-+++ cups-1.4b1/scheduler/subscriptions.c       2008-11-11 15:43:30.000000000 +0000
-@@ -1302,13 +1302,13 @@ cupsd_send_dbus(cupsd_eventmask_t event,
+diff -up cups-1.5.3/scheduler/subscriptions.c.eggcups cups-1.5.3/scheduler/subscriptions.c
+--- cups-1.5.3/scheduler/subscriptions.c.eggcups       2012-02-12 06:48:09.000000000 +0100
++++ cups-1.5.3/scheduler/subscriptions.c       2012-05-15 16:48:17.253871982 +0200
+@@ -1314,13 +1314,13 @@ cupsd_send_dbus(cupsd_eventmask_t event,
      what = "PrinterAdded";
    else if (event & CUPSD_EVENT_PRINTER_DELETED)
      what = "PrinterRemoved";
@@ -119,7 +119,7 @@ diff -up cups-1.4b1/scheduler/subscriptions.c.eggcups cups-1.4b1/scheduler/subsc
    else
      return;
  
-@@ -1344,7 +1344,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,
+@@ -1356,7 +1356,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,
    dbus_message_append_iter_init(message, &iter);
    if (dest)
      dbus_message_iter_append_string(&iter, dest->name);
similarity index 54%
rename from cups/patches/cups-driverd-timeout.patch
rename to cups/patches/012_cups-driverd-timeout.patch
index 222fb09e7fa193cbdbff6f2d8ef211eec0077662..cb9e5cf72600b04124cea44bfae4d8615616654a 100644 (file)
@@ -1,7 +1,7 @@
-diff -up cups-1.3.7/scheduler/ipp.c.driverd-timeout cups-1.3.7/scheduler/ipp.c
---- cups-1.3.7/scheduler/ipp.c.driverd-timeout 2008-07-15 13:40:51.000000000 +0100
-+++ cups-1.3.7/scheduler/ipp.c 2008-07-15 13:40:51.000000000 +0100
-@@ -4293,7 +4293,7 @@ copy_model(cupsd_client_t *con,          /* I - 
+diff -up cups-1.5.0/scheduler/ipp.c.driverd-timeout cups-1.5.0/scheduler/ipp.c
+--- cups-1.5.0/scheduler/ipp.c.driverd-timeout 2011-10-10 17:03:41.801690962 +0100
++++ cups-1.5.0/scheduler/ipp.c 2011-10-10 17:03:41.861689834 +0100
+@@ -5723,7 +5723,7 @@ copy_model(cupsd_client_t *con,          /* I -
    close(temppipe[1]);
  
   /*
@@ -10,7 +10,7 @@ diff -up cups-1.3.7/scheduler/ipp.c.driverd-timeout cups-1.3.7/scheduler/ipp.c
    */
  
    total = 0;
-@@ -4315,7 +4315,7 @@ copy_model(cupsd_client_t *con,          /* I - 
+@@ -5743,7 +5743,7 @@ copy_model(cupsd_client_t *con,          /* I -
      FD_SET(temppipe[0], &input);
      FD_SET(CGIPipes[0], &input);
  
similarity index 56%
rename from cups/patches/cups-strict-ppd-line-length.patch
rename to cups/patches/013_cups-strict-ppd-line-length.patch
index d393728179bc0f6771949383e59d2f57917a7a43..b2697ec3185bf1c938c8698663d62f350b439bfe 100644 (file)
@@ -1,7 +1,7 @@
-diff -up cups-1.3.5/cups/ppd.c~ cups-1.3.5/cups/ppd.c
---- cups-1.3.5/cups/ppd.c~     2007-11-30 19:29:50.000000000 +0000
-+++ cups-1.3.5/cups/ppd.c      2008-01-09 12:08:48.000000000 +0000
-@@ -2801,7 +2801,7 @@ ppd_read(cups_file_t    *fp,             /* I - Fil
+diff -up cups-1.5b1/cups/ppd.c.strict-ppd-line-length cups-1.5b1/cups/ppd.c
+--- cups-1.5b1/cups/ppd.c.strict-ppd-line-length       2011-05-20 05:49:49.000000000 +0200
++++ cups-1.5b1/cups/ppd.c      2011-05-24 15:46:13.000000000 +0200
+@@ -2786,7 +2786,7 @@ ppd_read(cups_file_t    *fp,             /* I - Fil
        *lineptr++ = ch;
        col ++;
  
@@ -10,7 +10,7 @@ diff -up cups-1.3.5/cups/ppd.c~ cups-1.3.5/cups/ppd.c
        {
         /*
            * Line is too long...
-@@ -2868,7 +2868,7 @@ ppd_read(cups_file_t    *fp,             /* I - Fil
+@@ -2847,7 +2847,7 @@ ppd_read(cups_file_t    *fp,             /* I - Fil
        {
          col ++;
  
@@ -19,7 +19,7 @@ diff -up cups-1.3.5/cups/ppd.c~ cups-1.3.5/cups/ppd.c
          {
           /*
              * Line is too long...
-@@ -2931,7 +2931,7 @@ ppd_read(cups_file_t    *fp,             /* I - Fil
+@@ -2906,7 +2906,7 @@ ppd_read(cups_file_t    *fp,             /* I - Fil
        {
          col ++;
  
similarity index 77%
rename from cups/patches/cups-logrotate.patch
rename to cups/patches/014_cups-logrotate.patch
index 559cbdc229ba4a5edd83ad1959f55f7b1bc53970..a6485a9b7a142e931dc11d127be37b0c15bc1e4e 100644 (file)
@@ -1,7 +1,7 @@
-diff -up cups-1.3.5/scheduler/log.c.logrotate cups-1.3.5/scheduler/log.c
---- cups-1.3.5/scheduler/log.c.logrotate       2008-02-14 12:21:25.000000000 +0000
-+++ cups-1.3.5/scheduler/log.c 2008-02-14 12:24:16.000000000 +0000
-@@ -29,6 +29,9 @@
+diff -up cups-1.5b1/scheduler/log.c.logrotate cups-1.5b1/scheduler/log.c
+--- cups-1.5b1/scheduler/log.c.logrotate       2011-05-14 01:04:16.000000000 +0200
++++ cups-1.5b1/scheduler/log.c 2011-05-24 15:47:20.000000000 +0200
+@@ -32,6 +32,9 @@
  #include "cupsd.h"
  #include <stdarg.h>
  #include <syslog.h>
@@ -11,7 +11,7 @@ diff -up cups-1.3.5/scheduler/log.c.logrotate cups-1.3.5/scheduler/log.c
  
  
  /*
-@@ -467,12 +470,10 @@ check_log_file(cups_file_t **lf, /* IO -
+@@ -71,12 +74,10 @@ cupsdCheckLogFile(cups_file_t **lf,        /* I
      return (1);
  
   /*
@@ -26,7 +26,7 @@ diff -up cups-1.3.5/scheduler/log.c.logrotate cups-1.3.5/scheduler/log.c
    {
     /*
      * Handle format strings...
-@@ -565,6 +566,34 @@ check_log_file(cups_file_t **lf,  /* IO -
+@@ -186,6 +187,34 @@ cupsdCheckLogFile(cups_file_t **lf,       /* I
    }
  
   /*
similarity index 73%
rename from cups/patches/cups-usb-paperout.patch
rename to cups/patches/015_cups-usb-paperout.patch
index fb69145a4a4675be3b23c6eeca383d46b4aaf18d..f1f73f0a32ce1b3819dcc0545de2b97001becbb0 100644 (file)
@@ -1,6 +1,6 @@
-diff -up cups-1.4b1/backend/usb-unix.c.usb-paperout cups-1.4b1/backend/usb-unix.c
---- cups-1.4b1/backend/usb-unix.c.usb-paperout 2008-11-12 09:30:03.000000000 +0000
-+++ cups-1.4b1/backend/usb-unix.c      2008-11-12 09:30:03.000000000 +0000
+diff -up cups-1.5b1/backend/usb-unix.c.usb-paperout cups-1.5b1/backend/usb-unix.c
+--- cups-1.5b1/backend/usb-unix.c.usb-paperout 2011-05-24 15:51:39.000000000 +0200
++++ cups-1.5b1/backend/usb-unix.c      2011-05-24 15:51:39.000000000 +0200
 @@ -30,6 +30,11 @@
  
  #include <sys/select.h>
@@ -13,7 +13,7 @@ diff -up cups-1.4b1/backend/usb-unix.c.usb-paperout cups-1.4b1/backend/usb-unix.
  
  /*
   * Local functions...
-@@ -324,7 +329,19 @@ open_device(const char *uri,              /* I - Dev
+@@ -334,7 +339,19 @@ open_device(const char *uri,              /* I - Dev
    if (!strncmp(uri, "usb:/dev/", 9))
  #ifdef __linux
    {
@@ -34,7 +34,7 @@ diff -up cups-1.4b1/backend/usb-unix.c.usb-paperout cups-1.4b1/backend/usb-unix.
    }
    else if (!strncmp(uri, "usb://", 6))
    {
-@@ -390,7 +407,14 @@ open_device(const char *uri,              /* I - Dev
+@@ -400,7 +417,14 @@ open_device(const char *uri,              /* I - Dev
          if (!strcmp(uri, device_uri))
        {
         /*
diff --git a/cups/patches/016_cups-res_init.patch b/cups/patches/016_cups-res_init.patch
new file mode 100644 (file)
index 0000000..94a81a4
--- /dev/null
@@ -0,0 +1,26 @@
+diff -up cups-1.6b1/cups/http-addr.c.res_init cups-1.6b1/cups/http-addr.c
+--- cups-1.6b1/cups/http-addr.c.res_init       2012-05-17 00:57:03.000000000 +0200
++++ cups-1.6b1/cups/http-addr.c        2012-05-25 15:51:51.323916352 +0200
+@@ -254,7 +254,8 @@ httpAddrLookup(
+     if (error)
+     {
+-      if (error == EAI_FAIL)
++      if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA ||
++          error == EAI_NONAME)
+         cg->need_res_init = 1;
+       return (httpAddrString(addr, name, namelen));
+diff -up cups-1.6b1/cups/http-addrlist.c.res_init cups-1.6b1/cups/http-addrlist.c
+--- cups-1.6b1/cups/http-addrlist.c.res_init   2012-04-23 19:26:57.000000000 +0200
++++ cups-1.6b1/cups/http-addrlist.c    2012-05-25 16:05:05.930377452 +0200
+@@ -540,7 +540,8 @@ httpAddrGetList(const char *hostname,      /*
+     }
+     else
+     {
+-      if (error == EAI_FAIL)
++      if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA ||
++          error == EAI_NONAME)
+         cg->need_res_init = 1;
+       _cupsSetError(IPP_INTERNAL_ERROR, gai_strerror(error), 0);
similarity index 71%
rename from cups/patches/cups-filter-debug.patch
rename to cups/patches/017_cups-filter-debug.patch
index 38053e63afd6e2b3fb2cc7ff5ed024470ad92b6f..96c82dab9333fe1eae827eaf7ecd5df8a5f0aee2 100644 (file)
@@ -1,14 +1,14 @@
-diff -up cups-1.4rc1/scheduler/job.c.filter-debug cups-1.4rc1/scheduler/job.c
---- cups-1.4rc1/scheduler/job.c.filter-debug   2009-06-23 18:10:57.125572911 +0100
-+++ cups-1.4rc1/scheduler/job.c        2009-06-23 18:11:31.495572481 +0100
-@@ -544,10 +544,28 @@ cupsdContinueJob(cupsd_job_t *job)       /* I 
+diff -up cups-1.6b1/scheduler/job.c.filter-debug cups-1.6b1/scheduler/job.c
+--- cups-1.6b1/scheduler/job.c.filter-debug    2012-05-25 16:06:01.000000000 +0200
++++ cups-1.6b1/scheduler/job.c 2012-05-25 16:07:46.309259511 +0200
+@@ -625,10 +625,28 @@ cupsdContinueJob(cupsd_job_t *job)       /* I
  
      if (!filters)
      {
 +      mime_filter_t *current;
 +
        cupsdLogJob(job, CUPSD_LOG_ERROR,
-                 "Unable to convert file %d to printable format!",
+                 "Unable to convert file %d to printable format.",
                  job->current_file);
  
 +      cupsdLogJob(job, CUPSD_LOG_ERROR,
similarity index 77%
rename from cups/patches/cups-uri-compat.patch
rename to cups/patches/018_cups-uri-compat.patch
index dd55b66080495b7759b06d9fe8cc6c3606f8a27b..2520a5bec6dcaa9dc3518ed0510a1fcced03e0a8 100644 (file)
@@ -1,9 +1,9 @@
-diff -up cups-1.4rc1/backend/usb-unix.c.uri-compat cups-1.4rc1/backend/usb-unix.c
---- cups-1.4rc1/backend/usb-unix.c.uri-compat  2009-07-15 10:48:46.992133677 +0100
-+++ cups-1.4rc1/backend/usb-unix.c     2009-07-15 10:49:05.305008114 +0100
+diff -up cups-1.5b1/backend/usb-unix.c.uri-compat cups-1.5b1/backend/usb-unix.c
+--- cups-1.5b1/backend/usb-unix.c.uri-compat   2011-05-24 15:59:05.000000000 +0200
++++ cups-1.5b1/backend/usb-unix.c      2011-05-24 16:02:03.000000000 +0200
 @@ -63,11 +63,34 @@ print_device(const char *uri,              /* I - De
    int         device_fd;              /* USB device */
-   size_t      tbytes;                 /* Total number of bytes written */
+   ssize_t     tbytes;                 /* Total number of bytes written */
    struct termios opts;                        /* Parallel port options */
 +  char                *fixed_uri = strdup (uri);
 +  char                *p;
@@ -37,7 +37,7 @@ diff -up cups-1.4rc1/backend/usb-unix.c.uri-compat cups-1.4rc1/backend/usb-unix.
    * Open the USB port device...
    */
 @@ -107,10 +130,10 @@ print_device(const char *uri,            /* I - De
-              strncasecmp(hostname, "Minolta", 7);
+              _cups_strncasecmp(hostname, "Minolta", 7);
  #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
  
 -    if (use_bc && !strncmp(uri, "usb:/dev/", 9))
similarity index 76%
rename from cups/patches/cups-cups-get-classes.patch
rename to cups/patches/019_cups-cups-get-classes.patch
index 196f5f16663e5117c5d424a668023ca3071494c0..b0ffe1c40c171c799eb1ec78aa2641cda16e1653 100644 (file)
@@ -1,7 +1,7 @@
-diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c
---- cups-1.4rc1/cups/dest.c.cups-get-classes   2009-05-13 22:39:17.000000000 +0100
-+++ cups-1.4rc1/cups/dest.c    2009-07-28 22:17:40.285709944 +0100
-@@ -1735,6 +1735,7 @@ cups_get_sdests(http_t      *http,       /* I 
+diff -up cups-1.5.0/cups/dest.c.cups-get-classes cups-1.5.0/cups/dest.c
+--- cups-1.5.0/cups/dest.c.cups-get-classes    2011-05-20 04:49:49.000000000 +0100
++++ cups-1.5.0/cups/dest.c     2011-09-14 12:10:05.111635428 +0100
+@@ -534,6 +534,7 @@ _cupsGetDests(http_t      *http,   /* I - 
    char                uri[1024];              /* printer-uri value */
    int         num_options;            /* Number of options */
    cups_option_t       *options;               /* Options */
@@ -9,7 +9,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c
  #ifdef __APPLE__
    char                media_default[41];      /* Default paper size */
  #endif /* __APPLE__ */
-@@ -1791,6 +1792,8 @@ cups_get_sdests(http_t      *http,       /* I 
+@@ -590,6 +591,8 @@ _cupsGetDests(http_t      *http,   /* I - 
    *    printer-uri [for IPP_GET_PRINTER_ATTRIBUTES]
    */
  
@@ -18,7 +18,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c
    request = ippNewRequest(op);
  
    ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
-@@ -1848,6 +1851,23 @@ cups_get_sdests(http_t      *http,      /* I 
+@@ -647,6 +650,23 @@ _cupsGetDests(http_t      *http,  /* I - 
            attr->value_tag != IPP_TAG_URI)
            continue;
  
@@ -42,7 +42,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c
          if (!strcmp(attr->name, "auth-info-required") ||
            !strcmp(attr->name, "device-uri") ||
            !strcmp(attr->name, "marker-change-time") ||
-@@ -1939,6 +1959,28 @@ cups_get_sdests(http_t      *http,      /* I 
+@@ -738,6 +758,28 @@ _cupsGetDests(http_t      *http,  /* I - 
            continue;
        }
  
@@ -52,7 +52,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c
 +      * early if so.
 +      */
 +
-+      if (op == CUPS_GET_CLASSES)
++      if (op == CUPS_GET_CLASSES && num_dests > 0)
 +      {
 +      int diff;
 +      cups_find_dest (printer_name, NULL, num_dests, *dests, 0, &diff);
@@ -71,7 +71,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c
        if ((dest = cups_add_dest(printer_name, NULL, &num_dests, dests)) != NULL)
        {
          dest->num_options = num_options;
-@@ -1955,6 +1997,16 @@ cups_get_sdests(http_t      *http,      /* I 
+@@ -754,6 +796,15 @@ _cupsGetDests(http_t      *http,  /* I - 
    }
  
   /*
@@ -81,8 +81,7 @@ diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c
 +  */
 +
 +  if (get_classes)
-+    num_dests = cups_get_sdests (http, CUPS_GET_CLASSES, name,
-+                               num_dests, dests);
++    num_dests = _cupsGetDests (http, CUPS_GET_CLASSES, name, dests, 0, 0);
 +
 + /*
    * Return the count...
similarity index 82%
rename from cups/patches/cups-str3382.patch
rename to cups/patches/020_cups-str3382.patch
index 14e9b2778998f93f433b6f3a4c11b5be7989dc91..2e8736d04853ae833c13838ff5e51d3169a2fcb8 100644 (file)
@@ -1,7 +1,7 @@
-diff -up cups-1.4.3/cups/tempfile.c.str3382 cups-1.4.3/cups/tempfile.c
---- cups-1.4.3/cups/tempfile.c.str3382 2010-01-18 19:47:12.000000000 +0100
-+++ cups-1.4.3/cups/tempfile.c 2010-03-31 13:26:52.000000000 +0200
-@@ -35,6 +35,7 @@
+diff -up cups-1.5b1/cups/tempfile.c.str3382 cups-1.5b1/cups/tempfile.c
+--- cups-1.5b1/cups/tempfile.c.str3382 2010-03-24 01:45:34.000000000 +0100
++++ cups-1.5b1/cups/tempfile.c 2011-05-24 16:04:47.000000000 +0200
+@@ -33,6 +33,7 @@
  #  include <io.h>
  #else
  #  include <unistd.h>
@@ -9,7 +9,7 @@ diff -up cups-1.4.3/cups/tempfile.c.str3382 cups-1.4.3/cups/tempfile.c
  #endif /* WIN32 || __EMX__ */
  
  
-@@ -56,7 +57,7 @@ cupsTempFd(char *filename,           /* I - Point
+@@ -54,7 +55,7 @@ cupsTempFd(char *filename,           /* I - Point
    char                tmppath[1024];          /* Windows temporary directory */
    DWORD               curtime;                /* Current time */
  #else
@@ -18,7 +18,7 @@ diff -up cups-1.4.3/cups/tempfile.c.str3382 cups-1.4.3/cups/tempfile.c
  #endif /* WIN32 */
  
  
-@@ -107,33 +108,25 @@ cupsTempFd(char *filename,               /* I - Point
+@@ -105,33 +106,25 @@ cupsTempFd(char *filename,               /* I - Point
  
      snprintf(filename, len - 1, "%s/%05lx%08lx", tmpdir,
               GetCurrentProcessId(), curtime);
diff --git a/cups/patches/021_cups-0755.patch b/cups/patches/021_cups-0755.patch
new file mode 100644 (file)
index 0000000..b0df3a0
--- /dev/null
@@ -0,0 +1,21 @@
+diff -up cups-1.6b1/Makedefs.in.0755 cups-1.6b1/Makedefs.in
+--- cups-1.6b1/Makedefs.in.0755        2012-05-23 01:58:31.000000000 +0200
++++ cups-1.6b1/Makedefs.in     2012-05-25 16:09:40.545463214 +0200
+@@ -40,14 +40,14 @@ SHELL              =       /bin/sh
+ # Installation programs...
+ #
+-INSTALL_BIN   =       $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
++INSTALL_BIN   =       $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@
+ INSTALL_COMPDATA =    $(INSTALL) -c -m 444 @INSTALL_GZIP@
+ INSTALL_CONFIG        =       $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
+ INSTALL_DATA  =       $(INSTALL) -c -m 444
+ INSTALL_DIR   =       $(INSTALL) -d
+-INSTALL_LIB   =       $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
++INSTALL_LIB   =       $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@
+ INSTALL_MAN   =       $(INSTALL) -c -m 444
+-INSTALL_SCRIPT        =       $(INSTALL) -c -m 555
++INSTALL_SCRIPT        =       $(INSTALL) -c -m 755
+ #
+ # Default user, group, and system groups for the scheduler...
similarity index 71%
rename from cups/patches/cups-hp-deviceid-oid.patch
rename to cups/patches/022_cups-hp-deviceid-oid.patch
index 29f0781d4776c91756fee3494e829424c76e32ce..da5136a812950352c950e04228d71dd96ce0b72e 100644 (file)
@@ -1,7 +1,7 @@
-diff -up cups-1.4.3/backend/snmp.c.hp-deviceid-oid cups-1.4.3/backend/snmp.c
---- cups-1.4.3/backend/snmp.c.hp-deviceid-oid  2009-12-08 02:13:42.000000000 +0000
-+++ cups-1.4.3/backend/snmp.c  2010-04-13 15:00:26.486148914 +0100
-@@ -194,6 +194,7 @@ static const int   UriOID[] = { CUPS_OID_p
+diff -up cups-1.5b1/backend/snmp.c.hp-deviceid-oid cups-1.5b1/backend/snmp.c
+--- cups-1.5b1/backend/snmp.c.hp-deviceid-oid  2011-05-20 05:49:49.000000000 +0200
++++ cups-1.5b1/backend/snmp.c  2011-05-24 17:24:48.000000000 +0200
+@@ -187,6 +187,7 @@ static const int   UriOID[] = { CUPS_OID_p
  static const int      LexmarkProductOID[] = { 1,3,6,1,4,1,641,2,1,2,1,2,1,-1 };
  static const int      LexmarkProductOID2[] = { 1,3,6,1,4,1,674,10898,100,2,1,2,1,2,1,-1 };
  static const int      LexmarkDeviceIdOID[] = { 1,3,6,1,4,1,641,2,1,2,1,3,1,-1 };
@@ -9,7 +9,7 @@ diff -up cups-1.4.3/backend/snmp.c.hp-deviceid-oid cups-1.4.3/backend/snmp.c
  static const int      XeroxProductOID[] = { 1,3,6,1,4,1,128,2,1,3,1,2,0,-1 };
  static cups_array_t   *DeviceURIs = NULL;
  static int            HostNameLookups = 0;
-@@ -1003,6 +1004,9 @@ read_snmp_response(int fd)               /* I - SNMP 
+@@ -1006,6 +1007,9 @@ read_snmp_response(int fd)               /* I - SNMP 
        _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1,
                       packet.community, CUPS_ASN1_GET_REQUEST,
                       DEVICE_PRODUCT, XeroxProductOID);
diff --git a/cups/patches/023_cups-dnssd-deviceid.patch b/cups/patches/023_cups-dnssd-deviceid.patch
new file mode 100644 (file)
index 0000000..b3c2b8e
--- /dev/null
@@ -0,0 +1,38 @@
+diff -up cups-1.6b1/backend/dnssd.c.dnssd-deviceid cups-1.6b1/backend/dnssd.c
+--- cups-1.6b1/backend/dnssd.c.dnssd-deviceid  2012-05-21 18:05:58.000000000 +0200
++++ cups-1.6b1/backend/dnssd.c 2012-05-25 16:27:49.226874427 +0200
+@@ -1181,15 +1181,22 @@ query_callback(
+   if (device->device_id)
+     free(device->device_id);
++  if (device_id[0])
++  {
++    /* Mark this as the real device ID. */
++    ptr = device_id + strlen(device_id);
++    snprintf(ptr, sizeof(device_id) - (ptr - device_id), "FZY:0;");
++  }
++
+   if (!device_id[0] && strcmp(model, "Unknown"))
+   {
+     if (make_and_model[0])
+-      snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;",
++      snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;FZY:1;",
+              make_and_model, model);
+     else if (!_cups_strncasecmp(model, "designjet ", 10))
+-      snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s", model + 10);
++      snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s;FZY:1;", model + 10);
+     else if (!_cups_strncasecmp(model, "stylus ", 7))
+-      snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s", model + 7);
++      snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s;FZY:1;", model + 7);
+     else if ((ptr = strchr(model, ' ')) != NULL)
+     {
+      /*
+@@ -1199,7 +1206,7 @@ query_callback(
+       memcpy(make_and_model, model, ptr - model);
+       make_and_model[ptr - model] = '\0';
+-      snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s",
++      snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;FZY:1;",
+              make_and_model, ptr + 1);
+     }
+   }
similarity index 73%
rename from cups/patches/cups-ricoh-deviceid-oid.patch
rename to cups/patches/024_cups-ricoh-deviceid-oid.patch
index 6a5b6a903acebe5150d30ad4264e1c3078737dee..c148f9539b4c2db143afabd4aff6540b5d5a4c43 100644 (file)
@@ -1,7 +1,7 @@
-diff -up cups-1.4.3/backend/snmp.c.ricoh-deviceid-oid cups-1.4.3/backend/snmp.c
---- cups-1.4.3/backend/snmp.c.ricoh-deviceid-oid       2010-05-11 17:30:57.266120467 +0100
-+++ cups-1.4.3/backend/snmp.c  2010-05-11 17:31:16.267120141 +0100
-@@ -195,6 +195,7 @@ static const int   LexmarkProductOID[] = {
+diff -up cups-1.5b1/backend/snmp.c.ricoh-deviceid-oid cups-1.5b1/backend/snmp.c
+--- cups-1.5b1/backend/snmp.c.ricoh-deviceid-oid       2011-05-24 17:29:48.000000000 +0200
++++ cups-1.5b1/backend/snmp.c  2011-05-24 17:29:48.000000000 +0200
+@@ -188,6 +188,7 @@ static const int   LexmarkProductOID[] = {
  static const int      LexmarkProductOID2[] = { 1,3,6,1,4,1,674,10898,100,2,1,2,1,2,1,-1 };
  static const int      LexmarkDeviceIdOID[] = { 1,3,6,1,4,1,641,2,1,2,1,3,1,-1 };
  static const int      HPDeviceIdOID[] = { 1,3,6,1,4,1,11,2,3,9,1,1,7,0,-1 };
@@ -9,7 +9,7 @@ diff -up cups-1.4.3/backend/snmp.c.ricoh-deviceid-oid cups-1.4.3/backend/snmp.c
  static const int      XeroxProductOID[] = { 1,3,6,1,4,1,128,2,1,3,1,2,0,-1 };
  static cups_array_t   *DeviceURIs = NULL;
  static int            HostNameLookups = 0;
-@@ -1002,6 +1003,9 @@ read_snmp_response(int fd)               /* I - SNMP 
+@@ -1005,6 +1006,9 @@ read_snmp_response(int fd)               /* I - SNMP 
                       packet.community, CUPS_ASN1_GET_REQUEST,
                       DEVICE_ID, LexmarkDeviceIdOID);
        _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1,
diff --git a/cups/patches/025_cups-systemd-socket.patch b/cups/patches/025_cups-systemd-socket.patch
new file mode 100644 (file)
index 0000000..83fabdb
--- /dev/null
@@ -0,0 +1,395 @@
+diff -up cups-1.6b1/config.h.in.systemd-socket cups-1.6b1/config.h.in
+--- cups-1.6b1/config.h.in.systemd-socket      2012-05-17 00:57:03.000000000 +0200
++++ cups-1.6b1/config.h.in     2012-05-28 11:16:35.657250584 +0200
+@@ -506,6 +506,13 @@
+ /*
++ * Do we have systemd support?
++ */
++
++#undef HAVE_SYSTEMD
++
++
++/*
+  * Various scripting languages...
+  */
+diff -up cups-1.6b1/config-scripts/cups-systemd.m4.systemd-socket cups-1.6b1/config-scripts/cups-systemd.m4
+--- cups-1.6b1/config-scripts/cups-systemd.m4.systemd-socket   2012-05-28 11:16:35.658250577 +0200
++++ cups-1.6b1/config-scripts/cups-systemd.m4  2012-05-28 11:16:35.658250577 +0200
+@@ -0,0 +1,36 @@
++dnl
++dnl "$Id$"
++dnl
++dnl   systemd stuff for CUPS.
++
++dnl Find whether systemd is available
++
++SDLIBS=""
++AC_ARG_WITH([systemdsystemunitdir],
++        AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
++        [], [with_systemdsystemunitdir=$($PKGCONFIG --variable=systemdsystemunitdir systemd)])
++if test "x$with_systemdsystemunitdir" != xno; then
++        AC_MSG_CHECKING(for libsystemd-daemon)
++        if $PKGCONFIG --exists libsystemd-daemon; then
++              AC_MSG_RESULT(yes)
++              SDCFLAGS=`$PKGCONFIG --cflags libsystemd-daemon`
++              SDLIBS=`$PKGCONFIG --libs libsystemd-daemon`
++              AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
++              AC_DEFINE(HAVE_SYSTEMD)
++      else
++              AC_MSG_RESULT(no)
++      fi
++fi
++
++if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then
++        SYSTEMD_UNITS="cups.service cups.socket cups.path"
++else
++        SYSTEMD_UNITS=""
++fi
++
++AC_SUBST(SYSTEMD_UNITS)
++AC_SUBST(SDLIBS)
++
++dnl
++dnl "$Id$"
++dnl
+diff -up cups-1.6b1/configure.in.systemd-socket cups-1.6b1/configure.in
+--- cups-1.6b1/configure.in.systemd-socket     2012-04-23 19:26:57.000000000 +0200
++++ cups-1.6b1/configure.in    2012-05-28 11:16:35.658250577 +0200
+@@ -33,6 +33,7 @@ sinclude(config-scripts/cups-pam.m4)
+ sinclude(config-scripts/cups-largefile.m4)
+ sinclude(config-scripts/cups-dnssd.m4)
+ sinclude(config-scripts/cups-launchd.m4)
++sinclude(config-scripts/cups-systemd.m4)
+ sinclude(config-scripts/cups-defaults.m4)
+ sinclude(config-scripts/cups-scripting.m4)
+@@ -66,6 +67,9 @@ AC_OUTPUT(Makedefs
+         conf/snmp.conf
+         cups-config
+         data/testprint
++          data/cups.service
++          data/cups.socket
++          data/cups.path
+         desktop/cups.desktop
+         doc/help/ref-cupsd-conf.html
+         doc/help/standard.html
+diff -up cups-1.6b1/cups/usersys.c.systemd-socket cups-1.6b1/cups/usersys.c
+--- cups-1.6b1/cups/usersys.c.systemd-socket   2012-04-23 19:26:57.000000000 +0200
++++ cups-1.6b1/cups/usersys.c  2012-05-28 11:16:35.659250570 +0200
+@@ -975,7 +975,7 @@ cups_read_client_conf(
+     struct stat       sockinfo;               /* Domain socket information */
+     if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) &&
+-      (sockinfo.st_mode & S_IRWXO) == S_IRWXO)
++      (sockinfo.st_mode & (S_IROTH | S_IWOTH)) == (S_IROTH | S_IWOTH))
+       cups_server = CUPS_DEFAULT_DOMAINSOCKET;
+     else
+ #endif /* CUPS_DEFAULT_DOMAINSOCKET */
+diff -up cups-1.6b1/data/cups.path.in.systemd-socket cups-1.6b1/data/cups.path.in
+--- cups-1.6b1/data/cups.path.in.systemd-socket        2012-05-28 11:16:35.659250570 +0200
++++ cups-1.6b1/data/cups.path.in       2012-05-28 11:16:35.659250570 +0200
+@@ -0,0 +1,8 @@
++[Unit]
++Description=CUPS Printer Service Spool
++
++[Path]
++PathExistsGlob=@CUPS_REQUESTS@/d*
++
++[Install]
++WantedBy=multi-user.target
+diff -up cups-1.6b1/data/cups.service.in.systemd-socket cups-1.6b1/data/cups.service.in
+--- cups-1.6b1/data/cups.service.in.systemd-socket     2012-05-28 11:16:35.659250570 +0200
++++ cups-1.6b1/data/cups.service.in    2012-05-28 11:16:35.659250570 +0200
+@@ -0,0 +1,10 @@
++[Unit]
++Description=CUPS Printing Service
++
++[Service]
++ExecStart=@sbindir@/cupsd -f
++PrivateTmp=true
++
++[Install]
++Also=cups.socket cups.path
++WantedBy=printer.target
+diff -up cups-1.6b1/data/cups.socket.in.systemd-socket cups-1.6b1/data/cups.socket.in
+--- cups-1.6b1/data/cups.socket.in.systemd-socket      2012-05-28 11:16:35.660250563 +0200
++++ cups-1.6b1/data/cups.socket.in     2012-05-28 11:16:35.660250563 +0200
+@@ -0,0 +1,8 @@
++[Unit]
++Description=CUPS Printing Service Sockets
++
++[Socket]
++ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@
++
++[Install]
++WantedBy=sockets.target
+diff -up cups-1.6b1/data/Makefile.systemd-socket cups-1.6b1/data/Makefile
+--- cups-1.6b1/data/Makefile.systemd-socket    2011-08-27 11:23:01.000000000 +0200
++++ cups-1.6b1/data/Makefile   2012-05-28 11:16:35.660250563 +0200
+@@ -100,6 +100,12 @@ install-data:
+               $(INSTALL_DATA) $$file $(DATADIR)/ppdc; \
+       done
+       $(INSTALL_DIR) -m 755 $(DATADIR)/profiles
++      if test "x$(SYSTEMD_UNITS)" != "x" ; then \
++              $(INSTALL_DIR) -m 755 $(SYSTEMDUNITDIR); \
++              for file in $(SYSTEMD_UNITS); do \
++                      $(INSTALL_DATA) $$file $(SYSTEMDUNITDIR); \
++              done; \
++      fi
+ #
+@@ -143,6 +149,9 @@ uninstall:
+       -$(RMDIR) $(DATADIR)/data
+       -$(RMDIR) $(DATADIR)/banners
+       -$(RMDIR) $(DATADIR)
++      for file in $(SYSTEMD_UNITS); do \
++              $(RM) $(SYSTEMDUNITDIR)/$$file; \
++      done
+ #
+diff -up cups-1.6b1/Makedefs.in.systemd-socket cups-1.6b1/Makedefs.in
+--- cups-1.6b1/Makedefs.in.systemd-socket      2012-05-28 11:16:35.648250647 +0200
++++ cups-1.6b1/Makedefs.in     2012-05-28 11:16:35.660250563 +0200
+@@ -134,11 +134,13 @@ CXXFLAGS =       @CPPFLAGS@ @CXXFLAGS@
+ CXXLIBS               =       @CXXLIBS@
+ DBUS_NOTIFIER =       @DBUS_NOTIFIER@
+ DBUS_NOTIFIERLIBS =   @DBUS_NOTIFIERLIBS@
++SYSTEMD_UNITS   =       @SYSTEMD_UNITS@
+ DNSSD_BACKEND =       @DNSSD_BACKEND@
+ DSOFLAGS      =       -L../cups @DSOFLAGS@
+ DSOLIBS               =       @DSOLIBS@ $(COMMONLIBS)
+ DNSSDLIBS     =       @DNSSDLIBS@
+ LAUNCHDLIBS   =       @LAUNCHDLIBS@
++SDLIBS                =       @SDLIBS@
+ LDFLAGS               =       -L../cgi-bin -L../cups -L../filter -L../ppdc \
+                       -L../scheduler @LDARCHFLAGS@ \
+                       @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
+@@ -229,6 +231,7 @@ PAMFILE            =       @PAMFILE@
+ DEFAULT_LAUNCHD_CONF =        @DEFAULT_LAUNCHD_CONF@
+ DBUSDIR               =       @DBUSDIR@
++SYSTEMDUNITDIR  =       $(BUILDROOT)@systemdsystemunitdir@
+ #
+diff -up cups-1.6b1/scheduler/client.h.systemd-socket cups-1.6b1/scheduler/client.h
+--- cups-1.6b1/scheduler/client.h.systemd-socket       2012-03-22 21:30:20.000000000 +0100
++++ cups-1.6b1/scheduler/client.h      2012-05-28 11:16:35.661250556 +0200
+@@ -77,6 +77,9 @@ typedef struct
+   int                 fd;             /* File descriptor for this server */
+   http_addr_t         address;        /* Bind address of socket */
+   http_encryption_t   encryption;     /* To encrypt or not to encrypt... */
++#ifdef HAVE_SYSTEMD
++  int                 is_systemd;     /* Is this a systemd socket? */
++#endif /* HAVE_SYSTEMD */
+ } cupsd_listener_t;
+diff -up cups-1.6b1/scheduler/listen.c.systemd-socket cups-1.6b1/scheduler/listen.c
+--- cups-1.6b1/scheduler/listen.c.systemd-socket       2011-04-16 01:38:13.000000000 +0200
++++ cups-1.6b1/scheduler/listen.c      2012-05-28 11:16:35.661250556 +0200
+@@ -401,7 +401,11 @@ cupsdStopListening(void)
+        lis;
+        lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
+   {
+-    if (lis->fd != -1)
++    if (lis->fd != -1
++#ifdef HAVE_SYSTEMD
++        && !lis->is_systemd
++#endif /* HAVE_SYSTEMD */
++        )
+     {
+ #ifdef WIN32
+       closesocket(lis->fd);
+diff -up cups-1.6b1/scheduler/main.c.systemd-socket cups-1.6b1/scheduler/main.c
+--- cups-1.6b1/scheduler/main.c.systemd-socket 2012-05-28 11:16:35.612250897 +0200
++++ cups-1.6b1/scheduler/main.c        2012-05-28 12:49:32.698375139 +0200
+@@ -26,6 +26,8 @@
+  *   launchd_checkin()     - Check-in with launchd and collect the listening
+  *                           fds.
+  *   launchd_checkout()    - Update the launchd KeepAlive file as needed.
++ *   systemd_checkin()     - Check-in with systemd and collect the
++ *                           listening fds.
+  *   parent_handler()      - Catch USR1/CHLD signals...
+  *   process_children()    - Process all dead children...
+  *   select_timeout()      - Calculate the select timeout value.
+@@ -62,6 +64,10 @@
+ #  endif /* !LAUNCH_JOBKEY_SERVICEIPC */
+ #endif /* HAVE_LAUNCH_H */
++#ifdef HAVE_SYSTEMD
++#include <systemd/sd-daemon.h>
++#endif /* HAVE_SYSTEMD */
++
+ #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
+ #  include <malloc.h>
+ #endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
+@@ -78,6 +84,9 @@
+ static void           launchd_checkin(void);
+ static void           launchd_checkout(void);
+ #endif /* HAVE_LAUNCHD */
++#ifdef HAVE_SYSTEMD
++static void           systemd_checkin(void);
++#endif /* HAVE_SYSTEMD */
+ static void           parent_handler(int sig);
+ static void           process_children(void);
+ static void           sigchld_handler(int sig);
+@@ -528,6 +537,13 @@ main(int  argc,                           /* I - Number of comm
+   }
+ #endif /* HAVE_LAUNCHD */
++#ifdef HAVE_SYSTEMD
++ /*
++  * If we were started by systemd get the listen sockets file descriptors...
++  */
++  systemd_checkin();
++#endif /* HAVE_SYSTEMD */
++
+  /*
+   * Startup the server...
+   */
+@@ -738,6 +754,15 @@ main(int  argc,                           /* I - Number of comm
+       }
+ #endif /* HAVE_LAUNCHD */
++#ifdef HAVE_SYSTEMD
++       /*
++      * If we were started by systemd get the listen sockets file
++      * descriptors...
++        */
++
++        systemd_checkin();
++#endif /* HAVE_SYSTEMD */
++
+        /*
+         * Startup the server...
+         */
+@@ -1516,6 +1541,102 @@ launchd_checkout(void)
+ }
+ #endif /* HAVE_LAUNCHD */
++#ifdef HAVE_SYSTEMD
++static void
++systemd_checkin(void)
++{
++  int n, fd;
++
++  n = sd_listen_fds(0);
++  if (n < 0)
++  {
++    cupsdLogMessage(CUPSD_LOG_ERROR,
++           "systemd_checkin: Failed to acquire sockets from systemd - %s",
++           strerror(-n));
++    exit(EXIT_FAILURE);
++    return;
++  }
++
++  if (n == 0)
++    return;
++
++  for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++)
++  {
++    http_addr_t addr;
++    socklen_t addrlen = sizeof (addr);
++    int r;
++    cupsd_listener_t *lis;
++    char s[256];
++
++    r = sd_is_socket(fd, AF_UNSPEC, SOCK_STREAM, 1);
++    if (r < 0)
++    {
++      cupsdLogMessage(CUPSD_LOG_ERROR,
++             "systemd_checkin: Unable to verify socket type - %s",
++             strerror(-r));
++      continue;
++    }
++
++    if (!r)
++    {
++      cupsdLogMessage(CUPSD_LOG_ERROR,
++             "systemd_checkin: Socket not of the right type");
++      continue;
++    }
++
++    if (getsockname(fd, (struct sockaddr*) &addr, &addrlen))
++    {
++      cupsdLogMessage(CUPSD_LOG_ERROR,
++             "systemd_checkin: Unable to get local address - %s",
++             strerror(errno));
++      continue;
++    }
++
++   /*
++    * Try to match the systemd socket address to one of the listeners...
++    */
++
++    for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
++       lis;
++       lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
++      if (httpAddrEqual(&lis->address, &addr))
++      break;
++
++    if (lis)
++    {
++      cupsdLogMessage(CUPSD_LOG_DEBUG,
++                      "systemd_checkin: Matched existing listener %s with fd %d...",
++                      httpAddrString(&(lis->address), s, sizeof(s)), fd);
++    }
++    else
++    {
++      cupsdLogMessage(CUPSD_LOG_DEBUG,
++                      "systemd_checkin: Adding new listener %s with fd %d...",
++                      httpAddrString(&addr, s, sizeof(s)), fd);
++
++      if ((lis = calloc(1, sizeof(cupsd_listener_t))) == NULL)
++      {
++        cupsdLogMessage(CUPSD_LOG_ERROR,
++                        "systemd_checkin: Unable to allocate listener - "
++                        "%s.", strerror(errno));
++        exit(EXIT_FAILURE);
++      }
++
++      cupsArrayAdd(Listeners, lis);
++
++      memcpy(&lis->address, &addr, sizeof(lis->address));
++    }
++
++    lis->fd = fd;
++    lis->is_systemd = 1;
++
++#  ifdef HAVE_SSL
++    if (_httpAddrPort(&(lis->address)) == 443)
++      lis->encryption = HTTP_ENCRYPT_ALWAYS;
++#  endif /* HAVE_SSL */
++  }
++}
++#endif /* HAVE_SYSTEMD */
+ /*
+  * 'parent_handler()' - Catch USR1/CHLD signals...
+diff -up cups-1.6b1/scheduler/Makefile.systemd-socket cups-1.6b1/scheduler/Makefile
+--- cups-1.6b1/scheduler/Makefile.systemd-socket       2012-05-21 19:40:22.000000000 +0200
++++ cups-1.6b1/scheduler/Makefile      2012-05-28 11:16:35.663250542 +0200
+@@ -371,7 +371,7 @@ cupsd:     $(CUPSDOBJS) $(LIBCUPSMIME) ../cu
+       $(CC) $(LDFLAGS) -o cupsd $(CUPSDOBJS) -L. -lcupsmime \
+               $(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
+               $(LIBPAPER) $(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBS) \
+-              $(LIBGSSAPI) $(LIBWRAP)
++              $(LIBGSSAPI) $(LIBWRAP) $(SDLIBS)
+ cupsd-static: $(CUPSDOBJS) libcupsmime.a ../cups/$(LIBCUPSSTATIC)
+       echo Linking $@...
+@@ -379,7 +379,7 @@ cupsd-static:      $(CUPSDOBJS) libcupsmime.a
+               $(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
+               ../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(LIBZ) $(LIBPAPER) \
+               $(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBGSSAPI) \
+-              $(LIBWRAP)
++              $(LIBWRAP)  $(SDLIBS)
+ tls.o:        tls-darwin.c tls-gnutls.c tls-openssl.c
similarity index 62%
rename from cups/patches/cups-x-lspp.patch
rename to cups/patches/026_cups-lspp.patch
index 380b55d02d54fa537d7b5cf40d38d4844259f3d8..d81ef06534ffbe1e43b6b2823d272f8ae760c59c 100644 (file)
@@ -1,9 +1,9 @@
-diff -up cups-1.4.5/config.h.in.lspp cups-1.4.5/config.h.in
---- cups-1.4.5/config.h.in.lspp        2010-12-24 13:21:31.134859403 +0000
-+++ cups-1.4.5/config.h.in     2010-12-24 13:21:31.173858387 +0000
-@@ -672,6 +672,12 @@
- #undef HAVE_SYS_STATVFS_H
- #undef HAVE_SYS_VFS_H
+diff -up cups-1.6b1/config.h.in.lspp cups-1.6b1/config.h.in
+--- cups-1.6b1/config.h.in.lspp        2012-05-25 17:01:32.000000000 +0200
++++ cups-1.6b1/config.h.in     2012-05-25 17:03:16.889043298 +0200
+@@ -768,6 +768,13 @@ static __inline int _cups_abs(int i) { r
+ #  endif /* __GNUC__ || __STDC_VERSION__ */
+ #endif /* !HAVE_ABS && !abs */
  
 +/*
 + * Are we trying to meet LSPP requirements?
@@ -11,12 +11,13 @@ diff -up cups-1.4.5/config.h.in.lspp cups-1.4.5/config.h.in
 +
 +#undef WITH_LSPP
 +
++
  #endif /* !_CUPS_CONFIG_H_ */
  
-diff -up cups-1.4.5/config-scripts/cups-lspp.m4.lspp cups-1.4.5/config-scripts/cups-lspp.m4
---- cups-1.4.5/config-scripts/cups-lspp.m4.lspp        2010-12-24 13:21:31.174858361 +0000
-+++ cups-1.4.5/config-scripts/cups-lspp.m4     2010-12-24 13:21:31.174858361 +0000
+ /*
+diff -up cups-1.6b1/config-scripts/cups-lspp.m4.lspp cups-1.6b1/config-scripts/cups-lspp.m4
+--- cups-1.6b1/config-scripts/cups-lspp.m4.lspp        2012-05-25 17:01:32.852768495 +0200
++++ cups-1.6b1/config-scripts/cups-lspp.m4     2012-05-25 17:01:32.853768488 +0200
 @@ -0,0 +1,36 @@
 +dnl
 +dnl   LSPP code for the Common UNIX Printing System (CUPS).
@@ -54,11 +55,11 @@ diff -up cups-1.4.5/config-scripts/cups-lspp.m4.lspp cups-1.4.5/config-scripts/c
 +            ;;
 +    esac
 +fi
-diff -up cups-1.4.5/configure.in.lspp cups-1.4.5/configure.in
---- cups-1.4.5/configure.in.lspp       2010-06-22 22:42:44.000000000 +0100
-+++ cups-1.4.5/configure.in    2010-12-24 13:21:31.174858362 +0000
-@@ -42,6 +42,8 @@ sinclude(config-scripts/cups-pap.m4)
- sinclude(config-scripts/cups-pdf.m4)
+diff -up cups-1.6b1/configure.in.lspp cups-1.6b1/configure.in
+--- cups-1.6b1/configure.in.lspp       2012-05-25 17:01:32.000000000 +0200
++++ cups-1.6b1/configure.in    2012-05-25 17:04:03.994714943 +0200
+@@ -37,6 +37,8 @@ sinclude(config-scripts/cups-systemd.m4)
+ sinclude(config-scripts/cups-defaults.m4)
  sinclude(config-scripts/cups-scripting.m4)
  
 +sinclude(config-scripts/cups-lspp.m4)
@@ -66,845 +67,9 @@ diff -up cups-1.4.5/configure.in.lspp cups-1.4.5/configure.in
  INSTALL_LANGUAGES=""
  UNINSTALL_LANGUAGES=""
  LANGFILES=""
-diff -up cups-1.4.5/cups/cups.h.lspp cups-1.4.5/cups/cups.h
---- cups-1.4.5/cups/cups.h.lspp        2010-06-22 04:18:27.000000000 +0100
-+++ cups-1.4.5/cups/cups.h     2010-12-24 13:21:31.176858307 +0000
-@@ -15,6 +15,9 @@
-  *   This file is subject to the Apple OS-Developed Software exception.
-  */
-+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
-+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
-+
- #ifndef _CUPS_CUPS_H_
- #  define _CUPS_CUPS_H_
-@@ -86,6 +89,12 @@ extern "C" {
- #  define CUPS_WHICHJOBS_COMPLETED 1
-+# ifdef WITH_LSPP
-+# define MLS_CONFIG "mls"
-+# define TE_CONFIG "te"
-+# define SELINUX_CONFIG "SELinux"
-+# define UNKNOWN_SL "UNKNOWN SL"
-+# endif /* WITH_LSPP */
- /*
-  * Types and structures...
-  */
-diff -up cups-1.4.5/data/Makefile.lspp cups-1.4.5/data/Makefile
---- cups-1.4.5/data/Makefile.lspp      2008-11-12 19:30:57.000000000 +0000
-+++ cups-1.4.5/data/Makefile   2010-12-24 13:21:31.177858282 +0000
-@@ -25,7 +25,10 @@ BANNERS     =       \
-               secret \
-               standard \
-               topsecret \
--              unclassified
-+              unclassified \
-+              selinux \
-+              mls \
-+              te
- CHARMAPS =    \
-               euc-cn.txt \
-diff -up cups-1.4.5/data/mls.lspp cups-1.4.5/data/mls
---- cups-1.4.5/data/mls.lspp   2010-12-24 13:21:31.177858282 +0000
-+++ cups-1.4.5/data/mls        2010-12-24 13:21:31.178858258 +0000
-@@ -0,0 +1,261 @@
-+%!PS-Adobe-3.0
-+%%BoundingBox: 0 0 612 792
-+%%Pages: 1
-+%%LanguageLevel: 1
-+%%DocumentData: Clean7Bit
-+%%DocumentSuppliedResources: procset bannerprint/1.0
-+%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
-+%%Creator: Michael Sweet, Easy Software Products
-+%%CreationDate: May 10, 2000
-+%%Title: Test Page
-+%%EndComments
-+%%BeginProlog
-+%%BeginResource procset bannerprint 1.1 0
-+%
-+%   PostScript banner page for the Common UNIX Printing System ("CUPS").
-+%
-+%   Copyright 1993-2005 by Easy Software Products
-+%
-+%   These coded instructions, statements, and computer programs are the
-+%   property of Easy Software Products and are protected by Federal
-+%   copyright law.  Distribution and use rights are outlined in the file
-+%   "LICENSE.txt" which should have been included with this file.  If this
-+%   file is missing or damaged please contact Easy Software Products
-+%   at:
-+%
-+%       Attn: CUPS Licensing Information
-+%       Easy Software Products
-+%       44141 Airport View Drive, Suite 204
-+%       Hollywood, Maryland 20636 USA
-+%
-+%       Voice: (301) 373-9600
-+%       EMail: cups-info@cups.org
-+%         WWW: http://www.cups.org
-+%
-+/CENTER {                     % Draw centered text
-+                              % (name) CENTER -
-+  dup stringwidth pop         % Get the width of the string
-+  0.5 mul neg 0 rmoveto               % Shift left 1/2 of the distance
-+  show                                % Show the string
-+} bind def
-+/RIGHT {                      % Draw right-justified text
-+                              % (name) RIGHT -
-+  dup stringwidth pop         % Get the width of the string
-+  neg 0 rmoveto                       % Shift left the entire distance
-+  show                                % Show the string
-+} bind def
-+/NUMBER {                     % Draw a number
-+                              % power n NUMBER -
-+  1 index 1 eq {              % power == 1?
-+    round cvi exch pop                % Convert "n" to integer
-+  } {
-+    1 index mul round exch div        % Truncate extra decimal places
-+  } ifelse
-+  100 string cvs show         % Convert to a string and show it...
-+} bind def
-+/CUPSLOGO {                   % Draw the CUPS logo
-+                              % height CUPSLOGO
-+  % Start with a big C...
-+  /Helvetica findfont 1 index scalefont setfont
-+  0 setgray
-+  0 0 moveto
-+  (C) show
-+
-+  % Then "UNIX Printing System" much smaller...
-+  /Helvetica-Bold findfont 1 index 9 div scalefont setfont
-+  0.25 mul
-+  dup dup 2.0 mul moveto
-+  (UNIX) show
-+  dup dup 1.6 mul moveto
-+  (Printing) show
-+  dup 1.2 mul moveto
-+  (System) show
-+} bind def
-+/ESPLOGO {                    % Draw the ESP logo
-+                              % height ESPLOGO
-+  % Compute the size of the logo...
-+  0 0
-+  2 index 1.5 mul 3 index
-+
-+  % Do the "metallic" fill from 10% black to 40% black...
-+  1 -0.001 0 {
-+    dup                       % loopval
-+    -0.15 mul         % loopval * -0.15
-+    0.9 add           % 0.9 - loopval * 0.15
-+    setgray           % set gray shade
-+
-+    0                 % x
-+    1 index neg               % loopval
-+    1 add             % 1 - loopval
-+    3 index           % height
-+    mul                       % height * (1 - loopval)
-+    moveto            % starting point
-+
-+    dup                       % loopval
-+    3 index           % width
-+    mul                       % loopval * width
-+    2 index           % height
-+    lineto            % Next point
-+
-+    0                 % x
-+    2 index           % height
-+    lineto            % Next point
-+
-+    closepath
-+    fill
-+
-+    dup                       % loopval
-+    0.15 mul          % loopval * 0.15
-+    0.6 add           % 0.6 + loopval * 0.15
-+    setgray
-+
-+    dup                       % loopval
-+    neg 1 add         % 1 - loopval
-+    3 index           % width
-+    mul                       % (1 - loopval) * width
-+    0                 % y
-+    moveto            % Starting point
-+
-+    2 index           % width
-+    exch              % loopval
-+    2 index           % height
-+    mul                       % loopval * height
-+    lineto            % Next point
-+
-+    1 index           % width
-+    0                 % y
-+    lineto            % Next point
-+
-+    closepath
-+    fill
-+  } for
-+
-+  0 setgray rectstroke
-+
-+  /Helvetica-BoldOblique findfont 1 index 3 div scalefont setfont
-+  dup 40 div
-+
-+  dup 4 mul 1 index 25 mul moveto (E) show
-+  dup 10 mul 1 index 15 mul moveto (S) show
-+  dup 16 mul 1 index 5 mul moveto (P) show
-+
-+  /Helvetica-BoldOblique findfont 2 index 5 div scalefont setfont
-+  dup 14 mul 1 index 29 mul moveto (asy) show
-+  dup 20 mul 1 index 19 mul moveto (oftware) show
-+  dup 26 mul 1 index 9 mul moveto (roducts) show
-+
-+  pop
-+} bind def
-+%%EndResource
-+%%EndProlog
-+%%Page: 1 1
-+gsave
-+
-+  % Determine the imageable area and device resolution...
-+  initclip newpath clippath pathbbox  % Get bounding rectangle
-+  72 div /pageTop exch def            % Get top margin in inches
-+  72 div /pageRight exch def          % Get right margin in inches
-+  72 div /pageBottom exch def         % Get bottom margin in inches
-+  72 div /pageLeft exch def           % Get left margin in inches
-+
-+  /pageWidth pageRight pageLeft sub def       % pageWidth = pageRight - pageLeft
-+  /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom
-+
-+  /boxWidth                           % width of text box
-+  pageWidth pageHeight lt
-+  { pageWidth 54 mul }
-+  { pageHeight 42 mul }
-+  ifelse def
-+
-+  newpath                             % Clear bounding path
-+
-+  % Create fonts...
-+  /bigFont /Helvetica-Bold findfont   % bigFont = Helvetica-Bold
-+  pageHeight 3 mul scalefont def      % size = pageHeight * 3 (nominally 33)
-+
-+  /mediumFont /Helvetica findfont     % mediumFont = Helvetica
-+  pageHeight 1.5 mul scalefont def    % size = pageHeight * 1.5 (nominally 16.5)
-+
-+  % Offset page to account for lower-left margin...
-+  pageLeft 72 mul
-+  pageBottom 72 mul
-+  translate
-+
-+  % Job information box...
-+  pageWidth 36 mul 9 add              % x = pageWidth * 1/2 * 72 + 9
-+  boxWidth 0.5 mul sub                        % x-= 1/2 box width
-+  pageHeight 30 mul 9 sub             % y = pageHeight * 1/2 * 72 - 9
-+  boxWidth                            % w = box width
-+  pageHeight 14 mul                   % h = pageHeight * 1/2 * 72
-+  0.5 setgray rectfill                        % Draw a shadow
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  boxWidth 0.5 mul sub                        % x-= 1/2 box width
-+  pageHeight 30 mul                   % y = pageHeight * 1/4 * 72
-+  boxWidth                            % w = box width
-+  pageHeight 14 mul                   % h = pageHeight * 1/2 * 72
-+
-+  4 copy 1 setgray rectfill           % Clear the box to white
-+  0 setgray rectstroke                        % Draw a black box around it...
-+
-+  % Job information text...
-+  mediumFont setfont                  % Medium sized font
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight 5 mul add                        % y += 2 lines
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Job ID: ) RIGHT
-+  moveto
-+  ({printer-name}-{job-id}) show
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight 2 mul add                        % y += 1 line
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Title: ) RIGHT
-+  moveto
-+  ({job-name}) show
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight -1 mul add                       % y -= 1 line
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Requesting User: ) RIGHT
-+  moveto
-+  ({job-originating-user-name}) show
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight -4 mul add                       % y -= 2 lines
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Billing Info: ) RIGHT
-+  moveto
-+  ({?job-billing}) show
-+
-+  % Then the CUPS logo....
-+  gsave
-+    pageWidth 4 mul
-+    pageWidth 6 mul
-+    translate
-+    pageWidth 9 mul CUPSLOGO
-+  grestore
-+
-+  % And the ESP logo....
-+  gsave
-+    pageWidth 59 mul
-+    pageWidth 6 mul
-+    translate
-+    pageWidth 6 mul ESPLOGO
-+  grestore
-+% Show the page...
-+grestore
-+showpage
-+%
-+% End of "$Id: mls_template,v 1.1 2005/06/27 18:44:46 colmo Exp $".
-+%
-+%%EOF
-diff -up cups-1.4.5/data/selinux.lspp cups-1.4.5/data/selinux
---- cups-1.4.5/data/selinux.lspp       2010-12-24 13:21:31.178858258 +0000
-+++ cups-1.4.5/data/selinux    2010-12-24 13:21:31.179858233 +0000
-@@ -0,0 +1,261 @@
-+%!PS-Adobe-3.0
-+%%BoundingBox: 0 0 612 792
-+%%Pages: 1
-+%%LanguageLevel: 1
-+%%DocumentData: Clean7Bit
-+%%DocumentSuppliedResources: procset bannerprint/1.0
-+%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
-+%%Creator: Michael Sweet, Easy Software Products
-+%%CreationDate: May 10, 2000
-+%%Title: Test Page
-+%%EndComments
-+%%BeginProlog
-+%%BeginResource procset bannerprint 1.1 0
-+%
-+%   PostScript banner page for the Common UNIX Printing System ("CUPS").
-+%
-+%   Copyright 1993-2005 by Easy Software Products
-+%
-+%   These coded instructions, statements, and computer programs are the
-+%   property of Easy Software Products and are protected by Federal
-+%   copyright law.  Distribution and use rights are outlined in the file
-+%   "LICENSE.txt" which should have been included with this file.  If this
-+%   file is missing or damaged please contact Easy Software Products
-+%   at:
-+%
-+%       Attn: CUPS Licensing Information
-+%       Easy Software Products
-+%       44141 Airport View Drive, Suite 204
-+%       Hollywood, Maryland 20636 USA
-+%
-+%       Voice: (301) 373-9600
-+%       EMail: cups-info@cups.org
-+%         WWW: http://www.cups.org
-+%
-+/CENTER {                     % Draw centered text
-+                              % (name) CENTER -
-+  dup stringwidth pop         % Get the width of the string
-+  0.5 mul neg 0 rmoveto               % Shift left 1/2 of the distance
-+  show                                % Show the string
-+} bind def
-+/RIGHT {                      % Draw right-justified text
-+                              % (name) RIGHT -
-+  dup stringwidth pop         % Get the width of the string
-+  neg 0 rmoveto                       % Shift left the entire distance
-+  show                                % Show the string
-+} bind def
-+/NUMBER {                     % Draw a number
-+                              % power n NUMBER -
-+  1 index 1 eq {              % power == 1?
-+    round cvi exch pop                % Convert "n" to integer
-+  } {
-+    1 index mul round exch div        % Truncate extra decimal places
-+  } ifelse
-+  100 string cvs show         % Convert to a string and show it...
-+} bind def
-+/CUPSLOGO {                   % Draw the CUPS logo
-+                              % height CUPSLOGO
-+  % Start with a big C...
-+  /Helvetica findfont 1 index scalefont setfont
-+  0 setgray
-+  0 0 moveto
-+  (C) show
-+
-+  % Then "UNIX Printing System" much smaller...
-+  /Helvetica-Bold findfont 1 index 9 div scalefont setfont
-+  0.25 mul
-+  dup dup 2.0 mul moveto
-+  (UNIX) show
-+  dup dup 1.6 mul moveto
-+  (Printing) show
-+  dup 1.2 mul moveto
-+  (System) show
-+} bind def
-+/ESPLOGO {                    % Draw the ESP logo
-+                              % height ESPLOGO
-+  % Compute the size of the logo...
-+  0 0
-+  2 index 1.5 mul 3 index
-+
-+  % Do the "metallic" fill from 10% black to 40% black...
-+  1 -0.001 0 {
-+    dup                       % loopval
-+    -0.15 mul         % loopval * -0.15
-+    0.9 add           % 0.9 - loopval * 0.15
-+    setgray           % set gray shade
-+
-+    0                 % x
-+    1 index neg               % loopval
-+    1 add             % 1 - loopval
-+    3 index           % height
-+    mul                       % height * (1 - loopval)
-+    moveto            % starting point
-+
-+    dup                       % loopval
-+    3 index           % width
-+    mul                       % loopval * width
-+    2 index           % height
-+    lineto            % Next point
-+
-+    0                 % x
-+    2 index           % height
-+    lineto            % Next point
-+
-+    closepath
-+    fill
-+
-+    dup                       % loopval
-+    0.15 mul          % loopval * 0.15
-+    0.6 add           % 0.6 + loopval * 0.15
-+    setgray
-+
-+    dup                       % loopval
-+    neg 1 add         % 1 - loopval
-+    3 index           % width
-+    mul                       % (1 - loopval) * width
-+    0                 % y
-+    moveto            % Starting point
-+
-+    2 index           % width
-+    exch              % loopval
-+    2 index           % height
-+    mul                       % loopval * height
-+    lineto            % Next point
-+
-+    1 index           % width
-+    0                 % y
-+    lineto            % Next point
-+
-+    closepath
-+    fill
-+  } for
-+
-+  0 setgray rectstroke
-+
-+  /Helvetica-BoldOblique findfont 1 index 3 div scalefont setfont
-+  dup 40 div
-+
-+  dup 4 mul 1 index 25 mul moveto (E) show
-+  dup 10 mul 1 index 15 mul moveto (S) show
-+  dup 16 mul 1 index 5 mul moveto (P) show
-+
-+  /Helvetica-BoldOblique findfont 2 index 5 div scalefont setfont
-+  dup 14 mul 1 index 29 mul moveto (asy) show
-+  dup 20 mul 1 index 19 mul moveto (oftware) show
-+  dup 26 mul 1 index 9 mul moveto (roducts) show
-+
-+  pop
-+} bind def
-+%%EndResource
-+%%EndProlog
-+%%Page: 1 1
-+gsave
-+
-+  % Determine the imageable area and device resolution...
-+  initclip newpath clippath pathbbox  % Get bounding rectangle
-+  72 div /pageTop exch def            % Get top margin in inches
-+  72 div /pageRight exch def          % Get right margin in inches
-+  72 div /pageBottom exch def         % Get bottom margin in inches
-+  72 div /pageLeft exch def           % Get left margin in inches
-+
-+  /pageWidth pageRight pageLeft sub def       % pageWidth = pageRight - pageLeft
-+  /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom
-+
-+  /boxWidth                           % width of text box
-+  pageWidth pageHeight lt
-+  { pageWidth 54 mul }
-+  { pageHeight 42 mul }
-+  ifelse def
-+
-+  newpath                             % Clear bounding path
-+
-+  % Create fonts...
-+  /bigFont /Helvetica-Bold findfont   % bigFont = Helvetica-Bold
-+  pageHeight 3 mul scalefont def      % size = pageHeight * 3 (nominally 33)
-+
-+  /mediumFont /Helvetica findfont     % mediumFont = Helvetica
-+  pageHeight 1.5 mul scalefont def    % size = pageHeight * 1.5 (nominally 16.5)
-+
-+  % Offset page to account for lower-left margin...
-+  pageLeft 72 mul
-+  pageBottom 72 mul
-+  translate
-+
-+  % Job information box...
-+  pageWidth 36 mul 9 add              % x = pageWidth * 1/2 * 72 + 9
-+  boxWidth 0.5 mul sub                        % x-= 1/2 box width
-+  pageHeight 30 mul 9 sub             % y = pageHeight * 1/2 * 72 - 9
-+  boxWidth                            % w = box width
-+  pageHeight 14 mul                   % h = pageHeight * 1/2 * 72
-+  0.5 setgray rectfill                        % Draw a shadow
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  boxWidth 0.5 mul sub                        % x-= 1/2 box width
-+  pageHeight 30 mul                   % y = pageHeight * 1/4 * 72
-+  boxWidth                            % w = box width
-+  pageHeight 14 mul                   % h = pageHeight * 1/2 * 72
-+
-+  4 copy 1 setgray rectfill           % Clear the box to white
-+  0 setgray rectstroke                        % Draw a black box around it...
-+
-+  % Job information text...
-+  mediumFont setfont                  % Medium sized font
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight 5 mul add                        % y += 2 lines
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Job ID: ) RIGHT
-+  moveto
-+  ({printer-name}-{job-id}) show
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight 2 mul add                        % y += 1 line
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Title: ) RIGHT
-+  moveto
-+  ({job-name}) show
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight -1 mul add                       % y -= 1 line
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Requesting User: ) RIGHT
-+  moveto
-+  ({job-originating-user-name}) show
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight -4 mul add                       % y -= 2 lines
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Billing Info: ) RIGHT
-+  moveto
-+  ({?job-billing}) show
-+
-+  % Then the CUPS logo....
-+  gsave
-+    pageWidth 4 mul
-+    pageWidth 6 mul
-+    translate
-+    pageWidth 9 mul CUPSLOGO
-+  grestore
-+
-+  % And the ESP logo....
-+  gsave
-+    pageWidth 59 mul
-+    pageWidth 6 mul
-+    translate
-+    pageWidth 6 mul ESPLOGO
-+  grestore
-+% Show the page...
-+grestore
-+showpage
-+%
-+% End of "$Id: mls_template,v 1.1 2005/06/27 18:44:46 colmo Exp $".
-+%
-+%%EOF
-diff -up cups-1.4.5/data/te.lspp cups-1.4.5/data/te
---- cups-1.4.5/data/te.lspp    2010-12-24 13:21:31.179858233 +0000
-+++ cups-1.4.5/data/te 2010-12-24 13:21:31.180858207 +0000
-@@ -0,0 +1,261 @@
-+%!PS-Adobe-3.0
-+%%BoundingBox: 0 0 612 792
-+%%Pages: 1
-+%%LanguageLevel: 1
-+%%DocumentData: Clean7Bit
-+%%DocumentSuppliedResources: procset bannerprint/1.0
-+%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
-+%%Creator: Michael Sweet, Easy Software Products
-+%%CreationDate: May 10, 2000
-+%%Title: Test Page
-+%%EndComments
-+%%BeginProlog
-+%%BeginResource procset bannerprint 1.1 0
-+%
-+%   PostScript banner page for the Common UNIX Printing System ("CUPS").
-+%
-+%   Copyright 1993-2005 by Easy Software Products
-+%
-+%   These coded instructions, statements, and computer programs are the
-+%   property of Easy Software Products and are protected by Federal
-+%   copyright law.  Distribution and use rights are outlined in the file
-+%   "LICENSE.txt" which should have been included with this file.  If this
-+%   file is missing or damaged please contact Easy Software Products
-+%   at:
-+%
-+%       Attn: CUPS Licensing Information
-+%       Easy Software Products
-+%       44141 Airport View Drive, Suite 204
-+%       Hollywood, Maryland 20636 USA
-+%
-+%       Voice: (301) 373-9600
-+%       EMail: cups-info@cups.org
-+%         WWW: http://www.cups.org
-+%
-+/CENTER {                     % Draw centered text
-+                              % (name) CENTER -
-+  dup stringwidth pop         % Get the width of the string
-+  0.5 mul neg 0 rmoveto               % Shift left 1/2 of the distance
-+  show                                % Show the string
-+} bind def
-+/RIGHT {                      % Draw right-justified text
-+                              % (name) RIGHT -
-+  dup stringwidth pop         % Get the width of the string
-+  neg 0 rmoveto                       % Shift left the entire distance
-+  show                                % Show the string
-+} bind def
-+/NUMBER {                     % Draw a number
-+                              % power n NUMBER -
-+  1 index 1 eq {              % power == 1?
-+    round cvi exch pop                % Convert "n" to integer
-+  } {
-+    1 index mul round exch div        % Truncate extra decimal places
-+  } ifelse
-+  100 string cvs show         % Convert to a string and show it...
-+} bind def
-+/CUPSLOGO {                   % Draw the CUPS logo
-+                              % height CUPSLOGO
-+  % Start with a big C...
-+  /Helvetica findfont 1 index scalefont setfont
-+  0 setgray
-+  0 0 moveto
-+  (C) show
-+
-+  % Then "UNIX Printing System" much smaller...
-+  /Helvetica-Bold findfont 1 index 9 div scalefont setfont
-+  0.25 mul
-+  dup dup 2.0 mul moveto
-+  (UNIX) show
-+  dup dup 1.6 mul moveto
-+  (Printing) show
-+  dup 1.2 mul moveto
-+  (System) show
-+} bind def
-+/ESPLOGO {                    % Draw the ESP logo
-+                              % height ESPLOGO
-+  % Compute the size of the logo...
-+  0 0
-+  2 index 1.5 mul 3 index
-+
-+  % Do the "metallic" fill from 10% black to 40% black...
-+  1 -0.001 0 {
-+    dup                       % loopval
-+    -0.15 mul         % loopval * -0.15
-+    0.9 add           % 0.9 - loopval * 0.15
-+    setgray           % set gray shade
-+
-+    0                 % x
-+    1 index neg               % loopval
-+    1 add             % 1 - loopval
-+    3 index           % height
-+    mul                       % height * (1 - loopval)
-+    moveto            % starting point
-+
-+    dup                       % loopval
-+    3 index           % width
-+    mul                       % loopval * width
-+    2 index           % height
-+    lineto            % Next point
-+
-+    0                 % x
-+    2 index           % height
-+    lineto            % Next point
-+
-+    closepath
-+    fill
-+
-+    dup                       % loopval
-+    0.15 mul          % loopval * 0.15
-+    0.6 add           % 0.6 + loopval * 0.15
-+    setgray
-+
-+    dup                       % loopval
-+    neg 1 add         % 1 - loopval
-+    3 index           % width
-+    mul                       % (1 - loopval) * width
-+    0                 % y
-+    moveto            % Starting point
-+
-+    2 index           % width
-+    exch              % loopval
-+    2 index           % height
-+    mul                       % loopval * height
-+    lineto            % Next point
-+
-+    1 index           % width
-+    0                 % y
-+    lineto            % Next point
-+
-+    closepath
-+    fill
-+  } for
-+
-+  0 setgray rectstroke
-+
-+  /Helvetica-BoldOblique findfont 1 index 3 div scalefont setfont
-+  dup 40 div
-+
-+  dup 4 mul 1 index 25 mul moveto (E) show
-+  dup 10 mul 1 index 15 mul moveto (S) show
-+  dup 16 mul 1 index 5 mul moveto (P) show
-+
-+  /Helvetica-BoldOblique findfont 2 index 5 div scalefont setfont
-+  dup 14 mul 1 index 29 mul moveto (asy) show
-+  dup 20 mul 1 index 19 mul moveto (oftware) show
-+  dup 26 mul 1 index 9 mul moveto (roducts) show
-+
-+  pop
-+} bind def
-+%%EndResource
-+%%EndProlog
-+%%Page: 1 1
-+gsave
-+
-+  % Determine the imageable area and device resolution...
-+  initclip newpath clippath pathbbox  % Get bounding rectangle
-+  72 div /pageTop exch def            % Get top margin in inches
-+  72 div /pageRight exch def          % Get right margin in inches
-+  72 div /pageBottom exch def         % Get bottom margin in inches
-+  72 div /pageLeft exch def           % Get left margin in inches
-+
-+  /pageWidth pageRight pageLeft sub def       % pageWidth = pageRight - pageLeft
-+  /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom
-+
-+  /boxWidth                           % width of text box
-+  pageWidth pageHeight lt
-+  { pageWidth 54 mul }
-+  { pageHeight 42 mul }
-+  ifelse def
-+
-+  newpath                             % Clear bounding path
-+
-+  % Create fonts...
-+  /bigFont /Helvetica-Bold findfont   % bigFont = Helvetica-Bold
-+  pageHeight 3 mul scalefont def      % size = pageHeight * 3 (nominally 33)
-+
-+  /mediumFont /Helvetica findfont     % mediumFont = Helvetica
-+  pageHeight 1.5 mul scalefont def    % size = pageHeight * 1.5 (nominally 16.5)
-+
-+  % Offset page to account for lower-left margin...
-+  pageLeft 72 mul
-+  pageBottom 72 mul
-+  translate
-+
-+  % Job information box...
-+  pageWidth 36 mul 9 add              % x = pageWidth * 1/2 * 72 + 9
-+  boxWidth 0.5 mul sub                        % x-= 1/2 box width
-+  pageHeight 30 mul 9 sub             % y = pageHeight * 1/2 * 72 - 9
-+  boxWidth                            % w = box width
-+  pageHeight 14 mul                   % h = pageHeight * 1/2 * 72
-+  0.5 setgray rectfill                        % Draw a shadow
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  boxWidth 0.5 mul sub                        % x-= 1/2 box width
-+  pageHeight 30 mul                   % y = pageHeight * 1/4 * 72
-+  boxWidth                            % w = box width
-+  pageHeight 14 mul                   % h = pageHeight * 1/2 * 72
-+
-+  4 copy 1 setgray rectfill           % Clear the box to white
-+  0 setgray rectstroke                        % Draw a black box around it...
-+
-+  % Job information text...
-+  mediumFont setfont                  % Medium sized font
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight 5 mul add                        % y += 2 lines
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Job ID: ) RIGHT
-+  moveto
-+  ({printer-name}-{job-id}) show
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight 2 mul add                        % y += 1 line
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Title: ) RIGHT
-+  moveto
-+  ({job-name}) show
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight -1 mul add                       % y -= 1 line
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Requesting User: ) RIGHT
-+  moveto
-+  ({job-originating-user-name}) show
-+
-+  pageWidth 36 mul                    % x = pageWidth * 1/2 * 72
-+  pageHeight 36 mul                   % y = pageHeight * 1/2 * 72
-+  pageHeight -4 mul add                       % y -= 2 lines
-+  2 copy                              % Copy X & Y
-+  moveto
-+  (Billing Info: ) RIGHT
-+  moveto
-+  ({?job-billing}) show
-+
-+  % Then the CUPS logo....
-+  gsave
-+    pageWidth 4 mul
-+    pageWidth 6 mul
-+    translate
-+    pageWidth 9 mul CUPSLOGO
-+  grestore
-+
-+  % And the ESP logo....
-+  gsave
-+    pageWidth 59 mul
-+    pageWidth 6 mul
-+    translate
-+    pageWidth 6 mul ESPLOGO
-+  grestore
-+% Show the page...
-+grestore
-+showpage
-+%
-+% End of "$Id: mls_template,v 1.1 2005/06/27 18:44:46 colmo Exp $".
-+%
-+%%EOF
-diff -up cups-1.4.5/filter/common.c.lspp cups-1.4.5/filter/common.c
---- cups-1.4.5/filter/common.c.lspp    2007-07-11 22:46:42.000000000 +0100
-+++ cups-1.4.5/filter/common.c 2010-12-24 13:21:31.181858180 +0000
+diff -up cups-1.6b1/filter/common.c.lspp cups-1.6b1/filter/common.c
+--- cups-1.6b1/filter/common.c.lspp    2011-05-20 05:49:49.000000000 +0200
++++ cups-1.6b1/filter/common.c 2012-05-25 17:01:32.854768481 +0200
 @@ -30,6 +30,12 @@
   * Include necessary headers...
   */
@@ -957,7 +122,7 @@ diff -up cups-1.4.5/filter/common.c.lspp cups-1.4.5/filter/common.c
 +    {
 +      lines = 1 + (int)(label_len / max_width);
 +      line_len = (int)(label_len / lines);
-+      wrapped_label = malloc(sizeof(wrapped_label) * lines);
++      wrapped_label = malloc(sizeof(*wrapped_label) * lines);
 +      label_index = i = n = 0;
 +      while (classification[label_index])
 +      {
@@ -989,7 +154,7 @@ diff -up cups-1.4.5/filter/common.c.lspp cups-1.4.5/filter/common.c
 +    else
 +    {
 +      lines = 1;
-+      wrapped_label = malloc(sizeof(wrapped_label));
++      wrapped_label = malloc(sizeof(*wrapped_label));
 +      wrapped_label[0] = (char*)classification;
 +    }
 +
@@ -1073,10 +238,10 @@ diff -up cups-1.4.5/filter/common.c.lspp cups-1.4.5/filter/common.c
  
  
  /*
-diff -up cups-1.4.5/filter/pstops.c.lspp cups-1.4.5/filter/pstops.c
---- cups-1.4.5/filter/pstops.c.lspp    2010-12-24 13:21:30.960863932 +0000
-+++ cups-1.4.5/filter/pstops.c 2010-12-24 13:21:31.186858049 +0000
-@@ -3335,6 +3335,18 @@ write_label_prolog(pstops_doc_t *doc,   /*
+diff -up cups-1.6b1/filter/pstops.c.lspp cups-1.6b1/filter/pstops.c
+--- cups-1.6b1/filter/pstops.c.lspp    2012-04-23 21:19:19.000000000 +0200
++++ cups-1.6b1/filter/pstops.c 2012-05-25 17:01:32.855768474 +0200
+@@ -3202,6 +3202,18 @@ write_label_prolog(pstops_doc_t *doc,   /*
  {
    const char  *classification;        /* CLASSIFICATION environment variable */
    const char  *ptr;                   /* Temporary string pointer */
@@ -1095,7 +260,7 @@ diff -up cups-1.4.5/filter/pstops.c.lspp cups-1.4.5/filter/pstops.c
  
  
   /*
-@@ -3357,6 +3369,124 @@ write_label_prolog(pstops_doc_t *doc,  /*
+@@ -3224,6 +3236,124 @@ write_label_prolog(pstops_doc_t *doc,  /*
      return;
    }
  
@@ -1115,7 +280,7 @@ diff -up cups-1.4.5/filter/pstops.c.lspp cups-1.4.5/filter/pstops.c
 +    {
 +      lines = 1 + (int)(label_len / max_width);
 +      line_len = (int)(label_len / lines);
-+      wrapped_label = malloc(sizeof(wrapped_label) * lines);
++      wrapped_label = malloc(sizeof(*wrapped_label) * lines);
 +      label_index = i = n = 0;
 +      while (classification[label_index])
 +      {
@@ -1147,7 +312,7 @@ diff -up cups-1.4.5/filter/pstops.c.lspp cups-1.4.5/filter/pstops.c
 +    else
 +    {
 +      lines = 1;
-+      wrapped_label = malloc(sizeof(wrapped_label));
++      wrapped_label = malloc(sizeof(*wrapped_label));
 +      wrapped_label[0] = (char*)classification;
 +    }
 +
@@ -1220,7 +385,7 @@ diff -up cups-1.4.5/filter/pstops.c.lspp cups-1.4.5/filter/pstops.c
   /*
    * Set the classification + page label string...
    */
-@@ -3435,7 +3565,10 @@ write_label_prolog(pstops_doc_t *doc,   /*
+@@ -3302,7 +3432,10 @@ write_label_prolog(pstops_doc_t *doc,   /*
    doc_printf(doc, "  %.0f moveto ESPpl show\n", top - 14.0);
    doc_puts(doc, "pop\n");
    doc_puts(doc, "}bind put\n");
@@ -1231,47 +396,35 @@ diff -up cups-1.4.5/filter/pstops.c.lspp cups-1.4.5/filter/pstops.c
  
  
  /*
-diff -up cups-1.4.5/Makedefs.in.lspp cups-1.4.5/Makedefs.in
---- cups-1.4.5/Makedefs.in.lspp        2010-12-24 13:21:31.073860989 +0000
-+++ cups-1.4.5/Makedefs.in     2010-12-24 13:21:31.187858023 +0000
-@@ -146,7 +146,7 @@ LIBCUPSORDER       =       @LIBCUPSORDER@
- LIBCUPSIMAGEORDER =   @LIBCUPSIMAGEORDER@
- LINKCUPS      =       @LINKCUPS@ $(SSLLIBS) $(DNSSDLIBS)
+diff -up cups-1.6b1/Makedefs.in.lspp cups-1.6b1/Makedefs.in
+--- cups-1.6b1/Makedefs.in.lspp        2012-05-25 17:01:32.000000000 +0200
++++ cups-1.6b1/Makedefs.in     2012-05-25 17:07:57.325088484 +0200
+@@ -146,7 +146,7 @@ LDFLAGS            =       -L../cgi-bin -L../cups -L../f
+                       @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
+ LINKCUPS      =       @LINKCUPS@ $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(LIBZ)
  LINKCUPSIMAGE =       @LINKCUPSIMAGE@
 -LIBS          =       $(LINKCUPS) $(COMMONLIBS)
 +LIBS          =       $(LINKCUPS) $(COMMONLIBS) @LIBAUDIT@ @LIBSELINUX@
  OPTIM         =       @OPTIM@
  OPTIONS               =
  PAMLIBS               =       @PAMLIBS@
-@@ -258,7 +258,7 @@ DBUSDIR            =       @DBUSDIR@
- # Rules...
- #
--.SILENT:
-+
- .SUFFIXES:    .1 .1.gz .1m .1m.gz .3 .3.gz .5 .5.gz .7 .7.gz .8 .8.gz .a .c .cxx .h .man .o .32.o .64.o .gz
- .c.o:
-diff -up cups-1.4.5/scheduler/client.c.lspp cups-1.4.5/scheduler/client.c
---- cups-1.4.5/scheduler/client.c.lspp 2010-10-17 05:13:56.000000000 +0100
-+++ cups-1.4.5/scheduler/client.c      2010-12-24 13:21:31.194857839 +0000
-@@ -44,6 +44,7 @@
-  *   valid_host()           - Is the Host: field valid?
-  *   write_file()           - Send a file via HTTP.
-  *   write_pipe()           - Flag that data is available on the CGI pipe.
+diff -up cups-1.6b1/scheduler/client.c.lspp cups-1.6b1/scheduler/client.c
+--- cups-1.6b1/scheduler/client.c.lspp 2012-05-08 00:41:30.000000000 +0200
++++ cups-1.6b1/scheduler/client.c      2012-05-25 17:13:38.947707163 +0200
+@@ -41,6 +41,7 @@
+  *   valid_host()         - Is the Host: field valid?
+  *   write_file()         - Send a file via HTTP.
+  *   write_pipe()         - Flag that data is available on the CGI pipe.
 + *   client_pid_to_auid()   - Get the audit login uid of the client.
   */
  
  /*
-@@ -52,6 +53,7 @@
+@@ -49,10 +50,16 @@
  
  #include "cupsd.h"
  
 +#define _GNU_SOURCE
- #ifdef HAVE_CDSASSL
- #  include <Security/Security.h>
- #  include <Security/SecItem.h>
-@@ -90,6 +92,12 @@ extern const char *cssmErrorString(int e
+ #ifdef HAVE_TCPD_H
  #  include <tcpd.h>
  #endif /* HAVE_TCPD_H */
  
@@ -1280,11 +433,10 @@ diff -up cups-1.4.5/scheduler/client.c.lspp cups-1.4.5/scheduler/client.c
 +#include <selinux/context.h>
 +#include <fcntl.h>
 +#endif /* WITH_LSPP */
-+
  
  /*
-  * Local functions...
-@@ -391,6 +399,57 @@ cupsdAcceptClient(cupsd_listener_t *lis)
+  * Local globals...
+@@ -371,6 +378,57 @@ cupsdAcceptClient(cupsd_listener_t *lis)
    }
  #endif /* HAVE_TCPD_H */
  
@@ -1339,10 +491,10 @@ diff -up cups-1.4.5/scheduler/client.c.lspp cups-1.4.5/scheduler/client.c
 +  }
 +#endif /* WITH_LSPP */
 +
- #ifdef AF_INET6
-   if (con->http.hostaddr->addr.sa_family == AF_INET6)
-     cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdAcceptClient: %d from %s:%d (IPv6)",
-@@ -781,6 +840,13 @@ cupsdReadClient(cupsd_client_t *con)      /* 
+ #ifdef AF_LOCAL
+   if (con->http.hostaddr->addr.sa_family == AF_LOCAL)
+     cupsdLogMessage(CUPSD_LOG_DEBUG, "[Client %d] Accepted from %s (Domain)",
+@@ -678,6 +736,13 @@ cupsdReadClient(cupsd_client_t *con)      /*
    mime_type_t         *type;          /* MIME type of file */
    cupsd_printer_t     *p;             /* Printer */
    static unsigned     request_id = 0; /* Request ID for temp files */
@@ -1356,7 +508,7 @@ diff -up cups-1.4.5/scheduler/client.c.lspp cups-1.4.5/scheduler/client.c
  
  
    status = HTTP_CONTINUE;
-@@ -2135,6 +2201,67 @@ cupsdReadClient(cupsd_client_t *con)    /* 
+@@ -2126,6 +2191,67 @@ cupsdReadClient(cupsd_client_t *con)    /*
            fchmod(con->file, 0640);
            fchown(con->file, RunUser, Group);
              fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC);
@@ -1424,9 +576,9 @@ diff -up cups-1.4.5/scheduler/client.c.lspp cups-1.4.5/scheduler/client.c
          }
  
          if (con->http.state != HTTP_POST_SEND)
-@@ -4641,6 +4768,50 @@ make_certificate(cupsd_client_t *con)   /*
- #endif /* HAVE_SSL */
+@@ -3581,6 +3707,49 @@ is_path_absolute(const char *path)      /* I
+   return (1);
+ }
  
 +#ifdef WITH_LSPP
 +/*
@@ -1471,13 +623,12 @@ diff -up cups-1.4.5/scheduler/client.c.lspp cups-1.4.5/scheduler/client.c
 +    return uid;
 +}
 +#endif /* WITH_LSPP */
-+
  /*
   * 'pipe_command()' - Pipe the output of a command to the remote client.
-  */
-diff -up cups-1.4.5/scheduler/client.h.lspp cups-1.4.5/scheduler/client.h
---- cups-1.4.5/scheduler/client.h.lspp 2009-05-26 23:01:23.000000000 +0100
-+++ cups-1.4.5/scheduler/client.h      2010-12-24 13:21:31.195857813 +0000
+diff -up cups-1.6b1/scheduler/client.h.lspp cups-1.6b1/scheduler/client.h
+--- cups-1.6b1/scheduler/client.h.lspp 2012-05-25 17:01:32.847768530 +0200
++++ cups-1.6b1/scheduler/client.h      2012-05-25 17:14:12.963470050 +0200
 @@ -18,6 +18,13 @@
  #endif /* HAVE_AUTHORIZATION_H */
  
@@ -1492,7 +643,7 @@ diff -up cups-1.4.5/scheduler/client.h.lspp cups-1.4.5/scheduler/client.h
  /*
   * HTTP client structure...
   */
-@@ -64,6 +71,10 @@ struct cupsd_client_s
+@@ -63,6 +70,10 @@ struct cupsd_client_s
  #ifdef HAVE_AUTHORIZATION_H
    AuthorizationRef    authref;        /* Authorization ref */
  #endif /* HAVE_AUTHORIZATION_H */
@@ -1503,7 +654,7 @@ diff -up cups-1.4.5/scheduler/client.h.lspp cups-1.4.5/scheduler/client.h
  };
  
  #define HTTP(con) &((con)->http)
-@@ -133,6 +144,9 @@ extern void        cupsdStartListening(void);
+@@ -135,6 +146,9 @@ extern void        cupsdStartListening(void);
  extern void   cupsdStopListening(void);
  extern void   cupsdUpdateCGI(void);
  extern void   cupsdWriteClient(cupsd_client_t *con);
@@ -1511,20 +662,20 @@ diff -up cups-1.4.5/scheduler/client.h.lspp cups-1.4.5/scheduler/client.h
 +extern uid_t  client_pid_to_auid(pid_t clipid);
 +#endif /* WITH_LSPP */
  
- /*
-diff -up cups-1.4.5/scheduler/conf.c.lspp cups-1.4.5/scheduler/conf.c
---- cups-1.4.5/scheduler/conf.c.lspp   2010-12-24 13:21:30.897865572 +0000
-+++ cups-1.4.5/scheduler/conf.c        2010-12-24 13:21:31.200857684 +0000
-@@ -29,6 +29,7 @@
-  *   read_configuration()     - Read a configuration file.
+ #ifdef HAVE_SSL
+ extern int    cupsdEndTLS(cupsd_client_t *con);
+diff -up cups-1.6b1/scheduler/conf.c.lspp cups-1.6b1/scheduler/conf.c
+--- cups-1.6b1/scheduler/conf.c.lspp   2012-05-25 17:01:32.778769011 +0200
++++ cups-1.6b1/scheduler/conf.c        2012-05-25 17:01:32.860768439 +0200
+@@ -32,6 +32,7 @@
   *   read_location()          - Read a <Location path> definition.
   *   read_policy()            - Read a <Policy name> definition.
+  *   set_policy_defaults()    - Set default policy values as needed.
 + *   is_lspp_config()         - Is the system configured for LSPP
   */
  
  /*
-@@ -54,6 +55,9 @@
+@@ -57,6 +58,9 @@
  #  define INADDR_NONE 0xffffffff
  #endif /* !INADDR_NONE */
  
@@ -1534,7 +685,7 @@ diff -up cups-1.4.5/scheduler/conf.c.lspp cups-1.4.5/scheduler/conf.c
  
  /*
   * Configuration variable structure...
-@@ -172,6 +176,10 @@ static const cupsd_var_t  variables[] =
+@@ -164,6 +168,10 @@ static const cupsd_var_t  variables[] =
  #  if defined(HAVE_LIBSSL) || defined(HAVE_GNUTLS)
    { "ServerKey",              &ServerKey,             CUPSD_VARTYPE_PATHNAME },
  #  endif /* HAVE_LIBSSL || HAVE_GNUTLS */
@@ -1545,7 +696,7 @@ diff -up cups-1.4.5/scheduler/conf.c.lspp cups-1.4.5/scheduler/conf.c
  #endif /* HAVE_SSL */
    { "ServerName",             &ServerName,            CUPSD_VARTYPE_STRING },
    { "ServerRoot",             &ServerRoot,            CUPSD_VARTYPE_PATHNAME },
-@@ -430,6 +438,9 @@ cupsdReadConfiguration(void)
+@@ -537,6 +545,9 @@ cupsdReadConfiguration(void)
    const char  *tmpdir;                /* TMPDIR environment variable */
    struct stat tmpinfo;                /* Temporary directory info */
    cupsd_policy_t *p;                  /* Policy */
@@ -1555,7 +706,7 @@ diff -up cups-1.4.5/scheduler/conf.c.lspp cups-1.4.5/scheduler/conf.c
  
  
   /*
-@@ -713,6 +724,25 @@ cupsdReadConfiguration(void)
+@@ -801,6 +812,25 @@ cupsdReadConfiguration(void)
  
    RunUser = getuid();
  
@@ -1581,12 +732,7 @@ diff -up cups-1.4.5/scheduler/conf.c.lspp cups-1.4.5/scheduler/conf.c
    cupsdLogMessage(CUPSD_LOG_INFO, "Remote access is %s.",
                    RemotePort ? "enabled" : "disabled");
  
-@@ -1081,11 +1111,23 @@ cupsdReadConfiguration(void)
-   * Update classification setting as needed...
-   */
--  if (Classification && !strcasecmp(Classification, "none"))
-+  if (Classification && strcasecmp(Classification, "none") == 0)
+@@ -1185,7 +1215,19 @@ cupsdReadConfiguration(void)
      cupsdClearString(&Classification);
  
    if (Classification)
@@ -1606,7 +752,7 @@ diff -up cups-1.4.5/scheduler/conf.c.lspp cups-1.4.5/scheduler/conf.c
  
   /*
    * Check the MaxClients setting, and then allocate memory for it...
-@@ -3657,6 +3699,18 @@ read_location(cups_file_t *fp,          /* I - C
+@@ -3423,6 +3465,18 @@ read_location(cups_file_t *fp,          /* I - C
    return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
  }
  
@@ -1614,9 +760,9 @@ diff -up cups-1.4.5/scheduler/conf.c.lspp cups-1.4.5/scheduler/conf.c
 +int is_lspp_config()
 +{
 +  if (Classification != NULL)
-+    return ((strcasecmp(Classification, MLS_CONFIG) == 0) 
-+            || (strcasecmp(Classification, TE_CONFIG) == 0)
-+            || (strcasecmp(Classification, SELINUX_CONFIG) == 0));
++    return ((_cups_strcasecmp(Classification, MLS_CONFIG) == 0) 
++            || (_cups_strcasecmp(Classification, TE_CONFIG) == 0)
++            || (_cups_strcasecmp(Classification, SELINUX_CONFIG) == 0));
 +  else
 +    return 0;
 +}
@@ -1625,44 +771,79 @@ diff -up cups-1.4.5/scheduler/conf.c.lspp cups-1.4.5/scheduler/conf.c
  
  /*
   * 'read_policy()' - Read a <Policy name> definition.
-diff -up cups-1.4.5/scheduler/conf.h.lspp cups-1.4.5/scheduler/conf.h
---- cups-1.4.5/scheduler/conf.h.lspp   2010-12-24 13:21:30.897865572 +0000
-+++ cups-1.4.5/scheduler/conf.h        2010-12-24 13:21:31.202857632 +0000
-@@ -250,6 +250,12 @@ VAR char          *ServerKey              VALUE(NULL);
- VAR int                       SSLOptions              VALUE(CUPSD_SSL_NONE);
+diff -up cups-1.6b1/scheduler/conf.h.lspp cups-1.6b1/scheduler/conf.h
+--- cups-1.6b1/scheduler/conf.h.lspp   2012-05-25 17:01:32.000000000 +0200
++++ cups-1.6b1/scheduler/conf.h        2012-05-25 17:16:20.522580884 +0200
+@@ -247,6 +247,13 @@ VAR int                   SSLOptions              VALUE(CUPSD_SSL_NO
                                        /* SSL/TLS options */
  #endif /* HAVE_SSL */
 +#ifdef WITH_LSPP
 +VAR int                       AuditLog                VALUE(-1),
 +                                      /* File descriptor for audit */
 +                      PerPageLabels           VALUE(TRUE);
 +                                      /* Put the label on each page */
 +#endif /* WITH_LSPP */
++
  #ifdef HAVE_LAUNCHD
- VAR int                       LaunchdTimeout          VALUE(DEFAULT_KEEPALIVE);
-@@ -266,6 +272,9 @@ VAR char           *SystemGroupAuthKey     VALUE(NULL
-                                       /* System group auth key */
- #endif /* HAVE_AUTHORIZATION_H */
+ VAR int                       LaunchdTimeout          VALUE(10);
+                                       /* Time after which an idle cupsd will exit */
+@@ -265,6 +272,9 @@ int                        HaveServerCreds         VALUE(0);
+ gss_cred_id_t         ServerCreds;    /* Server's GSS credentials */
+ #endif /* HAVE_GSSAPI */
  
 +#ifdef WITH_LSPP
-+extern int    is_lspp_config(void);
++extern int            is_lspp_config(void);
 +#endif /* WITH_LSPP */
  
  /*
   * Prototypes...
-diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
---- cups-1.4.5/scheduler/ipp.c.lspp    2010-12-24 13:21:31.114859924 +0000
-+++ cups-1.4.5/scheduler/ipp.c 2010-12-24 13:21:31.217857242 +0000
-@@ -41,6 +41,7 @@
-  *   cancel_all_jobs()           - Cancel all print jobs.
+diff -up cups-1.6b1/scheduler/cupsd.h.lspp cups-1.6b1/scheduler/cupsd.h
+--- cups-1.6b1/scheduler/cupsd.h.lspp  2012-05-21 19:40:22.000000000 +0200
++++ cups-1.6b1/scheduler/cupsd.h       2012-05-25 17:01:32.861768432 +0200
+@@ -13,6 +13,8 @@
+  *   file is missing or damaged, see the license at "http://www.cups.org/".
+  */
++/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
++/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
+ /*
+  * Include necessary headers.
+@@ -37,13 +39,20 @@
+ #  include <unistd.h>
+ #endif /* WIN32 */
++#include "config.h"
++#ifdef WITH_LSPP
++#  define MLS_CONFIG "mls"
++#  define TE_CONFIG "te"
++#  define SELINUX_CONFIG "SELinux"
++#  define UNKNOWN_SL "UNKNOWN SL"
++#endif /* WITH_LSPP */
++
+ #include "mime.h"
+ #if defined(HAVE_CDSASSL)
+ #  include <CoreFoundation/CoreFoundation.h>
+ #endif /* HAVE_CDSASSL */
+-
+ /*
+  * Some OS's don't have hstrerror(), most notably Solaris...
+  */
+diff -up cups-1.6b1/scheduler/ipp.c.lspp cups-1.6b1/scheduler/ipp.c
+--- cups-1.6b1/scheduler/ipp.c.lspp    2012-05-25 17:01:32.810768787 +0200
++++ cups-1.6b1/scheduler/ipp.c 2012-05-25 17:18:06.620841313 +0200
+@@ -35,6 +35,7 @@
+  *   cancel_all_jobs()           - Cancel all or selected print jobs.
   *   cancel_job()                - Cancel a print job.
   *   cancel_subscription()       - Cancel a subscription.
 + *   check_context()             - Check the SELinux context for a user and job
-  *   check_quotas()              - Check quotas for a printer and user.
   *   check_rss_recipient()       - Check that we do not have a duplicate RSS
   *                                 feed URI.
-@@ -102,6 +103,9 @@
+  *   check_quotas()              - Check quotas for a printer and user.
+@@ -99,6 +100,9 @@
   *   validate_user()             - Validate the user for the request.
   */
  
@@ -1672,7 +853,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
  /*
   * Include necessary headers...
   */
-@@ -124,6 +128,14 @@ extern int mbr_check_membership_by_id(uu
+@@ -122,6 +126,14 @@ extern int mbr_check_membership_by_id(uu
  #  endif /* HAVE_MEMBERSHIPPRIV_H */
  #endif /* __APPLE__ */
  
@@ -1687,7 +868,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
  
  /*
   * Local functions...
-@@ -157,6 +169,9 @@ static void        cancel_all_jobs(cupsd_client
+@@ -146,6 +158,9 @@ static void        cancel_all_jobs(cupsd_client
  static void   cancel_job(cupsd_client_t *con, ipp_attribute_t *uri);
  static void   cancel_subscription(cupsd_client_t *con, int id);
  static int    check_rss_recipient(const char *recipient);
@@ -1695,9 +876,9 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
 +static int    check_context(cupsd_client_t *con, cupsd_job_t *job);
 +#endif /* WITH_LSPP */
  static int    check_quotas(cupsd_client_t *con, cupsd_printer_t *p);
- static ipp_attribute_t        *copy_attribute(ipp_t *to, ipp_attribute_t *attr,
-                                       int quickcopy);
-@@ -1354,6 +1369,21 @@ add_job(cupsd_client_t  *con,           /* I - Cl
+ static void   close_job(cupsd_client_t *con, ipp_attribute_t *uri);
+ static void   copy_attrs(ipp_t *to, ipp_t *from, cups_array_t *ra,
+@@ -1285,6 +1300,21 @@ add_job(cupsd_client_t  *con,           /* I - Cl
    ipp_attribute_t *media_col,         /* media-col attribute */
                *media_margin;          /* media-*-margin attribute */
    ipp_t               *unsup_col;             /* media-col in unsupported response */
@@ -1719,7 +900,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
  
  
    cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job(%p[%d], %p(%s), %p(%s/%s))",
-@@ -1612,6 +1642,106 @@ add_job(cupsd_client_t  *con,          /* I - Cl
+@@ -1542,6 +1572,106 @@ add_job(cupsd_client_t  *con,          /* I - Cl
      ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL,
                   "Untitled");
  
@@ -1826,7 +1007,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
    if ((job = cupsdAddJob(priority, printer->name)) == NULL)
    {
      send_ipp_status(con, IPP_INTERNAL_ERROR,
-@@ -1620,6 +1750,32 @@ add_job(cupsd_client_t  *con,           /* I - Cl
+@@ -1550,6 +1680,32 @@ add_job(cupsd_client_t  *con,           /* I - Cl
      return (NULL);
    }
  
@@ -1856,10 +1037,10 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
 +  }
 +#endif /* WITH_LSPP */
 +
-   job->dtype   = printer->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT |
-                                   CUPS_PRINTER_REMOTE);
+   job->dtype   = printer->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE);
    job->attrs   = con->request;
-@@ -1825,6 +1981,29 @@ add_job(cupsd_client_t  *con,           /* I - Cl
+   job->dirty   = 1;
+@@ -1759,6 +1915,29 @@ add_job(cupsd_client_t  *con,           /* I - Cl
        attr->values[0].string.text = _cupsStrRetain(printer->job_sheets[0]);
        attr->values[1].string.text = _cupsStrRetain(printer->job_sheets[1]);
      }
@@ -1889,7 +1070,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
  
      job->job_sheets = attr;
  
-@@ -1855,6 +2034,9 @@ add_job(cupsd_client_t  *con,            /* I - Cl
+@@ -1789,6 +1968,9 @@ add_job(cupsd_client_t  *con,            /* I - Cl
                                             "job-sheets=\"%s,none\", "
                                             "job-originating-user-name=\"%s\"",
                      Classification, job->username);
@@ -1899,7 +1080,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
        }
        else if (attr->num_values == 2 &&
                 strcmp(attr->values[0].string.text,
-@@ -1873,6 +2055,9 @@ add_job(cupsd_client_t  *con,            /* I - Cl
+@@ -1807,6 +1989,9 @@ add_job(cupsd_client_t  *con,            /* I - Cl
                                             "job-originating-user-name=\"%s\"",
                      attr->values[0].string.text,
                      attr->values[1].string.text, job->username);
@@ -1909,7 +1090,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
        }
        else if (strcmp(attr->values[0].string.text, Classification) &&
                 strcmp(attr->values[0].string.text, "none") &&
-@@ -1893,6 +2078,9 @@ add_job(cupsd_client_t  *con,            /* I - Cl
+@@ -1827,6 +2012,9 @@ add_job(cupsd_client_t  *con,            /* I - Cl
                        "job-originating-user-name=\"%s\"",
                        attr->values[0].string.text,
                        attr->values[1].string.text, job->username);
@@ -1919,7 +1100,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
          }
        }
        else if (strcmp(attr->values[0].string.text, Classification) &&
-@@ -1933,8 +2121,52 @@ add_job(cupsd_client_t  *con,           /* I - Cl
+@@ -1867,8 +2055,52 @@ add_job(cupsd_client_t  *con,           /* I - Cl
                      "job-sheets=\"%s\", "
                      "job-originating-user-name=\"%s\"",
                      Classification, job->username);
@@ -1972,7 +1153,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
  
     /*
      * See if we need to add the starting sheet...
-@@ -4289,6 +4521,107 @@ check_rss_recipient(
+@@ -3615,6 +3847,111 @@ check_rss_recipient(
  }
  
  
@@ -2031,7 +1212,11 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
 +    cupsdLogMessage(CUPSD_LOG_ERROR, "check_context: unable to convert %s to SELinux sid", con->scon);
 +    return -1;
 +  }
-+  avc_context_to_sid(job->scon, &jobsid);
++  if (avc_context_to_sid(job->scon, &jobsid) != 0)
++  {
++    cupsdLogMessage(CUPSD_LOG_ERROR, "check_context: unable to convert %s to SELinux sid", job->scon);
++    return -1;
++  }
 +  avc_entry_ref_init(&avcref);
 +  tclass = SECCLASS_FILE;
 +  avr = FILE__READ;
@@ -2080,7 +1265,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
  /*
   * 'check_quotas()' - Check quotas for a printer and user.
   */
-@@ -4843,6 +5176,15 @@ copy_banner(cupsd_client_t *con,        /* I - 
+@@ -4067,6 +4404,15 @@ copy_banner(cupsd_client_t *con,        /* I -
    char                attrname[255],          /* Name of attribute */
                *s;                     /* Pointer into name */
    ipp_attribute_t *attr;              /* Attribute */
@@ -2096,7 +1281,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
  
  
    cupsdLogMessage(CUPSD_LOG_DEBUG2,
-@@ -4878,6 +5220,82 @@ copy_banner(cupsd_client_t *con,        /* I - 
+@@ -4102,6 +4448,82 @@ copy_banner(cupsd_client_t *con,        /* I -
  
    fchmod(cupsFileNumber(out), 0640);
    fchown(cupsFileNumber(out), RunUser, Group);
@@ -2179,7 +1364,7 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
  
   /*
    * Try the localized banner file under the subdirectory...
-@@ -4972,6 +5390,24 @@ copy_banner(cupsd_client_t *con,        /* I - 
+@@ -4196,6 +4618,24 @@ copy_banner(cupsd_client_t *con,        /* I -
        else
          s = attrname;
  
@@ -2189,9 +1374,9 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
 +        if (job->scon != NULL && strncmp(job->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) != 0)
 +        {
 +          jobcon = context_new(job->scon);
-+          if (strcasecmp(name, MLS_CONFIG) == 0)
++          if (_cups_strcasecmp(name, MLS_CONFIG) == 0)
 +            mls_label = context_range_get(jobcon);
-+          else if (strcasecmp(name, TE_CONFIG) == 0)
++          else if (_cups_strcasecmp(name, TE_CONFIG) == 0)
 +            mls_label = context_type_get(jobcon);
 +          else // default to using the whole context string
 +            mls_label = context_str(jobcon);
@@ -2204,9 +1389,9 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
        if (!strcmp(s, "printer-name"))
        {
          cupsFilePuts(out, job->dest);
-@@ -6945,6 +7381,22 @@ get_job_attrs(cupsd_client_t  *con,     /* I
-     return;
-   }
+@@ -6273,6 +6713,22 @@ get_job_attrs(cupsd_client_t  *con,     /* I
+   exclude = cupsdGetPrivateAttrs(policy, con, printer, job->username);
  
 +
 +#ifdef WITH_LSPP
@@ -2227,19 +1412,19 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
   /*
    * Copy attributes...
    */
-@@ -7175,6 +7627,11 @@ get_jobs(cupsd_client_t  *con,          /* I - C
-     if (username[0] && strcasecmp(username, job->username))
-       continue;
+@@ -6626,6 +7082,11 @@ get_jobs(cupsd_client_t  *con,          /* I - C
+       if (username[0] && _cups_strcasecmp(username, job->username))
+       continue;
  
 +#ifdef WITH_LSPP
-+    if (is_lspp_config() && check_context(con, job) != 1)
-+      continue;
++      if (is_lspp_config() && check_context(con, job) != 1)
++      continue;
 +#endif /* WITH_LSPP */
 +
-     if (count > 0)
-       ippAddSeparator(con->response);
+       if (count > 0)
+       ippAddSeparator(con->response);
  
-@@ -11594,6 +12051,11 @@ validate_user(cupsd_job_t    *job,    /* I 
+@@ -11106,6 +11567,11 @@ validate_user(cupsd_job_t    *job,    /* I
  
    strlcpy(username, get_username(con), userlen);
  
@@ -2251,11 +1436,11 @@ diff -up cups-1.4.5/scheduler/ipp.c.lspp cups-1.4.5/scheduler/ipp.c
   /*
    * Check the username against the owner...
    */
-diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
---- cups-1.4.5/scheduler/job.c.lspp    2010-12-24 13:21:31.028862162 +0000
-+++ cups-1.4.5/scheduler/job.c 2010-12-24 13:21:31.224857060 +0000
-@@ -66,6 +66,9 @@
-  *   update_job_attrs()         - Update the job-printer-* attributes.
+diff -up cups-1.6b1/scheduler/job.c.lspp cups-1.6b1/scheduler/job.c
+--- cups-1.6b1/scheduler/job.c.lspp    2012-05-25 17:01:32.824768691 +0200
++++ cups-1.6b1/scheduler/job.c 2012-05-25 17:22:50.856860012 +0200
+@@ -68,6 +68,9 @@
+  *   update_job_attrs()       - Update the job-printer-* attributes.
   */
  
 +/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
@@ -2264,9 +1449,9 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
  /*
   * Include necessary headers...
   */
-@@ -75,6 +78,14 @@
- #include <cups/backend.h>
- #include <cups/dir.h>
+@@ -83,6 +86,14 @@
+ #  endif /* HAVE_IOKIT_PWR_MGT_IOPMLIBPRIVATE_H */
+ #endif /* __APPLE__ */
  
 +#ifdef WITH_LSPP
 +#include <libaudit.h>
@@ -2279,8 +1464,8 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
  
  /*
   * Design Notes for Job Management
-@@ -505,6 +516,14 @@ cupsdContinueJob(cupsd_job_t *job)        /* I 
-                                       /* PRINTER env variable */
+@@ -580,6 +591,14 @@ cupsdContinueJob(cupsd_job_t *job)        /* I
+                                       /* PRINTER_STATE_REASONS env var */
                        rip_max_cache[255];
                                        /* RIP_MAX_CACHE env variable */
 +#ifdef WITH_LSPP
@@ -2294,7 +1479,7 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
  
  
    cupsdLogMessage(CUPSD_LOG_DEBUG2,
-@@ -929,6 +948,67 @@ cupsdContinueJob(cupsd_job_t *job)        /* I 
+@@ -1071,6 +1090,67 @@ cupsdContinueJob(cupsd_job_t *job)      /* I
      }
    }
  
@@ -2325,11 +1510,11 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
 +      else
 +        label_template = strdup(attr->values[0].string.text);
 +
-+      if (strcasecmp(label_template, MLS_CONFIG) == 0)
++      if (_cups_strcasecmp(label_template, MLS_CONFIG) == 0)
 +        mls_label = context_range_get(jobcon);
-+      else if (strcasecmp(label_template, TE_CONFIG) == 0)
++      else if (_cups_strcasecmp(label_template, TE_CONFIG) == 0)
 +        mls_label = context_type_get(jobcon);
-+      else if (strcasecmp(label_template, SELINUX_CONFIG) == 0)
++      else if (_cups_strcasecmp(label_template, SELINUX_CONFIG) == 0)
 +        mls_label = context_str(jobcon);
 +      else
 +        mls_label = label_template;
@@ -2362,33 +1547,8 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
    if (Classification && !banner_page)
    {
      if ((attr = ippFindAttribute(job->attrs, "job-sheets",
-@@ -1165,13 +1245,13 @@ cupsdContinueJob(cupsd_job_t *job)     /* I 
-       if (access(command, F_OK))
-       {
-         snprintf(command, sizeof(command), "%s/backend/%s", ServerBin_compat,
--                 method);
-+                 scheme);
-         if (!access(command, F_OK))
-           {
-             /* Not in the correct directory, but we found it in the compat
-              * directory.  Issue a warning. */
-             cupsdLogMessage(CUPSD_LOG_INFO,
--                            "Backend '%s' not in %s/backend!", method,
-+                            "Backend '%s' not in %s/backend!", scheme,
-                             ServerBin);
-           }
-         else
-@@ -1179,7 +1259,7 @@ cupsdContinueJob(cupsd_job_t *job)       /* I 
-             /* Not in the compat directory either; make any error
-                messages use the correct directory name then. */
-             snprintf(command, sizeof(command), "%s/backend/%s", ServerBin,
--                     method);
-+                     scheme);
-           }
-       }
- #endif /* __x86_64__ */
-@@ -1626,6 +1706,20 @@ cupsdLoadJob(cupsd_job_t *job)          /* I - J
-     goto error;
+@@ -1845,6 +1925,20 @@ cupsdLoadJob(cupsd_job_t *job)          /* I - J
+       ippSetString(job->attrs, &job->reasons, 0, "none");
    }
  
 +#ifdef WITH_LSPP
@@ -2408,7 +1568,7 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
    job->sheets     = ippFindAttribute(job->attrs, "job-media-sheets-completed",
                                       IPP_TAG_INTEGER);
    job->job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME);
-@@ -2013,6 +2107,14 @@ cupsdSaveJob(cupsd_job_t *job)          /* I - J
+@@ -2235,6 +2329,14 @@ cupsdSaveJob(cupsd_job_t *job)          /* I - J
  {
    char                filename[1024];         /* Job control filename */
    cups_file_t *fp;                    /* Job file */
@@ -2423,8 +1583,8 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
  
  
    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSaveJob(job=%p(%d)): job->attrs=%p",
-@@ -2031,6 +2133,76 @@ cupsdSaveJob(cupsd_job_t *job)          /* I - J
-   fchmod(cupsFileNumber(fp), 0600);
+@@ -2247,6 +2349,76 @@ cupsdSaveJob(cupsd_job_t *job)          /* I - J
    fchown(cupsFileNumber(fp), RunUser, Group);
  
 +#ifdef WITH_LSPP
@@ -2500,7 +1660,7 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
    job->attrs->state = IPP_IDLE;
  
    if (ippWriteIO(fp, (ipp_iocb_t)cupsFileWrite, 1, NULL,
-@@ -3332,6 +3504,18 @@ get_options(cupsd_job_t *job,           /* I - Jo
+@@ -3735,6 +3907,18 @@ get_options(cupsd_job_t *job,           /* I - Jo
          banner_page)
          continue;
  
@@ -2519,7 +1679,7 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
       /*
        * Otherwise add them to the list...
        */
-@@ -4020,6 +4204,19 @@ static void
+@@ -4457,6 +4641,19 @@ static void
  start_job(cupsd_job_t     *job,               /* I - Job ID */
            cupsd_printer_t *printer)   /* I - Printer to print job */
  {
@@ -2539,7 +1699,7 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
    cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job(job=%p(%d), printer=%p(%s))",
                    job, job->id, printer, printer->name);
  
-@@ -4142,6 +4339,108 @@ start_job(cupsd_job_t     *job,                /* I - 
+@@ -4599,6 +4796,108 @@ start_job(cupsd_job_t     *job,                /* I -
    fcntl(job->side_pipes[1], F_SETFD,
        fcntl(job->side_pipes[1], F_GETFD) | FD_CLOEXEC);
  
@@ -2648,9 +1808,9 @@ diff -up cups-1.4.5/scheduler/job.c.lspp cups-1.4.5/scheduler/job.c
   /*
    * Now start the first file in the job...
    */
-diff -up cups-1.4.5/scheduler/job.h.lspp cups-1.4.5/scheduler/job.h
---- cups-1.4.5/scheduler/job.h.lspp    2009-05-11 23:46:01.000000000 +0100
-+++ cups-1.4.5/scheduler/job.h 2010-12-24 13:21:31.225857034 +0000
+diff -up cups-1.6b1/scheduler/job.h.lspp cups-1.6b1/scheduler/job.h
+--- cups-1.6b1/scheduler/job.h.lspp    2012-05-23 03:36:50.000000000 +0200
++++ cups-1.6b1/scheduler/job.h 2012-05-25 17:23:41.802504888 +0200
 @@ -13,6 +13,13 @@
   *   file is missing or damaged, see the license at "http://www.cups.org/".
   */
@@ -2665,10 +1825,10 @@ diff -up cups-1.4.5/scheduler/job.h.lspp cups-1.4.5/scheduler/job.h
  /*
   * Constants...
   */
-@@ -83,6 +90,10 @@ struct cupsd_job_s                  /**** Job request *
-   krb5_ccache         ccache;         /* Kerberos credential cache */
-   char                        *ccname;        /* KRB5CCNAME environment variable */
#endif /* HAVE_GSSAPI */
+@@ -82,6 +89,10 @@ struct cupsd_job_s                  /**** Job request *
+   int                 progress;       /* Printing progress */
+   int                 num_keywords;   /* Number of PPD keywords */
  cups_option_t               *keywords;      /* PPD keywords */
 +#ifdef WITH_LSPP
 +  security_context_t  scon;           /* Security context of job */
 +  uid_t                       auid;           /* Audit loginuid for this job */
@@ -2676,10 +1836,10 @@ diff -up cups-1.4.5/scheduler/job.h.lspp cups-1.4.5/scheduler/job.h
  };
  
  typedef struct cupsd_joblog_s         /**** Job log message ****/
-diff -up cups-1.4.5/scheduler/main.c.lspp cups-1.4.5/scheduler/main.c
---- cups-1.4.5/scheduler/main.c.lspp   2010-12-24 13:21:31.158858778 +0000
-+++ cups-1.4.5/scheduler/main.c        2010-12-24 13:22:10.827825881 +0000
-@@ -37,6 +37,8 @@
+diff -up cups-1.6b1/scheduler/main.c.lspp cups-1.6b1/scheduler/main.c
+--- cups-1.6b1/scheduler/main.c.lspp   2012-05-25 17:01:32.849768516 +0200
++++ cups-1.6b1/scheduler/main.c        2012-05-25 17:01:32.868768383 +0200
+@@ -38,6 +38,8 @@
   *   usage()               - Show scheduler usage.
   */
  
@@ -2688,9 +1848,9 @@ diff -up cups-1.4.5/scheduler/main.c.lspp cups-1.4.5/scheduler/main.c
  /*
   * Include necessary headers...
   */
-@@ -76,6 +78,9 @@
- #  include <dlfcn.h>
- #endif /* __APPLE__ && HAVE_DLFCN_H */
+@@ -75,6 +77,9 @@
+ #  include <notify.h>
+ #endif /* HAVE_NOTIFY_H */
  
 +#ifdef WITH_LSPP
 +#  include <libaudit.h>
@@ -2698,7 +1858,7 @@ diff -up cups-1.4.5/scheduler/main.c.lspp cups-1.4.5/scheduler/main.c
  
  /*
   * Local functions...
-@@ -145,6 +150,9 @@ main(int  argc,                            /* I - Number of comm
+@@ -138,6 +143,9 @@ main(int  argc,                            /* I - Number of comm
  #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
    struct sigaction    action;         /* Actions for POSIX signals */
  #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
@@ -2708,7 +1868,7 @@ diff -up cups-1.4.5/scheduler/main.c.lspp cups-1.4.5/scheduler/main.c
  #ifdef __sgi
    cups_file_t         *fp;            /* Fake lpsched lock file */
    struct stat         statbuf;        /* Needed for checking lpsched FIFO */
-@@ -474,6 +482,25 @@ main(int  argc,                           /* I - Number of comm
+@@ -463,6 +471,25 @@ main(int  argc,                           /* I - Number of comm
  #endif /* DEBUG */
    }
  
@@ -2734,7 +1894,7 @@ diff -up cups-1.4.5/scheduler/main.c.lspp cups-1.4.5/scheduler/main.c
   /*
    * Set the timezone info...
    */
-@@ -1241,6 +1268,11 @@ main(int  argc,                         /* I - Number of comm
+@@ -1180,6 +1207,11 @@ main(int  argc,                         /* I - Number of comm
  
    cupsdStopSelect();
  
@@ -2746,10 +1906,10 @@ diff -up cups-1.4.5/scheduler/main.c.lspp cups-1.4.5/scheduler/main.c
    return (!stop_scheduler);
  }
  
-diff -up cups-1.4.5/scheduler/printers.c.lspp cups-1.4.5/scheduler/printers.c
---- cups-1.4.5/scheduler/printers.c.lspp       2010-12-24 13:21:31.168858518 +0000
-+++ cups-1.4.5/scheduler/printers.c    2010-12-24 13:21:31.236856747 +0000
-@@ -59,6 +59,8 @@
+diff -up cups-1.6b1/scheduler/printers.c.lspp cups-1.6b1/scheduler/printers.c
+--- cups-1.6b1/scheduler/printers.c.lspp       2012-05-25 17:01:32.786768955 +0200
++++ cups-1.6b1/scheduler/printers.c    2012-05-25 17:24:11.144300359 +0200
+@@ -56,6 +56,8 @@
   *   write_xml_string()         - Write a string with XML escaping.
   */
  
@@ -2758,9 +1918,9 @@ diff -up cups-1.4.5/scheduler/printers.c.lspp cups-1.4.5/scheduler/printers.c
  /*
   * Include necessary headers...
   */
-@@ -103,6 +105,10 @@ static void       write_irix_state(cupsd_print
- #endif /* __sgi */
- static void   write_xml_string(cups_file_t *fp, const char *s);
+@@ -80,6 +82,10 @@
+ #  include <asl.h>
+ #endif /* __APPLE__ */
  
 +#ifdef WITH_LSPP
 +#  include <libaudit.h>
@@ -2768,8 +1928,8 @@ diff -up cups-1.4.5/scheduler/printers.c.lspp cups-1.4.5/scheduler/printers.c
 +#endif /* WITH_LSPP */
  
  /*
-  * 'cupsdAddPrinter()' - Add a printer to the system.
-@@ -2267,6 +2273,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
+  * Local functions...
+@@ -2101,6 +2107,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
                  "username",
                  "password"
                };
@@ -2783,7 +1943,7 @@ diff -up cups-1.4.5/scheduler/printers.c.lspp cups-1.4.5/scheduler/printers.c
  
  
    DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name,
-@@ -2397,6 +2410,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
+@@ -2234,6 +2247,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
        attr->values[1].string.text = _cupsStrAlloc(Classification ?
                                           Classification : p->job_sheets[1]);
      }
@@ -2802,7 +1962,7 @@ diff -up cups-1.4.5/scheduler/printers.c.lspp cups-1.4.5/scheduler/printers.c
 +        if (getfilecon(printerfile, &devcon) == -1)
 +        {
 +          if(is_selinux_enabled())
-+            cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdSetPrinterAttrs: Unable to get printer context");
++            cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdSetPrinterAttrs: Unable to get printer context");
 +        }
 +        else
 +        {
@@ -2829,7 +1989,7 @@ diff -up cups-1.4.5/scheduler/printers.c.lspp cups-1.4.5/scheduler/printers.c
    }
  
    p->raw    = 0;
-@@ -5536,7 +5588,6 @@ write_irix_state(cupsd_printer_t *p)     /* 
+@@ -5320,7 +5372,6 @@ write_irix_state(cupsd_printer_t *p)     /*
  }
  #endif /* __sgi */
  
diff --git a/cups/patches/cups-0755.patch b/cups/patches/cups-0755.patch
deleted file mode 100644 (file)
index 7835592..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-diff -up cups-1.4.5/Makedefs.in.0755 cups-1.4.5/Makedefs.in
---- cups-1.4.5/Makedefs.in.0755        2010-12-06 17:19:03.335315249 +0000
-+++ cups-1.4.5/Makedefs.in     2010-12-06 17:19:03.416307263 +0000
-@@ -41,13 +41,13 @@ SHELL              =       /bin/sh
- # Installation programs...
- #
--INSTALL_BIN   =       $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
-+INSTALL_BIN   =       $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@
- INSTALL_CONFIG        =       $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
- INSTALL_DATA  =       $(INSTALL) -c -m 444
- INSTALL_DIR   =       $(INSTALL) -d
--INSTALL_LIB   =       $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
-+INSTALL_LIB   =       $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@
- INSTALL_MAN   =       $(INSTALL) -c -m 444
--INSTALL_SCRIPT        =       $(INSTALL) -c -m 555
-+INSTALL_SCRIPT        =       $(INSTALL) -c -m 755
- #
- # Default user, group, and system groups for the scheduler...
-diff -up cups-1.4.5/scheduler/Makefile.0755 cups-1.4.5/scheduler/Makefile
---- cups-1.4.5/scheduler/Makefile.0755 2010-12-06 17:28:58.562552167 +0000
-+++ cups-1.4.5/scheduler/Makefile      2010-12-06 17:29:07.087756415 +0000
-@@ -174,7 +174,7 @@ install-data:
- install-exec:
-       echo Installing programs in $(SBINDIR)...
-       $(INSTALL_DIR) -m 755 $(SBINDIR)
--      $(INSTALL_BIN) -m 500 cupsd $(SBINDIR)
-+      $(INSTALL_BIN) -m 755 cupsd $(SBINDIR)
-       $(INSTALL_BIN) cupsfilter $(SBINDIR)
-       -if test "x`uname`" = xDarwin; then \
-               $(INSTALL_DIR) $(BUILDROOT)/System/Library/Printers/Libraries; \
diff --git a/cups/patches/cups-EAI_AGAIN.patch b/cups/patches/cups-EAI_AGAIN.patch
deleted file mode 100644 (file)
index 033e7f8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up cups-1.4.2/cups/http-addr.c.EAI_AGAIN cups-1.4.2/cups/http-addr.c
---- cups-1.4.2/cups/http-addr.c.EAI_AGAIN      2010-02-23 10:39:35.038261623 +0000
-+++ cups-1.4.2/cups/http-addr.c        2010-02-23 10:41:14.684385991 +0000
-@@ -253,7 +253,7 @@ httpAddrLookup(
-     if (error)
-     {
--      if (error == EAI_FAIL)
-+      if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA)
-         cg->need_res_init = 1;
-       return (httpAddrString(addr, name, namelen));
diff --git a/cups/patches/cups-autotype-crash.patch b/cups/patches/cups-autotype-crash.patch
deleted file mode 100644 (file)
index ed6cb15..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-diff -up cups-1.4.4/scheduler/ipp.c.autotype-crash cups-1.4.4/scheduler/ipp.c
---- cups-1.4.4/scheduler/ipp.c.autotype-crash  2010-10-15 15:25:15.093421917 +0100
-+++ cups-1.4.4/scheduler/ipp.c 2010-10-15 15:25:49.645296947 +0100
-@@ -10481,8 +10481,9 @@ send_document(cupsd_client_t  *con,    /* I
-     if (!filetype)
-       filetype = mimeType(MimeDatabase, super, type);
--    cupsdLogJob(job, CUPSD_LOG_DEBUG, "Request file type is %s/%s.",
--              filetype->super, filetype->type);
-+    if (filetype)
-+      cupsdLogJob(job, CUPSD_LOG_DEBUG, "Request file type is %s/%s.",
-+                filetype->super, filetype->type);
-   }
-   else
-     filetype = mimeType(MimeDatabase, super, type);
diff --git a/cups/patches/cups-avahi.patch b/cups/patches/cups-avahi.patch
deleted file mode 100644 (file)
index b1fc75c..0000000
+++ /dev/null
@@ -1,3338 +0,0 @@
-diff -up cups-1.4.5/backend/dnssd.c.avahi cups-1.4.5/backend/dnssd.c
---- cups-1.4.5/backend/dnssd.c.avahi   2010-12-24 13:11:33.760461375 +0000
-+++ cups-1.4.5/backend/dnssd.c 2010-12-24 13:11:38.325341226 +0000
-@@ -15,14 +15,21 @@
-  *
-  * Contents:
-  *
-+ *   next_txt_record()       - Get next TXT record from a cups_txt_records_t.
-+ *   parse_txt_record_pair() - Read key/value pair in cups_txt_records_t.
-  *   main()                  - Browse for printers.
-  *   browse_callback()       - Browse devices.
-  *   browse_local_callback() - Browse local devices.
-  *   compare_devices()       - Compare two devices.
-  *   exec_backend()          - Execute the backend that corresponds to the
-  *                             resolved service name.
-+ *   device_type()           - Get DNS-SD type enumeration from string.
-  *   get_device()            - Create or update a device.
-  *   query_callback()        - Process query data.
-+ *   avahi_client_callback() - Avahi client callback function.
-+ *   avahi_query_callback()  - Avahi query callback function.
-+ *   avahi_browse_callback() - Avahi browse callback function.
-+ *   find_device()           - Find a device from its name and domain.
-  *   sigterm_handler()       - Handle termination signals...
-  *   unquote()               - Unquote a name string.
-  */
-@@ -33,7 +40,18 @@
- #include "backend-private.h"
- #include <cups/array.h>
--#include <dns_sd.h>
-+#ifdef HAVE_DNSSD
-+#  include <dns_sd.h>
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+#  include <avahi-client/client.h>
-+#  include <avahi-client/lookup.h>
-+#  include <avahi-common/simple-watch.h>
-+#  include <avahi-common/domain.h>
-+#  include <avahi-common/error.h>
-+#  include <avahi-common/malloc.h>
-+#define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX
-+#endif /* HAVE_AVAHI */
- /*
-@@ -52,7 +70,12 @@ typedef enum
- typedef struct
- {
-+#ifdef HAVE_DNSSD
-   DNSServiceRef       ref;                    /* Service reference for resolve */
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+  int         resolved;               /* Did we resolve the device? */
-+#endif /* HAVE_AVAHI */
-   char                *name,                  /* Service name */
-               *domain,                /* Domain name */
-               *fullName,              /* Full name */
-@@ -64,6 +87,20 @@ typedef struct
-               sent;                   /* Did we list the device? */
- } cups_device_t;
-+typedef struct
-+{
-+  char key[256];
-+  char value[256];
-+
-+#ifdef HAVE_DNSSD
-+  const uint8_t *data;
-+  const uint8_t *datanext;
-+  const uint8_t *dataend;
-+#else /* HAVE_AVAHI */
-+  AvahiStringList *txt;
-+#endif /* HAVE_DNSSD */
-+} cups_txt_records_t;
-+
- /*
-  * Local globals...
-@@ -77,6 +114,7 @@ static int          job_canceled = 0;
-  * Local functions...
-  */
-+#ifdef HAVE_DNSSD
- static void           browse_callback(DNSServiceRef sdRef,
-                                       DNSServiceFlags flags,
-                                       uint32_t interfaceIndex,
-@@ -92,12 +130,6 @@ static void                browse_local_callback(DNSSe
-                                             const char *regtype,
-                                             const char *replyDomain,
-                                             void *context);
--static int            compare_devices(cups_device_t *a, cups_device_t *b);
--static void           exec_backend(char **argv);
--static cups_device_t  *get_device(cups_array_t *devices,
--                                  const char *serviceName,
--                                  const char *regtype,
--                                  const char *replyDomain);
- static void           query_callback(DNSServiceRef sdRef,
-                                      DNSServiceFlags flags,
-                                      uint32_t interfaceIndex,
-@@ -106,9 +138,118 @@ static void              query_callback(DNSServiceRe
-                                      uint16_t rrclass, uint16_t rdlen,
-                                      const void *rdata, uint32_t ttl,
-                                      void *context);
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+static void           avahi_client_callback (AvahiClient *client,
-+                                             AvahiClientState state,
-+                                             void *context);
-+static void           avahi_browse_callback (AvahiServiceBrowser *browser,
-+                                             AvahiIfIndex interface,
-+                                             AvahiProtocol protocol,
-+                                             AvahiBrowserEvent event,
-+                                             const char *serviceName,
-+                                             const char *regtype,
-+                                             const char *replyDomain,
-+                                             AvahiLookupResultFlags flags,
-+                                             void *context);
-+#endif /* HAVE_AVAHI */
-+
-+static cups_device_t *        find_device (cups_array_t *devices,
-+                                   cups_txt_records_t *txt,
-+                                   cups_device_t *dkey);
-+static int            compare_devices(cups_device_t *a, cups_device_t *b);
-+static void           exec_backend(char **argv);
-+static cups_device_t  *get_device(cups_array_t *devices,
-+                                  const char *serviceName,
-+                                  const char *regtype,
-+                                  const char *replyDomain);
- static void           sigterm_handler(int sig);
- static void           unquote(char *dst, const char *src, size_t dstsize);
-+#ifdef HAVE_AVAHI
-+static AvahiSimplePoll *simple_poll = NULL;
-+static int avahi_got_callback;
-+#endif /* HAVE_AVAHI */
-+
-+
-+/*
-+ * 'next_txt_record()' - Get next TXT record from a cups_txt_records_t.
-+ */
-+
-+static cups_txt_records_t *
-+next_txt_record (cups_txt_records_t *txt)
-+{
-+#ifdef HAVE_DNSSD
-+  txt->data = txt->datanext;
-+#else /* HAVE_AVAHI */
-+  txt->txt = avahi_string_list_get_next (txt->txt);
-+  if (txt->txt == NULL)
-+    return NULL;
-+#endif /* HAVE_DNSSD */
-+
-+  return txt;
-+}
-+
-+
-+/*
-+ * 'parse_txt_record_pair()' - Read key/value pair in cups_txt_records_t.
-+ */
-+
-+static int
-+parse_txt_record_pair (cups_txt_records_t *txt)
-+{
-+#ifdef HAVE_DNSSD
-+  uint8_t     datalen;
-+  uint8_t     *data = txt->data;
-+  char                *ptr;
-+
-+ /*
-+  * Read a key/value pair starting with an 8-bit length.  Since the
-+  * length is 8 bits and the size of the key/value buffers is 256, we
-+  * don't need to check for overflow...
-+  */
-+
-+  datalen = *data++;
-+  if (!datalen || (data + datalen) >= txt->dataend)
-+    return NULL;
-+  txt->datanext = data + datalen;
-+
-+  for (ptr = txt->key; data < txt->datanext && *data != '='; data ++)
-+    *ptr++ = *data;
-+  *ptr = '\0';
-+
-+  if (data < txt->datanext && *data == '=')
-+  {
-+    data++;
-+
-+    if (data < datanext)
-+      memcpy (txt->value, data, txt->datanext - data);
-+    value[txt->datanext - data] = '\0';
-+  }
-+  else
-+    return 1;
-+#else /* HAVE_AVAHI */
-+  char *key, *value;
-+  size_t len;
-+  avahi_string_list_get_pair (txt->txt, &key, &value, &len);
-+  if (len > sizeof (txt->value) - 1)
-+    len = sizeof (txt->value) - 1;
-+
-+  memcpy (txt->value, value, len);
-+  txt->value[len] = '\0';
-+  len = strlen (key);
-+  if (len > sizeof (txt->key) - 1)
-+    len = sizeof (txt->key) - 1;
-+
-+  memcpy (txt->key, key, len);
-+  txt->key[len] = '\0';
-+  avahi_free (key);
-+  avahi_free (value);
-+#endif /* HAVE_AVAHI */
-+
-+  return 0;
-+}
-+
- /*
-  * 'main()' - Browse for printers.
-@@ -119,6 +260,13 @@ main(int  argc,                           /* I - Number of comm
-      char *argv[])                    /* I - Command-line arguments */
- {
-   const char  *name;                  /* Backend name */
-+  cups_array_t        *devices;               /* Device array */
-+  cups_device_t       *device;                /* Current device */
-+  char                uriName[1024];          /* Unquoted fullName for URI */
-+#ifdef HAVE_DNSSD
-+  int         fd;                     /* Main file descriptor */
-+  fd_set      input;                  /* Input set for select() */
-+  struct timeval timeout;             /* Timeout for select() */
-   DNSServiceRef       main_ref,               /* Main service reference */
-               fax_ipp_ref,            /* IPP fax service reference */
-               ipp_ref,                /* IPP service reference */
-@@ -130,12 +278,11 @@ main(int  argc,                          /* I - Number of comm
-               pdl_datastream_ref,     /* AppSocket service reference */
-               printer_ref,            /* LPD service reference */
-               riousbprint_ref;        /* Remote IO service reference */
--  int         fd;                     /* Main file descriptor */
--  fd_set      input;                  /* Input set for select() */
--  struct timeval timeout;             /* Timeout for select() */
--  cups_array_t        *devices;               /* Device array */
--  cups_device_t       *device;                /* Current device */
--  char                uriName[1024];          /* Unquoted fullName for URI */
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+  AvahiClient *client;
-+  int         error;
-+#endif /* HAVE_AVAHI */
- #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
-   struct sigaction action;            /* Actions for POSIX signals */
- #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
-@@ -194,6 +341,49 @@ main(int  argc,                           /* I - Number of comm
-   * Browse for different kinds of printers...
-   */
-+#ifdef HAVE_AVAHI
-+  if ((simple_poll = avahi_simple_poll_new ()) == NULL)
-+  {
-+    perror ("ERROR: Unable to create avahi simple poll object");
-+    return (1);
-+  }
-+
-+  client = avahi_client_new (avahi_simple_poll_get (simple_poll),
-+                           0, avahi_client_callback, NULL, &error);
-+  if (!client)
-+  {
-+    perror ("ERROR: Unable to create avahi client");
-+    return (1);
-+  }
-+
-+  avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
-+                           AVAHI_PROTO_UNSPEC,
-+                           "_fax-ipp._tcp", NULL, 0,
-+                           avahi_browse_callback, devices);
-+  avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
-+                           AVAHI_PROTO_UNSPEC,
-+                           "_ipp._tcp", NULL, 0,
-+                           avahi_browse_callback, devices);
-+  avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
-+                           AVAHI_PROTO_UNSPEC,
-+                           "_ipp-tls._tcp", NULL, 0,
-+                           avahi_browse_callback, devices);
-+  avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
-+                           AVAHI_PROTO_UNSPEC,
-+                           "_pdl-datastream._tcp",
-+                           NULL, 0,
-+                           avahi_browse_callback,
-+                           devices);
-+  avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
-+                           AVAHI_PROTO_UNSPEC,
-+                           "_printer._tcp", NULL, 0,
-+                           avahi_browse_callback, devices);
-+  avahi_service_browser_new (client, AVAHI_IF_UNSPEC,
-+                           AVAHI_PROTO_UNSPEC,
-+                           "_riousbprint._tcp", NULL, 0,
-+                           avahi_browse_callback, devices);
-+#endif /* HAVE_AVAHI */
-+#ifdef HAVE_DNSSD
-   if (DNSServiceCreateConnection(&main_ref) != kDNSServiceErr_NoError)
-   {
-     perror("ERROR: Unable to create service connection");
-@@ -245,6 +435,7 @@ main(int  argc,                            /* I - Number of comm
-   riousbprint_ref = main_ref;
-   DNSServiceBrowse(&riousbprint_ref, kDNSServiceFlagsShareConnection, 0,
-                    "_riousbprint._tcp", NULL, browse_callback, devices);
-+#endif /* HAVE_DNSSD */
-  /*
-   * Loop until we are killed...
-@@ -252,6 +443,9 @@ main(int  argc,                            /* I - Number of comm
-   while (!job_canceled)
-   {
-+    int announce = 0;
-+
-+#ifdef HAVE_DNSSD
-     FD_ZERO(&input);
-     FD_SET(fd, &input);
-@@ -271,11 +465,35 @@ main(int  argc,                          /* I - Number of comm
-     }
-     else
-     {
-+      announce = 1;
-+    }
-+#else /* HAVE_AVAHI */
-+    int r;
-+    avahi_got_callback = 0;
-+    r = avahi_simple_poll_iterate (simple_poll, 1);
-+    if (r != 0 && r != EINTR)
-+    {
-+     /*
-+      * We've been told to exit the loop.  Perhaps the connection to
-+      * avahi failed.
-+      */
-+
-+      break;
-+    }
-+
-+    if (avahi_got_callback)
-+      announce = 1;
-+#endif /* HAVE_DNSSD */
-+
-+    if (announce)
-+    {
-      /*
-       * Announce any devices we've found...
-       */
-+#ifdef HAVE_DNSSD
-       DNSServiceErrorType status;     /* DNS query status */
-+#endif /* HAVE_DNSSD */
-       cups_device_t *best;            /* Best matching device */
-       char    device_uri[1024];       /* Device URI */
-       int     count;                  /* Number of queries */
-@@ -285,6 +503,7 @@ main(int  argc,                            /* I - Number of comm
-                best = NULL, count = 0;
-            device;
-          device = (cups_device_t *)cupsArrayNext(devices))
-+#ifdef HAVE_DNSSD
-         if (!device->ref && !device->sent)
-       {
-        /*
-@@ -313,14 +532,23 @@ main(int  argc,                          /* I - Number of comm
-             count ++;
-           }
-       }
--      else if (!device->sent)
-+      else
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+      if (!device->resolved)
-+        continue;
-+        else
-+#endif /* HAVE_AVAHI */
-+      if (!device->sent)
-       {
-+#ifdef HAVE_DNSSD
-        /*
-         * Got the TXT records, now report the device...
-         */
-         DNSServiceRefDeallocate(device->ref);
-         device->ref = 0;
-+#endif /* HAVE_DNSSD */
-           if (!best)
-           best = device;
-@@ -368,6 +596,7 @@ main(int  argc,                            /* I - Number of comm
- }
-+#ifdef HAVE_DNSSD
- /*
-  * 'browse_callback()' - Browse devices.
-  */
-@@ -456,6 +685,7 @@ browse_local_callback(
-         device->fullName);
-   device->sent = 1;
- }
-+#endif /* HAVE_DNSSD */
- /*
-@@ -530,6 +760,37 @@ exec_backend(char **argv)         /* I - Comman
- /*
-+ * 'device_type()' - Get DNS-SD type enumeration from string.
-+ */
-+
-+static int
-+device_type (const char *regtype)
-+{
-+#ifdef HAVE_AVAHI
-+  if (!strcmp(regtype, "_ipp._tcp") ||
-+      !strcmp(regtype, "_ipp-tls._tcp"))
-+    return (CUPS_DEVICE_IPP);
-+  else if (!strcmp(regtype, "_fax-ipp._tcp"))
-+    return (CUPS_DEVICE_FAX_IPP);
-+  else if (!strcmp(regtype, "_printer._tcp"))
-+    return (CUPS_DEVICE_PDL_DATASTREAM);
-+#else
-+  if (!strcmp(regtype, "_ipp._tcp.") ||
-+      !strcmp(regtype, "_ipp-tls._tcp."))
-+    return (CUPS_DEVICE_IPP);
-+  else if (!strcmp(regtype, "_fax-ipp._tcp."))
-+    return (CUPS_DEVICE_FAX_IPP);
-+  else if (!strcmp(regtype, "_printer._tcp."))
-+    return (CUPS_DEVICE_PRINTER);
-+  else if (!strcmp(regtype, "_pdl-datastream._tcp."))
-+    return (CUPS_DEVICE_PDL_DATASTREAM);
-+#endif /* HAVE_AVAHI */
-+
-+  return (CUPS_DEVICE_RIOUSBPRINT);
-+}
-+
-+
-+/*
-  * 'get_device()' - Create or update a device.
-  */
-@@ -550,18 +811,7 @@ get_device(cups_array_t *devices, /* I -
-   */
-   key.name = (char *)serviceName;
--
--  if (!strcmp(regtype, "_ipp._tcp.") ||
--      !strcmp(regtype, "_ipp-tls._tcp."))
--    key.type = CUPS_DEVICE_IPP;
--  else if (!strcmp(regtype, "_fax-ipp._tcp."))
--    key.type = CUPS_DEVICE_FAX_IPP;
--  else if (!strcmp(regtype, "_printer._tcp."))
--    key.type = CUPS_DEVICE_PRINTER;
--  else if (!strcmp(regtype, "_pdl-datastream._tcp."))
--    key.type = CUPS_DEVICE_PDL_DATASTREAM;
--  else
--    key.type = CUPS_DEVICE_RIOUSBPRINT;
-+  key.type = device_type (regtype);
-   for (device = cupsArrayFind(devices, &key);
-        device;
-@@ -581,8 +831,14 @@ get_device(cups_array_t *devices, /* I -
-         free(device->domain);
-       device->domain = strdup(replyDomain);
-+#ifdef HAVE_DNSSD
-       DNSServiceConstructFullName(fullName, device->name, regtype,
-                                   replyDomain);
-+#else /* HAVE_AVAHI */
-+      avahi_service_name_join (fullName, kDNSServiceMaxDomainName,
-+                               serviceName, regtype, replyDomain);
-+#endif /* HAVE_DNSSD */
-+
-       free(device->fullName);
-       device->fullName = strdup(fullName);
-       }
-@@ -602,6 +858,9 @@ get_device(cups_array_t *devices,  /* I -
-   device->domain   = strdup(replyDomain);
-   device->type     = key.type;
-   device->priority = 50;
-+#ifdef HAVE_AVAHI
-+  device->resolved = 0;
-+#endif /* HAVE_AVAHI */
-   cupsArrayAdd(devices, device);
-@@ -609,13 +868,20 @@ get_device(cups_array_t *devices,        /* I -
-   * Set the "full name" of this service, which is used for queries...
-   */
-+#ifdef HAVE_DNSSD
-   DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain);
-+#else /* HAVE_AVAHI */
-+  avahi_service_name_join (fullName, kDNSServiceMaxDomainName,
-+                         serviceName, regtype, replyDomain);
-+#endif /* HAVE_DNSSD */
-+
-   device->fullName = strdup(fullName);
-   return (device);
- }
-+#ifdef HAVE_DNSSD
- /*
-  * 'query_callback()' - Process query data.
-  */
-@@ -639,7 +905,7 @@ query_callback(
-               *ptr;                   /* Pointer into string */
-   cups_device_t       dkey,                   /* Search key */
-               *device;                /* Device */
--
-+  cups_txt_records_t txt;
-   fprintf(stderr, "DEBUG2: query_callback(sdRef=%p, flags=%x, "
-                   "interfaceIndex=%d, errorCode=%d, fullName=\"%s\", "
-@@ -673,84 +939,232 @@ query_callback(
-   if ((ptr = strstr(name, "._")) != NULL)
-     *ptr = '\0';
--  if (strstr(fullName, "_ipp._tcp.") ||
--      strstr(fullName, "_ipp-tls._tcp."))
--    dkey.type = CUPS_DEVICE_IPP;
--  else if (strstr(fullName, "_fax-ipp._tcp."))
--    dkey.type = CUPS_DEVICE_FAX_IPP;
--  else if (strstr(fullName, "_printer._tcp."))
--    dkey.type = CUPS_DEVICE_PRINTER;
--  else if (strstr(fullName, "_pdl-datastream._tcp."))
--    dkey.type = CUPS_DEVICE_PDL_DATASTREAM;
-+  dkey.type = device_type (fullName);
-+
-+  txt.data = rdata;
-+  txt.dataend = rdata + rdlen;
-+  device = find_device ((cups_array_t *) context, &txt, &dkey);
-+  if (!device)
-+    fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName);
-+}
-+#endif /* HAVE_DNSSD */
-+
-+
-+#ifdef HAVE_AVAHI
-+/*
-+ * 'avahi_client_callback()' - Avahi client callback function.
-+ */
-+
-+static void
-+avahi_client_callback(AvahiClient *client,
-+                    AvahiClientState state,
-+                    void *context)
-+{
-+ /*
-+  * If the connection drops, quit.
-+  */
-+
-+  if (state == AVAHI_CLIENT_FAILURE)
-+  {
-+    fprintf (stderr, "ERROR: Avahi connection failed\n");
-+    avahi_simple_poll_quit (simple_poll);
-+  }
-+}
-+
-+
-+/*
-+ * 'avahi_query_callback()' - Avahi query callback function.
-+ */
-+
-+static void
-+avahi_query_callback(AvahiServiceResolver *resolver,
-+                   AvahiIfIndex interface,
-+                   AvahiProtocol protocol,
-+                   AvahiResolverEvent event,
-+                   const char *name,
-+                   const char *type,
-+                   const char *domain,
-+                   const char *host_name,
-+                   const AvahiAddress *address,
-+                   uint16_t port,
-+                   AvahiStringList *txt,
-+                   AvahiLookupResultFlags flags,
-+                   void *context)
-+{
-+  AvahiClient         *client;
-+  cups_device_t               key,
-+                      *device;
-+  char                        uqname[1024],
-+                      *ptr;
-+  cups_txt_records_t  txtr;
-+
-+  client = avahi_service_resolver_get_client (resolver);
-+  if (event != AVAHI_RESOLVER_FOUND)
-+  {
-+    if (event == AVAHI_RESOLVER_FAILURE)
-+    {
-+      fprintf (stderr, "ERROR: %s\n",
-+             avahi_strerror (avahi_client_errno (client)));
-+    }
-+
-+    avahi_service_resolver_free (resolver);
-+    return;
-+  }
-+
-+ /*
-+  * Set search key for device.
-+  */
-+
-+  key.name = uqname;
-+  unquote (uqname, name, sizeof (uqname));
-+  if ((ptr = strstr(name, "._")) != NULL)
-+    *ptr = '\0';
-+
-+  key.domain = (char *) domain;
-+  key.type = device_type (type);
-+
-+ /*
-+  * Find the device and the the TXT information.
-+  */
-+
-+  txtr.txt = txt;
-+  device = find_device ((cups_array_t *) context, &txtr, &key);
-+  if (device)
-+  {
-+   /*
-+    * Let the main loop know to announce the device.
-+    */
-+
-+    device->resolved = 1;
-+    avahi_got_callback = 1;
-+  }
-   else
--    dkey.type = CUPS_DEVICE_RIOUSBPRINT;
-+    fprintf (stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", name);
-+
-+  avahi_service_resolver_free (resolver);
-+}
-+
-+
-+/*
-+ * 'avahi_browse_callback()' - Avahi browse callback function.
-+ */
-+
-+static void
-+avahi_browse_callback(AvahiServiceBrowser *browser,
-+                    AvahiIfIndex interface,
-+                    AvahiProtocol protocol,
-+                    AvahiBrowserEvent event,
-+                    const char *name,
-+                    const char *type,
-+                    const char *domain,
-+                    AvahiLookupResultFlags flags,
-+                    void *context)
-+{
-+  AvahiClient *client = avahi_service_browser_get_client (browser);
--  for (device = cupsArrayFind(devices, &dkey);
-+  switch (event)
-+  {
-+  case AVAHI_BROWSER_FAILURE:
-+    fprintf (stderr, "ERROR: %s\n",
-+           avahi_strerror (avahi_client_errno (client)));
-+    avahi_simple_poll_quit (simple_poll);
-+    return;
-+
-+  case AVAHI_BROWSER_NEW:
-+   /*
-+    * This object is new on the network.
-+    */
-+
-+    if (flags & AVAHI_LOOKUP_RESULT_LOCAL)
-+    {
-+     /*
-+      * This comes from the local machine so ignore it.
-+      */
-+
-+      fprintf (stderr, "DEBUG: ignoring local service %s\n", name);
-+    }
-+    else
-+    {
-+     /*
-+      * Create a device entry for it if it doesn't yet exist.
-+      */
-+
-+      get_device ((cups_array_t *)context, name, type, domain);
-+
-+     /*
-+      * Now look for a TXT entry.
-+      */
-+
-+      if (avahi_service_resolver_new (client, interface, protocol,
-+                                    name, type, domain,
-+                                    AVAHI_PROTO_UNSPEC, 0,
-+                                    avahi_query_callback, context) == NULL)
-+      {
-+      fprintf (stderr, "ERROR: failed to resolve service %s: %s\n",
-+               name, avahi_strerror (avahi_client_errno (client)));
-+      }
-+    }
-+
-+    break;
-+
-+  case AVAHI_BROWSER_REMOVE:
-+  case AVAHI_BROWSER_ALL_FOR_NOW:
-+  case AVAHI_BROWSER_CACHE_EXHAUSTED:
-+    break;
-+  }
-+}
-+#endif /* HAVE_AVAHI */
-+
-+
-+/*
-+ * 'find_device()' - Find a device from its name and domain.
-+ */
-+
-+static cups_device_t *
-+find_device (cups_array_t *devices,
-+           cups_txt_records_t *txt,
-+           cups_device_t *dkey)
-+{
-+  cups_device_t       *device;
-+  char                *ptr;
-+
-+  for (device = cupsArrayFind(devices, dkey);
-        device;
-        device = cupsArrayNext(devices))
-   {
--    if (strcasecmp(device->name, dkey.name) ||
--        strcasecmp(device->domain, dkey.domain))
-+    if (strcasecmp(device->name, dkey->name) ||
-+        strcasecmp(device->domain, dkey->domain))
-     {
-       device = NULL;
-       break;
-     }
--    else if (device->type == dkey.type)
-+    else if (device->type == dkey->type)
-     {
-      /*
-       * Found it, pull out the priority and make and model from the TXT
-       * record and save it...
-       */
--      const uint8_t   *data,          /* Pointer into data */
--                      *datanext,      /* Next key/value pair */
--                      *dataend;       /* End of entire TXT record */
--      uint8_t         datalen;        /* Length of current key/value pair */
--      char            key[256],       /* Key string */
--                      value[256],     /* Value string */
--                      make_and_model[512],
-+      char            make_and_model[512],
-                                       /* Manufacturer and model */
-                       model[256],     /* Model */
--                      device_id[2048];/* 1284 device ID */
--
-+                      device_id[2048]; /* 1284 device ID */
-       device_id[0]      = '\0';
-       make_and_model[0] = '\0';
-       strcpy(model, "Unknown");
--      for (data = rdata, dataend = data + rdlen;
--           data < dataend;
--           data = datanext)
-+      for (;;)
-       {
--       /*
--        * Read a key/value pair starting with an 8-bit length.  Since the
--      * length is 8 bits and the size of the key/value buffers is 256, we
--      * don't need to check for overflow...
--      */
--
--        datalen = *data++;
--
--        if (!datalen || (data + datalen) >= dataend)
--        break;
-+      char *key;
-+      char *value;
--        datanext = data + datalen;
--
--        for (ptr = key; data < datanext && *data != '='; data ++)
--        *ptr++ = *data;
--      *ptr = '\0';
--
--      if (data < datanext && *data == '=')
--      {
--        data ++;
--
--        if (data < datanext)
--          memcpy(value, data, datanext - data);
--        value[datanext - data] = '\0';
--      }
--      else
--        continue;
-+      if (parse_txt_record_pair (txt))
-+        goto next;
-+      key = txt->key;
-+      value = txt->value;
-         if (!strncasecmp(key, "usb_", 4))
-       {
-        /*
-@@ -805,6 +1219,10 @@ query_callback(
-         if (device->type == CUPS_DEVICE_PRINTER)
-           device->sent = 1;
-       }
-+
-+      next:
-+      if (next_txt_record (txt) == NULL)
-+        break;
-       }
-       if (device->device_id)
-@@ -861,11 +1279,9 @@ query_callback(
-     }
-   }
--  if (!device)
--    fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName);
-+  return device;
- }
--
- /*
-  * 'sigterm_handler()' - Handle termination signals...
-  */
-diff -up cups-1.4.5/config.h.in.avahi cups-1.4.5/config.h.in
---- cups-1.4.5/config.h.in.avahi       2010-08-13 05:11:46.000000000 +0100
-+++ cups-1.4.5/config.h.in     2010-12-24 13:11:38.327341170 +0000
-@@ -344,6 +344,13 @@
- /*
-+ * Do we have Avahi for DNS Service Discovery?
-+ */
-+
-+#undef HAVE_AVAHI
-+
-+
-+/*
-  * Do we have <sys/ioctl.h>?
-  */
-diff -up cups-1.4.5/config-scripts/cups-dnssd.m4.avahi cups-1.4.5/config-scripts/cups-dnssd.m4
---- cups-1.4.5/config-scripts/cups-dnssd.m4.avahi      2009-08-28 23:54:34.000000000 +0100
-+++ cups-1.4.5/config-scripts/cups-dnssd.m4    2010-12-24 13:11:38.326341199 +0000
-@@ -27,6 +27,21 @@ AC_ARG_WITH(dnssd-includes, [  --with-dn
- DNSSDLIBS=""
- DNSSD_BACKEND=""
-+AC_ARG_ENABLE(avahi, [  --enable-avahi          turn on DNS Service Discovery support, default=no],
-+            [if test x$enable_avahi = xyes; then
-+                     AC_MSG_CHECKING(for Avahi)
-+                     if $PKGCONFIG --exists avahi-client; then
-+                             AC_MSG_RESULT(yes)
-+                             CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`"
-+                             DNSSDLIBS="`$PKGCONFIG --libs avahi-client`"
-+                             DNSSD_BACKEND="dnssd"
-+                             AC_DEFINE(HAVE_AVAHI)
-+                             enable_dnssd=no
-+                     else
-+                             AC_MSG_RESULT(no)
-+                     fi
-+             fi])
-+
- if test x$enable_dnssd != xno; then
-       AC_CHECK_HEADER(dns_sd.h, [
-               case "$uname" in
-diff -up cups-1.4.5/cups/http-support.c.avahi cups-1.4.5/cups/http-support.c
---- cups-1.4.5/cups/http-support.c.avahi       2010-10-01 23:40:38.000000000 +0100
-+++ cups-1.4.5/cups/http-support.c     2010-12-24 13:11:38.330341093 +0000
-@@ -41,6 +41,10 @@
-  *   http_copy_decode()   - Copy and decode a URI.
-  *   http_copy_encode()   - Copy and encode a URI.
-  *   resolve_callback()   - Build a device URI for the given service name.
-+ *   avahi_resolve_uri_client_cb()
-+ *                        - Avahi client callback for resolving URI.
-+ *   avahi_resolve_uri_resolver_cb()
-+ *                        - Avahi resolver callback for resolving URI.
-  */
- /*
-@@ -55,6 +59,11 @@
- #  include <dns_sd.h>
- #  include <poll.h>
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+#  include <avahi-client/client.h>
-+#  include <avahi-client/lookup.h>
-+#  include <avahi-common/simple-watch.h>
-+#endif /* HAVE_AVAHI */
- /*
-@@ -121,6 +130,24 @@ static void               resolve_callback(DNSService
-                                        void *context);
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+static void   avahi_resolve_uri_client_cb(AvahiClient *client,
-+                                          AvahiClientState state,
-+                                          void *simple_poll);
-+static void   avahi_resolve_uri_resolver_cb(AvahiServiceResolver *resolver,
-+                                            AvahiIfIndex interface,
-+                                            AvahiProtocol protocol,
-+                                            AvahiResolverEvent event,
-+                                            const char *name,
-+                                            const char *type,
-+                                            const char *domain,
-+                                            const char *host_name,
-+                                            const AvahiAddress *address,
-+                                            uint16_t port,
-+                                            AvahiStringList *txt,
-+                                            AvahiLookupResultFlags flags,
-+                                            void *context);
-+#endif /* HAVE_AVAHI */
- /*
-  * 'httpAssembleURI()' - Assemble a uniform resource identifier from its
-@@ -1351,6 +1378,9 @@ _httpResolveURI(
-   if (strstr(hostname, "._tcp"))
-   {
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+    char              *regtype,       /* Pointer to type in hostname */
-+                      *domain;        /* Pointer to domain in hostname */
- #ifdef HAVE_DNSSD
-     DNSServiceRef     ref,            /* DNS-SD master service reference */
-                       domainref,      /* DNS-SD service reference for domain */
-@@ -1361,6 +1391,16 @@ _httpResolveURI(
-                       *domain;        /* Pointer to domain in hostname */
-     _http_uribuf_t    uribuf;         /* URI buffer */
-     struct pollfd     polldata;       /* Polling data */
-+#else /* HAVE_AVAHI */
-+    AvahiSimplePoll   *simple_poll;
-+    AvahiClient               *client;
-+    int                       error;
-+    struct
-+    {
-+      AvahiSimplePoll *poll;
-+      _http_uribuf_t  uribuf;
-+    } user_data;
-+#endif /* HAVE_DNSSD */
-     if (logit)
-@@ -1398,8 +1438,13 @@ _httpResolveURI(
-     if (domain)
-       *domain++ = '\0';
-+#ifdef HAVE_DNSSD
-     uribuf.buffer  = resolved_uri;
-     uribuf.bufsize = resolved_size;
-+#else
-+    user_data.uribuf.buffer = resolved_uri;
-+    user_data.uribuf.bufsize = resolved_size;
-+#endif
-     resolved_uri[0] = '\0';
-@@ -1414,6 +1459,7 @@ _httpResolveURI(
-     uri = NULL;
-+#ifdef HAVE_DNSSD
-     if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError)
-     {
-       localref = ref;
-@@ -1500,6 +1546,36 @@ _httpResolveURI(
-       DNSServiceRefDeallocate(ref);
-     }
-+#else /* HAVE_AVAHI */
-+    if ((simple_poll = avahi_simple_poll_new ()) != NULL)
-+    {
-+      if ((client = avahi_client_new (avahi_simple_poll_get (simple_poll),
-+                                    0, avahi_resolve_uri_client_cb,
-+                                    &simple_poll, &error)) != NULL)
-+      {
-+      user_data.poll = simple_poll;
-+      if (avahi_service_resolver_new (client, AVAHI_IF_UNSPEC,
-+                                      AVAHI_PROTO_UNSPEC, hostname,
-+                                      regtype, domain, AVAHI_PROTO_UNSPEC, 0,
-+                                      avahi_resolve_uri_resolver_cb,
-+                                      &user_data) != NULL)
-+      {
-+        avahi_simple_poll_loop (simple_poll);
-+
-+       /*
-+        * Collect the result.
-+        */
-+
-+        if (resolved_uri[0])
-+          uri = resolved_uri;
-+      }
-+
-+      avahi_client_free (client);
-+      }
-+
-+      avahi_simple_poll_free (simple_poll);
-+    }
-+#endif /* HAVE_DNSSD */
-     if (logit)
-     {
-@@ -1511,13 +1587,13 @@ _httpResolveURI(
-       fputs("STATE: -connecting-to-device,offline-report\n", stderr);
-     }
--#else
-+#else /* HAVE_DNSSD || HAVE_AVAHI */
-    /*
-     * No DNS-SD support...
-     */
-     uri = NULL;
--#endif /* HAVE_DNSSD */
-+#endif /* HAVE_DNSSD || HAVE_AVAHI */
-     if (logit && !uri)
-       _cupsLangPuts(stderr, _("Unable to find printer!\n"));
-@@ -1723,6 +1799,116 @@ resolve_callback(
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+/*
-+ * 'avahi_resolve_uri_client_cb()' - Avahi client callback for resolving URI.
-+ */
-+
-+static void
-+avahi_resolve_uri_client_cb (AvahiClient *client,
-+                           AvahiClientState state,
-+                           void *simple_poll)
-+{
-+  DEBUG_printf(("avahi_resolve_uri_client_callback(client=%p, state=%d, "
-+              "simple_poll=%p)\n", client, state, simple_poll));
-+
-+  /*
-+   * If the connection drops, quit.
-+   */
-+
-+  if (state == AVAHI_CLIENT_FAILURE)
-+    avahi_simple_poll_quit (simple_poll);
-+}
-+
-+
-+/*
-+ * 'avahi_resolve_uri_resolver_cb()' - Avahi resolver callback for resolving
-+ *                                     URI.
-+ */
-+
-+static void
-+avahi_resolve_uri_resolver_cb (AvahiServiceResolver *resolver,
-+                             AvahiIfIndex interface,
-+                             AvahiProtocol protocol,
-+                             AvahiResolverEvent event,
-+                             const char *name,
-+                             const char *type,
-+                             const char *domain,
-+                             const char *host_name,
-+                             const AvahiAddress *address,
-+                             uint16_t port,
-+                             AvahiStringList *txt,
-+                             AvahiLookupResultFlags flags,
-+                             void *context)
-+{
-+  const char          *scheme;        /* URI scheme */
-+  char                        rp[256];        /* Remote printer */
-+  AvahiStringList     *pair;
-+  char                        *value;
-+  size_t              valueLen = 0;
-+  char                        addr[AVAHI_ADDRESS_STR_MAX];
-+  struct
-+  {
-+    AvahiSimplePoll   *poll;
-+    _http_uribuf_t    uribuf;
-+  }           *poll_uribuf = context;
-+
-+  DEBUG_printf(("avahi_resolve_uri_resolver_callback(resolver=%p, "
-+              "interface=%d, protocol=%d, event=%d, name=\"%s\", "
-+              "type=\"%s\", domain=\"%s\", host_name=\"%s\", address=%p, "
-+              "port=%d, txt=%p, flags=%d, context=%p)\n",
-+              resolver, interface, protocol, event, name, type, domain,
-+              host_name, address, port, txt, flags, context));
-+
-+  if (event != AVAHI_RESOLVER_FOUND)
-+  {
-+    avahi_service_resolver_free (resolver);
-+    avahi_simple_poll_quit (poll_uribuf->poll);
-+    return;
-+  }
-+
-+ /*
-+  * Figure out the scheme from the full name...
-+  */
-+
-+  if (strstr(type, "_ipp."))
-+    scheme = "ipp";
-+  else if (strstr(type, "_printer."))
-+    scheme = "lpd";
-+  else if (strstr(type, "_pdl-datastream."))
-+    scheme = "socket";
-+  else
-+    scheme = "riousbprint";
-+
-+ /*
-+  * Extract the "remote printer key from the TXT record...
-+  */
-+
-+  if ((pair = avahi_string_list_find (txt, "rp")) != NULL)
-+  {
-+    avahi_string_list_get_pair (pair, NULL, &value, &valueLen);
-+    rp[0] = '/';
-+    memcpy (rp + 1, value, valueLen);
-+    rp[valueLen + 1] = '\0';
-+  }
-+  else
-+    rp[0] = '\0';
-+
-+ /*
-+  * Assemble the final device URI...
-+  */
-+
-+  avahi_address_snprint (addr, AVAHI_ADDRESS_STR_MAX, address);
-+  httpAssembleURI(HTTP_URI_CODING_ALL, poll_uribuf->uribuf.buffer,
-+                poll_uribuf->uribuf.bufsize, scheme, NULL,
-+                addr, port, rp);
-+  DEBUG_printf(("avahi_resolve_uri_resolver_callback: Resolved URI is \"%s\"\n",
-+              poll_uribuf->uribuf.buffer));
-+  avahi_simple_poll_quit (poll_uribuf->poll);
-+}
-+#endif /* HAVE_AVAHI */
-+
-+
- /*
-  * End of "$Id: http-support.c 9322 2010-10-01 22:40:38Z mike $".
-  */
-diff -up cups-1.4.5/scheduler/avahi.c.avahi cups-1.4.5/scheduler/avahi.c
---- cups-1.4.5/scheduler/avahi.c.avahi 2010-12-24 13:11:38.333341014 +0000
-+++ cups-1.4.5/scheduler/avahi.c       2010-12-24 13:11:38.333341014 +0000
-@@ -0,0 +1,441 @@
-+/*
-+ * "$Id$"
-+ *
-+ *   Avahi poll implementation for the CUPS scheduler.
-+ *
-+ *   Copyright (C) 2010 Red Hat, Inc.
-+ *   Authors:
-+ *    Tim Waugh <twaugh@redhat.com>
-+ *
-+ *   Distribution and use rights are outlined in the file "LICENSE.txt"
-+ *   "LICENSE" which should have been included with this file.  If this
-+ *   file is missing or damaged, see the license at "http://www.cups.org/".
-+ *
-+ * Contents:
-+ *
-+ *   watch_read_cb         - Read callback for file descriptor
-+ *   watch_write_cb        - Write callback for file descriptor
-+ *   watched_fd_add_select() - Call cupsdAddSelect() as needed
-+ *   watch_new()           - Create a new file descriptor watch
-+ *   watch_free()          - Free a file descriptor watch
-+ *   watch_update()        - Update watched events for a file descriptor
-+ *   watch_get_events()    - Get events that happened for a file descriptor
-+ *   timeout_cb()          - Run a timed Avahi callback
-+ *   timeout_new()         - Set a wakeup time
-+ *   timeout_update()      - Update the expiration time for a timeout
-+ *   timeout_free()        - Free a timeout
-+ *   compare_watched_fds() - Compare watched file descriptors for array sorting
-+ *   compare_timeouts()    - Compare timeouts for array sorting
-+ *   avahi_cups_poll_new() - Create a new Avahi main loop object for CUPS
-+ *   avahi_cups_poll_free() - Free an Avahi main loop object for CUPS
-+ *   avahi_cups_poll_get() - Get the abstract poll API structure
-+ */
-+
-+#include <config.h>
-+
-+#ifdef HAVE_AVAHI /* Applies to entire file... */
-+
-+/*
-+ * Include necessary headers...
-+ */
-+
-+#include "cupsd.h"
-+
-+#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
-+#  include <malloc.h>
-+#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
-+
-+#ifdef HAVE_AVAHI
-+#  include <avahi-common/timeval.h>
-+#endif /* HAVE_AVAHI */
-+
-+
-+typedef struct
-+{
-+  AvahiCupsPoll *cups_poll;
-+
-+  int fd;
-+  AvahiWatchEvent occurred;
-+  cups_array_t *watches;
-+} cupsd_watched_fd_t;
-+
-+struct AvahiWatch
-+{
-+  cupsd_watched_fd_t *watched_fd;
-+
-+  AvahiWatchEvent events;
-+  AvahiWatchCallback callback;
-+  void *userdata;
-+};
-+
-+struct AvahiTimeout
-+{
-+  AvahiCupsPoll *cups_poll;
-+  AvahiTimeoutCallback callback;
-+  void *userdata;
-+  cupsd_timeout_t *cupsd_timeout;
-+};
-+
-+/*
-+ * Local functions...
-+ */
-+
-+static AvahiWatch *   watch_new(const AvahiPoll *api,
-+                                int fd,
-+                                AvahiWatchEvent events,
-+                                AvahiWatchCallback callback,
-+                                void *userdata);
-+static void           watch_free(AvahiWatch *watch);
-+static void           watch_update(AvahiWatch *watch,
-+                                   AvahiWatchEvent events);
-+static AvahiWatchEvent        watch_get_events(AvahiWatch *watch);
-+static int            compare_watches(AvahiWatch *p0,
-+                                      AvahiWatch *p1);
-+
-+
-+/*
-+ * 'watch_read_cb' - Read callback for file descriptor
-+ */
-+
-+static void
-+watch_read_cb (void *userdata)
-+{
-+  AvahiWatch *watch;
-+  cupsd_watched_fd_t *watched_fd = userdata;
-+  watched_fd->occurred |= AVAHI_WATCH_IN;
-+  for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
-+       watch;
-+       watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) {
-+    if (watch->events & watched_fd->occurred) {
-+      (watch->callback) (watch, watched_fd->fd,
-+                       AVAHI_WATCH_IN, watch->userdata);
-+      watched_fd->occurred &= ~AVAHI_WATCH_IN;
-+      break;
-+    }
-+  }
-+}
-+
-+
-+/*
-+ * 'watch_write_cb' - Write callback for file descriptor
-+ */
-+
-+static void
-+watch_write_cb (void *userdata)
-+{
-+  AvahiWatch *watch;
-+  cupsd_watched_fd_t *watched_fd = userdata;
-+  watched_fd->occurred |= AVAHI_WATCH_OUT;
-+  for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
-+       watch;
-+       watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) {
-+    if (watch->events & watched_fd->occurred) {
-+      (watch->callback) (watch, watched_fd->fd,
-+                       AVAHI_WATCH_OUT, watch->userdata);
-+      watched_fd->occurred &= ~AVAHI_WATCH_OUT;
-+      break;
-+    }
-+  }
-+}
-+
-+
-+/*
-+ * 'watched_fd_add_select' - Call cupsdAddSelect() as needed
-+ */
-+
-+static int                                            /* O - Watches? */
-+watched_fd_add_select (cupsd_watched_fd_t *watched_fd)
-+{
-+  AvahiWatch *watch;
-+  cupsd_selfunc_t read_cb = NULL, write_cb = NULL;
-+
-+  for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
-+       watch;
-+       watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches)) {
-+    if (watch->events & (AVAHI_WATCH_IN |
-+                           AVAHI_WATCH_ERR |
-+                           AVAHI_WATCH_HUP)) {
-+      read_cb = (cupsd_selfunc_t)watch_read_cb;
-+      if (write_cb != NULL)
-+      break;
-+    }
-+
-+    if (watch->events & AVAHI_WATCH_OUT) {
-+      write_cb = (cupsd_selfunc_t)watch_write_cb;
-+      if (read_cb != NULL)
-+      break;
-+    }
-+  }
-+
-+  if (read_cb || write_cb)
-+    cupsdAddSelect (watched_fd->fd, read_cb, write_cb, watched_fd);
-+  else
-+    cupsdRemoveSelect (watched_fd->fd);
-+
-+  return (read_cb || write_cb);
-+}
-+
-+/*
-+ * 'watch_new' - Create a new file descriptor watch
-+ */
-+
-+static AvahiWatch *
-+watch_new (const AvahiPoll *api,
-+         int fd,
-+         AvahiWatchEvent events,
-+         AvahiWatchCallback callback,
-+         void *userdata)
-+{
-+  cupsd_watched_fd_t key, *watched_fd;
-+  AvahiCupsPoll *cups_poll = api->userdata;
-+  AvahiWatch *watch = malloc(sizeof(AvahiWatch));
-+  if (watch == NULL)
-+    return (NULL);
-+
-+  watch->events = events;
-+  watch->callback = callback;
-+  watch->userdata = userdata;
-+
-+  key.fd = fd;
-+  watched_fd = cupsArrayFind (cups_poll->watched_fds, &key);
-+  if (watched_fd == NULL) {
-+    watched_fd = malloc(sizeof(cupsd_watched_fd_t));
-+    if (watched_fd == NULL)
-+      return (NULL);
-+
-+    watched_fd->fd = fd;
-+    watched_fd->occurred = 0;
-+    watched_fd->watches = cupsArrayNew ((cups_array_func_t)compare_watches,
-+                                      NULL);
-+  }
-+
-+  cupsArrayAdd(watched_fd->watches, watch);
-+  watched_fd_add_select (watched_fd);
-+  return (watch);
-+}
-+
-+
-+/*
-+ * 'watch_free' - Free a file descriptor watch
-+ */
-+
-+static void
-+watch_free (AvahiWatch *watch)
-+{
-+  cupsd_watched_fd_t *watched_fd = watch->watched_fd;
-+  AvahiCupsPoll *cups_poll = watched_fd->cups_poll;
-+
-+  cupsArrayRemove (watched_fd->watches, watch);
-+  free (watch);
-+
-+  if (!watched_fd_add_select (watched_fd)) {
-+    /* No more watches */
-+    cupsArrayRemove (cups_poll->watched_fds, watched_fd);
-+    free (watched_fd);
-+  }
-+}
-+
-+
-+/*
-+ * 'watch_update' - Update watched events for a file descriptor
-+ */
-+
-+static void
-+watch_update (AvahiWatch *watch,
-+            AvahiWatchEvent events)
-+{
-+  watch->events = events;
-+  watched_fd_add_select (watch->watched_fd);
-+}
-+
-+
-+/*
-+ * 'watch_get_events' - Get events that happened for a file descriptor
-+ */
-+
-+static AvahiWatchEvent
-+watch_get_events (AvahiWatch *watch)
-+{
-+  return (watch->watched_fd->occurred);
-+}
-+
-+
-+/*
-+ * 'compare_watches' - Compare watches for array sorting
-+ */
-+
-+static int
-+compare_watches (AvahiWatch *p0,
-+               AvahiWatch *p1)
-+{
-+  if (p0->watched_fd->fd < p1->watched_fd->fd)
-+    return (-1);
-+
-+  return ((p0->watched_fd->fd == p1->watched_fd->fd) ? 0 : 1);
-+}
-+
-+
-+/*
-+ * 'timeout_cb()' - Run a timed Avahi callback
-+ */
-+
-+static void
-+timeout_cb (cupsd_timeout_t *cupsd_timeout, void *userdata)
-+{
-+  AvahiTimeout *timeout = userdata;
-+  (timeout->callback) (timeout, timeout->userdata);
-+}
-+
-+
-+/*
-+ * 'timeout_new' - Set a wakeup time
-+ */
-+
-+static AvahiTimeout *
-+timeout_new (const AvahiPoll *api,
-+           const struct timeval *tv,
-+           AvahiTimeoutCallback callback,
-+           void *userdata)
-+{
-+  AvahiTimeout *timeout;
-+  AvahiCupsPoll *cups_poll = api->userdata;
-+
-+  timeout = malloc(sizeof(AvahiTimeout));
-+  if (timeout == NULL)
-+    return (NULL);
-+
-+  timeout->cups_poll = cups_poll;
-+  timeout->callback = callback;
-+  timeout->userdata = userdata;
-+  timeout->cupsd_timeout = cupsdAddTimeout (tv,
-+                                          (cupsd_timeoutfunc_t)timeout_cb,
-+                                          timeout);
-+  cupsArrayAdd (cups_poll->timeouts, timeout);
-+  return (timeout);
-+}
-+
-+
-+/*
-+ * 'timeout_update' - Update the expiration time for a timeout
-+ */
-+
-+static void
-+timeout_update (AvahiTimeout *timeout,
-+              const struct timeval *tv)
-+{
-+  cupsdUpdateTimeout (timeout->cupsd_timeout, tv);
-+}
-+
-+
-+/*
-+ * ' timeout_free' - Free a timeout
-+ */
-+
-+static void
-+timeout_free (AvahiTimeout *timeout)
-+{
-+  cupsArrayRemove (timeout->cups_poll->timeouts, timeout);
-+  cupsdRemoveTimeout (timeout->cupsd_timeout);
-+  free (timeout);
-+}
-+
-+
-+/*
-+ * 'compare_watched_fds' - Compare watched file descriptors for array sorting
-+ */
-+static int
-+compare_watched_fds(cupsd_watched_fd_t *p0,
-+                  cupsd_watched_fd_t *p1)
-+{
-+  if (p0->fd != p1->fd)
-+    return (p0->fd < p1->fd ? -1 : 1);
-+
-+  if (p0 == p1)
-+    return (0);
-+
-+  return (p0 < p1 ? -1 : 1);
-+}
-+
-+
-+/*
-+ * 'compare_timeouts' - Compare timeouts for array sorting
-+ */
-+static int
-+compare_timeouts(AvahiTimeout *p0,
-+               AvahiTimeout *p1)
-+{
-+ /*
-+  * Just compare pointers to make it a stable sort.
-+  */
-+
-+  if (p0->cupsd_timeout < p1->cupsd_timeout)
-+    return (-1);
-+  return ((p0->cupsd_timeout == p1->cupsd_timeout) ? 0 : 1);
-+}
-+
-+
-+/*
-+ * 'avahi_cups_poll_new' - Create a new Avahi main loop object for CUPS
-+ */
-+
-+AvahiCupsPoll *
-+avahi_cups_poll_new (void)
-+{
-+  AvahiCupsPoll *cups_poll = malloc(sizeof(AvahiCupsPoll));
-+  if (cups_poll == NULL)
-+    return (NULL);
-+
-+  cups_poll->watched_fds = cupsArrayNew ((cups_array_func_t)compare_watched_fds,
-+                                       NULL);
-+  cups_poll->timeouts = cupsArrayNew ((cups_array_func_t)compare_timeouts,
-+                                    NULL);
-+
-+  cups_poll->api.userdata = cups_poll;
-+  cups_poll->api.watch_new = watch_new;
-+  cups_poll->api.watch_free = watch_free;
-+  cups_poll->api.watch_update = watch_update;
-+  cups_poll->api.watch_get_events = watch_get_events;
-+
-+  cups_poll->api.timeout_new = timeout_new;
-+  cups_poll->api.timeout_update = timeout_update;
-+  cups_poll->api.timeout_free = timeout_free;
-+
-+  return (cups_poll);
-+}
-+
-+
-+/*
-+ * 'avahi_cups_poll_free' - Free an Avahi main loop object for CUPS
-+ */
-+void
-+avahi_cups_poll_free (AvahiCupsPoll *cups_poll)
-+{
-+  cupsd_watched_fd_t *watched_fd;
-+
-+  for (watched_fd = (cupsd_watched_fd_t*)cupsArrayFirst(cups_poll->watched_fds);
-+       watched_fd;
-+       watched_fd = (cupsd_watched_fd_t*)cupsArrayNext(cups_poll->watched_fds)){
-+    cupsArrayClear (watched_fd->watches);
-+  }
-+
-+  cupsArrayClear (cups_poll->watched_fds);
-+  cupsArrayClear (cups_poll->timeouts);
-+}
-+
-+
-+/*
-+ * 'avahi_cups_poll_get' - Get the abstract poll API structure
-+ */
-+
-+const AvahiPoll *
-+avahi_cups_poll_get (AvahiCupsPoll *cups_poll)
-+{
-+  return (&cups_poll->api);
-+}
-+
-+
-+#endif /* HAVE_AVAHI ... from top of file */
-+
-+/*
-+ * End of "$Id$".
-+ */
-diff -up cups-1.4.5/scheduler/avahi.h.avahi cups-1.4.5/scheduler/avahi.h
---- cups-1.4.5/scheduler/avahi.h.avahi 2010-12-24 13:11:38.334340988 +0000
-+++ cups-1.4.5/scheduler/avahi.h       2010-12-24 13:11:38.334340988 +0000
-@@ -0,0 +1,49 @@
-+/*
-+ * "$Id$"
-+ *
-+ *   Avahi poll implementation for the CUPS scheduler.
-+ *
-+ *   Copyright (C) 2010 Red Hat, Inc.
-+ *   Authors:
-+ *    Tim Waugh <twaugh@redhat.com>
-+ *
-+ *   Distribution and use rights are outlined in the file "LICENSE.txt"
-+ *   which should have been included with this file.  If this file is
-+ *   file is missing or damaged, see the license at "http://www.cups.org/".
-+ */
-+
-+#include <config.h>
-+
-+#ifdef HAVE_AVAHI
-+#  include <avahi-client/client.h>
-+#  include <avahi-client/publish.h>
-+#endif /* HAVE_AVAHI */
-+
-+#ifdef HAVE_AUTHORIZATION_H
-+#  include <Security/Authorization.h>
-+#endif /* HAVE_AUTHORIZATION_H */
-+
-+
-+#ifdef HAVE_AVAHI
-+typedef struct
-+{
-+    AvahiPoll api;
-+    cups_array_t *watched_fds;
-+    cups_array_t *timeouts;
-+} AvahiCupsPoll;
-+#endif /* HAVE_AVAHI */
-+
-+/*
-+ * Prototypes...
-+ */
-+
-+#ifdef HAVE_AVAHI
-+extern AvahiCupsPoll *        avahi_cups_poll_new(void);
-+extern void           avahi_cups_poll_free(AvahiCupsPoll *cups_poll);
-+extern const AvahiPoll *avahi_cups_poll_get(AvahiCupsPoll *cups_poll);
-+#endif /* HAVE_AVAHI */
-+
-+
-+/*
-+ * End of "$Id$".
-+ */
-diff -up cups-1.4.5/scheduler/cupsd.h.avahi cups-1.4.5/scheduler/cupsd.h
---- cups-1.4.5/scheduler/cupsd.h.avahi 2010-09-21 23:34:57.000000000 +0100
-+++ cups-1.4.5/scheduler/cupsd.h       2010-12-24 13:11:38.335340961 +0000
-@@ -147,6 +147,15 @@ extern const char *cups_hstrerror(int);
- typedef void (*cupsd_selfunc_t)(void *data);
-+#ifdef HAVE_AVAHI
-+/*
-+ * Timeout callback function type...
-+ */
-+
-+typedef struct _cupsd_timeout_s cupsd_timeout_t;
-+typedef void (*cupsd_timeoutfunc_t)(cupsd_timeout_t *timeout, void *data);
-+#endif /* HAVE_AVAHI */
-+
- /*
-  * Globals...
-@@ -188,6 +197,9 @@ VAR PSQUpdateQuotaProcPtr PSQUpdateQuota
-                                       /* Apple PrintService quota function */
- #endif /* __APPLE__ && HAVE_DLFCN_H */
-+#ifdef HAVE_AVAHI
-+VAR cups_array_t *Timeouts;           /* Timed callbacks for main loop */
-+#endif /* HAVE_AVAHI */
-@@ -240,6 +252,18 @@ extern void       cupsdRemoveSelect(int fd);
- extern void   cupsdStartSelect(void);
- extern void   cupsdStopSelect(void);
-+#ifdef HAVE_AVAHI
-+extern void     cupsdInitTimeouts(void);
-+extern cupsd_timeout_t *cupsdAddTimeout (const struct timeval *tv,
-+                                       cupsd_timeoutfunc_t cb,
-+                                       void *data);
-+extern cupsd_timeout_t *cupsdNextTimeout (long *delay);
-+extern void     cupsdRunTimeout (cupsd_timeout_t *timeout);
-+extern void     cupsdUpdateTimeout (cupsd_timeout_t *timeout,
-+                                  const struct timeval *tv);
-+extern void     cupsdRemoveTimeout (cupsd_timeout_t *timeout);
-+#endif /* HAVE_AVAHI */
-+
- extern int    cupsdRemoveFile(const char *filename);
-diff -up cups-1.4.5/scheduler/dirsvc.c.avahi cups-1.4.5/scheduler/dirsvc.c
---- cups-1.4.5/scheduler/dirsvc.c.avahi        2010-12-24 13:11:33.679463507 +0000
-+++ cups-1.4.5/scheduler/dirsvc.c      2010-12-24 13:11:38.343340751 +0000
-@@ -99,6 +99,13 @@
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_DNSSD
-+typedef char *cupsd_txt_record_t;
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+typedef AvahiStringList *cupsd_txt_record_t;
-+#endif /* HAVE_AVAHI */
-+
- /*
-  * Local functions...
-  */
-@@ -159,15 +166,20 @@ static void      update_polling(void);
- static void   update_smb(int onoff);
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+static cupsd_txt_record_t dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p,
-+                                            int for_lpd);
-+static void   dnssdDeregisterPrinter(cupsd_printer_t *p);
-+static int    dnssdComparePrinters(cupsd_printer_t *a, cupsd_printer_t *b);
-+static void   dnssdRegisterPrinter(cupsd_printer_t *p);
-+static void   dnssdStop(void);
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-+
- #ifdef HAVE_DNSSD
- #  ifdef HAVE_COREFOUNDATION
- static void   dnssdAddAlias(const void *key, const void *value,
-                             void *context);
- #  endif /* HAVE_COREFOUNDATION */
--static char   *dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p,
--                                   int for_lpd);
--static int    dnssdComparePrinters(cupsd_printer_t *a, cupsd_printer_t *b);
--static void   dnssdDeregisterPrinter(cupsd_printer_t *p);
- static char   *dnssdPackTxtRecord(int *txt_len, char *keyvalue[][2],
-                                   int count);
- static void   dnssdRegisterCallback(DNSServiceRef sdRef,
-@@ -175,11 +187,20 @@ static void      dnssdRegisterCallback(DNSSer
-                                     DNSServiceErrorType errorCode,
-                                     const char *name, const char *regtype,
-                                     const char *domain, void *context);
--static void   dnssdRegisterPrinter(cupsd_printer_t *p);
--static void   dnssdStop(void);
- static void   dnssdUpdate(void);
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+static AvahiStringList *avahiPackTxtRecord(char *keyvalue[][2],
-+                                         int count);
-+static void   avahi_entry_group_cb (AvahiEntryGroup *group,
-+                                    AvahiEntryGroupState state,
-+                                    void *userdata);
-+static void   avahi_client_cb (AvahiClient *client,
-+                               AvahiClientState state,
-+                               void *userdata);
-+#endif /* HAVE_AVAHI */
-+
- #ifdef HAVE_LDAP
- static const char * const ldap_attrs[] =/* CUPS LDAP attributes */
-               {
-@@ -283,10 +304,10 @@ cupsdDeregisterPrinter(
-     ldap_dereg_printer(p);
- #endif /* HAVE_LDAP */
--#ifdef HAVE_DNSSD
--  if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef)
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+  if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD))
-     dnssdDeregisterPrinter(p);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- }
-@@ -694,10 +715,10 @@ cupsdRegisterPrinter(cupsd_printer_t *p)
-     slpRegisterPrinter(p); */
- #endif /* HAVE_LIBSLP */
--#ifdef HAVE_DNSSD
--  if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef)
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+  if ((BrowseLocalProtocols & BROWSE_DNSSD))
-     dnssdRegisterPrinter(p);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- }
-@@ -1535,13 +1556,16 @@ cupsdStartBrowsing(void)
-   else
-     BrowseSocket = -1;
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-   if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_DNSSD)
-   {
-+#ifdef HAVE_DNSSD
-     DNSServiceErrorType error;                /* Error from service creation */
-+#endif /* HAVE_DNSSD */
-     cupsd_listener_t  *lis;           /* Current listening socket */
-+#ifdef HAVE_DNSSD
-    /*
-     * First create a "master" connection for all registrations...
-     */
-@@ -1566,6 +1590,7 @@ cupsdStartBrowsing(void)
-       fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
-       cupsdAddSelect(fd, (cupsd_selfunc_t)dnssdUpdate, NULL, NULL);
-+#endif /* HAVE_DNSSD */
-      /*
-       * Then get the port we use for registrations.  If we are not listening
-@@ -1607,9 +1632,20 @@ cupsdStartBrowsing(void)
-       */
-       cupsdUpdateDNSSDName();
-+#ifdef HAVE_DNSSD
-     }
--  }
- #endif /* HAVE_DNSSD */
-+  }
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-+
-+#ifdef HAVE_AVAHI
-+  if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_DNSSD)
-+  {
-+    AvahiCupsPollHandle = avahi_cups_poll_new ();
-+    avahi_client_new (avahi_cups_poll_get (AvahiCupsPollHandle),
-+                    0, avahi_client_cb, NULL, NULL);
-+  }
-+#endif /* HAVE_AVAHI */
- #ifdef HAVE_LIBSLP
-   if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
-@@ -1835,10 +1871,10 @@ cupsdStopBrowsing(void)
-     BrowseSocket = -1;
-   }
--#ifdef HAVE_DNSSD
--  if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef)
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+  if ((BrowseLocalProtocols & BROWSE_DNSSD))
-     dnssdStop();
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- #ifdef HAVE_LIBSLP
-   if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) &&
-@@ -1903,7 +1939,7 @@ cupsdStopPolling(void)
- }
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- /*
-  * 'cupsdUpdateDNSSDName()' - Update the computer name we use for browsing...
-  */
-@@ -1911,7 +1947,12 @@ cupsdStopPolling(void)
- void
- cupsdUpdateDNSSDName(void)
- {
-+#ifdef HAVE_DNSSD
-   DNSServiceErrorType error;          /* Error from service creation */
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+  int         ret;                    /* Error from service creation */
-+#endif /* HAVE_AVAHI */
-   char                webif[1024];            /* Web interface share name */
- #ifdef HAVE_COREFOUNDATION_H
-   SCDynamicStoreRef sc;                       /* Context for dynamic store */
-@@ -2043,6 +2084,7 @@ cupsdUpdateDNSSDName(void)
-     else
-       strlcpy(webif, "CUPS Web Interface", sizeof(webif));
-+#ifdef HAVE_DNSSD
-     if (WebIFRef)
-       DNSServiceRefDeallocate(WebIFRef);
-@@ -2055,6 +2097,42 @@ cupsdUpdateDNSSDName(void)
-                                   NULL)) != kDNSServiceErr_NoError)
-       cupsdLogMessage(CUPSD_LOG_ERROR,
-                     "DNS-SD web interface registration failed: %d", error);
-+#endif /* HAVE_DNSSD */
-+
-+#ifdef HAVE_AVAHI
-+    if (!AvahiCupsClient)
-+     /*
-+      * Client not yet running.
-+      */
-+      return;
-+
-+    if (AvahiWebIFGroup)
-+      avahi_entry_group_reset (AvahiWebIFGroup);
-+    else
-+      AvahiWebIFGroup = avahi_entry_group_new (AvahiCupsClient,
-+                                             avahi_entry_group_cb,
-+                                             NULL);
-+
-+    if (AvahiWebIFGroup)
-+    {
-+      ret = avahi_entry_group_add_service (AvahiWebIFGroup,
-+                                         AVAHI_IF_UNSPEC,
-+                                         AVAHI_PROTO_UNSPEC,
-+                                         0, /* flags */
-+                                         webif, /* name */
-+                                         "_http._tcp", /* type */
-+                                         NULL, /* domain */
-+                                         NULL, /* host */
-+                                         htons(DNSSDPort), /* port */
-+                                         "path=/", NULL);
-+      if (ret == 0)
-+      ret = avahi_entry_group_commit (AvahiWebIFGroup);
-+
-+      if (ret != 0)
-+      cupsdLogMessage (CUPSD_LOG_ERROR,
-+                       "Avahi web interface registration failed: %d", ret);
-+    }
-+#endif /* HAVE_AVAHI */
-   }
- }
- #endif /* HAVE_DNSSD */
-@@ -2300,162 +2378,7 @@ dequote(char       *d,                 /* I - Destinat
- }
--#ifdef HAVE_DNSSD
--#  ifdef HAVE_COREFOUNDATION
--/*
-- * 'dnssdAddAlias()' - Add a DNS-SD alias name.
-- */
--
--static void
--dnssdAddAlias(const void *key,                /* I - Key */
--              const void *value,      /* I - Value (domain) */
--            void       *context)      /* I - Unused */
--{
--  char        valueStr[1024],                 /* Domain string */
--      hostname[1024];                 /* Complete hostname */
--
--
--  (void)context;
--
--  if (CFGetTypeID((CFStringRef)value) == CFStringGetTypeID() &&
--      CFStringGetCString((CFStringRef)value, valueStr, sizeof(valueStr),
--                         kCFStringEncodingUTF8))
--  {
--    snprintf(hostname, sizeof(hostname), "%s.%s", DNSSDHostName, valueStr);
--    if (!DNSSDAlias)
--      DNSSDAlias = cupsArrayNew(NULL, NULL);
--
--    cupsdAddAlias(DNSSDAlias, hostname);
--    cupsdLogMessage(CUPSD_LOG_DEBUG, "Added Back to My Mac ServerAlias %s",
--                  hostname);
--  }
--  else
--    cupsdLogMessage(CUPSD_LOG_ERROR,
--                    "Bad Back to My Mac domain in dynamic store!");
--}
--#  endif /* HAVE_COREFOUNDATION */
--
--
--/*
-- * 'dnssdBuildTxtRecord()' - Build a TXT record from printer info.
-- */
--
--static char *                         /* O - TXT record */
--dnssdBuildTxtRecord(
--    int             *txt_len,         /* O - TXT record length */
--    cupsd_printer_t *p,                       /* I - Printer information */
--    int             for_lpd)          /* I - 1 = LPD, 0 = IPP */
--{
--  int         i;                      /* Looping var */
--  char                adminurl_str[256],      /* URL for th admin page */
--              type_str[32],           /* Type to string buffer */
--              state_str[32],          /* State to string buffer */
--              rp_str[1024],           /* Queue name string buffer */
--              air_str[1024],          /* auth-info-required string buffer */
--              *keyvalue[32][2];       /* Table of key/value pairs */
--
--
-- /*
--  * Load up the key value pairs...
--  */
--
--  i = 0;
--
--  keyvalue[i  ][0] = "txtvers";
--  keyvalue[i++][1] = "1";
--
--  keyvalue[i  ][0] = "qtotal";
--  keyvalue[i++][1] = "1";
--
--  keyvalue[i  ][0] = "rp";
--  keyvalue[i++][1] = rp_str;
--  if (for_lpd)
--    strlcpy(rp_str, p->name, sizeof(rp_str));
--  else
--    snprintf(rp_str, sizeof(rp_str), "%s/%s", 
--           (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers", p->name);
--
--  keyvalue[i  ][0] = "ty";
--  keyvalue[i++][1] = p->make_model ? p->make_model : "Unknown";
--
--  httpAssembleURIf(HTTP_URI_CODING_ALL, adminurl_str, sizeof(adminurl_str),
--                   "http", NULL, DNSSDHostName, DNSSDPort, "/%s/%s",
--                 (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers",
--                 p->name);
--  keyvalue[i  ][0] = "adminurl";
--  keyvalue[i++][1] = adminurl_str;
--
--  keyvalue[i  ][0] = "note";
--  keyvalue[i++][1] = p->location ? p->location : "";
--
--  keyvalue[i  ][0] = "priority";
--  keyvalue[i++][1] = for_lpd ? "100" : "0";
--
--  keyvalue[i  ][0] = "product";
--  keyvalue[i++][1] = p->product ? p->product : "Unknown";
--
--  snprintf(type_str, sizeof(type_str), "0x%X", p->type | CUPS_PRINTER_REMOTE);
--  snprintf(state_str, sizeof(state_str), "%d", p->state);
--
--  keyvalue[i  ][0] = "printer-state";
--  keyvalue[i++][1] = state_str;
--
--  keyvalue[i  ][0] = "printer-type";
--  keyvalue[i++][1] = type_str;
--
--  keyvalue[i  ][0] = "Transparent";
--  keyvalue[i++][1] = "T";
--
--  keyvalue[i  ][0] = "Binary";
--  keyvalue[i++][1] = "T";
--
--  keyvalue[i  ][0] = "Fax";
--  keyvalue[i++][1] = (p->type & CUPS_PRINTER_FAX) ? "T" : "F";
--
--  keyvalue[i  ][0] = "Color";
--  keyvalue[i++][1] = (p->type & CUPS_PRINTER_COLOR) ? "T" : "F";
--
--  keyvalue[i  ][0] = "Duplex";
--  keyvalue[i++][1] = (p->type & CUPS_PRINTER_DUPLEX) ? "T" : "F";
--
--  keyvalue[i  ][0] = "Staple";
--  keyvalue[i++][1] = (p->type & CUPS_PRINTER_STAPLE) ? "T" : "F";
--
--  keyvalue[i  ][0] = "Copies";
--  keyvalue[i++][1] = (p->type & CUPS_PRINTER_COPIES) ? "T" : "F";
--
--  keyvalue[i  ][0] = "Collate";
--  keyvalue[i++][1] = (p->type & CUPS_PRINTER_COLLATE) ? "T" : "F";
--
--  keyvalue[i  ][0] = "Punch";
--  keyvalue[i++][1] = (p->type & CUPS_PRINTER_PUNCH) ? "T" : "F";
--
--  keyvalue[i  ][0] = "Bind";
--  keyvalue[i++][1] = (p->type & CUPS_PRINTER_BIND) ? "T" : "F";
--
--  keyvalue[i  ][0] = "Sort";
--  keyvalue[i++][1] = (p->type & CUPS_PRINTER_SORT) ? "T" : "F";
--
--  keyvalue[i  ][0] = "Scan";
--  keyvalue[i++][1] = (p->type & CUPS_PRINTER_MFP) ? "T" : "F";
--
--  keyvalue[i  ][0] = "pdl";
--  keyvalue[i++][1] = p->pdl ? p->pdl : "application/postscript";
--
--  if (get_auth_info_required(p, air_str, sizeof(air_str)))
--  {
--    keyvalue[i  ][0] = "air";
--    keyvalue[i++][1] = air_str;
--  }
--
-- /*
--  * Then pack them into a proper txt record...
--  */
--
--  return (dnssdPackTxtRecord(txt_len, keyvalue, i));
--}
--
--
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- /*
-  * 'dnssdComparePrinters()' - Compare the registered names of two printers.
-  */
-@@ -2479,6 +2402,10 @@ dnssdDeregisterPrinter(
- {
-   cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdDeregisterPrinter(%s)", p->name);
-+#ifdef HAVE_DNSSD
-+  if (!DNSSDRef)
-+    return;
-+
-  /*
-   * Closing the socket deregisters the service
-   */
-@@ -2514,6 +2441,23 @@ dnssdDeregisterPrinter(
-     free(p->printer_txt);
-     p->printer_txt = NULL;
-   }
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+  if (p->avahi_group)
-+  {
-+    avahi_entry_group_reset (p->avahi_group);
-+    avahi_entry_group_free (p->avahi_group);
-+    p->avahi_group = NULL;
-+
-+    if (p->ipp_txt)
-+      avahi_string_list_free (p->ipp_txt);
-+
-+    if (p->printer_txt)
-+      avahi_string_list_free (p->printer_txt);
-+
-+    p->ipp_txt = p->printer_txt = NULL;
-+  }
-+#endif /* HAVE_AVAHI */
-  /*
-   * Remove the printer from the array of DNS-SD printers, then clear the
-@@ -2526,140 +2470,53 @@ dnssdDeregisterPrinter(
- /*
-- * 'dnssdPackTxtRecord()' - Pack an array of key/value pairs into the
-- *                          TXT record format.
-+ * 'dnssdRegisterPrinter()' - Start sending broadcast information for a printer
-+ *                          or update the broadcast contents.
-  */
--static char *                         /* O - TXT record */
--dnssdPackTxtRecord(int  *txt_len,     /* O - TXT record length */
--                 char *keyvalue[][2], /* I - Table of key value pairs */
--                 int  count)          /* I - Items in table */
-+static void 
-+dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
- {
--  int  i;                             /* Looping var */
--  int  length;                                /* Length of TXT record */
--  int  length2;                               /* Length of value */
--  char *txtRecord;                    /* TXT record buffer */
--  char *cursor;                               /* Looping pointer */
-+#ifdef HAVE_DNSSD
-+  DNSServiceErrorType se;             /* dnssd errors */
-+  char                        *ipp_txt,       /* IPP TXT record buffer */
-+                      *printer_txt,   /* LPD TXT record buffer */
-+                      *nameptr;       /* Pointer into name */
-+  int                 ipp_len,        /* IPP TXT record length */
-+                      printer_len;    /* LPD TXT record length */
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+  int                 ret;            /* Error code */
-+  AvahiStringList     *ipp_txt,       /* IPP TXT record list */
-+                      *printer_txt;   /* LPD TXT record buffer */
-+#endif /* HAVE_AVAHI */
-+  char                        name[1024];     /* Service name */
-+  const char          *regtype;       /* Registration type */
-- /*
--  * Calculate the buffer size
--  */
-+#ifdef HAVE_DNSSD
-+  if (!DNSSDRef)
-+    return;
--  for (length = i = 0; i < count; i++)
--    length += 1 + strlen(keyvalue[i][0]) + 
--            (keyvalue[i][1] ? 1 + strlen(keyvalue[i][1]) : 0);
-+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name,
-+                  !p->ipp_ref ? "new" : "update");
-+
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name,
-+                !p->avahi_group ? "new" : "update");
-+#endif /* HAVE_AVAHI */
-  /*
--  * Allocate and fill it
-+  * If per-printer sharing was just disabled make sure we're not
-+  * registered before returning.
-   */
--  txtRecord = malloc(length);
--  if (txtRecord)
-+  if (!p->shared)
-   {
--    *txt_len = length;
--
--    for (cursor = txtRecord, i = 0; i < count; i++)
--    {
--     /*
--      * Drop in the p-string style length byte followed by the data
--      */
--
--      length  = strlen(keyvalue[i][0]);
--      length2 = keyvalue[i][1] ? 1 + strlen(keyvalue[i][1]) : 0;
--
--      *cursor++ = (unsigned char)(length + length2);
--
--      memcpy(cursor, keyvalue[i][0], length);
--      cursor += length;
--
--      if (length2)
--      {
--        length2 --;
--      *cursor++ = '=';
--      memcpy(cursor, keyvalue[i][1], length2);
--      cursor += length2;
--      }
--    }
--  }
--
--  return (txtRecord);
--}
--
--
--/*
-- * 'dnssdRegisterCallback()' - DNSServiceRegister callback.
-- */
--
--static void
--dnssdRegisterCallback(
--    DNSServiceRef     sdRef,          /* I - DNS Service reference */
--    DNSServiceFlags   flags,          /* I - Reserved for future use */
--    DNSServiceErrorType       errorCode,      /* I - Error code */
--    const char                *name,          /* I - Service name */
--    const char                *regtype,       /* I - Service type */
--    const char                *domain,        /* I - Domain. ".local" for now */
--    void              *context)       /* I - User-defined context */
--{
--  cupsd_printer_t *p = (cupsd_printer_t *)context;
--                                      /* Current printer */
--
--
--  cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterCallback(%s, %s) for %s (%s)",
--                  name, regtype, p ? p->name : "Web Interface",
--                p ? (p->reg_name ? p->reg_name : "(null)") : "NA");
--
--  if (errorCode)
--  {
--    cupsdLogMessage(CUPSD_LOG_ERROR, 
--                  "DNSServiceRegister failed with error %d", (int)errorCode);
--    return;
--  }
--  else if (p && (!p->reg_name || strcasecmp(name, p->reg_name)))
--  {
--    cupsdLogMessage(CUPSD_LOG_INFO, "Using service name \"%s\" for \"%s\"",
--                    name, p->name);
--
--    cupsArrayRemove(DNSSDPrinters, p);
--    cupsdSetString(&p->reg_name, name);
--    cupsArrayAdd(DNSSDPrinters, p);
--
--    LastEvent |= CUPSD_EVENT_PRINTER_MODIFIED;
--  }
--}
--
--
--/*
-- * 'dnssdRegisterPrinter()' - Start sending broadcast information for a printer
-- *                          or update the broadcast contents.
-- */
--
--static void 
--dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
--{
--  DNSServiceErrorType se;             /* dnssd errors */
--  char                        *ipp_txt,       /* IPP TXT record buffer */
--                      *printer_txt,   /* LPD TXT record buffer */
--                      name[1024],     /* Service name */
--                      *nameptr;       /* Pointer into name */
--  int                 ipp_len,        /* IPP TXT record length */
--                      printer_len;    /* LPD TXT record length */
--  const char          *regtype;       /* Registration type */
--
--
--  cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterPrinter(%s) %s", p->name,
--                  !p->ipp_ref ? "new" : "update");
--
-- /*
--  * If per-printer sharing was just disabled make sure we're not
--  * registered before returning.
--  */
--
--  if (!p->shared)
--  {
--    dnssdDeregisterPrinter(p);
--    return;
--  }
-+    dnssdDeregisterPrinter(p);
-+    return;
-+  }
-  /*
-   * The registered name takes the form of "<printer-info> @ <computer name>"...
-@@ -2694,6 +2551,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p)
-   * Register IPP and (optionally) LPD...
-   */
-+#ifdef HAVE_DNSSD
-   ipp_len = 0;                                /* anti-compiler-warning-code */
-   ipp_txt = dnssdBuildTxtRecord(&ipp_len, p, 0);
-@@ -2860,6 +2718,140 @@ dnssdRegisterPrinter(cupsd_printer_t *p)
-     if (printer_txt)
-       free(printer_txt);
-   }
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+  if (!AvahiCupsClient)
-+   /*
-+    * Client not running yet.  The client callback will call us again later.
-+    */
-+    return;
-+
-+  ipp_txt = dnssdBuildTxtRecord(NULL, p, 0);
-+  printer_txt = dnssdBuildTxtRecord(NULL, p, 1);
-+  regtype = (p->type & CUPS_PRINTER_FAX) ? "_fax-ipp._tcp" : "_ipp._tcp";
-+
-+  if (p->avahi_group && p->ipp_txt && ipp_txt &&
-+      !avahi_string_list_equal (p->ipp_txt, ipp_txt))
-+  {
-+   /*
-+    * Update the existing registration...
-+    */
-+
-+    avahi_string_list_free (p->ipp_txt);
-+
-+    if (p->printer_txt)
-+      avahi_string_list_free (p->printer_txt);
-+
-+    ret = avahi_entry_group_update_service_txt_strlst (p->avahi_group,
-+                                                     AVAHI_IF_UNSPEC,
-+                                                     AVAHI_PROTO_UNSPEC,
-+                                                     0, name, regtype, NULL,
-+                                                     ipp_txt);
-+    if (ret < 0)
-+      goto update_failed;
-+
-+    p->ipp_txt = ipp_txt;
-+    ipp_txt = NULL;
-+
-+    if (BrowseLocalProtocols & BROWSE_LPD)
-+    {
-+      ret = avahi_entry_group_update_service_txt_strlst (p->avahi_group,
-+                                                       AVAHI_IF_UNSPEC,
-+                                                       AVAHI_PROTO_UNSPEC,
-+                                                       0, name,
-+                                                       "_printer._tcp", NULL,
-+                                                       printer_txt);
-+
-+      if (ret < 0)
-+      goto update_failed;
-+
-+      p->printer_txt = printer_txt;
-+      printer_txt = NULL;
-+    }
-+
-+    ret = avahi_entry_group_commit (p->avahi_group);
-+    if (ret < 0)
-+    {
-+    update_failed:
-+      cupsdLogMessage (CUPSD_LOG_ERROR,
-+                     "Failed to update TXT record for %s: %d",
-+                     name, ret);
-+      avahi_entry_group_reset (p->avahi_group);
-+      avahi_entry_group_free (p->avahi_group);
-+      p->avahi_group = NULL;
-+      ipp_txt = p->ipp_txt;
-+      p->ipp_txt = NULL;
-+    }
-+  }
-+
-+  if (!p->avahi_group)
-+  {
-+   /*
-+    * Initial registration.  Use the _fax subtype for fax queues...
-+    */
-+
-+    p->avahi_group = avahi_entry_group_new (AvahiCupsClient,
-+                                          avahi_entry_group_cb,
-+                                          p);
-+
-+    cupsdLogMessage(CUPSD_LOG_DEBUG,
-+                  "Registering Avahi printer %s with name \"%s\" and "
-+                  "type \"%s\"", p->name, name, regtype);
-+
-+    ret = avahi_entry_group_add_service_strlst (p->avahi_group,
-+                                              AVAHI_IF_UNSPEC,
-+                                              AVAHI_PROTO_UNSPEC,
-+                                              0, name, regtype, NULL, NULL,
-+                                              htons(DNSSDPort),
-+                                              ipp_txt);
-+    if (ret < 0)
-+      goto add_failed;
-+
-+    p->ipp_txt = ipp_txt;
-+    ipp_txt = NULL;
-+
-+    if (BrowseLocalProtocols & BROWSE_LPD)
-+    {
-+      cupsdLogMessage(CUPSD_LOG_DEBUG,
-+                    "Registering Avahi printer %s with name \"%s\" and "
-+                    "type \"_printer._tcp\"", p->name, name);
-+
-+      ret = avahi_entry_group_add_service_strlst (p->avahi_group,
-+                                                AVAHI_IF_UNSPEC,
-+                                                AVAHI_PROTO_UNSPEC,
-+                                                0, name,
-+                                                "_printer._tcp", NULL, NULL,
-+                                                htons(515),
-+                                                printer_txt);
-+      if (ret < 0)
-+      goto add_failed;
-+
-+      p->printer_txt = printer_txt;
-+      printer_txt = NULL;
-+    }
-+
-+    ret = avahi_entry_group_commit (p->avahi_group);
-+
-+    if (ret < 0)
-+    {
-+    add_failed:
-+      cupsdLogMessage (CUPSD_LOG_ERROR,
-+                     "Failed to add Avahi entry for %s: %d",
-+                     name, ret);
-+      avahi_entry_group_reset (p->avahi_group);
-+      avahi_entry_group_free (p->avahi_group);
-+      p->avahi_group = NULL;
-+      ipp_txt = p->ipp_txt;
-+      p->ipp_txt = NULL;
-+    }
-+  }
-+
-+  if (ipp_txt)
-+    avahi_string_list_free (ipp_txt);
-+
-+  if (printer_txt)
-+    avahi_string_list_free (printer_txt);
-+#endif /* HAVE_AVAHI */
- }
-@@ -2872,6 +2864,10 @@ dnssdStop(void)
- {
-   cupsd_printer_t     *p;             /* Current printer */
-+#ifdef HAVE_DNSSD
-+  if (!DNSSDRef)
-+    return;
-+#endif /* HAVE_DNSSD */
-  /*
-   * De-register the individual printers
-@@ -2882,6 +2878,7 @@ dnssdStop(void)
-        p = (cupsd_printer_t *)cupsArrayNext(Printers))
-     dnssdDeregisterPrinter(p);
-+#ifdef HAVE_DNSSD
-  /*
-   * Shutdown the rest of the service refs...
-   */
-@@ -2902,6 +2899,7 @@ dnssdStop(void)
-   DNSServiceRefDeallocate(DNSSDRef);
-   DNSSDRef = NULL;
-+#endif /* HAVE_DNSSD */
-   cupsArrayDelete(DNSSDPrinters);
-   DNSSDPrinters = NULL;
-@@ -2911,6 +2909,272 @@ dnssdStop(void)
- /*
-+ * 'dnssdBuildTxtRecord()' - Build a TXT record from printer info.
-+ */
-+
-+static cupsd_txt_record_t             /* O - TXT record */
-+dnssdBuildTxtRecord(
-+    int             *txt_len,         /* O - TXT record length */
-+    cupsd_printer_t *p,                       /* I - Printer information */
-+    int             for_lpd)          /* I - 1 = LPD, 0 = IPP */
-+{
-+  int         i;                      /* Looping var */
-+  char                adminurl_str[256],      /* URL for th admin page */
-+              type_str[32],           /* Type to string buffer */
-+              state_str[32],          /* State to string buffer */
-+              rp_str[1024],           /* Queue name string buffer */
-+              air_str[1024],          /* auth-info-required string buffer */
-+              *keyvalue[32][2];       /* Table of key/value pairs */
-+
-+
-+ /*
-+  * Load up the key value pairs...
-+  */
-+
-+  i = 0;
-+
-+  keyvalue[i  ][0] = "txtvers";
-+  keyvalue[i++][1] = "1";
-+
-+  keyvalue[i  ][0] = "qtotal";
-+  keyvalue[i++][1] = "1";
-+
-+  keyvalue[i  ][0] = "rp";
-+  keyvalue[i++][1] = rp_str;
-+  if (for_lpd)
-+    strlcpy(rp_str, p->name, sizeof(rp_str));
-+  else
-+    snprintf(rp_str, sizeof(rp_str), "%s/%s", 
-+           (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers", p->name);
-+
-+  keyvalue[i  ][0] = "ty";
-+  keyvalue[i++][1] = p->make_model ? p->make_model : "Unknown";
-+
-+  httpAssembleURIf(HTTP_URI_CODING_ALL, adminurl_str, sizeof(adminurl_str),
-+                   "http", NULL, DNSSDHostName, DNSSDPort, "/%s/%s",
-+                 (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers",
-+                 p->name);
-+  keyvalue[i  ][0] = "adminurl";
-+  keyvalue[i++][1] = adminurl_str;
-+
-+  keyvalue[i  ][0] = "note";
-+  keyvalue[i++][1] = p->location ? p->location : "";
-+
-+  keyvalue[i  ][0] = "priority";
-+  keyvalue[i++][1] = for_lpd ? "100" : "0";
-+
-+  keyvalue[i  ][0] = "product";
-+  keyvalue[i++][1] = p->product ? p->product : "Unknown";
-+
-+  snprintf(type_str, sizeof(type_str), "0x%X", p->type | CUPS_PRINTER_REMOTE);
-+  snprintf(state_str, sizeof(state_str), "%d", p->state);
-+
-+  keyvalue[i  ][0] = "printer-state";
-+  keyvalue[i++][1] = state_str;
-+
-+  keyvalue[i  ][0] = "printer-type";
-+  keyvalue[i++][1] = type_str;
-+
-+  keyvalue[i  ][0] = "Transparent";
-+  keyvalue[i++][1] = "T";
-+
-+  keyvalue[i  ][0] = "Binary";
-+  keyvalue[i++][1] = "T";
-+
-+  keyvalue[i  ][0] = "Fax";
-+  keyvalue[i++][1] = (p->type & CUPS_PRINTER_FAX) ? "T" : "F";
-+
-+  keyvalue[i  ][0] = "Color";
-+  keyvalue[i++][1] = (p->type & CUPS_PRINTER_COLOR) ? "T" : "F";
-+
-+  keyvalue[i  ][0] = "Duplex";
-+  keyvalue[i++][1] = (p->type & CUPS_PRINTER_DUPLEX) ? "T" : "F";
-+
-+  keyvalue[i  ][0] = "Staple";
-+  keyvalue[i++][1] = (p->type & CUPS_PRINTER_STAPLE) ? "T" : "F";
-+
-+  keyvalue[i  ][0] = "Copies";
-+  keyvalue[i++][1] = (p->type & CUPS_PRINTER_COPIES) ? "T" : "F";
-+
-+  keyvalue[i  ][0] = "Collate";
-+  keyvalue[i++][1] = (p->type & CUPS_PRINTER_COLLATE) ? "T" : "F";
-+
-+  keyvalue[i  ][0] = "Punch";
-+  keyvalue[i++][1] = (p->type & CUPS_PRINTER_PUNCH) ? "T" : "F";
-+
-+  keyvalue[i  ][0] = "Bind";
-+  keyvalue[i++][1] = (p->type & CUPS_PRINTER_BIND) ? "T" : "F";
-+
-+  keyvalue[i  ][0] = "Sort";
-+  keyvalue[i++][1] = (p->type & CUPS_PRINTER_SORT) ? "T" : "F";
-+
-+  keyvalue[i  ][0] = "Scan";
-+  keyvalue[i++][1] = (p->type & CUPS_PRINTER_MFP) ? "T" : "F";
-+
-+  keyvalue[i  ][0] = "pdl";
-+  keyvalue[i++][1] = p->pdl ? p->pdl : "application/postscript";
-+
-+  if (get_auth_info_required(p, air_str, sizeof(air_str)))
-+  {
-+    keyvalue[i  ][0] = "air";
-+    keyvalue[i++][1] = air_str;
-+  }
-+
-+ /*
-+  * Then pack them into a proper txt record...
-+  */
-+
-+#ifdef HAVE_DNSSD
-+  return (dnssdPackTxtRecord(txt_len, keyvalue, i));
-+#endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+  return (avahiPackTxtRecord(keyvalue, i));
-+#endif /* HAVE_AVAHI */
-+}
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-+
-+
-+#ifdef HAVE_DNSSD
-+#  ifdef HAVE_COREFOUNDATION
-+/*
-+ * 'dnssdAddAlias()' - Add a DNS-SD alias name.
-+ */
-+
-+static void
-+dnssdAddAlias(const void *key,                /* I - Key */
-+              const void *value,      /* I - Value (domain) */
-+            void       *context)      /* I - Unused */
-+{
-+  char        valueStr[1024],                 /* Domain string */
-+      hostname[1024];                 /* Complete hostname */
-+
-+
-+  (void)context;
-+
-+  if (CFGetTypeID((CFStringRef)value) == CFStringGetTypeID() &&
-+      CFStringGetCString((CFStringRef)value, valueStr, sizeof(valueStr),
-+                         kCFStringEncodingUTF8))
-+  {
-+    snprintf(hostname, sizeof(hostname), "%s.%s", DNSSDHostName, valueStr);
-+    if (!DNSSDAlias)
-+      DNSSDAlias = cupsArrayNew(NULL, NULL);
-+
-+    cupsdAddAlias(DNSSDAlias, hostname);
-+    cupsdLogMessage(CUPSD_LOG_DEBUG, "Added Back to My Mac ServerAlias %s",
-+                  hostname);
-+  }
-+  else
-+    cupsdLogMessage(CUPSD_LOG_ERROR,
-+                    "Bad Back to My Mac domain in dynamic store!");
-+}
-+#  endif /* HAVE_COREFOUNDATION */
-+
-+
-+/*
-+ * 'dnssdPackTxtRecord()' - Pack an array of key/value pairs into the
-+ *                          TXT record format.
-+ */
-+
-+static char *                         /* O - TXT record */
-+dnssdPackTxtRecord(int  *txt_len,     /* O - TXT record length */
-+                 char *keyvalue[][2], /* I - Table of key value pairs */
-+                 int  count)          /* I - Items in table */
-+{
-+  int  i;                             /* Looping var */
-+  int  length;                                /* Length of TXT record */
-+  int  length2;                               /* Length of value */
-+  char *txtRecord;                    /* TXT record buffer */
-+  char *cursor;                               /* Looping pointer */
-+
-+
-+ /*
-+  * Calculate the buffer size
-+  */
-+
-+  for (length = i = 0; i < count; i++)
-+    length += 1 + strlen(keyvalue[i][0]) + 
-+            (keyvalue[i][1] ? 1 + strlen(keyvalue[i][1]) : 0);
-+
-+ /*
-+  * Allocate and fill it
-+  */
-+
-+  txtRecord = malloc(length);
-+  if (txtRecord)
-+  {
-+    *txt_len = length;
-+
-+    for (cursor = txtRecord, i = 0; i < count; i++)
-+    {
-+     /*
-+      * Drop in the p-string style length byte followed by the data
-+      */
-+
-+      length  = strlen(keyvalue[i][0]);
-+      length2 = keyvalue[i][1] ? 1 + strlen(keyvalue[i][1]) : 0;
-+
-+      *cursor++ = (unsigned char)(length + length2);
-+
-+      memcpy(cursor, keyvalue[i][0], length);
-+      cursor += length;
-+
-+      if (length2)
-+      {
-+        length2 --;
-+      *cursor++ = '=';
-+      memcpy(cursor, keyvalue[i][1], length2);
-+      cursor += length2;
-+      }
-+    }
-+  }
-+
-+  return (txtRecord);
-+}
-+
-+
-+/*
-+ * 'dnssdRegisterCallback()' - DNSServiceRegister callback.
-+ */
-+
-+static void
-+dnssdRegisterCallback(
-+    DNSServiceRef     sdRef,          /* I - DNS Service reference */
-+    DNSServiceFlags   flags,          /* I - Reserved for future use */
-+    DNSServiceErrorType       errorCode,      /* I - Error code */
-+    const char                *name,          /* I - Service name */
-+    const char                *regtype,       /* I - Service type */
-+    const char                *domain,        /* I - Domain. ".local" for now */
-+    void              *context)       /* I - User-defined context */
-+{
-+  cupsd_printer_t *p = (cupsd_printer_t *)context;
-+                                      /* Current printer */
-+
-+
-+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdRegisterCallback(%s, %s) for %s (%s)",
-+                  name, regtype, p ? p->name : "Web Interface",
-+                p ? (p->reg_name ? p->reg_name : "(null)") : "NA");
-+
-+  if (errorCode)
-+  {
-+    cupsdLogMessage(CUPSD_LOG_ERROR, 
-+                  "DNSServiceRegister failed with error %d", (int)errorCode);
-+    return;
-+  }
-+  else if (p && (!p->reg_name || strcasecmp(name, p->reg_name)))
-+  {
-+    cupsdLogMessage(CUPSD_LOG_INFO, "Using service name \"%s\" for \"%s\"",
-+                    name, p->name);
-+
-+    cupsArrayRemove(DNSSDPrinters, p);
-+    cupsdSetString(&p->reg_name, name);
-+    cupsArrayAdd(DNSSDPrinters, p);
-+
-+    LastEvent |= CUPSD_EVENT_PRINTER_MODIFIED;
-+  }
-+}
-+
-+
-+/*
-  * 'dnssdUpdate()' - Handle DNS-SD queries.
-  */
-@@ -2931,6 +3195,126 @@ dnssdUpdate(void)
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+/*
-+ * 'avahiPackTxtRecord()' - Pack an array of key/value pairs into an
-+ *                          AvahiStringList.
-+ */
-+
-+static AvahiStringList *              /* O - new string list */
-+avahiPackTxtRecord(char *keyvalue[][2],       /* I - Table of key value pairs */
-+                 int count)           /* I - Items in table */
-+{
-+  AvahiStringList *strlst = NULL;
-+  char **elements;
-+  size_t len;
-+  int i;
-+
-+  elements = malloc ((1 + count) * sizeof (char *));
-+  if (!elements)
-+    goto cleanup;
-+
-+  for (i = 0; i < count; i++)
-+  {
-+    len = (1 + strlen (keyvalue[i][0]) +
-+         (keyvalue[i][1] ? 1 + strlen (keyvalue[i][1]) : 1));
-+    elements[i] = malloc (len * sizeof (char));
-+    if (!elements[i])
-+      goto cleanup;
-+
-+    snprintf (elements[i], len, "%s=%s", keyvalue[i][0], keyvalue[i][1]);
-+  }
-+
-+  strlst = avahi_string_list_new_from_array ((const char **) elements, count);
-+
-+cleanup:
-+  while (--i >= 0)
-+    free (elements[i]);
-+
-+  free (elements);
-+  return (strlst);
-+}
-+
-+
-+/*
-+ * 'avahi_entry_group_cb()' - Avahi entry group callback function.
-+ */
-+static void
-+avahi_entry_group_cb (AvahiEntryGroup *group,
-+                    AvahiEntryGroupState state,
-+                    void *userdata)
-+{
-+  char *name;
-+
-+  if (userdata)
-+    name = ((cupsd_printer_t *) userdata)->reg_name;
-+  else
-+    name = "CUPS web interface";
-+
-+  switch (state)
-+  {
-+  case AVAHI_ENTRY_GROUP_UNCOMMITED:
-+  case AVAHI_ENTRY_GROUP_REGISTERING:
-+    break;
-+
-+  case AVAHI_ENTRY_GROUP_ESTABLISHED:
-+    cupsdLogMessage (CUPSD_LOG_DEBUG,
-+                   "Avahi entry group established for %s", name);
-+    break;
-+
-+  default:
-+    cupsdLogMessage (CUPSD_LOG_DEBUG,
-+                   "Avahi entry group %s has state %d",
-+                   name, state);
-+    break;
-+  }
-+}
-+
-+/*
-+ * 'avahi_client_cb()' - Avahi client callback function.
-+ */
-+static void
-+avahi_client_cb (AvahiClient *client,
-+               AvahiClientState state,
-+               void *userdata)
-+{
-+  cupsd_printer_t *printer;
-+  switch (state)
-+  {
-+  case AVAHI_CLIENT_S_RUNNING:
-+   /*
-+    * Avahi client started successfully.
-+    */
-+    AvahiCupsClient = client;
-+    cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client started");
-+
-+    cupsdUpdateDNSSDName ();
-+
-+    for (printer = (cupsd_printer_t *)cupsArrayFirst(DNSSDPrinters);
-+       printer;
-+       printer = (cupsd_printer_t *)cupsArrayNext(DNSSDPrinters))
-+    {
-+      if (!printer->avahi_group)
-+      dnssdRegisterPrinter (printer);
-+    }
-+
-+    break;
-+
-+  case AVAHI_CLIENT_CONNECTING:
-+    cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client connecting");
-+    break;
-+
-+  case AVAHI_CLIENT_FAILURE:
-+    cupsdLogMessage (CUPSD_LOG_ERROR, "Avahi client failed");
-+    break;
-+
-+  default:
-+    cupsdLogMessage (CUPSD_LOG_DEBUG, "Avahi client state: %d", state);
-+  }
-+}
-+#endif /* HAVE_AVAHI */
-+
-+
- /*
-  * 'get_auth_info_required()' - Get the auth-info-required value to advertise.
-  */
-diff -up cups-1.4.5/scheduler/dirsvc.h.avahi cups-1.4.5/scheduler/dirsvc.h
---- cups-1.4.5/scheduler/dirsvc.h.avahi        2009-05-14 18:54:37.000000000 +0100
-+++ cups-1.4.5/scheduler/dirsvc.h      2010-12-24 13:11:38.344340724 +0000
-@@ -32,6 +32,10 @@
- #  endif /* HAVE_LDAP_SSL_H */
- #endif /* HAVE_LDAP */
-+#ifdef HAVE_AVAHI
-+#  include <avahi-client/publish.h>
-+#endif /* HAVE_AVAHI */
-+
- /*
-  * Browse protocols...
-  */
-@@ -132,17 +136,20 @@ VAR int                  PollPipe        VALUE(0);
- VAR cupsd_statbuf_t   *PollStatusBuffer VALUE(NULL);
-                                       /* Status buffer for pollers */
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+VAR int                       DNSSDPort       VALUE(0);
-+                                      /* Port number to register */
- VAR char              *DNSSDComputerName VALUE(NULL),
-                                       /* Computer/server name */
-                       *DNSSDHostName  VALUE(NULL);
-                                       /* Hostname */
--VAR cups_array_t      *DNSSDAlias     VALUE(NULL);
--                                      /* List of dynamic ServerAlias's */
--VAR int                       DNSSDPort       VALUE(0);
--                                      /* Port number to register */
- VAR cups_array_t      *DNSSDPrinters  VALUE(NULL);
-                                       /* Printers we have registered */
-+#endif /* HAVE_DNSSD || HAVE_AVAHI */
-+
-+#ifdef HAVE_DNSSD
-+VAR cups_array_t      *DNSSDAlias     VALUE(NULL);
-+                                      /* List of dynamic ServerAlias's */
- VAR DNSServiceRef     DNSSDRef        VALUE(NULL),
-                                       /* Master DNS-SD service reference */
-                       WebIFRef        VALUE(NULL),
-@@ -151,6 +158,15 @@ VAR DNSServiceRef DNSSDRef        VALUE(NULL),
-                                       /* Remote printer browse reference */
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+VAR AvahiCupsPoll     *AvahiCupsPollHandle    VALUE(NULL);
-+                                      /* AvahiCupsPoll object */
-+VAR AvahiClient               *AvahiCupsClient        VALUE(NULL);
-+                                      /* AvahiClient object */
-+VAR AvahiEntryGroup   *AvahiWebIFGroup        VALUE(NULL);
-+                                      /* Web interface entry group */
-+#endif /* HAVE_AVAHI */
-+
- #ifdef HAVE_LIBSLP
- VAR SLPHandle         BrowseSLPHandle VALUE(NULL);
-                                       /* SLP API handle */
-@@ -198,9 +214,9 @@ extern void        cupsdStartBrowsing(void);
- extern void   cupsdStartPolling(void);
- extern void   cupsdStopBrowsing(void);
- extern void   cupsdStopPolling(void);
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
- extern void   cupsdUpdateDNSSDName(void);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- #ifdef HAVE_LDAP
- extern void   cupsdUpdateLDAPBrowse(void);
- #endif /* HAVE_LDAP */
-diff -up cups-1.4.5/scheduler/main.c.avahi cups-1.4.5/scheduler/main.c
---- cups-1.4.5/scheduler/main.c.avahi  2010-12-24 13:11:33.633464718 +0000
-+++ cups-1.4.5/scheduler/main.c        2010-12-24 13:11:38.348340619 +0000
-@@ -161,6 +161,10 @@ main(int  argc,                           /* I - Number of comm
-   int                 launchd_idle_exit;
-                                       /* Idle exit on select timeout? */
- #endif        /* HAVE_LAUNCHD */
-+#ifdef HAVE_AVAHI
-+  cupsd_timeout_t     *tmo;           /* Next scheduled timed callback */
-+  long                        tmo_delay;      /* Time before it must be called */
-+#endif /* HAVE_AVAHI */
- #ifdef HAVE_GETEUID
-@@ -561,6 +565,14 @@ main(int  argc,                           /* I - Number of comm
-   httpInitialize();
-+#ifdef HAVE_AVAHI
-+ /*
-+  * Initialize timed callback structures.
-+  */
-+
-+  cupsdInitTimeouts();
-+#endif /* HAVE_AVAHI */
-+
-   cupsdStartServer();
-  /*
-@@ -900,6 +912,16 @@ main(int  argc,                           /* I - Number of comm
-     }
- #endif /* __APPLE__ */
-+#ifdef HAVE_AVAHI
-+   /*
-+    * If a timed callback is due, run it.
-+    */
-+
-+    tmo = cupsdNextTimeout (&tmo_delay);
-+    if (tmo && tmo_delay == 0)
-+      cupsdRunTimeout (tmo);
-+#endif /* HAVE_AVAHI */
-+
- #ifndef __APPLE__
-    /*
-     * Update the network interfaces once a minute...
-@@ -1925,6 +1947,10 @@ select_timeout(int fds)                 /* I - Number 
-   cupsd_job_t         *job;           /* Job information */
-   cupsd_subscription_t        *sub;           /* Subscription information */
-   const char          *why;           /* Debugging aid */
-+#ifdef HAVE_AVAHI
-+  cupsd_timeout_t     *tmo;           /* Timed callback */
-+  long                        tmo_delay;      /* Seconds before calling it */
-+#endif /* HAVE_AVAHI */
-  /*
-@@ -1967,6 +1993,19 @@ select_timeout(int fds)                 /* I - Number 
-   }
- #endif /* __APPLE__ */
-+#ifdef HAVE_AVAHI
-+ /*
-+  * See if there are any scheduled timed callbacks to run.
-+  */
-+
-+  tmo = cupsdNextTimeout (&tmo_delay);
-+  if (tmo)
-+  {
-+    timeout = tmo_delay;
-+    why = "run a timed callback";
-+  }
-+#endif /* HAVE_AVAHI */
-+
-  /*
-   * Check whether we are accepting new connections...
-   */
-diff -up cups-1.4.5/scheduler/Makefile.avahi cups-1.4.5/scheduler/Makefile
---- cups-1.4.5/scheduler/Makefile.avahi        2010-12-24 13:11:33.739461928 +0000
-+++ cups-1.4.5/scheduler/Makefile      2010-12-24 13:11:38.332341040 +0000
-@@ -17,6 +17,7 @@ include ../Makedefs
- CUPSDOBJS =   \
-               auth.o \
-+              avahi.o \
-               banners.o \
-               cert.o \
-               classes.o \
-@@ -39,7 +40,8 @@ CUPSDOBJS =  \
-               server.o \
-               statbuf.o \
-               subscriptions.o \
--              sysman.o
-+              sysman.o \
-+              timeout.o
- LIBOBJS =     \
-               filter.o \
-               mime.o \
-diff -up cups-1.4.5/scheduler/printers.c.avahi cups-1.4.5/scheduler/printers.c
---- cups-1.4.5/scheduler/printers.c.avahi      2010-12-24 13:11:33.784460744 +0000
-+++ cups-1.4.5/scheduler/printers.c    2010-12-24 13:11:38.356340409 +0000
-@@ -929,10 +929,10 @@ cupsdDeletePrinter(
-   cupsdClearString(&p->alert);
-   cupsdClearString(&p->alert_description);
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-   cupsdClearString(&p->product);
-   cupsdClearString(&p->pdl);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-   cupsArrayDelete(p->filetypes);
-@@ -1301,9 +1301,9 @@ cupsdLoadAllPrinters(void)
-     {
-       if (value)
-       {
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-         p->product = _cupsStrAlloc(value);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-       }
-       else
-       cupsdLogMessage(CUPSD_LOG_ERROR,
-@@ -1717,10 +1717,10 @@ cupsdSaveAllPrinters(void)
-     cupsFilePrintf(fp, "Type %d\n", printer->type);
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-     if (printer->product)
-       cupsFilePutConf(fp, "Product", printer->product);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-     for (ptr = (char *)cupsArrayFirst(printer->filters);
-          ptr;
-@@ -3860,7 +3860,7 @@ add_printer_formats(cupsd_printer_t *p)  
-     attr->values[i].string.text = _cupsStrAlloc(mimetype);
-   }
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-   {
-     char              pdl[1024];      /* Buffer to build pdl list */
-     mime_filter_t     *filter;        /* MIME filter looping var */
-@@ -3914,7 +3914,7 @@ add_printer_formats(cupsd_printer_t *p)  
-     cupsdSetString(&p->pdl, pdl);
-   }
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- }
-@@ -4951,9 +4951,9 @@ load_ppd(cupsd_printer_t *p)             /* I - Pri
-       attr->values[i].string.text = _cupsStrAlloc("bcp");
-     }
--#ifdef HAVE_DNSSD
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-     cupsdSetString(&p->product, ppd->product);
--#endif /* HAVE_DNSSD */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
-     if (ppdFindAttr(ppd, "APRemoteQueueID", NULL))
-       p->type |= CUPS_PRINTER_REMOTE;
-diff -up cups-1.4.5/scheduler/printers.h.avahi cups-1.4.5/scheduler/printers.h
---- cups-1.4.5/scheduler/printers.h.avahi      2010-03-30 23:07:33.000000000 +0100
-+++ cups-1.4.5/scheduler/printers.h    2010-12-24 13:11:38.357340382 +0000
-@@ -16,6 +16,9 @@
- #ifdef HAVE_DNSSD
- #  include <dns_sd.h>
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+#  include "avahi.h"
-+#endif /* HAVE_AVAHI */
- #include <cups/pwg-private.h>
-@@ -99,17 +102,24 @@ typedef struct cupsd_printer_s
-   char                *recoverable;           /* com.apple.print.recoverable-message */
-   _pwg_t      *pwg;                   /* PWG<->PPD mapping data */
-+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-+  char                *reg_name;              /* Name used for service registration */
-+  char                *product,               /* PPD Product string */
-+              *pdl;                   /* pdl value for TXT record */
-+#endif /* defined(HAVE_DNSSD) || defined(HAVE_AVAHI) */
- #ifdef HAVE_DNSSD
--  char                *reg_name,              /* Name used for service registration */
--              *product,               /* PPD Product string */
--              *pdl,                   /* pdl value for TXT record */
--              *ipp_txt,               /* IPP TXT record contents */
-+  char                *ipp_txt,               /* IPP TXT record contents */
-               *printer_txt;           /* LPD TXT record contents */
-   int         ipp_len,                /* IPP TXT record length */
-               printer_len;            /* LPD TXT record length */
-   DNSServiceRef       ipp_ref,                /* Reference for _ipp._tcp,_cups */
-               printer_ref;            /* Reference for _printer._tcp */
- #endif /* HAVE_DNSSD */
-+#ifdef HAVE_AVAHI
-+  AvahiStringList *ipp_txt,           /* IPP TXT record */
-+                *printer_txt;         /* LPD TXT record */
-+  AvahiEntryGroup *avahi_group;               /* Avahi entry group */
-+#endif /* HAVE_AVAHI */
- } cupsd_printer_t;
-diff -up cups-1.4.5/scheduler/timeout.c.avahi cups-1.4.5/scheduler/timeout.c
---- cups-1.4.5/scheduler/timeout.c.avahi       2010-12-24 13:11:38.358340356 +0000
-+++ cups-1.4.5/scheduler/timeout.c     2010-12-24 13:11:38.358340356 +0000
-@@ -0,0 +1,191 @@
-+/*
-+ * "$Id$"
-+ *
-+ *   Timeout functions for the Common UNIX Printing System (CUPS).
-+ *
-+ *   Copyright (C) 2010 Red Hat, Inc.
-+ *   Authors:
-+ *     Tim Waugh <twaugh@redhat.com>
-+ *
-+ *   Distribution and use rights are outlined in the file "LICENSE.txt"
-+ *   which should have been included with this file.  If this file is
-+ *   file is missing or damaged, see the license at "http://www.cups.org/".
-+ *
-+ * Contents:
-+ *
-+ *   cupsdInitTimeouts()  - Initialise timeout structure.
-+ *   cupsdAddTimeout()    - Add a timed callback.
-+ *   cupsdNextTimeout()   - Find the next enabled timed callback.
-+ *   cupsdUpdateTimeout() - Adjust the time of a timed callback or disable it.
-+ *   cupsdRemoveTimeout() - Discard a timed callback.
-+ *   compare_timeouts()   - Compare timed callbacks for array sorting.
-+ */
-+
-+#include <config.h>
-+
-+#ifdef HAVE_AVAHI /* Applies to entire file... */
-+
-+/*
-+ * Include necessary headers...
-+ */
-+
-+#include "cupsd.h"
-+
-+#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
-+#  include <malloc.h>
-+#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
-+
-+#ifdef HAVE_AVAHI
-+#  include <avahi-common/timeval.h>
-+#endif /* HAVE_AVAHI */
-+
-+
-+struct _cupsd_timeout_s
-+{
-+  struct timeval when;
-+  int enabled;
-+  cupsd_timeoutfunc_t callback;
-+  void *data;
-+};
-+
-+/*
-+ * Local functions...
-+ */
-+
-+/*
-+ * 'compare_timeouts()' - Compare timed callbacks for array sorting.
-+ */
-+
-+static int
-+compare_timeouts (cupsd_timeout_t *p0, cupsd_timeout_t *p1)
-+{
-+  if (!p0->enabled || !p1->enabled)
-+  {
-+    if (!p0->enabled && !p1->enabled)
-+      return (0);
-+
-+    return (p0->enabled ? -1 : 1);
-+  }
-+
-+  return (avahi_timeval_compare (&p0->when, &p1->when));
-+}
-+
-+
-+/*
-+ * 'cupsdInitTimeouts()' - Initialise timeout structures.
-+ */
-+
-+void
-+cupsdInitTimeouts(void)
-+{
-+  Timeouts = cupsArrayNew ((cups_array_func_t)compare_timeouts, NULL);
-+}
-+
-+
-+/*
-+ * 'cupsdAddTimeout()' - Add a timed callback.
-+ */
-+
-+cupsd_timeout_t *                             /* O - Timeout handle */
-+cupsdAddTimeout(const struct timeval *tv,     /* I - Absolute time */
-+              cupsd_timeoutfunc_t cb,         /* I - Callback function */
-+              void *data)                     /* I - User data */
-+{
-+  cupsd_timeout_t *timeout;
-+
-+  timeout = malloc (sizeof(cupsd_timeout_t));
-+  if (timeout != NULL)
-+  {
-+    timeout->enabled = (tv != NULL);
-+    if (tv)
-+    {
-+      timeout->when.tv_sec = tv->tv_sec;
-+      timeout->when.tv_usec = tv->tv_usec;
-+    }
-+
-+    timeout->callback = cb;
-+    timeout->data = data;
-+    cupsArrayAdd (Timeouts, timeout);
-+  }
-+
-+  return timeout;
-+}
-+
-+
-+/*
-+ * 'cupsdNextTimeout()' - Find the next enabled timed callback.
-+ */
-+
-+cupsd_timeout_t *             /* O - Next enabled timeout or NULL */
-+cupsdNextTimeout(long *delay) /* O - Seconds before scheduled */
-+{
-+  cupsd_timeout_t *first = cupsArrayFirst (Timeouts);
-+  struct timeval curtime;
-+
-+  if (first && !first->enabled)
-+    first = NULL;
-+
-+  if (first && delay)
-+  {
-+    gettimeofday (&curtime, NULL);
-+    if (avahi_timeval_compare (&curtime, &first->when) > 0)
-+    {
-+      *delay = 0;
-+    } else {
-+      *delay = 1 + first->when.tv_sec - curtime.tv_sec;
-+      if (first->when.tv_usec < curtime.tv_usec)
-+      (*delay)--;
-+    }
-+  }
-+
-+  return (first);
-+}
-+
-+
-+/*
-+ * 'cupsdRunTimeout()' - Run a timed callback.
-+ */
-+
-+void
-+cupsdRunTimeout(cupsd_timeout_t *timeout)     /* I - Timeout */
-+{
-+  timeout->enabled = 0;
-+  timeout->callback (timeout, timeout->data);
-+}
-+
-+/*
-+ * 'cupsdUpdateTimeout()' - Adjust the time of a timed callback or disable it.
-+ */
-+
-+void
-+cupsdUpdateTimeout(cupsd_timeout_t *timeout,  /* I - Timeout */
-+                 const struct timeval *tv)    /* I - Absolute time or NULL */
-+{
-+  cupsArrayRemove (Timeouts, timeout);
-+  timeout->enabled = (tv != NULL);
-+  if (tv)
-+  {
-+    timeout->when.tv_sec = tv->tv_sec;
-+    timeout->when.tv_usec = tv->tv_usec;
-+  }
-+  cupsArrayAdd (Timeouts, timeout);
-+}
-+
-+
-+/*
-+ * 'cupsdRemoveTimeout()' - Discard a timed callback.
-+ */
-+
-+void
-+cupsdRemoveTimeout(cupsd_timeout_t *timeout)  /* I - Timeout */
-+{
-+  cupsArrayRemove (Timeouts, timeout);
-+  free (timeout);
-+}
-+
-+
-+#endif /* HAVE_AVAHI ... from top of file */
-+
-+/*
-+ * End of "$Id$".
-+ */
diff --git a/cups/patches/cups-banners.patch b/cups/patches/cups-banners.patch
deleted file mode 100644 (file)
index 6907c91..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- cups-1.2rc2/scheduler/banners.c.banners    2006-04-19 16:12:07.000000000 +0100
-+++ cups-1.2rc2/scheduler/banners.c    2006-04-19 16:12:42.000000000 +0100
-@@ -119,6 +119,8 @@
-     if ((ext = strrchr(dent->filename, '.')) != NULL)
-       if (!strcmp(ext, ".bck") ||
-           !strcmp(ext, ".bak") ||
-+          !strcmp(ext, ".rpmnew") ||
-+          !strcmp(ext, ".rpmsave") ||
-         !strcmp(ext, ".sav"))
-       continue;
diff --git a/cups/patches/cups-build.patch b/cups/patches/cups-build.patch
deleted file mode 100644 (file)
index 727deb2..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-diff -up cups-1.4rc1/Makedefs.in.build cups-1.4rc1/Makedefs.in
---- cups-1.4rc1/Makedefs.in.build      2009-05-27 00:27:06.000000000 +0100
-+++ cups-1.4rc1/Makedefs.in    2009-06-17 11:18:27.185443255 +0100
-@@ -124,7 +124,7 @@ ARFLAGS            =       @ARFLAGS@
- BACKLIBS      =       @BACKLIBS@
- BANNERTOPS    =       @BANNERTOPS@
- CFLAGS                =       @CPPFLAGS@ @CFLAGS@
--COMMONLIBS    =       @LIBS@
-+COMMONLIBS    =       @LIBS@ $(DNSSDLIBS)
- CUPSDLIBS     =       @CUPSDLIBS@
- CXXFLAGS      =       @CPPFLAGS@ @CXXFLAGS@
- CXXLIBS               =       @CXXLIBS@
-diff -up cups-1.4rc1/scheduler/dirsvc.c.build cups-1.4rc1/scheduler/dirsvc.c
---- cups-1.4rc1/scheduler/dirsvc.c.build       2009-05-14 18:54:37.000000000 +0100
-+++ cups-1.4rc1/scheduler/dirsvc.c     2009-06-17 11:23:23.366318546 +0100
-@@ -2042,7 +2042,7 @@ cupsdUpdateDNSSDName(void)
-     WebIFRef = DNSSDRef;
-     if ((error = DNSServiceRegister(&WebIFRef,
--                                  kDNSServiceFlagsShareConnection,
-+                                  0,
-                                   0, webif, "_http._tcp", NULL,
-                                   NULL, htons(DNSSDPort), 7,
-                                   "\006path=/", dnssdRegisterCallback,
-@@ -2765,7 +2765,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p)
-     do
-     {
-       p->ipp_ref = DNSSDRef;
--      if ((se = DNSServiceRegister(&p->ipp_ref, kDNSServiceFlagsShareConnection,
-+      if ((se = DNSServiceRegister(&p->ipp_ref, 0,
-                                    0, name, regtype, NULL, NULL,
-                                  htons(DNSSDPort), ipp_len, ipp_txt,
-                                  dnssdRegisterCallback,
-@@ -2854,7 +2854,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p)
-       p->printer_ref = DNSSDRef;
-       if ((se = DNSServiceRegister(&p->printer_ref,
--                                   kDNSServiceFlagsShareConnection,
-+                                   0,
-                                  0, name, "_printer._tcp", NULL, NULL,
-                                  htons(515), printer_len, printer_txt,
-                                  dnssdRegisterCallback,
diff --git a/cups/patches/cups-dnssd-deviceid.patch b/cups/patches/cups-dnssd-deviceid.patch
deleted file mode 100644 (file)
index abb8366..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-diff -up cups-1.4.3/backend/dnssd.c.dnssd-deviceid.patch cups-1.4.3/backend/dnssd.c
---- cups-1.4.3/backend/dnssd.c.dnssd-deviceid.patch    2010-04-16 19:36:12.226148774 +0100
-+++ cups-1.4.3/backend/dnssd.c 2010-04-16 19:39:53.314148240 +0100
-@@ -1192,15 +1192,22 @@ find_device (cups_array_t *devices,
-       if (device->device_id)
-         free(device->device_id);
-+      if (device_id[0])
-+      {
-+        /* Mark this as the real device ID. */
-+        ptr = device_id + strlen(device_id);
-+        snprintf(ptr, sizeof(device_id) - (ptr - device_id), "FZY:0;");
-+      }
-+
-       if (!device_id[0] && strcmp(model, "Unknown"))
-       {
-         if (make_and_model[0])
--        snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;",
-+        snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;FZY:1;",
-                  make_and_model, model);
-         else if (!strncasecmp(model, "designjet ", 10))
--        snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s", model + 10);
-+        snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s;FZY:1;", model + 10);
-         else if (!strncasecmp(model, "stylus ", 7))
--        snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s", model + 7);
-+        snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s;FZY:1;", model + 7);
-         else if ((ptr = strchr(model, ' ')) != NULL)
-       {
-        /*
-@@ -1210,7 +1217,7 @@ find_device (cups_array_t *devices,
-           memcpy(make_and_model, model, ptr - model);
-         make_and_model[ptr - model] = '\0';
--        snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s",
-+        snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;FZY:1;",
-                  make_and_model, ptr + 1);
-         }
-       }
diff --git a/cups/patches/cups-force-gnutls.patch b/cups/patches/cups-force-gnutls.patch
deleted file mode 100644 (file)
index 85adaa8..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-diff -up cups-1.4.4/config-scripts/cups-ssl.m4.force-gnutls cups-1.4.4/config-scripts/cups-ssl.m4
---- cups-1.4.4/config-scripts/cups-ssl.m4.force-gnutls 2010-09-15 16:49:22.343502552 +0100
-+++ cups-1.4.4/config-scripts/cups-ssl.m4      2010-09-15 16:49:42.347502595 +0100
-@@ -65,23 +65,21 @@ if test x$enable_ssl != xno; then
-       if $PKGCONFIG --exists gnutls; then
-           if test "x$have_pthread" = xyes; then
-               AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
--          else
--              have_ssl=1
--              SSLLIBS=`$PKGCONFIG --libs gnutls`
--              SSLFLAGS=`$PKGCONFIG --cflags gnutls`
--              AC_DEFINE(HAVE_SSL)
--              AC_DEFINE(HAVE_GNUTLS)
-           fi
-+          have_ssl=1
-+          SSLLIBS=`$PKGCONFIG --libs gnutls`
-+          SSLFLAGS=`$PKGCONFIG --cflags gnutls`
-+          AC_DEFINE(HAVE_SSL)
-+          AC_DEFINE(HAVE_GNUTLS)
-       elif test "x$LIBGNUTLSCONFIG" != x; then
-           if test "x$have_pthread" = xyes; then
-               AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
--          else
--              have_ssl=1
--              SSLLIBS=`$LIBGNUTLSCONFIG --libs`
--              SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
--              AC_DEFINE(HAVE_SSL)
--              AC_DEFINE(HAVE_GNUTLS)
-           fi
-+          have_ssl=1
-+          SSLLIBS=`$LIBGNUTLSCONFIG --libs`
-+          SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
-+          AC_DEFINE(HAVE_SSL)
-+          AC_DEFINE(HAVE_GNUTLS)
-       fi
-       if test $have_ssl = 1; then
-diff -up cups-1.4.4/configure.force-gnutls cups-1.4.4/configure
---- cups-1.4.4/configure.force-gnutls  2010-06-17 19:25:47.000000000 +0100
-+++ cups-1.4.4/configure       2010-09-15 16:50:01.689503165 +0100
-@@ -17542,36 +17542,34 @@ fi
-           if test "x$have_pthread" = xyes; then
-               { echo "$as_me:$LINENO: WARNING: The current version of GNU TLS cannot be made thread-safe." >&5
- echo "$as_me: WARNING: The current version of GNU TLS cannot be made thread-safe." >&2;}
--          else
--              have_ssl=1
--              SSLLIBS=`$PKGCONFIG --libs gnutls`
--              SSLFLAGS=`$PKGCONFIG --cflags gnutls`
--              cat >>confdefs.h <<\_ACEOF
-+          fi
-+          have_ssl=1
-+          SSLLIBS=`$PKGCONFIG --libs gnutls`
-+          SSLFLAGS=`$PKGCONFIG --cflags gnutls`
-+          cat >>confdefs.h <<\_ACEOF
- #define HAVE_SSL 1
- _ACEOF
--              cat >>confdefs.h <<\_ACEOF
-+          cat >>confdefs.h <<\_ACEOF
- #define HAVE_GNUTLS 1
- _ACEOF
--          fi
-       elif test "x$LIBGNUTLSCONFIG" != x; then
-           if test "x$have_pthread" = xyes; then
-               { echo "$as_me:$LINENO: WARNING: The current version of GNU TLS cannot be made thread-safe." >&5
- echo "$as_me: WARNING: The current version of GNU TLS cannot be made thread-safe." >&2;}
--          else
--              have_ssl=1
--              SSLLIBS=`$LIBGNUTLSCONFIG --libs`
--              SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
--              cat >>confdefs.h <<\_ACEOF
-+          fi
-+          have_ssl=1
-+          SSLLIBS=`$LIBGNUTLSCONFIG --libs`
-+          SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
-+          cat >>confdefs.h <<\_ACEOF
- #define HAVE_SSL 1
- _ACEOF
--              cat >>confdefs.h <<\_ACEOF
-+          cat >>confdefs.h <<\_ACEOF
- #define HAVE_GNUTLS 1
- _ACEOF
--          fi
-       fi
-       if test $have_ssl = 1; then
diff --git a/cups/patches/cups-getpass.patch b/cups/patches/cups-getpass.patch
deleted file mode 100644 (file)
index 1c1da96..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-diff -up cups-1.4.4/cups/usersys.c.getpass cups-1.4.4/cups/usersys.c
---- cups-1.4.4/cups/usersys.c.getpass  2010-03-30 23:07:33.000000000 +0100
-+++ cups-1.4.4/cups/usersys.c  2010-06-18 09:38:08.368096897 +0100
-@@ -41,6 +41,8 @@
- #include "globals.h"
- #include <stdlib.h>
- #include <sys/stat.h>
-+#include <termios.h>
-+#include <signal.h>
- #ifdef WIN32
- #  include <windows.h>
- #else
-@@ -406,7 +408,29 @@ _cupsGetPassword(const char *prompt)      /* 
-   * Use the standard getpass function to get a password from the console.
-   */
--  return (getpass(prompt));
-+  static char password[100];
-+  struct termios oldtio, newtio;
-+  sigset_t oldset, newset;
-+  int nread;
-+  sigprocmask (SIG_BLOCK, NULL, &newset);
-+  sigaddset (&newset, SIGINT);
-+  sigaddset (&newset, SIGTSTP);
-+  sigprocmask (SIG_BLOCK, &newset, &oldset);
-+  tcgetattr (STDIN_FILENO, &oldtio);
-+  newtio = oldtio;
-+  newtio.c_lflag &= ~ECHO;
-+  tcsetattr (STDIN_FILENO, TCSAFLUSH, &newtio);
-+  fputs (prompt, stdout);
-+  fflush (stdout);
-+  nread = read (STDIN_FILENO, password, sizeof (password));
-+  tcsetattr (STDIN_FILENO, TCSAFLUSH, &oldtio);
-+  fputc ('\n', stdout);
-+  sigprocmask (SIG_SETMASK, &oldset, NULL);
-+  if (nread > 0)
-+    password[nread - 1] = '\0';
-+  else
-+    password[0] ='\0';
-+  return password;
- #endif /* WIN32 */
- }
diff --git a/cups/patches/cups-hostnamelookups.patch b/cups/patches/cups-hostnamelookups.patch
deleted file mode 100644 (file)
index 75b6abf..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -up cups-1.4.4/scheduler/network.c.hostnamelookups cups-1.4.4/scheduler/network.c
---- cups-1.4.4/scheduler/network.c.hostnamelookups     2010-04-09 23:42:09.000000000 +0100
-+++ cups-1.4.4/scheduler/network.c     2010-06-18 11:13:02.331979867 +0100
-@@ -154,11 +154,7 @@ cupsdNetIFUpdate(void)
-     * Try looking up the hostname for the address as needed...
-     */
--#ifdef __APPLE__
-     if (HostNameLookups)
--#else
--    if (HostNameLookups || RemotePort)
--#endif /* __APPLE__ */
-       httpAddrLookup((http_addr_t *)(addr->ifa_addr), hostname,
-                      sizeof(hostname));
-     else
-@@ -166,7 +162,7 @@ cupsdNetIFUpdate(void)
-      /*
-       * Map the default server address and localhost to the server name
-       * and localhost, respectively; for all other addresses, use the
--      * dotted notation...
-+      * numeric address...
-       */
-       if (httpAddrLocalhost((http_addr_t *)(addr->ifa_addr)))
diff --git a/cups/patches/cups-no-export-ssllibs.patch b/cups/patches/cups-no-export-ssllibs.patch
deleted file mode 100644 (file)
index 9effc8e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up cups-1.4b2-svn8404/config-scripts/cups-ssl.m4.no-export-ssllibs cups-1.4b2-svn8404/config-scripts/cups-ssl.m4
---- cups-1.4b2-svn8404/config-scripts/cups-ssl.m4.no-export-ssllibs    2009-02-17 17:45:27.000000000 +0000
-+++ cups-1.4b2-svn8404/config-scripts/cups-ssl.m4      2009-03-05 11:12:59.000000000 +0000
-@@ -110,7 +110,7 @@ fi
- AC_SUBST(SSLFLAGS)
- AC_SUBST(SSLLIBS)
--EXPORT_SSLLIBS="$SSLLIBS"
-+EXPORT_SSLLIBS=""
- AC_SUBST(EXPORT_SSLLIBS)
diff --git a/cups/patches/cups-no-gzip-man.patch b/cups/patches/cups-no-gzip-man.patch
deleted file mode 100644 (file)
index 4a08503..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-diff -up cups-1.4b2-svn8404/config-scripts/cups-manpages.m4.no-gzip-man cups-1.4b2-svn8404/config-scripts/cups-manpages.m4
---- cups-1.4b2-svn8404/config-scripts/cups-manpages.m4.no-gzip-man     2009-01-16 08:58:42.000000000 +0000
-+++ cups-1.4b2-svn8404/config-scripts/cups-manpages.m4 2009-03-05 11:11:12.000000000 +0000
-@@ -69,10 +69,10 @@ case "$uname" in
-               ;;
-       Linux* | GNU* | Darwin*)
-               # Linux, GNU Hurd, and Mac OS X
--              MAN1EXT=1.gz
--              MAN5EXT=5.gz
--              MAN7EXT=7.gz
--              MAN8EXT=8.gz
-+              MAN1EXT=1
-+              MAN5EXT=5
-+              MAN7EXT=7
-+              MAN8EXT=8
-               MAN8DIR=8
-               ;;
-       *)
diff --git a/cups/patches/cups-page-label.patch b/cups/patches/cups-page-label.patch
deleted file mode 100644 (file)
index 220b31d..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-diff -up cups-1.4.5/filter/pstops.c.page-label cups-1.4.5/filter/pstops.c
---- cups-1.4.5/filter/pstops.c.page-label      2010-08-31 20:36:08.000000000 +0200
-+++ cups-1.4.5/filter/pstops.c 2010-11-12 13:11:11.000000000 +0100
-@@ -108,6 +108,7 @@ typedef struct                             /**** Document informa
-   int         num_options;            /* Number of document-wide options */
-   cups_option_t       *options;               /* Document-wide options */
-   int         normal_landscape,       /* Normal rotation for landscape? */
-+              orientation,            /* Original orientation of the document */
-               saw_eof,                /* Saw the %%EOF comment? */
-               slow_collate,           /* Collate copies by hand? */
-               slow_duplex,            /* Duplex pages slowly? */
-@@ -2083,7 +2084,7 @@ do_setup(pstops_doc_t *doc,              /* I - Docu
-     * of the pages...
-     */
--    if (Orientation & 1)
-+    if (doc->orientation & 1)
-       write_label_prolog(doc, doc->page_label, PageBottom,
-                          PageWidth - PageLength + PageTop, PageLength);
-     else
-@@ -2091,7 +2092,30 @@ do_setup(pstops_doc_t *doc,             /* I - Docu
-                          PageLength);
-   }
-   else
--    write_label_prolog(doc, doc->page_label, PageBottom, PageTop, PageWidth);
-+  {
-+    switch (doc->orientation)
-+    {
-+      case 0 :
-+        write_label_prolog(doc, doc->page_label, PageBottom, PageTop, 
-+                             PageWidth);
-+          break;
-+
-+      case 1 :
-+        write_label_prolog(doc, doc->page_label, PageLeft, PageRight, 
-+                             PageLength);
-+          break;
-+
-+      case 2 :
-+        write_label_prolog(doc, doc->page_label, PageLength - PageTop, 
-+                             PageLength - PageBottom, PageWidth);
-+          break;
-+
-+      case 3 :
-+        write_label_prolog(doc, doc->page_label, PageWidth - PageRight, 
-+                             PageWidth - PageLeft, PageLength);
-+          break;
-+    }
-+  }
- }
-@@ -2176,7 +2200,7 @@ end_nup(pstops_doc_t *doc,               /* I - Docum
-     case 1 :
-       if (doc->use_ESPshowpage)
-       {
--        write_labels(doc, Orientation);
-+        write_labels(doc, doc->orientation);
-           doc_puts(doc, "ESPshowpage\n");
-       }
-       break;
-@@ -2191,7 +2215,7 @@ end_nup(pstops_doc_t *doc,               /* I - Docum
-           * Rotate the labels back to portrait...
-           */
--          write_labels(doc, Orientation - 1);
-+          write_labels(doc, doc->orientation - 1);
-         }
-         else if (Orientation == 0)
-         {
-@@ -2217,7 +2241,7 @@ end_nup(pstops_doc_t *doc,               /* I - Docum
-     default :
-       if (is_last_page(number) && doc->use_ESPshowpage)
-       {
--        write_labels(doc, Orientation);
-+        write_labels(doc, doc->orientation);
-           doc_puts(doc, "ESPshowpage\n");
-       }
-         break;
-@@ -2433,6 +2457,12 @@ set_pstops_options(
-     Orientation = 0;
-  /*
-+  * Save original orientation of the document
-+  */
-+
-+  doc->orientation = Orientation;
-+
-+ /*
-   * AP_FIRSTPAGE_* and the corresponding non-first-page options.
-   */
diff --git a/cups/patches/cups-peercred.patch b/cups/patches/cups-peercred.patch
deleted file mode 100644 (file)
index 4e579b4..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -up cups-1.3.5/scheduler/auth.c.peercred cups-1.3.5/scheduler/auth.c
---- cups-1.3.5/scheduler/auth.c.peercred       2008-02-05 16:52:20.000000000 +0000
-+++ cups-1.3.5/scheduler/auth.c        2008-02-05 18:20:06.000000000 +0000
-@@ -54,6 +54,7 @@
-  * Include necessary headers...
-  */
-+#define _GNU_SOURCE
- #include "cupsd.h"
- #include <grp.h>
- #ifdef HAVE_SHADOW_H
diff --git a/cups/patches/cups-res_init.patch b/cups/patches/cups-res_init.patch
deleted file mode 100644 (file)
index 22c75ba..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up cups-1.4b2-svn8404/cups/http-addrlist.c.res_init cups-1.4b2-svn8404/cups/http-addrlist.c
---- cups-1.4b2-svn8404/cups/http-addrlist.c.res_init   2009-03-23 17:41:03.000000000 +0000
-+++ cups-1.4b2-svn8404/cups/http-addrlist.c    2009-03-23 17:41:26.000000000 +0000
-@@ -373,7 +373,7 @@ httpAddrGetList(const char *hostname,      /*
-       freeaddrinfo(results);
-     }
--    else if (error == EAI_FAIL)
-+    else if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA)
-       cg->need_res_init = 1;
- #else
diff --git a/cups/patches/cups-serial.patch b/cups/patches/cups-serial.patch
deleted file mode 100644 (file)
index 6e111f2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -up cups-1.4b2/backend/serial.c.serial cups-1.4b2/backend/serial.c
---- cups-1.4b2/backend/serial.c.serial 2008-12-16 16:25:02.000000000 +0000
-+++ cups-1.4b2/backend/serial.c        2008-12-16 16:25:21.000000000 +0000
-@@ -74,6 +74,7 @@
- #endif /* __APPLE__ */
- #if defined(__linux) && defined(TIOCGSERIAL)
-+#  include <linux/types.h>
- #  include <linux/serial.h>
- #  include <linux/ioctl.h>
- #endif /* __linux && TIOCGSERIAL */
diff --git a/cups/patches/cups-serialize-gnutls.patch b/cups/patches/cups-serialize-gnutls.patch
deleted file mode 100644 (file)
index cdd82cb..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-diff -up cups-1.4.4/cups/http.c.serialize-gnutls cups-1.4.4/cups/http.c
---- cups-1.4.4/cups/http.c.serialize-gnutls    2010-09-17 13:37:01.858871762 +0100
-+++ cups-1.4.4/cups/http.c     2010-09-17 13:55:22.579871934 +0100
-@@ -149,7 +149,7 @@ static int         http_write_ssl(http_t *http,
- #  ifdef HAVE_GNUTLS
- #    ifdef HAVE_PTHREAD_H
--GCRY_THREAD_OPTION_PTHREAD_IMPL;
-+static pthread_mutex_t gnutls_lock;
- #    endif /* HAVE_PTHREAD_H */
- #  elif defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H)
-@@ -1231,7 +1231,7 @@ httpInitialize(void)
-   */
- #  ifdef HAVE_PTHREAD_H
--  gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
-+  pthread_mutex_init(&gnutls_lock, NULL);
- #  endif /* HAVE_PTHREAD_H */
-  /*
-@@ -2228,6 +2228,7 @@ _httpWait(http_t *http,                  /* I - Connect
-     if (SSL_pending((SSL *)(http->tls)))
-       return (1);
- #  elif defined(HAVE_GNUTLS)
-+    /* lock already held here... */
-     if (gnutls_record_check_pending(((http_tls_t *)(http->tls))->session))
-       return (1);
- #  elif defined(HAVE_CDSASSL)
-@@ -2294,6 +2295,8 @@ int                                      /* O - 1 if data is available, 0
- httpWait(http_t *http,                        /* I - Connection to server */
-          int    msec)                 /* I - Milliseconds to wait */
- {
-+  int ret;
-+
-  /*
-   * First see if there is data in the buffer...
-   */
-@@ -2318,7 +2321,17 @@ httpWait(http_t *http,                  /* I - Connecti
-   * If not, check the SSL/TLS buffers and do a select() on the connection...
-   */
--  return (_httpWait(http, msec, 1));
-+#if defined(HAVE_SSL) && defined(HAVE_GNUTLS) && defined(HAVE_PTHREAD_H)
-+  pthread_mutex_lock(&gnutls_lock);
-+#endif
-+
-+  ret = _httpWait(http, msec, 1);
-+
-+#if defined(HAVE_SSL) && defined(HAVE_GNUTLS) && defined(HAVE_PTHREAD_H)
-+  pthread_mutex_unlock(&gnutls_lock);
-+#endif
-+
-+  return (ret);
- }
-@@ -2769,7 +2782,9 @@ http_read_ssl(http_t *http,              /* I - Conn
-   ssize_t     result;                 /* Return value */
-+  pthread_mutex_lock(&gnutls_lock);
-   result = gnutls_record_recv(((http_tls_t *)(http->tls))->session, buf, len);
-+  pthread_mutex_unlock(&gnutls_lock);
-   if (result < 0 && !errno)
-   {
-@@ -3085,6 +3100,7 @@ http_setup_ssl(http_t *http)             /* I - Con
-     return (-1);
-   }
-+  pthread_mutex_lock(&gnutls_lock);
-   gnutls_certificate_allocate_credentials(credentials);
-   gnutls_init(&(conn->session), GNUTLS_CLIENT);
-@@ -3104,9 +3120,11 @@ http_setup_ssl(http_t *http)            /* I - Con
-     free(credentials);
-     free(conn);
-+    pthread_mutex_unlock(&gnutls_lock);
-     return (-1);
-   }
-+  pthread_mutex_unlock(&gnutls_lock);
-   conn->credentials = credentials;
- #  elif defined(HAVE_CDSASSL)
-@@ -3196,9 +3214,11 @@ http_shutdown_ssl(http_t *http)         /* I - 
-   conn = (http_tls_t *)(http->tls);
-   credentials = (gnutls_certificate_client_credentials *)(conn->credentials);
-+  pthread_mutex_lock(&gnutls_lock);
-   gnutls_bye(conn->session, GNUTLS_SHUT_RDWR);
-   gnutls_deinit(conn->session);
-   gnutls_certificate_free_credentials(*credentials);
-+  pthread_mutex_unlock(&gnutls_lock);
-   free(credentials);
-   free(conn);
-@@ -3445,7 +3465,9 @@ http_write_ssl(http_t     *http, /* I - 
- #  elif defined(HAVE_GNUTLS)
-   ssize_t     result;                 /* Return value */
-+  pthread_mutex_lock(&gnutls_lock);
-   result = gnutls_record_send(((http_tls_t *)(http->tls))->session, buf, len);
-+  pthread_mutex_unlock(&gnutls_lock);
-   if (result < 0 && !errno)
-   {
diff --git a/cups/patches/cups-snmp-quirks.patch b/cups/patches/cups-snmp-quirks.patch
deleted file mode 100644 (file)
index 0308676..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-diff -up cups-1.4.3/backend/snmp-supplies.c.snmp-quirks cups-1.4.3/backend/snmp-supplies.c
---- cups-1.4.3/backend/snmp-supplies.c.snmp-quirks     2009-11-20 01:27:57.000000000 +0000
-+++ cups-1.4.3/backend/snmp-supplies.c 2010-06-09 16:27:05.515019804 +0100
-@@ -38,6 +38,13 @@
- /*
-+ * Printer quirks...
-+ */
-+
-+#define QUIRK_CAPACITY        (1<<0)
-+
-+
-+/*
-  * Local structures...
-  */
-@@ -57,6 +64,12 @@ typedef struct                              /**** Printer state ta
-   const char  *keyword;               /* IPP printer-state-reasons keyword */
- } backend_state_t;
-+typedef struct                                /**** Quirk names table ****/
-+{
-+  int         bit;                    /* Quirk bit */
-+  const char  *keyword;               /* cupsSNMPQuirks keyword */
-+} quirk_name_t;
-+
- /*
-  * Local globals...
-@@ -68,6 +81,7 @@ static int           current_state = -1;
- static int            charset = -1;   /* Character set for supply names */
- static int            num_supplies = 0;
-                                       /* Number of supplies found */
-+static int            quirks = 0;     /* Printer quirks */
- static backend_supplies_t supplies[CUPS_MAX_SUPPLIES];
-                                       /* Supply information */
-@@ -153,6 +167,15 @@ static const backend_state_t const print
-                         { CUPS_TC_outputFull, "output-area-full-warning" }
-                       };
-+static const quirk_name_t const quirk_names[] =
-+                      {
-+                       /*
-+                        * The prtMarkerSuppliesLevel values are
-+                        * percentages, not levels relative to the
-+                        * stated capacity.
-+                        */
-+                        { QUIRK_CAPACITY, "capacity" }
-+                      };
- /*
-  * Local functions...
-@@ -208,6 +231,9 @@ backendSNMPSupplies(
-       if (i)
-         *ptr++ = ',';
-+      if (quirks & QUIRK_CAPACITY)
-+      supplies[i].max_capacity = 100;
-+
-       if (supplies[i].max_capacity > 0)
-         sprintf(ptr, "%d", 100 * supplies[i].level / supplies[i].max_capacity);
-       else
-@@ -305,6 +331,7 @@ backend_init_supplies(
-     http_addr_t *addr)                        /* I - Printer address */
- {
-   int         i,                      /* Looping var */
-+              len,                    /* Quirk name length */
-               type;                   /* Current marker type */
-   cups_file_t *cachefile;             /* Cache file */
-   const char  *cachedir;              /* CUPS_CACHEDIR value */
-@@ -366,6 +393,7 @@ backend_init_supplies(
-   current_state = -1;
-   num_supplies  = -1;
-   charset       = -1;
-+  quirks      = 0;
-   memset(supplies, 0, sizeof(supplies));
-@@ -381,6 +409,34 @@ backend_init_supplies(
-     return;
-   }
-+  if (ppd &&
-+      (ppdattr = ppdFindAttr(ppd, "cupsSNMPQuirks", NULL)) != NULL &&
-+      ppdattr->value)
-+  {
-+    ptr = ppdattr->value;
-+    while (*ptr != '\0')
-+    {
-+     /*
-+      * Match keyword against quirk_names table.
-+      */
-+
-+      for (i = 0; i < sizeof (quirk_names) / sizeof (quirk_names[0]); i++)
-+      {
-+      len = strlen (quirk_names[i].keyword);
-+      if (!strncmp (ptr, quirk_names[i].keyword, len) &&
-+          (ptr[len] == '\0' || ptr[len] == ' '))
-+        quirks |= quirk_names[i].bit;
-+      }
-+
-+     /*
-+      * Advance to next keyword.
-+      */
-+
-+      ptr += strcspn (ptr, " ");
-+      ptr += strspn (ptr, " ");
-+    }
-+  }
-+
-   ppdClose(ppd);
-  /*
diff --git a/cups/patches/cups-str3754.patch b/cups/patches/cups-str3754.patch
deleted file mode 100644 (file)
index 148575a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -up cups-1.4.5/scheduler/printers.c.printer-timeout cups-1.4.5/scheduler/printers.c
---- cups-1.4.5/scheduler/printers.c.printer-timeout    2010-12-16 14:42:07.048865052 +0000
-+++ cups-1.4.5/scheduler/printers.c    2010-12-16 14:43:05.325684376 +0000
-@@ -785,6 +785,7 @@ cupsdDeletePrinter(
-   */
-   cupsdSetPrinterState(p, IPP_PRINTER_STOPPED, update);
-+  p->state = IPP_PRINTER_STOPPED;
-   if (p->job)
-     cupsdSetJobState(p->job, IPP_JOB_PENDING, CUPSD_JOB_FORCE,
diff --git a/cups/patches/cups-texttops-rotate-page.patch b/cups/patches/cups-texttops-rotate-page.patch
deleted file mode 100644 (file)
index 2b048cd..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-diff -up cups-1.4.3/filter/texttops.c.texttops-rotate-page cups-1.4.3/filter/texttops.c
---- cups-1.4.3/filter/texttops.c.texttops-rotate-page  2008-11-06 16:42:18.000000000 +0000
-+++ cups-1.4.3/filter/texttops.c       2010-05-18 16:42:23.669940884 +0100
-@@ -97,6 +97,13 @@ WritePage(void)
-   puts("gsave");
-+  /* If we're opereating in Landscape (Orientation == 1 or Orientation == 3)
-+     then rotate and translate the page */
-+  if ( Orientation & 1 ) {
-+    printf ("%d rotate\n", (Orientation & 3) * 90 );
-+    printf("0 %.0f neg translate\n", PageLength);
-+  }
-+
-   if (PrettyPrint)
-     printf("%d H\n", NumPages);
-@@ -212,7 +219,7 @@ WriteProlog(const char *title,             /* I - T
-   puts("%!PS-Adobe-3.0");
-   printf("%%%%BoundingBox: 0 0 %.0f %.0f\n", PageWidth, PageLength);
--  printf("%%cupsRotation: %d\n", (Orientation & 3) * 90);
-+  puts("%cupsRotation: 0");
-   puts("%%Creator: texttops/" CUPS_SVERSION);
-   printf("%%%%CreationDate: %s\n", curdate);
-   WriteTextComment("Title", title);
-@@ -549,6 +556,8 @@ WriteProlog(const char *title,             /* I - T
-   puts("%%EndComments");
-   puts("%%BeginProlog");
-+  printf("%%%%Orientation: %s\n", 
-+         Orientation & 1 ? "Landscape" : "Portrait");
-  /*
-   * Download any missing fonts...
index ae668ab119841182090e8e69e1a9af8437eeb5b1..dfb87b817d0352c43ad8ab5f926cb29d4efa7ae0 100644 (file)
@@ -1,10 +1,15 @@
 [Unit]
-Description=CUPS Printing Service
+Description=CUPS scheduler
+Requires=printer.target
+After=syslog.target
 
 [Service]
-ExecStart=/usr/sbin/cupsd -f -c /etc/cups/cupsd.conf
-ExecStartPost=/sbin/udevadm trigger --subsystem-match=usb --attr-match=serial=AL01077498
+Type=forking
+PIDFile=/var/run/cupsd.pid
+ExecStartPre=/usr/sbin/cupsd -t
+ExecStart=/usr/sbin/cupsd
+ExecStartPost=/sbin/udevadm trigger --subsystem-match=usb --attr-match=bInterfaceClass=07 --attr-match=bInterfaceSubClass=01 --action=add
+ExecStartPost=/sbin/udevadm trigger --subsystem-match=usb --property-match=DEVNAME="/dev/usb/lp*" --action=add
 
 [Install]
 WantedBy=multi-user.target
-
index 2c79f96f551c4d67f5f50aea1cd7a3015b9f31f5..d0bc7d0c45199bbb686a5685c9aedd4fb8bea492 100644 (file)
@@ -4,8 +4,8 @@
 ###############################################################################
 
 name       = expat
-version    = 2.0.1
-release    = 3
+version    = 2.1.0
+release    = 1
 
 groups     = System/Libraries
 url        = http://www.libexpat.org/
index 69f6fd2b1f8861b81a5883a0cd957883da6eda89..2937ab62633190e509644923a2ee83e20646016e 100644 (file)
@@ -7,8 +7,8 @@
 build_cloog_ppl = 1
 
 name       = gcc
-version    = 4.7.1
-release    = 3
+version    = 4.7.2
+release    = 2
 
 maintainer = Michael Tremer <michael.tremer@ipfire.org>
 groups     = Development/Compilers
index 813713d6323f779f416b7bf3b7d4457230c88057..d8f430ce98fdf570886508b546c12c91cbaf6a8b 100644 (file)
@@ -383,7 +383,7 @@ diff -Nur gcc-4.7.0-vanilla/gcc/configure gcc-4.7.0/gcc/configure
 +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can default to use -fstack-protector" >&5
 +$as_echo_n "checking if we can default to use -fstack-protector... " >&6; }
 +  ssp_link_test=no
-+  if test x$gcc_cv_libc_provides_ssp = xyes && test x$set_have_as_tls = yes; then
++  if test x$gcc_cv_libc_provides_ssp = xyes && test x$set_have_as_tls = xyes; then
 +    if $EGREP '^      *#[     ]*define[       ]+__UCLIBC__[   ]+1' \
 +       $target_header_dir/features.h > /dev/null; then
 +      if test -f $target_header_dir/bits/uClibc_config.h && \
index 9ba6900fb88119bff8d8622072973beb104a6b7c..e7a073dae0adf887a6a92fd38ed0db60476fde0a 100644 (file)
@@ -4,12 +4,12 @@
 ###############################################################################
 
 name       = gdbm
-version    = 1.8.3
-release    = 2
+version    = 1.10
+release    = 1
 
 groups     = Development/Tools
 url        = http://www.gnu.org/software/gdbm/
-license    = GPL
+license    = GPLv3+
 summary    = The GDBM package contains the GNU Database Manager.
 
 description
@@ -19,17 +19,22 @@ description
        retrieved in less time than if it was stored in a text file.
 end
 
-source_dl  =
+source_dl  = http://ftp.gnu.org/gnu/gdbm/
 
 build
-       prepare_cmds
-               sed -i Makefile.* \
-                       -e "s/^BINOWN = .*/BINOWN = root/" \
-                       -e "s/^BINGRP = .*/BINGRP = root/"
+       requires
+               gettext
+               libtool
        end
 
-       install
-               make install install-compat INSTALL_ROOT=%{BUILDROOT}
+       configure_options += \
+               --enable-libgdbm-compat
+
+       install_cmds
+               mkdir -pv %{BUILDROOT}%{includedir}/gdbm
+               ln -svf ../gdbm.h %{BUILDROOT}%{includedir}/gdbm/gdbm.h
+               ln -svf ../ndbm.h %{BUILDROOT}%{includedir}/gdbm/ndbm.h
+               ln -svf ../dbm.h  %{BUILDROOT}%{includedir}/gdbm/dbm.h
        end
 end
 
diff --git a/gdbm/patches/gdbm-1.10-fedora.patch b/gdbm/patches/gdbm-1.10-fedora.patch
new file mode 100644 (file)
index 0000000..18a4d5e
--- /dev/null
@@ -0,0 +1,14 @@
+diff -up gdbm-1.10/NOTE-WARNING.fedora gdbm-1.10/NOTE-WARNING
+--- gdbm-1.10/NOTE-WARNING.fedora      2011-11-14 17:43:41.267566501 +0100
++++ gdbm-1.10/NOTE-WARNING     2011-11-14 17:47:53.312549265 +0100
+@@ -12,8 +12,8 @@ systems where it is not the default.  `L
+ when a system uses 64bit file offsets.  Gdbm has, of course, supported `large
+ files' on systems where it was the default for a very long time.
+-On some systems, such as Solaris, this functionality is not enabled by
+-default.  Gdbm will now enable it.  THIS MEANS THAT GDBM 1.9 MAY NOT BE
++On some systems this functionality is not enabled by default. To enable it, 
++build rpm with option --with=largefile. THIS MEANS THAT GDBM 1.9 MAY NOT BE 
+ ABLE TO ACCESS DATABASES CREATED BY PREVIOUS VERIONS ON THE SAME SYSTEM.
+ Running the `configure' script with the `--disable-largefile' flag should
diff --git a/gdbm/patches/gdbm-1.10-zeroheaders.patch b/gdbm/patches/gdbm-1.10-zeroheaders.patch
new file mode 100644 (file)
index 0000000..a268f6b
--- /dev/null
@@ -0,0 +1,33 @@
+diff -up gdbm-1.10/src/falloc.c.zeroheaders gdbm-1.10/src/falloc.c
+--- gdbm-1.10/src/falloc.c.zeroheaders 2011-11-11 11:59:11.000000000 +0100
++++ gdbm-1.10/src/falloc.c     2011-11-14 17:34:32.487604027 +0100
+@@ -255,7 +255,7 @@ push_avail_block (GDBM_FILE dbf)
+   /* Split the header block. */
+-  temp = (avail_block *) malloc (av_size);
++  temp = (avail_block *) calloc (1, av_size);
+   if (temp == NULL) _gdbm_fatal (dbf, _("malloc error"));
+   /* Set the size to be correct AFTER the pop_avail_block. */
+   temp->size = dbf->header->avail.size;
+diff -up gdbm-1.10/src/gdbmopen.c.zeroheaders gdbm-1.10/src/gdbmopen.c
+--- gdbm-1.10/src/gdbmopen.c.zeroheaders       2011-11-11 19:39:42.000000000 +0100
++++ gdbm-1.10/src/gdbmopen.c   2011-11-14 17:33:24.867608650 +0100
+@@ -264,7 +264,7 @@ gdbm_open (const char *file, int block_s
+       (dbf->header->block_size - sizeof (hash_bucket))
+       / sizeof (bucket_element) + 1;
+       dbf->header->bucket_size  = dbf->header->block_size;
+-      dbf->bucket = (hash_bucket *) malloc (dbf->header->bucket_size);
++      dbf->bucket = (hash_bucket *) calloc (1, dbf->header->bucket_size);
+       if (dbf->bucket == NULL)
+       {
+         gdbm_close (dbf);
+@@ -456,7 +456,7 @@ _gdbm_init_cache(GDBM_FILE dbf, size_t s
+       for(index = 0; index < size; index++)
+         {
+           (dbf->bucket_cache[index]).ca_bucket
+-            = (hash_bucket *) malloc (dbf->header->bucket_size);
++            = (hash_bucket *) calloc (1, dbf->header->bucket_size);
+           if ((dbf->bucket_cache[index]).ca_bucket == NULL)
+           {
+               gdbm_errno = GDBM_MALLOC_ERROR;
index fa829f30b5957b489af88176024c7bab68d40e97..44d64d6f0591333b5e64b6696d03aa9a767f65f6 100644 (file)
@@ -4,7 +4,7 @@
 ###############################################################################
 
 name       = gnutls
-version    = 3.1.0
+version    = 3.1.2
 release    = 1
 
 groups     = System/Libraries
diff --git a/harfbuzz/harfbuzz.nm b/harfbuzz/harfbuzz.nm
new file mode 100644 (file)
index 0000000..7ab7e1e
--- /dev/null
@@ -0,0 +1,44 @@
+###############################################################################
+# IPFire.org    - An Open Source Firewall Solution                            #
+# Copyright (C) - IPFire Development Team <info@ipfire.org>                   #
+###############################################################################
+
+name       = harfbuzz
+version    = 0.9.4
+release    = 1
+
+groups     = System/Libraries
+url        = http://freedesktop.org/wiki/Software/HarfBuzz
+license    = MIT
+summary    = A text shaping library.
+
+description
+       HarfBuzz is an implementation of the OpenType Layout engine.
+end
+
+source_dl  = http://www.freedesktop.org/software/harfbuzz/release/
+sources    = %{thisapp}.tar.bz2
+
+build
+       requires
+               cairo-devel
+               freetype-devel
+               glib2-devel
+       end
+
+       test
+               make check
+       end
+end
+
+packages
+       package %{name}
+
+       package %{name}-devel
+               template DEVEL
+       end
+
+       package %{name}-debuginfo
+               template DEBUGINFO
+       end
+end
index cd3a8a2f65ed164a6ea21d6ec4c4157f6d84294c..b09973a8ac89cc11dd2267a4099e17903657f152 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = hplip
 version    = 3.10.9
-release    = 1
+release    = 3
 
 groups     = Applications/Printing
 url        = http://hplipopensource.com/hplip-web/index.html
@@ -13,14 +13,14 @@ license    = GPLv2*
 summary    = HP Printer/Scanner Library (full version).
 
 description
-       HPLIP (Hewlett-Packard Linux Imaging & Printing) is an HP-developed \
-       olution for printing, scanning, and faxing with HP inkjet and laser based \
-       printers in Linux. The HPLIP project provides printing support for 1,924 \
-       printer models. \
+       HPLIP (Hewlett-Packard Linux Imaging & Printing) is an HP-developed
+       olution for printing, scanning, and faxing with HP inkjet and laser based
+       printers in Linux. The HPLIP project provides printing support for 1,924
+       printer models.
        This is the full version including printer/scanner support.
 end
 
-source_dl  =
+source_dl  = http://sourceforge.net/projects/%{name}/files/%{name}/%{version}/
 
 build
        requires
@@ -33,17 +33,81 @@ build
                libtool
                libusb-compat-devel
                net-snmp-devel
+               openssl-devel
                pkg-config
                python-devel
                sane-devel
        end
 
        configure_options += \
-               --sysconfdir=/etc
+               --sysconfdir=%{sysconfdir} \
+               --disable-gui-build \
+               --disable-qt4
+
+       install_cmds
+               # Remove unwanted files.
+               rm -rvf %{BUILDROOT}%{bindir}/hp-systray
+               rm -rvf %{BUILDROOT}%{sysconfdir}/sane.d/
+               rm -rvf %{BUILDROOT}%{datadir}/installer
+
+               # Remove files for HAL.
+               rm -rvf %{BUILDROOT}%{datadir}/hal
+
+               # Remove X11 relevated files.
+               rm -rvf %{BUILDROOT}%{datadir}/applications/
+
+               # Remove xdg files.
+               rm -rvf %{BUILDROOT}%{sysconfdir}/xdg/
+       end
 end
 
 packages
        package %{name}
+               requires
+                       %{name}-common=%{thisver}
+                       cups
+               end
+       end
+
+       package %{name}-common
+               summary = Files needed by the HPLIP printer and scanner drivers.
+               description = %{summary}
+
+               files
+                       %{libdir}/udev/
+                       %{libdir}/python*/
+                       %{sysconfdir}/udev/
+                       %{datadir}/hplip
+               end
+       end
+
+       package %{name}-libs
+               template LIBS
+       end
+       
+       package %{name}-devel
+               template DEVEL
+       end
+
+       package libsane-hpaio
+               summary = SANE driver for scanners in HP's multi-function devices.
+               description = %{summary}
+
+               prerequires += sane
+
+               files
+                       %{libdir}/sane/*
+               end
+
+               script postin
+                       # Add hplip scanner support to sane.
+                       echo "hpaio" >> %{sysconfdir}/sane.d/dll.conf
+               end
+
+               script postun
+                       # Remove hplip scanner support from sane.
+                       sed -i "/^hpaio$/d" %{sysconfdir}/sane.d/dll.conf
+               end
        end
 
        package %{name}-debuginfo
index b171219e692462a97f13e44c193fa33dd660e2cf..0941a42fe8b4e1cab569edb3500b9c5726520fdd 100644 (file)
@@ -6,7 +6,7 @@
 name       = initscripts
 epoch      = 1
 version    = 2.99
-release    = 17
+release    = 18
 
 groups     = System/Boot
 url        =
diff --git a/initscripts/patches/0001-ipcalc-Enhance-to-implode-explode-IPv6-addresses.patch b/initscripts/patches/0001-ipcalc-Enhance-to-implode-explode-IPv6-addresses.patch
new file mode 100644 (file)
index 0000000..abba71f
--- /dev/null
@@ -0,0 +1,93 @@
+From 5baf67156ccb7fed775d8bd00298a6ccaed03214 Mon Sep 17 00:00:00 2001
+From: Michael Tremer <michael.tremer@ipfire.org>
+Date: Sun, 9 Sep 2012 21:34:19 +0000
+Subject: [PATCH] ipcalc: Enhance to implode/explode IPv6 addresses.
+
+These functionalities are handy to work with IPv6 addresses
+in shell scripts.
+
+implode:
+Removes all leading zeroes from the IP address:
+  ::0:0:0:1 -> ::1
+
+explode:
+Adds all leading zeroes:
+   ::1 -> 0000:0000:0000:0000:0000:0000:0000:0001
+---
+ src/ipcalc.1 |   10 ++++++++++
+ src/ipcalc.c |   25 +++++++++++++++++++++++++
+ 2 files changed, 35 insertions(+), 0 deletions(-)
+
+diff --git a/src/ipcalc.1 b/src/ipcalc.1
+index 30e0b20..654e2ba 100644
+--- a/src/ipcalc.1
++++ b/src/ipcalc.1
+@@ -51,6 +51,16 @@ Show the prefix for the given mask/IP address.
+ Display the network address for the given IP address and netmask.
+ .TP
++\fB\-i\fR, \fB\-\-implode\fR
++Implodes the given IPv6 address. Returns the shortest possible representation
++of the given IPv6 address.
++
++.TP
++\fB\-e\fR, \fB\-\-explode\fR
++Explodes the given IPv6 address. Adds all leading zeroes and replaces
++:: with zeroes, too.
++
++.TP
+ \fB\-s\fR, \fB\-\-silent\fR 
+ Don't ever display error messages.
+diff --git a/src/ipcalc.c b/src/ipcalc.c
+index 7316f05..c3f4604 100644
+--- a/src/ipcalc.c
++++ b/src/ipcalc.c
+@@ -218,6 +218,7 @@ int main(int argc, const char **argv) {
+     int showHostname = 0, showNetmask = 0;
+     int beSilent = 0;
+     int doCheck = 0, familyIPv4 = 0, familyIPv6 = 0;
++    int implodeIP6Address = 0, explodeIP6Address = 0;
+     int rc;
+     poptContext optCon;
+     char *ipStr, *prefixStr, *netmaskStr, *chptr;
+@@ -246,6 +247,10 @@ int main(int argc, const char **argv) {
+           "Display network prefix", },
+         { "silent", 's', 0, &beSilent, 0,
+           "Don't ever display error messages" },
++        { "implode", 'i', 0, &implodeIP6Address, 0,
++          "Implode given IPv6 address", },
++        { "explode", 'e', 0, &explodeIP6Address, 0,
++          "Explode given IPv6 address", },
+         POPT_AUTOHELP
+         { NULL, '\0', 0, 0, 0, NULL, NULL }
+     };
+@@ -472,5 +477,25 @@ int main(int argc, const char **argv) {
+         printf("HOSTNAME=%s\n", hostName);
+     }
++    if (implodeIP6Address) {
++        if (inet_ntop(AF_INET6, &ip6, namebuf, INET6_ADDRSTRLEN) == NULL) {
++            perror("inet_ntop error");
++            abort();
++        }
++
++        printf("ADDRESS6_IMPL=%s\n", namebuf);
++    }
++
++    if (explodeIP6Address) {
++        sprintf(namebuf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
++            (int)ip6.s6_addr[0], (int)ip6.s6_addr[1], (int)ip6.s6_addr[2], (int)ip6.s6_addr[3],
++            (int)ip6.s6_addr[4], (int)ip6.s6_addr[5], (int)ip6.s6_addr[6], (int)ip6.s6_addr[7],
++            (int)ip6.s6_addr[8], (int)ip6.s6_addr[9], (int)ip6.s6_addr[10], (int)ip6.s6_addr[11],
++            (int)ip6.s6_addr[12], (int)ip6.s6_addr[13], (int)ip6.s6_addr[14], (int)ip6.s6_addr[15]
++        );
++
++        printf("ADDRESS6_EXPL=%s\n", namebuf);
++    }
++
+     return 0;
+ }
+-- 
+1.7.8.2
+
diff --git a/initscripts/patches/0001-ipcalc-Implement-prefix-for-IPv6.patch b/initscripts/patches/0001-ipcalc-Implement-prefix-for-IPv6.patch
new file mode 100644 (file)
index 0000000..8fbde3e
--- /dev/null
@@ -0,0 +1,84 @@
+From 027b87bd2fcfd1aa6fe48a363d51e40ff972f03d Mon Sep 17 00:00:00 2001
+From: Michael Tremer <michael.tremer@ipfire.org>
+Date: Sat, 15 Sep 2012 10:50:32 +0000
+Subject: [PATCH] ipcalc: Implement --prefix for IPv6.
+
+The -p option will now return the prefix of the given IPv6 address.
+
+[root@os src]# ./ipcalc -p 2001:db8:abc:123::1/64
+PREFIX6=2001:db8:abc:123::
+[root@os src]# ./ipcalc -p 2001:db8:abc:123::2/48
+PREFIX6=2001:db8:abc::
+---
+ src/ipcalc.c |   31 ++++++++++++++++++++++++++++---
+ 1 files changed, 28 insertions(+), 3 deletions(-)
+
+diff --git a/src/ipcalc.c b/src/ipcalc.c
+index c3f4604..039f4c7 100644
+--- a/src/ipcalc.c
++++ b/src/ipcalc.c
+@@ -204,6 +204,21 @@ char *get_hostname(int family, void *addr)
+     return hostinfo->h_name;
+ }
++void ipv6_prefix(struct in6_addr *dst, struct in6_addr *addr, unsigned int prefix) {
++    uint8_t i;
++
++    /* Make a copy to work with, because we don't want to alter the input. */
++    memcpy(dst, addr, sizeof(struct in6_addr));
++
++    for (i = 0; i < (128 - prefix) / 8; i++) {
++        dst->s6_addr[15-i] = 0;
++    }
++
++    if ((128 - prefix) % 8) {
++        dst->s6_addr[15-i] &= ~((1 << ((128 - prefix) % 8)) - 1);
++    }
++}
++
+ /*!
+   \fn main(int argc, const char **argv)
+   \brief wrapper program for ipcalc functions.
+@@ -225,7 +240,7 @@ int main(int argc, const char **argv) {
+     char *hostName = NULL;
+     char namebuf[INET6_ADDRSTRLEN+1];
+     struct in_addr ip, netmask, network, broadcast;
+-    struct in6_addr ip6;
++    struct in6_addr ip6, prefix6;
+     int prefix = -1;
+     char errBuf[250];
+     struct poptOption optionsTable[] = {
+@@ -394,7 +409,7 @@ int main(int argc, const char **argv) {
+     }
+     if (familyIPv6 &&
+-        (showBroadcast || showNetmask || showNetwork || showPrefix)) {
++        (showBroadcast || showNetmask || showNetwork)) {
+         if (!beSilent) {
+             fprintf(stderr, "ipcalc: unable to show setting for IPv6\n");
+         }
+@@ -429,10 +444,20 @@ int main(int argc, const char **argv) {
+         printf("NETMASK=%s\n", namebuf);
+     }
+-    if (showPrefix) {
++    if (showPrefix && familyIPv4) {
+         if (prefix == -1)
+             prefix = mask2prefix(ip);
+         printf("PREFIX=%d\n", prefix);
++
++    } else if (showPrefix && familyIPv6) {
++      ipv6_prefix(&prefix6, &ip6, prefix);
++
++      if (inet_ntop(AF_INET6, &prefix6, namebuf, INET6_ADDRSTRLEN) == NULL) {
++              perror("inet_ntop error");
++              abort();
++      }
++
++      printf("PREFIX6=%s\n", namebuf);
+     }
+     if (showBroadcast) {
+-- 
+1.7.8.2
+
diff --git a/iptraf-ng/iptraf-ng.nm b/iptraf-ng/iptraf-ng.nm
new file mode 100644 (file)
index 0000000..353ed31
--- /dev/null
@@ -0,0 +1,55 @@
+###############################################################################
+# IPFire.org    - An Open Source Firewall Solution                            #
+# Copyright (C) - IPFire Development Team <info@ipfire.org>                   #
+###############################################################################
+
+name       = iptraf-ng
+version    = 1.1.3.1
+release    = 1
+
+groups     = Networking/Tools
+url        = https://fedorahosted.org/iptraf-ng/
+license    = GPLv2+
+summary    = A console-based network monitoring utility.
+
+description
+       IPTraf-ng is a console-based network monitoring utility.  IPTraf gathers
+       data like TCP connection packet and byte counts, interface statistics
+       and activity indicators, TCP/UDP traffic breakdowns, and LAN station
+       packet and byte counts.  IPTraf-ng features include an IP traffic monitor
+       which shows TCP flag information, packet and byte counts, ICMP
+       details, OSPF packet types, and oversized IP packet warnings;
+       interface statistics showing IP, TCP, UDP, ICMP, non-IP and other IP
+       packet counts, IP checksum errors, interface activity and packet size
+       counts; a TCP and UDP service monitor showing counts of incoming and
+       outgoing packets for common TCP and UDP application ports, a LAN
+       statistics module that discovers active hosts and displays statistics
+       about their activity; TCP, UDP and other protocol display filters so
+       you can view just the traffic you want; logging; support for Ethernet,
+       FDDI, ISDN, SLIP, PPP, and loopback interfaces; and utilization of the
+       built-in raw socket interface of the Linux kernel, so it can be used
+       on a wide variety of supported network cards.
+end
+
+source_dl  = https://fedorahosted.org/releases/i/p/iptraf-ng/
+
+build
+       requires
+               ncurses-devel
+       end
+
+       install_cmds
+               mkdir -pv %{BUILDROOT}%{localstatedir}/{lock,log,lib}/iptraf-ng
+       end
+end
+
+packages
+       package %{name}
+               # Create an alias for iptraf.
+               provides = iptraf
+       end
+
+       package %{name}-debuginfo
+               template DEBUGINFO
+       end
+end
diff --git a/iptraf-ng/patches/0001-token-ring-kernel-v3.5-kill-off-token-ring-support.patch b/iptraf-ng/patches/0001-token-ring-kernel-v3.5-kill-off-token-ring-support.patch
new file mode 100644 (file)
index 0000000..e5c04cd
--- /dev/null
@@ -0,0 +1,128 @@
+From 72512af1a3f1d55fff73cdfe7b63d9cfe8cc37ab Mon Sep 17 00:00:00 2001
+Message-Id: <72512af1a3f1d55fff73cdfe7b63d9cfe8cc37ab.1337783673.git.npajkovs@redhat.com>
+From: Nikola Pajkovsky <npajkovs@redhat.com>
+Date: Wed, 23 May 2012 16:32:27 +0200
+Subject: [PATCH] token-ring: kernel v3.5 kill off token-ring support
+
+Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
+---
+ src/hostmon.c          |   10 ----------
+ src/iptraf-ng-compat.h |    1 -
+ src/othptab.c          |    6 ------
+ src/packet.c           |   27 ---------------------------
+ src/tcptable.c         |    4 ----
+ 5 files changed, 48 deletions(-)
+
+diff --git a/src/hostmon.c b/src/hostmon.c
+index 40a2b95..72b91f8 100644
+--- a/src/hostmon.c
++++ b/src/hostmon.c
+@@ -1004,16 +1004,6 @@ void hostmon(const struct OPTIONS *options, time_t facilitytime, char *ifptr,
+                                      FDDI_K_ALEN);
+                               list = flist;
+                               break; }
+-                      case ARPHRD_IEEE802:
+-                      case ARPHRD_IEEE802_TR: {
+-                              struct trh_hdr *hdr_trh =
+-                                      (struct trh_hdr *)pkt.pkt_buf;
+-                              memcpy(scratch_saddr, hdr_trh->saddr,
+-                                     TR_ALEN);
+-                              memcpy(scratch_daddr, hdr_trh->daddr,
+-                                     TR_ALEN);
+-                              list = flist;
+-                              break; }
+                       default:
+                               /* unknown link protocol */
+                               continue;
+diff --git a/src/iptraf-ng-compat.h b/src/iptraf-ng-compat.h
+index d5aee4a..2d9da96 100644
+--- a/src/iptraf-ng-compat.h
++++ b/src/iptraf-ng-compat.h
+@@ -39,7 +39,6 @@
+ #include <linux/if_ether.h>
+ #include <linux/if_packet.h>
+ #include <linux/if_fddi.h>
+-#include <linux/if_tr.h>
+ #include <linux/types.h>
+ #include <linux/isdn.h>
+diff --git a/src/othptab.c b/src/othptab.c
+index d12cdfd..1181eb1 100644
+--- a/src/othptab.c
++++ b/src/othptab.c
+@@ -193,12 +193,6 @@ struct othptabent *add_othp_entry(struct othptable *table, struct pkt_hdr *pkt,
+                                             saddr), new_entry->smacaddr);
+                       convmacaddr((char *) (((struct fddihdr *) packet)->
+                                             daddr), new_entry->dmacaddr);
+-              } else if ((pkt->pkt_hatype == ARPHRD_IEEE802)
+-                         || (pkt->pkt_hatype == ARPHRD_IEEE802_TR)) {
+-                      convmacaddr((char *) (((struct trh_hdr *) packet)->
+-                                            saddr), new_entry->smacaddr);
+-                      convmacaddr((char *) (((struct trh_hdr *) packet)->
+-                                            daddr), new_entry->dmacaddr);
+               }
+       }
+diff --git a/src/packet.c b/src/packet.c
+index a43a27a..f3e4304 100644
+--- a/src/packet.c
++++ b/src/packet.c
+@@ -51,24 +51,6 @@ static int in_cksum(u_short * addr, int len)
+       return (u_short) (~sum);
+ }
+-static unsigned int get_tr_ip_offset(char *pkt)
+-{
+-      struct trh_hdr *trh;
+-      unsigned int riflen = 0;
+-
+-      trh = (struct trh_hdr *) pkt;
+-
+-      /*
+-       * Check if this packet has TR routing information and get
+-       * its length.
+-       */
+-      if (trh->saddr[0] & TR_RII)
+-              riflen = (ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8;
+-
+-      return sizeof(struct trh_hdr) - TR_MAXRIFLEN + riflen +
+-          sizeof(struct trllc);
+-}
+-
+ static int packet_adjust(struct pkt_hdr *pkt)
+ {
+       int retval = 0;
+@@ -109,15 +91,6 @@ static int packet_adjust(struct pkt_hdr *pkt)
+               pkt->pkt_payload += sizeof(struct fddihdr);
+               pkt->pkt_len -= sizeof(struct fddihdr);
+               break;
+-      case ARPHRD_IEEE802_TR:
+-      case ARPHRD_IEEE802:
+-              pkt->pkt_payload = pkt->pkt_buf;
+-              /* Token Ring patch supplied by Tomas Dvorak */
+-              /* Get the start of the IP packet from the Token Ring frame. */
+-              unsigned int dataoffset = get_tr_ip_offset(pkt->pkt_payload);
+-              pkt->pkt_payload += dataoffset;
+-              pkt->pkt_len -= dataoffset;
+-              break;
+       default:
+               /* return a NULL packet to signal an unrecognized link */
+               /* protocol to the caller.  Hopefully, this switch statement */
+diff --git a/src/tcptable.c b/src/tcptable.c
+index 56c4780..b0e5ccc 100644
+--- a/src/tcptable.c
++++ b/src/tcptable.c
+@@ -620,10 +620,6 @@ void updateentry(struct tcptable *table, struct tcptableent *tableentry,
+               } else if (linkproto == ARPHRD_FDDI) {
+                       convmacaddr((char *) (((struct fddihdr *) packet)->
+                                             saddr), newmacaddr);
+-              } else if ((linkproto == ARPHRD_IEEE802)
+-                         || (linkproto == ARPHRD_IEEE802_TR)) {
+-                      convmacaddr((char *) (((struct trh_hdr *) packet)->
+-                                            saddr), newmacaddr);
+               }
+               if (tableentry->smacaddr[0] != '\0') {
+-- 
+1.7.10
+
index 425cd207e114bb27f98be3b375a394e29b1cdec8..c176834dc653333c5d8b7f6683cc3d77d9094125 100644 (file)
@@ -6,7 +6,7 @@
 name       = isdn4k-utils
 version    = 3.2
 devel_ver  = CVS-2010-05-01
-release    = 7
+release    = 8
 thisapp    = %{name}-%{devel_ver}-patched
 
 groups     = Networking/Tools
diff --git a/isdn4k-utils/patches/015-isdn4k-utils-fix-ipppd.patch b/isdn4k-utils/patches/015-isdn4k-utils-fix-ipppd.patch
new file mode 100644 (file)
index 0000000..ebe9e8e
--- /dev/null
@@ -0,0 +1,23 @@
+*** isdn4k-utils-CVS-2010-05-01-patched/ipppd.org/main.c       1969-12-31 20:03:58.571929416 -0500
+--- isdn4k-utils-CVS-2010-05-01-patched/ipppd/main.c   2012-07-18 05:46:07.636040971 -0400
+***************
+*** 1301,1309 ****
+           * XXX We assume a va_list is either a pointer or an array, so
+           * what gets passed for a va_list is like a void * in some sense.
+           */
+          a = va_arg(args, void *);
+! #if defined(__alpha__) || defined(__sh__)       /* always do this? */
+       n = fmtmsg(buf, buflen + 1, f, a);
+  #else
+       n = vfmtmsg(buf, buflen + 1, f, a);
+  #endif
+--- 1301,1309 ----
+           * XXX We assume a va_list is either a pointer or an array, so
+           * what gets passed for a va_list is like a void * in some sense.
+           */
+          a = va_arg(args, void *);
+! #if defined(__alpha__) || defined(__sh__) || defined ( __arm__ )      /* always do this? */
+       n = fmtmsg(buf, buflen + 1, f, a);
+  #else
+       n = vfmtmsg(buf, buflen + 1, f, a);
+  #endif
index fb5813c87e01f6549ce249685c9c728b1281bd93..5ff9ba3955c4b3eeec39e01f20370e9f57f15089 100644 (file)
@@ -4,8 +4,8 @@
 ###############################################################################
 
 name       = kernel
-version    = 3.5.1
-release    = 0.4
+version    = 3.5.3
+release    = 0.1
 thisapp    = linux-%{version}
 
 maintainer = Michael Tremer <michael.tremer@ipfire.org>
similarity index 98%
rename from kernel/patches/grsecurity-2.9.1-3.5.1-201208112021.patch
rename to kernel/patches/grsecurity-2.9.1-3.5.3-201209062131.patch
index e9ffa801f09ff5d95dcbc4f798107fa2a7e4060f..07e504b61e41dc1a4195aaf28d51202ecb1501f4 100644 (file)
@@ -275,7 +275,7 @@ index 13d6166..8c235b6 100644
  ==============================================================
  
 diff --git a/Makefile b/Makefile
-index d7ee1cb..bf3389b 100644
+index c901aae..0f96503 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -241,8 +241,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
@@ -1442,7 +1442,7 @@ index 75fe66b..2255c86 100644
  /*
   * Memory returned by kmalloc() may be used for DMA, so we must make
 diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
-index 004c1bc..d9d6d91 100644
+index e4448e1..7bc86b7 100644
 --- a/arch/arm/include/asm/cacheflush.h
 +++ b/arch/arm/include/asm/cacheflush.h
 @@ -108,7 +108,7 @@ struct cpu_cache_fns {
@@ -1663,7 +1663,7 @@ index b57c75e..ed2d6b2 100644
  
  EXPORT_SYMBOL(__get_user_1);
 diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
-index 19c95ea..7160f7c 100644
+index 693b744..e684262 100644
 --- a/arch/arm/kernel/process.c
 +++ b/arch/arm/kernel/process.c
 @@ -28,7 +28,6 @@
@@ -1674,7 +1674,7 @@ index 19c95ea..7160f7c 100644
  #include <linux/hw_breakpoint.h>
  #include <linux/cpuidle.h>
  
-@@ -255,9 +254,10 @@ void machine_power_off(void)
+@@ -256,9 +255,10 @@ void machine_power_off(void)
        machine_shutdown();
        if (pm_power_off)
                pm_power_off();
@@ -1686,7 +1686,7 @@ index 19c95ea..7160f7c 100644
  {
        machine_shutdown();
  
-@@ -499,12 +499,6 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -501,12 +501,6 @@ unsigned long get_wchan(struct task_struct *p)
        return 0;
  }
  
@@ -1745,7 +1745,7 @@ index e15d83b..8c466dd 100644
  #endif
  
 diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
-index 3647170..065e1cd 100644
+index c7cae6b..e1e523c 100644
 --- a/arch/arm/kernel/traps.c
 +++ b/arch/arm/kernel/traps.c
 @@ -264,6 +264,8 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
@@ -2326,7 +2326,7 @@ index 0f01de2..d37d309 100644
  #define __cacheline_aligned   __aligned(L1_CACHE_BYTES)
  #define ____cacheline_aligned __aligned(L1_CACHE_BYTES)
 diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h
-index 7d91166..88ab87e 100644
+index 6e6fe18..a6ae668 100644
 --- a/arch/ia64/include/asm/atomic.h
 +++ b/arch/ia64/include/asm/atomic.h
 @@ -208,6 +208,16 @@ atomic64_add_negative (__s64 i, atomic64_t *v)
@@ -4374,6 +4374,26 @@ index d183f87..1867f1a 100644
                regs->link = current->mm->context.vdso_base + vdso64_rt_sigtramp;
        } else {
                err |= setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]);
+diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
+index f2496f2..4e3cc47 100644
+--- a/arch/powerpc/kernel/syscalls.c
++++ b/arch/powerpc/kernel/syscalls.c
+@@ -107,11 +107,11 @@ long ppc64_personality(unsigned long personality)
+       long ret;
+       if (personality(current->personality) == PER_LINUX32
+-          && personality == PER_LINUX)
+-              personality = PER_LINUX32;
++          && personality(personality) == PER_LINUX)
++              personality = (personality & ~PER_MASK) | PER_LINUX32;
+       ret = sys_personality(personality);
+-      if (ret == PER_LINUX32)
+-              ret = PER_LINUX;
++      if (personality(ret) == PER_LINUX32)
++              ret = (ret & ~PER_MASK) | PER_LINUX;
+       return ret;
+ }
+ #endif
 diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
 index 1589723..cefe690 100644
 --- a/arch/powerpc/kernel/traps.c
@@ -4697,7 +4717,7 @@ index 2a30d5a..5e5586f 100644
  
  #define __read_mostly __attribute__((__section__(".data..read_mostly")))
 diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
-index 06151e6..c08cb52 100644
+index 06151e6..598f9a5 100644
 --- a/arch/s390/include/asm/elf.h
 +++ b/arch/s390/include/asm/elf.h
 @@ -161,8 +161,14 @@ extern unsigned int vdso_enabled;
@@ -4717,7 +4737,17 @@ index 06151e6..c08cb52 100644
  
  /* This yields a mask that user programs can use to figure out what
     instruction set this CPU supports. */
-@@ -210,7 +216,4 @@ struct linux_binprm;
+@@ -182,7 +188,8 @@ extern char elf_platform[];
+ #define ELF_PLATFORM (elf_platform)
+ #ifndef CONFIG_64BIT
+-#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
++#define SET_PERSONALITY(ex) \
++      set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
+ #else /* CONFIG_64BIT */
+ #define SET_PERSONALITY(ex)                                   \
+ do {                                                          \
+@@ -210,7 +217,4 @@ struct linux_binprm;
  #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
  int arch_setup_additional_pages(struct linux_binprm *, int);
  
@@ -8606,7 +8636,7 @@ index 673ac9b..7a8c5df 100644
  
        if (err)
 diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
-index 20e5f7b..eab8751 100644
+index 20e5f7b..f33c779 100644
 --- a/arch/x86/ia32/ia32entry.S
 +++ b/arch/x86/ia32/ia32entry.S
 @@ -14,8 +14,10 @@
@@ -8666,7 +8696,7 @@ index 20e5f7b..eab8751 100644
        movl    %ebp,%ebp               /* zero extension */
        pushq_cfi $__USER32_DS
        /*CFI_REL_OFFSET ss,0*/
-@@ -134,22 +156,37 @@ ENTRY(ia32_sysenter_target)
+@@ -134,22 +156,42 @@ ENTRY(ia32_sysenter_target)
        CFI_REL_OFFSET rsp,0
        pushfq_cfi
        /*CFI_REL_OFFSET rflags,0*/
@@ -8686,6 +8716,11 @@ index 20e5f7b..eab8751 100644
        cld
        SAVE_ARGS 0,1,0
 +      pax_enter_kernel_user
++
++#ifdef CONFIG_PAX_RANDKSTACK
++      pax_erase_kstack
++#endif
++
 +      /*
 +       * No need to follow this irqs on/off section: the syscall
 +       * disabled irqs, here we enable it straight after entry:
@@ -8709,7 +8744,7 @@ index 20e5f7b..eab8751 100644
        CFI_REMEMBER_STATE
        jnz  sysenter_tracesys
        cmpq    $(IA32_NR_syscalls-1),%rax
-@@ -159,12 +196,15 @@ sysenter_do_call:
+@@ -159,12 +201,15 @@ sysenter_do_call:
  sysenter_dispatch:
        call    *ia32_sys_call_table(,%rax,8)
        movq    %rax,RAX-ARGOFFSET(%rsp)
@@ -8727,7 +8762,7 @@ index 20e5f7b..eab8751 100644
        /* clear IF, that popfq doesn't enable interrupts early */
        andl  $~0x200,EFLAGS-R11(%rsp) 
        movl    RIP-R11(%rsp),%edx              /* User %eip */
-@@ -190,6 +230,9 @@ sysexit_from_sys_call:
+@@ -190,6 +235,9 @@ sysexit_from_sys_call:
        movl %eax,%esi                  /* 2nd arg: syscall number */
        movl $AUDIT_ARCH_I386,%edi      /* 1st arg: audit arch */
        call __audit_syscall_entry
@@ -8737,7 +8772,7 @@ index 20e5f7b..eab8751 100644
        movl RAX-ARGOFFSET(%rsp),%eax   /* reload syscall number */
        cmpq $(IA32_NR_syscalls-1),%rax
        ja ia32_badsys
-@@ -201,7 +244,7 @@ sysexit_from_sys_call:
+@@ -201,7 +249,7 @@ sysexit_from_sys_call:
        .endm
  
        .macro auditsys_exit exit
@@ -8746,7 +8781,7 @@ index 20e5f7b..eab8751 100644
        jnz ia32_ret_from_sys_call
        TRACE_IRQS_ON
        sti
-@@ -212,11 +255,12 @@ sysexit_from_sys_call:
+@@ -212,11 +260,12 @@ sysexit_from_sys_call:
  1:    setbe %al               /* 1 if error, 0 if not */
        movzbl %al,%edi         /* zero-extend that into %edi */
        call __audit_syscall_exit
@@ -8760,7 +8795,7 @@ index 20e5f7b..eab8751 100644
        jz \exit
        CLEAR_RREGS -ARGOFFSET
        jmp int_with_check
-@@ -234,7 +278,7 @@ sysexit_audit:
+@@ -234,7 +283,7 @@ sysexit_audit:
  
  sysenter_tracesys:
  #ifdef CONFIG_AUDITSYSCALL
@@ -8769,17 +8804,17 @@ index 20e5f7b..eab8751 100644
        jz      sysenter_auditsys
  #endif
        SAVE_REST
-@@ -242,6 +286,9 @@ sysenter_tracesys:
-       movq    $-ENOSYS,RAX(%rsp)/* ptrace can change this for a bad syscall */
-       movq    %rsp,%rdi        /* &pt_regs -> arg1 */
-       call    syscall_trace_enter
+@@ -246,6 +295,9 @@ sysenter_tracesys:
+       RESTORE_REST
+       cmpq    $(IA32_NR_syscalls-1),%rax
+       ja      int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
 +
 +      pax_erase_kstack
 +
-       LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
-       RESTORE_REST
-       cmpq    $(IA32_NR_syscalls-1),%rax
-@@ -273,19 +320,20 @@ ENDPROC(ia32_sysenter_target)
+       jmp     sysenter_do_call
+       CFI_ENDPROC
+ ENDPROC(ia32_sysenter_target)
+@@ -273,19 +325,25 @@ ENDPROC(ia32_sysenter_target)
  ENTRY(ia32_cstar_target)
        CFI_STARTPROC32 simple
        CFI_SIGNAL_FRAME
@@ -8793,6 +8828,11 @@ index 20e5f7b..eab8751 100644
        movq    PER_CPU_VAR(kernel_stack),%rsp
 +      SAVE_ARGS 8*6,0,0
 +      pax_enter_kernel_user
++
++#ifdef CONFIG_PAX_RANDKSTACK
++      pax_erase_kstack
++#endif
++
        /*
         * No need to follow this irqs on/off section: the syscall
         * disabled irqs and here we enable it straight after entry:
@@ -8802,7 +8842,7 @@ index 20e5f7b..eab8751 100644
        movl    %eax,%eax       /* zero extension */
        movq    %rax,ORIG_RAX-ARGOFFSET(%rsp)
        movq    %rcx,RIP-ARGOFFSET(%rsp)
-@@ -301,10 +349,17 @@ ENTRY(ia32_cstar_target)
+@@ -301,10 +359,17 @@ ENTRY(ia32_cstar_target)
        /* no need to do an access_ok check here because r8 has been
           32bit zero extended */ 
        /* hardware stack frame is complete now */      
@@ -8822,7 +8862,7 @@ index 20e5f7b..eab8751 100644
        CFI_REMEMBER_STATE
        jnz   cstar_tracesys
        cmpq $IA32_NR_syscalls-1,%rax
-@@ -314,12 +369,15 @@ cstar_do_call:
+@@ -314,12 +379,15 @@ cstar_do_call:
  cstar_dispatch:
        call *ia32_sys_call_table(,%rax,8)
        movq %rax,RAX-ARGOFFSET(%rsp)
@@ -8840,7 +8880,7 @@ index 20e5f7b..eab8751 100644
        RESTORE_ARGS 0,-ARG_SKIP,0,0,0
        movl RIP-ARGOFFSET(%rsp),%ecx
        CFI_REGISTER rip,rcx
-@@ -347,7 +405,7 @@ sysretl_audit:
+@@ -347,7 +415,7 @@ sysretl_audit:
  
  cstar_tracesys:
  #ifdef CONFIG_AUDITSYSCALL
@@ -8849,17 +8889,17 @@ index 20e5f7b..eab8751 100644
        jz cstar_auditsys
  #endif
        xchgl %r9d,%ebp
-@@ -356,6 +414,9 @@ cstar_tracesys:
-       movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */
-       movq %rsp,%rdi        /* &pt_regs -> arg1 */
-       call syscall_trace_enter
+@@ -361,6 +429,9 @@ cstar_tracesys:
+       xchgl %ebp,%r9d
+       cmpq $(IA32_NR_syscalls-1),%rax
+       ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
 +
 +      pax_erase_kstack
 +
-       LOAD_ARGS32 ARGOFFSET, 1  /* reload args from stack in case ptrace changed it */
-       RESTORE_REST
-       xchgl %ebp,%r9d
-@@ -401,19 +462,21 @@ ENTRY(ia32_syscall)
+       jmp cstar_do_call
+ END(ia32_cstar_target)
+                               
+@@ -401,19 +472,26 @@ ENTRY(ia32_syscall)
        CFI_REL_OFFSET  rip,RIP-RIP
        PARAVIRT_ADJUST_EXCEPTION_FRAME
        SWAPGS
@@ -8877,6 +8917,11 @@ index 20e5f7b..eab8751 100644
 -      orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
 -      testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
 +      pax_enter_kernel_user
++
++#ifdef CONFIG_PAX_RANDKSTACK
++      pax_erase_kstack
++#endif
++
 +      /*
 +       * No need to follow this irqs on/off section: the syscall
 +       * disabled irqs and here we enable it straight after entry:
@@ -8888,16 +8933,16 @@ index 20e5f7b..eab8751 100644
        jnz ia32_tracesys
        cmpq $(IA32_NR_syscalls-1),%rax
        ja ia32_badsys
-@@ -432,6 +495,9 @@ ia32_tracesys:
-       movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */
-       movq %rsp,%rdi        /* &pt_regs -> arg1 */
-       call syscall_trace_enter
+@@ -436,6 +514,9 @@ ia32_tracesys:
+       RESTORE_REST
+       cmpq $(IA32_NR_syscalls-1),%rax
+       ja  int_ret_from_sys_call       /* ia32_tracesys has set RAX(%rsp) */
 +
 +      pax_erase_kstack
 +
-       LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
-       RESTORE_REST
-       cmpq $(IA32_NR_syscalls-1),%rax
+       jmp ia32_do_call
+ END(ia32_syscall)
 diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
 index 4540bec..714d913 100644
 --- a/arch/x86/ia32/sys_ia32.c
@@ -13672,7 +13717,7 @@ index 7261083..5c12053 100644
  bogus_magic:
        jmp     bogus_magic
 diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
-index 1f84794..e23f862 100644
+index 73ef56c..0238021 100644
 --- a/arch/x86/kernel/alternative.c
 +++ b/arch/x86/kernel/alternative.c
 @@ -276,6 +276,13 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
@@ -14825,10 +14870,10 @@ index 9b9f18b..9fcaa04 100644
  #include <asm/processor.h>
  #include <asm/fcntl.h>
 diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
-index 623f288..0683156 100644
+index 623f288..8bdd78a 100644
 --- a/arch/x86/kernel/entry_32.S
 +++ b/arch/x86/kernel/entry_32.S
-@@ -176,13 +176,146 @@
+@@ -176,13 +176,153 @@
        /*CFI_REL_OFFSET gs, PT_GS*/
  .endm
  .macro SET_KERNEL_GS reg
@@ -14932,10 +14977,10 @@ index 623f288..0683156 100644
 +#ifdef CONFIG_PAX_MEMORY_STACKLEAK
 +/*
 + * ebp: thread_info
-+ * ecx, edx: can be clobbered
 + */
 +ENTRY(pax_erase_kstack)
 +      pushl %edi
++      pushl %ecx
 +      pushl %eax
 +
 +      mov TI_lowest_stack(%ebp), %edi
@@ -14959,6 +15004,12 @@ index 623f288..0683156 100644
 +2:    cld
 +      mov %esp, %ecx
 +      sub %edi, %ecx
++
++      cmp $THREAD_SIZE_asm, %ecx
++      jb 3f
++      ud2
++3:
++
 +      shr $2, %ecx
 +      rep stosl
 +
@@ -14967,6 +15018,7 @@ index 623f288..0683156 100644
 +      mov %edi, TI_lowest_stack(%ebp)
 +
 +      popl %eax
++      popl %ecx
 +      popl %edi
 +      ret
 +ENDPROC(pax_erase_kstack)
@@ -14976,7 +15028,7 @@ index 623f288..0683156 100644
        cld
        PUSH_GS
        pushl_cfi %fs
-@@ -205,7 +338,7 @@
+@@ -205,7 +345,7 @@
        CFI_REL_OFFSET ecx, 0
        pushl_cfi %ebx
        CFI_REL_OFFSET ebx, 0
@@ -14985,7 +15037,7 @@ index 623f288..0683156 100644
        movl %edx, %ds
        movl %edx, %es
        movl $(__KERNEL_PERCPU), %edx
-@@ -213,6 +346,15 @@
+@@ -213,6 +353,15 @@
        SET_KERNEL_GS %edx
  .endm
  
@@ -15001,7 +15053,7 @@ index 623f288..0683156 100644
  .macro RESTORE_INT_REGS
        popl_cfi %ebx
        CFI_RESTORE ebx
-@@ -296,7 +438,7 @@ ENTRY(ret_from_fork)
+@@ -296,7 +445,7 @@ ENTRY(ret_from_fork)
        popfl_cfi
        jmp syscall_exit
        CFI_ENDPROC
@@ -15010,7 +15062,7 @@ index 623f288..0683156 100644
  
  /*
   * Interrupt exit functions should be protected against kprobes
-@@ -329,7 +471,15 @@ ret_from_intr:
+@@ -329,7 +478,15 @@ ret_from_intr:
        andl $SEGMENT_RPL_MASK, %eax
  #endif
        cmpl $USER_RPL, %eax
@@ -15026,7 +15078,7 @@ index 623f288..0683156 100644
  
  ENTRY(resume_userspace)
        LOCKDEP_SYS_EXIT
-@@ -341,8 +491,8 @@ ENTRY(resume_userspace)
+@@ -341,8 +498,8 @@ ENTRY(resume_userspace)
        andl $_TIF_WORK_MASK, %ecx      # is there any work to be done on
                                        # int/exception return?
        jne work_pending
@@ -15037,7 +15089,7 @@ index 623f288..0683156 100644
  
  #ifdef CONFIG_PREEMPT
  ENTRY(resume_kernel)
-@@ -357,7 +507,7 @@ need_resched:
+@@ -357,7 +514,7 @@ need_resched:
        jz restore_all
        call preempt_schedule_irq
        jmp need_resched
@@ -15046,7 +15098,7 @@ index 623f288..0683156 100644
  #endif
        CFI_ENDPROC
  /*
-@@ -391,23 +541,34 @@ sysenter_past_esp:
+@@ -391,28 +548,43 @@ sysenter_past_esp:
        /*CFI_REL_OFFSET cs, 0*/
        /*
         * Push current_thread_info()->sysenter_return to the stack.
@@ -15084,7 +15136,16 @@ index 623f288..0683156 100644
        movl %ebp,PT_EBP(%esp)
        _ASM_EXTABLE(1b,syscall_fault)
  
-@@ -427,12 +588,24 @@ sysenter_do_call:
+       GET_THREAD_INFO(%ebp)
++#ifdef CONFIG_PAX_RANDKSTACK
++      pax_erase_kstack
++#endif
++
+       testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
+       jnz sysenter_audit
+ sysenter_do_call:
+@@ -427,12 +599,24 @@ sysenter_do_call:
        testl $_TIF_ALLWORK_MASK, %ecx
        jne sysexit_audit
  sysenter_exit:
@@ -15109,7 +15170,7 @@ index 623f288..0683156 100644
        PTGS_TO_GS
        ENABLE_INTERRUPTS_SYSEXIT
  
-@@ -449,6 +622,9 @@ sysenter_audit:
+@@ -449,6 +633,9 @@ sysenter_audit:
        movl %eax,%edx                  /* 2nd arg: syscall number */
        movl $AUDIT_ARCH_I386,%eax      /* 1st arg: audit arch */
        call __audit_syscall_entry
@@ -15119,7 +15180,7 @@ index 623f288..0683156 100644
        pushl_cfi %ebx
        movl PT_EAX(%esp),%eax          /* reload syscall number */
        jmp sysenter_do_call
-@@ -474,10 +650,16 @@ sysexit_audit:
+@@ -474,10 +661,16 @@ sysexit_audit:
  
        CFI_ENDPROC
  .pushsection .fixup,"ax"
@@ -15138,7 +15199,19 @@ index 623f288..0683156 100644
        PTGS_TO_GS_EX
  ENDPROC(ia32_sysenter_target)
  
-@@ -509,6 +691,15 @@ syscall_exit:
+@@ -491,6 +684,11 @@ ENTRY(system_call)
+       pushl_cfi %eax                  # save orig_eax
+       SAVE_ALL
+       GET_THREAD_INFO(%ebp)
++
++#ifdef CONFIG_PAX_RANDKSTACK
++      pax_erase_kstack
++#endif
++
+                                       # system call tracing in operation / emulation
+       testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
+       jnz syscall_trace_entry
+@@ -509,6 +707,15 @@ syscall_exit:
        testl $_TIF_ALLWORK_MASK, %ecx  # current->work
        jne syscall_exit_work
  
@@ -15154,7 +15227,7 @@ index 623f288..0683156 100644
  restore_all:
        TRACE_IRQS_IRET
  restore_all_notrace:
-@@ -565,14 +756,34 @@ ldt_ss:
+@@ -565,14 +772,34 @@ ldt_ss:
   * compensating for the offset by changing to the ESPFIX segment with
   * a base address that matches for the difference.
   */
@@ -15192,7 +15265,7 @@ index 623f288..0683156 100644
        pushl_cfi $__ESPFIX_SS
        pushl_cfi %eax                  /* new kernel esp */
        /* Disable interrupts, but do not irqtrace this section: we
-@@ -601,35 +812,23 @@ work_resched:
+@@ -601,35 +828,23 @@ work_resched:
        movl TI_flags(%ebp), %ecx
        andl $_TIF_WORK_MASK, %ecx      # is there any work to be done other
                                        # than syscall tracing?
@@ -15232,7 +15305,7 @@ index 623f288..0683156 100644
  #endif
        TRACE_IRQS_ON
        ENABLE_INTERRUPTS(CLBR_NONE)
-@@ -640,7 +839,7 @@ work_notifysig_v86:
+@@ -640,7 +855,7 @@ work_notifysig_v86:
        xorl %edx, %edx
        call do_notify_resume
        jmp resume_userspace
@@ -15241,7 +15314,7 @@ index 623f288..0683156 100644
  
        # perform syscall exit tracing
        ALIGN
-@@ -648,11 +847,14 @@ syscall_trace_entry:
+@@ -648,11 +863,14 @@ syscall_trace_entry:
        movl $-ENOSYS,PT_EAX(%esp)
        movl %esp, %eax
        call syscall_trace_enter
@@ -15257,7 +15330,7 @@ index 623f288..0683156 100644
  
        # perform syscall exit tracing
        ALIGN
-@@ -665,20 +867,24 @@ syscall_exit_work:
+@@ -665,20 +883,24 @@ syscall_exit_work:
        movl %esp, %eax
        call syscall_trace_leave
        jmp resume_userspace
@@ -15285,7 +15358,7 @@ index 623f288..0683156 100644
        CFI_ENDPROC
  /*
   * End of kprobes section
-@@ -750,6 +956,36 @@ ENTRY(ptregs_clone)
+@@ -750,6 +972,36 @@ ENTRY(ptregs_clone)
        CFI_ENDPROC
  ENDPROC(ptregs_clone)
  
@@ -15322,7 +15395,7 @@ index 623f288..0683156 100644
  .macro FIXUP_ESPFIX_STACK
  /*
   * Switch back for ESPFIX stack to the normal zerobased stack
-@@ -759,8 +995,15 @@ ENDPROC(ptregs_clone)
+@@ -759,8 +1011,15 @@ ENDPROC(ptregs_clone)
   * normal stack and adjusts ESP with the matching offset.
   */
        /* fixup the stack */
@@ -15340,7 +15413,7 @@ index 623f288..0683156 100644
        shl $16, %eax
        addl %esp, %eax                 /* the adjusted stack pointer */
        pushl_cfi $__KERNEL_DS
-@@ -813,7 +1056,7 @@ vector=vector+1
+@@ -813,7 +1072,7 @@ vector=vector+1
    .endr
  2:    jmp common_interrupt
  .endr
@@ -15349,7 +15422,7 @@ index 623f288..0683156 100644
  
  .previous
  END(interrupt)
-@@ -861,7 +1104,7 @@ ENTRY(coprocessor_error)
+@@ -861,7 +1120,7 @@ ENTRY(coprocessor_error)
        pushl_cfi $do_coprocessor_error
        jmp error_code
        CFI_ENDPROC
@@ -15358,7 +15431,7 @@ index 623f288..0683156 100644
  
  ENTRY(simd_coprocessor_error)
        RING0_INT_FRAME
-@@ -882,7 +1125,7 @@ ENTRY(simd_coprocessor_error)
+@@ -882,7 +1141,7 @@ ENTRY(simd_coprocessor_error)
  #endif
        jmp error_code
        CFI_ENDPROC
@@ -15367,7 +15440,7 @@ index 623f288..0683156 100644
  
  ENTRY(device_not_available)
        RING0_INT_FRAME
-@@ -890,18 +1133,18 @@ ENTRY(device_not_available)
+@@ -890,18 +1149,18 @@ ENTRY(device_not_available)
        pushl_cfi $do_device_not_available
        jmp error_code
        CFI_ENDPROC
@@ -15389,7 +15462,7 @@ index 623f288..0683156 100644
  #endif
  
  ENTRY(overflow)
-@@ -910,7 +1153,7 @@ ENTRY(overflow)
+@@ -910,7 +1169,7 @@ ENTRY(overflow)
        pushl_cfi $do_overflow
        jmp error_code
        CFI_ENDPROC
@@ -15398,7 +15471,7 @@ index 623f288..0683156 100644
  
  ENTRY(bounds)
        RING0_INT_FRAME
-@@ -918,7 +1161,7 @@ ENTRY(bounds)
+@@ -918,7 +1177,7 @@ ENTRY(bounds)
        pushl_cfi $do_bounds
        jmp error_code
        CFI_ENDPROC
@@ -15407,7 +15480,7 @@ index 623f288..0683156 100644
  
  ENTRY(invalid_op)
        RING0_INT_FRAME
-@@ -926,7 +1169,7 @@ ENTRY(invalid_op)
+@@ -926,7 +1185,7 @@ ENTRY(invalid_op)
        pushl_cfi $do_invalid_op
        jmp error_code
        CFI_ENDPROC
@@ -15416,7 +15489,7 @@ index 623f288..0683156 100644
  
  ENTRY(coprocessor_segment_overrun)
        RING0_INT_FRAME
-@@ -934,35 +1177,35 @@ ENTRY(coprocessor_segment_overrun)
+@@ -934,35 +1193,35 @@ ENTRY(coprocessor_segment_overrun)
        pushl_cfi $do_coprocessor_segment_overrun
        jmp error_code
        CFI_ENDPROC
@@ -15457,7 +15530,7 @@ index 623f288..0683156 100644
  
  ENTRY(divide_error)
        RING0_INT_FRAME
-@@ -970,7 +1213,7 @@ ENTRY(divide_error)
+@@ -970,7 +1229,7 @@ ENTRY(divide_error)
        pushl_cfi $do_divide_error
        jmp error_code
        CFI_ENDPROC
@@ -15466,7 +15539,7 @@ index 623f288..0683156 100644
  
  #ifdef CONFIG_X86_MCE
  ENTRY(machine_check)
-@@ -979,7 +1222,7 @@ ENTRY(machine_check)
+@@ -979,7 +1238,7 @@ ENTRY(machine_check)
        pushl_cfi machine_check_vector
        jmp error_code
        CFI_ENDPROC
@@ -15475,7 +15548,7 @@ index 623f288..0683156 100644
  #endif
  
  ENTRY(spurious_interrupt_bug)
-@@ -988,7 +1231,7 @@ ENTRY(spurious_interrupt_bug)
+@@ -988,7 +1247,7 @@ ENTRY(spurious_interrupt_bug)
        pushl_cfi $do_spurious_interrupt_bug
        jmp error_code
        CFI_ENDPROC
@@ -15484,7 +15557,7 @@ index 623f288..0683156 100644
  /*
   * End of kprobes section
   */
-@@ -1100,7 +1343,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
+@@ -1100,7 +1359,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
  
  ENTRY(mcount)
        ret
@@ -15493,7 +15566,7 @@ index 623f288..0683156 100644
  
  ENTRY(ftrace_caller)
        cmpl $0, function_trace_stop
-@@ -1129,7 +1372,7 @@ ftrace_graph_call:
+@@ -1129,7 +1388,7 @@ ftrace_graph_call:
  .globl ftrace_stub
  ftrace_stub:
        ret
@@ -15502,7 +15575,7 @@ index 623f288..0683156 100644
  
  #else /* ! CONFIG_DYNAMIC_FTRACE */
  
-@@ -1165,7 +1408,7 @@ trace:
+@@ -1165,7 +1424,7 @@ trace:
        popl %ecx
        popl %eax
        jmp ftrace_stub
@@ -15511,7 +15584,7 @@ index 623f288..0683156 100644
  #endif /* CONFIG_DYNAMIC_FTRACE */
  #endif /* CONFIG_FUNCTION_TRACER */
  
-@@ -1186,7 +1429,7 @@ ENTRY(ftrace_graph_caller)
+@@ -1186,7 +1445,7 @@ ENTRY(ftrace_graph_caller)
        popl %ecx
        popl %eax
        ret
@@ -15520,7 +15593,7 @@ index 623f288..0683156 100644
  
  .globl return_to_handler
  return_to_handler:
-@@ -1241,15 +1484,18 @@ error_code:
+@@ -1241,15 +1500,18 @@ error_code:
        movl $-1, PT_ORIG_EAX(%esp)     # no syscall to restart
        REG_TO_PTGS %ecx
        SET_KERNEL_GS %ecx
@@ -15541,7 +15614,7 @@ index 623f288..0683156 100644
  
  /*
   * Debug traps and NMI can happen at the one SYSENTER instruction
-@@ -1291,7 +1537,7 @@ debug_stack_correct:
+@@ -1291,7 +1553,7 @@ debug_stack_correct:
        call do_debug
        jmp ret_from_exception
        CFI_ENDPROC
@@ -15550,7 +15623,7 @@ index 623f288..0683156 100644
  
  /*
   * NMI is doubly nasty. It can happen _while_ we're handling
-@@ -1328,6 +1574,9 @@ nmi_stack_correct:
+@@ -1328,6 +1590,9 @@ nmi_stack_correct:
        xorl %edx,%edx          # zero error code
        movl %esp,%eax          # pt_regs pointer
        call do_nmi
@@ -15560,7 +15633,7 @@ index 623f288..0683156 100644
        jmp restore_all_notrace
        CFI_ENDPROC
  
-@@ -1364,12 +1613,15 @@ nmi_espfix_stack:
+@@ -1364,12 +1629,15 @@ nmi_espfix_stack:
        FIXUP_ESPFIX_STACK              # %eax == %esp
        xorl %edx,%edx                  # zero error code
        call do_nmi
@@ -15577,7 +15650,7 @@ index 623f288..0683156 100644
  
  ENTRY(int3)
        RING0_INT_FRAME
-@@ -1381,14 +1633,14 @@ ENTRY(int3)
+@@ -1381,14 +1649,14 @@ ENTRY(int3)
        call do_int3
        jmp ret_from_exception
        CFI_ENDPROC
@@ -15594,7 +15667,7 @@ index 623f288..0683156 100644
  
  #ifdef CONFIG_KVM_GUEST
  ENTRY(async_page_fault)
-@@ -1396,7 +1648,7 @@ ENTRY(async_page_fault)
+@@ -1396,7 +1664,7 @@ ENTRY(async_page_fault)
        pushl_cfi $do_async_page_fault
        jmp error_code
        CFI_ENDPROC
@@ -15604,7 +15677,7 @@ index 623f288..0683156 100644
  
  /*
 diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
-index 7d65133..27bce5b 100644
+index 7d65133..c888d5f 100644
 --- a/arch/x86/kernel/entry_64.S
 +++ b/arch/x86/kernel/entry_64.S
 @@ -57,6 +57,8 @@
@@ -15680,7 +15753,7 @@ index 7d65133..27bce5b 100644
        jmp *%rdi
  #endif
  
-@@ -180,6 +188,282 @@ ENTRY(native_usergs_sysret64)
+@@ -180,6 +188,280 @@ ENTRY(native_usergs_sysret64)
  ENDPROC(native_usergs_sysret64)
  #endif /* CONFIG_PARAVIRT */
  
@@ -15909,12 +15982,9 @@ index 7d65133..27bce5b 100644
 +.endm
 +
 +#ifdef CONFIG_PAX_MEMORY_STACKLEAK
-+/*
-+ * r11: thread_info
-+ * rcx, rdx: can be clobbered
-+ */
 +ENTRY(pax_erase_kstack)
 +      pushq %rdi
++      pushq %rcx
 +      pushq %rax
 +      pushq %r11
 +
@@ -15955,6 +16025,7 @@ index 7d65133..27bce5b 100644
 +
 +      popq %r11
 +      popq %rax
++      popq %rcx
 +      popq %rdi
 +      pax_force_retaddr
 +      ret
@@ -15963,7 +16034,7 @@ index 7d65133..27bce5b 100644
  
  .macro TRACE_IRQS_IRETQ offset=ARGOFFSET
  #ifdef CONFIG_TRACE_IRQFLAGS
-@@ -271,8 +555,8 @@ ENDPROC(native_usergs_sysret64)
+@@ -271,8 +553,8 @@ ENDPROC(native_usergs_sysret64)
        .endm
  
        .macro UNFAKE_STACK_FRAME
@@ -15974,7 +16045,7 @@ index 7d65133..27bce5b 100644
        .endm
  
  /*
-@@ -359,7 +643,7 @@ ENDPROC(native_usergs_sysret64)
+@@ -359,7 +641,7 @@ ENDPROC(native_usergs_sysret64)
        movq %rsp, %rsi
  
        leaq -RBP(%rsp),%rdi    /* arg1 for handler */
@@ -15983,7 +16054,7 @@ index 7d65133..27bce5b 100644
        je 1f
        SWAPGS
        /*
-@@ -394,9 +678,10 @@ ENTRY(save_rest)
+@@ -394,9 +676,10 @@ ENTRY(save_rest)
        movq_cfi r15, R15+16
        movq %r11, 8(%rsp)      /* return address */
        FIXUP_TOP_OF_STACK %r11, 16
@@ -15995,7 +16066,7 @@ index 7d65133..27bce5b 100644
  
  /* save complete stack frame */
        .pushsection .kprobes.text, "ax"
-@@ -425,9 +710,10 @@ ENTRY(save_paranoid)
+@@ -425,9 +708,10 @@ ENTRY(save_paranoid)
        js 1f   /* negative -> in kernel */
        SWAPGS
        xorl %ebx,%ebx
@@ -16008,7 +16079,7 @@ index 7d65133..27bce5b 100644
        .popsection
  
  /*
-@@ -449,7 +735,7 @@ ENTRY(ret_from_fork)
+@@ -449,7 +733,7 @@ ENTRY(ret_from_fork)
  
        RESTORE_REST
  
@@ -16017,7 +16088,7 @@ index 7d65133..27bce5b 100644
        jz   retint_restore_args
  
        testl $_TIF_IA32, TI_flags(%rcx)        # 32-bit compat task needs IRET
-@@ -459,7 +745,7 @@ ENTRY(ret_from_fork)
+@@ -459,7 +743,7 @@ ENTRY(ret_from_fork)
        jmp ret_from_sys_call                   # go to the SYSRET fastpath
  
        CFI_ENDPROC
@@ -16026,7 +16097,7 @@ index 7d65133..27bce5b 100644
  
  /*
   * System call entry. Up to 6 arguments in registers are supported.
-@@ -495,7 +781,7 @@ END(ret_from_fork)
+@@ -495,7 +779,7 @@ END(ret_from_fork)
  ENTRY(system_call)
        CFI_STARTPROC   simple
        CFI_SIGNAL_FRAME
@@ -16035,12 +16106,17 @@ index 7d65133..27bce5b 100644
        CFI_REGISTER    rip,rcx
        /*CFI_REGISTER  rflags,r11*/
        SWAPGS_UNSAFE_STACK
-@@ -508,16 +794,18 @@ GLOBAL(system_call_after_swapgs)
+@@ -508,16 +792,23 @@ GLOBAL(system_call_after_swapgs)
  
        movq    %rsp,PER_CPU_VAR(old_rsp)
        movq    PER_CPU_VAR(kernel_stack),%rsp
 +      SAVE_ARGS 8*6,0
 +      pax_enter_kernel_user
++
++#ifdef CONFIG_PAX_RANDKSTACK
++      pax_erase_kstack
++#endif
++
        /*
         * No need to follow this irqs off/on section - it's straight
         * and short:
@@ -16056,7 +16132,7 @@ index 7d65133..27bce5b 100644
        jnz tracesys
  system_call_fastpath:
  #if __SYSCALL_MASK == ~0
-@@ -527,7 +815,7 @@ system_call_fastpath:
+@@ -527,7 +818,7 @@ system_call_fastpath:
        cmpl $__NR_syscall_max,%eax
  #endif
        ja badsys
@@ -16065,7 +16141,7 @@ index 7d65133..27bce5b 100644
        call *sys_call_table(,%rax,8)  # XXX:    rip relative
        movq %rax,RAX-ARGOFFSET(%rsp)
  /*
-@@ -541,10 +829,13 @@ sysret_check:
+@@ -541,10 +832,13 @@ sysret_check:
        LOCKDEP_SYS_EXIT
        DISABLE_INTERRUPTS(CLBR_NONE)
        TRACE_IRQS_OFF
@@ -16080,7 +16156,7 @@ index 7d65133..27bce5b 100644
        /*
         * sysretq will re-enable interrupts:
         */
-@@ -596,14 +887,18 @@ badsys:
+@@ -596,14 +890,18 @@ badsys:
         * jump back to the normal fast path.
         */
  auditsys:
@@ -16100,7 +16176,7 @@ index 7d65133..27bce5b 100644
        jmp system_call_fastpath
  
        /*
-@@ -624,7 +919,7 @@ sysret_audit:
+@@ -624,7 +922,7 @@ sysret_audit:
        /* Do syscall tracing */
  tracesys:
  #ifdef CONFIG_AUDITSYSCALL
@@ -16109,7 +16185,7 @@ index 7d65133..27bce5b 100644
        jz auditsys
  #endif
        SAVE_REST
-@@ -632,12 +927,16 @@ tracesys:
+@@ -632,12 +930,16 @@ tracesys:
        FIXUP_TOP_OF_STACK %rdi
        movq %rsp,%rdi
        call syscall_trace_enter
@@ -16126,7 +16202,7 @@ index 7d65133..27bce5b 100644
        RESTORE_REST
  #if __SYSCALL_MASK == ~0
        cmpq $__NR_syscall_max,%rax
-@@ -646,7 +945,7 @@ tracesys:
+@@ -646,7 +948,7 @@ tracesys:
        cmpl $__NR_syscall_max,%eax
  #endif
        ja   int_ret_from_sys_call      /* RAX(%rsp) set to -ENOSYS above */
@@ -16135,15 +16211,18 @@ index 7d65133..27bce5b 100644
        call *sys_call_table(,%rax,8)
        movq %rax,RAX-ARGOFFSET(%rsp)
        /* Use IRET because user could have changed frame */
-@@ -667,6 +966,7 @@ GLOBAL(int_with_check)
+@@ -667,7 +969,9 @@ GLOBAL(int_with_check)
        andl %edi,%edx
        jnz   int_careful
        andl    $~TS_COMPAT,TI_status(%rcx)
+-      jmp   retint_swapgs
++      pax_exit_kernel_user
 +      pax_erase_kstack
-       jmp   retint_swapgs
++      jmp   retint_swapgs_pax
  
        /* Either reschedule or signal or syscall exit tracking needed. */
-@@ -713,7 +1013,7 @@ int_restore_rest:
+       /* First do a reschedule test. */
+@@ -713,7 +1017,7 @@ int_restore_rest:
        TRACE_IRQS_OFF
        jmp int_with_check
        CFI_ENDPROC
@@ -16152,7 +16231,7 @@ index 7d65133..27bce5b 100644
  
  /*
   * Certain special system calls that need to save a complete full stack frame.
-@@ -729,7 +1029,7 @@ ENTRY(\label)
+@@ -729,7 +1033,7 @@ ENTRY(\label)
        call \func
        jmp ptregscall_common
        CFI_ENDPROC
@@ -16161,7 +16240,7 @@ index 7d65133..27bce5b 100644
        .endm
  
        PTREGSCALL stub_clone, sys_clone, %r8
-@@ -747,9 +1047,10 @@ ENTRY(ptregscall_common)
+@@ -747,9 +1051,10 @@ ENTRY(ptregscall_common)
        movq_cfi_restore R12+8, r12
        movq_cfi_restore RBP+8, rbp
        movq_cfi_restore RBX+8, rbx
@@ -16173,7 +16252,7 @@ index 7d65133..27bce5b 100644
  
  ENTRY(stub_execve)
        CFI_STARTPROC
-@@ -764,7 +1065,7 @@ ENTRY(stub_execve)
+@@ -764,7 +1069,7 @@ ENTRY(stub_execve)
        RESTORE_REST
        jmp int_ret_from_sys_call
        CFI_ENDPROC
@@ -16182,7 +16261,7 @@ index 7d65133..27bce5b 100644
  
  /*
   * sigreturn is special because it needs to restore all registers on return.
-@@ -782,7 +1083,7 @@ ENTRY(stub_rt_sigreturn)
+@@ -782,7 +1087,7 @@ ENTRY(stub_rt_sigreturn)
        RESTORE_REST
        jmp int_ret_from_sys_call
        CFI_ENDPROC
@@ -16191,7 +16270,7 @@ index 7d65133..27bce5b 100644
  
  #ifdef CONFIG_X86_X32_ABI
        PTREGSCALL stub_x32_sigaltstack, sys32_sigaltstack, %rdx
-@@ -851,7 +1152,7 @@ vector=vector+1
+@@ -851,7 +1156,7 @@ vector=vector+1
  2:    jmp common_interrupt
  .endr
        CFI_ENDPROC
@@ -16200,7 +16279,7 @@ index 7d65133..27bce5b 100644
  
  .previous
  END(interrupt)
-@@ -871,6 +1172,16 @@ END(interrupt)
+@@ -871,6 +1176,16 @@ END(interrupt)
        subq $ORIG_RAX-RBP, %rsp
        CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP
        SAVE_ARGS_IRQ
@@ -16217,7 +16296,7 @@ index 7d65133..27bce5b 100644
        call \func
        .endm
  
-@@ -902,7 +1213,7 @@ ret_from_intr:
+@@ -902,7 +1217,7 @@ ret_from_intr:
  
  exit_intr:
        GET_THREAD_INFO(%rcx)
@@ -16226,11 +16305,12 @@ index 7d65133..27bce5b 100644
        je retint_kernel
  
        /* Interrupt came from user space */
-@@ -924,12 +1235,15 @@ retint_swapgs:          /* return to user-space */
+@@ -924,12 +1239,16 @@ retint_swapgs:          /* return to user-space */
         * The iretq could re-enable interrupts:
         */
        DISABLE_INTERRUPTS(CLBR_ANY)
 +      pax_exit_kernel_user
++retint_swapgs_pax:
        TRACE_IRQS_IRETQ
        SWAPGS
        jmp restore_args
@@ -16242,7 +16322,7 @@ index 7d65133..27bce5b 100644
        /*
         * The iretq could re-enable interrupts:
         */
-@@ -1012,7 +1326,7 @@ ENTRY(retint_kernel)
+@@ -1012,7 +1331,7 @@ ENTRY(retint_kernel)
  #endif
  
        CFI_ENDPROC
@@ -16251,7 +16331,7 @@ index 7d65133..27bce5b 100644
  /*
   * End of kprobes section
   */
-@@ -1029,7 +1343,7 @@ ENTRY(\sym)
+@@ -1029,7 +1348,7 @@ ENTRY(\sym)
        interrupt \do_sym
        jmp ret_from_intr
        CFI_ENDPROC
@@ -16260,7 +16340,7 @@ index 7d65133..27bce5b 100644
  .endm
  
  #ifdef CONFIG_SMP
-@@ -1102,12 +1416,22 @@ ENTRY(\sym)
+@@ -1102,12 +1421,22 @@ ENTRY(\sym)
        CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
        call error_entry
        DEFAULT_FRAME 0
@@ -16284,7 +16364,7 @@ index 7d65133..27bce5b 100644
  .endm
  
  .macro paranoidzeroentry sym do_sym
-@@ -1119,15 +1443,25 @@ ENTRY(\sym)
+@@ -1119,15 +1448,25 @@ ENTRY(\sym)
        CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
        call save_paranoid
        TRACE_IRQS_OFF
@@ -16312,7 +16392,7 @@ index 7d65133..27bce5b 100644
  .macro paranoidzeroentry_ist sym do_sym ist
  ENTRY(\sym)
        INTR_FRAME
-@@ -1137,14 +1471,30 @@ ENTRY(\sym)
+@@ -1137,14 +1476,30 @@ ENTRY(\sym)
        CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
        call save_paranoid
        TRACE_IRQS_OFF_DEBUG
@@ -16344,7 +16424,7 @@ index 7d65133..27bce5b 100644
  .endm
  
  .macro errorentry sym do_sym
-@@ -1155,13 +1505,23 @@ ENTRY(\sym)
+@@ -1155,13 +1510,23 @@ ENTRY(\sym)
        CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
        call error_entry
        DEFAULT_FRAME 0
@@ -16369,7 +16449,7 @@ index 7d65133..27bce5b 100644
  .endm
  
        /* error code is on the stack already */
-@@ -1174,13 +1534,23 @@ ENTRY(\sym)
+@@ -1174,13 +1539,23 @@ ENTRY(\sym)
        call save_paranoid
        DEFAULT_FRAME 0
        TRACE_IRQS_OFF
@@ -16394,7 +16474,7 @@ index 7d65133..27bce5b 100644
  .endm
  
  zeroentry divide_error do_divide_error
-@@ -1210,9 +1580,10 @@ gs_change:
+@@ -1210,9 +1585,10 @@ gs_change:
  2:    mfence          /* workaround */
        SWAPGS
        popfq_cfi
@@ -16406,7 +16486,7 @@ index 7d65133..27bce5b 100644
  
        _ASM_EXTABLE(gs_change,bad_gs)
        .section .fixup,"ax"
-@@ -1231,13 +1602,14 @@ ENTRY(kernel_thread_helper)
+@@ -1231,13 +1607,14 @@ ENTRY(kernel_thread_helper)
         * Here we are in the child and the registers are set as they were
         * at kernel_thread() invocation in the parent.
         */
@@ -16422,7 +16502,7 @@ index 7d65133..27bce5b 100644
  
  /*
   * execve(). This function needs to use IRET, not SYSRET, to set up all state properly.
-@@ -1264,11 +1636,11 @@ ENTRY(kernel_execve)
+@@ -1264,11 +1641,11 @@ ENTRY(kernel_execve)
        RESTORE_REST
        testq %rax,%rax
        je int_ret_from_sys_call
@@ -16436,7 +16516,7 @@ index 7d65133..27bce5b 100644
  
  /* Call softirq on interrupt stack. Interrupts are off. */
  ENTRY(call_softirq)
-@@ -1286,9 +1658,10 @@ ENTRY(call_softirq)
+@@ -1286,9 +1663,10 @@ ENTRY(call_softirq)
        CFI_DEF_CFA_REGISTER    rsp
        CFI_ADJUST_CFA_OFFSET   -8
        decl PER_CPU_VAR(irq_count)
@@ -16448,7 +16528,7 @@ index 7d65133..27bce5b 100644
  
  #ifdef CONFIG_XEN
  zeroentry xen_hypervisor_callback xen_do_hypervisor_callback
-@@ -1326,7 +1699,7 @@ ENTRY(xen_do_hypervisor_callback)   # do_hypervisor_callback(struct *pt_regs)
+@@ -1326,7 +1704,7 @@ ENTRY(xen_do_hypervisor_callback)   # do_hypervisor_callback(struct *pt_regs)
        decl PER_CPU_VAR(irq_count)
        jmp  error_exit
        CFI_ENDPROC
@@ -16457,7 +16537,7 @@ index 7d65133..27bce5b 100644
  
  /*
   * Hypervisor uses this for application faults while it executes.
-@@ -1385,7 +1758,7 @@ ENTRY(xen_failsafe_callback)
+@@ -1385,7 +1763,7 @@ ENTRY(xen_failsafe_callback)
        SAVE_ALL
        jmp error_exit
        CFI_ENDPROC
@@ -16466,7 +16546,7 @@ index 7d65133..27bce5b 100644
  
  apicinterrupt XEN_HVM_EVTCHN_CALLBACK \
        xen_hvm_callback_vector xen_evtchn_do_upcall
-@@ -1434,16 +1807,31 @@ ENTRY(paranoid_exit)
+@@ -1434,16 +1812,31 @@ ENTRY(paranoid_exit)
        TRACE_IRQS_OFF_DEBUG
        testl %ebx,%ebx                         /* swapgs needed? */
        jnz paranoid_restore
@@ -16499,7 +16579,7 @@ index 7d65133..27bce5b 100644
        jmp irq_return
  paranoid_userspace:
        GET_THREAD_INFO(%rcx)
-@@ -1472,7 +1860,7 @@ paranoid_schedule:
+@@ -1472,7 +1865,7 @@ paranoid_schedule:
        TRACE_IRQS_OFF
        jmp paranoid_userspace
        CFI_ENDPROC
@@ -16508,7 +16588,7 @@ index 7d65133..27bce5b 100644
  
  /*
   * Exception entry point. This expects an error code/orig_rax on the stack.
-@@ -1499,12 +1887,13 @@ ENTRY(error_entry)
+@@ -1499,12 +1892,13 @@ ENTRY(error_entry)
        movq_cfi r14, R14+8
        movq_cfi r15, R15+8
        xorl %ebx,%ebx
@@ -16523,7 +16603,7 @@ index 7d65133..27bce5b 100644
        ret
  
  /*
-@@ -1531,7 +1920,7 @@ bstep_iret:
+@@ -1531,7 +1925,7 @@ bstep_iret:
        movq %rcx,RIP+8(%rsp)
        jmp error_swapgs
        CFI_ENDPROC
@@ -16532,7 +16612,7 @@ index 7d65133..27bce5b 100644
  
  
  /* ebx:       no swapgs flag (1: don't need swapgs, 0: need it) */
-@@ -1551,7 +1940,7 @@ ENTRY(error_exit)
+@@ -1551,7 +1945,7 @@ ENTRY(error_exit)
        jnz retint_careful
        jmp retint_swapgs
        CFI_ENDPROC
@@ -16541,7 +16621,7 @@ index 7d65133..27bce5b 100644
  
  /*
   * Test if a given stack is an NMI stack or not.
-@@ -1609,9 +1998,11 @@ ENTRY(nmi)
+@@ -1609,9 +2003,11 @@ ENTRY(nmi)
         * If %cs was not the kernel segment, then the NMI triggered in user
         * space, which means it is definitely not nested.
         */
@@ -16554,7 +16634,7 @@ index 7d65133..27bce5b 100644
        /*
         * Check the special variable on the stack to see if NMIs are
         * executing.
-@@ -1758,6 +2149,16 @@ end_repeat_nmi:
+@@ -1758,6 +2154,16 @@ end_repeat_nmi:
         */
        call save_paranoid
        DEFAULT_FRAME 0
@@ -16571,7 +16651,7 @@ index 7d65133..27bce5b 100644
        /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
        movq %rsp,%rdi
        movq $-1,%rsi
-@@ -1765,21 +2166,32 @@ end_repeat_nmi:
+@@ -1765,21 +2171,32 @@ end_repeat_nmi:
        testl %ebx,%ebx                         /* swapgs needed? */
        jnz nmi_restore
  nmi_swapgs:
@@ -20224,7 +20304,7 @@ index 7df1c6d..9ea7c79 100644
  
  out:
 diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
-index f95d242..3b49a90 100644
+index 4837375..2cc9722 100644
 --- a/arch/x86/kvm/emulate.c
 +++ b/arch/x86/kvm/emulate.c
 @@ -256,6 +256,7 @@ struct gprefix {
@@ -20306,10 +20386,10 @@ index f75af40..285b18f 100644
  
        local_irq_disable();
 diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
-index 32eb588..19c4fe3 100644
+index 86c8704..e8ee2ac 100644
 --- a/arch/x86/kvm/vmx.c
 +++ b/arch/x86/kvm/vmx.c
-@@ -1313,7 +1313,11 @@ static void reload_tss(void)
+@@ -1317,7 +1317,11 @@ static void reload_tss(void)
        struct desc_struct *descs;
  
        descs = (void *)gdt->address;
@@ -20321,18 +20401,7 @@ index 32eb588..19c4fe3 100644
        load_TR_desc();
  }
  
-@@ -1475,8 +1479,8 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
-        * The sysexit path does not restore ds/es, so we must set them to
-        * a reasonable value ourselves.
-        */
--      loadsegment(ds, __USER_DS);
--      loadsegment(es, __USER_DS);
-+      loadsegment(ds, __KERNEL_DS);
-+      loadsegment(es, __KERNEL_DS);
- #endif
-       reload_tss();
- #ifdef CONFIG_X86_64
-@@ -2653,8 +2657,11 @@ static __init int hardware_setup(void)
+@@ -2650,8 +2654,11 @@ static __init int hardware_setup(void)
        if (!cpu_has_vmx_flexpriority())
                flexpriority_enabled = 0;
  
@@ -20346,7 +20415,7 @@ index 32eb588..19c4fe3 100644
  
        if (enable_ept && !cpu_has_vmx_ept_2m_page())
                kvm_disable_largepages();
-@@ -3680,7 +3687,7 @@ static void vmx_set_constant_host_state(void)
+@@ -3719,7 +3726,7 @@ static void vmx_set_constant_host_state(void)
        vmcs_writel(HOST_IDTR_BASE, dt.address);   /* 22.2.4 */
  
        asm("mov $.Lkvm_vmx_return, %0" : "=r"(tmpl));
@@ -20355,7 +20424,7 @@ index 32eb588..19c4fe3 100644
  
        rdmsr(MSR_IA32_SYSENTER_CS, low32, high32);
        vmcs_write32(HOST_IA32_SYSENTER_CS, low32);
-@@ -6218,6 +6225,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -6257,6 +6264,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
                "jmp .Lkvm_vmx_return \n\t"
                ".Llaunched: " __ex(ASM_VMX_VMRESUME) "\n\t"
                ".Lkvm_vmx_return: "
@@ -20368,7 +20437,7 @@ index 32eb588..19c4fe3 100644
                /* Save guest registers, load host registers, keep flags */
                "mov %0, %c[wordsize](%%"R"sp) \n\t"
                "pop %0 \n\t"
-@@ -6266,6 +6279,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -6305,6 +6318,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
  #endif
                [cr2]"i"(offsetof(struct vcpu_vmx, vcpu.arch.cr2)),
                [wordsize]"i"(sizeof(ulong))
@@ -20380,28 +20449,41 @@ index 32eb588..19c4fe3 100644
              : "cc", "memory"
                , R"ax", R"bx", R"di", R"si"
  #ifdef CONFIG_X86_64
-@@ -6294,6 +6312,16 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
-               }
-       }
+@@ -6312,7 +6330,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+ #endif
+             );
  
-+      asm("mov %0, %%ds; mov %0, %%es; mov %0, %%ss" : : "r"(__KERNEL_DS));
+-#ifndef CONFIG_X86_64
++#ifdef CONFIG_X86_32
+       /*
+        * The sysexit path does not restore ds/es, so we must set them to
+        * a reasonable value ourselves.
+@@ -6321,8 +6339,18 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+        * may be executed in interrupt context, which saves and restore segments
+        * around it, nullifying its effect.
+        */
+-      loadsegment(ds, __USER_DS);
+-      loadsegment(es, __USER_DS);
++      loadsegment(ds, __KERNEL_DS);
++      loadsegment(es, __KERNEL_DS);
++      loadsegment(ss, __KERNEL_DS);
 +
-+#if defined(CONFIG_X86_32) && defined(CONFIG_PAX_KERNEXEC)
++#ifdef CONFIG_PAX_KERNEXEC
 +      loadsegment(fs, __KERNEL_PERCPU);
 +#endif
 +
-+#if defined(CONFIG_X86_32) && defined(CONFIG_PAX_MEMORY_UDEREF)
++#ifdef CONFIG_PAX_MEMORY_UDEREF
 +      __set_fs(current_thread_info()->addr_limit);
 +#endif
 +
-       vmx->loaded_vmcs->launched = 1;
+ #endif
  
-       vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);
+       vcpu->arch.regs_avail = ~((1 << VCPU_REGS_RIP) | (1 << VCPU_REGS_RSP)
 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
-index be6d549..b0ba2bf 100644
+index 14c290d..0dae6e5 100644
 --- a/arch/x86/kvm/x86.c
 +++ b/arch/x86/kvm/x86.c
-@@ -1357,8 +1357,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
+@@ -1361,8 +1361,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
  {
        struct kvm *kvm = vcpu->kvm;
        int lm = is_long_mode(vcpu);
@@ -20412,7 +20494,7 @@ index be6d549..b0ba2bf 100644
        u8 blob_size = lm ? kvm->arch.xen_hvm_config.blob_size_64
                : kvm->arch.xen_hvm_config.blob_size_32;
        u32 page_num = data & ~PAGE_MASK;
-@@ -2214,6 +2214,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
+@@ -2218,6 +2218,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
                if (n < msr_list.nmsrs)
                        goto out;
                r = -EFAULT;
@@ -20421,7 +20503,7 @@ index be6d549..b0ba2bf 100644
                if (copy_to_user(user_msr_list->indices, &msrs_to_save,
                                 num_msrs_to_save * sizeof(u32)))
                        goto out;
-@@ -2339,7 +2341,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
+@@ -2343,7 +2345,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
  static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
                                    struct kvm_interrupt *irq)
  {
@@ -20430,7 +20512,7 @@ index be6d549..b0ba2bf 100644
                return -EINVAL;
        if (irqchip_in_kernel(vcpu->kvm))
                return -ENXIO;
-@@ -4876,7 +4878,7 @@ static void kvm_set_mmio_spte_mask(void)
+@@ -4880,7 +4882,7 @@ static void kvm_set_mmio_spte_mask(void)
        kvm_mmu_set_mmio_spte_mask(mask);
  }
  
@@ -23336,15 +23418,14 @@ index e5b130b..6690d31 100644
 +}
 +EXPORT_SYMBOL(copy_to_user_overflow);
 diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c
-index 903ec1e..833f340 100644
+index 903ec1e..af8e064 100644
 --- a/arch/x86/mm/extable.c
 +++ b/arch/x86/mm/extable.c
-@@ -6,12 +6,25 @@
+@@ -6,12 +6,24 @@
  static inline unsigned long
  ex_insn_addr(const struct exception_table_entry *x)
  {
 -      return (unsigned long)&x->insn + x->insn;
-+//printk(KERN_ERR "fixup %p insn:%x fixup:%x\n", x, x->insn, x->fixup);
 +      unsigned long reloc = 0;
 +
 +#if defined(CONFIG_PAX_KERNEXEC) && defined(CONFIG_X86_32)
@@ -23367,7 +23448,7 @@ index 903ec1e..833f340 100644
  }
  
  int fixup_exception(struct pt_regs *regs)
-@@ -20,7 +33,7 @@ int fixup_exception(struct pt_regs *regs)
+@@ -20,7 +32,7 @@ int fixup_exception(struct pt_regs *regs)
        unsigned long new_ip;
  
  #ifdef CONFIG_PNPBIOS
@@ -23376,14 +23457,6 @@ index 903ec1e..833f340 100644
                extern u32 pnp_bios_fault_eip, pnp_bios_fault_esp;
                extern u32 pnp_bios_is_utter_crap;
                pnp_bios_is_utter_crap = 1;
-@@ -34,6 +47,7 @@ int fixup_exception(struct pt_regs *regs)
- #endif
-       fixup = search_exception_tables(regs->ip);
-+//printk(KERN_ERR "fixup %p %lx\n", fixup, regs->ip);
-       if (fixup) {
-               new_ip = ex_fixup_addr(fixup);
 diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
 index 76dcd9d..e9dffde 100644
 --- a/arch/x86/mm/fault.c
@@ -26541,7 +26614,7 @@ index 218cdb1..fd55c08 100644
        syscall_init();                         /* This sets MSR_*STAR and related */
  #endif
 diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
-index cbca565..35ce1d7 100644
+index cbca565..bae7133 100644
 --- a/arch/x86/realmode/init.c
 +++ b/arch/x86/realmode/init.c
 @@ -62,7 +62,13 @@ void __init setup_real_mode(void)
@@ -26552,7 +26625,7 @@ index cbca565..35ce1d7 100644
 +      trampoline_header->start = __pa(ktla_ktva(startup_32_smp));
 +
 +#ifdef CONFIG_PAX_KERNEXEC
-+      trampoline_header->start -=  LOAD_PHYSICAL_ADDR;
++      trampoline_header->start -= LOAD_PHYSICAL_ADDR;
 +#endif
 +
 +      trampoline_header->boot_cs = __BOOT_CS;
@@ -27605,7 +27678,7 @@ index 251c7b62..000462d 100644
                                bool enable = !device_may_wakeup(&dev->dev);
                                device_set_wakeup_enable(&dev->dev, enable);
 diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
-index 0734086..3ad3e4c 100644
+index bbac51e..4c094f9 100644
 --- a/drivers/acpi/processor_driver.c
 +++ b/drivers/acpi/processor_driver.c
 @@ -556,7 +556,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
@@ -29623,10 +29696,10 @@ index 0a484b4..f48ccd1 100644
  
        if (cmd != SIOCWANDEV)
 diff --git a/drivers/char/random.c b/drivers/char/random.c
-index 4ec04a7..9918387 100644
+index d98b2a6..f0ceb97 100644
 --- a/drivers/char/random.c
 +++ b/drivers/char/random.c
-@@ -261,8 +261,13 @@
+@@ -272,8 +272,13 @@
  /*
   * Configuration information
   */
@@ -29640,7 +29713,7 @@ index 4ec04a7..9918387 100644
  #define SEC_XFER_SIZE 512
  #define EXTRACT_SIZE 10
  
-@@ -300,10 +305,17 @@ static struct poolinfo {
+@@ -313,10 +318,17 @@ static struct poolinfo {
        int poolwords;
        int tap1, tap2, tap3, tap4, tap5;
  } poolinfo_table[] = {
@@ -29658,7 +29731,18 @@ index 4ec04a7..9918387 100644
  #if 0
        /* x^2048 + x^1638 + x^1231 + x^819 + x^411 + x + 1  -- 115 */
        { 2048, 1638,   1231,   819,    411,    1 },
-@@ -726,6 +738,17 @@ void add_disk_randomness(struct gendisk *disk)
+@@ -527,8 +539,8 @@ static void _mix_pool_bytes(struct entropy_store *r, const void *in,
+               input_rotate += i ? 7 : 14;
+       }
+-      ACCESS_ONCE(r->input_rotate) = input_rotate;
+-      ACCESS_ONCE(r->add_ptr) = i;
++      ACCESS_ONCE_RW(r->input_rotate) = input_rotate;
++      ACCESS_ONCE_RW(r->add_ptr) = i;
+       smp_wmb();
+       if (out)
+@@ -799,6 +811,17 @@ void add_disk_randomness(struct gendisk *disk)
  }
  #endif
  
@@ -29667,8 +29751,8 @@ index 4ec04a7..9918387 100644
 +
 +__init void transfer_latent_entropy(void)
 +{
-+      mix_pool_bytes(&input_pool, &latent_entropy, sizeof(latent_entropy));
-+      mix_pool_bytes(&nonblocking_pool, &latent_entropy, sizeof(latent_entropy));
++      mix_pool_bytes(&input_pool, &latent_entropy, sizeof(latent_entropy), NULL);
++      mix_pool_bytes(&nonblocking_pool, &latent_entropy, sizeof(latent_entropy), NULL);
 +//    printk(KERN_INFO "PAX: transferring latent entropy: %16llx\n", latent_entropy);
 +}
 +#endif
@@ -29676,7 +29760,7 @@ index 4ec04a7..9918387 100644
  /*********************************************************************
   *
   * Entropy extraction routines
-@@ -913,7 +936,7 @@ static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,
+@@ -1008,7 +1031,7 @@ static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,
  
                extract_buf(r, tmp);
                i = min_t(int, nbytes, EXTRACT_SIZE);
@@ -29685,7 +29769,7 @@ index 4ec04a7..9918387 100644
                        ret = -EFAULT;
                        break;
                }
-@@ -1238,7 +1261,7 @@ EXPORT_SYMBOL(generate_random_uuid);
+@@ -1342,7 +1365,7 @@ EXPORT_SYMBOL(generate_random_uuid);
  #include <linux/sysctl.h>
  
  static int min_read_thresh = 8, min_write_thresh;
@@ -29970,10 +30054,10 @@ index 515a42c..5ecf3ba 100644
  void fw_card_initialize(struct fw_card *card,
                const struct fw_card_driver *driver, struct device *device);
 diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
-index 153980b..4b4d046 100644
+index b298158..7ed8432 100644
 --- a/drivers/firmware/dmi_scan.c
 +++ b/drivers/firmware/dmi_scan.c
-@@ -449,11 +449,6 @@ void __init dmi_scan_machine(void)
+@@ -452,11 +452,6 @@ void __init dmi_scan_machine(void)
                }
        }
        else {
@@ -29985,7 +30069,7 @@ index 153980b..4b4d046 100644
                p = dmi_ioremap(0xF0000, 0x10000);
                if (p == NULL)
                        goto error;
-@@ -723,7 +718,7 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *),
+@@ -726,7 +721,7 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *),
        if (buf == NULL)
                return -1;
  
@@ -30510,7 +30594,7 @@ index ed3224c..6618589 100644
        iir = I915_READ(IIR);
  
 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
-index a8538ac..4868a05 100644
+index 8a11131..46eeeaa 100644
 --- a/drivers/gpu/drm/i915/intel_display.c
 +++ b/drivers/gpu/drm/i915/intel_display.c
 @@ -2000,7 +2000,7 @@ intel_finish_fb(struct drm_framebuffer *old_fb)
@@ -30522,7 +30606,7 @@ index a8538ac..4868a05 100644
  
        /* Big Hammer, we also need to ensure that any pending
         * MI_WAIT_FOR_EVENT inside a user batch buffer on the
-@@ -5925,9 +5925,8 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
+@@ -5914,9 +5914,8 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
  
        obj = work->old_fb_obj;
  
@@ -30534,7 +30618,7 @@ index a8538ac..4868a05 100644
                wake_up(&dev_priv->pending_flip_queue);
  
        schedule_work(&work->work);
-@@ -6264,7 +6263,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
+@@ -6253,7 +6252,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
        /* Block clients from rendering to the new back buffer until
         * the flip occurs and the object is no longer visible.
         */
@@ -30543,7 +30627,7 @@ index a8538ac..4868a05 100644
  
        ret = dev_priv->display.queue_flip(dev, crtc, fb, obj);
        if (ret)
-@@ -6279,7 +6278,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
+@@ -6268,7 +6267,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
        return 0;
  
  cleanup_pending:
@@ -30708,7 +30792,7 @@ index a9514ea..369d511 100644
                        .train_set = nv50_sor_dp_train_set,
                        .train_adj = nv50_sor_dp_train_adj
 diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c
-index c486d3c..3a7d6f4 100644
+index c50b075..6b07dfc 100644
 --- a/drivers/gpu/drm/nouveau/nvd0_display.c
 +++ b/drivers/gpu/drm/nouveau/nvd0_display.c
 @@ -1366,7 +1366,7 @@ nvd0_sor_dpms(struct drm_encoder *encoder, int mode)
@@ -31156,10 +31240,10 @@ index 8a8725c..afed796 100644
                        marker = list_first_entry(&queue->head,
                                                 struct vmw_marker, head);
 diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
-index 4c87276..9ecc3c7 100644
+index 1f6957c..b579481 100644
 --- a/drivers/hid/hid-core.c
 +++ b/drivers/hid/hid-core.c
-@@ -2151,7 +2151,7 @@ static bool hid_ignore(struct hid_device *hdev)
+@@ -2153,7 +2153,7 @@ static bool hid_ignore(struct hid_device *hdev)
  
  int hid_add_device(struct hid_device *hdev)
  {
@@ -31168,7 +31252,7 @@ index 4c87276..9ecc3c7 100644
        int ret;
  
        if (WARN_ON(hdev->status & HID_STAT_ADDED))
-@@ -2186,7 +2186,7 @@ int hid_add_device(struct hid_device *hdev)
+@@ -2188,7 +2188,7 @@ int hid_add_device(struct hid_device *hdev)
        /* XXX hack, any other cleaner solution after the driver core
         * is converted to allow more than 20 bytes as the device name? */
        dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus,
@@ -33506,7 +33590,7 @@ index 1cbfc6b..56e1dbb 100644
  /*----------------------------------------------------------------*/
  
 diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
-index cacd008..2823610 100644
+index 53aec45..250851c 100644
 --- a/drivers/md/raid1.c
 +++ b/drivers/md/raid1.c
 @@ -1685,7 +1685,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
@@ -35419,10 +35503,10 @@ index d9e0824..1a874e7 100644
  
  static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
 diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
-index b620c55..a76cd49 100644
+index 02f5007..bd0bd8f 100644
 --- a/drivers/net/wireless/ath/ath9k/hw.h
 +++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -609,7 +609,7 @@ struct ath_hw_private_ops {
+@@ -610,7 +610,7 @@ struct ath_hw_private_ops {
  
        /* ANI */
        void (*ani_cache_ini_regs)(struct ath_hw *ah);
@@ -35431,7 +35515,7 @@ index b620c55..a76cd49 100644
  
  /**
   * struct ath_hw_ops - callbacks used by hardware code and driver code
-@@ -639,7 +639,7 @@ struct ath_hw_ops {
+@@ -640,7 +640,7 @@ struct ath_hw_ops {
        void (*antdiv_comb_conf_set)(struct ath_hw *ah,
                        struct ath_hw_antcomb_conf *antconf);
  
@@ -35440,7 +35524,7 @@ index b620c55..a76cd49 100644
  
  struct ath_nf_limits {
        s16 max;
-@@ -659,7 +659,7 @@ enum ath_cal_list {
+@@ -660,7 +660,7 @@ enum ath_cal_list {
  #define AH_FASTCC       0x4
  
  struct ath_hw {
@@ -38977,6 +39061,19 @@ index b0b2ac3..89a4399 100644
        "AGP",
        "PCI",
        "PRO AGP",
+diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
+index 2e471c2..f00eb3e 100644
+--- a/drivers/video/console/fbcon.c
++++ b/drivers/video/console/fbcon.c
+@@ -442,7 +442,7 @@ static int __init fb_console_setup(char *this_opt)
+       while ((options = strsep(&this_opt, ",")) != NULL) {
+               if (!strncmp(options, "font:", 5))
+-                      strcpy(fontname, options + 5);
++                      strlcpy(fontname, options + 5, sizeof(fontname));
+               
+               if (!strncmp(options, "scrollback:", 11)) {
+                       options += 11;
 diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
 index 5c3960d..15cf8fc 100644
 --- a/drivers/video/fbcmap.c
@@ -42225,7 +42322,7 @@ index 0da9095..1386693 100644
                        goto out_sig;
                if (offset > inode->i_sb->s_maxbytes)
 diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
-index da8876d..9f3e6d8 100644
+index da8876d..4456166 100644
 --- a/fs/autofs4/waitq.c
 +++ b/fs/autofs4/waitq.c
 @@ -61,7 +61,7 @@ static int autofs4_write(struct autofs_sb_info *sbi,
@@ -42237,6 +42334,30 @@ index da8876d..9f3e6d8 100644
        ssize_t wr = 0;
  
        sigpipe = sigismember(&current->pending.signal, SIGPIPE);
+@@ -348,6 +348,10 @@ static int validate_request(struct autofs_wait_queue **wait,
+       return 1;
+ }
++#ifdef CONFIG_GRKERNSEC_HIDESYM
++static atomic_unchecked_t autofs_dummy_name_id = ATOMIC_INIT(0);
++#endif
++
+ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
+               enum autofs_notify notify)
+ {
+@@ -381,7 +385,12 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
+       /* If this is a direct mount request create a dummy name */
+       if (IS_ROOT(dentry) && autofs_type_trigger(sbi->type))
++#ifdef CONFIG_GRKERNSEC_HIDESYM
++              /* this name does get written to userland via autofs4_write() */
++              qstr.len = sprintf(name, "%08lx", atomic_inc_return_unchecked(&autofs_dummy_name_id));
++#else
+               qstr.len = sprintf(name, "%p", dentry);
++#endif
+       else {
+               qstr.len = autofs4_getpath(sbi, dentry, &name);
+               if (!qstr.len) {
 diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
 index e18da23..affc30e 100644
 --- a/fs/befs/linuxvfs.c
@@ -43862,7 +43983,7 @@ index 6901578..d402eb5 100644
  
        return hit;
 diff --git a/fs/compat.c b/fs/compat.c
-index 6161255..512b1a1 100644
+index 6161255..9f28287 100644
 --- a/fs/compat.c
 +++ b/fs/compat.c
 @@ -490,7 +490,7 @@ compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
@@ -43972,6 +44093,38 @@ index 6161255..512b1a1 100644
                if (__put_user_unaligned(d_off, &lastdirent->d_off))
                        error = -EFAULT;
                else
+@@ -1155,11 +1173,14 @@ compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec,
+       struct file *file;
+       int fput_needed;
+       ssize_t ret;
++      loff_t pos;
+       file = fget_light(fd, &fput_needed);
+       if (!file)
+               return -EBADF;
+-      ret = compat_readv(file, vec, vlen, &file->f_pos);
++      pos = file->f_pos;
++      ret = compat_readv(file, vec, vlen, &pos);
++      file->f_pos = pos;
+       fput_light(file, fput_needed);
+       return ret;
+ }
+@@ -1221,11 +1242,14 @@ compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec,
+       struct file *file;
+       int fput_needed;
+       ssize_t ret;
++      loff_t pos;
+       file = fget_light(fd, &fput_needed);
+       if (!file)
+               return -EBADF;
+-      ret = compat_writev(file, vec, vlen, &file->f_pos);
++      pos = file->f_pos;
++      ret = compat_writev(file, vec, vlen, &pos);
++      file->f_pos = pos;
+       fput_light(file, fput_needed);
+       return ret;
+ }
 diff --git a/fs/compat_binfmt_elf.c b/fs/compat_binfmt_elf.c
 index 112e45a..b59845b 100644
 --- a/fs/compat_binfmt_elf.c
@@ -44146,8 +44299,22 @@ index b2a34a1..162fa69 100644
        set_fs(fs_save);
        return rc;
  }
+diff --git a/fs/eventpoll.c b/fs/eventpoll.c
+index 1c8b556..eedec84 100644
+--- a/fs/eventpoll.c
++++ b/fs/eventpoll.c
+@@ -1654,8 +1654,8 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
+               error = PTR_ERR(file);
+               goto out_free_fd;
+       }
+-      fd_install(fd, file);
+       ep->file = file;
++      fd_install(fd, file);
+       return fd;
+ out_free_fd:
 diff --git a/fs/exec.c b/fs/exec.c
-index e95aeed..9c7b4c2 100644
+index e95aeed..a943469 100644
 --- a/fs/exec.c
 +++ b/fs/exec.c
 @@ -55,6 +55,15 @@
@@ -44846,9 +45013,9 @@ index e95aeed..9c7b4c2 100644
 +#endif
 +
 +#ifdef CONFIG_PAX_SIZE_OVERFLOW
-+void report_size_overflow(const char *file, unsigned int line, const char *func)
++void report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name)
 +{
-+      printk(KERN_ERR "PAX: size overflow detected in function %s %s:%u\n", func, file, line);
++      printk(KERN_ERR "PAX: size overflow detected in function %s %s:%u %s", func, file, line, ssa_name);
 +      dump_stack();
 +      do_group_exit(SIGKILL);
 +}
@@ -45034,10 +45201,10 @@ index 25cd608..9ed5294 100644
        }
        return 1;
 diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
-index d23b31c..0585239 100644
+index 1b50890..e56c5ad 100644
 --- a/fs/ext4/balloc.c
 +++ b/fs/ext4/balloc.c
-@@ -488,8 +488,8 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,
+@@ -500,8 +500,8 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,
        /* Hm, nope.  Are (enough) root reserved clusters available? */
        if (uid_eq(sbi->s_resuid, current_fsuid()) ||
            (!gid_eq(sbi->s_resgid, GLOBAL_ROOT_GID) && in_group_p(sbi->s_resgid)) ||
@@ -46864,6 +47031,18 @@ index c99163b..a11ad40 100644
  
                res = next - LAST_INO_BATCH;
        }
+diff --git a/fs/isofs/export.c b/fs/isofs/export.c
+index aa4356d..1d38044 100644
+--- a/fs/isofs/export.c
++++ b/fs/isofs/export.c
+@@ -134,6 +134,7 @@ isofs_export_encode_fh(struct inode *inode,
+       len = 3;
+       fh32[0] = ei->i_iget5_block;
+       fh16[2] = (__u16)ei->i_iget5_offset;  /* fh16 [sic] */
++      fh16[3] = 0;  /* avoid leaking uninitialized data */
+       fh32[2] = inode->i_generation;
+       if (parent) {
+               struct iso_inode_info *eparent;
 diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
 index 4a6cf28..d3a29d3 100644
 --- a/fs/jffs2/erase.c
@@ -49853,6 +50032,18 @@ index c175b4d..8f36a16 100644
        u8 checksum = 0;
        int i;
        for (i = 0; i < sizeof(struct tag); ++i)
+diff --git a/fs/udf/namei.c b/fs/udf/namei.c
+index 1802417..c31deb3 100644
+--- a/fs/udf/namei.c
++++ b/fs/udf/namei.c
+@@ -1279,6 +1279,7 @@ static int udf_encode_fh(struct inode *inode, __u32 *fh, int *lenp,
+       *lenp = 3;
+       fid->udf.block = location.logicalBlockNum;
+       fid->udf.partref = location.partitionReferenceNum;
++      fid->udf.parent_partref = 0;
+       fid->udf.generation = inode->i_generation;
+       if (parent) {
 diff --git a/fs/utimes.c b/fs/utimes.c
 index fa4dbe4..e12d1b9 100644
 --- a/fs/utimes.c
@@ -49992,6 +50183,27 @@ index 19bf0c5..9f26b02 100644
                            off & 0x7fffffff, ino, DT_UNKNOWN)) {
                        *offset = off & 0x7fffffff;
                        return 0;
+diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
+index f9c3fe3..69cf4fc 100644
+--- a/fs/xfs/xfs_discard.c
++++ b/fs/xfs/xfs_discard.c
+@@ -179,12 +179,14 @@ xfs_ioc_trim(
+        * used by the fstrim application.  In the end it really doesn't
+        * matter as trimming blocks is an advisory interface.
+        */
++      if (range.start >= XFS_FSB_TO_B(mp, mp->m_sb.sb_dblocks) ||
++          range.minlen > XFS_FSB_TO_B(mp, XFS_ALLOC_AG_MAX_USABLE(mp)))
++              return -XFS_ERROR(EINVAL);
++
+       start = BTOBB(range.start);
+       end = start + BTOBBT(range.len) - 1;
+       minlen = BTOBB(max_t(u64, granularity, range.minlen));
+-      if (XFS_BB_TO_FSB(mp, start) >= mp->m_sb.sb_dblocks)
+-              return -XFS_ERROR(EINVAL);
+       if (end > XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks) - 1)
+               end = XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)- 1;
 diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
 index 3a05a41..320bec6 100644
 --- a/fs/xfs/xfs_ioctl.c
@@ -50018,6 +50230,19 @@ index 1a25fd8..e935581 100644
  
        if (!IS_ERR(s))
                kfree(s);
+diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
+index 92d4331..ca28a4b 100644
+--- a/fs/xfs/xfs_rtalloc.c
++++ b/fs/xfs/xfs_rtalloc.c
+@@ -857,7 +857,7 @@ xfs_rtbuf_get(
+       xfs_buf_t       *bp;            /* block buffer, result */
+       xfs_inode_t     *ip;            /* bitmap or summary inode */
+       xfs_bmbt_irec_t map;
+-      int             nmap;
++      int             nmap = 1;
+       int             error;          /* error value */
+       ip = issum ? mp->m_rsumip : mp->m_rbmip;
 diff --git a/grsecurity/Kconfig b/grsecurity/Kconfig
 new file mode 100644
 index 0000000..4d533f1
@@ -51011,7 +51236,7 @@ index 0000000..1b9afa9
 +endif
 diff --git a/grsecurity/gracl.c b/grsecurity/gracl.c
 new file mode 100644
-index 0000000..bda2a91
+index 0000000..1561617
 --- /dev/null
 +++ b/grsecurity/gracl.c
 @@ -0,0 +1,4017 @@
@@ -53214,8 +53439,8 @@ index 0000000..bda2a91
 +      // if old name had restrictions/auditing, make sure the new name does as well
 +      needmode = oldmode & (GR_NOPTRACE | GR_PTRACERD | GR_INHERIT | GR_AUDITS);
 +
-+      // don't allow hardlinking of suid/sgid files without permission
-+      if (old_dentry->d_inode->i_mode & (S_ISUID | S_ISGID))
++      // don't allow hardlinking of suid/sgid/fcapped files without permission
++      if (is_privileged_binary(old_dentry))
 +              needmode |= GR_SETID;
 +
 +      if ((newmode & needmode) != needmode)
@@ -53226,7 +53451,7 @@ index 0000000..bda2a91
 +              return newmode;
 +bad:
 +      needmode = oldmode;
-+      if (old_dentry->d_inode->i_mode & (S_ISUID | S_ISGID))
++      if (is_privileged_binary(old_dentry))
 +              needmode |= GR_SETID;
 +      
 +      if (current->acl->mode & (GR_LEARN | GR_INHERITLEARN)) {
@@ -55261,10 +55486,10 @@ index 0000000..6d21049
 +
 diff --git a/grsecurity/gracl_fs.c b/grsecurity/gracl_fs.c
 new file mode 100644
-index 0000000..88d0e87
+index 0000000..d28e241
 --- /dev/null
 +++ b/grsecurity/gracl_fs.c
-@@ -0,0 +1,435 @@
+@@ -0,0 +1,437 @@
 +#include <linux/kernel.h>
 +#include <linux/sched.h>
 +#include <linux/types.h>
@@ -55365,7 +55590,8 @@ index 0000000..88d0e87
 +      if ((acc_mode & MAY_READ) &&
 +          !((open_flags & O_DIRECTORY) || (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode))))
 +              reqmode |= GR_READ;
-+      if ((open_flags & O_CREAT) && (imode & (S_ISUID | S_ISGID)))
++      if ((open_flags & O_CREAT) &&
++          ((imode & S_ISUID) || ((imode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))))
 +              reqmode |= GR_SETID;
 +
 +      mode =
@@ -55483,7 +55709,8 @@ index 0000000..88d0e87
 +      if (unlikely(dentry->d_inode && S_ISSOCK(dentry->d_inode->i_mode)))
 +              return 1;
 +
-+      if (unlikely(mode & (S_ISUID | S_ISGID))) {
++      if (unlikely(dentry->d_inode && !S_ISDIR(dentry->d_inode->i_mode) &&
++                   ((mode & S_ISUID) || ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))))) {
 +              return generic_fs_handler(dentry, mnt, GR_WRITE | GR_SETID,
 +                                 GR_CHMOD_ACL_MSG);
 +      } else {
@@ -55597,7 +55824,7 @@ index 0000000..88d0e87
 +                  const int mode)
 +{
 +      __u32 reqmode = GR_WRITE | GR_CREATE;
-+      if (unlikely(mode & (S_ISUID | S_ISGID)))
++      if (unlikely((mode & S_ISUID) || ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))))
 +              reqmode |= GR_SETID;
 +
 +      return generic_fs_create_handler(new_dentry, parent_dentry, parent_mnt,
@@ -58100,10 +58327,10 @@ index 0000000..05a6015
 +}
 diff --git a/grsecurity/grsec_link.c b/grsecurity/grsec_link.c
 new file mode 100644
-index 0000000..a225b02
+index 0000000..589481f
 --- /dev/null
 +++ b/grsecurity/grsec_link.c
-@@ -0,0 +1,59 @@
+@@ -0,0 +1,58 @@
 +#include <linux/kernel.h>
 +#include <linux/sched.h>
 +#include <linux/fs.h>
@@ -58153,8 +58380,7 @@ index 0000000..a225b02
 +      const struct cred *cred = current_cred();
 +
 +      if (grsec_enable_link && !uid_eq(cred->fsuid, inode->i_uid) &&
-+          (!S_ISREG(mode) || (mode & S_ISUID) ||
-+           ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) ||
++          (!S_ISREG(mode) || is_privileged_binary(dentry) || 
 +           (inode_permission(inode, MAY_READ | MAY_WRITE))) &&
 +          !capable(CAP_FOWNER) && !uid_eq(cred->uid, GLOBAL_ROOT_UID)) {
 +              gr_log_fs_int2_str(GR_DONT_AUDIT, GR_HARDLINK_MSG, dentry, mnt, inode->i_uid, inode->i_gid, to);
@@ -59804,6 +60030,21 @@ index 9e6e1c6..d47b906 100644
  
  #define ACPI_DRIVER_ALL_NOTIFY_EVENTS 0x1     /* system AND device events */
  
+diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h
+index 77ff547..181834f 100644
+--- a/include/asm-generic/4level-fixup.h
++++ b/include/asm-generic/4level-fixup.h
+@@ -13,8 +13,10 @@
+ #define pmd_alloc(mm, pud, address) \
+       ((unlikely(pgd_none(*(pud))) && __pmd_alloc(mm, pud, address))? \
+               NULL: pmd_offset(pud, address))
++#define pmd_alloc_kernel(mm, pud, address) pmd_alloc((mm), (pud), (address))
+ #define pud_alloc(mm, pgd, address)   (pgd)
++#define pud_alloc_kernel(mm, pgd, address)    pud_alloc((mm), (pgd), (address))
+ #define pud_offset(pgd, start)                (pgd)
+ #define pud_none(pud)                 0
+ #define pud_bad(pud)                  0
 diff --git a/include/asm-generic/atomic-long.h b/include/asm-generic/atomic-long.h
 index b7babf0..3ba8aee 100644
 --- a/include/asm-generic/atomic-long.h
@@ -60566,10 +60807,10 @@ index 4c57065..4307975 100644
  #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
  #endif
 diff --git a/include/linux/capability.h b/include/linux/capability.h
-index d10b7ed..11390a1 100644
+index d10b7ed..0288b79 100644
 --- a/include/linux/capability.h
 +++ b/include/linux/capability.h
-@@ -553,6 +553,9 @@ extern bool capable(int cap);
+@@ -553,10 +553,15 @@ extern bool capable(int cap);
  extern bool ns_capable(struct user_namespace *ns, int cap);
  extern bool nsown_capable(int cap);
  extern bool inode_capable(const struct inode *inode, int cap);
@@ -60579,6 +60820,12 @@ index d10b7ed..11390a1 100644
  
  /* audit system wants to get cap info from files as well */
  extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
++extern int is_privileged_binary(const struct dentry *dentry);
++
+ #endif /* __KERNEL__ */
+ #endif /* !_LINUX_CAPABILITY_H */
 diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
 index 42e55de..1cd0e66 100644
 --- a/include/linux/cleancache.h
@@ -62309,7 +62556,7 @@ index 8185f57..7b2d222 100644
  };
  
 diff --git a/include/linux/init.h b/include/linux/init.h
-index 6b95109..bcbdd68 100644
+index 6b95109..7616d09 100644
 --- a/include/linux/init.h
 +++ b/include/linux/init.h
 @@ -39,9 +39,15 @@
@@ -62356,22 +62603,6 @@ index 6b95109..bcbdd68 100644
  #define __meminitdata    __section(.meminit.data)
  #define __meminitconst   __section(.meminit.rodata)
  #define __memexit        __section(.memexit.text) __exitused __cold notrace
-@@ -294,13 +300,13 @@ void __init parse_early_options(char *cmdline);
- /* Each module must use one module_init(). */
- #define module_init(initfn)                                   \
--      static inline initcall_t __inittest(void)               \
-+      static inline __used initcall_t __inittest(void)        \
-       { return initfn; }                                      \
-       int init_module(void) __attribute__((alias(#initfn)));
- /* This is only required if you want to be unloadable. */
- #define module_exit(exitfn)                                   \
--      static inline exitcall_t __exittest(void)               \
-+      static inline __used exitcall_t __exittest(void)        \
-       { return exitfn; }                                      \
-       void cleanup_module(void) __attribute__((alias(#exitfn)));
 diff --git a/include/linux/init_task.h b/include/linux/init_task.h
 index 9e65eff..b131e8b 100644
 --- a/include/linux/init_task.h
@@ -63276,20 +63507,20 @@ index 3fd2e87..d93a721 100644
  struct ctl_table_header;
  struct ctl_table;
 diff --git a/include/linux/random.h b/include/linux/random.h
-index 8f74538..de61694 100644
+index ac621ce..c1215f3 100644
 --- a/include/linux/random.h
 +++ b/include/linux/random.h
-@@ -54,6 +54,10 @@ extern void add_input_randomness(unsigned int type, unsigned int code,
+@@ -53,6 +53,10 @@ extern void add_input_randomness(unsigned int type, unsigned int code,
                                 unsigned int value);
- extern void add_interrupt_randomness(int irq);
+ extern void add_interrupt_randomness(int irq, int irq_flags);
  
 +#ifdef CONFIG_PAX_LATENT_ENTROPY
 +extern void transfer_latent_entropy(void);
 +#endif
 +
  extern void get_random_bytes(void *buf, int nbytes);
+ extern void get_random_bytes_arch(void *buf, int nbytes);
  void generate_random_uuid(unsigned char uuid_out[16]);
 @@ -69,12 +73,17 @@ void srandom32(u32 seed);
  
  u32 prandom32(struct rnd_state *);
@@ -63656,7 +63887,7 @@ index 899fbb4..1cb4138 100644
  
  #define VIDEO_TYPE_MDA                0x10    /* Monochrome Text Display      */
 diff --git a/include/linux/security.h b/include/linux/security.h
-index 4e5a73c..a5784a1 100644
+index 3dea6a9..81fd81f 100644
 --- a/include/linux/security.h
 +++ b/include/linux/security.h
 @@ -26,6 +26,7 @@
@@ -64627,6 +64858,23 @@ index bbd023a..97c6d0d 100644
  
  #ifdef CONFIG_IP_MROUTE
  #ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
+diff --git a/include/net/scm.h b/include/net/scm.h
+index d456f4c..0c0017c 100644
+--- a/include/net/scm.h
++++ b/include/net/scm.h
+@@ -71,9 +71,11 @@ static __inline__ void scm_destroy(struct scm_cookie *scm)
+ }
+ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
+-                             struct scm_cookie *scm)
++                             struct scm_cookie *scm, bool forcecreds)
+ {
+       memset(scm, 0, sizeof(*scm));
++      if (forcecreds)
++              scm_set_cred(scm, task_tgid(current), current_cred());
+       unix_get_peersec_dgram(sock, scm);
+       if (msg->msg_controllen <= 0)
+               return 0;
 diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
 index a2ef814..31a8e3f 100644
 --- a/include/net/sctp/sctp.h
@@ -68390,7 +68638,7 @@ index 19db29f..33b52b6 100644
  
                if (pm_wakeup_pending()) {
 diff --git a/kernel/printk.c b/kernel/printk.c
-index 21bea76..f55ef3e 100644
+index 146827f..a501fec 100644
 --- a/kernel/printk.c
 +++ b/kernel/printk.c
 @@ -782,6 +782,11 @@ static int check_syslog_permissions(int type, bool from_file)
@@ -70446,18 +70694,6 @@ index 66ce414..6f0a0dd 100644
                err_printk(dev, NULL, "DMA-API: device driver maps memory from"
                                "stack [addr=%p]\n", addr);
  }
-diff --git a/lib/extable.c b/lib/extable.c
-index 4cac81e..4d66cfc 100644
---- a/lib/extable.c
-+++ b/lib/extable.c
-@@ -13,6 +13,7 @@
- #include <linux/init.h>
- #include <linux/sort.h>
- #include <asm/uaccess.h>
-+#include <asm/pgtable.h>
- #ifndef ARCH_HAS_SORT_EXTABLE
- /*
 diff --git a/lib/inflate.c b/lib/inflate.c
 index 013a761..c28f3fc 100644
 --- a/lib/inflate.c
@@ -70521,7 +70757,7 @@ index e796429..6e38f9f 100644
  static inline void *ptr_to_indirect(void *ptr)
  {
 diff --git a/lib/vsprintf.c b/lib/vsprintf.c
-index c3f36d41..5c5aeb5 100644
+index 598a73e..5c5aeb5 100644
 --- a/lib/vsprintf.c
 +++ b/lib/vsprintf.c
 @@ -16,6 +16,9 @@
@@ -70593,7 +70829,7 @@ index c3f36d41..5c5aeb5 100644
        case 'B':
                return symbol_string(buf, end, ptr, spec, *fmt);
        case 'R':
-@@ -1025,12 +1041,15 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
+@@ -1025,6 +1041,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
                        va_end(va);
                        return buf;
                }
@@ -70602,15 +70838,7 @@ index c3f36d41..5c5aeb5 100644
        case 'K':
                /*
                 * %pK cannot be used in IRQ context because its test
-                * for CAP_SYSLOG would be meaningless.
-                */
--              if (in_irq() || in_serving_softirq() || in_nmi()) {
-+              if (kptr_restrict && (in_irq() || in_serving_softirq() ||
-+                                    in_nmi())) {
-                       if (spec.field_width == -1)
-                               spec.field_width = default_width;
-                       return string(buf, end, "pK-error", spec);
-@@ -1047,6 +1066,21 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
+@@ -1048,6 +1066,21 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
                }
                break;
        }
@@ -70632,7 +70860,7 @@ index c3f36d41..5c5aeb5 100644
        spec.flags |= SMALL;
        if (spec.field_width == -1) {
                spec.field_width = default_width;
-@@ -1758,11 +1792,11 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
+@@ -1759,11 +1792,11 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
        typeof(type) value;                                             \
        if (sizeof(type) == 8) {                                        \
                args = PTR_ALIGN(args, sizeof(u32));                    \
@@ -70647,7 +70875,7 @@ index c3f36d41..5c5aeb5 100644
        }                                                               \
        args += sizeof(type);                                           \
        value;                                                          \
-@@ -1825,7 +1859,7 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
+@@ -1826,7 +1859,7 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
                case FORMAT_TYPE_STR: {
                        const char *str_arg = args;
                        args += strlen(str_arg) + 1;
@@ -70770,10 +70998,10 @@ index 57c4b93..24b8f59 100644
        /* if an huge pmd materialized from under us just retry later */
        if (unlikely(pmd_trans_huge(*pmd)))
 diff --git a/mm/hugetlb.c b/mm/hugetlb.c
-index e198831..38d524f 100644
+index 19558df..f7743b3 100644
 --- a/mm/hugetlb.c
 +++ b/mm/hugetlb.c
-@@ -2447,6 +2447,27 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma,
+@@ -2463,6 +2463,27 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma,
        return 1;
  }
  
@@ -70801,7 +71029,7 @@ index e198831..38d524f 100644
  /*
   * Hugetlb_cow() should be called with page lock of the original hugepage held.
   * Called with hugetlb_instantiation_mutex held and pte_page locked so we
-@@ -2559,6 +2580,11 @@ retry_avoidcopy:
+@@ -2575,6 +2596,11 @@ retry_avoidcopy:
                                make_huge_pte(vma, new_page, 1));
                page_remove_rmap(old_page);
                hugepage_add_new_anon_rmap(new_page, vma, address);
@@ -70813,7 +71041,7 @@ index e198831..38d524f 100644
                /* Make the old page be freed below */
                new_page = old_page;
                mmu_notifier_invalidate_range_end(mm,
-@@ -2713,6 +2739,10 @@ retry:
+@@ -2729,6 +2755,10 @@ retry:
                                && (vma->vm_flags & VM_SHARED)));
        set_huge_pte_at(mm, address, ptep, new_pte);
  
@@ -70824,7 +71052,7 @@ index e198831..38d524f 100644
        if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) {
                /* Optimization, do the COW without a second fault */
                ret = hugetlb_cow(mm, vma, address, ptep, new_pte, page);
-@@ -2742,6 +2772,10 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
+@@ -2758,6 +2788,10 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
        static DEFINE_MUTEX(hugetlb_instantiation_mutex);
        struct hstate *h = hstate_vma(vma);
  
@@ -70835,7 +71063,7 @@ index e198831..38d524f 100644
        address &= huge_page_mask(h);
  
        ptep = huge_pte_offset(mm, address);
-@@ -2755,6 +2789,26 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
+@@ -2771,6 +2805,26 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
                               VM_FAULT_SET_HINDEX(h - hstates);
        }
  
@@ -70863,7 +71091,7 @@ index e198831..38d524f 100644
        if (!ptep)
                return VM_FAULT_OOM;
 diff --git a/mm/internal.h b/mm/internal.h
-index 2ba87fb..7f451e2 100644
+index 8052379..47029d1 100644
 --- a/mm/internal.h
 +++ b/mm/internal.h
 @@ -95,6 +95,7 @@ extern void putback_lru_page(struct page *page);
@@ -70990,7 +71218,7 @@ index 14d260f..b2a80fd 100644
        if (end == start)
                goto out;
 diff --git a/mm/memory-failure.c b/mm/memory-failure.c
-index de4ce70..3629c7d 100644
+index 6de0d61..da836cf 100644
 --- a/mm/memory-failure.c
 +++ b/mm/memory-failure.c
 @@ -61,7 +61,7 @@ int sysctl_memory_failure_early_kill __read_mostly = 0;
@@ -71719,7 +71947,7 @@ index 2466d12..08be4f6 100644
        return 0;
  }
 diff --git a/mm/mempolicy.c b/mm/mempolicy.c
-index 1d771e4..f9a6808 100644
+index 1d771e4..64b57d0 100644
 --- a/mm/mempolicy.c
 +++ b/mm/mempolicy.c
 @@ -619,6 +619,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
@@ -71794,6 +72022,15 @@ index 1d771e4..f9a6808 100644
        err = do_migrate_pages(mm, old, new,
                capable(CAP_SYS_NICE) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE);
  
+@@ -2556,7 +2589,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context)
+               break;
+       default:
+-              BUG();
++              return -EINVAL;
+       }
+       l = strlen(policy_modes[mode]);
 diff --git a/mm/mlock.c b/mm/mlock.c
 index ef726e8..cd7f1ec 100644
 --- a/mm/mlock.c
@@ -73510,7 +73747,7 @@ index d4b0c10..ed421b5 100644
        new->vm_region = region;
  
 diff --git a/mm/page_alloc.c b/mm/page_alloc.c
-index 4a4f921..eaa5e3a 100644
+index 201b508..1fb51ca 100644
 --- a/mm/page_alloc.c
 +++ b/mm/page_alloc.c
 @@ -336,7 +336,7 @@ out:
@@ -73758,7 +73995,7 @@ index bd10636..5c16d49 100644
                return -ENOMEM;
  
 diff --git a/mm/slab.c b/mm/slab.c
-index e901a36..ca479fc 100644
+index e901a36..9ff3f90 100644
 --- a/mm/slab.c
 +++ b/mm/slab.c
 @@ -153,7 +153,7 @@
@@ -73900,7 +74137,7 @@ index e901a36..ca479fc 100644
  
                seq_printf(m, " : cpustat %6lu %6lu %6lu %6lu",
                           allochit, allocmiss, freehit, freemiss);
-@@ -4652,13 +4669,68 @@ static int __init slab_proc_init(void)
+@@ -4652,13 +4669,71 @@ static int __init slab_proc_init(void)
  {
        proc_create("slabinfo",S_IWUSR|S_IRUSR,NULL,&proc_slabinfo_operations);
  #ifdef CONFIG_DEBUG_SLAB_LEAK
@@ -73920,6 +74157,9 @@ index e901a36..ca479fc 100644
 +      if (ZERO_OR_NULL_PTR(ptr))
 +              return false;
 +
++      if (!slab_is_available())
++              return false;
++
 +      if (!virt_addr_valid(ptr))
 +              return false;
 +
@@ -73971,7 +74211,7 @@ index e901a36..ca479fc 100644
   * ksize - get the actual amount of memory allocated for a given object
   * @objp: Pointer to the object
 diff --git a/mm/slob.c b/mm/slob.c
-index 8105be4..3c15e57 100644
+index 8105be4..3e3e9cd 100644
 --- a/mm/slob.c
 +++ b/mm/slob.c
 @@ -29,7 +29,7 @@
@@ -74122,7 +74362,7 @@ index 8105be4..3c15e57 100644
        return ret;
  }
  EXPORT_SYMBOL(__kmalloc_node);
-@@ -533,13 +547,83 @@ void kfree(const void *block)
+@@ -533,13 +547,88 @@ void kfree(const void *block)
        sp = slob_page(block);
        if (is_slob_page(sp)) {
                int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
@@ -74142,6 +74382,11 @@ index 8105be4..3c15e57 100644
  
 +bool is_usercopy_object(const void *ptr)
 +{
++      if (!slab_is_available())
++              return false;
++
++      // PAX: TODO
++
 +      return false;
 +}
 +
@@ -74209,7 +74454,7 @@ index 8105be4..3c15e57 100644
  /* can't use ksize for kmem_cache_alloc memory, only kmalloc */
  size_t ksize(const void *block)
  {
-@@ -552,10 +636,10 @@ size_t ksize(const void *block)
+@@ -552,10 +641,10 @@ size_t ksize(const void *block)
        sp = slob_page(block);
        if (is_slob_page(sp)) {
                int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
@@ -74223,7 +74468,7 @@ index 8105be4..3c15e57 100644
  }
  EXPORT_SYMBOL(ksize);
  
-@@ -571,8 +655,13 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
+@@ -571,8 +660,13 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
  {
        struct kmem_cache *c;
  
@@ -74237,7 +74482,7 @@ index 8105be4..3c15e57 100644
  
        if (c) {
                c->name = name;
-@@ -614,17 +703,25 @@ void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
+@@ -614,17 +708,25 @@ void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
  
        lockdep_trace_alloc(flags);
  
@@ -74263,7 +74508,7 @@ index 8105be4..3c15e57 100644
  
        if (c->ctor)
                c->ctor(b);
-@@ -636,10 +733,16 @@ EXPORT_SYMBOL(kmem_cache_alloc_node);
+@@ -636,10 +738,16 @@ EXPORT_SYMBOL(kmem_cache_alloc_node);
  
  static void __kmem_cache_free(void *b, int size)
  {
@@ -74282,7 +74527,7 @@ index 8105be4..3c15e57 100644
  }
  
  static void kmem_rcu_free(struct rcu_head *head)
-@@ -652,17 +755,31 @@ static void kmem_rcu_free(struct rcu_head *head)
+@@ -652,17 +760,31 @@ static void kmem_rcu_free(struct rcu_head *head)
  
  void kmem_cache_free(struct kmem_cache *c, void *b)
  {
@@ -74318,7 +74563,7 @@ index 8105be4..3c15e57 100644
  EXPORT_SYMBOL(kmem_cache_free);
  
 diff --git a/mm/slub.c b/mm/slub.c
-index 8c691fa..ff23a85 100644
+index 8c691fa..2993c2b 100644
 --- a/mm/slub.c
 +++ b/mm/slub.c
 @@ -209,7 +209,7 @@ struct track {
@@ -74401,7 +74646,7 @@ index 8c691fa..ff23a85 100644
        return kmalloc_caches[index];
  }
  
-@@ -3405,6 +3417,56 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
+@@ -3405,6 +3417,59 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
  EXPORT_SYMBOL(__kmalloc_node);
  #endif
  
@@ -74413,6 +74658,9 @@ index 8c691fa..ff23a85 100644
 +      if (ZERO_OR_NULL_PTR(ptr))
 +              return false;
 +
++      if (!slab_is_available())
++              return false;
++
 +      if (!virt_addr_valid(ptr))
 +              return false;
 +
@@ -74458,7 +74706,7 @@ index 8c691fa..ff23a85 100644
  size_t ksize(const void *object)
  {
        struct page *page;
-@@ -3679,7 +3741,7 @@ static void __init kmem_cache_bootstrap_fixup(struct kmem_cache *s)
+@@ -3679,7 +3744,7 @@ static void __init kmem_cache_bootstrap_fixup(struct kmem_cache *s)
        int node;
  
        list_add(&s->list, &slab_caches);
@@ -74467,7 +74715,7 @@ index 8c691fa..ff23a85 100644
  
        for_each_node_state(node, N_NORMAL_MEMORY) {
                struct kmem_cache_node *n = get_node(s, node);
-@@ -3799,17 +3861,17 @@ void __init kmem_cache_init(void)
+@@ -3799,17 +3864,17 @@ void __init kmem_cache_init(void)
  
        /* Caches that are not of the two-to-the-power-of size */
        if (KMALLOC_MIN_SIZE <= 32) {
@@ -74488,7 +74736,7 @@ index 8c691fa..ff23a85 100644
                caches++;
        }
  
-@@ -3851,6 +3913,22 @@ void __init kmem_cache_init(void)
+@@ -3851,6 +3916,22 @@ void __init kmem_cache_init(void)
                }
        }
  #endif
@@ -74511,7 +74759,7 @@ index 8c691fa..ff23a85 100644
        printk(KERN_INFO
                "SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d,"
                " CPUs=%d, Nodes=%d\n",
-@@ -3877,7 +3955,7 @@ static int slab_unmergeable(struct kmem_cache *s)
+@@ -3877,7 +3958,7 @@ static int slab_unmergeable(struct kmem_cache *s)
        /*
         * We may have set a slab to be unmergeable during bootstrap.
         */
@@ -74520,7 +74768,7 @@ index 8c691fa..ff23a85 100644
                return 1;
  
        return 0;
-@@ -3936,7 +4014,7 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
+@@ -3936,7 +4017,7 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
        down_write(&slub_lock);
        s = find_mergeable(size, align, flags, name, ctor);
        if (s) {
@@ -74529,7 +74777,7 @@ index 8c691fa..ff23a85 100644
                /*
                 * Adjust the object sizes so that we clear
                 * the complete object on kzalloc.
-@@ -3945,7 +4023,7 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
+@@ -3945,7 +4026,7 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
                s->inuse = max_t(int, s->inuse, ALIGN(size, sizeof(void *)));
  
                if (sysfs_slab_alias(s, name)) {
@@ -74538,7 +74786,7 @@ index 8c691fa..ff23a85 100644
                        goto err;
                }
                up_write(&slub_lock);
-@@ -4074,7 +4152,7 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
+@@ -4074,7 +4155,7 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
  }
  #endif
  
@@ -74547,7 +74795,7 @@ index 8c691fa..ff23a85 100644
  static int count_inuse(struct page *page)
  {
        return page->inuse;
-@@ -4461,12 +4539,12 @@ static void resiliency_test(void)
+@@ -4461,12 +4542,12 @@ static void resiliency_test(void)
        validate_slab_cache(kmalloc_caches[9]);
  }
  #else
@@ -74562,7 +74810,7 @@ index 8c691fa..ff23a85 100644
  enum slab_stat_type {
        SL_ALL,                 /* All slabs */
        SL_PARTIAL,             /* Only partially allocated slabs */
-@@ -4709,7 +4787,7 @@ SLAB_ATTR_RO(ctor);
+@@ -4709,7 +4790,7 @@ SLAB_ATTR_RO(ctor);
  
  static ssize_t aliases_show(struct kmem_cache *s, char *buf)
  {
@@ -74571,7 +74819,7 @@ index 8c691fa..ff23a85 100644
  }
  SLAB_ATTR_RO(aliases);
  
-@@ -5280,6 +5358,7 @@ static char *create_unique_id(struct kmem_cache *s)
+@@ -5280,6 +5361,7 @@ static char *create_unique_id(struct kmem_cache *s)
        return name;
  }
  
@@ -74579,7 +74827,7 @@ index 8c691fa..ff23a85 100644
  static int sysfs_slab_add(struct kmem_cache *s)
  {
        int err;
-@@ -5342,6 +5421,7 @@ static void sysfs_slab_remove(struct kmem_cache *s)
+@@ -5342,6 +5424,7 @@ static void sysfs_slab_remove(struct kmem_cache *s)
        kobject_del(&s->kobj);
        kobject_put(&s->kobj);
  }
@@ -74587,7 +74835,7 @@ index 8c691fa..ff23a85 100644
  
  /*
   * Need to buffer aliases during bootup until sysfs becomes
-@@ -5355,6 +5435,7 @@ struct saved_alias {
+@@ -5355,6 +5438,7 @@ struct saved_alias {
  
  static struct saved_alias *alias_list;
  
@@ -74595,7 +74843,7 @@ index 8c691fa..ff23a85 100644
  static int sysfs_slab_alias(struct kmem_cache *s, const char *name)
  {
        struct saved_alias *al;
-@@ -5377,6 +5458,7 @@ static int sysfs_slab_alias(struct kmem_cache *s, const char *name)
+@@ -5377,6 +5461,7 @@ static int sysfs_slab_alias(struct kmem_cache *s, const char *name)
        alias_list = al;
        return 0;
  }
@@ -74715,7 +74963,7 @@ index 8c7265a..c96d884 100644
        mm->unmap_area = arch_unmap_area;
  }
 diff --git a/mm/vmalloc.c b/mm/vmalloc.c
-index 2aad499..a8a740e 100644
+index 2aad499..4006a74 100644
 --- a/mm/vmalloc.c
 +++ b/mm/vmalloc.c
 @@ -39,8 +39,19 @@ static void vunmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end)
@@ -74844,7 +75092,7 @@ index 2aad499..a8a740e 100644
   * vstart and vend.
   */
 -static struct vmap_area *alloc_vmap_area(unsigned long size,
-+static struct __size_overflow(1) vmap_area *alloc_vmap_area(unsigned long size,
++static __size_overflow(1) struct vmap_area *alloc_vmap_area(unsigned long size,
                                unsigned long align,
                                unsigned long vstart, unsigned long vend,
                                int node, gfp_t gfp_mask)
@@ -75035,6 +75283,18 @@ index 876fbe8..8bbea9f 100644
        __SONET_ITEMS
  #undef __HANDLE_ITEM
  }
+diff --git a/net/atm/common.c b/net/atm/common.c
+index b4b44db..0c0ad93 100644
+--- a/net/atm/common.c
++++ b/net/atm/common.c
+@@ -812,6 +812,7 @@ int vcc_getsockopt(struct socket *sock, int level, int optname,
+               if (!vcc->dev || !test_bit(ATM_VF_ADDR, &vcc->flags))
+                       return -ENOTCONN;
++              memset(&pvc, 0, sizeof(pvc));
+               pvc.sap_family = AF_ATMPVC;
+               pvc.sap_addr.itf = vcc->dev->number;
+               pvc.sap_addr.vpi = vcc->vpi;
 diff --git a/net/atm/lec.h b/net/atm/lec.h
 index a86aff9..3a0d6f6 100644
 --- a/net/atm/lec.h
@@ -75078,6 +75338,18 @@ index 0d020de..011c7bb 100644
  }
  
  static void atm_dev_info(struct seq_file *seq, const struct atm_dev *dev)
+diff --git a/net/atm/pvc.c b/net/atm/pvc.c
+index 3a73491..ae03240 100644
+--- a/net/atm/pvc.c
++++ b/net/atm/pvc.c
+@@ -95,6 +95,7 @@ static int pvc_getname(struct socket *sock, struct sockaddr *sockaddr,
+               return -ENOTCONN;
+       *sockaddr_len = sizeof(struct sockaddr_atmpvc);
+       addr = (struct sockaddr_atmpvc *)sockaddr;
++      memset(addr, 0, sizeof(*addr));
+       addr->sap_family = AF_ATMPVC;
+       addr->sap_addr.itf = vcc->dev->number;
+       addr->sap_addr.vpi = vcc->vpi;
 diff --git a/net/atm/resources.c b/net/atm/resources.c
 index 23f45ce..c748f1a 100644
 --- a/net/atm/resources.c
@@ -75221,6 +75493,26 @@ index 74175c2..32f8901 100644
        frag1->seqno = htons(seqno - 1);
        frag2->seqno = htons(seqno);
  
+diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
+index 5914623..bedc768 100644
+--- a/net/bluetooth/hci_sock.c
++++ b/net/bluetooth/hci_sock.c
+@@ -706,6 +706,7 @@ static int hci_sock_getname(struct socket *sock, struct sockaddr *addr, int *add
+       *addr_len = sizeof(*haddr);
+       haddr->hci_family = AF_BLUETOOTH;
+       haddr->hci_dev    = hdev->id;
++      haddr->hci_channel= 0;
+       release_sock(sk);
+       return 0;
+@@ -1016,6 +1017,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char
+               {
+                       struct hci_filter *f = &hci_pi(sk)->filter;
++                      memset(&uf, 0, sizeof(uf));
+                       uf.type_mask = f->type_mask;
+                       uf.opcode    = f->opcode;
+                       uf.event_mask[0] = *((u32 *) f->event_mask + 0);
 diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
 index 4554e80..b778671 100644
 --- a/net/bluetooth/l2cap_core.c
@@ -75238,8 +75530,40 @@ index 4554e80..b778671 100644
  
                        if (test_bit(CONF_STATE2_DEVICE, &chan->conf_state) &&
                                                        rfc.mode != chan->mode)
+diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
+index 3bb1611..fcf656b 100644
+--- a/net/bluetooth/l2cap_sock.c
++++ b/net/bluetooth/l2cap_sock.c
+@@ -246,6 +246,7 @@ static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *l
+       BT_DBG("sock %p, sk %p", sock, sk);
++      memset(la, 0, sizeof(struct sockaddr_l2));
+       addr->sa_family = AF_BLUETOOTH;
+       *len = sizeof(struct sockaddr_l2);
+diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
+index e8707de..2df6956 100644
+--- a/net/bluetooth/rfcomm/sock.c
++++ b/net/bluetooth/rfcomm/sock.c
+@@ -547,6 +547,7 @@ static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr, int *
+       BT_DBG("sock %p, sk %p", sock, sk);
++      memset(sa, 0, sizeof(*sa));
+       sa->rc_family  = AF_BLUETOOTH;
+       sa->rc_channel = rfcomm_pi(sk)->channel;
+       if (peer)
+@@ -841,6 +842,7 @@ static int rfcomm_sock_getsockopt(struct socket *sock, int level, int optname, c
+               }
+               sec.level = rfcomm_pi(sk)->sec_level;
++              sec.key_size = 0;
+               len = min_t(unsigned int, len, sizeof(sec));
+               if (copy_to_user(optval, (char *) &sec, len))
 diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
-index d1820ff..d414b0e 100644
+index d1820ff..4f8c8f6 100644
 --- a/net/bluetooth/rfcomm/tty.c
 +++ b/net/bluetooth/rfcomm/tty.c
 @@ -314,7 +314,7 @@ static void rfcomm_dev_del(struct rfcomm_dev *dev)
@@ -75251,6 +75575,15 @@ index d1820ff..d414b0e 100644
                spin_unlock_irqrestore(&dev->port.lock, flags);
                return;
        }
+@@ -461,7 +461,7 @@ static int rfcomm_get_dev_list(void __user *arg)
+       size = sizeof(*dl) + dev_num * sizeof(*di);
+-      dl = kmalloc(size, GFP_KERNEL);
++      dl = kzalloc(size, GFP_KERNEL);
+       if (!dl)
+               return -ENOMEM;
 @@ -669,10 +669,10 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
                return -ENODEV;
  
@@ -75333,6 +75666,21 @@ index 047cd0e..461fd28 100644
                                         p->sequence_no);
                        list_del(&p->list);
                        goto out;
+diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c
+index 69771c0..e597733 100644
+--- a/net/caif/chnl_net.c
++++ b/net/caif/chnl_net.c
+@@ -94,6 +94,10 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
+       /* check the version of IP */
+       ip_version = skb_header_pointer(skb, 0, 1, &buf);
++      if (!ip_version) {
++              kfree_skb(skb);
++              return -EINVAL;
++      }
+       switch (*ip_version >> 4) {
+       case 4:
 diff --git a/net/can/gw.c b/net/can/gw.c
 index b41acf2..3affb3a 100644
 --- a/net/can/gw.c
@@ -75491,7 +75839,7 @@ index ae6acf6..d5c8f66 100644
  
        return err;
 diff --git a/net/core/dev.c b/net/core/dev.c
-index 1cb0d8a..0427dd9 100644
+index a000840..566cee1 100644
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
 @@ -1135,9 +1135,13 @@ void dev_load(struct net *net, const char *name)
@@ -75508,7 +75856,7 @@ index 1cb0d8a..0427dd9 100644
        }
  }
  EXPORT_SYMBOL(dev_load);
-@@ -1601,7 +1605,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
+@@ -1602,7 +1606,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
  {
        if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) {
                if (skb_copy_ubufs(skb, GFP_ATOMIC)) {
@@ -75517,7 +75865,7 @@ index 1cb0d8a..0427dd9 100644
                        kfree_skb(skb);
                        return NET_RX_DROP;
                }
-@@ -1611,7 +1615,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
+@@ -1612,7 +1616,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
        nf_reset(skb);
  
        if (unlikely(!is_skb_forwardable(dev, skb))) {
@@ -75526,7 +75874,7 @@ index 1cb0d8a..0427dd9 100644
                kfree_skb(skb);
                return NET_RX_DROP;
        }
-@@ -2040,7 +2044,7 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
+@@ -2041,7 +2045,7 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
  
  struct dev_gso_cb {
        void (*destructor)(struct sk_buff *skb);
@@ -75535,7 +75883,7 @@ index 1cb0d8a..0427dd9 100644
  
  #define DEV_GSO_CB(skb) ((struct dev_gso_cb *)(skb)->cb)
  
-@@ -2875,7 +2879,7 @@ enqueue:
+@@ -2876,7 +2880,7 @@ enqueue:
  
        local_irq_restore(flags);
  
@@ -75544,7 +75892,7 @@ index 1cb0d8a..0427dd9 100644
        kfree_skb(skb);
        return NET_RX_DROP;
  }
-@@ -2947,7 +2951,7 @@ int netif_rx_ni(struct sk_buff *skb)
+@@ -2948,7 +2952,7 @@ int netif_rx_ni(struct sk_buff *skb)
  }
  EXPORT_SYMBOL(netif_rx_ni);
  
@@ -75553,7 +75901,7 @@ index 1cb0d8a..0427dd9 100644
  {
        struct softnet_data *sd = &__get_cpu_var(softnet_data);
  
-@@ -3234,7 +3238,7 @@ ncls:
+@@ -3235,7 +3239,7 @@ ncls:
        if (pt_prev) {
                ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
        } else {
@@ -75562,7 +75910,7 @@ index 1cb0d8a..0427dd9 100644
                kfree_skb(skb);
                /* Jamal, now you will not able to escape explaining
                 * me how you were going to use this. :-)
-@@ -3799,7 +3803,7 @@ void netif_napi_del(struct napi_struct *napi)
+@@ -3800,7 +3804,7 @@ void netif_napi_del(struct napi_struct *napi)
  }
  EXPORT_SYMBOL(netif_napi_del);
  
@@ -75571,7 +75919,7 @@ index 1cb0d8a..0427dd9 100644
  {
        struct softnet_data *sd = &__get_cpu_var(softnet_data);
        unsigned long time_limit = jiffies + 2;
-@@ -4269,8 +4273,13 @@ static int ptype_seq_show(struct seq_file *seq, void *v)
+@@ -4270,8 +4274,13 @@ static int ptype_seq_show(struct seq_file *seq, void *v)
                else
                        seq_printf(seq, "%04x", ntohs(pt->type));
  
@@ -75585,7 +75933,7 @@ index 1cb0d8a..0427dd9 100644
        }
  
        return 0;
-@@ -5820,7 +5829,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
+@@ -5823,7 +5832,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
        } else {
                netdev_stats_to_stats64(storage, &dev->stats);
        }
@@ -75657,7 +76005,7 @@ index 7e7aeb0..2a998cb 100644
  
        m->msg_iov = iov;
 diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
-index 23e3f66..f78041f 100644
+index 6c50ac0..6b4c038 100644
 --- a/net/core/rtnetlink.c
 +++ b/net/core/rtnetlink.c
 @@ -58,7 +58,7 @@ struct rtnl_link {
@@ -75826,6 +76174,40 @@ index 5fd1467..8b70900 100644
  }
  EXPORT_SYMBOL_GPL(sock_diag_save_cookie);
  
+diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h
+index 75c3582..fb85d37 100644
+--- a/net/dccp/ccid.h
++++ b/net/dccp/ccid.h
+@@ -246,7 +246,7 @@ static inline int ccid_hc_rx_getsockopt(struct ccid *ccid, struct sock *sk,
+                                       u32 __user *optval, int __user *optlen)
+ {
+       int rc = -ENOPROTOOPT;
+-      if (ccid->ccid_ops->ccid_hc_rx_getsockopt != NULL)
++      if (ccid != NULL && ccid->ccid_ops->ccid_hc_rx_getsockopt != NULL)
+               rc = ccid->ccid_ops->ccid_hc_rx_getsockopt(sk, optname, len,
+                                                optval, optlen);
+       return rc;
+@@ -257,7 +257,7 @@ static inline int ccid_hc_tx_getsockopt(struct ccid *ccid, struct sock *sk,
+                                       u32 __user *optval, int __user *optlen)
+ {
+       int rc = -ENOPROTOOPT;
+-      if (ccid->ccid_ops->ccid_hc_tx_getsockopt != NULL)
++      if (ccid != NULL && ccid->ccid_ops->ccid_hc_tx_getsockopt != NULL)
+               rc = ccid->ccid_ops->ccid_hc_tx_getsockopt(sk, optname, len,
+                                                optval, optlen);
+       return rc;
+diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
+index 8c67bed..ce0d140 100644
+--- a/net/dccp/ccids/ccid3.c
++++ b/net/dccp/ccids/ccid3.c
+@@ -531,6 +531,7 @@ static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len,
+       case DCCP_SOCKOPT_CCID_TX_INFO:
+               if (len < sizeof(tfrc))
+                       return -EINVAL;
++              memset(&tfrc, 0, sizeof(tfrc));
+               tfrc.tfrctx_x      = hc->tx_x;
+               tfrc.tfrctx_x_recv = hc->tx_x_recv;
+               tfrc.tfrctx_x_calc = hc->tx_x_calc;
 diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
 index a55eecc..dd8428c 100644
 --- a/net/decnet/sysctl_net_decnet.c
@@ -76402,6 +76784,31 @@ index 8f6411c..5767579 100644
  
                if (ops->ndo_do_ioctl) {
                        mm_segment_t oldfs = get_fs();
+diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
+index db1521f..ebb3314 100644
+--- a/net/ipv6/esp6.c
++++ b/net/ipv6/esp6.c
+@@ -166,8 +166,6 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
+       struct esp_data *esp = x->data;
+       /* skb is pure payload to encrypt */
+-      err = -ENOMEM;
+-
+       aead = esp->aead;
+       alen = crypto_aead_authsize(aead);
+@@ -202,8 +200,10 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
+       }
+       tmp = esp_alloc_tmp(aead, nfrags + sglists, seqhilen);
+-      if (!tmp)
++      if (!tmp) {
++              err = -ENOMEM;
+               goto error;
++      }
+       seqhi = esp_tmp_seqhi(tmp);
+       iv = esp_tmp_iv(aead, tmp, seqhilen);
 diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
 index e6cee52..cf47476 100644
 --- a/net/ipv6/inet6_connection_sock.c
@@ -76849,6 +77256,38 @@ index 34e4185..8823368 100644
        } while (!res);
        return res;
  }
+diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
+index 35e1e4b..9275471 100644
+--- a/net/l2tp/l2tp_ip6.c
++++ b/net/l2tp/l2tp_ip6.c
+@@ -410,6 +410,7 @@ static int l2tp_ip6_getname(struct socket *sock, struct sockaddr *uaddr,
+       lsa->l2tp_family = AF_INET6;
+       lsa->l2tp_flowinfo = 0;
+       lsa->l2tp_scope_id = 0;
++      lsa->l2tp_unused = 0;
+       if (peer) {
+               if (!lsk->peer_conn_id)
+                       return -ENOTCONN;
+diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
+index fe5453c..a13c3e23 100644
+--- a/net/llc/af_llc.c
++++ b/net/llc/af_llc.c
+@@ -969,14 +969,13 @@ static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,
+       struct sockaddr_llc sllc;
+       struct sock *sk = sock->sk;
+       struct llc_sock *llc = llc_sk(sk);
+-      int rc = 0;
++      int rc = -EBADF;
+       memset(&sllc, 0, sizeof(sllc));
+       lock_sock(sk);
+       if (sock_flag(sk, SOCK_ZAPPED))
+               goto out;
+       *uaddrlen = sizeof(sllc);
+-      memset(uaddr, 0, *uaddrlen);
+       if (peer) {
+               rc = -ENOTCONN;
+               if (sk->sk_state != TCP_ESTABLISHED)
 diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
 index 3f3cd50..d2cf249 100644
 --- a/net/mac80211/ieee80211_i.h
@@ -77107,7 +77546,7 @@ index a54b018c..07e0120 100644
        if (ipvs->sync_state & IP_VS_STATE_MASTER)
                ip_vs_sync_conn(net, cp, pkts);
 diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
-index 84444dd..86adaa0 100644
+index 84444dd..f91c066 100644
 --- a/net/netfilter/ipvs/ip_vs_ctl.c
 +++ b/net/netfilter/ipvs/ip_vs_ctl.c
 @@ -788,7 +788,7 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest,
@@ -77146,7 +77585,15 @@ index 84444dd..86adaa0 100644
                        entry.weight = atomic_read(&dest->weight);
                        entry.u_threshold = dest->u_threshold;
                        entry.l_threshold = dest->l_threshold;
-@@ -3089,7 +3089,7 @@ static int ip_vs_genl_fill_dest(struct sk_buff *skb, struct ip_vs_dest *dest)
+@@ -2759,6 +2759,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
+       {
+               struct ip_vs_timeout_user t;
++              memset(&t, 0, sizeof(t));
+               __ip_vs_get_timeouts(net, &t);
+               if (copy_to_user(user, &t, sizeof(t)) != 0)
+                       ret = -EFAULT;
+@@ -3089,7 +3090,7 @@ static int ip_vs_genl_fill_dest(struct sk_buff *skb, struct ip_vs_dest *dest)
        if (nla_put(skb, IPVS_DEST_ATTR_ADDR, sizeof(dest->addr), &dest->addr) ||
            nla_put_u16(skb, IPVS_DEST_ATTR_PORT, dest->port) ||
            nla_put_u32(skb, IPVS_DEST_ATTR_FWD_METHOD,
@@ -77349,7 +77796,7 @@ index 4fe4fb4..87a89e5 100644
        return 0;
  }
 diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
-index b3025a6..d63a537 100644
+index b3025a6..e717db9 100644
 --- a/net/netlink/af_netlink.c
 +++ b/net/netlink/af_netlink.c
 @@ -753,7 +753,7 @@ static void netlink_overrun(struct sock *sk)
@@ -77361,7 +77808,26 @@ index b3025a6..d63a537 100644
  }
  
  static struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
-@@ -2022,7 +2022,7 @@ static int netlink_seq_show(struct seq_file *seq, void *v)
+@@ -1344,7 +1344,7 @@ static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,
+       if (NULL == siocb->scm)
+               siocb->scm = &scm;
+-      err = scm_send(sock, msg, siocb->scm);
++      err = scm_send(sock, msg, siocb->scm, true);
+       if (err < 0)
+               return err;
+@@ -1355,7 +1355,8 @@ static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,
+               dst_pid = addr->nl_pid;
+               dst_group = ffs(addr->nl_groups);
+               err =  -EPERM;
+-              if (dst_group && !netlink_capable(sock, NL_NONROOT_SEND))
++              if ((dst_group || dst_pid) &&
++                  !netlink_capable(sock, NL_NONROOT_SEND))
+                       goto out;
+       } else {
+               dst_pid = nlk->dst_pid;
+@@ -2022,7 +2023,7 @@ static int netlink_seq_show(struct seq_file *seq, void *v)
                           sk_wmem_alloc_get(s),
                           nlk->cb,
                           atomic_read(&s->sk_refcnt),
@@ -77370,6 +77836,14 @@ index b3025a6..d63a537 100644
                           sock_i_ino(s)
                        );
  
+@@ -2124,6 +2125,7 @@ static void __init netlink_add_usersock_entry(void)
+       rcu_assign_pointer(nl_table[NETLINK_USERSOCK].listeners, listeners);
+       nl_table[NETLINK_USERSOCK].module = THIS_MODULE;
+       nl_table[NETLINK_USERSOCK].registered = 1;
++      nl_table[NETLINK_USERSOCK].nl_nonroot = NL_NONROOT_SEND;
+       netlink_table_ungrab();
+ }
 diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
 index 06592d8..64860f6 100644
 --- a/net/netrom/af_netrom.c
@@ -77984,7 +78458,7 @@ index 31c7bfc..bc380ae 100644
                to += addrlen;
                cnt++;
 diff --git a/net/socket.c b/net/socket.c
-index 0452dca..7e9758c 100644
+index 0452dca..5af9802 100644
 --- a/net/socket.c
 +++ b/net/socket.c
 @@ -88,6 +88,7 @@
@@ -78155,7 +78629,33 @@ index 0452dca..7e9758c 100644
        uaddr_len = COMPAT_NAMELEN(msg);
        if (MSG_CMSG_COMPAT & flags) {
                err = verify_compat_iovec(msg_sys, iov, &addr, VERIFY_WRITE);
-@@ -2761,7 +2821,7 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
+@@ -2605,7 +2665,7 @@ static int do_siocgstamp(struct net *net, struct socket *sock,
+       err = sock_do_ioctl(net, sock, cmd, (unsigned long)&ktv);
+       set_fs(old_fs);
+       if (!err)
+-              err = compat_put_timeval(up, &ktv);
++              err = compat_put_timeval(&ktv, up);
+       return err;
+ }
+@@ -2621,7 +2681,7 @@ static int do_siocgstampns(struct net *net, struct socket *sock,
+       err = sock_do_ioctl(net, sock, cmd, (unsigned long)&kts);
+       set_fs(old_fs);
+       if (!err)
+-              err = compat_put_timespec(up, &kts);
++              err = compat_put_timespec(&kts, up);
+       return err;
+ }
+@@ -2658,6 +2718,7 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32)
+       if (copy_from_user(&ifc32, uifc32, sizeof(struct compat_ifconf)))
+               return -EFAULT;
++      memset(&ifc, 0, sizeof(ifc));
+       if (ifc32.ifcbuf == 0) {
+               ifc32.ifc_len = 0;
+               ifc.ifc_len = 0;
+@@ -2761,7 +2822,7 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
        }
  
        ifr = compat_alloc_user_space(buf_size);
@@ -78164,7 +78664,7 @@ index 0452dca..7e9758c 100644
  
        if (copy_in_user(&ifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ))
                return -EFAULT;
-@@ -2785,12 +2845,12 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
+@@ -2785,12 +2846,12 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
                        offsetof(struct ethtool_rxnfc, fs.ring_cookie));
  
                if (copy_in_user(rxnfc, compat_rxnfc,
@@ -78181,7 +78681,7 @@ index 0452dca..7e9758c 100644
                    copy_in_user(&rxnfc->rule_cnt, &compat_rxnfc->rule_cnt,
                                 sizeof(rxnfc->rule_cnt)))
                        return -EFAULT;
-@@ -2802,12 +2862,12 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
+@@ -2802,12 +2863,12 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
  
        if (convert_out) {
                if (copy_in_user(compat_rxnfc, rxnfc,
@@ -78198,7 +78698,7 @@ index 0452dca..7e9758c 100644
                    copy_in_user(&compat_rxnfc->rule_cnt, &rxnfc->rule_cnt,
                                 sizeof(rxnfc->rule_cnt)))
                        return -EFAULT;
-@@ -2877,7 +2937,7 @@ static int bond_ioctl(struct net *net, unsigned int cmd,
+@@ -2877,7 +2938,7 @@ static int bond_ioctl(struct net *net, unsigned int cmd,
                old_fs = get_fs();
                set_fs(KERNEL_DS);
                err = dev_ioctl(net, cmd,
@@ -78207,7 +78707,7 @@ index 0452dca..7e9758c 100644
                set_fs(old_fs);
  
                return err;
-@@ -2986,7 +3046,7 @@ static int compat_sioc_ifmap(struct net *net, unsigned int cmd,
+@@ -2986,7 +3047,7 @@ static int compat_sioc_ifmap(struct net *net, unsigned int cmd,
  
        old_fs = get_fs();
        set_fs(KERNEL_DS);
@@ -78216,7 +78716,7 @@ index 0452dca..7e9758c 100644
        set_fs(old_fs);
  
        if (cmd == SIOCGIFMAP && !err) {
-@@ -3091,7 +3151,7 @@ static int routing_ioctl(struct net *net, struct socket *sock,
+@@ -3091,7 +3152,7 @@ static int routing_ioctl(struct net *net, struct socket *sock,
                ret |= __get_user(rtdev, &(ur4->rt_dev));
                if (rtdev) {
                        ret |= copy_from_user(devname, compat_ptr(rtdev), 15);
@@ -78225,7 +78725,7 @@ index 0452dca..7e9758c 100644
                        devname[15] = 0;
                } else
                        r4.rt_dev = NULL;
-@@ -3317,8 +3377,8 @@ int kernel_getsockopt(struct socket *sock, int level, int optname,
+@@ -3317,8 +3378,8 @@ int kernel_getsockopt(struct socket *sock, int level, int optname,
        int __user *uoptlen;
        int err;
  
@@ -78236,7 +78736,7 @@ index 0452dca..7e9758c 100644
  
        set_fs(KERNEL_DS);
        if (level == SOL_SOCKET)
-@@ -3338,7 +3398,7 @@ int kernel_setsockopt(struct socket *sock, int level, int optname,
+@@ -3338,7 +3399,7 @@ int kernel_setsockopt(struct socket *sock, int level, int optname,
        char __user *uoptval;
        int err;
  
@@ -78536,7 +79036,7 @@ index f976e9cd..560d055 100644
  
        sub->evt.event = htohl(event, sub->swap);
 diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
-index 641f2e4..a63f5e1 100644
+index 641f2e4..590bb48 100644
 --- a/net/unix/af_unix.c
 +++ b/net/unix/af_unix.c
 @@ -780,6 +780,12 @@ static struct sock *unix_find_other(struct net *net,
@@ -78585,8 +79085,26 @@ index 641f2e4..a63f5e1 100644
                mutex_unlock(&path.dentry->d_inode->i_mutex);
                dput(path.dentry);
                path.dentry = dentry;
+@@ -1448,7 +1468,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
+       if (NULL == siocb->scm)
+               siocb->scm = &tmp_scm;
+       wait_for_unix_gc();
+-      err = scm_send(sock, msg, siocb->scm);
++      err = scm_send(sock, msg, siocb->scm, false);
+       if (err < 0)
+               return err;
+@@ -1617,7 +1637,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
+       if (NULL == siocb->scm)
+               siocb->scm = &tmp_scm;
+       wait_for_unix_gc();
+-      err = scm_send(sock, msg, siocb->scm);
++      err = scm_send(sock, msg, siocb->scm, false);
+       if (err < 0)
+               return err;
 diff --git a/net/wireless/core.h b/net/wireless/core.h
-index 8523f38..79f6091 100644
+index bc686ef..27845e6 100644
 --- a/net/wireless/core.h
 +++ b/net/wireless/core.h
 @@ -27,7 +27,7 @@ struct cfg80211_registered_device {
@@ -78711,6 +79229,34 @@ index ccfbd32..9b61cf9f 100644
                }
        }
  
+diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
+index 5b228f9..6aca4e3 100644
+--- a/net/xfrm/xfrm_state.c
++++ b/net/xfrm/xfrm_state.c
+@@ -1981,8 +1981,10 @@ int __xfrm_init_state(struct xfrm_state *x, bool init_replay)
+               goto error;
+       x->outer_mode = xfrm_get_mode(x->props.mode, family);
+-      if (x->outer_mode == NULL)
++      if (x->outer_mode == NULL) {
++              err = -EPROTONOSUPPORT;
+               goto error;
++      }
+       if (init_replay) {
+               err = xfrm_init_replay(x);
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
+index 44293b3..be1d3e58 100644
+--- a/net/xfrm/xfrm_user.c
++++ b/net/xfrm/xfrm_user.c
+@@ -1413,6 +1413,7 @@ static int copy_to_user_tmpl(struct xfrm_policy *xp, struct sk_buff *skb)
+               struct xfrm_user_tmpl *up = &vec[i];
+               struct xfrm_tmpl *kp = &xp->xfrm_vec[i];
++              memset(up, 0, sizeof(*up));
+               memcpy(&up->id, &kp->id, sizeof(up->id));
+               up->family = kp->encap_family;
+               memcpy(&up->saddr, &kp->saddr, sizeof(up->saddr));
 diff --git a/scripts/Makefile.build b/scripts/Makefile.build
 index ff1720d..ed8475e 100644
 --- a/scripts/Makefile.build
@@ -79106,10 +79652,10 @@ index 5c11312..72742b5 100644
      write_hex_cnt = 0;
      for (i = 0; i < logo_clutsize; i++) {
 diff --git a/security/Kconfig b/security/Kconfig
-index e9c6ac7..4349785 100644
+index e9c6ac7..58348f4 100644
 --- a/security/Kconfig
 +++ b/security/Kconfig
-@@ -4,6 +4,876 @@
+@@ -4,6 +4,888 @@
  
  menu "Security options"
  
@@ -79695,6 +80241,10 @@ index e9c6ac7..4349785 100644
 +        Select the method used to instrument function pointer dereferences.
 +        Note that binary modules cannot be instrumented by this approach.
 +
++        Note that the implementation requires a gcc with plugin support,
++        i.e., gcc 4.5 or newer.  You may need to install the supporting
++        headers explicitly in addition to the normal gcc package.
++
 +      config PAX_KERNEXEC_PLUGIN_METHOD_BTS
 +              bool "bts"
 +              help
@@ -79868,11 +80418,12 @@ index e9c6ac7..4349785 100644
 +        and you are advised to test this feature on your expected workload
 +        before deploying it.
 +
-+        Note: full support for this feature requires gcc with plugin support
-+        so make sure your compiler is at least gcc 4.5.0.  Using older gcc
-+        versions means that functions with large enough stack frames may
-+        leave uninitialized memory behind that may be exposed to a later
-+        syscall leaking the stack.
++        Note that the full feature requires a gcc with plugin support,
++        i.e., gcc 4.5 or newer.  You may need to install the supporting
++        headers explicitly in addition to the normal gcc package.  Using
++        older gcc versions means that functions with large enough stack
++        frames may leave uninitialized memory behind that may be exposed
++        to a later syscall leaking the stack.
 +
 +config PAX_MEMORY_UDEREF
 +      bool "Prevent invalid userland pointer dereference"
@@ -79954,11 +80505,14 @@ index e9c6ac7..4349785 100644
 +        arguments marked by a size_overflow attribute with double integer
 +        precision (DImode/TImode for 32/64 bit integer types).
 +
-+        The recomputed argument is checked against INT_MAX and an event
++        The recomputed argument is checked against TYPE_MAX and an event
 +        is logged on overflow and the triggering process is killed.
 +
-+        Homepage:
-+        http://www.grsecurity.net/~ephox/overflow_plugin/
++        Homepage: http://www.grsecurity.net/~ephox/overflow_plugin/
++
++        Note that the implementation requires a gcc with plugin support,
++        i.e., gcc 4.5 or newer.  You may need to install the supporting
++        headers explicitly in addition to the normal gcc package.
 +
 +config PAX_LATENT_ENTROPY
 +      bool "Generate some entropy during boot"
@@ -79970,6 +80524,10 @@ index e9c6ac7..4349785 100644
 +        there is little 'natural' source of entropy normally.  The cost
 +        is some slowdown of the boot process.
 +
++        Note that the implementation requires a gcc with plugin support,
++        i.e., gcc 4.5 or newer.  You may need to install the supporting
++        headers explicitly in addition to the normal gcc package.
++
 +        Note that entropy extracted this way is not cryptographically
 +        secure!
 +
@@ -79986,7 +80544,7 @@ index e9c6ac7..4349785 100644
  source security/keys/Kconfig
  
  config SECURITY_DMESG_RESTRICT
-@@ -103,7 +973,7 @@ config INTEL_TXT
+@@ -103,7 +985,7 @@ config INTEL_TXT
  config LSM_MMAP_MIN_ADDR
        int "Low address space for LSM to protect from user allocation"
        depends on SECURITY && SECURITY_SELINUX
@@ -80009,10 +80567,43 @@ index 8ea39aa..8569ac5 100644
  
        .ptrace_access_check =          apparmor_ptrace_access_check,
 diff --git a/security/commoncap.c b/security/commoncap.c
-index 6dbae46..f534748 100644
+index 6dbae46..d5611fd 100644
 --- a/security/commoncap.c
 +++ b/security/commoncap.c
-@@ -583,6 +583,9 @@ int cap_bprm_secureexec(struct linux_binprm *bprm)
+@@ -415,6 +415,32 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data
+       return 0;
+ }
++/* returns:
++      1 for suid privilege
++      2 for sgid privilege
++      3 for fscap privilege
++*/
++int is_privileged_binary(const struct dentry *dentry)
++{
++      struct cpu_vfs_cap_data capdata;
++      struct inode *inode = dentry->d_inode;
++
++      if (!inode || S_ISDIR(inode->i_mode))
++              return 0;
++
++      if (inode->i_mode & S_ISUID)
++              return 1;
++      if ((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))
++              return 2;
++
++      if (!get_vfs_caps_from_disk(dentry, &capdata)) {
++              if (!cap_isclear(capdata.inheritable) || !cap_isclear(capdata.permitted))
++                      return 3;
++      }
++
++      return 0;
++}
++
+ /*
+  * Attempt to get the on-exec apply capability sets for an executable file from
+  * its xattrs and, if present, apply them to the proposed credentials being
+@@ -583,6 +609,9 @@ int cap_bprm_secureexec(struct linux_binprm *bprm)
        const struct cred *cred = current_cred();
        kuid_t root_uid = make_kuid(cred->user_ns, 0);
  
@@ -80213,7 +80804,7 @@ index 860aeb3..45765c0 100644
  
  /* Save user chosen LSM */
 diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
-index daaa4ed..99a640f 100644
+index db10db2..99a640f 100644
 --- a/security/selinux/hooks.c
 +++ b/security/selinux/hooks.c
 @@ -95,8 +95,6 @@
@@ -80225,29 +80816,7 @@ index daaa4ed..99a640f 100644
  /* SECMARK reference count */
  static atomic_t selinux_secmark_refcount = ATOMIC_INIT(0);
  
-@@ -2792,11 +2790,16 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name,
-                       /* We strip a nul only if it is at the end, otherwise the
-                        * context contains a nul and we should audit that */
--                      str = value;
--                      if (str[size - 1] == '\0')
--                              audit_size = size - 1;
--                      else
--                              audit_size = size;
-+                      if (value) {
-+                              str = value;
-+                              if (str[size - 1] == '\0')
-+                                      audit_size = size - 1;
-+                              else
-+                                      audit_size = size;
-+                      } else {
-+                              str = "";
-+                              audit_size = 0;
-+                      }
-                       ab = audit_log_start(current->audit_context, GFP_ATOMIC, AUDIT_SELINUX_ERR);
-                       audit_log_format(ab, "op=setxattr invalid_context=");
-                       audit_log_n_untrustedstring(ab, value, audit_size);
-@@ -5506,7 +5509,7 @@ static int selinux_key_getsecurity(struct key *key, char **_buffer)
+@@ -5511,7 +5509,7 @@ static int selinux_key_getsecurity(struct key *key, char **_buffer)
  
  #endif
  
@@ -81562,7 +82131,7 @@ index 0000000..048d4ff
 +}
 diff --git a/tools/gcc/generate_size_overflow_hash.sh b/tools/gcc/generate_size_overflow_hash.sh
 new file mode 100644
-index 0000000..a0fe8b2
+index 0000000..68b646e
 --- /dev/null
 +++ b/tools/gcc/generate_size_overflow_hash.sh
 @@ -0,0 +1,94 @@
@@ -81619,7 +82188,7 @@ index 0000000..a0fe8b2
 +              params="${data_array[2]}"
 +              next="${data_array[5]}"
 +
-+              echo "struct size_overflow_hash $struct_hash_name = {" >> "$header1"
++              echo "const struct size_overflow_hash $struct_hash_name = {" >> "$header1"
 +
 +              echo -e "\t.next\t= $next,\n\t.name\t= \"$funcn\"," >> "$header1"
 +              echo -en "\t.param\t= " >> "$header1"
@@ -81634,7 +82203,7 @@ index 0000000..a0fe8b2
 +}
 +
 +create_headers () {
-+      echo "struct size_overflow_hash *size_overflow_hash[$n] = {" >> "$header1"
++      echo "const struct size_overflow_hash * const size_overflow_hash[$n] = {" >> "$header1"
 +}
 +
 +create_array_elements () {
@@ -82569,10 +83138,10 @@ index 0000000..b8008f7
 +}
 diff --git a/tools/gcc/size_overflow_hash.data b/tools/gcc/size_overflow_hash.data
 new file mode 100644
-index 0000000..036c9c6
+index 0000000..50e9970
 --- /dev/null
 +++ b/tools/gcc/size_overflow_hash.data
-@@ -0,0 +1,3057 @@
+@@ -0,0 +1,3164 @@
 +_000001_hash alloc_dr 2 65495 _000001_hash NULL
 +_000002_hash __copy_from_user 3 10918 _000002_hash NULL
 +_000003_hash copy_from_user 3 17559 _000003_hash NULL
@@ -82852,7 +83421,7 @@ index 0000000..036c9c6
 +_000285_hash ip_vs_create_timeout_table 2 64478 _000285_hash NULL
 +_000286_hash ipw_queue_tx_init 3 49161 _000286_hash NULL
 +_000287_hash irda_setsockopt 5 19824 _000287_hash NULL
-+_000288_hash irias_new_octseq_value 2 13596 _000288_hash NULL
++_000288_hash irias_new_octseq_value 2 13596 _003296_hash NULL nohasharray
 +_000289_hash ir_lirc_transmit_ir 3 64403 _000289_hash NULL
 +_000290_hash irnet_ctrl_write 3 24139 _000290_hash NULL
 +_000291_hash isdn_add_channels 3 40905 _000291_hash NULL
@@ -82876,7 +83445,7 @@ index 0000000..036c9c6
 +_000310_hash keyctl_update_key 3 26061 _000310_hash NULL
 +_000311_hash __kfifo_alloc 2-3 22173 _000311_hash NULL
 +_000313_hash kfifo_copy_from_user 3 5091 _000313_hash NULL
-+_000314_hash kmalloc_node 1 50163 _000314_hash NULL
++_000314_hash kmalloc_node 1 50163 _003293_hash NULL nohasharray
 +_000315_hash kmalloc_parameter 1 65279 _000315_hash NULL
 +_000316_hash kmem_alloc 1 31920 _000316_hash NULL
 +_000317_hash kobj_map 2-3 9566 _000317_hash NULL
@@ -83216,7 +83785,7 @@ index 0000000..036c9c6
 +_000667_hash zd_usb_read_fw 4 22049 _000667_hash NULL
 +_000668_hash zerocopy_sg_from_iovec 3 11828 _000668_hash NULL
 +_000669_hash zoran_write 3 22404 _000669_hash NULL
-+_000671_hash acpi_ex_allocate_name_string 2 7685 _002855_hash NULL nohasharray
++_000671_hash acpi_ex_allocate_name_string 2-1 7685 _002855_hash NULL nohasharray
 +_000672_hash acpi_os_allocate_zeroed 1 37422 _000672_hash NULL
 +_000673_hash acpi_ut_initialize_buffer 2 47143 _002314_hash NULL nohasharray
 +_000674_hash ad7879_spi_xfer 3 36311 _000674_hash NULL
@@ -83466,7 +84035,7 @@ index 0000000..036c9c6
 +_000944_hash l2tp_session_create 1 25286 _000944_hash NULL
 +_000945_hash lc_create 3 48662 _000945_hash NULL
 +_000946_hash leaf_dealloc 3 29566 _000946_hash NULL
-+_000947_hash linear_conf 2 23485 _000947_hash NULL
++_000947_hash linear_conf 2 23485 _003314_hash NULL nohasharray
 +_000948_hash lirc_buffer_init 2-3 53282 _000948_hash NULL
 +_000950_hash llc_ui_sendmsg 4 24987 _000950_hash NULL
 +_000951_hash lpfc_sli4_queue_alloc 3 62646 _000951_hash NULL
@@ -83596,7 +84165,7 @@ index 0000000..036c9c6
 +_001088_hash sctp_tsnmap_init 2 36446 _001088_hash NULL
 +_001089_hash sctp_user_addto_chunk 2-3 62047 _001089_hash NULL
 +_001091_hash security_context_to_sid 2 19839 _001091_hash NULL
-+_001092_hash security_context_to_sid_default 2 3492 _001092_hash NULL
++_001092_hash security_context_to_sid_default 2 3492 _003366_hash NULL nohasharray
 +_001093_hash security_context_to_sid_force 2 20724 _001093_hash NULL
 +_001094_hash selinux_transaction_write 3 59038 _001094_hash NULL
 +_001095_hash sel_write_access 3 51704 _001095_hash NULL
@@ -83666,7 +84235,7 @@ index 0000000..036c9c6
 +_001164_hash svc_pool_map_alloc_arrays 2 47181 _001164_hash NULL
 +_001165_hash symtab_init 2 61050 _001165_hash NULL
 +_001166_hash sys_bind 3 10799 _001166_hash NULL
-+_001167_hash sys_connect 3 15291 _001167_hash NULL
++_001167_hash sys_connect 3 15291 _003291_hash NULL nohasharray
 +_001168_hash sys_flistxattr 3 41407 _001168_hash NULL
 +_001169_hash sys_fsetxattr 4 49736 _001169_hash NULL
 +_001170_hash sysfs_write_file 3 57116 _001170_hash NULL
@@ -83807,11 +84376,11 @@ index 0000000..036c9c6
 +_001314_hash copy_counters_to_user 5 17027 _001824_hash NULL nohasharray
 +_001315_hash copy_entries_to_user 1 52367 _001315_hash NULL
 +_001316_hash copy_from_buf 4 27308 _001316_hash NULL
-+_001317_hash copy_oldmem_page 3 26164 _001317_hash NULL
++_001317_hash copy_oldmem_page 3-1 26164 _001317_hash NULL
 +_001318_hash copy_to_user_fromio 3 57432 _001318_hash NULL
 +_001319_hash cryptd_hash_setkey 3 42781 _001319_hash NULL
 +_001320_hash crypto_authenc_esn_setkey 3 6985 _001320_hash NULL
-+_001321_hash crypto_authenc_setkey 3 80 _001321_hash NULL
++_001321_hash crypto_authenc_setkey 3 80 _003311_hash NULL nohasharray
 +_001322_hash cx18_copy_buf_to_user 4 22735 _001322_hash NULL
 +_001324_hash cxgbi_ddp_reserve 4 30091 _001324_hash NULL
 +_001325_hash datablob_hmac_append 3 40038 _001325_hash NULL
@@ -84035,7 +84604,7 @@ index 0000000..036c9c6
 +_001560_hash unlink1 3 63059 _001560_hash NULL
 +_001562_hash usb_allocate_stream_buffers 3 8964 _001562_hash NULL
 +_001563_hash usbdev_read 3 45114 _001563_hash NULL
-+_001564_hash usblp_read 3 57342 _001564_hash NULL
++_001564_hash usblp_read 3 57342 _003306_hash NULL nohasharray
 +_001565_hash usbtmc_read 3 32377 _001565_hash NULL
 +_001566_hash usbvision_v4l2_read 3 34386 _001566_hash NULL
 +_001567_hash _usb_writeN_sync 4 31682 _001567_hash NULL
@@ -84048,7 +84617,7 @@ index 0000000..036c9c6
 +_001574_hash venus_lookup 4 8121 _001574_hash NULL
 +_001575_hash venus_mkdir 4 8967 _001575_hash NULL
 +_001576_hash venus_remove 4 59781 _001576_hash NULL
-+_001577_hash venus_rename 4-5 17707 _001577_hash NULL
++_001577_hash venus_rename 4-5 17707 _003279_hash NULL nohasharray
 +_001579_hash venus_rmdir 4 45564 _001579_hash NULL
 +_001580_hash venus_symlink 4-6 23570 _001580_hash NULL
 +_001582_hash vfs_readlink 3 54368 _001582_hash NULL
@@ -84473,7 +85042,7 @@ index 0000000..036c9c6
 +_002010_hash sel_read_perm 3 42302 _002010_hash NULL
 +_002011_hash sel_read_policy 3 55947 _002011_hash NULL
 +_002012_hash sel_read_policycap 3 28544 _002012_hash NULL
-+_002013_hash sel_read_policyvers 3 55 _002013_hash NULL
++_002013_hash sel_read_policyvers 3 55 _003257_hash NULL nohasharray
 +_002014_hash send_msg 4 37323 _002014_hash NULL
 +_002015_hash send_packet 4 52960 _002015_hash NULL
 +_002016_hash short_retry_limit_read 3 4687 _002016_hash NULL
@@ -85479,7 +86048,7 @@ index 0000000..036c9c6
 +_003099_hash snd_nm256_capture_copy 5 28622 _003099_hash NULL
 +_003100_hash snd_nm256_playback_copy 5 38567 _003100_hash NULL
 +_003101_hash tomoyo_init_log 2 14806 _003101_hash NULL
-+_003102_hash usbdux_attach_common 4 51764 _003102_hash NULL
++_003102_hash usbdux_attach_common 4 51764 _003271_hash NULL nohasharray
 +_003103_hash compat_sys_fcntl 3 15654 _003103_hash NULL
 +_003104_hash ieee80211_auth_challenge 3 18810 _003104_hash NULL
 +_003105_hash ieee80211_rtl_auth_challenge 3 61897 _003105_hash NULL
@@ -85630,12 +86199,119 @@ index 0000000..036c9c6
 +_003253_hash acl_alloc 1 35979 _003253_hash NULL
 +_003254_hash acl_alloc_stack_init 1 60630 _003254_hash NULL
 +_003255_hash acl_alloc_num 1-2 60778 _003255_hash NULL
++_003257_hash padzero 1 55 _003257_hash &_002013_hash
++_003258_hash __get_vm_area_node 1 55305 _003258_hash NULL
++_003259_hash get_vm_area 1 18080 _003259_hash NULL
++_003260_hash __get_vm_area 1 61599 _003260_hash NULL
++_003261_hash get_vm_area_caller 1 10527 _003261_hash NULL
++_003262_hash __get_vm_area_caller 1 56416 _003302_hash NULL nohasharray
++_003263_hash alloc_vm_area 1 36149 _003263_hash NULL
++_003264_hash __ioremap_caller 1-2 21800 _003264_hash NULL
++_003266_hash vmap 2 15025 _003266_hash NULL
++_003267_hash ioremap_cache 1-2 47189 _003267_hash NULL
++_003269_hash ioremap_nocache 1-2 2439 _003269_hash NULL
++_003271_hash ioremap_prot 1-2 51764 _003271_hash &_003102_hash
++_003273_hash ioremap_wc 1-2 62695 _003273_hash NULL
++_003274_hash acpi_os_ioremap 1-2 49523 _003274_hash NULL
++_003276_hash ca91cx42_alloc_resource 2 10502 _003276_hash NULL
++_003277_hash devm_ioremap_nocache 2-3 2036 _003277_hash NULL
++_003279_hash __einj_error_trigger 1 17707 _003279_hash &_001577_hash
++_003280_hash io_mapping_map_wc 2 19284 _003280_hash NULL
++_003281_hash ioremap 1-2 23172 _003281_hash NULL
++_003283_hash lguest_map 1-2 42008 _003283_hash NULL
++_003285_hash msix_map_region 3 3411 _003285_hash NULL
++_003286_hash pci_iomap 3 47575 _003286_hash NULL
++_003287_hash sfi_map_memory 1-2 5183 _003287_hash NULL
++_003289_hash tsi148_alloc_resource 2 24563 _003289_hash NULL
++_003290_hash vb2_vmalloc_get_userptr 3 31374 _003290_hash NULL
++_003291_hash xlate_dev_mem_ptr 1 15291 _003291_hash &_001167_hash
++_003292_hash a4t_cs_init 3 27734 _003292_hash NULL
++_003293_hash aac_nark_ioremap 2 50163 _003293_hash &_000314_hash
++_003294_hash aac_rkt_ioremap 2 3333 _003294_hash NULL
++_003295_hash aac_rx_ioremap 2 52410 _003295_hash NULL
++_003296_hash aac_sa_ioremap 2 13596 _003296_hash &_000288_hash
++_003297_hash aac_src_ioremap 2 41688 _003297_hash NULL
++_003298_hash aac_srcv_ioremap 2 6659 _003298_hash NULL
++_003299_hash acpi_map 1-2 58725 _003299_hash NULL
++_003301_hash acpi_os_read_memory 1-3 54186 _003301_hash NULL
++_003302_hash acpi_os_write_memory 1-3 56416 _003302_hash &_003262_hash
++_003303_hash c101_run 2 37279 _003303_hash NULL
++_003304_hash ca91cx42_master_set 4 23146 _003304_hash NULL
++_003305_hash check586 2 29914 _003305_hash NULL
++_003306_hash check_mirror 1-2 57342 _003306_hash &_001564_hash
++_003308_hash cru_detect 1 11272 _003308_hash NULL
++_003309_hash cs553x_init_one 3 58886 _003309_hash NULL
++_003310_hash cycx_setup 4 47562 _003310_hash NULL
++_003311_hash DepcaSignature 2 80 _003311_hash &_001321_hash
++_003312_hash devm_ioremap 2-3 29235 _003312_hash NULL
++_003314_hash divasa_remap_pci_bar 3-4 23485 _003314_hash &_000947_hash
++_003316_hash dma_declare_coherent_memory 2-4 14244 _003316_hash NULL
++_003318_hash doc_probe 1 23285 _003318_hash NULL
++_003319_hash DoC_Probe 1 57534 _003319_hash NULL
++_003320_hash ems_pcmcia_add_card 2 62627 _003320_hash NULL
++_003321_hash gdth_init_isa 1 28091 _003321_hash NULL
++_003322_hash gdth_search_isa 1 58595 _003322_hash NULL
++_003323_hash isp1760_register 1-2 628 _003323_hash NULL
++_003325_hash mthca_map_reg 2-3 5664 _003325_hash NULL
++_003327_hash n2_run 3 53459 _003327_hash NULL
++_003328_hash pcim_iomap 3 58334 _003328_hash NULL
++_003329_hash probe_bios 1 17467 _003329_hash NULL
++_003330_hash register_device 2-3 60015 _003330_hash NULL
++_003332_hash remap_pci_mem 1-2 15966 _003332_hash NULL
++_003334_hash rtl_port_map 1-2 2385 _003334_hash NULL
++_003336_hash sfi_map_table 1 5462 _003336_hash NULL
++_003337_hash sriov_enable_migration 2 14889 _003337_hash NULL
++_003338_hash ssb_bus_scan 2 36578 _003338_hash NULL
++_003339_hash ssb_ioremap 2 5228 _003339_hash NULL
++_003340_hash tpm_tis_init 2-3 15304 _003340_hash NULL
++_003342_hash tsi148_master_set 4 14685 _003342_hash NULL
++_003343_hash acpi_os_map_memory 1-2 11161 _003343_hash NULL
++_003345_hash com90xx_found 3 13974 _003345_hash NULL
++_003346_hash dmam_declare_coherent_memory 2-4 43679 _003346_hash NULL
++_003348_hash gdth_isa_probe_one 1 48925 _003348_hash NULL
++_003349_hash sfi_check_table 1 6772 _003349_hash NULL
++_003350_hash sfi_sysfs_install_table 1 51688 _003350_hash NULL
++_003351_hash sriov_enable 2 59689 _003351_hash NULL
++_003352_hash ssb_bus_register 3 65183 _003352_hash NULL
++_003353_hash acpi_ex_system_memory_space_handler 2 31192 _003353_hash NULL
++_003354_hash acpi_tb_check_xsdt 1 21862 _003354_hash NULL
++_003355_hash acpi_tb_install_table 1 12988 _003355_hash NULL
++_003356_hash acpi_tb_parse_root_table 1 53455 _003356_hash NULL
++_003357_hash check_vendor_extension 1 3254 _003357_hash NULL
++_003358_hash pci_enable_sriov 2 35745 _003358_hash NULL
++_003359_hash ssb_bus_pcmciabus_register 3 56020 _003359_hash NULL
++_003360_hash ssb_bus_ssbbus_register 2 2217 _003360_hash NULL
++_003361_hash lpfc_sli_probe_sriov_nr_virtfn 2 26004 _003361_hash NULL
++_003364_hash alloc_vm_area 1 15989 _003364_hash NULL
++_003366_hash efi_ioremap 1-2 3492 _003366_hash &_001092_hash
++_003368_hash init_chip_wc_pat 2 62768 _003368_hash NULL
++_003369_hash io_mapping_create_wc 1-2 1354 _003369_hash NULL
++_003371_hash iommu_map_mmio_space 1 30919 _003371_hash NULL
++_003372_hash arch_gnttab_map_shared 3 41306 _003372_hash NULL
++_003373_hash arch_gnttab_map_status 3 49812 _003373_hash NULL
++_003374_hash intel_render_ring_init_dri 2-3 45446 _003374_hash NULL
++_003376_hash persistent_ram_iomap 1-2 47156 _003376_hash NULL
++_003378_hash sparse_early_usemaps_alloc_pgdat_section 2 62304 _003378_hash NULL
++_003379_hash ttm_bo_ioremap 2-3 31082 _003379_hash NULL
++_003381_hash ttm_bo_kmap_ttm 3 5922 _003381_hash NULL
++_003382_hash atyfb_setup_generic 3 49151 _003382_hash NULL
++_003383_hash do_test 1 15766 _003383_hash NULL
++_003384_hash mga_ioremap 1-2 8571 _003384_hash NULL
++_003386_hash mid_get_vbt_data_r0 2 10876 _003386_hash NULL
++_003387_hash mid_get_vbt_data_r10 2 6308 _003387_hash NULL
++_003388_hash mid_get_vbt_data_r1 2 26170 _003388_hash NULL
++_003389_hash persistent_ram_buffer_map 1-2 11332 _003389_hash NULL
++_003391_hash read_vbt_r0 1 503 _003391_hash NULL
++_003392_hash read_vbt_r10 1 60679 _003392_hash NULL
++_003393_hash tpci200_slot_map_space 2 3848 _003393_hash NULL
++_003394_hash ttm_bo_kmap 2-3 60118 _003394_hash NULL
++_003395_hash persistent_ram_new 1-2 14588 _003395_hash NULL
 diff --git a/tools/gcc/size_overflow_plugin.c b/tools/gcc/size_overflow_plugin.c
 new file mode 100644
-index 0000000..5af42b5
+index 0000000..e9310fa
 --- /dev/null
 +++ b/tools/gcc/size_overflow_plugin.c
-@@ -0,0 +1,1558 @@
+@@ -0,0 +1,1612 @@
 +/*
 + * Copyright 2011, 2012 by Emese Revfy <re.emese@gmail.com>
 + * Licensed under the GPL v2, or (at your option) v3
@@ -85671,9 +86347,9 @@ index 0000000..5af42b5
 +#include "cfgloop.h"
 +
 +struct size_overflow_hash {
-+              struct size_overflow_hash *next;
-+              const char *name;
-+              unsigned int param;
++      const struct size_overflow_hash * const next;
++      const char * const name;
++      const unsigned int param;
 +};
 +
 +#include "size_overflow_hash.h"
@@ -85696,15 +86372,16 @@ index 0000000..5af42b5
 +int plugin_is_GPL_compatible;
 +void debug_gimple_stmt(gimple gs);
 +
-+static tree expand(struct pointer_set_t *visited, bool *potentionally_overflowed, tree var);
++static tree expand(struct pointer_set_t *visited, bool *potentionally_overflowed, tree lhs);
 +static tree report_size_overflow_decl;
-+static tree const_char_ptr_type_node;
++static const_tree const_char_ptr_type_node;
 +static unsigned int handle_function(void);
 +static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool *potentionally_overflowed, bool before);
 +static tree get_size_overflow_type(gimple stmt, tree node);
++static tree dup_assign(struct pointer_set_t *visited, bool *potentionally_overflowed, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3);
 +
 +static struct plugin_info size_overflow_plugin_info = {
-+      .version        = "20120811beta",
++      .version        = "20120820beta",
 +      .help           = "no-size-overflow\tturn off size overflow checking\n",
 +};
 +
@@ -85757,8 +86434,8 @@ index 0000000..5af42b5
 +#define cwmixa( in ) { cwfold( in, m, k, h ); }
 +#define cwmixb( in ) { cwfold( in, n, h, k ); }
 +
-+      const unsigned int m = 0x57559429;
-+      const unsigned int n = 0x5052acdb;
++      unsigned int m = 0x57559429;
++      unsigned int n = 0x5052acdb;
 +      const unsigned int *key4 = (const unsigned int *)key;
 +      unsigned int h = len;
 +      unsigned int k = len + seed + n;
@@ -85789,14 +86466,14 @@ index 0000000..5af42b5
 +      return fn ^ codes;
 +}
 +
-+static inline tree get_original_function_decl(tree fndecl)
++static inline const_tree get_original_function_decl(const_tree fndecl)
 +{
 +      if (DECL_ABSTRACT_ORIGIN(fndecl))
 +              return DECL_ABSTRACT_ORIGIN(fndecl);
 +      return fndecl;
 +}
 +
-+static inline gimple get_def_stmt(tree node)
++static inline gimple get_def_stmt(const_tree node)
 +{
 +      gcc_assert(node != NULL_TREE);
 +      gcc_assert(TREE_CODE(node) == SSA_NAME);
@@ -85848,9 +86525,10 @@ index 0000000..5af42b5
 +      return len;
 +}
 +
-+static unsigned int get_function_decl(tree fndecl, unsigned char *tree_codes)
++static unsigned int get_function_decl(const_tree fndecl, unsigned char *tree_codes)
 +{
-+      tree arg, result, type = TREE_TYPE(fndecl);
++      tree arg;
++      const_tree result, type = TREE_TYPE(fndecl);
 +      enum tree_code code = TREE_CODE(type);
 +      size_t len = 0;
 +
@@ -85879,10 +86557,10 @@ index 0000000..5af42b5
 +      return len;
 +}
 +
-+static struct size_overflow_hash *get_function_hash(tree fndecl)
++static const struct size_overflow_hash *get_function_hash(const_tree fndecl)
 +{
 +      unsigned int hash;
-+      struct size_overflow_hash *entry;
++      const struct size_overflow_hash *entry;
 +      unsigned char tree_codes[CODES_LIMIT];
 +      size_t len;
 +      const char *func_name = NAME(fndecl);
@@ -85903,9 +86581,9 @@ index 0000000..5af42b5
 +      return NULL;
 +}
 +
-+static void check_arg_type(tree var)
++static void check_arg_type(const_tree arg)
 +{
-+      tree type = TREE_TYPE(var);
++      const_tree type = TREE_TYPE(arg);
 +      enum tree_code code = TREE_CODE(type);
 +
 +      gcc_assert(code == INTEGER_TYPE || code == ENUMERAL_TYPE ||
@@ -85913,7 +86591,7 @@ index 0000000..5af42b5
 +                (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == INTEGER_TYPE));
 +}
 +
-+static int find_arg_number(tree arg, tree func)
++static int find_arg_number(const_tree arg, const_tree func)
 +{
 +      tree var;
 +      bool match = false;
@@ -85939,7 +86617,7 @@ index 0000000..5af42b5
 +      return argnum;
 +}
 +
-+static void print_missing_msg(tree func, unsigned int argnum)
++static void print_missing_msg(const_tree func, unsigned int argnum)
 +{
 +      unsigned int new_hash;
 +      size_t len;
@@ -85952,16 +86630,15 @@ index 0000000..5af42b5
 +      inform(loc, "Function %s is missing from the size_overflow hash table +%s+%d+%u+", curfunc, curfunc, argnum, new_hash);
 +}
 +
-+static void check_missing_attribute(tree arg)
++static void check_missing_attribute(const_tree arg)
 +{
-+      tree type, func = get_original_function_decl(current_function_decl);
++      const_tree type = TREE_TYPE(arg);
++      const_tree func = get_original_function_decl(current_function_decl);
 +      unsigned int argnum;
-+      struct size_overflow_hash *hash;
++      const struct size_overflow_hash *hash;
 +
 +      gcc_assert(TREE_CODE(arg) != COMPONENT_REF);
 +
-+      type = TREE_TYPE(arg);
-+
 +      if (TREE_CODE(type) == POINTER_TYPE)
 +              return;
 +
@@ -86002,9 +86679,9 @@ index 0000000..5af42b5
 +      return assign;
 +}
 +
-+static bool is_bool(tree node)
++static bool is_bool(const_tree node)
 +{
-+      tree type;
++      const_tree type;
 +
 +      if (node == NULL_TREE)
 +              return false;
@@ -86028,26 +86705,25 @@ index 0000000..5af42b5
 +      return fold_convert(type, var);
 +}
 +
-+static gimple build_cast_stmt(tree type, tree var, tree new_var, gimple_stmt_iterator *gsi, bool before)
++static gimple build_cast_stmt(tree dst_type, tree rhs, tree lhs, gimple_stmt_iterator *gsi, bool before)
 +{
 +      gimple assign;
-+      location_t loc;
 +
-+      gcc_assert(type != NULL_TREE && var != NULL_TREE);
++      gcc_assert(dst_type != NULL_TREE && rhs != NULL_TREE);
 +      if (gsi_end_p(*gsi) && before == BEFORE_STMT)
 +              gcc_unreachable();
 +
-+      if (new_var == CREATE_NEW_VAR)
-+              new_var = create_new_var(type);
++      if (lhs == CREATE_NEW_VAR)
++              lhs = create_new_var(dst_type);
 +
-+      assign = gimple_build_assign(new_var, cast_a_tree(type, var));
++      assign = gimple_build_assign(lhs, cast_a_tree(dst_type, rhs));
 +
 +      if (!gsi_end_p(*gsi)) {
-+              loc = gimple_location(gsi_stmt(*gsi));
++              location_t loc = gimple_location(gsi_stmt(*gsi));
 +              gimple_set_location(assign, loc);
 +      }
 +
-+      gimple_set_lhs(assign, make_ssa_name(new_var, assign));
++      gimple_set_lhs(assign, make_ssa_name(lhs, assign));
 +
 +      if (before)
 +              gsi_insert_before(gsi, assign, GSI_NEW_STMT);
@@ -86061,7 +86737,7 @@ index 0000000..5af42b5
 +
 +static tree cast_to_new_size_overflow_type(gimple stmt, tree new_rhs1, tree size_overflow_type, bool before)
 +{
-+      gimple assign;
++      const_gimple assign;
 +      gimple_stmt_iterator gsi;
 +
 +      if (new_rhs1 == NULL_TREE)
@@ -86075,9 +86751,25 @@ index 0000000..5af42b5
 +      return new_rhs1;
 +}
 +
++static tree follow_overflow_type_and_dup(struct pointer_set_t *visited, bool *potentionally_overflowed, gimple stmt, tree node, tree new_rhs1, tree new_rhs2, tree new_rhs3)
++{
++      tree size_overflow_type = get_size_overflow_type(stmt, node);
++
++      new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++      if (new_rhs2 != NULL_TREE)
++              new_rhs2 = cast_to_new_size_overflow_type(stmt, new_rhs2, size_overflow_type, BEFORE_STMT);
++
++      if (new_rhs3 != NULL_TREE)
++              new_rhs3 = cast_to_new_size_overflow_type(stmt, new_rhs3, size_overflow_type, BEFORE_STMT);
++
++      return dup_assign(visited, potentionally_overflowed, stmt, size_overflow_type, new_rhs1, new_rhs2, new_rhs3);
++}
++
 +static tree create_assign(struct pointer_set_t *visited, bool *potentionally_overflowed, gimple oldstmt, tree rhs1, bool before)
 +{
-+      tree oldstmt_rhs1, size_overflow_type, lhs;
++      const_tree oldstmt_rhs1;
++      tree size_overflow_type, lhs;
 +      enum tree_code code;
 +      gimple stmt;
 +      gimple_stmt_iterator gsi;
@@ -86105,7 +86797,7 @@ index 0000000..5af42b5
 +      pointer_set_insert(visited, oldstmt);
 +      if (lookup_stmt_eh_lp(oldstmt) != 0) {
 +              basic_block next_bb, cur_bb;
-+              edge e;
++              const_edge e;
 +
 +              gcc_assert(before == false);
 +              gcc_assert(stmt_can_throw_internal(oldstmt));
@@ -86135,9 +86827,9 @@ index 0000000..5af42b5
 +
 +static tree dup_assign(struct pointer_set_t *visited, bool *potentionally_overflowed, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3)
 +{
-+      tree new_var, lhs = gimple_get_lhs(oldstmt);
 +      gimple stmt;
 +      gimple_stmt_iterator gsi;
++      tree new_var, lhs = gimple_get_lhs(oldstmt);
 +
 +      if (!*potentionally_overflowed)
 +              return NULL_TREE;
@@ -86190,7 +86882,7 @@ index 0000000..5af42b5
 +      return gimple_get_lhs(stmt);
 +}
 +
-+static gimple overflow_create_phi_node(gimple oldstmt, tree var)
++static gimple overflow_create_phi_node(gimple oldstmt, tree result)
 +{
 +      basic_block bb;
 +      gimple phi;
@@ -86198,7 +86890,7 @@ index 0000000..5af42b5
 +
 +      bb = gsi_bb(gsi);
 +
-+      phi = create_phi_node(var, bb);
++      phi = create_phi_node(result, bb);
 +      gsi = gsi_last(phi_nodes(bb));
 +      gsi_remove(&gsi, false);
 +
@@ -86222,7 +86914,7 @@ index 0000000..5af42b5
 +static tree cast_old_phi_arg(gimple oldstmt, tree size_overflow_type, tree arg, tree new_var, unsigned int i)
 +{
 +      basic_block bb;
-+      gimple newstmt;
++      const_gimple newstmt;
 +      gimple_stmt_iterator gsi;
 +      bool before = BEFORE_STMT;
 +
@@ -86244,7 +86936,7 @@ index 0000000..5af42b5
 +      return gimple_get_lhs(newstmt);
 +}
 +
-+static gimple handle_new_phi_arg(tree arg, tree new_var, tree new_rhs)
++static const_gimple handle_new_phi_arg(const_tree arg, tree new_var, tree new_rhs)
 +{
 +      gimple newstmt;
 +      gimple_stmt_iterator gsi;
@@ -86281,7 +86973,7 @@ index 0000000..5af42b5
 +
 +static tree build_new_phi_arg(struct pointer_set_t *visited, bool *potentionally_overflowed, tree size_overflow_type, tree arg, tree new_var)
 +{
-+      gimple newstmt;
++      const_gimple newstmt;
 +      tree new_rhs;
 +
 +      new_rhs = expand(visited, potentionally_overflowed, arg);
@@ -86294,27 +86986,28 @@ index 0000000..5af42b5
 +      return gimple_get_lhs(newstmt);
 +}
 +
-+static tree build_new_phi(struct pointer_set_t *visited, bool *potentionally_overflowed, tree var)
++static tree build_new_phi(struct pointer_set_t *visited, bool *potentionally_overflowed, tree orig_result)
 +{
-+      gimple phi, oldstmt = get_def_stmt(var);
-+      tree new_var, size_overflow_type;
-+      unsigned int i, n = gimple_phi_num_args(oldstmt);
++      gimple phi, oldstmt = get_def_stmt(orig_result);
++      tree new_result, size_overflow_type;
++      unsigned int i;
++      unsigned int n = gimple_phi_num_args(oldstmt);
 +
-+      size_overflow_type = get_size_overflow_type(oldstmt, var);
++      size_overflow_type = get_size_overflow_type(oldstmt, orig_result);
 +
-+      new_var = create_new_var(size_overflow_type);
++      new_result = create_new_var(size_overflow_type);
 +
 +      pointer_set_insert(visited, oldstmt);
-+      phi = overflow_create_phi_node(oldstmt, new_var);
++      phi = overflow_create_phi_node(oldstmt, new_result);
 +      for (i = 0; i < n; i++) {
 +              tree arg, lhs;
 +
 +              arg = gimple_phi_arg_def(oldstmt, i);
 +              if (is_gimple_constant(arg))
 +                      arg = cast_a_tree(size_overflow_type, arg);
-+              lhs = build_new_phi_arg(visited, potentionally_overflowed, size_overflow_type, arg, new_var);
++              lhs = build_new_phi_arg(visited, potentionally_overflowed, size_overflow_type, arg, new_result);
 +              if (lhs == NULL_TREE)
-+                      lhs = cast_old_phi_arg(oldstmt, size_overflow_type, arg, new_var, i);
++                      lhs = cast_old_phi_arg(oldstmt, size_overflow_type, arg, new_result, i);
 +              add_phi_arg(phi, lhs, gimple_phi_arg_edge(oldstmt, i), gimple_location(oldstmt));
 +      }
 +
@@ -86322,9 +87015,9 @@ index 0000000..5af42b5
 +      return gimple_phi_result(phi);
 +}
 +
-+static tree change_assign_rhs(gimple stmt, tree orig_rhs, tree new_rhs)
++static tree change_assign_rhs(gimple stmt, const_tree orig_rhs, tree new_rhs)
 +{
-+      gimple assign;
++      const_gimple assign;
 +      gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
 +      tree origtype = TREE_TYPE(orig_rhs);
 +
@@ -86337,18 +87030,18 @@ index 0000000..5af42b5
 +static void change_rhs1(gimple stmt, tree new_rhs1)
 +{
 +      tree assign_rhs;
-+      tree rhs = gimple_assign_rhs1(stmt);
++      const_tree rhs = gimple_assign_rhs1(stmt);
 +
 +      assign_rhs = change_assign_rhs(stmt, rhs, new_rhs1);
 +      gimple_assign_set_rhs1(stmt, assign_rhs);
 +      update_stmt(stmt);
 +}
 +
-+static bool check_mode_type(gimple stmt)
++static bool check_mode_type(const_gimple stmt)
 +{
-+      tree lhs = gimple_get_lhs(stmt);
-+      tree lhs_type = TREE_TYPE(lhs);
-+      tree rhs_type = TREE_TYPE(gimple_assign_rhs1(stmt));
++      const_tree lhs = gimple_get_lhs(stmt);
++      const_tree lhs_type = TREE_TYPE(lhs);
++      const_tree rhs_type = TREE_TYPE(gimple_assign_rhs1(stmt));
 +      enum machine_mode lhs_mode = TYPE_MODE(lhs_type);
 +      enum machine_mode rhs_mode = TYPE_MODE(rhs_type);
 +
@@ -86361,13 +87054,13 @@ index 0000000..5af42b5
 +      return true;
 +}
 +
-+static bool check_undefined_integer_operation(gimple stmt)
++static bool check_undefined_integer_operation(const_gimple stmt)
 +{
-+      gimple def_stmt;
-+      tree lhs = gimple_get_lhs(stmt);
-+      tree rhs1 = gimple_assign_rhs1(stmt);
-+      tree rhs1_type = TREE_TYPE(rhs1);
-+      tree lhs_type = TREE_TYPE(lhs);
++      const_gimple def_stmt;
++      const_tree lhs = gimple_get_lhs(stmt);
++      const_tree rhs1 = gimple_assign_rhs1(stmt);
++      const_tree rhs1_type = TREE_TYPE(rhs1);
++      const_tree lhs_type = TREE_TYPE(lhs);
 +
 +      if (TYPE_MODE(rhs1_type) != TYPE_MODE(lhs_type) || TYPE_UNSIGNED(rhs1_type) == TYPE_UNSIGNED(lhs_type))
 +              return false;
@@ -86381,12 +87074,33 @@ index 0000000..5af42b5
 +      return true;
 +}
 +
++static bool is_a_cast_and_const_overflow(const_tree no_const_rhs)
++{
++      const_tree rhs1, lhs, rhs1_type, lhs_type;
++      enum machine_mode lhs_mode, rhs_mode;
++      gimple def_stmt = get_def_stmt(no_const_rhs);
++
++      if (!gimple_assign_cast_p(def_stmt))
++              return false;
++
++      rhs1 = gimple_assign_rhs1(def_stmt);
++      lhs = gimple_get_lhs(def_stmt);
++      rhs1_type = TREE_TYPE(rhs1);
++      lhs_type = TREE_TYPE(lhs);
++      rhs_mode = TYPE_MODE(rhs1_type);
++      lhs_mode = TYPE_MODE(lhs_type);
++      if (TYPE_UNSIGNED(lhs_type) == TYPE_UNSIGNED(rhs1_type) || lhs_mode != rhs_mode)
++              return false;
++
++      return true;
++}
++
 +static tree handle_unary_rhs(struct pointer_set_t *visited, bool *potentionally_overflowed, gimple stmt)
 +{
 +      tree size_overflow_type, lhs = gimple_get_lhs(stmt);
 +      tree new_rhs1, rhs1 = gimple_assign_rhs1(stmt);
-+      tree rhs1_type = TREE_TYPE(rhs1);
-+      tree lhs_type = TREE_TYPE(lhs);
++      const_tree rhs1_type = TREE_TYPE(rhs1);
++      const_tree lhs_type = TREE_TYPE(lhs);
 +
 +      *potentionally_overflowed = true;
 +
@@ -86398,23 +87112,18 @@ index 0000000..5af42b5
 +      if (gimple_plf(stmt, MY_STMT))
 +              return lhs;
 +
-+      if (gimple_plf(stmt, NO_CAST_CHECK)) {
-+              size_overflow_type = get_size_overflow_type(stmt, rhs1);
-+              new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
-+              return dup_assign(visited, potentionally_overflowed, stmt, size_overflow_type, new_rhs1, NULL_TREE, NULL_TREE);
-+      }
++      if (gimple_plf(stmt, NO_CAST_CHECK))
++              return follow_overflow_type_and_dup(visited, potentionally_overflowed, stmt, rhs1, new_rhs1, NULL_TREE, NULL_TREE);
 +
-+      if (!gimple_assign_cast_p(stmt)) {
-+              size_overflow_type = get_size_overflow_type(stmt, lhs);
++      if (gimple_assign_rhs_code(stmt) == BIT_NOT_EXPR) {
++              size_overflow_type = get_size_overflow_type(stmt, rhs1);
 +              new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
-+              return dup_assign(visited, potentionally_overflowed, stmt, size_overflow_type, new_rhs1, NULL_TREE, NULL_TREE);
++              check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, potentionally_overflowed, BEFORE_STMT);
++              return create_assign(visited, potentionally_overflowed, stmt, lhs, AFTER_STMT);
 +      }
 +
-+      if (check_undefined_integer_operation(stmt)) {
-+              size_overflow_type = get_size_overflow_type(stmt, lhs);
-+              new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
-+              return dup_assign(visited, potentionally_overflowed, stmt, size_overflow_type, new_rhs1, NULL_TREE, NULL_TREE);
-+      }
++      if (!gimple_assign_cast_p(stmt) || check_undefined_integer_operation(stmt))
++              return follow_overflow_type_and_dup(visited, potentionally_overflowed, stmt, lhs, new_rhs1, NULL_TREE, NULL_TREE);
 +
 +      size_overflow_type = get_size_overflow_type(stmt, rhs1);
 +      new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
@@ -86422,8 +87131,10 @@ index 0000000..5af42b5
 +      change_rhs1(stmt, new_rhs1);
 +      check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, potentionally_overflowed, BEFORE_STMT);
 +
++      rhs1 = gimple_assign_rhs1(stmt);
++      rhs1_type = TREE_TYPE(rhs1);
 +      if (TYPE_UNSIGNED(rhs1_type) != TYPE_UNSIGNED(lhs_type))
-+              return create_assign(visited, potentionally_overflowed, stmt, lhs, AFTER_STMT);
++              return create_assign(visited, potentionally_overflowed, stmt, rhs1, AFTER_STMT);
 +
 +      if (!check_mode_type(stmt))
 +              return create_assign(visited, potentionally_overflowed, stmt, lhs, AFTER_STMT);
@@ -86481,7 +87192,7 @@ index 0000000..5af42b5
 +static tree create_string_param(tree string)
 +{
 +      tree i_type, a_type;
-+      int length = TREE_STRING_LENGTH(string);
++      const int length = TREE_STRING_LENGTH(string);
 +
 +      gcc_assert(length > 0);
 +
@@ -86495,12 +87206,14 @@ index 0000000..5af42b5
 +      return build1(ADDR_EXPR, ptr_type_node, string);
 +}
 +
-+static void insert_cond_result(basic_block bb_true, gimple stmt, tree arg, bool min)
++static void insert_cond_result(basic_block bb_true, const_gimple stmt, const_tree arg, bool min)
 +{
-+      gimple func_stmt, def_stmt;
-+      tree current_func, loc_file, loc_line, ssa_name;
++      gimple func_stmt;
++      const_gimple def_stmt;
++      const_tree loc_line;
++      tree loc_file, ssa_name, current_func;
 +      expanded_location xloc;
-+      char ssa_name_buf[100];
++      char ssa_name_buf[256];
 +      gimple_stmt_iterator gsi = gsi_start_bb(bb_true);
 +
 +      def_stmt = get_def_stmt(arg);
@@ -86520,11 +87233,8 @@ index 0000000..5af42b5
 +      current_func = build_string(NAME_LEN(current_function_decl) + 1, NAME(current_function_decl));
 +      current_func = create_string_param(current_func);
 +
-+      if (min)
-+              snprintf(ssa_name_buf, 100, "%s_%u (min)\n", NAME(SSA_NAME_VAR(arg)), SSA_NAME_VERSION(arg));
-+      else
-+              snprintf(ssa_name_buf, 100, "%s_%u (max)\n", NAME(SSA_NAME_VAR(arg)), SSA_NAME_VERSION(arg));
-+      ssa_name = build_string(100, ssa_name_buf);
++      snprintf(ssa_name_buf, 256, "%s_%u (%s)\n", NAME(SSA_NAME_VAR(arg)), SSA_NAME_VERSION(arg), min ? "min" : "max");
++      ssa_name = build_string(256, ssa_name_buf);
 +      ssa_name = create_string_param(ssa_name);
 +
 +      // void report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name)
@@ -86533,7 +87243,7 @@ index 0000000..5af42b5
 +      gsi_insert_after(&gsi, func_stmt, GSI_CONTINUE_LINKING);
 +}
 +
-+static void __unused print_the_code_insertions(gimple stmt)
++static void __unused print_the_code_insertions(const_gimple stmt)
 +{
 +      location_t loc = gimple_location(stmt);
 +
@@ -86581,7 +87291,9 @@ index 0000000..5af42b5
 +
 +static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool *potentionally_overflowed, bool before)
 +{
-+      tree cast_rhs_type, type_max_type, type_min_type, type_max, type_min, rhs_type = TREE_TYPE(rhs);
++      const_tree rhs_type = TREE_TYPE(rhs);
++      tree cast_rhs_type, type_max_type, type_min_type, type_max, type_min;
++
 +      gcc_assert(rhs_type != NULL_TREE);
 +      gcc_assert(TREE_CODE(rhs_type) == INTEGER_TYPE || TREE_CODE(rhs_type) == BOOLEAN_TYPE || TREE_CODE(rhs_type) == ENUMERAL_TYPE);
 +
@@ -86603,27 +87315,27 @@ index 0000000..5af42b5
 +      insert_check_size_overflow(stmt, LT_EXPR, cast_rhs, type_min, before, true);
 +}
 +
-+static tree get_handle_const_assign_size_overflow_type(gimple def_stmt, tree var_rhs)
++static tree get_size_overflow_type_for_intentional_overflow(gimple def_stmt, tree change_rhs)
 +{
-+      gimple var_rhs_def_stmt;
++      gimple change_rhs_def_stmt;
 +      tree lhs = gimple_get_lhs(def_stmt);
 +      tree lhs_type = TREE_TYPE(lhs);
 +      tree rhs1_type = TREE_TYPE(gimple_assign_rhs1(def_stmt));
 +      tree rhs2_type = TREE_TYPE(gimple_assign_rhs2(def_stmt));
 +
-+      if (var_rhs == NULL_TREE)
++      if (change_rhs == NULL_TREE)
 +              return get_size_overflow_type(def_stmt, lhs);
 +
-+      var_rhs_def_stmt = get_def_stmt(var_rhs);
++      change_rhs_def_stmt = get_def_stmt(change_rhs);
 +
 +      if (TREE_CODE_CLASS(gimple_assign_rhs_code(def_stmt)) == tcc_comparison)
-+              return get_size_overflow_type(var_rhs_def_stmt, var_rhs);
++              return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
 +
 +      if (gimple_assign_rhs_code(def_stmt) == LSHIFT_EXPR)
-+              return get_size_overflow_type(var_rhs_def_stmt, var_rhs);
++              return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
 +
 +      if (gimple_assign_rhs_code(def_stmt) == RSHIFT_EXPR)
-+              return get_size_overflow_type(var_rhs_def_stmt, var_rhs);
++              return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
 +
 +      if (!useless_type_conversion_p(lhs_type, rhs1_type) || !useless_type_conversion_p(rhs1_type, rhs2_type)) {
 +              debug_gimple_stmt(def_stmt);
@@ -86633,44 +87345,16 @@ index 0000000..5af42b5
 +      return get_size_overflow_type(def_stmt, lhs);
 +}
 +
-+static tree handle_const_assign(struct pointer_set_t *visited, bool *potentionally_overflowed, gimple def_stmt, tree var_rhs, tree new_rhs1, tree new_rhs2)
++static bool is_a_constant_overflow(const_gimple stmt, const_tree rhs)
 +{
-+      tree new_rhs, size_overflow_type, orig_rhs;
-+      void (*gimple_assign_set_rhs)(gimple, tree);
-+      tree rhs1 = gimple_assign_rhs1(def_stmt);
-+      tree rhs2 = gimple_assign_rhs2(def_stmt);
-+      tree lhs = gimple_get_lhs(def_stmt);
-+
-+      if (var_rhs == NULL_TREE)
-+              return create_assign(visited, potentionally_overflowed, def_stmt, lhs, AFTER_STMT);
-+
-+      if (new_rhs2 == NULL_TREE) {
-+              size_overflow_type = get_handle_const_assign_size_overflow_type(def_stmt, new_rhs1);
-+              new_rhs2 = cast_a_tree(size_overflow_type, rhs2);
-+              orig_rhs = rhs1;
-+              gimple_assign_set_rhs = &gimple_assign_set_rhs1;
-+      } else {
-+              size_overflow_type = get_handle_const_assign_size_overflow_type(def_stmt, new_rhs2);
-+              new_rhs1 = cast_a_tree(size_overflow_type, rhs1);
-+              orig_rhs = rhs2;
-+              gimple_assign_set_rhs = &gimple_assign_set_rhs2;
-+      }
-+
-+      var_rhs = cast_to_new_size_overflow_type(def_stmt, var_rhs, size_overflow_type, BEFORE_STMT);
-+
-+      if (gimple_assign_rhs_code(def_stmt) == MIN_EXPR)
-+              return dup_assign(visited, potentionally_overflowed, def_stmt, size_overflow_type, new_rhs1, new_rhs2, NULL_TREE);
-+
-+      check_size_overflow(def_stmt, size_overflow_type, var_rhs, orig_rhs, potentionally_overflowed, BEFORE_STMT);
-+
-+      new_rhs = change_assign_rhs(def_stmt, orig_rhs, var_rhs);
-+      gimple_assign_set_rhs(def_stmt, new_rhs);
-+      update_stmt(def_stmt);
-+
-+      return create_assign(visited, potentionally_overflowed, def_stmt, lhs, AFTER_STMT);
++      if (gimple_assign_rhs_code(stmt) == MIN_EXPR)
++              return false;
++      if (!is_gimple_constant(rhs))
++              return false;
++      return true;
 +}
 +
-+static tree get_cast_def_stmt_rhs(tree new_rhs)
++static tree get_cast_def_stmt_rhs(const_tree new_rhs)
 +{
 +      gimple def_stmt;
 +
@@ -86684,7 +87368,8 @@ index 0000000..5af42b5
 +static tree cast_to_int_TI_type_and_check(bool *potentionally_overflowed, gimple stmt, tree new_rhs)
 +{
 +      gimple_stmt_iterator gsi;
-+      gimple cast_stmt, def_stmt;
++      const_gimple cast_stmt;
++      gimple def_stmt;
 +      enum machine_mode mode = TYPE_MODE(TREE_TYPE(new_rhs));
 +
 +      if (mode != TImode && mode != DImode) {
@@ -86711,13 +87396,13 @@ index 0000000..5af42b5
 +      return new_rhs;
 +}
 +
-+static bool is_an_integer_trunction(gimple stmt)
++static bool is_an_integer_trunction(const_gimple stmt)
 +{
 +      gimple rhs1_def_stmt, rhs2_def_stmt;
-+      tree rhs1_def_stmt_rhs1, rhs2_def_stmt_rhs1;
++      const_tree rhs1_def_stmt_rhs1, rhs2_def_stmt_rhs1;
 +      enum machine_mode rhs1_def_stmt_rhs1_mode, rhs2_def_stmt_rhs1_mode;
-+      tree rhs1 = gimple_assign_rhs1(stmt);
-+      tree rhs2 = gimple_assign_rhs2(stmt);
++      const_tree rhs1 = gimple_assign_rhs1(stmt);
++      const_tree rhs2 = gimple_assign_rhs2(stmt);
 +      enum machine_mode rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1));
 +      enum machine_mode rhs2_mode = TYPE_MODE(TREE_TYPE(rhs2));
 +
@@ -86748,7 +87433,7 @@ index 0000000..5af42b5
 +
 +static tree handle_integer_truncation(struct pointer_set_t *visited, bool *potentionally_overflowed, tree lhs)
 +{
-+      tree new_rhs1, new_rhs2, size_overflow_type;
++      tree new_rhs1, new_rhs2;
 +      tree new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1, new_lhs;
 +      tree new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type;
 +      gimple assign, stmt = get_def_stmt(lhs);
@@ -86776,15 +87461,64 @@ index 0000000..5af42b5
 +      new_lhs = gimple_get_lhs(assign);
 +      check_size_overflow(assign, TREE_TYPE(new_lhs), new_lhs, rhs1, potentionally_overflowed, AFTER_STMT);
 +
-+      size_overflow_type = get_size_overflow_type(stmt, lhs);
-+      new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
-+      new_rhs2 = cast_to_new_size_overflow_type(stmt, new_rhs2, size_overflow_type, BEFORE_STMT);
-+      return dup_assign(visited, potentionally_overflowed, stmt, size_overflow_type, new_rhs1, new_rhs2, NULL_TREE);
++      return follow_overflow_type_and_dup(visited, potentionally_overflowed, stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++static bool is_a_neg_overflow(const_gimple stmt, const_tree rhs)
++{
++      const_gimple def_stmt;
++
++      if (TREE_CODE(rhs) != SSA_NAME)
++              return false;
++
++      if (gimple_assign_rhs_code(stmt) != PLUS_EXPR)
++              return false;
++
++      def_stmt = get_def_stmt(rhs);
++      if (gimple_code(def_stmt) != GIMPLE_ASSIGN || gimple_assign_rhs_code(def_stmt) != BIT_NOT_EXPR)
++              return false;
++
++      return true;
++}
++
++static tree handle_intentional_overflow(struct pointer_set_t *visited, bool *potentionally_overflowed, bool check_overflow, gimple stmt, tree change_rhs, tree new_rhs1, tree new_rhs2)
++{
++      tree new_rhs, size_overflow_type, orig_rhs;
++      void (*gimple_assign_set_rhs)(gimple, tree);
++      tree rhs1 = gimple_assign_rhs1(stmt);
++      tree rhs2 = gimple_assign_rhs2(stmt);
++      tree lhs = gimple_get_lhs(stmt);
++
++      if (change_rhs == NULL_TREE)
++              return create_assign(visited, potentionally_overflowed, stmt, lhs, AFTER_STMT);
++
++      if (new_rhs2 == NULL_TREE) {
++              size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs1);
++              new_rhs2 = cast_a_tree(size_overflow_type, rhs2);
++              orig_rhs = rhs1;
++              gimple_assign_set_rhs = &gimple_assign_set_rhs1;
++      } else {
++              size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs2);
++              new_rhs1 = cast_a_tree(size_overflow_type, rhs1);
++              orig_rhs = rhs2;
++              gimple_assign_set_rhs = &gimple_assign_set_rhs2;
++      }
++
++      change_rhs = cast_to_new_size_overflow_type(stmt, change_rhs, size_overflow_type, BEFORE_STMT);
++
++      if (check_overflow)
++              check_size_overflow(stmt, size_overflow_type, change_rhs, orig_rhs, potentionally_overflowed, BEFORE_STMT);
++
++      new_rhs = change_assign_rhs(stmt, orig_rhs, change_rhs);
++      gimple_assign_set_rhs(stmt, new_rhs);
++      update_stmt(stmt);
++
++      return create_assign(visited, potentionally_overflowed, stmt, lhs, AFTER_STMT);
 +}
 +
 +static tree handle_binary_ops(struct pointer_set_t *visited, bool *potentionally_overflowed, tree lhs)
 +{
-+      tree rhs1, rhs2, size_overflow_type, new_lhs;
++      tree rhs1, rhs2, new_lhs;
 +      gimple def_stmt = get_def_stmt(lhs);
 +      tree new_rhs1 = NULL_TREE;
 +      tree new_rhs2 = NULL_TREE;
@@ -86822,18 +87556,17 @@ index 0000000..5af42b5
 +      if (TREE_CODE(rhs2) == SSA_NAME)
 +              new_rhs2 = expand(visited, potentionally_overflowed, rhs2);
 +
-+      if (is_gimple_constant(rhs2))
-+              return handle_const_assign(visited, potentionally_overflowed, def_stmt, new_rhs1, new_rhs1, NULL_TREE);
-+
-+      if (is_gimple_constant(rhs1))
-+              return handle_const_assign(visited, potentionally_overflowed, def_stmt, new_rhs2, NULL_TREE, new_rhs2);
-+
-+      size_overflow_type = get_size_overflow_type(def_stmt, lhs);
++      if (is_a_neg_overflow(def_stmt, rhs2))
++              return handle_intentional_overflow(visited, potentionally_overflowed, true, def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++      if (is_a_neg_overflow(def_stmt, rhs1))
++              return handle_intentional_overflow(visited, potentionally_overflowed, true, def_stmt, new_rhs2, NULL_TREE, new_rhs2);
 +
-+      new_rhs1 = cast_to_new_size_overflow_type(def_stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
-+      new_rhs2 = cast_to_new_size_overflow_type(def_stmt, new_rhs2, size_overflow_type, BEFORE_STMT);
++      if (is_a_constant_overflow(def_stmt, rhs2))
++              return handle_intentional_overflow(visited, potentionally_overflowed, !is_a_cast_and_const_overflow(rhs1), def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++      if (is_a_constant_overflow(def_stmt, rhs1))
++              return handle_intentional_overflow(visited, potentionally_overflowed, !is_a_cast_and_const_overflow(rhs2), def_stmt, new_rhs2, NULL_TREE, new_rhs2);
 +
-+      return dup_assign(visited, potentionally_overflowed, def_stmt, size_overflow_type, new_rhs1, new_rhs2, NULL_TREE);
++      return follow_overflow_type_and_dup(visited, potentionally_overflowed, def_stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
 +}
 +
 +#if BUILDING_GCC_VERSION >= 4007
@@ -86846,14 +87579,14 @@ index 0000000..5af42b5
 +      return expand(visited, potentionally_overflowed, rhs);
 +}
 +
-+static tree handle_ternary_ops(struct pointer_set_t *visited, bool *potentionally_overflowed, tree var)
++static tree handle_ternary_ops(struct pointer_set_t *visited, bool *potentionally_overflowed, tree lhs)
 +{
 +      tree rhs1, rhs2, rhs3, new_rhs1, new_rhs2, new_rhs3, size_overflow_type;
-+      gimple def_stmt = get_def_stmt(var);
++      gimple def_stmt = get_def_stmt(lhs);
 +
 +      *potentionally_overflowed = true;
 +
-+      size_overflow_type = get_size_overflow_type(def_stmt, var);
++      size_overflow_type = get_size_overflow_type(def_stmt, lhs);
 +
 +      rhs1 = gimple_assign_rhs1(def_stmt);
 +      rhs2 = gimple_assign_rhs2(def_stmt);
@@ -86862,11 +87595,7 @@ index 0000000..5af42b5
 +      new_rhs2 = get_new_rhs(visited, potentionally_overflowed, size_overflow_type, rhs2);
 +      new_rhs3 = get_new_rhs(visited, potentionally_overflowed, size_overflow_type, rhs3);
 +
-+      new_rhs1 = cast_to_new_size_overflow_type(def_stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
-+      new_rhs2 = cast_to_new_size_overflow_type(def_stmt, new_rhs2, size_overflow_type, BEFORE_STMT);
-+      new_rhs3 = cast_to_new_size_overflow_type(def_stmt, new_rhs3, size_overflow_type, BEFORE_STMT);
-+
-+      return dup_assign(visited, potentionally_overflowed, def_stmt, size_overflow_type, new_rhs1, new_rhs2, new_rhs3);
++      return follow_overflow_type_and_dup(visited, potentionally_overflowed, def_stmt, lhs, new_rhs1, new_rhs2, new_rhs3);
 +}
 +#endif
 +
@@ -86901,7 +87630,7 @@ index 0000000..5af42b5
 +
 +static tree expand_visited(gimple def_stmt)
 +{
-+      gimple next_stmt;
++      const_gimple next_stmt;
 +      gimple_stmt_iterator gsi = gsi_for_stmt(def_stmt);
 +
 +      gsi_next(&gsi);
@@ -86919,51 +87648,51 @@ index 0000000..5af42b5
 +      }
 +}
 +
-+static tree expand(struct pointer_set_t *visited, bool *potentionally_overflowed, tree var)
++static tree expand(struct pointer_set_t *visited, bool *potentionally_overflowed, tree lhs)
 +{
 +      gimple def_stmt;
-+      enum tree_code code = TREE_CODE(TREE_TYPE(var));
++      enum tree_code code = TREE_CODE(TREE_TYPE(lhs));
 +
-+      if (is_gimple_constant(var))
++      if (is_gimple_constant(lhs))
 +              return NULL_TREE;
 +
-+      if (TREE_CODE(var) == ADDR_EXPR)
++      if (TREE_CODE(lhs) == ADDR_EXPR)
 +              return NULL_TREE;
 +
 +      gcc_assert(code == INTEGER_TYPE || code == POINTER_TYPE || code == BOOLEAN_TYPE || code == ENUMERAL_TYPE);
 +
-+      if (TREE_CODE(SSA_NAME_VAR(var)) == PARM_DECL)
-+              check_missing_attribute(var);
++      if (TREE_CODE(SSA_NAME_VAR(lhs)) == PARM_DECL)
++              check_missing_attribute(lhs);
 +
-+      def_stmt = get_def_stmt(var);
++      def_stmt = get_def_stmt(lhs);
 +
 +      if (!def_stmt)
 +              return NULL_TREE;
 +
 +      if (gimple_plf(def_stmt, MY_STMT))
-+              return var;
++              return lhs;
 +
 +      if (pointer_set_contains(visited, def_stmt))
 +              return expand_visited(def_stmt);
 +
 +      switch (gimple_code(def_stmt)) {
 +      case GIMPLE_NOP:
-+              check_missing_attribute(var);
++              check_missing_attribute(lhs);
 +              return NULL_TREE;
 +      case GIMPLE_PHI:
-+              return build_new_phi(visited, potentionally_overflowed, var);
++              return build_new_phi(visited, potentionally_overflowed, lhs);
 +      case GIMPLE_CALL:
 +      case GIMPLE_ASM:
-+              return create_assign(visited, potentionally_overflowed, def_stmt, var, AFTER_STMT);
++              return create_assign(visited, potentionally_overflowed, def_stmt, lhs, AFTER_STMT);
 +      case GIMPLE_ASSIGN:
 +              switch (gimple_num_ops(def_stmt)) {
 +              case 2:
-+                      return handle_unary_ops(visited, potentionally_overflowed, var);
++                      return handle_unary_ops(visited, potentionally_overflowed, lhs);
 +              case 3:
-+                      return handle_binary_ops(visited, potentionally_overflowed, var);
++                      return handle_binary_ops(visited, potentionally_overflowed, lhs);
 +#if BUILDING_GCC_VERSION >= 4007
 +              case 4:
-+                      return handle_ternary_ops(visited, potentionally_overflowed, var);
++                      return handle_ternary_ops(visited, potentionally_overflowed, lhs);
 +#endif
 +              }
 +      default:
@@ -86973,9 +87702,9 @@ index 0000000..5af42b5
 +      }
 +}
 +
-+static void change_function_arg(gimple stmt, tree origarg, unsigned int argnum, tree newarg)
++static void change_function_arg(gimple stmt, const_tree origarg, unsigned int argnum, tree newarg)
 +{
-+      gimple assign;
++      const_gimple assign;
 +      gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
 +      tree origtype = TREE_TYPE(origarg);
 +
@@ -86987,10 +87716,11 @@ index 0000000..5af42b5
 +      update_stmt(stmt);
 +}
 +
-+static tree get_function_arg(unsigned int argnum, gimple stmt, tree fndecl)
++static tree get_function_arg(unsigned int argnum, const_gimple stmt, const_tree fndecl)
 +{
 +      const char *origid;
-+      tree arg, origarg;
++      tree arg;
++      const_tree origarg;
 +
 +      if (!DECL_ABSTRACT_ORIGIN(fndecl)) {
 +              gcc_assert(gimple_call_num_args(stmt) > argnum);
@@ -87014,7 +87744,7 @@ index 0000000..5af42b5
 +      return NULL_TREE;
 +}
 +
-+static void handle_function_arg(gimple stmt, tree fndecl, unsigned int argnum)
++static void handle_function_arg(gimple stmt, const_tree fndecl, unsigned int argnum)
 +{
 +      struct pointer_set_t *visited;
 +      tree arg, newarg;
@@ -87044,7 +87774,7 @@ index 0000000..5af42b5
 +      check_size_overflow(stmt, TREE_TYPE(newarg), newarg, arg, &potentionally_overflowed, BEFORE_STMT);
 +}
 +
-+static void handle_function_by_attribute(gimple stmt, tree attr, tree fndecl)
++static void handle_function_by_attribute(gimple stmt, const_tree attr, const_tree fndecl)
 +{
 +      tree p = TREE_VALUE(attr);
 +      do {
@@ -87053,11 +87783,11 @@ index 0000000..5af42b5
 +      } while (p);
 +}
 +
-+static void handle_function_by_hash(gimple stmt, tree fndecl)
++static void handle_function_by_hash(gimple stmt, const_tree fndecl)
 +{
-+      tree orig_fndecl;
++      const_tree orig_fndecl;
 +      unsigned int num;
-+      struct size_overflow_hash *hash;
++      const struct size_overflow_hash *hash;
 +
 +      orig_fndecl = get_original_function_decl(fndecl);
 +      hash = get_function_hash(orig_fndecl);
@@ -87094,7 +87824,7 @@ index 0000000..5af42b5
 +              next = bb->next_bb;
 +
 +              for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
-+                      tree fndecl, attr;
++                      const_tree fndecl, attr;
 +                      gimple stmt = gsi_stmt(gsi);
 +
 +                      if (!(is_gimple_call(stmt)))
@@ -87514,7 +88244,7 @@ index 0000000..38d2014
 +      return 0;
 +}
 diff --git a/tools/perf/util/include/asm/alternative-asm.h b/tools/perf/util/include/asm/alternative-asm.h
-index 6789d78..4afd019 100644
+index 6789d78..4afd019e 100644
 --- a/tools/perf/util/include/asm/alternative-asm.h
 +++ b/tools/perf/util/include/asm/alternative-asm.h
 @@ -5,4 +5,7 @@
index d12624a04aec25eedc724a0f18dadcef256b60f0..e8ab26fd69fe5e39ff098091a3265c601b65b2a1 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = mesa
 version    = 7.11.2
-release    = 1
+release    = 2
 
 groups     = Development/Tools
 url        = http://www.mesa3d.org
@@ -75,6 +75,10 @@ packages
        package %{name}-devel
                template DEVEL
 
+               provides
+                       libGL-devel = %{thisver}
+               end
+
                requires
                        libX11-devel
                end
diff --git a/mtr/mtr.nm b/mtr/mtr.nm
new file mode 100644 (file)
index 0000000..4d978be
--- /dev/null
@@ -0,0 +1,37 @@
+###############################################################################
+# IPFire.org    - An Open Source Firewall Solution                            #
+# Copyright (C) - IPFire Development Team <info@ipfire.org>                   #
+###############################################################################
+
+name       = mtr
+version    = 0.82
+release    = 1
+
+groups     = Applications/Internet
+url        = http://www.BitWizard.nl/mtr
+license    = GPLv2+
+summary    = A network diagnostic tool.
+
+description
+       Mtr is a network diagnostic tool that combines ping and traceroute
+       into one program.
+end
+
+source_dl  = ftp://ftp.bitwizard.nl/mtr/
+
+build
+       requires
+               ncurses-devel
+       end
+
+       configure_options += \
+               --without-gtk
+end
+
+packages
+       package %{name}
+
+       package %{name}-debuginfo
+               template DEBUGINFO
+       end
+end
index fef3ca5500d9449c74f5e0356cd43b7f7e8a32cb..1f80a015edd4b838ddc0665bfa5b853b191213b5 100644 (file)
@@ -4,7 +4,7 @@
 ###############################################################################
 
 name       = openldap
-version    = 2.4.30
+version    = 2.4.32
 release    = 1
 
 groups     = System/Daemons
@@ -51,11 +51,6 @@ build
                --enable-ndb=no \
                --disable-static
 
-# Doens't seem to work in chroot.
-#define test
-#      cd %{DIR_APP} && make check
-#endef
-
        install_cmds
                mv -v %{BUILDROOT}%{libdir}/slapd %{BUILDROOT}/usr/sbin/slapd
                ln -svf slapd %{BUILDROOT}/usr/sbin/slapacl
@@ -85,6 +80,24 @@ end
 
 packages
        package %{name}
+               script postin
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script preun
+                       systemctl --no-reload disable openldap.service >/dev/null 2>&1 || :
+                       systemctl stop openldap.service >/dev/null 2>&1 || :
+               end
+
+               script postun
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script postup
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+                       systemctl try-restart openldap.service >/dev/null 2>&1 || :
+               end
+       end
 
        package %{name}-libs
                template LIBS
index 4eb155fc9e952d81715e139b2e5cb364ba48ebdc..8c2c57ba422502a555c6534e7dec6fe360b816d1 100644 (file)
@@ -1,5 +1,5 @@
 [Unit]
-Description=Very Secure FTP Daemon
+Description=OpenLDAP
 After=basic.target
 
 [Service]
index 707790b2f1dfbcce360119b562967ad7b0c8f173..42423eef5b239947952972b2d18133a34382f4ef 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = openssh
 version    = 5.9p1
-release    = 6
+release    = 7
 
 groups     = Application/Internet
 url        = http://www.openssh.com/portable.html
@@ -172,7 +172,7 @@ packages
                files
                        %{sysconfdir}/pam.d/sshd
                        %{sysconfdir}/ssh/sshd_config
-                       /lib/systemd
+                       %{unitdir}/sshd.service
                        %{libdir}/openssh/sftp-server
                        %{sbindir}/sshd-keygen
                        %{sbindir}/sshd
index c071243e4837e8e2adbc29425ee57045be4733f9..d862b326c233ef47c3443b14839cb9b3e3acc371 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = pakfire
 version    = 0.9.23
-release    = 1
+release    = 3
 
 maintainer = Michael Tremer <michael.tremer@ipfire.org>
 groups     = System/Packaging
diff --git a/pakfire/patches/0001-Rework-parallelism-decision-function-and-move-it-int.patch b/pakfire/patches/0001-Rework-parallelism-decision-function-and-move-it-int.patch
new file mode 100644 (file)
index 0000000..c34691b
--- /dev/null
@@ -0,0 +1,444 @@
+From cae350969fc6ae01b1f4a10927c43340f1ca0592 Mon Sep 17 00:00:00 2001
+From: Michael Tremer <michael.tremer@ipfire.org>
+Date: Thu, 26 Jul 2012 20:49:25 +0200
+Subject: [PATCH 1/4] Rework parallelism decision function and move it into
+ the System class.
+
+---
+ po/pakfire.pot                  | 128 +++++++++++++++++++++-------------------
+ python/pakfire/cli.py           |   1 +
+ python/pakfire/packages/make.py |   3 +-
+ python/pakfire/system.py        |  16 +++++
+ python/pakfire/util.py          |  13 ----
+ 5 files changed, 85 insertions(+), 76 deletions(-)
+
+diff --git a/po/pakfire.pot b/po/pakfire.pot
+index 495f5cd..c1c67fb 100644
+--- a/po/pakfire.pot
++++ b/po/pakfire.pot
+@@ -8,7 +8,7 @@ msgid ""
+ msgstr ""
+ "Project-Id-Version: PACKAGE VERSION\n"
+ "Report-Msgid-Bugs-To: \n"
+-"POT-Creation-Date: 2012-07-26 17:09+0200\n"
++"POT-Creation-Date: 2012-07-26 19:43+0200\n"
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+ "Language-Team: LANGUAGE <LL@li.org>\n"
+@@ -428,11 +428,11 @@ msgstr ""
+ msgid "Enabled"
+ msgstr ""
+-#: ../python/pakfire/cli.py:348 ../python/pakfire/cli.py:1050
++#: ../python/pakfire/cli.py:348 ../python/pakfire/cli.py:1051
+ msgid "Priority"
+ msgstr ""
+-#: ../python/pakfire/cli.py:348 ../python/pakfire/cli.py:1095
++#: ../python/pakfire/cli.py:348 ../python/pakfire/cli.py:1096
+ msgid "Packages"
+ msgstr ""
+@@ -659,228 +659,232 @@ msgstr ""
+ msgid "Memory"
+ msgstr ""
+-#: ../python/pakfire/cli.py:964 ../python/pakfire/server.py:311
++#: ../python/pakfire/cli.py:963
++msgid "Parallelism"
++msgstr ""
++
++#: ../python/pakfire/cli.py:965 ../python/pakfire/server.py:311
+ msgid "Native arch"
+ msgstr ""
+-#: ../python/pakfire/cli.py:966
++#: ../python/pakfire/cli.py:967
+ msgid "Default arch"
+ msgstr ""
+-#: ../python/pakfire/cli.py:968 ../python/pakfire/server.py:313
++#: ../python/pakfire/cli.py:969 ../python/pakfire/server.py:313
+ msgid "Supported arches"
+ msgstr ""
+-#: ../python/pakfire/cli.py:981
++#: ../python/pakfire/cli.py:982
+ msgid "Your IP address"
+ msgstr ""
+-#: ../python/pakfire/cli.py:986
++#: ../python/pakfire/cli.py:987
+ msgid "You are authenticated to the build service:"
+ msgstr ""
+-#: ../python/pakfire/cli.py:992
++#: ../python/pakfire/cli.py:993
+ msgid "User name"
+ msgstr ""
+-#: ../python/pakfire/cli.py:993
++#: ../python/pakfire/cli.py:994
+ msgid "Real name"
+ msgstr ""
+-#: ../python/pakfire/cli.py:994
++#: ../python/pakfire/cli.py:995
+ msgid "Email address"
+ msgstr ""
+-#: ../python/pakfire/cli.py:995
++#: ../python/pakfire/cli.py:996
+ msgid "Registered"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1002
++#: ../python/pakfire/cli.py:1003
+ msgid "You could not be authenticated to the build service."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1023
++#: ../python/pakfire/cli.py:1024
+ msgid "No ongoing jobs found."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1026
++#: ../python/pakfire/cli.py:1027
+ msgid "Active build jobs"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1032
++#: ../python/pakfire/cli.py:1033
+ msgid "No jobs found."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1035
++#: ../python/pakfire/cli.py:1036
+ msgid "Recently processed build jobs"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1042
++#: ../python/pakfire/cli.py:1043
+ #, python-format
+ msgid "A build with ID %s could not be found."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1045
++#: ../python/pakfire/cli.py:1046
+ #, python-format
+ msgid "Build: %(name)s"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1049 ../python/pakfire/cli.py:1077
++#: ../python/pakfire/cli.py:1050 ../python/pakfire/cli.py:1078
+ msgid "State"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1053
++#: ../python/pakfire/cli.py:1054
+ msgid "Jobs"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1066
++#: ../python/pakfire/cli.py:1067
+ #, python-format
+ msgid "A job with ID %s could not be found."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1073
++#: ../python/pakfire/cli.py:1074
+ #, python-format
+ msgid "Job: %(name)s"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1078 ../python/pakfire/packages/base.py:107
++#: ../python/pakfire/cli.py:1079 ../python/pakfire/packages/base.py:107
+ #: ../python/pakfire/transaction.py:404
+ msgid "Arch"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1083 ../python/pakfire/packages/base.py:142
++#: ../python/pakfire/cli.py:1084 ../python/pakfire/packages/base.py:142
+ msgid "Build host"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1088
++#: ../python/pakfire/cli.py:1089
+ msgid "Time created"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1089
++#: ../python/pakfire/cli.py:1090
+ msgid "Time started"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1090
++#: ../python/pakfire/cli.py:1091
+ msgid "Time finished"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1091
++#: ../python/pakfire/cli.py:1092
+ msgid "Duration"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1119
++#: ../python/pakfire/cli.py:1120
+ msgid "Invalid error code given."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1122
++#: ../python/pakfire/cli.py:1123
+ #, python-format
+ msgid "Reponse from the server: %s"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1128
++#: ../python/pakfire/cli.py:1129
+ msgid "Pakfire daemon command line interface."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1156
++#: ../python/pakfire/cli.py:1157
+ msgid "Pakfire key command line interface."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1200 ../python/pakfire/cli.py:1210
++#: ../python/pakfire/cli.py:1201 ../python/pakfire/cli.py:1211
+ msgid "Import a key from file."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1202
++#: ../python/pakfire/cli.py:1203
+ msgid "The real name of the owner of this key."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1204
++#: ../python/pakfire/cli.py:1205
+ msgid "The email address of the owner of this key."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1212
++#: ../python/pakfire/cli.py:1213
+ msgid "Filename of that key to import."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1218
++#: ../python/pakfire/cli.py:1219
+ msgid "Export a key to a file."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1220
++#: ../python/pakfire/cli.py:1221
+ msgid "The ID of the key to export."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1222
++#: ../python/pakfire/cli.py:1223
+ msgid "Write the key to this file."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1224
++#: ../python/pakfire/cli.py:1225
+ msgid "Export the secret key, too."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1230
++#: ../python/pakfire/cli.py:1231
+ msgid "Delete a key from the local keyring."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1232
++#: ../python/pakfire/cli.py:1233
+ msgid "The ID of the key to delete."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1238
++#: ../python/pakfire/cli.py:1239
+ msgid "List all imported keys."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1244
++#: ../python/pakfire/cli.py:1245
+ msgid "Sign one or more packages."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1246
++#: ../python/pakfire/cli.py:1247
+ msgid "Key that is used sign the package(s)."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1248
++#: ../python/pakfire/cli.py:1249
+ msgid "Package(s) to sign."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1254
++#: ../python/pakfire/cli.py:1255
+ msgid "Verify one or more packages."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1258
++#: ../python/pakfire/cli.py:1259
+ msgid "Package(s) to verify."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1265
++#: ../python/pakfire/cli.py:1266
+ msgid "Generating the key may take a moment..."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1314
++#: ../python/pakfire/cli.py:1315
+ #, python-format
+ msgid "Signing %s..."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1331
++#: ../python/pakfire/cli.py:1332
+ #, python-format
+ msgid "Verifying %s..."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1341
++#: ../python/pakfire/cli.py:1342
+ msgid "This signature is valid."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1344
++#: ../python/pakfire/cli.py:1345
+ msgid "Unknown key"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1345
++#: ../python/pakfire/cli.py:1346
+ msgid "Could not check if this signature is valid."
+ msgstr ""
+-#: ../python/pakfire/cli.py:1348 ../python/pakfire/keyring.py:96
++#: ../python/pakfire/cli.py:1349 ../python/pakfire/keyring.py:96
+ #, python-format
+ msgid "Created: %s"
+ msgstr ""
+-#: ../python/pakfire/cli.py:1352 ../python/pakfire/keyring.py:99
++#: ../python/pakfire/cli.py:1353 ../python/pakfire/keyring.py:99
+ #, python-format
+ msgid "Expires: %s"
+ msgstr ""
+@@ -1216,26 +1220,26 @@ msgstr ""
+ msgid "Template does not exist: %s"
+ msgstr ""
+-#: ../python/pakfire/packages/make.py:80
++#: ../python/pakfire/packages/make.py:81
+ msgid "Package name is undefined."
+ msgstr ""
+-#: ../python/pakfire/packages/make.py:83
++#: ../python/pakfire/packages/make.py:84
+ msgid "Package version is undefined."
+ msgstr ""
+-#: ../python/pakfire/packages/make.py:420
++#: ../python/pakfire/packages/make.py:421
+ #, python-format
+ msgid "Searching for automatic dependencies for %s..."
+ msgstr ""
+-#: ../python/pakfire/packages/make.py:474
++#: ../python/pakfire/packages/make.py:475
+ #, python-format
+ msgid "Regular experession is invalid and has been skipped: %s"
+ msgstr ""
+ #. Let the user know what has been done.
+-#: ../python/pakfire/packages/make.py:490
++#: ../python/pakfire/packages/make.py:491
+ #, python-format
+ msgid "Filter '%(pattern)s' filtered %(dep)s."
+ msgstr ""
+diff --git a/python/pakfire/cli.py b/python/pakfire/cli.py
+index a808975..419e9a0 100644
+--- a/python/pakfire/cli.py
++++ b/python/pakfire/cli.py
+@@ -960,6 +960,7 @@ class CliClient(Cli):
+               ret.append("  %s:" % _("Hardware information"))
+               ret.append("      %-16s: %s" % (_("CPU model"), system.cpu_model))
+               ret.append("      %-16s: %s" % (_("Memory"),    util.format_size(system.memory)))
++              ret.append("      %-16s: %s" % (_("Parallelism"), system.parallelism))
+               ret.append("")
+               ret.append("      %-16s: %s" % (_("Native arch"), system.native_arch))
+               if not system.arch == system.native_arch:
+diff --git a/python/pakfire/packages/make.py b/python/pakfire/packages/make.py
+index 43aca8a..263527a 100644
+--- a/python/pakfire/packages/make.py
++++ b/python/pakfire/packages/make.py
+@@ -45,6 +45,7 @@ from file import SourcePackage
+ from pakfire.constants import *
+ from pakfire.i18n import _
++from pakfire.system import system
+ class MakefileBase(Package):
+       def __init__(self, pakfire, filename):
+@@ -57,7 +58,7 @@ class MakefileBase(Package):
+               environ = self.pakfire.environ
+               environ.update({
+                       "BASEDIR"          : os.path.dirname(self.filename),
+-                      "PARALLELISMFLAGS" : "-j%s" % util.calc_parallelism(),
++                      "PARALLELISMFLAGS" : "-j%d" % system.parallelism,
+               })
+               # Open and parse the makefile.
+diff --git a/python/pakfire/system.py b/python/pakfire/system.py
+index 4d533dd..44d43a2 100644
+--- a/python/pakfire/system.py
++++ b/python/pakfire/system.py
+@@ -150,6 +150,22 @@ class System(object):
+       def get_mountpoint(self, path):
+               return Mountpoint(path)
++      @property
++      def parallelism(self):
++              """
++                      Calculates how many processes should be run
++                      simulatneously when compiling.
++              """
++              # Check how many processes would fit into the
++              # memory when each process takes up to 500MB.
++              multiplicator = self.memory / (500 * 1024 * 1024)
++              multiplicator = round(multiplicator)
++
++              # Count the number of online CPU cores.
++              cpucount = os.sysconf("SC_NPROCESSORS_CONF")
++
++              return min(multiplicator, cpucount * 2)
++
+ # Create an instance of this class to only keep it once in memory.
+ system = System()
+diff --git a/python/pakfire/util.py b/python/pakfire/util.py
+index 2581ece..9fa011a 100644
+--- a/python/pakfire/util.py
++++ b/python/pakfire/util.py
+@@ -296,16 +296,3 @@ def scriptlet_interpreter(scriptlet):
+               break
+       return interpreter
+-
+-def calc_parallelism():
+-      """
+-              Calculate how many processes to run
+-              at the same time.
+-
+-              We take the log10(number of processors) * factor
+-      """
+-      num = os.sysconf("SC_NPROCESSORS_CONF")
+-      if num == 1:
+-              return 2
+-
+-      return num
+-- 
+1.7.11.4
+
diff --git a/pakfire/patches/0002-lexer-Add-shell-commands-with-echo-123.patch b/pakfire/patches/0002-lexer-Add-shell-commands-with-echo-123.patch
new file mode 100644 (file)
index 0000000..504e332
--- /dev/null
@@ -0,0 +1,88 @@
+From 2eceee39ef4d78e77101ece088d7833f1b83fdad Mon Sep 17 00:00:00 2001
+From: Michael Tremer <michael.tremer@ipfire.org>
+Date: Tue, 2 Oct 2012 22:04:43 +0200
+Subject: [PATCH 2/4] lexer: Add shell commands with %(echo 123..).
+
+It is possible to use shell commands, just like $(...) in shell.
+It's a handy feature when you need some output of a tool
+in a variable.
+
+Every time the variable is expanded, the command is called.
+It is not ensured that the personality is the same as in
+the build environment.
+---
+ python/pakfire/packages/lexer.py | 37 ++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 36 insertions(+), 1 deletion(-)
+
+diff --git a/python/pakfire/packages/lexer.py b/python/pakfire/packages/lexer.py
+index 09a8215..af6dda0 100644
+--- a/python/pakfire/packages/lexer.py
++++ b/python/pakfire/packages/lexer.py
+@@ -6,6 +6,8 @@ import re
+ from pakfire.constants import *
+ from pakfire.i18n import _
++import pakfire.chroot
++
+ import logging
+ #log = logging.getLogger("pakfire.lexer")
+ log = logging.getLogger("pakfire")
+@@ -90,7 +92,7 @@ LEXER_UNEXPORT        = re.compile(r"^unexport\s+([A-Za-z0-9_\-]+)$")
+ LEXER_INCLUDE         = re.compile(r"^include\s+(.+)$")
+ LEXER_VARIABLE        = re.compile(r"\%\{([A-Za-z0-9_\-]+)\}")
+-LEXER_SHELL           = re.compile(r"\%\(.*\)")
++LEXER_SHELL           = re.compile(r"\%\((.*)\)")
+ LEXER_IF_IF           = re.compile(r"^if\s+(.*)\s+(==|!=)\s+(.*)\s*")
+ LEXER_IF_ELIF         = re.compile(r"^elif\s+(.*)\s*(==|!=)\s*(.*)\s*")
+@@ -204,6 +206,18 @@ class Lexer(object):
+               if s is None:
+                       return ""
++              # First run all embedded commands.
++              while s:
++                      m = re.search(LEXER_SHELL, s)
++                      if not m:
++                              break
++
++                      command = m.group(1)
++                      result = self.exec_command(command)
++
++                      s = s.replace("%%(%s)" % command, result or "")
++
++              # Then expand the variables.
+               while s:
+                       m = re.search(LEXER_VARIABLE, s)
+                       if not m:
+@@ -214,6 +228,27 @@ class Lexer(object):
+               return s
++      def exec_command(self, command):
++              # Expand all variables in the command.
++              command = self.expand_string(command)
++
++              # If the command is empty, we don't do anything.
++              if not command:
++                      return
++
++              # Do we need to chroot and change personality?
++              try:
++                      output = pakfire.chroot.do(command, shell=True, returnOutput=1, logger=log)
++
++              except Error:
++                      return
++
++              # Strip newline.
++              if output:
++                      output = output.rstrip("\n")
++
++              return output
++
+       def get_var(self, key, default=None, raw=False):
+               definitions = {}
+               definitions.update(self.root.definitions)
+-- 
+1.7.11.4
+
diff --git a/pakfire/patches/0003-macros-Add-python-variables.patch b/pakfire/patches/0003-macros-Add-python-variables.patch
new file mode 100644 (file)
index 0000000..e46d866
--- /dev/null
@@ -0,0 +1,34 @@
+From b59029f9d6c226a70f333e52db43dd62fb89dcc8 Mon Sep 17 00:00:00 2001
+From: Michael Tremer <michael.tremer@ipfire.org>
+Date: Tue, 2 Oct 2012 22:07:24 +0200
+Subject: [PATCH 3/4] macros: Add python variables.
+
+---
+ macros/python.macro | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+ create mode 100644 macros/python.macro
+
+diff --git a/macros/python.macro b/macros/python.macro
+new file mode 100644
+index 0000000..1b417f2
+--- /dev/null
++++ b/macros/python.macro
+@@ -0,0 +1,15 @@
++# A bunch of predefined things for Python.
++
++# Python 3 constants.
++python3 = /usr/bin/python3
++
++python3_sitearch = %(%{python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
++python3_sitelib  = %(%{python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
++python3_version  = %(%{python3} -c "import sys; sys.stdout.write(sys.version[:3])")
++
++# Python 2 constants.
++python = /usr/bin/python2
++
++python_sitearch = %(%{python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
++python_sitelib  = %(%{python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
++python_version  = %(%{python} -c "import sys; sys.stdout.write(sys.version[:3])")
+-- 
+1.7.11.4
+
diff --git a/pakfire/patches/0004-macros-Add-templates-for-python-packages.patch b/pakfire/patches/0004-macros-Add-templates-for-python-packages.patch
new file mode 100644 (file)
index 0000000..01e445a
--- /dev/null
@@ -0,0 +1,41 @@
+From 7ac1cb68d8dfc00d7189abb63f8af710ed276385 Mon Sep 17 00:00:00 2001
+From: Michael Tremer <michael.tremer@ipfire.org>
+Date: Tue, 2 Oct 2012 22:07:50 +0200
+Subject: [PATCH 4/4] macros: Add templates for python packages.
+
+---
+ macros/templates.macro | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/macros/templates.macro b/macros/templates.macro
+index 794619b..a2388b9 100644
+--- a/macros/templates.macro
++++ b/macros/templates.macro
+@@ -87,4 +87,24 @@ packages
+                       %{datadir}/doc
+               end
+       end
++
++      template PYTHON
++              summary = Python bindings from the %{name} package.
++              description = %{summary}
++
++              files
++                      %{python_sitearch}
++                      %{python_sitelib}
++              end
++      end
++
++      template PYTHON3
++              summary = Python 3 bindings from the %{name} package.
++              description = %{summary}
++
++              files
++                      %{python3_sitearch}
++                      %{python3_sitelib}
++              end
++      end
+ end
+-- 
+1.7.11.4
+
diff --git a/pakfire/patches/0005-Fix-caching-scriptlets.patch b/pakfire/patches/0005-Fix-caching-scriptlets.patch
new file mode 100644 (file)
index 0000000..3a60306
--- /dev/null
@@ -0,0 +1,40 @@
+From bd629777539347ab8da89616d6cd724c44c04f5c Mon Sep 17 00:00:00 2001
+From: Michael Tremer <michael.tremer@ipfire.org>
+Date: Tue, 2 Oct 2012 23:11:56 +0200
+Subject: [PATCH 5/6] Fix caching scriptlets.
+
+Fixes #10117.
+
+Scriptlets have not been executed when the package has
+not been available (i.e. had to be downloaded).
+---
+ python/pakfire/actions.py | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/python/pakfire/actions.py b/python/pakfire/actions.py
+index 9fda261..b8d0fb3 100644
+--- a/python/pakfire/actions.py
++++ b/python/pakfire/actions.py
+@@ -140,8 +140,17 @@ class ActionScript(Action):
+       script_action = None
+       def init(self):
+-              # Load the scriplet.
+-              self.scriptlet = self.pkg.get_scriptlet(self.script_action)
++              self._scriptlet = None
++
++      @property
++      def scriptlet(self):
++              """
++                      Load the scriplet.
++              """
++              if self._scriptlet is None:
++                      self._scriptlet = self.pkg.get_scriptlet(self.script_action)
++
++              return self._scriptlet
+       def get_lang(self):
+               if not self.scriptlet:
+-- 
+1.7.11.4
+
diff --git a/pakfire/patches/0006-python-Byte-compile-all-files-in-sitelib.patch b/pakfire/patches/0006-python-Byte-compile-all-files-in-sitelib.patch
new file mode 100644 (file)
index 0000000..070aa47
--- /dev/null
@@ -0,0 +1,167 @@
+From e9e430d4fd5b09327f57651726ffac1b7874ae01 Mon Sep 17 00:00:00 2001
+From: Michael Tremer <michael.tremer@ipfire.org>
+Date: Wed, 3 Oct 2012 00:45:11 +0200
+Subject: [PATCH 6/6] python: Byte-compile all files in sitelib.
+
+For files which are located elsewhere, it is required
+to call:
+  python_bytecompile <path1> <path2>... (Python 2)
+or
+  python3_bytecompile <path1> <path2>... (Python 3)
+---
+ macros/build.macro  | 12 ++++++-
+ macros/python.macro |  3 ++
+ tools/py-compile    | 90 +++++++++++++++++++++++++++++------------------------
+ 3 files changed, 64 insertions(+), 41 deletions(-)
+
+diff --git a/macros/build.macro b/macros/build.macro
+index 6987068..4e4d830 100644
+--- a/macros/build.macro
++++ b/macros/build.macro
+@@ -46,7 +46,17 @@ def MACRO_INSTALL_LOGROTATE_FILES
+ end
+ def MACRO_PYTHON_COMPILE
+-      # XXX TODO
++      if [ -x "%{python3}" ]; then
++              %{python3_bytecompile} \
++                      %{BUILDROOT}%{python3_sitearch} \
++                      %{BUILDROOT}%{python3_sitelib}
++      fi
++
++      if [ -x "%{python}" ]; then
++              %{python_bytecompile} \
++                      %{BUILDROOT}%{python_sitearch} \
++                      %{BUILDROOT}%{python_sitelib}
++      fi
+ end
+ MACRO_PERL_CLEANUP
+diff --git a/macros/python.macro b/macros/python.macro
+index 1b417f2..15c1209 100644
+--- a/macros/python.macro
++++ b/macros/python.macro
+@@ -1,7 +1,9 @@
+ # A bunch of predefined things for Python.
++python_bytecompile_script = /usr/lib/pakfire/py-compile
+ # Python 3 constants.
+ python3 = /usr/bin/python3
++python3_bytecompile = %{python_bytecompile_script} --python=%{python3}
+ python3_sitearch = %(%{python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
+ python3_sitelib  = %(%{python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
+@@ -9,6 +11,7 @@ python3_version  = %(%{python3} -c "import sys; sys.stdout.write(sys.version[:3]
+ # Python 2 constants.
+ python = /usr/bin/python2
++python_bytecompile = %{python_bytecompile_script} --python=%{python}
+ python_sitearch = %(%{python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
+ python_sitelib  = %(%{python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
+diff --git a/tools/py-compile b/tools/py-compile
+index 66c33ed..5ccd8f9 100755
+--- a/tools/py-compile
++++ b/tools/py-compile
+@@ -1,48 +1,58 @@
+ #!/bin/sh
+-PYTHON=$(which python 2>/dev/null)
++python_interpreter="python"
++paths=""
++
++while [ $# -gt 0 ]; do
++      case "${1}" in
++              --python=*)
++                      python_interpreter=${1#--python=}
++                      ;;
++              *)
++                      paths="${paths} ${1}"
++                      ;;
++      esac
++      shift
++done
+-if [ -z "${PYTHON}" ]; then
+-      # Python is not present. Fail silently.
+-      exit 0
++if [ -z "${paths}" ]; then
++      echo >&2 "No path specified!"
++      exit 1
+ fi
+-files=""
+-for i in $*; do
+-      if [ -e ${i}c ] && [ -e ${i}o ]; then
+-              continue # all files we want are already there
+-      fi
+-      files="$files $i"
+-done
++if [ "${python_interpreter:0:1}" != "/" ]; then
++      python_interpreter=$(which ${python_interpreter} 2>/dev/null)
++fi
+-if [ -z "${files}" ]; then
+-      # No files need to be proceeded.
+-      exit 0
++if [ ! -x "${python_interpreter}" ]; then
++      echo >&2 "Python interpreter is not executable: ${python_interpreter}"
++      exit 1
+ fi
+-$PYTHON -c "
+-import sys, os, string, py_compile
+-
+-files = '''$files'''
+-print 'Byte-compiling python modules...'
+-for file in string.split(files):
+-    if not os.path.exists(file) or not (len(file) >= 3 and file[-3:] == '.py'):
+-        continue
+-    print file,
+-    sys.stdout.flush()
+-    py_compile.compile(file)
+-print" || exit $?
+-
+-# this will fail for python < 1.5, but that doesn't matter ...
+-$PYTHON -O -c "
+-import sys, os, string, py_compile
+-
+-files = '''$files'''
+-print 'Byte-compiling python modules (optimised versions) ...'
+-for file in string.split(files):
+-    if not os.path.exists(file) or not (len(file) >= 3 and file[-3:] == '.py'):
+-        continue
+-    print file,
+-    sys.stdout.flush()
+-    py_compile.compile(file)
+-print" 2>/dev/null || :
++tempfile=$(mktemp)
++trap "rm -f ${tempfile}" EXIT
++
++cat > ${tempfile} <<EOF
++import py_compile
++import sys
++
++for file in sys.argv[1:]:
++      py_compile.compile(file, doraise=0)
++EOF
++
++filelist=$(find ${paths} -type f -a -name "*.py")
++
++# Compile with optimization.
++${python_interpreter} -O ${tempfile} ${filelist}
++
++# Compile without optimization.
++${python_interpreter} ${tempfile} ${filelist}
++
++# Hardlink identical files.
++for pyc in $(find ${paths} -type f -a -name "*.pyc"); do
++      pyo="${pyc/.pyc/.pyo}"
++
++      if cmp -s "${pyc}" "${pyo}"; then
++              ln -f "${pyc}" "${pyo}"
++      fi
++done
+-- 
+1.7.11.4
+
index ba16ffb0f7b7e6e720c11b00451b31c9792224ca..be1409dd56eda1fb0b4b60324a5dbe1dea49eff2 100644 (file)
@@ -4,9 +4,9 @@
 ###############################################################################
 
 name       = pango
-major     = 1.29
-version    = %{major}.5
-release    = 2
+major     = 1.31
+version    = %{major}.0
+release    = 1
 
 groups     = System/Libraries
 url        = http://www.pango.org/
@@ -14,7 +14,7 @@ license    = LGPLv2+
 summary    = System for layout and rendering of internationalized text.
 
 description
-       Pango is a library for laying out and rendering of text, with an \
+       Pango is a library for laying out and rendering of text, with an
        emphasis on internationalization.
 end
 
@@ -29,6 +29,7 @@ build
                gcc-c++
                glib2-devel
                glibc-devel
+               harfbuzz-devel
                libXft-devel
                perl
                pkg-config
@@ -40,7 +41,6 @@ end
 
 packages
        package %{name}
-       end
 
        package %{name}-devel
                template DEVEL
index 1dfa92770a48c29e8885e5004fc9bdf0ea87f914..48b6687f74baeaa8723b3d53414a9f8a06587257 100644 (file)
@@ -4,8 +4,8 @@
 ###############################################################################
 
 name       = patch
-version    = 2.6.1
-release    = 3
+version    = 2.7
+release    = 1
 
 groups     = Development/Tools
 url        = http://www.gnu.org/software/patch/patch.html
@@ -20,10 +20,12 @@ description
        diff file to add the changes to their original file.
 end
 
-source_dl  =
+source_dl  = ftp://ftp.gnu.org/gnu/patch/
+sources    = %{thisapp}.tar.xz
 
 build
        requires
+               attr-devel
                ed
                libselinux-devel
                pkg-config
diff --git a/patch/patches/patch-2.5.4-sigsegv.patch b/patch/patches/patch-2.5.4-sigsegv.patch
deleted file mode 100644 (file)
index c018153..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-diff -up patch-2.6/src/inp.c.sigsegv patch-2.6/src/inp.c
---- patch-2.6/src/inp.c.sigsegv        2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6/src/inp.c        2009-11-16 09:31:52.305022200 +0000
-@@ -77,6 +77,14 @@ re_input (void)
-     }
- }
-+void
-+reset_scan_input_vars()
-+{
-+ using_plan_a = 1;
-+ i_buffer = NULL;
-+ i_ptr = NULL;
-+}
-+
- /* Construct the line index, somehow or other. */
- void
-diff -up patch-2.6/src/inp.h.sigsegv patch-2.6/src/inp.h
---- patch-2.6/src/inp.h.sigsegv        2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6/src/inp.h        2009-11-16 09:32:24.440021838 +0000
-@@ -24,4 +24,5 @@ XTERN LINENUM input_lines;           /* how long 
- char const *ifetch (LINENUM, bool, size_t *);
- void get_input_file (char const *, char const *);
- void re_input (void);
-+void reset_scan_input_vars (void);
- void scan_input (char *);
-diff -up patch-2.6/src/patch.c.sigsegv patch-2.6/src/patch.c
---- patch-2.6/src/patch.c.sigsegv      2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6/src/patch.c      2009-11-16 09:31:52.306021801 +0000
-@@ -210,7 +210,10 @@ main (int argc, char **argv)
-       /* find out where all the lines are */
-       if (!skip_rest_of_patch)
--          scan_input (inname);
-+          scan_input (inname);
-+        else
-+          reset_scan_input_vars ();
-+        
-       /* from here on, open no standard i/o files, because malloc */
-       /* might misfire and we can't catch it easily */
diff --git a/patch/patches/patch-2.6.1-CVE-2010-4651.patch b/patch/patches/patch-2.6.1-CVE-2010-4651.patch
deleted file mode 100644 (file)
index 3f2de6a..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-diff -up patch-2.6.1/Makefile.in.CVE-2010-4651 patch-2.6.1/Makefile.in
---- patch-2.6.1/Makefile.in.CVE-2010-4651      2009-12-30 12:56:30.000000000 +0000
-+++ patch-2.6.1/Makefile.in    2011-02-10 12:29:32.926361705 +0000
-@@ -192,6 +192,7 @@ installcheck::
- TESTS = \
-       tests/asymmetric-hunks \
-       tests/backup-prefix-suffix \
-+      tests/bad-filenames \
-       tests/corrupt-reject-files \
-       tests/create-delete \
-       tests/crlf-handling \
-diff -up patch-2.6.1/src/common.h.CVE-2010-4651 patch-2.6.1/src/common.h
---- patch-2.6.1/src/common.h.CVE-2010-4651     2011-02-10 12:30:29.142797627 +0000
-+++ patch-2.6.1/src/common.h   2011-02-10 12:30:33.566989729 +0000
-@@ -169,6 +169,7 @@ XTERN char *revision;                      /* prerequisite 
- #endif
- void fatal_exit (int) __attribute__ ((noreturn));
-+void validate_target_name (char const *n);
- #include <errno.h>
- #if !STDC_HEADERS && !defined errno
-diff -up patch-2.6.1/src/patch.c.CVE-2010-4651 patch-2.6.1/src/patch.c
---- patch-2.6.1/src/patch.c.CVE-2010-4651      2011-02-10 12:30:20.721432124 +0000
-+++ patch-2.6.1/src/patch.c    2011-02-10 12:30:33.567989772 +0000
-@@ -34,6 +34,7 @@
- #include <util.h>
- #include <version.h>
- #include <xalloc.h>
-+#include <dirname.h>
- /* procedures */
-@@ -916,6 +917,26 @@ numeric_string (char const *string,
-   return value;
- }
-+void
-+validate_target_name (char const *n)
-+{
-+  char const *p = n;
-+  if (explicit_inname)
-+    return;
-+  if (IS_ABSOLUTE_FILE_NAME (p))
-+    fatal ("rejecting absolute target file name: %s", quotearg (p));
-+  while (*p)
-+    {
-+      if (*p == '.' && *++p == '.' && ( ! *++p || ISSLASH (*p)))
-+      fatal ("rejecting target file name with \"..\" component: %s",
-+             quotearg (n));
-+      while (*p && ! ISSLASH (*p))
-+      p++;
-+      while (ISSLASH (*p))
-+      p++;
-+    }
-+}
-+
- /* Attempt to find the right place to apply this hunk of patch. */
- static LINENUM
-diff -up patch-2.6.1/src/pch.c.CVE-2010-4651 patch-2.6.1/src/pch.c
---- patch-2.6.1/src/pch.c.CVE-2010-4651        2009-12-30 12:56:30.000000000 +0000
-+++ patch-2.6.1/src/pch.c      2011-02-10 12:30:33.573990033 +0000
-@@ -3,7 +3,7 @@
- /* Copyright (C) 1986, 1987, 1988 Larry Wall
-    Copyright (C) 1990, 1991, 1992, 1993, 1997, 1998, 1999, 2000, 2001,
--   2002, 2003, 2006, 2009 Free Software Foundation, Inc.
-+   2002, 2003, 2006, 2009, 2011 Free Software Foundation, Inc.
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-@@ -199,6 +199,8 @@ maybe_reverse (char const *name, bool no
- {
-   bool looks_reversed = (! is_empty) < p_says_nonexistent[reverse ^ is_empty];
-+  validate_target_name (name);
-+
-   if (looks_reversed)
-     reverse ^=
-       ok_to_reverse ("The next patch%s would %s the file %s,\nwhich %s!",
-@@ -725,6 +727,7 @@ intuit_diff_type (bool need_header)
-       inerrno = stat_errno[i];
-       invc = version_controlled[i];
-       instat = st[i];
-+      validate_target_name (inname);
-       }
-     return retval;
-diff -up patch-2.6.1/tests/bad-filenames.CVE-2010-4651 patch-2.6.1/tests/bad-filenames
---- patch-2.6.1/tests/bad-filenames.CVE-2010-4651      2011-02-10 12:29:32.931361921 +0000
-+++ patch-2.6.1/tests/bad-filenames    2011-02-10 12:30:33.576990163 +0000
-@@ -0,0 +1,71 @@
-+# Copyright (C) 2011 Free Software Foundation, Inc.
-+#
-+# Copying and distribution of this file, with or without modification,
-+# in any medium, are permitted without royalty provided the copyright
-+# notice and this notice are preserved.
-+
-+. $srcdir/test-lib.sh
-+
-+use_local_patch
-+use_tmpdir
-+
-+# ================================================================
-+
-+emit_2()
-+{
-+cat <<EOF
-+--- $1
-++++ $2
-+@@ -0,0 +1 @@
-++x
-+EOF
-+}
-+
-+emit_patch() { emit_2 /dev/null "$1"; }
-+
-+# Ensure that patch rejects an output file name that is absolute
-+# or that contains a ".." component.
-+
-+check 'emit_patch /absolute/path | patch -p0; echo status: $?' <<EOF
-+$PATCH: **** rejecting absolute target file name: /absolute/path
-+status: 2
-+EOF
-+
-+check 'emit_patch a/../z | patch -p0; echo status: $?' <<EOF
-+$PATCH: **** rejecting target file name with ".." component: a/../z
-+status: 2
-+EOF
-+
-+check 'emit_patch a/../z | patch -p1; echo status: $?' <<EOF
-+$PATCH: **** rejecting target file name with ".." component: ../z
-+status: 2
-+EOF
-+
-+check 'emit_patch a/.. | patch -p0; echo status: $?' <<EOF
-+$PATCH: **** rejecting target file name with ".." component: a/..
-+status: 2
-+EOF
-+
-+check 'emit_patch ../z | patch -p0; echo status: $?' <<EOF
-+$PATCH: **** rejecting target file name with ".." component: ../z
-+status: 2
-+EOF
-+
-+check 'emit_2 /abs/path target | patch -p0; echo status: $?' <<EOF
-+patching file target
-+status: 0
-+EOF
-+
-+echo x > target
-+check 'emit_2 /abs/path target | patch -R -p0; echo status: $?' <<EOF
-+patching file target
-+status: 0
-+EOF
-+
-+# Do not validate any file name from the input when the target
-+# is specified on the command line:
-+touch abs
-+check 'emit_patch /absolute/path | patch `pwd`/abs; echo status: $?' <<EOF
-+patching file `pwd`/abs
-+status: 0
-+EOF
diff --git a/patch/patches/patch-2.6.1-backup-if-mismatch.patch b/patch/patches/patch-2.6.1-backup-if-mismatch.patch
deleted file mode 100644 (file)
index 0ad0986..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-diff -up patch-2.6.1/src/patch.c.backup-if-mismatch patch-2.6.1/src/patch.c
---- patch-2.6.1/src/patch.c.backup-if-mismatch 2011-02-16 16:43:54.575850844 +0000
-+++ patch-2.6.1/src/patch.c    2011-02-16 16:44:56.907995789 +0000
-@@ -106,6 +106,7 @@ main (int argc, char **argv)
-     char numbuf[LINENUM_LENGTH_BOUND + 1];
-     bool written_to_rejname = false;
-     bool apply_empty_patch = false;
-+    bool posixly_correct_set;
-     exit_failure = 2;
-     program_name = argv[0];
-@@ -125,7 +126,7 @@ main (int argc, char **argv)
-                        i < 0 ? shell_quoting_style : (enum quoting_style) i);
-     }
--    posixly_correct = getenv ("POSIXLY_CORRECT") != 0;
-+    posixly_correct_set = posixly_correct = getenv ("POSIXLY_CORRECT") != 0;
-     backup_if_mismatch = ! posixly_correct;
-     patch_get = ((val = getenv ("PATCH_GET"))
-                ? numeric_string (val, true, "PATCH_GET value")
-@@ -151,6 +152,10 @@ main (int argc, char **argv)
-     Argv = argv;
-     get_some_switches();
-+    /* Let --posix cause --no-backup-if-mismatch. */
-+    if (! posixly_correct_set && posixly_correct && backup_if_mismatch)
-+      backup_if_mismatch = false;
-+
-     if (make_backups | backup_if_mismatch)
-       backup_type = get_version (version_control_context, version_control);
diff --git a/patch/patches/patch-2.6.1-get-arg.patch b/patch/patches/patch-2.6.1-get-arg.patch
deleted file mode 100644 (file)
index 45f3bc8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up patch-2.6.1/src/patch.c.get-arg patch-2.6.1/src/patch.c
---- patch-2.6.1/src/patch.c.get-arg    2010-07-27 18:05:26.217150510 +0100
-+++ patch-2.6.1/src/patch.c    2010-07-27 18:05:47.464150892 +0100
-@@ -558,7 +558,7 @@ static struct option const longopts[] =
-   {"remove-empty-files", no_argument, NULL, 'E'},
-   {"force", no_argument, NULL, 'f'},
-   {"fuzz", required_argument, NULL, 'F'},
--  {"get", no_argument, NULL, 'g'},
-+  {"get", required_argument, NULL, 'g'},
-   {"input", required_argument, NULL, 'i'},
-   {"ignore-whitespace", no_argument, NULL, 'l'},
- #ifdef ENABLE_MERGE
diff --git a/patch/patches/patch-selinux.patch b/patch/patches/patch-selinux.patch
deleted file mode 100644 (file)
index 904539c..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-diff -up patch-2.6.1/Makefile.in.selinux patch-2.6.1/Makefile.in
---- patch-2.6.1/Makefile.in.selinux    2011-02-08 11:29:34.590271489 +0000
-+++ patch-2.6.1/Makefile.in    2011-02-08 11:29:34.602271607 +0000
-@@ -40,7 +40,7 @@ EXEEXT = @EXEEXT@
- LDFLAGS = @LDFLAGS@
- LIBOBJDIR = gl/lib/
- LIBOBJS = @LIBOBJS@ ${LIBOBJDIR}full-write$U.o
--LIBS = @LIBS@
-+LIBS = @LIBS@ -lselinux
- OBJEXT = @OBJEXT@
- PACKAGE_NAME = @PACKAGE_NAME@
- PACKAGE_VERSION = @PACKAGE_VERSION@
-diff -up patch-2.6.1/src/common.h.selinux patch-2.6.1/src/common.h
---- patch-2.6.1/src/common.h.selinux   2009-12-30 12:56:30.000000000 +0000
-+++ patch-2.6.1/src/common.h   2011-02-08 11:29:34.602271607 +0000
-@@ -32,6 +32,8 @@
- #include <sys/types.h>
- #include <time.h>
-+#include <selinux/selinux.h>
-+
- #include <sys/stat.h>
- #if ! defined S_ISDIR && defined S_IFDIR
- # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-@@ -118,6 +120,7 @@ XTERN char *outfile;
- XTERN int inerrno;
- XTERN int invc;
- XTERN struct stat instat;
-+XTERN security_context_t incontext;
- XTERN bool dry_run;
- XTERN bool posixly_correct;
-diff -up patch-2.6.1/src/inp.c.selinux patch-2.6.1/src/inp.c
---- patch-2.6.1/src/inp.c.selinux      2011-02-08 11:29:34.576271352 +0000
-+++ patch-2.6.1/src/inp.c      2011-02-08 11:29:34.604271627 +0000
-@@ -152,8 +152,18 @@ get_input_file (char const *filename, ch
-     char *diffbuf;
-     char *getbuf;
--    if (inerrno == -1)
--      inerrno = stat (filename, &instat) == 0 ? 0 : errno;
-+    inerrno = stat (filename, &instat) == 0 ? 0 : errno;
-+    if (inerrno == 0)
-+      {
-+        inerrno = getfilecon (inname, &incontext) == -1 ? errno : 0;
-+        if (inerrno == ENODATA || inerrno == ENOTSUP)
-+          {
-+      inerrno = 0;
-+      incontext = NULL;
-+          }
-+      }
-+    else
-+      incontext = NULL;
-     /* Perhaps look for RCS or SCCS versions.  */
-     if (patch_get
-@@ -197,7 +207,7 @@ get_input_file (char const *filename, ch
-           }
-           if (cs && version_get (filename, cs, ! inerrno, elsewhere, getbuf,
--                                 &instat))
-+                                 &instat, &incontext))
-             inerrno = 0;
-           free (getbuf);
-@@ -209,6 +219,7 @@ get_input_file (char const *filename, ch
-       {
-       instat.st_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
-       instat.st_size = 0;
-+      incontext = NULL;
-       }
-     else if (! S_ISREG (instat.st_mode))
-       fatal ("File %s is not a regular file -- can't patch",
-diff -up patch-2.6.1/src/patch.c.selinux patch-2.6.1/src/patch.c
---- patch-2.6.1/src/patch.c.selinux    2011-02-08 11:29:34.586271450 +0000
-+++ patch-2.6.1/src/patch.c    2011-02-08 11:29:34.606271646 +0000
-@@ -421,6 +421,21 @@ main (int argc, char **argv)
-                             /* Fails if we are not in group instat.st_gid.  */
-                             chown (outname, -1, instat.st_gid);
-                           }
-+
-+                        if (! inerrno && incontext)
-+                          {
-+                            security_context_t outcontext;
-+                            if (getfilecon (outname, &outcontext) != -1 &&
-+                                outcontext &&
-+                                strcmp(outcontext, incontext) && 
-+                                setfilecon (outname, incontext) != 0)
-+                              {
-+                                if (errno != ENOTSUP && errno != EPERM)
-+                                  pfatal ("Can't set security context "
-+                                          "on file %s", quotearg (outname));
-+                              }
-+                          }
-+
-                         /* FIXME: There may be other attributes to preserve.  */
-                       }
-                   }
-diff -up patch-2.6.1/src/pch.c.selinux patch-2.6.1/src/pch.c
---- patch-2.6.1/src/pch.c.selinux      2011-02-08 11:29:34.591271499 +0000
-+++ patch-2.6.1/src/pch.c      2011-02-08 11:30:08.810621570 +0000
-@@ -307,7 +307,12 @@ there_is_another_patch (bool need_header
-           inname[t - buf - 1] = 0;
-           if (stat (inname, &instat) == 0)
-             {
--              inerrno = 0;
-+              inerrno = getfilecon (inname, &incontext) == -1 ? errno : 0;
-+              if (inerrno == ENODATA || inerrno == ENOTSUP)
-+                {
-+                  inerrno = 0;
-+                  incontext = NULL;
-+                }
-               invc = -1;
-             }
-           else
-@@ -681,7 +686,7 @@ intuit_diff_type (bool need_header)
-                         if (cs)
-                           {
-                             if (version_get (p_name[i], cs, false, readonly,
--                                             getbuf, &st[i]))
-+                                             getbuf, &st[i], NULL))
-                               stat_errno[i] = 0;
-                             else
-                               version_controlled[i] = 0;
-@@ -746,6 +751,7 @@ intuit_diff_type (bool need_header)
-       invc = version_controlled[i];
-       instat = st[i];
-       validate_target_name (inname);
-+      getfilecon (inname, &incontext);
-       }
-     return retval;
-diff -up patch-2.6.1/src/util.c.selinux patch-2.6.1/src/util.c
---- patch-2.6.1/src/util.c.selinux     2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6.1/src/util.c     2011-02-08 11:29:34.613271715 +0000
-@@ -574,7 +574,8 @@ version_controller (char const *filename
-    Return true if successful.  */
- bool
- version_get (char const *filename, char const *cs, bool exists, bool readonly,
--           char const *getbuf, struct stat *filestat)
-+           char const *getbuf, struct stat *filestat,
-+           security_context_t *filecontext)
- {
-   if (patch_get < 0)
-     {
-@@ -599,6 +600,13 @@ version_get (char const *filename, char 
-       fatal ("Can't get file %s from %s", quotearg (filename), cs);
-       if (stat (filename, filestat) != 0)
-       pfatal ("%s", quotearg (filename));
-+      if (filecontext && getfilecon (filename, filecontext) == -1)
-+      {
-+        if (errno == ENODATA || errno == ENOTSUP)
-+          *filecontext = NULL;
-+        else
-+          pfatal ("%s", quotearg (filename));
-+      }
-     }
-   return 1;
-diff -up patch-2.6.1/src/util.h.selinux patch-2.6.1/src/util.h
---- patch-2.6.1/src/util.h.selinux     2009-11-02 19:09:57.000000000 +0000
-+++ patch-2.6.1/src/util.h     2011-02-08 11:29:34.614271726 +0000
-@@ -51,7 +51,7 @@ char *fetchname (char *, int, char **, t
- char *savebuf (char const *, size_t);
- char *savestr (char const *);
- char const *version_controller (char const *, bool, struct stat const *, char **, char **);
--bool version_get (char const *, char const *, bool, bool, char const *, struct stat *);
-+bool version_get (char const *, char const *, bool, bool, char const *, struct stat *, security_context_t *);
- int create_file (char const *, int, mode_t, bool);
- int systemic (char const *);
- char *format_linenum (char[LINENUM_LENGTH_BOUND + 1], LINENUM);
diff --git a/pdns/pdns.conf b/pdns/pdns.conf
new file mode 100644 (file)
index 0000000..82b67c1
--- /dev/null
@@ -0,0 +1,39 @@
+###############################################################################
+##                                                                             #
+## IPFire.org - A linux based firewall                                         #
+## Copyright (C) 2012  IPFire Development Team                                 #
+##                                                                             #
+## This program is free software: you can redistribute it and/or modify        #
+## it under the terms of the GNU General Public License as published by        #
+## the Free Software Foundation, either version 3 of the License, or           #
+## (at your option) any later version.                                         #
+##                                                                             #
+## This program is distributed in the hope that it will be useful,             #
+## but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+## GNU General Public License for more details.                                #
+##                                                                             #
+## You should have received a copy of the GNU General Public License           #
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+##                                                                             #
+################################################################################
+#
+## These file contains the default configuration for the PowerDNS service.
+#
+# An example configuration file with all provided options can be found on 
+# /etc/pdns/pdns.conf-dist.
+#
+daemon=no
+socket-dir=/run/pdns/
+
+# Run powerdns as the following user and group.
+setuid=pdns
+setgid=pdns
+
+# Only use one of them. Enable gsqlite3-dnssec if you are using DNS Sec.
+launch=gsqlite3
+#launch=gsqlite3-dnssec
+gsqlite3-database=/var/lib/pdns/pdns.db
+
+# Enable if you also have installed the pdns-recursor.
+#recursor=127.0.0.1:54
index bd5e1e7ca5ce03b730ca74503b6fee984df8e68e..939e980d32856c3b5b77b75b3c1ba46ea8f178ab 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = pdns
 version    = 3.1
-release    = 1
+release    = 2
 
 groups     = Networking/DNS
 url        = http://powerdns.com/
@@ -27,26 +27,51 @@ build
                chrpath
                gcc-c++
                lua-devel
-               openldap-devel
+               shadow-utils
                sqlite-devel
                zlib-devel
        end
 
-       CPPFLAGS = -DLDAP_DEPRECATED
-
+       # No paralilelism build.
        PARALLELISMFLAGS =
 
        configure_options += \
-               --sysconfdir=/etc/pdns \
+               --sysconfdir=%{sysconfdir}/pdns \
                --libdir=%{libdir}/powerdns \
                --with-modules="" \
-               --with-dynmodules="pipe geo ldap gsqlite3" \
+               --with-dynmodules="pipe geo gsqlite3" \
                --with-lua \
                --disable-static
 
+       prepare_cmds
+               %{create_user}
+       end
+
        install_cmds
+               # Create directories for pdns sqlite db.
+               mkdir -p %{BUILDROOT}%{datadir}/pdns/
+               mkdir -p %{BUILDROOT}%{sharedstatedir}/pdns/
+
+               # Install shema for sqlite database.
+               install -m 0644 %{DIR_SOURCE}/pdns.table \
+                       %{BUILDROOT}%{datadir}/pdns/pdns.table
+
+               # Install default configuration.
+               install -m 0644 %{DIR_SOURCE}/pdns.conf \
+                       %{BUILDROOT}%{sysconfdir}/pdns/pdns.conf
+
+               # Create empty database file.
+               touch %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
+
+               # Fix permissions and ownership from database.
+               chown -R pdns:pdns %{BUILDROOT}%{sharedstatedir}/pdns
+               chmod 660 %{BUILDROOT}%{sharedstatedir}/pdns/pdns.db
+
+               # Remove unneded binaries.
+               rm -vf %{BUILDROOT}%{bindir}/zone2ldap
+
+               # Remove rpath from binaries and backend libs.
                chrpath --delete %{BUILDROOT}/usr/bin/pdns_control
-               chrpath --delete %{BUILDROOT}/usr/bin/zone2ldap
                chrpath --delete %{BUILDROOT}/usr/bin/zone2sql
                chrpath --delete %{BUILDROOT}/usr/sbin/pdns_server
                chrpath --delete %{BUILDROOT}%{libdir}/powerdns/*.so
@@ -55,8 +80,55 @@ build
        end
 end
 
+create_user
+       getent group pdns >/dev/null || groupadd -r pdns
+       getent passwd pdns >/dev/null || \
+       useradd -r -g pdns -d %{sharedstatedir}/pdns -s /sbin/nologin \
+               -c "PowerDNS user" pdns
+end
+
 packages
        package %{name}
+               prerequires
+                       coreutils
+                       shadow-utils
+                       sqlite
+               end
+               configfiles
+                       /etc/pdns/pdns.conf
+               end
+
+               script prein
+                       %{create_user}
+               end
+
+               script postin
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+
+                       # Check if DB allready exists. Create pdns sqlite database if not.
+                       if [ ! -s "%{sharedstatedir}/pdns/pdns.db" ]; then
+                               sqlite3 %{sharedstatedir}/pdns/pdns.db < %{datadir}/pdns/pdns.table
+                       fi
+               end
+
+               script preun
+                       systemctl --no-reload disable pdns.service >/dev/null 2>&1 || :
+                       systemctl stop pdns.service >/dev/null 2>&1 || :
+
+                       # Backup existing database.
+                       mv %{sharedstatedir}/pdns/pdns.db{,.bak}
+               end
+
+               script postun
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script postup
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+                       systemctl try-restart pdns.service >/dev/null 2>&1 || :
+               end
+       end
 
        package %{name}-debuginfo
                template DEBUGINFO
diff --git a/pdns/pdns.table b/pdns/pdns.table
new file mode 100644 (file)
index 0000000..62fcefa
--- /dev/null
@@ -0,0 +1,63 @@
+create table domains (
+  id                INTEGER PRIMARY KEY,
+  name              VARCHAR(255) NOT NULL COLLATE NOCASE,
+  master            VARCHAR(128) DEFAULT NULL,
+  last_check        INTEGER DEFAULT NULL,
+  type              VARCHAR(6) NOT NULL,
+  notified_serial   INTEGER DEFAULT NULL, 
+  account           VARCHAR(40) DEFAULT NULL
+);
+
+CREATE UNIQUE INDEX name_index ON domains(name);
+
+CREATE TABLE records (
+  id              INTEGER PRIMARY KEY,
+  domain_id       INTEGER DEFAULT NULL,
+  name            VARCHAR(255) DEFAULT NULL, 
+  type            VARCHAR(10) DEFAULT NULL,
+  content         VARCHAR(65535) DEFAULT NULL,
+  ttl             INTEGER DEFAULT NULL,
+  prio            INTEGER DEFAULT NULL,
+  change_date     INTEGER DEFAULT NULL,
+  ordername       VARCHAR(255),
+  auth            BOOL
+);
+              
+CREATE INDEX rec_name_index ON records(name);
+CREATE INDEX nametype_index ON records(name,type);
+CREATE INDEX domain_id ON records(domain_id);
+CREATE INDEX orderindex ON records(ordername);
+
+create table supermasters (
+  ip          VARCHAR(25) NOT NULL, 
+  nameserver  VARCHAR(255) NOT NULL COLLATE NOCASE, 
+  account     VARCHAR(40) DEFAULT NULL
+);
+
+create table domainmetadata (
+ id             INTEGER PRIMARY KEY,
+ domain_id       INT NOT NULL,
+ kind           VARCHAR(16) COLLATE NOCASE,
+ content       TEXT
+);
+
+create index domainmetaidindex on domainmetadata(domain_id);
+
+create table cryptokeys (
+ id            INTEGER PRIMARY KEY,
+ domain_id      INT NOT NULL,
+ flags         INT NOT NULL,
+ active                BOOL,
+ content       TEXT
+);              
+
+create index domainidindex on cryptokeys(domain_id);           
+
+create table tsigkeys (
+ id            INTEGER PRIMARY KEY,
+ name          VARCHAR(255) COLLATE NOCASE,
+ algorithm     VARCHAR(50) COLLATE NOCASE,
+ secret                VARCHAR(255)
+);
+
+create unique index namealgoindex on tsigkeys(name, algorithm);
diff --git a/pdns/pdns.tmpfiles b/pdns/pdns.tmpfiles
new file mode 100644 (file)
index 0000000..b7e1b20
--- /dev/null
@@ -0,0 +1 @@
+d /run/pdns 0755 pdns pdns -
diff --git a/pkg-config/patches/pkg-config-0.25-autoconf-1.patch b/pkg-config/patches/pkg-config-0.25-autoconf-1.patch
deleted file mode 100644 (file)
index 8df41fc..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- pkg-config-0.25/pkg.m4.~1~ 2009-12-06 21:39:02.000000000 +0100
-+++ pkg-config-0.25/pkg.m4 2010-07-07 10:07:12.000000000 +0200
-@@ -135,7 +135,7 @@ 258871_PKG_ERRORS
- Consider adjusting the PKG_CONFIG_PATH environment variable if you
- installed software in a non-standard prefix.
-
--_PKG_TEXT])dnl
-+_PKG_TEXT])
-         ])
- elif test  = untried; then
-       AC_MSG_RESULT([no])
-@@ -146,7 +146,7 @@ path to pkg-config.
-
- _PKG_TEXT
-
--To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
-+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
-         ])
- else
-  []_CFLAGS=[][]_CFLAGS   
index bc36a26c1b57ba5cdcbd4fef7d429337307a0985..cc3a3f5e21ae0ffdbb957c23d8a9ea8f50f644e9 100644 (file)
@@ -4,8 +4,8 @@
 ###############################################################################
 
 name       = pkg-config
-version    = 0.25
-release    = 2
+version    = 0.27.1
+release    = 1
 
 groups     = Development/Tools
 url        = http://pkg-config.freedesktop.org/
@@ -18,17 +18,19 @@ description
        compiler and linker flags.
 end
 
-source_dl  =
+source_dl  = http://pkgconfig.freedesktop.org/releases/
+sources    = %{thisapp}.tar.gz
 
 build
        requires
                m4
-               popt-devel
+               glib2-devel
                sed
        end
 
        configure_options += \
-               --with-installed-popt
+               --disable-shared \
+               --with-installed-glib
 
        test
                make check
diff --git a/python3/patches/00003-remove-mimeaudio-tests.patch b/python3/patches/00003-remove-mimeaudio-tests.patch
new file mode 100644 (file)
index 0000000..8341363
--- /dev/null
@@ -0,0 +1,51 @@
+diff -up Python-3.3.0rc1/Lib/test/test_email/test_email.py.remove-mimeaudio-tests Python-3.3.0rc1/Lib/test/test_email/test_email.py
+--- Python-3.3.0rc1/Lib/test/test_email/test_email.py.remove-mimeaudio-tests   2012-08-25 15:22:10.000000000 -0400
++++ Python-3.3.0rc1/Lib/test/test_email/test_email.py  2012-08-27 11:00:11.936964586 -0400
+@@ -1321,47 +1321,6 @@ Blah blah blah
+         self.assertEqual(b.getvalue(), source + b'>From R\xc3\xb6lli\n')
+-# Test the basic MIMEAudio class
+-class TestMIMEAudio(unittest.TestCase):
+-    def setUp(self):
+-        with openfile('audiotest.au', 'rb') as fp:
+-            self._audiodata = fp.read()
+-        self._au = MIMEAudio(self._audiodata)
+-
+-    def test_guess_minor_type(self):
+-        self.assertEqual(self._au.get_content_type(), 'audio/basic')
+-
+-    def test_encoding(self):
+-        payload = self._au.get_payload()
+-        self.assertEqual(base64.decodebytes(bytes(payload, 'ascii')),
+-                self._audiodata)
+-
+-    def test_checkSetMinor(self):
+-        au = MIMEAudio(self._audiodata, 'fish')
+-        self.assertEqual(au.get_content_type(), 'audio/fish')
+-
+-    def test_add_header(self):
+-        eq = self.assertEqual
+-        unless = self.assertTrue
+-        self._au.add_header('Content-Disposition', 'attachment',
+-                            filename='audiotest.au')
+-        eq(self._au['content-disposition'],
+-           'attachment; filename="audiotest.au"')
+-        eq(self._au.get_params(header='content-disposition'),
+-           [('attachment', ''), ('filename', 'audiotest.au')])
+-        eq(self._au.get_param('filename', header='content-disposition'),
+-           'audiotest.au')
+-        missing = []
+-        eq(self._au.get_param('attachment', header='content-disposition'), '')
+-        unless(self._au.get_param('foo', failobj=missing,
+-                                  header='content-disposition') is missing)
+-        # Try some missing stuff
+-        unless(self._au.get_param('foobar', missing) is missing)
+-        unless(self._au.get_param('attachment', missing,
+-                                  header='foobar') is missing)
+-
+-
+-
+ # Test the basic MIMEImage class
+ class TestMIMEImage(unittest.TestCase):
+     def setUp(self):
diff --git a/python3/patches/00104-lib64-fix-for-test_install.patch b/python3/patches/00104-lib64-fix-for-test_install.patch
new file mode 100644 (file)
index 0000000..7852bf6
--- /dev/null
@@ -0,0 +1,13 @@
+--- Python-2.7.2/Lib/distutils/tests/test_install.py.lib64     2011-09-08 17:51:57.851405376 -0400
++++ Python-2.7.2/Lib/distutils/tests/test_install.py   2011-09-08 18:40:46.754205096 -0400
+@@ -41,8 +41,9 @@ class InstallTestCase(support.TempdirMan
+             self.assertEqual(got, expected)
+         libdir = os.path.join(destination, "lib", "python")
++        platlibdir = os.path.join(destination, "lib64", "python")
+         check_path(cmd.install_lib, libdir)
+-        check_path(cmd.install_platlib, libdir)
++        check_path(cmd.install_platlib, platlibdir)
+         check_path(cmd.install_purelib, libdir)
+         check_path(cmd.install_headers,
+                    os.path.join(destination, "include", "python", "foopkg"))
diff --git a/python3/patches/00111-no-static-lib.patch b/python3/patches/00111-no-static-lib.patch
new file mode 100644 (file)
index 0000000..91b24b8
--- /dev/null
@@ -0,0 +1,59 @@
+diff -up cpython-59223da36dec/Makefile.pre.in.no-static-lib cpython-59223da36dec/Makefile.pre.in
+--- cpython-59223da36dec/Makefile.pre.in.no-static-lib 2012-08-07 16:43:43.296466422 -0400
++++ cpython-59223da36dec/Makefile.pre.in       2012-08-07 16:44:13.299464371 -0400
+@@ -464,7 +464,7 @@ coverage:
+ # Build the interpreter
+-$(BUILDPYTHON):       Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
++$(BUILDPYTHON):       Modules/python.o $(LDLIBRARY) $(PY3LIBRARY)
+       $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+ platform: $(BUILDPYTHON) $(SYSCONFIGDATA)
+@@ -480,18 +480,6 @@ sharedmods: $(BUILDPYTHON) $(SYSCONFIGDA
+       $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+               $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
+-# Build static library
+-# avoid long command lines, same as LIBRARY_OBJS
+-$(LIBRARY): $(LIBRARY_OBJS)
+-      -rm -f $@
+-      $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
+-      $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
+-      $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
+-      $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) Python/frozen.o
+-      $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
+-      $(AR) $(ARFLAGS) $@ $(MODOBJS)
+-      $(RANLIB) $@
+-
+ libpython$(LDVERSION).so: $(LIBRARY_OBJS)
+       if test $(INSTSONAME) != $(LDLIBRARY); then \
+               $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+@@ -581,7 +569,7 @@ Modules/Setup: $(srcdir)/Modules/Setup.d
+               echo "-----------------------------------------------"; \
+       fi
+-Modules/_testembed: Modules/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
++Modules/_testembed: Modules/_testembed.o $(LDLIBRARY) $(PY3LIBRARY)
+       $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+ ############################################################################
+@@ -1155,18 +1143,6 @@ libainstall:    all python-config
+               else    true; \
+               fi; \
+       done
+-      @if test -d $(LIBRARY); then :; else \
+-              if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
+-                      if test "$(SO)" = .dll; then \
+-                              $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
+-                      else \
+-                              $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+-                              $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+-                      fi; \
+-              else \
+-                      echo Skip install of $(LIBRARY) - use make frameworkinstall; \
+-              fi; \
+-      fi
+       $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
+       $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
+       $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
diff --git a/python3/patches/00113-more-configuration-flags.patch b/python3/patches/00113-more-configuration-flags.patch
new file mode 100644 (file)
index 0000000..1067af1
--- /dev/null
@@ -0,0 +1,50 @@
+diff -up Python-3.3.0b1/configure.ac.more-configuration-flags Python-3.3.0b1/configure.ac
+--- Python-3.3.0b1/configure.ac.more-configuration-flags       2012-07-20 13:25:33.232864839 -0400
++++ Python-3.3.0b1/configure.ac        2012-07-20 13:25:33.314863815 -0400
+@@ -2585,6 +2585,30 @@ else AC_MSG_RESULT(no)
+ fi],
+ [AC_MSG_RESULT(no)])
++AC_MSG_CHECKING(for --with-count-allocs)
++AC_ARG_WITH(count-allocs,
++[  --with(out)count-allocs  enable/disable per-type instance accounting], [
++if test "$withval" != no
++then 
++  AC_DEFINE(COUNT_ALLOCS, 1,
++    [Define to keep records of the number of instances of each type]) 
++    AC_MSG_RESULT(yes)
++else AC_MSG_RESULT(no)
++fi],
++[AC_MSG_RESULT(no)])
++
++AC_MSG_CHECKING(for --with-call-profile)
++AC_ARG_WITH(call-profile,
++[  --with(out)-call-profile  enable/disable statistics on function call invocation], [
++if test "$withval" != no
++then 
++  AC_DEFINE(CALL_PROFILE, 1, 
++    [Define to keep records on function call invocation]) 
++    AC_MSG_RESULT(yes)
++else AC_MSG_RESULT(no)
++fi],
++[AC_MSG_RESULT(no)])
++
+ # Check for Python-specific malloc support
+ AC_MSG_CHECKING(for --with-pymalloc)
+ AC_ARG_WITH(pymalloc,
+diff -up Python-3.3.0b1/pyconfig.h.in.more-configuration-flags Python-3.3.0b1/pyconfig.h.in
+--- Python-3.3.0b1/pyconfig.h.in.more-configuration-flags      2012-07-20 13:25:33.000000000 -0400
++++ Python-3.3.0b1/pyconfig.h.in       2012-07-20 13:26:02.826494869 -0400
+@@ -12,6 +12,12 @@
+    support for AIX C++ shared extension modules. */
+ #undef AIX_GENUINE_CPLUSPLUS
++/* Define to keep records on function call invocation */
++#undef CALL_PROFILE
++
++/* Define to keep records of the number of instances of each type */
++#undef COUNT_ALLOCS
++
+ /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM
+    mixed-endian order (byte order 45670123) */
+ #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754
diff --git a/python3/patches/00114-statvfs-f_flag-constants.patch b/python3/patches/00114-statvfs-f_flag-constants.patch
new file mode 100644 (file)
index 0000000..af0d780
--- /dev/null
@@ -0,0 +1,39 @@
+diff -up Python-3.3.0b1/Modules/posixmodule.c.statvfs-f_flag-constants Python-3.3.0b1/Modules/posixmodule.c
+--- Python-3.3.0b1/Modules/posixmodule.c.statvfs-f_flag-constants      2012-06-26 16:19:54.000000000 -0400
++++ Python-3.3.0b1/Modules/posixmodule.c       2012-07-20 13:39:18.595546387 -0400
+@@ -11665,6 +11665,35 @@ all_ins(PyObject *d)
+     if (ins(d, "ST_NOSUID", (long)ST_NOSUID)) return -1;
+ #endif /* ST_NOSUID */
++    /* GNU extensions */
++#ifdef ST_NODEV
++    if (ins(d, "ST_NODEV", (long)ST_NODEV)) return -1;
++#endif /* ST_NODEV */
++#ifdef ST_NOEXEC
++    if (ins(d, "ST_NOEXEC", (long)ST_NOEXEC)) return -1;
++#endif /* ST_NOEXEC */
++#ifdef ST_SYNCHRONOUS
++    if (ins(d, "ST_SYNCHRONOUS", (long)ST_SYNCHRONOUS)) return -1;
++#endif /* ST_SYNCHRONOUS */
++#ifdef ST_MANDLOCK
++    if (ins(d, "ST_MANDLOCK", (long)ST_MANDLOCK)) return -1;
++#endif /* ST_MANDLOCK */
++#ifdef ST_WRITE
++    if (ins(d, "ST_WRITE", (long)ST_WRITE)) return -1;
++#endif /* ST_WRITE */
++#ifdef ST_APPEND
++    if (ins(d, "ST_APPEND", (long)ST_APPEND)) return -1;
++#endif /* ST_APPEND */
++#ifdef ST_NOATIME
++    if (ins(d, "ST_NOATIME", (long)ST_NOATIME)) return -1;
++#endif /* ST_NOATIME */
++#ifdef ST_NODIRATIME
++    if (ins(d, "ST_NODIRATIME", (long)ST_NODIRATIME)) return -1;
++#endif /* ST_NODIRATIME */
++#ifdef ST_RELATIME
++    if (ins(d, "ST_RELATIME", (long)ST_RELATIME)) return -1;
++#endif /* ST_RELATIME */
++
+     /* FreeBSD sendfile() constants */
+ #ifdef SF_NODISKIO
+     if (ins(d, "SF_NODISKIO", (long)SF_NODISKIO)) return -1;
diff --git a/python3/patches/00125-less-verbose-COUNT_ALLOCS.patch b/python3/patches/00125-less-verbose-COUNT_ALLOCS.patch
new file mode 100644 (file)
index 0000000..8cef015
--- /dev/null
@@ -0,0 +1,20 @@
+diff -up Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS Python-2.7/Python/pythonrun.c
+--- Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS    2010-08-17 14:49:33.321913909 -0400
++++ Python-2.7/Python/pythonrun.c      2010-08-17 14:54:48.750910403 -0400
+@@ -470,7 +470,15 @@ Py_Finalize(void)
+     /* Debugging stuff */
+ #ifdef COUNT_ALLOCS
+-    dump_counts(stdout);
++    /* This is a downstream Fedora modification.
++       The upstream default with COUNT_ALLOCS is to always dump the counts to
++       stdout on exit.  For our debug builds its useful to have the info from
++       COUNT_ALLOCS available, but the stdout info here gets in the way, so
++       we make it optional, wrapping it in an environment variable (modelled
++       on the other PYTHONDUMP* env variables):
++    */
++    if (Py_GETENV("PYTHONDUMPCOUNTS"))
++        dump_counts(stdout);
+ #endif
+     PRINT_TOTAL_REFS();
diff --git a/python3/patches/00131-disable-tests-in-test_io.patch b/python3/patches/00131-disable-tests-in-test_io.patch
new file mode 100644 (file)
index 0000000..d81a2d0
--- /dev/null
@@ -0,0 +1,11 @@
+diff -up Python-2.7.2/Lib/test/test_io.py.disable-tests-in-test_io Python-2.7.2/Lib/test/test_io.py
+--- Python-2.7.2/Lib/test/test_io.py.disable-tests-in-test_io  2011-09-01 14:18:45.963304089 -0400
++++ Python-2.7.2/Lib/test/test_io.py   2011-09-01 15:08:53.796098413 -0400
+@@ -2669,6 +2669,7 @@ class SignalsTest(unittest.TestCase):
+         self.check_interrupted_read_retry(lambda x: x,
+                                           mode="r")
++    @unittest.skip('rhbz#732998')
+     @unittest.skipUnless(threading, 'Threading required for this test.')
+     def check_interrupted_write_retry(self, item, **fdopen_kwargs):
+         """Check that a buffered write, when it gets interrupted (either
diff --git a/python3/patches/00132-add-rpmbuild-hooks-to-unittest.patch b/python3/patches/00132-add-rpmbuild-hooks-to-unittest.patch
new file mode 100644 (file)
index 0000000..fdfbab8
--- /dev/null
@@ -0,0 +1,68 @@
+diff -up Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/case.py
+--- Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest   2011-09-03 12:16:44.000000000 -0400
++++ Python-3.2.2/Lib/unittest/case.py  2011-09-09 06:35:16.365568382 -0400
+@@ -3,6 +3,7 @@
+ import sys
+ import functools
+ import difflib
++import os
+ import pprint
+ import re
+ import warnings
+@@ -101,6 +102,43 @@ def expectedFailure(func):
+     return wrapper
++# Non-standard/downstream-only hooks for handling issues with specific test
++# cases:
++
++def _skipInRpmBuild(reason):
++    """
++    Non-standard/downstream-only decorator for marking a specific unit test
++    to be skipped when run within the %check of an rpmbuild.
++
++    Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within
++    the environment, and has no effect otherwise.
++    """
++    if 'WITHIN_PYTHON_RPM_BUILD' in os.environ:
++        return skip(reason)
++    else:
++        return _id
++
++def _expectedFailureInRpmBuild(func):
++    """
++    Non-standard/downstream-only decorator for marking a specific unit test
++    as expected to fail within the %check of an rpmbuild.
++
++    Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within
++    the environment, and has no effect otherwise.
++    """
++    @functools.wraps(func)
++    def wrapper(*args, **kwargs):
++        if 'WITHIN_PYTHON_RPM_BUILD' in os.environ:
++            try:
++                func(*args, **kwargs)
++            except Exception:
++                raise _ExpectedFailure(sys.exc_info())
++            raise _UnexpectedSuccess
++        else:
++            # Call directly:
++            func(*args, **kwargs)
++    return wrapper
++
+ class _AssertRaisesBaseContext(object):
+     def __init__(self, expected, test_case, callable_obj=None,
+diff -up Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/__init__.py
+--- Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest       2011-09-03 12:16:44.000000000 -0400
++++ Python-3.2.2/Lib/unittest/__init__.py      2011-09-09 06:35:16.366568382 -0400
+@@ -57,7 +57,8 @@ __unittest = True
+ from .result import TestResult
+ from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf,
+-                   skipUnless, expectedFailure)
++                   skipUnless, expectedFailure,
++                   _skipInRpmBuild, _expectedFailureInRpmBuild)
+ from .suite import BaseTestSuite, TestSuite
+ from .loader import (TestLoader, defaultTestLoader, makeSuite, getTestCaseNames,
+                      findTestCases)
diff --git a/python3/patches/00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch b/python3/patches/00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch
new file mode 100644 (file)
index 0000000..087705c
--- /dev/null
@@ -0,0 +1,21 @@
+diff -up Python-3.3.0b2/Lib/test/test_sys.py.fix-COUNT_ALLOCS-failure-in-test_sys Python-3.3.0b2/Lib/test/test_sys.py
+--- Python-3.3.0b2/Lib/test/test_sys.py.fix-COUNT_ALLOCS-failure-in-test_sys   2012-08-11 02:54:16.000000000 -0400
++++ Python-3.3.0b2/Lib/test/test_sys.py        2012-08-13 14:50:15.253720597 -0400
+@@ -835,12 +835,17 @@ class SizeofTest(unittest.TestCase):
+         # type
+         # static type: PyTypeObject
+         s = vsize('P2n15Pl4Pn9Pn11PI')
++        # COUNT_ALLOCS adds a further 3 Py_ssize_t and 2 pointers:
++        if hasattr(sys, 'getcounts'):
++            s += struct.calcsize('3P2P')
+         check(int, s)
+         # (PyTypeObject + PyNumberMethods + PyMappingMethods +
+         #  PySequenceMethods + PyBufferProcs + 4P)
+         s = vsize('P2n15Pl4Pn9Pn11PI') + struct.calcsize('34P 3P 10P 2P 4P')
+         # Separate block for PyDictKeysObject with 4 entries
+         s += struct.calcsize("2nPn") + 4*struct.calcsize("n2P")
++        if hasattr(sys, 'getcounts'):
++            s += struct.calcsize('3P2P')
+         # class
+         class newstyleclass(object): pass
+         check(newstyleclass, s)
diff --git a/python3/patches/00135-fix-test-within-test_weakref-in-debug-build.patch b/python3/patches/00135-fix-test-within-test_weakref-in-debug-build.patch
new file mode 100644 (file)
index 0000000..6ed7801
--- /dev/null
@@ -0,0 +1,17 @@
+diff -up Python-3.2b2/Lib/test/test_weakref.py.test-weakref-COUNT_ALLOCS_fix Python-3.2b2/Lib/test/test_weakref.py
+--- Python-3.2b2/Lib/test/test_weakref.py.test-weakref-COUNT_ALLOCS_fix        2010-12-28 20:33:46.963364990 -0500
++++ Python-3.2b2/Lib/test/test_weakref.py      2010-12-28 20:35:44.115935248 -0500
+@@ -583,9 +583,10 @@ class ReferencesTestCase(TestBase):
+         # been cleared without their callbacks executing.  OTOH, the weakref
+         # to C is bound to a function local (wr), and wasn't trash, so that
+         # callback should have been invoked when C went away.
+-        self.assertEqual(alist, ["C went away"])
+-        # The remaining weakref should be dead now (its callback ran).
+-        self.assertEqual(wr(), None)
++        if not hasattr(sys, 'getcounts'):
++            self.assertEqual(alist, ["C went away"])
++            # The remaining weakref should be dead now (its callback ran).
++            self.assertEqual(wr(), None)
+         del alist[:]
+         gc.collect()
diff --git a/python3/patches/00137-skip-distutils-tests-that-fail-in-rpmbuild.patch b/python3/patches/00137-skip-distutils-tests-that-fail-in-rpmbuild.patch
new file mode 100644 (file)
index 0000000..8a6bc46
--- /dev/null
@@ -0,0 +1,12 @@
+diff -up Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py.skip-distutils-tests-that-fail-in-rpmbuild Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py
+--- Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py.skip-distutils-tests-that-fail-in-rpmbuild      2011-09-03 12:16:40.000000000 -0400
++++ Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py 2011-09-10 05:04:56.328852558 -0400
+@@ -23,6 +23,7 @@ setup(name='foo', version='0.1', py_modu
+ """
++@unittest._skipInRpmBuild("don't try to nest one rpm build inside another rpm build")
+ class BuildRpmTestCase(support.TempdirManager,
+                        support.LoggingSilencer,
+                        unittest.TestCase):
+diff -up Python-3.2.2/Lib/distutils/tests/test_build_ext.py.skip-distutils-tests-that-fail-in-rpmbuild Python-3.2.2/Lib/distutils/tests/test_build_ext.py
diff --git a/python3/patches/00139-skip-test_float-known-failure-on-arm.patch b/python3/patches/00139-skip-test_float-known-failure-on-arm.patch
new file mode 100644 (file)
index 0000000..9d0bfad
--- /dev/null
@@ -0,0 +1,11 @@
+diff -up Python-2.7.2/Lib/test/test_float.py.skip-test_float-known-failure-on-arm Python-2.7.2/Lib/test/test_float.py
+--- Python-2.7.2/Lib/test/test_float.py.skip-test_float-known-failure-on-arm   2011-09-08 19:34:09.000986128 -0400
++++ Python-2.7.2/Lib/test/test_float.py        2011-09-08 19:34:57.969982779 -0400
+@@ -1072,6 +1072,7 @@ class HexFloatTestCase(unittest.TestCase
+                     self.identical(got, expected)
++    @unittest.skip('Known failure on ARM: http://bugs.python.org/issue8265')
+     def test_from_hex(self):
+         MIN = self.MIN;
+         MAX = self.MAX;
diff --git a/python3/patches/00141-fix-test_gc_with_COUNT_ALLOCS.patch b/python3/patches/00141-fix-test_gc_with_COUNT_ALLOCS.patch
new file mode 100644 (file)
index 0000000..337e39e
--- /dev/null
@@ -0,0 +1,22 @@
+diff -up Python-3.2b2/Lib/test/test_gc.py.fix-test-gc-COUNT_ALLOCS Python-3.2b2/Lib/test/test_gc.py
+--- Python-3.2b2/Lib/test/test_gc.py.fix-test-gc-COUNT_ALLOCS  2010-12-28 20:39:40.779059772 -0500
++++ Python-3.2b2/Lib/test/test_gc.py   2010-12-28 20:41:15.890940017 -0500
+@@ -102,10 +102,16 @@ class GCTests(unittest.TestCase):
+         del a
+         self.assertNotEqual(gc.collect(), 0)
+         del B, C
+-        self.assertNotEqual(gc.collect(), 0)
++        if hasattr(sys, 'getcounts'):
++            self.assertEqual(gc.collect(), 0)
++        else:
++            self.assertNotEqual(gc.collect(), 0)
+         A.a = A()
+         del A
+-        self.assertNotEqual(gc.collect(), 0)
++        if hasattr(sys, 'getcounts'):
++            self.assertEqual(gc.collect(), 0)
++        else:
++            self.assertNotEqual(gc.collect(), 0)
+         self.assertEqual(gc.collect(), 0)
+     def test_method(self):
diff --git a/python3/patches/00142-skip-failing-pty-tests-in-rpmbuild.patch b/python3/patches/00142-skip-failing-pty-tests-in-rpmbuild.patch
new file mode 100644 (file)
index 0000000..414ffcd
--- /dev/null
@@ -0,0 +1,22 @@
+diff -up Python-2.7.2/Lib/test/test_openpty.py.skip-failing-pty-tests-in-rpmbuild Python-2.7.2/Lib/test/test_openpty.py
+--- Python-2.7.2/Lib/test/test_openpty.py.skip-failing-pty-tests-in-rpmbuild   2011-09-09 05:09:28.698920379 -0400
++++ Python-2.7.2/Lib/test/test_openpty.py      2011-09-09 05:10:54.805914490 -0400
+@@ -8,6 +8,7 @@ if not hasattr(os, "openpty"):
+ class OpenptyTest(unittest.TestCase):
++    @unittest._skipInRpmBuild('sometimes fails in Koji, possibly due to a mock issue (rhbz#714627)')
+     def test(self):
+         master, slave = os.openpty()
+         if not os.isatty(slave):
+diff -up Python-2.7.2/Lib/test/test_pty.py.skip-failing-pty-tests-in-rpmbuild Python-2.7.2/Lib/test/test_pty.py
+--- Python-2.7.2/Lib/test/test_pty.py.skip-failing-pty-tests-in-rpmbuild       2011-09-09 05:09:36.781919825 -0400
++++ Python-2.7.2/Lib/test/test_pty.py  2011-09-09 05:11:14.741913127 -0400
+@@ -109,6 +109,7 @@ class PtyTest(unittest.TestCase):
+         os.close(master_fd)
++    @unittest._skipInRpmBuild('sometimes fails in Koji, possibly due to a mock issue (rhbz#714627)')
+     def test_fork(self):
+         debug("calling pty.fork()")
+         pid, master_fd = pty.fork()
diff --git a/python3/patches/00153-fix-test_gdb-noise.patch b/python3/patches/00153-fix-test_gdb-noise.patch
new file mode 100644 (file)
index 0000000..cc9ed8c
--- /dev/null
@@ -0,0 +1,37 @@
+diff -up cpython-59223da36dec/Lib/test/test_gdb.py.fix-test_gdb-noise cpython-59223da36dec/Lib/test/test_gdb.py
+--- cpython-59223da36dec/Lib/test/test_gdb.py.fix-test_gdb-noise       2012-08-07 06:10:57.000000000 -0400
++++ cpython-59223da36dec/Lib/test/test_gdb.py  2012-08-07 17:13:46.592343113 -0400
+@@ -115,6 +115,15 @@ class DebuggerTests(unittest.TestCase):
+         # Generate a list of commands in gdb's language:
+         commands = ['set breakpoint pending yes',
+                     'break %s' % breakpoint,
++
++                    # GDB as of Fedora 17 onwards can distinguish between the
++                    # value of a variable at entry vs current value:
++                    #   http://sourceware.org/gdb/onlinedocs/gdb/Variables.html
++                    # which leads to the selftests failing with errors like this:
++                    #   AssertionError: 'v@entry=()' != '()'
++                    # Disable this:
++                    'set print entry-values no',
++
+                     'run']
+         if cmds_after_breakpoint:
+             commands += cmds_after_breakpoint
+@@ -154,8 +163,16 @@ class DebuggerTests(unittest.TestCase):
+         err = err.replace("warning: Cannot initialize thread debugging"
+                           " library: Debugger service failed\n",
+                           '')
+-
++        err = '\n'.join([line
++                         for line in err.splitlines()
++                         if not line.startswith('warning: Unable to open')
++                         if not line.startswith('Missing separate debuginfo for')
++                         if not line.startswith('Try: yum --disablerepo=')
++                         # In case 'set print entry-values no' failed:
++                         if not line.startswith('Undefined set print command')])
++ 
+         # Ensure no unexpected error messages:
++        self.maxDiff = None
+         self.assertEqual(err, '')
+         return out
diff --git a/python3/patches/00155-avoid-ctypes-thunks.patch b/python3/patches/00155-avoid-ctypes-thunks.patch
new file mode 100644 (file)
index 0000000..f03890e
--- /dev/null
@@ -0,0 +1,15 @@
+diff -up Python-3.2.3/Lib/ctypes/__init__.py.rhbz814391 Python-3.2.3/Lib/ctypes/__init__.py
+--- Python-3.2.3/Lib/ctypes/__init__.py.rhbz814391     2012-04-20 15:12:49.017867692 -0400
++++ Python-3.2.3/Lib/ctypes/__init__.py        2012-04-20 15:15:09.501111408 -0400
+@@ -275,11 +275,6 @@ def _reset_cache():
+     # _SimpleCData.c_char_p_from_param
+     POINTER(c_char).from_param = c_char_p.from_param
+     _pointer_type_cache[None] = c_void_p
+-    # XXX for whatever reasons, creating the first instance of a callback
+-    # function is needed for the unittests on Win64 to succeed.  This MAY
+-    # be a compiler bug, since the problem occurs only when _ctypes is
+-    # compiled with the MS SDK compiler.  Or an uninitialized variable?
+-    CFUNCTYPE(c_int)(lambda: None)
+ def create_unicode_buffer(init, size=None):
+     """create_unicode_buffer(aString) -> character array
diff --git a/python3/patches/00156-gdb-autoload-safepath.patch b/python3/patches/00156-gdb-autoload-safepath.patch
new file mode 100644 (file)
index 0000000..ac2aa40
--- /dev/null
@@ -0,0 +1,52 @@
+diff -up Python-3.2.3/Lib/test/test_gdb.py.gdb-autoload-safepath Python-3.2.3/Lib/test/test_gdb.py
+--- Python-3.2.3/Lib/test/test_gdb.py.gdb-autoload-safepath    2012-04-30 17:16:24.092706954 -0400
++++ Python-3.2.3/Lib/test/test_gdb.py  2012-04-30 17:17:13.275703592 -0400
+@@ -46,6 +46,19 @@ def gdb_has_frame_select():
+ HAS_PYUP_PYDOWN = gdb_has_frame_select()
++def gdb_has_autoload_safepath():
++    # Recent GDBs will only auto-load scripts from certain safe
++    # locations, so we will need to turn off this protection.
++    # However, if the GDB doesn't have it, then the following
++    # command will generate noise on stderr (rhbz#817072):
++    cmd = "--eval-command=set auto-load safe-path /"
++    p = subprocess.Popen(["gdb", "--batch", cmd],
++                         stderr=subprocess.PIPE)
++    _, stderr = p.communicate()
++    return b'"on" or "off" expected.' not in stderr
++    
++HAS_AUTOLOAD_SAFEPATH = gdb_has_autoload_safepath()
++
+ BREAKPOINT_FN='builtin_id'
+ class DebuggerTests(unittest.TestCase):
+@@ -106,15 +119,28 @@ class DebuggerTests(unittest.TestCase):
+                     'set print entry-values no',
+                     'run']
++
++        if HAS_AUTOLOAD_SAFEPATH:
++            # Recent GDBs will only auto-load scripts from certain safe
++            # locations.
++            # Where necessary, turn off this protection to ensure that
++            # our -gdb.py script can be loaded - but not on earlier gdb builds
++            # as this would generate noise on stderr (rhbz#817072):
++            init_commands = ['set auto-load safe-path /']
++        else:
++            init_commands = []
++
+         if cmds_after_breakpoint:
+             commands += cmds_after_breakpoint
+         else:
+             commands += ['backtrace']
++        # print init_commands
+         # print commands
+         # Use "commands" to generate the arguments with which to invoke "gdb":
+         args = ["gdb", "--batch"]
++        args += ['--init-eval-command=%s' % cmd for cmd in init_commands]
+         args += ['--eval-command=%s' % cmd for cmd in commands]
+         args += ["--args",
+                  sys.executable]
diff --git a/python3/patches/00157-uid-gid-overflows.patch b/python3/patches/00157-uid-gid-overflows.patch
new file mode 100644 (file)
index 0000000..ab4cb0c
--- /dev/null
@@ -0,0 +1,696 @@
+diff -up Python-3.3.0b1/Include/modsupport.h.uid-gid-overflows Python-3.3.0b1/Include/modsupport.h
+--- Python-3.3.0b1/Include/modsupport.h.uid-gid-overflows      2012-06-26 16:19:40.000000000 -0400
++++ Python-3.3.0b1/Include/modsupport.h        2012-07-20 14:21:46.854688763 -0400
+@@ -8,6 +8,7 @@ extern "C" {
+ /* Module support interface */
+ #include <stdarg.h>
++#include <sys/types.h>
+ /* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier
+    to mean Py_ssize_t */
+@@ -125,6 +126,17 @@ PyAPI_FUNC(PyObject *) PyModule_Create2(
+ PyAPI_DATA(char *) _Py_PackageContext;
+ #endif
++/*
++  Non-standard extension: support for dealing with uid_t and gid_t without
++  integer overflow
++ */
++
++PyAPI_FUNC(PyObject *) _PyObject_FromUid(uid_t uid);
++PyAPI_FUNC(PyObject *) _PyObject_FromGid(gid_t gid);
++
++PyAPI_FUNC(int) _PyArg_ParseUid(PyObject *in_obj, uid_t *out_uid);
++PyAPI_FUNC(int) _PyArg_ParseGid(PyObject *in_obj, gid_t *out_gid);
++
+ #ifdef __cplusplus
+ }
+ #endif
+diff -up Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_os.py
+--- Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows       2012-06-26 16:19:48.000000000 -0400
++++ Python-3.3.0b1/Lib/test/test_os.py 2012-07-20 14:21:46.856688739 -0400
+@@ -1174,30 +1174,36 @@ if sys.platform != 'win32':
+             def test_setuid(self):
+                 if os.getuid() != 0:
+                     self.assertRaises(os.error, os.setuid, 0)
++                self.assertRaises(TypeError, os.setuid, 'not an int')
+                 self.assertRaises(OverflowError, os.setuid, 1<<32)
+         if hasattr(os, 'setgid'):
+             def test_setgid(self):
+                 if os.getuid() != 0:
+                     self.assertRaises(os.error, os.setgid, 0)
++                self.assertRaises(TypeError, os.setgid, 'not an int')
+                 self.assertRaises(OverflowError, os.setgid, 1<<32)
+         if hasattr(os, 'seteuid'):
+             def test_seteuid(self):
+                 if os.getuid() != 0:
+                     self.assertRaises(os.error, os.seteuid, 0)
++                self.assertRaises(TypeError, os.seteuid, 'not an int')
+                 self.assertRaises(OverflowError, os.seteuid, 1<<32)
+         if hasattr(os, 'setegid'):
+             def test_setegid(self):
+                 if os.getuid() != 0:
+                     self.assertRaises(os.error, os.setegid, 0)
++                self.assertRaises(TypeError, os.setegid, 'not an int')
+                 self.assertRaises(OverflowError, os.setegid, 1<<32)
+         if hasattr(os, 'setreuid'):
+             def test_setreuid(self):
+                 if os.getuid() != 0:
+                     self.assertRaises(os.error, os.setreuid, 0, 0)
++                self.assertRaises(TypeError, os.setreuid, 'not an int', 0)
++                self.assertRaises(TypeError, os.setreuid, 0, 'not an int')
+                 self.assertRaises(OverflowError, os.setreuid, 1<<32, 0)
+                 self.assertRaises(OverflowError, os.setreuid, 0, 1<<32)
+@@ -1212,6 +1218,8 @@ if sys.platform != 'win32':
+             def test_setregid(self):
+                 if os.getuid() != 0:
+                     self.assertRaises(os.error, os.setregid, 0, 0)
++                self.assertRaises(TypeError, os.setregid, 'not an int', 0)
++                self.assertRaises(TypeError, os.setregid, 0, 'not an int')
+                 self.assertRaises(OverflowError, os.setregid, 1<<32, 0)
+                 self.assertRaises(OverflowError, os.setregid, 0, 1<<32)
+diff -up Python-3.3.0b1/Lib/test/test_posix.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_posix.py
+--- Python-3.3.0b1/Lib/test/test_posix.py.uid-gid-overflows    2012-06-26 16:19:48.000000000 -0400
++++ Python-3.3.0b1/Lib/test/test_posix.py      2012-07-20 14:21:46.857688726 -0400
+@@ -387,10 +387,17 @@ class PosixTester(unittest.TestCase):
+         else:
+             self.assertTrue(stat.S_ISFIFO(posix.stat(support.TESTFN).st_mode))
+-    def _test_all_chown_common(self, chown_func, first_param):
++    def _test_all_chown_common(self, chown_func, stat_func, first_param):
+         """Common code for chown, fchown and lchown tests."""
+         # test a successful chown call
+         chown_func(first_param, os.getuid(), os.getgid())
++        self.assertEqual(stat_func(first_param).st_uid, os.getuid())
++        self.assertEqual(stat_func(first_param).st_gid, os.getgid())
++
++        # verify that -1 works as a "do-nothing" option:
++        chown_func(first_param, -1, -1)
++        self.assertEqual(stat_func(first_param).st_uid, os.getuid())
++        self.assertEqual(stat_func(first_param).st_gid, os.getgid())
+         if os.getuid() == 0:
+             try:
+@@ -421,7 +428,7 @@ class PosixTester(unittest.TestCase):
+         # re-create the file
+         support.create_empty_file(support.TESTFN)
+-        self._test_all_chown_common(posix.chown, support.TESTFN)
++        self._test_all_chown_common(posix.chown, posix.stat, support.TESTFN)
+     @unittest.skipUnless(hasattr(posix, 'fchown'), "test needs os.fchown()")
+     def test_fchown(self):
+@@ -431,7 +438,7 @@ class PosixTester(unittest.TestCase):
+         test_file = open(support.TESTFN, 'w')
+         try:
+             fd = test_file.fileno()
+-            self._test_all_chown_common(posix.fchown, fd)
++            self._test_all_chown_common(posix.fchown, posix.fstat, fd)
+         finally:
+             test_file.close()
+@@ -440,7 +447,7 @@ class PosixTester(unittest.TestCase):
+         os.unlink(support.TESTFN)
+         # create a symlink
+         os.symlink(_DUMMY_SYMLINK, support.TESTFN)
+-        self._test_all_chown_common(posix.lchown, support.TESTFN)
++        self._test_all_chown_common(posix.lchown, posix.lstat, support.TESTFN)
+     def test_chdir(self):
+         if hasattr(posix, 'chdir'):
+diff -up Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_pwd.py
+--- Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows      2012-06-26 16:19:48.000000000 -0400
++++ Python-3.3.0b1/Lib/test/test_pwd.py        2012-07-20 14:21:46.857688726 -0400
+@@ -87,9 +87,9 @@ class PwdTest(unittest.TestCase):
+         # In some cases, byuids isn't a complete list of all users in the
+         # system, so if we try to pick a value not in byuids (via a perturbing
+         # loop, say), pwd.getpwuid() might still be able to find data for that
+-        # uid. Using sys.maxint may provoke the same problems, but hopefully
++        # uid. Using 2**32 - 2 may provoke the same problems, but hopefully
+         # it will be a more repeatable failure.
+-        fakeuid = sys.maxsize
++        fakeuid = 2**32 - 2
+         self.assertNotIn(fakeuid, byuids)
+         self.assertRaises(KeyError, pwd.getpwuid, fakeuid)
+diff -up Python-3.3.0b1/Modules/grpmodule.c.uid-gid-overflows Python-3.3.0b1/Modules/grpmodule.c
+--- Python-3.3.0b1/Modules/grpmodule.c.uid-gid-overflows       2012-06-26 16:19:54.000000000 -0400
++++ Python-3.3.0b1/Modules/grpmodule.c 2012-07-20 14:21:46.858688713 -0400
+@@ -69,7 +69,7 @@ mkgrent(struct group *p)
+             Py_INCREF(Py_None);
+     }
+ #endif
+-    SET(setIndex++, PyLong_FromLong((long) p->gr_gid));
++    SET(setIndex++, _PyObject_FromGid(p->gr_gid));
+     SET(setIndex++, w);
+ #undef SET
+@@ -84,18 +84,16 @@ mkgrent(struct group *p)
+ static PyObject *
+ grp_getgrgid(PyObject *self, PyObject *pyo_id)
+ {
+-    PyObject *py_int_id;
+-    unsigned int gid;
++    gid_t gid;
+     struct group *p;
+-    py_int_id = PyNumber_Long(pyo_id);
+-    if (!py_int_id)
+-            return NULL;
+-    gid = PyLong_AS_LONG(py_int_id);
+-    Py_DECREF(py_int_id);
++    if (!_PyArg_ParseGid(pyo_id, &gid)) {
++        return NULL;
++    }
+     if ((p = getgrgid(gid)) == NULL) {
+-        PyErr_Format(PyExc_KeyError, "getgrgid(): gid not found: %d", gid);
++        PyErr_Format(PyExc_KeyError,
++                     "getgrgid(): gid not found: %lu", (unsigned long)gid);
+         return NULL;
+     }
+     return mkgrent(p);
+diff -up Python-3.3.0b1/Modules/posixmodule.c.uid-gid-overflows Python-3.3.0b1/Modules/posixmodule.c
+--- Python-3.3.0b1/Modules/posixmodule.c.uid-gid-overflows     2012-07-20 14:21:46.788689588 -0400
++++ Python-3.3.0b1/Modules/posixmodule.c       2012-07-20 14:24:19.626778849 -0400
+@@ -2151,8 +2151,8 @@ _pystat_fromstructstat(STRUCT_STAT *st)
+     PyStructSequence_SET_ITEM(v, 2, PyLong_FromLong((long)st->st_dev));
+ #endif
+     PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long)st->st_nlink));
+-    PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong((long)st->st_uid));
+-    PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong((long)st->st_gid));
++    PyStructSequence_SET_ITEM(v, 4, _PyObject_FromUid(st->st_uid));
++    PyStructSequence_SET_ITEM(v, 5, _PyObject_FromGid(st->st_gid));
+ #ifdef HAVE_LARGEFILE_SUPPORT
+     PyStructSequence_SET_ITEM(v, 6,
+                               PyLong_FromLongLong((PY_LONG_LONG)st->st_size));
+@@ -2957,7 +2957,6 @@ static PyObject *
+ posix_chown(PyObject *self, PyObject *args, PyObject *kwargs)
+ {
+     path_t path;
+-    long uid_l, gid_l;
+     uid_t uid;
+     gid_t gid;
+     int dir_fd = DEFAULT_DIR_FD;
+@@ -2971,9 +2970,10 @@ posix_chown(PyObject *self, PyObject *ar
+ #ifdef HAVE_FCHOWN
+     path.allow_fd = 1;
+ #endif
+-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&ll|$O&p:chown", keywords,
++    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&|$O&p:chown", keywords,
+                                      path_converter, &path,
+-                                     &uid_l, &gid_l,
++                                     _PyArg_ParseUid, &uid,
++                                     _PyArg_ParseGid, &gid,
+ #ifdef HAVE_FCHOWNAT
+                                      dir_fd_converter, &dir_fd,
+ #else
+@@ -3004,8 +3004,6 @@ posix_chown(PyObject *self, PyObject *ar
+ #endif
+     Py_BEGIN_ALLOW_THREADS
+-    uid = (uid_t)uid_l;
+-    gid = (uid_t)gid_l;
+ #ifdef HAVE_FCHOWN
+     if (path.fd != -1)
+         result = fchown(path.fd, uid, gid);
+@@ -3049,12 +3047,15 @@ static PyObject *
+ posix_fchown(PyObject *self, PyObject *args)
+ {
+     int fd;
+-    long uid, gid;
++    uid_t uid;
++    gid_t gid;
+     int res;
+-    if (!PyArg_ParseTuple(args, "ill:fchown", &fd, &uid, &gid))
++    if (!PyArg_ParseTuple(args, "iO&O&:chown", &fd,
++                          _PyArg_ParseUid, &uid,
++                          _PyArg_ParseGid, &gid))
+         return NULL;
+     Py_BEGIN_ALLOW_THREADS
+-    res = fchown(fd, (uid_t) uid, (gid_t) gid);
++    res = fchown(fd, uid, gid);
+     Py_END_ALLOW_THREADS
+     if (res < 0)
+         return posix_error();
+@@ -3074,15 +3075,17 @@ posix_lchown(PyObject *self, PyObject *a
+ {
+     PyObject *opath;
+     char *path;
+-    long uid, gid;
++    uid_t uid;
++    gid_t gid;
+     int res;
+-    if (!PyArg_ParseTuple(args, "O&ll:lchown",
++    if (!PyArg_ParseTuple(args, "O&O&O&:lchown",
+                           PyUnicode_FSConverter, &opath,
+-                          &uid, &gid))
++                          _PyArg_ParseUid, &uid,
++                          _PyArg_ParseGid, &gid))
+         return NULL;
+     path = PyBytes_AsString(opath);
+     Py_BEGIN_ALLOW_THREADS
+-    res = lchown(path, (uid_t) uid, (gid_t) gid);
++    res = lchown(path, uid, gid);
+     Py_END_ALLOW_THREADS
+     if (res < 0)
+         return posix_error_with_allocated_filename(opath);
+@@ -6184,7 +6187,7 @@ Return the current process's effective g
+ static PyObject *
+ posix_getegid(PyObject *self, PyObject *noargs)
+ {
+-    return PyLong_FromLong((long)getegid());
++  return _PyObject_FromGid(getegid());
+ }
+ #endif
+@@ -6197,7 +6200,7 @@ Return the current process's effective u
+ static PyObject *
+ posix_geteuid(PyObject *self, PyObject *noargs)
+ {
+-    return PyLong_FromLong((long)geteuid());
++    return _PyObject_FromUid(geteuid());
+ }
+ #endif
+@@ -6210,7 +6213,7 @@ Return the current process's group id.")
+ static PyObject *
+ posix_getgid(PyObject *self, PyObject *noargs)
+ {
+-    return PyLong_FromLong((long)getgid());
++    return _PyObject_FromGid(getgid());
+ }
+ #endif
+@@ -6349,7 +6352,7 @@ posix_getgroups(PyObject *self, PyObject
+     if (result != NULL) {
+         int i;
+         for (i = 0; i < n; ++i) {
+-            PyObject *o = PyLong_FromLong((long)alt_grouplist[i]);
++            PyObject *o = _PyObject_FromGid(alt_grouplist[i]);
+             if (o == NULL) {
+                 Py_DECREF(result);
+                 result = NULL;
+@@ -6380,14 +6383,15 @@ posix_initgroups(PyObject *self, PyObjec
+     PyObject *oname;
+     char *username;
+     int res;
+-    long gid;
++    gid_t gid;
+-    if (!PyArg_ParseTuple(args, "O&l:initgroups",
+-                          PyUnicode_FSConverter, &oname, &gid))
++    if (!PyArg_ParseTuple(args, "O&O&:initgroups",
++                          PyUnicode_FSConverter, &oname,
++                          _PyArg_ParseGid, &gid))
+         return NULL;
+     username = PyBytes_AS_STRING(oname);
+-    res = initgroups(username, (gid_t) gid);
++    res = initgroups(username, gid);
+     Py_DECREF(oname);
+     if (res == -1)
+         return PyErr_SetFromErrno(PyExc_OSError);
+@@ -6562,7 +6566,7 @@ Return the current process's user id.");
+ static PyObject *
+ posix_getuid(PyObject *self, PyObject *noargs)
+ {
+-    return PyLong_FromLong((long)getuid());
++    return _PyObject_FromUid(getuid());
+ }
+ #endif
+@@ -6702,15 +6706,9 @@ Set the current process's user id.");
+ static PyObject *
+ posix_setuid(PyObject *self, PyObject *args)
+ {
+-    long uid_arg;
+     uid_t uid;
+-    if (!PyArg_ParseTuple(args, "l:setuid", &uid_arg))
+-        return NULL;
+-    uid = uid_arg;
+-    if (uid != uid_arg) {
+-        PyErr_SetString(PyExc_OverflowError, "user id too big");
++    if (!PyArg_ParseTuple(args, "O&:setuid", _PyArg_ParseUid, &uid))
+         return NULL;
+-    }
+     if (setuid(uid) < 0)
+         return posix_error();
+     Py_INCREF(Py_None);
+@@ -6727,15 +6725,9 @@ Set the current process's effective user
+ static PyObject *
+ posix_seteuid (PyObject *self, PyObject *args)
+ {
+-    long euid_arg;
+     uid_t euid;
+-    if (!PyArg_ParseTuple(args, "l", &euid_arg))
++    if (!PyArg_ParseTuple(args, "O&:seteuid", _PyArg_ParseUid, &euid))
+         return NULL;
+-    euid = euid_arg;
+-    if (euid != euid_arg) {
+-        PyErr_SetString(PyExc_OverflowError, "user id too big");
+-        return NULL;
+-    }
+     if (seteuid(euid) < 0) {
+         return posix_error();
+     } else {
+@@ -6753,15 +6745,9 @@ Set the current process's effective grou
+ static PyObject *
+ posix_setegid (PyObject *self, PyObject *args)
+ {
+-    long egid_arg;
+     gid_t egid;
+-    if (!PyArg_ParseTuple(args, "l", &egid_arg))
+-        return NULL;
+-    egid = egid_arg;
+-    if (egid != egid_arg) {
+-        PyErr_SetString(PyExc_OverflowError, "group id too big");
++    if (!PyArg_ParseTuple(args, "O&:setegid", _PyArg_ParseGid, &egid))
+         return NULL;
+-    }
+     if (setegid(egid) < 0) {
+         return posix_error();
+     } else {
+@@ -6779,23 +6765,11 @@ Set the current process's real and effec
+ static PyObject *
+ posix_setreuid (PyObject *self, PyObject *args)
+ {
+-    long ruid_arg, euid_arg;
+     uid_t ruid, euid;
+-    if (!PyArg_ParseTuple(args, "ll", &ruid_arg, &euid_arg))
+-        return NULL;
+-    if (ruid_arg == -1)
+-        ruid = (uid_t)-1;  /* let the compiler choose how -1 fits */
+-    else
+-        ruid = ruid_arg;  /* otherwise, assign from our long */
+-    if (euid_arg == -1)
+-        euid = (uid_t)-1;
+-    else
+-        euid = euid_arg;
+-    if ((euid_arg != -1 && euid != euid_arg) ||
+-        (ruid_arg != -1 && ruid != ruid_arg)) {
+-        PyErr_SetString(PyExc_OverflowError, "user id too big");
++    if (!PyArg_ParseTuple(args, "O&O&",
++                        _PyArg_ParseUid, &ruid,
++                        _PyArg_ParseUid, &euid))
+         return NULL;
+-    }
+     if (setreuid(ruid, euid) < 0) {
+         return posix_error();
+     } else {
+@@ -6813,23 +6787,11 @@ Set the current process's real and effec
+ static PyObject *
+ posix_setregid (PyObject *self, PyObject *args)
+ {
+-    long rgid_arg, egid_arg;
+     gid_t rgid, egid;
+-    if (!PyArg_ParseTuple(args, "ll", &rgid_arg, &egid_arg))
+-        return NULL;
+-    if (rgid_arg == -1)
+-        rgid = (gid_t)-1;  /* let the compiler choose how -1 fits */
+-    else
+-        rgid = rgid_arg;  /* otherwise, assign from our long */
+-    if (egid_arg == -1)
+-        egid = (gid_t)-1;
+-    else
+-        egid = egid_arg;
+-    if ((egid_arg != -1 && egid != egid_arg) ||
+-        (rgid_arg != -1 && rgid != rgid_arg)) {
+-        PyErr_SetString(PyExc_OverflowError, "group id too big");
++    if (!PyArg_ParseTuple(args, "O&O&",
++                        _PyArg_ParseGid, &rgid,
++                        _PyArg_ParseGid, &egid))
+         return NULL;
+-    }
+     if (setregid(rgid, egid) < 0) {
+         return posix_error();
+     } else {
+@@ -6847,15 +6809,9 @@ Set the current process's group id.");
+ static PyObject *
+ posix_setgid(PyObject *self, PyObject *args)
+ {
+-    long gid_arg;
+     gid_t gid;
+-    if (!PyArg_ParseTuple(args, "l:setgid", &gid_arg))
++    if (!PyArg_ParseTuple(args, "O&:setgid", _PyArg_ParseGid, &gid))
+         return NULL;
+-    gid = gid_arg;
+-    if (gid != gid_arg) {
+-        PyErr_SetString(PyExc_OverflowError, "group id too big");
+-        return NULL;
+-    }
+     if (setgid(gid) < 0)
+         return posix_error();
+     Py_INCREF(Py_None);
+@@ -6888,27 +6844,9 @@ posix_setgroups(PyObject *self, PyObject
+         elem = PySequence_GetItem(groups, i);
+         if (!elem)
+             return NULL;
+-        if (!PyLong_Check(elem)) {
+-            PyErr_SetString(PyExc_TypeError,
+-                            "groups must be integers");
++        if (!_PyArg_ParseGid(elem, &grouplist[i])) {
+             Py_DECREF(elem);
+             return NULL;
+-        } else {
+-            unsigned long x = PyLong_AsUnsignedLong(elem);
+-            if (PyErr_Occurred()) {
+-                PyErr_SetString(PyExc_TypeError,
+-                                "group id too big");
+-                Py_DECREF(elem);
+-                return NULL;
+-            }
+-            grouplist[i] = x;
+-            /* read back the value to see if it fitted in gid_t */
+-            if (grouplist[i] != x) {
+-                PyErr_SetString(PyExc_TypeError,
+-                                "group id too big");
+-                Py_DECREF(elem);
+-                return NULL;
+-            }
+         }
+         Py_DECREF(elem);
+     }
+@@ -10388,9 +10326,11 @@ Set the current process's real, effectiv
+ static PyObject*
+ posix_setresuid (PyObject *self, PyObject *args)
+ {
+-    /* We assume uid_t is no larger than a long. */
+-    long ruid, euid, suid;
+-    if (!PyArg_ParseTuple(args, "lll", &ruid, &euid, &suid))
++    uid_t ruid, euid, suid;
++    if (!PyArg_ParseTuple(args, "O&O&O&",
++                          _PyArg_ParseUid, &ruid,
++                          _PyArg_ParseUid, &euid,
++                          _PyArg_ParseUid, &suid))
+         return NULL;
+     if (setresuid(ruid, euid, suid) < 0)
+         return posix_error();
+@@ -10406,9 +10346,11 @@ Set the current process's real, effectiv
+ static PyObject*
+ posix_setresgid (PyObject *self, PyObject *args)
+ {
+-    /* We assume uid_t is no larger than a long. */
+-    long rgid, egid, sgid;
+-    if (!PyArg_ParseTuple(args, "lll", &rgid, &egid, &sgid))
++    gid_t rgid, egid, sgid;
++    if (!PyArg_ParseTuple(args, "O&O&O&",
++                          _PyArg_ParseGid, &rgid,
++                          _PyArg_ParseGid, &egid,
++                          _PyArg_ParseGid, &sgid))
+         return NULL;
+     if (setresgid(rgid, egid, sgid) < 0)
+         return posix_error();
+@@ -10425,14 +10367,13 @@ static PyObject*
+ posix_getresuid (PyObject *self, PyObject *noargs)
+ {
+     uid_t ruid, euid, suid;
+-    long l_ruid, l_euid, l_suid;
++    PyObject *obj_ruid, *obj_euid, *obj_suid;
+     if (getresuid(&ruid, &euid, &suid) < 0)
+         return posix_error();
+-    /* Force the values into long's as we don't know the size of uid_t. */
+-    l_ruid = ruid;
+-    l_euid = euid;
+-    l_suid = suid;
+-    return Py_BuildValue("(lll)", l_ruid, l_euid, l_suid);
++    obj_ruid = _PyObject_FromUid(ruid);
++    obj_euid = _PyObject_FromUid(euid);
++    obj_suid = _PyObject_FromUid(suid);
++    return Py_BuildValue("(NNN)", obj_ruid, obj_euid, obj_suid);
+ }
+ #endif
+@@ -10445,14 +10386,13 @@ static PyObject*
+ posix_getresgid (PyObject *self, PyObject *noargs)
+ {
+     uid_t rgid, egid, sgid;
+-    long l_rgid, l_egid, l_sgid;
++    PyObject *obj_rgid, *obj_egid, *obj_sgid;
+     if (getresgid(&rgid, &egid, &sgid) < 0)
+         return posix_error();
+-    /* Force the values into long's as we don't know the size of uid_t. */
+-    l_rgid = rgid;
+-    l_egid = egid;
+-    l_sgid = sgid;
+-    return Py_BuildValue("(lll)", l_rgid, l_egid, l_sgid);
++    obj_rgid = _PyObject_FromGid(rgid);
++    obj_egid = _PyObject_FromGid(egid);
++    obj_sgid = _PyObject_FromGid(sgid);
++    return Py_BuildValue("(NNN)", obj_rgid, obj_egid, obj_sgid);
+ }
+ #endif
+diff -up Python-3.3.0b1/Modules/pwdmodule.c.uid-gid-overflows Python-3.3.0b1/Modules/pwdmodule.c
+--- Python-3.3.0b1/Modules/pwdmodule.c.uid-gid-overflows       2012-06-26 16:19:54.000000000 -0400
++++ Python-3.3.0b1/Modules/pwdmodule.c 2012-07-20 14:21:46.861688675 -0400
+@@ -74,8 +74,8 @@ mkpwent(struct passwd *p)
+ #else
+     SETS(setIndex++, p->pw_passwd);
+ #endif
+-    SETI(setIndex++, p->pw_uid);
+-    SETI(setIndex++, p->pw_gid);
++    PyStructSequence_SET_ITEM(v, setIndex++, _PyObject_FromUid(p->pw_uid));
++    PyStructSequence_SET_ITEM(v, setIndex++, _PyObject_FromGid(p->pw_gid));
+ #ifdef __VMS
+     SETS(setIndex++, "");
+ #else
+@@ -104,13 +104,14 @@ See help(pwd) for more on password datab
+ static PyObject *
+ pwd_getpwuid(PyObject *self, PyObject *args)
+ {
+-    unsigned int uid;
++    uid_t uid;
+     struct passwd *p;
+-    if (!PyArg_ParseTuple(args, "I:getpwuid", &uid))
++    if (!PyArg_ParseTuple(args, "O&:getpwuid",
++                          _PyArg_ParseUid, &uid))
+         return NULL;
+     if ((p = getpwuid(uid)) == NULL) {
+         PyErr_Format(PyExc_KeyError,
+-                     "getpwuid(): uid not found: %d", uid);
++                     "getpwuid(): uid not found: %lu", (unsigned long)uid);
+         return NULL;
+     }
+     return mkpwent(p);
+diff -up Python-3.3.0b1/Python/getargs.c.uid-gid-overflows Python-3.3.0b1/Python/getargs.c
+--- Python-3.3.0b1/Python/getargs.c.uid-gid-overflows  2012-06-26 16:19:57.000000000 -0400
++++ Python-3.3.0b1/Python/getargs.c    2012-07-20 14:21:46.861688675 -0400
+@@ -4,6 +4,7 @@
+ #include "Python.h"
+ #include <ctype.h>
++#include <limits.h>
+ #ifdef __cplusplus
+@@ -1807,6 +1808,102 @@ _PyArg_NoKeywords(const char *funcname, 
+                     funcname);
+     return 0;
+ }
++
++PyObject *
++_PyObject_FromUid(uid_t uid)
++{
++    return PyLong_FromUnsignedLong((uid_t)uid);
++}
++
++PyObject *
++_PyObject_FromGid(gid_t gid)
++{
++    return PyLong_FromUnsignedLong((gid_t)gid);
++}
++
++int
++_PyArg_ParseUid(PyObject *in_obj, uid_t *out_uid)
++{
++    PyObject *index, *number = NULL;
++    long sl;
++    unsigned long ul;
++
++    assert(out_uid);
++
++    index = PyNumber_Index(in_obj);
++    if (index != NULL) {
++        number = PyNumber_Long(index);
++        Py_DECREF(index);
++    }
++    if (number == NULL) {
++        PyErr_SetString(PyExc_TypeError, "user id must be integer");
++        return 0;
++    }
++
++    /* Special case: support -1 (e.g. for use by chown) */
++    sl = PyLong_AsLong(number);
++    if (PyErr_Occurred()) {
++        PyErr_Clear();
++    } else if (sl == -1) {
++        Py_DECREF(number);
++        *out_uid = (uid_t)-1;
++        return 1;
++    }
++
++    /* Otherwise, it must be >= 0 */
++    ul = PyLong_AsUnsignedLong(number);
++    Py_DECREF(number);
++    *out_uid = ul;
++    /* read back the value to see if it fitted in uid_t */
++    if (PyErr_Occurred() || *out_uid != ul) {
++        PyErr_SetString(PyExc_OverflowError,
++                      "user id is not in range(-1, 2^32-1)");
++      return 0;
++    }
++    return 1;
++}
++
++int
++_PyArg_ParseGid(PyObject *in_obj, gid_t *out_gid)
++{
++    PyObject *index, *number = NULL;
++    long sl;
++    unsigned long ul;
++
++    assert(out_gid);
++
++    index = PyNumber_Index(in_obj);
++    if (index != NULL) {
++        number = PyNumber_Long(index);
++      Py_DECREF(index);
++    }
++    if (number == NULL) {
++        PyErr_SetString(PyExc_TypeError, "group id must be integer");
++      return 0;
++    }
++
++    /* Special case: support -1 (e.g. for use by chown) */
++    sl = PyLong_AsLong(number);
++    if (PyErr_Occurred()) {
++        PyErr_Clear();
++    } else if (sl == -1) {
++        Py_DECREF(number);
++      *out_gid = (gid_t)-1;
++      return 1;
++    }
++
++    ul = PyLong_AsUnsignedLong(number);
++    Py_DECREF(number);
++    *out_gid = ul;
++    /* read back the value to see if it fitted in gid_t */
++    if (PyErr_Occurred() || *out_gid != ul) {
++        PyErr_SetString(PyExc_OverflowError,
++                      "group id is not in range(-1, 2^32-1)");
++      return 0;
++    }
++    return 1;
++}
++
+ #ifdef __cplusplus
+ };
+ #endif
diff --git a/python3/patches/00160-disable-test_fs_holes-in-rpm-build.patch b/python3/patches/00160-disable-test_fs_holes-in-rpm-build.patch
new file mode 100644 (file)
index 0000000..9fa91d5
--- /dev/null
@@ -0,0 +1,11 @@
+diff -up cpython-59223da36dec/Lib/test/test_posix.py.disable-test_fs_holes-in-rpm-build cpython-59223da36dec/Lib/test/test_posix.py
+--- cpython-59223da36dec/Lib/test/test_posix.py.disable-test_fs_holes-in-rpm-build     2012-08-07 17:15:59.000000000 -0400
++++ cpython-59223da36dec/Lib/test/test_posix.py        2012-08-07 17:16:53.528330330 -0400
+@@ -973,6 +973,7 @@ class PosixTester(unittest.TestCase):
+         posix.RTLD_GLOBAL
+         posix.RTLD_LOCAL
++    @unittest._skipInRpmBuild('running kernel may not match kernel in chroot')
+     @unittest.skipUnless(hasattr(os, 'SEEK_HOLE'),
+                          "test needs an OS that reports file holes")
+     def test_fs_holes(self):
diff --git a/python3/patches/00163-disable-parts-of-test_socket-in-rpm-build.patch b/python3/patches/00163-disable-parts-of-test_socket-in-rpm-build.patch
new file mode 100644 (file)
index 0000000..0e28036
--- /dev/null
@@ -0,0 +1,11 @@
+diff -up Python-3.3.0b1/Lib/test/test_socket.py.disable-test_socket-in-rpm-builds Python-3.3.0b1/Lib/test/test_socket.py
+--- Python-3.3.0b1/Lib/test/test_socket.py.disable-test_socket-in-rpm-builds   2012-07-24 15:02:30.823355067 -0400
++++ Python-3.3.0b1/Lib/test/test_socket.py     2012-07-24 15:08:13.021354999 -0400
+@@ -2188,6 +2188,7 @@ class RecvmsgGenericStreamTests(RecvmsgG
+     # Tests which require a stream socket and can use either recvmsg()
+     # or recvmsg_into().
++    @unittest._skipInRpmBuild('fails intermittently when run within Koji')
+     def testRecvmsgEOF(self):
+         # Receive end-of-stream indicator (b"", peer socket closed).
+         msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock, 1024)
diff --git a/python3/patches/00164-disable-interrupted_write-tests-on-ppc.patch b/python3/patches/00164-disable-interrupted_write-tests-on-ppc.patch
new file mode 100644 (file)
index 0000000..0db8092
--- /dev/null
@@ -0,0 +1,52 @@
+diff -up Python-3.3.0b1/Lib/test/test_exceptions.py.846849 Python-3.3.0b1/Lib/test/test_exceptions.py
+--- Python-3.3.0b1/Lib/test/test_exceptions.py.846849  2012-06-26 22:19:47.000000000 +0200
++++ Python-3.3.0b1/Lib/test/test_exceptions.py 2012-08-13 17:41:28.845403486 +0200
+@@ -401,6 +401,7 @@ class ExceptionTests(unittest.TestCase):
+         self.assertIsNone(e.__context__)
+         self.assertIsNone(e.__cause__)
++    @unittest.skip('rhbz#846849')
+     def testChainingDescriptors(self):
+         try:
+             raise Exception()
+diff -up Python-3.3.0b1/Lib/test/test_io.py.846849 Python-3.3.0b1/Lib/test/test_io.py
+--- Python-3.3.0b1/Lib/test/test_io.py.846849  2012-06-26 22:19:48.000000000 +0200
++++ Python-3.3.0b1/Lib/test/test_io.py 2012-08-13 17:41:28.846403451 +0200
+@@ -2938,12 +2938,15 @@ class SignalsTest(unittest.TestCase):
+                 if e.errno != errno.EBADF:
+                     raise
++    @unittest.skip('rhbz#846849')
+     def test_interrupted_write_unbuffered(self):
+         self.check_interrupted_write(b"xy", b"xy", mode="wb", buffering=0)
++    @unittest.skip('rhbz#846849')
+     def test_interrupted_write_buffered(self):
+         self.check_interrupted_write(b"xy", b"xy", mode="wb")
++    @unittest.skip('rhbz#846849')
+     def test_interrupted_write_text(self):
+         self.check_interrupted_write("xy", b"xy", mode="w", encoding="ascii")
+diff -up Python-3.3.0b1/Lib/test/test_raise.py.846849 Python-3.3.0b1/Lib/test/test_raise.py
+--- Python-3.3.0b1/Lib/test/test_raise.py.846849       2012-08-13 17:42:16.719714213 +0200
++++ Python-3.3.0b1/Lib/test/test_raise.py      2012-08-13 17:43:02.544097272 +0200
+@@ -151,6 +151,7 @@ class TestRaise(unittest.TestCase):
+ class TestCause(unittest.TestCase):
++    @unittest.skip('rhbz#846849')
+     def testCauseSyntax(self):
+         try:
+             try:
+diff -up Python-3.3.0b1/Lib/test/test_traceback.py.846849 Python-3.3.0b1/Lib/test/test_traceback.py
+--- Python-3.3.0b1/Lib/test/test_traceback.py.846849   2012-08-13 17:44:19.714374275 +0200
++++ Python-3.3.0b1/Lib/test/test_traceback.py  2012-08-13 17:44:43.515534435 +0200
+@@ -246,6 +246,7 @@ class BaseExceptionReportingTests:
+         self.check_zero_div(blocks[0])
+         self.assertIn('inner_raise() # Marker', blocks[2])
++    @unittest.skip('rhbz#846849')
+     def test_context_suppression(self):
+         try:
+             try:
diff --git a/python3/patches/05000-autotool-intermediates.patch b/python3/patches/05000-autotool-intermediates.patch
new file mode 100644 (file)
index 0000000..bd9aeca
--- /dev/null
@@ -0,0 +1,73 @@
+diff -up ./configure.autotool-intermediates ./configure
+--- ./configure.autotool-intermediates 2012-08-07 17:21:25.249311751 -0400
++++ ./configure        2012-08-07 17:21:35.503311049 -0400
+@@ -779,6 +779,8 @@ with_thread
+ enable_ipv6
+ with_doc_strings
+ with_tsc
++with_count_allocs
++with_call_profile
+ with_pymalloc
+ with_valgrind
+ with_systemtap
+@@ -1457,6 +1459,8 @@ Optional Packages:
+                           deprecated; use --with(out)-threads
+   --with(out)-doc-strings disable/enable documentation strings
+   --with(out)-tsc         enable/disable timestamp counter profile
++  --with(out)count-allocs  enable/disable per-type instance accounting
++  --with(out)-call-profile  enable/disable statistics on function call invocation
+   --with(out)-pymalloc    disable/enable specialized mallocs
+   --with-valgrind         Enable Valgrind support
+   --with(out)-systemtap   disable/enable SystemTap support
+@@ -10017,6 +10021,50 @@ $as_echo "no" >&6; }
+ fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-count-allocs" >&5
++$as_echo_n "checking for --with-count-allocs... " >&6; }
++
++# Check whether --with-count-allocs was given.
++if test "${with_count_allocs+set}" = set; then :
++  withval=$with_count_allocs;
++if test "$withval" != no
++then
++
++$as_echo "#define COUNT_ALLOCS 1" >>confdefs.h
++
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-call-profile" >&5
++$as_echo_n "checking for --with-call-profile... " >&6; }
++
++# Check whether --with-call-profile was given.
++if test "${with_call_profile+set}" = set; then :
++  withval=$with_call_profile;
++if test "$withval" != no
++then
++
++$as_echo "#define CALL_PROFILE 1" >>confdefs.h
++
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
+ # Check for Python-specific malloc support
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-pymalloc" >&5
+ $as_echo_n "checking for --with-pymalloc... " >&6; }
+diff -up ./pyconfig.h.in.autotool-intermediates ./pyconfig.h.in
diff --git a/python3/patches/Python-3.1.1-rpath.patch b/python3/patches/Python-3.1.1-rpath.patch
new file mode 100644 (file)
index 0000000..1493af2
--- /dev/null
@@ -0,0 +1,20 @@
+diff -up Python-3.1.1/Lib/distutils/unixccompiler.py.rpath Python-3.1.1/Lib/distutils/unixccompiler.py
+--- Python-3.1.1/Lib/distutils/unixccompiler.py.rpath  2009-09-04 17:29:34.000000000 -0400
++++ Python-3.1.1/Lib/distutils/unixccompiler.py        2009-09-04 17:49:54.000000000 -0400
+@@ -141,6 +141,16 @@ class UnixCCompiler(CCompiler):
+     if sys.platform == "cygwin":
+         exe_extension = ".exe"
++    def _fix_lib_args(self, libraries, library_dirs, runtime_library_dirs):
++        """Remove standard library path from rpath"""
++        libraries, library_dirs, runtime_library_dirs = super(
++            self.__class__, self)._fix_lib_args(libraries, library_dirs,
++            runtime_library_dirs)
++        libdir = sysconfig.get_config_var('LIBDIR')
++        if runtime_library_dirs and (libdir in runtime_library_dirs):
++            runtime_library_dirs.remove(libdir)
++        return libraries, library_dirs, runtime_library_dirs
++
+     def preprocess(self, source, output_file=None, macros=None,
+                    include_dirs=None, extra_preargs=None, extra_postargs=None):
+         fixed_args = self._fix_compile_args(None, macros, include_dirs)
diff --git a/python3/patches/python-3.2.1-fix-test-subprocess-with-nonreadable-path-dir.patch b/python3/patches/python-3.2.1-fix-test-subprocess-with-nonreadable-path-dir.patch
new file mode 100644 (file)
index 0000000..6f43c72
--- /dev/null
@@ -0,0 +1,12 @@
+diff -up Python-3.2.1/Lib/test/test_subprocess.py.non-readable-path Python-3.2.1/Lib/test/test_subprocess.py
+--- Python-3.2.1/Lib/test/test_subprocess.py.non-readable-path 2011-07-09 02:58:51.000000000 -0400
++++ Python-3.2.1/Lib/test/test_subprocess.py   2011-07-11 11:34:16.284426005 -0400
+@@ -618,7 +618,7 @@ class ProcessTestCase(BaseTestCase):
+         for i in range(1024):
+             # Windows raises IOError.  Others raise OSError.
+             with self.assertRaises(EnvironmentError) as c:
+-                subprocess.Popen(['nonexisting_i_hope'],
++                subprocess.Popen(['/usr/bin/nonexisting_i_hope'],
+                                  stdout=subprocess.PIPE,
+                                  stderr=subprocess.PIPE)
+             # ignore errors that indicate the command was not found
diff --git a/python3/python-3.3.0b1-lib64.patch b/python3/python-3.3.0b1-lib64.patch
new file mode 100644 (file)
index 0000000..5ae03aa
--- /dev/null
@@ -0,0 +1,200 @@
+diff -up cpython-59223da36dec/Lib/distutils/command/install.py.lib64 cpython-59223da36dec/Lib/distutils/command/install.py
+--- cpython-59223da36dec/Lib/distutils/command/install.py.lib64        2012-08-07 06:10:57.000000000 -0400
++++ cpython-59223da36dec/Lib/distutils/command/install.py      2012-08-07 16:41:00.573477549 -0400
+@@ -45,14 +45,14 @@ else:
+ INSTALL_SCHEMES = {
+     'unix_prefix': {
+         'purelib': '$base/lib/python$py_version_short/site-packages',
+-        'platlib': '$platbase/lib/python$py_version_short/site-packages',
++        'platlib': '$platbase/lib64/python$py_version_short/site-packages',
+         'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
+         'scripts': '$base/bin',
+         'data'   : '$base',
+         },
+     'unix_home': {
+         'purelib': '$base/lib/python',
+-        'platlib': '$base/lib/python',
++        'platlib': '$base/lib64/python',
+         'headers': '$base/include/python/$dist_name',
+         'scripts': '$base/bin',
+         'data'   : '$base',
+diff -up cpython-59223da36dec/Lib/distutils/sysconfig.py.lib64 cpython-59223da36dec/Lib/distutils/sysconfig.py
+--- cpython-59223da36dec/Lib/distutils/sysconfig.py.lib64      2012-08-07 06:10:57.000000000 -0400
++++ cpython-59223da36dec/Lib/distutils/sysconfig.py    2012-08-07 16:41:00.573477549 -0400
+@@ -139,8 +139,12 @@ def get_python_lib(plat_specific=0, stan
+             prefix = plat_specific and EXEC_PREFIX or PREFIX
+     if os.name == "posix":
++        if plat_specific or standard_lib:
++            lib = "lib64"
++        else:
++            lib = "lib"
+         libpython = os.path.join(prefix,
+-                                 "lib", "python" + get_python_version())
++                                 lib, "python" + get_python_version())
+         if standard_lib:
+             return libpython
+         else:
+diff -up cpython-59223da36dec/Lib/site.py.lib64 cpython-59223da36dec/Lib/site.py
+--- cpython-59223da36dec/Lib/site.py.lib64     2012-08-07 06:10:57.000000000 -0400
++++ cpython-59223da36dec/Lib/site.py   2012-08-07 16:41:00.573477549 -0400
+@@ -303,12 +303,16 @@ def getsitepackages(prefixes=None):
+         if sys.platform in ('os2emx', 'riscos'):
+             sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
+         elif os.sep == '/':
++            sitepackages.append(os.path.join(prefix, "lib64",
++                                        "python" + sys.version[:3],
++                                        "site-packages"))
+             sitepackages.append(os.path.join(prefix, "lib",
+                                         "python" + sys.version[:3],
+                                         "site-packages"))
+             sitepackages.append(os.path.join(prefix, "lib", "site-python"))
+         else:
+             sitepackages.append(prefix)
++            sitepackages.append(os.path.join(prefix, "lib64", "site-packages"))
+             sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
+         if sys.platform == "darwin":
+             # for framework builds *only* we add the standard Apple
+diff -up cpython-59223da36dec/Lib/sysconfig.py.lib64 cpython-59223da36dec/Lib/sysconfig.py
+--- cpython-59223da36dec/Lib/sysconfig.py.lib64        2012-08-07 06:10:57.000000000 -0400
++++ cpython-59223da36dec/Lib/sysconfig.py      2012-08-07 16:41:00.574477549 -0400
+@@ -21,10 +21,10 @@ __all__ = [
+ _INSTALL_SCHEMES = {
+     'posix_prefix': {
+-        'stdlib': '{installed_base}/lib/python{py_version_short}',
+-        'platstdlib': '{platbase}/lib/python{py_version_short}',
++        'stdlib': '{installed_base}/lib64/python{py_version_short}',
++        'platstdlib': '{platbase}/lib64/python{py_version_short}',
+         'purelib': '{base}/lib/python{py_version_short}/site-packages',
+-        'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
++        'platlib': '{platbase}/lib64/python{py_version_short}/site-packages',
+         'include':
+             '{installed_base}/include/python{py_version_short}{abiflags}',
+         'platinclude':
+@@ -81,10 +81,10 @@ _INSTALL_SCHEMES = {
+         'data': '{userbase}',
+         },
+     'posix_user': {
+-        'stdlib': '{userbase}/lib/python{py_version_short}',
+-        'platstdlib': '{userbase}/lib/python{py_version_short}',
++        'stdlib': '{userbase}/lib64/python{py_version_short}',
++        'platstdlib': '{userbase}/lib64/python{py_version_short}',
+         'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
+-        'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
++        'platlib': '{userbase}/lib64/python{py_version_short}/site-packages',
+         'include': '{userbase}/include/python{py_version_short}',
+         'scripts': '{userbase}/bin',
+         'data': '{userbase}',
+diff -up cpython-59223da36dec/Lib/test/test_site.py.lib64 cpython-59223da36dec/Lib/test/test_site.py
+--- cpython-59223da36dec/Lib/test/test_site.py.lib64   2012-08-07 06:10:57.000000000 -0400
++++ cpython-59223da36dec/Lib/test/test_site.py 2012-08-07 16:41:00.574477549 -0400
+@@ -239,12 +239,15 @@ class HelperFunctionsTests(unittest.Test
+             self.assertEqual(dirs[2], wanted)
+         elif os.sep == '/':
+             # OS X non-framwework builds, Linux, FreeBSD, etc
+-            self.assertEqual(len(dirs), 2)
+-            wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
++            self.assertEqual(len(dirs), 3)
++            wanted = os.path.join('xoxo', 'lib64', 'python' + sys.version[:3],
+                                   'site-packages')
+             self.assertEqual(dirs[0], wanted)
+-            wanted = os.path.join('xoxo', 'lib', 'site-python')
++            wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
++                                  'site-packages')
+             self.assertEqual(dirs[1], wanted)
++            wanted = os.path.join('xoxo', 'lib', 'site-python')
++            self.assertEqual(dirs[2], wanted)
+         else:
+             # other platforms
+             self.assertEqual(len(dirs), 2)
+diff -up cpython-59223da36dec/Makefile.pre.in.lib64 cpython-59223da36dec/Makefile.pre.in
+--- cpython-59223da36dec/Makefile.pre.in.lib64 2012-08-07 16:41:00.557477550 -0400
++++ cpython-59223da36dec/Makefile.pre.in       2012-08-07 16:41:00.575477549 -0400
+@@ -108,7 +108,7 @@ LIBDIR=            @libdir@
+ MANDIR=               @mandir@
+ INCLUDEDIR=   @includedir@
+ CONFINCLUDEDIR=       $(exec_prefix)/include
+-SCRIPTDIR=    $(prefix)/lib
++SCRIPTDIR=    $(prefix)/lib64
+ ABIFLAGS=     @ABIFLAGS@
+ # Detailed destination directories
+diff -up cpython-59223da36dec/Modules/getpath.c.lib64 cpython-59223da36dec/Modules/getpath.c
+--- cpython-59223da36dec/Modules/getpath.c.lib64       2012-08-07 06:10:57.000000000 -0400
++++ cpython-59223da36dec/Modules/getpath.c     2012-08-07 16:41:00.575477549 -0400
+@@ -122,8 +122,8 @@
+ #endif
+ #ifndef PYTHONPATH
+-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
+-              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
++#define PYTHONPATH PREFIX "/lib64/python" VERSION ":" \
++              EXEC_PREFIX "/lib64/python" VERSION "/lib-dynload"
+ #endif
+ #ifndef LANDMARK
+@@ -135,7 +135,7 @@ static wchar_t exec_prefix[MAXPATHLEN+1]
+ static wchar_t progpath[MAXPATHLEN+1];
+ static wchar_t *module_search_path = NULL;
+ static int module_search_path_malloced = 0;
+-static wchar_t *lib_python = L"lib/python" VERSION;
++static wchar_t *lib_python = L"lib64/python" VERSION;
+ static void
+ reduce(wchar_t *dir)
+@@ -677,7 +677,7 @@ calculate_path(void)
+     }
+     else
+         wcsncpy(zip_path, _prefix, MAXPATHLEN);
+-    joinpath(zip_path, L"lib/python00.zip");
++    joinpath(zip_path, L"lib64/python00.zip");
+     bufsz = wcslen(zip_path);   /* Replace "00" with version */
+     zip_path[bufsz - 6] = VERSION[0];
+     zip_path[bufsz - 5] = VERSION[2];
+@@ -687,7 +687,7 @@ calculate_path(void)
+             fprintf(stderr,
+                 "Could not find platform dependent libraries <exec_prefix>\n");
+         wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
+-        joinpath(exec_prefix, L"lib/lib-dynload");
++        joinpath(exec_prefix, L"lib64/lib-dynload");
+     }
+     /* If we found EXEC_PREFIX do *not* reduce it!  (Yet.) */
+diff -up cpython-59223da36dec/setup.py.lib64 cpython-59223da36dec/setup.py
+--- cpython-59223da36dec/setup.py.lib64        2012-08-07 06:10:57.000000000 -0400
++++ cpython-59223da36dec/setup.py      2012-08-07 16:41:32.153475390 -0400
+@@ -438,7 +438,7 @@ class PyBuildExt(build_ext):
+         # directories (i.e. '.' and 'Include') must be first.  See issue
+         # 10520.
+         if not cross_compiling:
+-            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
++            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64')
+             add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+         # only change this for cross builds for 3.3, issues on Mageia
+         if cross_compiling:
+@@ -708,11 +708,11 @@ class PyBuildExt(build_ext):
+             elif curses_library:
+                 readline_libs.append(curses_library)
+             elif self.compiler.find_library_file(lib_dirs +
+-                                                     ['/usr/lib/termcap'],
++                                                     ['/usr/lib64/termcap'],
+                                                      'termcap'):
+                 readline_libs.append('termcap')
+             exts.append( Extension('readline', ['readline.c'],
+-                                   library_dirs=['/usr/lib/termcap'],
++                                   library_dirs=['/usr/lib64/termcap'],
+                                    extra_link_args=readline_extra_link_args,
+                                    libraries=readline_libs) )
+         else:
+@@ -749,8 +749,8 @@ class PyBuildExt(build_ext):
+             if krb5_h:
+                 ssl_incs += krb5_h
+         ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
+-                                     ['/usr/local/ssl/lib',
+-                                      '/usr/contrib/ssl/lib/'
++                                     ['/usr/local/ssl/lib64',
++                                      '/usr/contrib/ssl/lib64/'
+                                      ] )
+         if (ssl_incs is not None and
diff --git a/python3/python3.nm b/python3/python3.nm
new file mode 100644 (file)
index 0000000..51ddda9
--- /dev/null
@@ -0,0 +1,224 @@
+###############################################################################
+# IPFire.org    - An Open Source Firewall Solution                            #
+# Copyright (C) - IPFire Development Team <info@ipfire.org>                   #
+###############################################################################
+
+name       = python3
+major_ver  = 3.3
+version    = %{major_ver}.0
+release    = 1
+thisapp    = Python-%{version}
+
+groups     = Development/Languages
+url        = http://www.python.org
+license    = Python
+summary    = Version 3 of the Python programming language.
+
+description
+       Python is an interpreted, interactive, object-oriented programming
+       language often compared to Tcl, Perl, Scheme or Java. Python includes
+       modules, classes, exceptions, very high level dynamic data types and
+       dynamic typing. Python supports interfaces to many system calls and
+       libraries, as well as to various windowing systems.
+end
+
+source_dl  = http://python.org/ftp/python/%{version}/
+sources    = %{thisapp}.tar.xz
+
+pylibdir   = %{libdir}/python%{major_ver}
+dynload_dir= %{pylibdir}/lib-dynload
+
+build
+       requires
+               autoconf
+               automake
+               bzip2
+               bzip2-devel
+               db4-devel >= 1:4.8
+               expat-devel >= 2.1.0
+               findutils
+               gdbm-devel >= 1.10
+               gcc-c++
+               glibc-devel
+               gmp-devel
+               libffi-devel
+               libGL-devel
+               libX11-devel
+               ncurses-devel
+               openssl-devel
+               pkg-config
+               readline-devel
+               sqlite-devel
+               tar
+               tcl-devel
+               util-linux
+               xz-devel
+               zlib-devel
+       end
+
+       export CFLAGS   += -D_GNU_SOURCE -fwrapv
+       export CXXFLAGS += -D_GNU_SOURCE -fwrapv
+       export OPT       = %{CFLAGS}
+       export LINKCC    = gcc
+
+       prepare_cmds
+               # Apply patches for x86_64.
+               if [ "$(uname -m)" = "x86_64" ]; then
+                       patch -Np1 -i %{DIR_SOURCE}/python-3.3.0b1-lib64.patch
+               fi
+
+               # Remove embedded copies of expat and libffi
+               rm -rf Modules/{expat,zlib}
+               rm -rf Modules/_ctypes/{darwin,libffi,libffi_arm_wince,libffi_msvc,libffi_osx}
+
+               # Make all source files owned by root.
+               chown root.root -R .
+
+               autoreconf --force
+       end
+
+       configure_options += \
+               --enable-ipv6 \
+               --with-computed-gotos=yes \
+               --with-dbmliborder=gdbm:ndbm:bdb \
+               --with-system-expat \
+               --with-system-ffi \
+               --enable-shared
+
+       #test
+       #       make test
+       #end
+
+       install_cmds
+               install -d -m 0755 %{BUILDROOT}%{pylibdir}/site-packages/__pycache__
+               install -d -m 0755 %{BUILDROOT}/usr/lib/python${major_ver}/site-packages/__pycache__
+
+               # Development tools
+               mv -v %{BUILDROOT}%{bindir}/{,python3-}2to3
+               install -m 755 -d %{BUILDROOT}%{pylibdir}/Tools
+               install Tools/README %{BUILDROOT}%{pylibdir}/Tools/
+               cp -avr Tools/{freeze,i18n,pynche,scripts} %{BUILDROOT}%{pylibdir}/Tools/
+
+               rm -vf %{BUILDROOT}%{pylibdir}/email/test/data/audiotest.au %{BUILDROOT}%{pylibdir}/test/audiotest.au
+
+               # Switch all shebangs to refer to the specific Python version.
+               LD_LIBRARY_PATH=. ./python Tools/scripts/pathfix.py \
+                       -i "%{bindir}/python%{major_ver}" \
+                       %{BUILDROOT}
+
+               # Remove shebang lines from .py files that aren't executable, and
+               # remove executability from .py files that don't have a shebang line:
+               find %{BUILDROOT} -name \*.py \
+                       \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \
+                       -print -exec sed -i '1d' {} \; \) -o \( \
+                       -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
+                       -exec chmod a-x {} \; \) \)
+
+               # .xpm and .xbm files should not be executable:
+               find %{BUILDROOT} \
+                       \( -name \*.xbm -o -name \*.xpm -o -name \*.xpm.1 \) \
+                       -exec chmod a-x {} \;
+
+               # Remove executable flag from files that shouldn't have it:
+               chmod a-x \
+                       %{BUILDROOT}%{pylibdir}/distutils/tests/Setup.sample \
+                       %{BUILDROOT}%{pylibdir}/Tools/README
+
+               # Get rid of DOS batch files:
+               find %{BUILDROOT} -name \*.bat -exec rm {} \;
+
+               # Get rid of backup files:
+               find %{BUILDROOT}/ -name "*~" -exec rm -f {} \;
+               rm -f %{BUILDROOT}%{pylibdir}/LICENSE.txt
+
+               # Junk, no point in putting in -test sub-pkg
+               rm -f %{BUILDROOT}%{pylibdir}/idlelib/testcode.py*
+
+               # Fix end-of-line encodings:
+               find %{BUILDROOT}/ -name \*.py -exec sed -i 's/\r//' {} \;
+
+               # Do bytecompilation with the newly installed interpreter.
+               # compile *.pyo
+               find %{BUILDROOT} -type f -a -name "*.py" -print0 | \
+                       LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \
+                       PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \
+                       xargs -0 %{BUILDROOT}%{bindir}/python%{major_ver} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{BUILDROOT}")[2]) for f in sys.argv[1:]]' || :
+               # compile *.pyc
+               find %{BUILDROOT} -type f -a -name "*.py" -print0 | \
+                       LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \
+                       PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \
+                       xargs -0 %{BUILDROOT}%{bindir}/python%{major_ver} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{BUILDROOT}")[2], optimize=0) for f in sys.argv[1:]]' || :
+
+               # Fixup permissions for shared libraries from non-standard 555 to standard 755:
+               find %{BUILDROOT} -perm 555 -exec chmod 755 {} \;
+       end
+end
+
+packages
+       package %{name}
+               # Define python-abi manually.
+               provides
+                       python-abi = %{major_ver}
+               end
+
+               requires
+                       %{name}-libs = %{thisver}
+               end
+       end
+
+       package %{name}-libs
+               template LIBS
+
+               requires
+                       expat >= 2.1.0
+               end
+
+               files += %{dynload_dir}
+       end
+
+       package %{name}-devel
+               template DEVEL
+
+               requires += %{name}-libs = %{thisver}
+
+               files += \
+                       !%{libdir}/python*/config*/Makefile \
+                       !%{includedir}/python*/pyconfig.h
+       end
+
+       package %{name}-test
+               requires
+                       %{name} = %{thisver}
+               end
+
+               files
+                       %{pylibdir}/ctypes/test
+                       %{pylibdir}/distutils/testi
+                       %{pylibdir}/lib2to3/test
+                       %{pylibdir}/sqlite3/test
+                       %{pylibdir}/test
+                       %{pylibdir}/tkinter/test
+                       %{pylibdir}/unittest/test
+                       %{dynload_dir}/_ctypes_test*
+                       %{dynload_dir}/_testbuffer*
+                       %{dynload_dir}/_testcapi*
+               end
+       end
+
+       package %{name}-tools
+               requires
+                       %{name} = %{thisver}
+               end
+
+               files
+                       %{bindir}/python3-2to3
+                       %{bindir}/2to3*
+                       %{bindir}/idle*
+                       %{pylibdir}/Tools
+               end
+       end
+
+       package %{name}-debuginfo
+               template DEBUGINFO
+       end
+end
index 1d0dc1b44223d28662627e333baa47a663c70603..901f5d57f8b242febca56a6168dde6e02cf1aa3d 100644 (file)
 
 # are we an interactive shell?
 if [ "$PS1" ]; then
+  if [ -z "$PROMPT_COMMAND" ]; then
     case $TERM in
     xterm*)
-        if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
-            PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
-        else
-            PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
-        fi
-        ;;
+      if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
+          PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
+      else
+          PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
+      fi
+      ;;
     screen)
-        if [ -e /etc/sysconfig/bash-prompt-screen ]; then
-            PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
-        else
-            PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
-        fi
-        ;;
+      if [ -e /etc/sysconfig/bash-prompt-screen ]; then
+          PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
+      else
+          PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
+      fi
+      ;;
     *)
-        [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
-        ;;
+      [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
+      ;;
     esac
-    # Turn on checkwinsize
-    shopt -s checkwinsize
-    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
-    # You might want to have e.g. tty in prompt (e.g. more virtual machines)
-    # and console windows
-    # If you want to do so, just add e.g.
-    # if [ "$PS1" ]; then
-    #   PS1="[\u@\h:\l \W]\\$ "
-    # fi
-    # to your custom modification shell script in /etc/profile.d/ directory
+  fi
+  # Turn on parallel history
+  shopt -s histappend
+  history -a
+  # Turn on checkwinsize
+  shopt -s checkwinsize
+  [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
+  # You might want to have e.g. tty in prompt (e.g. more virtual machines)
+  # and console windows
+  # If you want to do so, just add e.g.
+  # if [ "$PS1" ]; then
+  #   PS1="[\u@\h:\l \W]\\$ "
+  # fi
+  # to your custom modification shell script in /etc/profile.d/ directory
 fi
 
 if ! shopt -q login_shell ; then # We're not a login shell
@@ -73,12 +78,12 @@ if ! shopt -q login_shell ; then # We're not a login shell
             if [ "$PS1" ]; then
                 . "$i"
             else
-                . "$i" >/dev/null 2>&1
+                . "$i" >/dev/null
             fi
         fi
     done
 
     unset i
-    unset pathmunge
+    unset -f pathmunge
 fi
 # vim:ts=4:sw=4
index 0eb5c9911d0a6c646b15430d6d4342e656770fca..a62230088a75c019b983feabac4900b4a69c6307 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = setup
 version    = 3.0
-release    = 5
+release    = 6
 arch       = noarch
 
 groups     = Base Build System/Base
diff --git a/wpa_supplicant/systemd/wpa_supplicant@.service b/wpa_supplicant/systemd/wpa_supplicant@.service
new file mode 100644 (file)
index 0000000..b3bd340
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=wpa_supplicant for %I.
+
+[Service]
+ExecStartPre=/usr/lib/network/helpers/wpa_supplicant-config-helper create %I
+ExecStart=/usr/lib/network/helpers/wpa_supplicant %I
+ExecStopPost=/usr/lib/network/helpers/wpa_supplicant-config-helper remove %I
+PIDFile=/run/wpa_supplicant-%I.pid
+Restart=on-failure
+UtmpIdentifier=%I
+KillMode=process
index 92fac58eaa620b9cc42f44219b447df7a06ae988..41f2ad6374eec1c52affe77d89de70d9f605f120 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = wpa_supplicant
 version    = 1.0
-release    = 1
+release    = 2
 
 groups     = Sytem/Base
 url        = http://hostap.epitest.fi/releases/
@@ -53,6 +53,8 @@ end
 
 packages
        package %{name}
+               requires += network >= 1:005
+       end
 
        package %{name}-debuginfo
                template DEBUGINFO