openpts: init at 0.2.6

This commit is contained in:
Thomas Strobel 2015-08-11 12:13:33 +02:00
parent 4abc4fa991
commit 3607cf316e
6 changed files with 128 additions and 0 deletions

View file

@ -0,0 +1,12 @@
diff -urNp openpts-0.2.6-cvs-patched/src/fsm.c openpts-0.2.6-current/src/fsm.c
--- openpts-0.2.6-cvs-patched/src/fsm.c 2012-01-05 03:49:15.000000000 -0500
+++ openpts-0.2.6-current/src/fsm.c 2012-01-09 12:11:17.338706205 -0500
@@ -934,7 +934,7 @@ char *getEventString(OPENPTS_PCR_EVENT_W
/* event */
event = eventWrapper->event;
if (event != NULL) {
- // len = snprintf(buf, size, "PCR[%d],TYPE=%d", (int)event->ulPcrIndex, event->eventType);
+ snprintf(buf, size, "PCR[%d],TYPE=%d", (int)event->ulPcrIndex, event->eventType);
} else {
LOG(LOG_ERR, "NULL event\n"); // TODO(munetoh)
xfree(buf);

View file

@ -0,0 +1,53 @@
{ stdenv, fetchurl, autoconf, automake, pkgconfig, libtool, trousers, openssl, libxml2, libuuid, gettext, perl }:
stdenv.mkDerivation rec {
name = "openpts-${version}";
version = "0.2.6";
src = fetchurl {
url = "http://jaist.dl.osdn.jp/openpts/54410/openpts-${version}.tar.gz";
sha256 = "1b5phshl49fxr5y3g5zz75gm0n4cw8i7n29x5f1a95xkwrjpazi0";
};
# patches from https://apps.fedoraproject.org/packages/openpts/sources/patches/
patches = [ ./bugs.patch ./zlib.patch ./tboot.patch ./ptsc.patch ];
buildInputs = [ autoconf automake pkgconfig libtool trousers openssl libxml2 libuuid gettext ];
preConfigure = ''
substituteInPlace include/Makefile.am --replace "./cvs2msg.pl" "${perl}/bin/perl cvs2msg.pl";
$SHELL bootstrap.sh
'';
configureFlags = [ "--with-tss" "--with-aru" "--with-tboot" "--enable-tnc" "--with-aide" ];
NIX_CFLAGS_COMPILE = "-I${trousers}/include/trousers -I${trousers}/include/tss";
preInstall = ''
mkdir -p $out
mkdir -p $out/etc
cp -p dist/ptsc.conf.in $out/etc/ptsc.conf
cp -p dist/ptsv.conf.in $out/etc/ptsv.conf
mkdir -p $out/share/openpts/models
cp -p models/*.uml $out/share/openpts/models/
mkdir -p $out/share/openpts/tpm_emulator
cp dist/tpm_emulator/README.rhel $out/share/openpts/tpm_emulator/README
cp dist/tpm_emulator/binary_bios_measurements $out/share/openpts/tpm_emulator/
cp dist/tpm_emulator/tcsd $out/share/openpts/tpm_emulator/
mkdir -p $out/share/openpts/tboot
cp dist/tboot/README.fedora15 $out/share/openpts/tboot/README
cp dist/tboot/ptsc.conf.fedora15 $out/share/openpts/tboot/ptsc.conf
cp dist/tboot/tcsd.conf.fedora15 $out/share/openpts/tboot/tcsd.conf
cp dist/tboot/tcsd.fedora15 $out/share/openpts/tboot/tcsd
'';
meta = {
description = "TCG Platform Trust Service (PTS)";
homepage = "ttp://sourceforge.jp/projects/openpts";
license = stdenv.lib.licenses.cpl10;
platforms = stdenv.lib.platforms.unix;
maintainers = with stdenv.lib.maintainers; [ tstrobel ];
};
}

View file

@ -0,0 +1,28 @@
diff -urNp openpts-0.2.6-patched/src/ptsc.c openpts-0.2.6-current/src/ptsc.c
--- openpts-0.2.6-patched/src/ptsc.c 2012-08-21 15:57:07.733841433 -0400
+++ openpts-0.2.6-current/src/ptsc.c 2012-08-21 16:13:26.479732504 -0400
@@ -457,7 +457,10 @@ void ptsc_lock(void) {
exit(1);
}
oldgrp = getegid();
- setegid(grp.gr_gid);
+ if(setegid(grp.gr_gid) != 0){
+ LOG(LOG_ERR, "setegid fail");
+ exit(1);
+ }
}
oldmask = umask(0);
@@ -467,7 +470,10 @@ void ptsc_lock(void) {
}
if (grpent) {
chmod(LOCK_DIR, 02775);
- setegid(oldgrp);
+ if(setegid(oldgrp) != 0){
+ LOG(LOG_ERR, "setegid fail");
+ exit(1);
+ }
}
fd = open(LOCK_FILE, O_RDWR | O_CREAT | O_TRUNC, 0660);
if (fd < 0) {

View file

@ -0,0 +1,21 @@
diff -urNp openpts-0.2.6-patched/src/tboot2iml.c openpts-0.2.6-current/src/tboot2iml.c
--- openpts-0.2.6-patched/src/tboot2iml.c 2012-07-23 16:30:12.381361421 -0400
+++ openpts-0.2.6-current/src/tboot2iml.c 2012-07-23 17:25:59.053945778 -0400
@@ -531,7 +531,7 @@ int sinit_acm_hash(char *filename, int s
int sha1sum_unzip(char *filename, int *filesize, BYTE *digest) {
- FILE *fp;
+ gzFile fp;
char buf[2048];
SHA_CTX sha_ctx;
int len;
@@ -541,7 +541,7 @@ int sha1sum_unzip(char *filename, int *f
/* open */
fp = gzopen(filename, "rb");
- if (fp == NULL) {
+ if (fp == Z_NULL) {
LOG(LOG_ERR, "File %s does not exist\n", filename);
return 0;
}

View file

@ -0,0 +1,12 @@
diff -urNp openpts-0.2.6-cvs-patched/src/Makefile.am openpts-0.2.6-current/src/Makefile.am
--- openpts-0.2.6-cvs-patched/src/Makefile.am 2012-01-05 03:49:15.000000000 -0500
+++ openpts-0.2.6-current/src/Makefile.am 2012-01-09 14:12:02.507361732 -0500
@@ -30,7 +30,7 @@ localedir = $(datadir)/locale
AM_CPPFLAGS = -I$(top_srcdir)/include $(LIBXML2_CFLAGS) $(TSS_CFLAGS) -I../include -DLOCALEDIR=\"$(localedir)\"
-AM_LDFLAGS = $(LIBXML2_LIBS) $(LIBCRYPTO_LIBS) $(TSS_LIBS) -lopenpts
+AM_LDFLAGS = $(LIBXML2_LIBS) $(LIBCRYPTO_LIBS) $(TSS_LIBS) -lz -lopenpts
# $(LIBINTL) -lopenpts
if HAVE_LIBUUID

View file

@ -9026,6 +9026,8 @@ let
nsq = callPackage ../servers/nsq { }; nsq = callPackage ../servers/nsq { };
openpts = callPackage ../servers/openpts { };
openresty = callPackage ../servers/http/openresty { }; openresty = callPackage ../servers/http/openresty { };
opensmtpd = callPackage ../servers/mail/opensmtpd { }; opensmtpd = callPackage ../servers/mail/opensmtpd { };