about summary refs log tree commit diff
path: root/pkgs/misc
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2014-11-05 05:32:41 +0300
committerNikolay Amiantov <ab@fmap.me>2014-11-14 13:51:26 +0300
commitaa548af5a5e997b94df41b1da57232bd10b76612 (patch)
treecb894bc183894209259e388d14960f0482861cff /pkgs/misc
parentf2c3bda151dd37d0913412a7ef6dac46063112a8 (diff)
downloadnixlib-aa548af5a5e997b94df41b1da57232bd10b76612.tar
nixlib-aa548af5a5e997b94df41b1da57232bd10b76612.tar.gz
nixlib-aa548af5a5e997b94df41b1da57232bd10b76612.tar.bz2
nixlib-aa548af5a5e997b94df41b1da57232bd10b76612.tar.lz
nixlib-aa548af5a5e997b94df41b1da57232bd10b76612.tar.xz
nixlib-aa548af5a5e997b94df41b1da57232bd10b76612.tar.zst
nixlib-aa548af5a5e997b94df41b1da57232bd10b76612.zip
cups: update package
Diffstat (limited to 'pkgs/misc')
-rw-r--r--pkgs/misc/cups/default.nix21
-rw-r--r--pkgs/misc/cups/pdf-filter.nix39
-rw-r--r--pkgs/misc/cups/use-initgroups.patch80
3 files changed, 92 insertions, 48 deletions
diff --git a/pkgs/misc/cups/default.nix b/pkgs/misc/cups/default.nix
index c332dc021546..56ccf7bd04ac 100644
--- a/pkgs/misc/cups/default.nix
+++ b/pkgs/misc/cups/default.nix
@@ -1,24 +1,27 @@
-{ stdenv, fetchurl, pkgconfig, zlib, libjpeg, libpng, libtiff, pam, openssl
+{ stdenv, fetchurl, pkgconfig, zlib, pam, openssl
 , dbus, libusb, acl }:
 
-let version = "1.5.4"; in
+let version = "2.0.0"; in
 
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   name = "cups-${version}";
 
-  passthru = { inherit version; };
-
   src = fetchurl {
-    url = "https://www.cups.org/software/${version}/cups-${version}-source.tar.bz2";
-    sha256 = "1rfhlv9b37120d6shngvyrcp99vh4a3lwdkrfanv3sjqid7068w0";
+    url = "https://www.cups.org/software/${version}/${name}-source.tar.bz2";
+    sha256 = "1qjv1w8m3f9lbrnd9wx8gman4sjbgb75svfypd4jkn649b5vpzc3";
   };
 
-  buildInputs = [ pkgconfig zlib libjpeg libpng libtiff libusb ]
+  buildInputs = [ pkgconfig zlib libusb ]
     ++ stdenv.lib.optionals stdenv.isLinux [ pam dbus.libs acl ] ;
 
   propagatedBuildInputs = [ openssl ];
 
-  configureFlags = "--localstatedir=/var --enable-dbus"; # --with-dbusdir
+  patches = [ ./use-initgroups.patch ];
+
+  configureFlags = [ "--localstatedir=/var" "--enable-dbus"
+                     # Workaround for installing systemd path
+                     "--with-systemd=$out/lib/systemd/system"
+                   ];
 
   installFlags =
     [ # Don't try to write in /var at build time.
diff --git a/pkgs/misc/cups/pdf-filter.nix b/pkgs/misc/cups/pdf-filter.nix
deleted file mode 100644
index e99ad03212c2..000000000000
--- a/pkgs/misc/cups/pdf-filter.nix
+++ /dev/null
@@ -1,39 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, cups, poppler }:
-
-stdenv.mkDerivation {
-  name = "cups-pdf-filter-${cups.version}";
-
-  inherit (cups) src;
-
-  buildInputs = [ pkgconfig cups poppler ];
-
-  preConfigure = ''
-    sed -e 's@\.\./cups/$(LIBCUPS)@@' -e 's@$(LIBCUPSIMAGE)@@' -i filter/Makefile
-    '';
-
-  NIX_LDFLAGS="-L${cups}/lib";
-
-  configureFlags = ''
-    --localstatedir=/var --enable-dbus
-    --enable-image --with-pdftops=pdftops'';
-
-  buildPhase = ''
-    cd filter
-    make pdftops
-    '';
-
-  installPhase = ''
-    mkdir -pv $out/lib/cups/filter $out/share/cups/mime
-    cp -v pdftops $out/lib/cups/filter
-    echo >$out/share/cups/mime/pdftops.convs 'application/pdf application/vnd.cups-postscript 66 pdftops'
-    '';
-
-
-  meta = {
-    homepage = http://www.cups.org/;
-    description = "Image and pdf filters for CUPS";
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = [ stdenv.lib.maintainers.urkud ];
-    platforms = stdenv.lib.platforms.linux;
-  };
-}
diff --git a/pkgs/misc/cups/use-initgroups.patch b/pkgs/misc/cups/use-initgroups.patch
new file mode 100644
index 000000000000..3976ce74a8a4
--- /dev/null
+++ b/pkgs/misc/cups/use-initgroups.patch
@@ -0,0 +1,80 @@
+diff -ru3 cups-2.0.0-old/scheduler/cups-exec.c cups-2.0.0/scheduler/cups-exec.c
+--- cups-2.0.0-old/scheduler/cups-exec.c	2014-11-04 19:55:05.734768315 +0300
++++ cups-2.0.0/scheduler/cups-exec.c	2014-11-04 20:24:15.936670878 +0300
+@@ -25,6 +25,7 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <grp.h>
++#include <pwd.h>
+ #include <sys/stat.h>
+ #ifdef HAVE_SANDBOX_H
+ #  include <sandbox.h>
+@@ -55,6 +56,7 @@
+   uid_t		uid = getuid();		/* UID */
+   gid_t		gid = getgid();		/* GID */
+   int		niceval = 0;		/* Nice value */
++  struct passwd *pwd;                   /* User passwd entry */
+ #ifdef HAVE_SANDBOX_H
+   char		*sandbox_error = NULL;	/* Sandbox error, if any */
+ #endif /* HAVE_SANDBOX_H */
+@@ -135,7 +137,15 @@
+     if (setgid(gid))
+       exit(errno + 100);
+ 
+-    if (setgroups(1, &gid))
++    if (uid)
++    {
++      if ((pwd = getpwuid(uid)) == NULL)
++        exit(errno + 100);
++
++      if (initgroups(pwd->pw_name, gid))
++        exit(errno + 100);
++    }
++    else if (setgroups(1, &gid))
+       exit(errno + 100);
+ 
+     if (uid && setuid(uid))
+diff -ru3 cups-2.0.0-old/scheduler/process.c cups-2.0.0/scheduler/process.c
+--- cups-2.0.0-old/scheduler/process.c	2014-11-04 19:55:05.736768298 +0300
++++ cups-2.0.0/scheduler/process.c	2014-11-04 20:23:55.001850057 +0300
+@@ -19,6 +19,7 @@
+ 
+ #include "cupsd.h"
+ #include <grp.h>
++#include <pwd.h>
+ #ifdef __APPLE__
+ #  include <libgen.h>
+ #endif /* __APPLE__ */
+@@ -462,6 +463,7 @@
+ 		cups_exec[1024];	/* Path to "cups-exec" program */
+   uid_t		user;			/* Command UID */
+   cupsd_proc_t	*proc;			/* New process record */
++  struct passwd *pwd;                   /* User passwd entry */
+ #ifdef HAVE_POSIX_SPAWN
+   posix_spawn_file_actions_t actions;	/* Spawn file actions */
+   posix_spawnattr_t attrs;		/* Spawn attributes */
+@@ -716,13 +718,22 @@
+       nice(FilterNice);
+ 
+    /*
+-    * Reset group membership to just the main one we belong to.
++    * Reset group membership to the main one we belong to with its 
++    * supplementary groups.
+     */
+ 
+     if (!RunUser && setgid(Group))
+       exit(errno + 100);
+ 
+-    if (!RunUser && setgroups(1, &Group))
++    if (!RunUser && user)
++    {
++      if ((pwd = getpwuid(user)) == NULL)
++        exit(errno + 100);
++
++      if (initgroups(pwd->pw_name, Group))
++        exit(errno + 100);
++    }
++    else if (!RunUser && setgroups(1, &Group))
+       exit(errno + 100);
+ 
+    /*