about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/trousers
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/trousers')
-rw-r--r--nixpkgs/pkgs/tools/security/trousers/allow-non-tss-config-file-owner.patch19
-rw-r--r--nixpkgs/pkgs/tools/security/trousers/default.nix36
2 files changed, 55 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/trousers/allow-non-tss-config-file-owner.patch b/nixpkgs/pkgs/tools/security/trousers/allow-non-tss-config-file-owner.patch
new file mode 100644
index 000000000000..774a14f72bab
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/trousers/allow-non-tss-config-file-owner.patch
@@ -0,0 +1,19 @@
+diff -ur trousers-0.3.11.2.orig/src/tcsd/tcsd_conf.c trousers-0.3.11.2/src/tcsd/tcsd_conf.c
+--- trousers-0.3.11.2.orig/src/tcsd/tcsd_conf.c	2013-07-12 18:27:37.000000000 +0200
++++ trousers-0.3.11.2/src/tcsd/tcsd_conf.c	2013-08-21 14:29:42.917231648 +0200
+@@ -763,6 +763,7 @@
+ 		return TCSERR(TSS_E_INTERNAL_ERROR);
+ 	}
+ 
++#ifndef ALLOW_NON_TSS_CONFIG_FILE
+ 	/* make sure user/group TSS owns the conf file */
+ 	if (pw->pw_uid != stat_buf.st_uid || grp->gr_gid != stat_buf.st_gid) {
+ 		LogError("TCSD config file (%s) must be user/group %s/%s", tcsd_config_file,
+@@ -775,6 +776,7 @@
+ 		LogError("TCSD config file (%s) must be mode 0600", tcsd_config_file);
+ 		return TCSERR(TSS_E_INTERNAL_ERROR);
+ 	}
++#endif
+ #endif /* SOLARIS */
+ 
+ 	if ((f = fopen(tcsd_config_file, "r")) == NULL) {
diff --git a/nixpkgs/pkgs/tools/security/trousers/default.nix b/nixpkgs/pkgs/tools/security/trousers/default.nix
new file mode 100644
index 000000000000..8309390d013b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/trousers/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, openssl, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "trousers-${version}";
+  version = "0.3.13";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/trousers/trousers/${version}/${name}.tar.gz";
+    sha256 = "1lvnla1c1ig2w3xvvrqg2w9qm7a1ygzy1j2gg8j7p8c87i58x45v";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ openssl ];
+
+  patches = [ ./allow-non-tss-config-file-owner.patch ];
+
+  configureFlags = [ "--disable-usercheck" ];
+
+  # Attempt to remove -std=gnu89 when updating if using gcc5
+  NIX_CFLAGS_COMPILE = "-std=gnu89 -DALLOW_NON_TSS_CONFIG_FILE";
+  NIX_LDFLAGS = "-lgcc_s";
+
+  # Fix broken libtool file
+  preFixup = stdenv.lib.optionalString (!stdenv.isDarwin) ''
+    sed 's,-lcrypto,-L${openssl.out}/lib -lcrypto,' -i $out/lib/libtspi.la
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Trusted computing software stack";
+    homepage    = http://trousers.sourceforge.net/;
+    license     = licenses.cpl10;
+    maintainers = [ maintainers.ak ];
+    platforms   = platforms.linux;
+  };
+}
+