cups: update package
This commit is contained in:
parent
f2c3bda151
commit
aa548af5a5
@ -175,7 +175,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.printing.drivers =
|
services.printing.drivers =
|
||||||
[ pkgs.cups pkgs.cups_pdf_filter pkgs.ghostscript additionalBackends
|
[ pkgs.cups pkgs.ghostscript additionalBackends
|
||||||
pkgs.perl pkgs.coreutils pkgs.gnused pkgs.bc pkgs.gawk pkgs.gnugrep
|
pkgs.perl pkgs.coreutils pkgs.gnused pkgs.bc pkgs.gawk pkgs.gnugrep
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -1,24 +1,27 @@
|
|||||||
{ stdenv, fetchurl, pkgconfig, zlib, libjpeg, libpng, libtiff, pam, openssl
|
{ stdenv, fetchurl, pkgconfig, zlib, pam, openssl
|
||||||
, dbus, libusb, acl }:
|
, dbus, libusb, acl }:
|
||||||
|
|
||||||
let version = "1.5.4"; in
|
let version = "2.0.0"; in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation rec {
|
||||||
name = "cups-${version}";
|
name = "cups-${version}";
|
||||||
|
|
||||||
passthru = { inherit version; };
|
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://www.cups.org/software/${version}/cups-${version}-source.tar.bz2";
|
url = "https://www.cups.org/software/${version}/${name}-source.tar.bz2";
|
||||||
sha256 = "1rfhlv9b37120d6shngvyrcp99vh4a3lwdkrfanv3sjqid7068w0";
|
sha256 = "1qjv1w8m3f9lbrnd9wx8gman4sjbgb75svfypd4jkn649b5vpzc3";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ pkgconfig zlib libjpeg libpng libtiff libusb ]
|
buildInputs = [ pkgconfig zlib libusb ]
|
||||||
++ stdenv.lib.optionals stdenv.isLinux [ pam dbus.libs acl ] ;
|
++ stdenv.lib.optionals stdenv.isLinux [ pam dbus.libs acl ] ;
|
||||||
|
|
||||||
propagatedBuildInputs = [ openssl ];
|
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 =
|
installFlags =
|
||||||
[ # Don't try to write in /var at build time.
|
[ # Don't try to write in /var at build time.
|
||||||
|
@ -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;
|
|
||||||
};
|
|
||||||
}
|
|
80
pkgs/misc/cups/use-initgroups.patch
Normal file
80
pkgs/misc/cups/use-initgroups.patch
Normal file
@ -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);
|
||||||
|
|
||||||
|
/*
|
@ -12314,7 +12314,6 @@ let
|
|||||||
|
|
||||||
cups = callPackage ../misc/cups { libusb = libusb1; };
|
cups = callPackage ../misc/cups { libusb = libusb1; };
|
||||||
|
|
||||||
cups_pdf_filter = callPackage ../misc/cups/pdf-filter.nix { };
|
|
||||||
|
|
||||||
crashplan = callPackage ../applications/backup/crashplan { };
|
crashplan = callPackage ../applications/backup/crashplan { };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user