[packages/libtnc] - new

qboosh qboosh at pld-linux.org
Sat Apr 5 17:43:10 CEST 2025


commit 01c7d5b6281c9647a1f47150dff1323d7ce0c65e
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Apr 5 17:14:31 2025 +0200

    - new

 libtnc-includes.patch       | 180 +++++++++++++++++++++++++++++++++++++++++
 libtnc-perl-symbolfix.patch |  18 +++++
 libtnc-symbolfix.patch      |  39 +++++++++
 libtnc.spec                 | 193 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 430 insertions(+)
---
diff --git a/libtnc.spec b/libtnc.spec
new file mode 100644
index 0000000..b7e3c1d
--- /dev/null
+++ b/libtnc.spec
@@ -0,0 +1,193 @@
+#
+# Conditional build:
+%bcond_without	static_libs	# static libraries
+%bcond_without	perl		# Perl interface
+
+# version of Perl Interface-TNC
+%define		perl_int_ver	1.0
+
+Summary:	TNC Interface library
+Summary(pl.UTF-8):	Biblioteka interfejsu TNC
+Name:		libtnc
+%define		main_ver	1.25
+Version:	%{main_ver}
+%define		rel		1
+Release:	%{rel}
+License:	GPL v2 or commercial
+Group:		Libraries
+Source0:	https://downloads.sourceforge.net/libtnc/%{name}-%{version}.tar.gz
+# Source0-md5:	29beb7feb0149832f699a90cd712d563
+Patch0:		%{name}-includes.patch
+# Fedora libtnc-1.25-symbolfix.patch split into C and Perl parts
+Patch1:		%{name}-symbolfix.patch
+Patch2:		%{name}-perl-symbolfix.patch
+URL:		https://sourceforge.net/projects/libtnc/
+BuildRequires:	bison
+BuildRequires:	flex
+BuildRequires:	libxml2-devel >= 2.0
+%if %{with perl}
+BuildRequires:	rpm-perlprov
+BuildRequires:	rpmbuild(macros) >= 1.745
+%endif
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This library provides functions for loading and interfacing with
+loadable IMC and IMV modules as required by the TNC IF-IMC and IF-IMV
+interfaces as described in:
+<https://www.trustedcomputinggroup.org/specs/TNC>
+
+Supports: IF-IMC 1.1, IF-IMV 1.1, IF-TNCCS 1.0.
+
+%description -l pl.UTF-8
+Biblioteka TNC dostarcza funkcje do ładowania i współpracy z
+ładowalnymi modułami IMC i IMV, zgodnie z wymogami interfejsów TNC
+IF-IMC i IF-IMV, opisanymi w:
+<https://www.trustedcomputinggroup.org/specs/TNC>
+
+Obsługuje: IF-IMC 1.1, IF-IMV 1.1, IF-TNCCS 1.0.
+
+%package devel
+Summary:	Header files for TNC libraries
+Summary(pl.UTF-8):	Pliki nagłówkowe bibliotek TNC
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description devel
+Header files for TNC libraries.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe bibliotek TNC.
+
+%package static
+Summary:	Static TNC libraries
+Summary(pl.UTF-8):	Statyczne biblioteki TNC
+Group:		Development/Libraries
+Requires:	%{name}-devel = %{version}-%{release}
+
+%description static
+Static TNC libraries.
+
+%description static -l pl.UTF-8
+Statyczne biblioteki TNC.
+
+%package -n perl-Interface-TNC
+Summary:	Interface::TNC Perl modules
+Summary(pl.UTF-8):	Moduły Perla Interface::TNC
+Version:	%{perl_int_ver}
+Release:	%{main_ver}.%{rel}
+# same as perl
+License:	GPL v1+ or Artistic
+Group:		Development/Languages/Perl
+Requires:	%{name} = %{main_ver}-%{release}
+
+%description -n perl-Interface-TNC
+Interface::TNC::IMC and Interface::TNC::IMV - Perl interface to TNC
+library.
+
+%description -n perl-Interface-TNC -l pl.UTF-8
+Interface::TNC::IMC oraz Interface::TNC::IMV - perlowy interfejs do
+biblioteki TNC.
+
+%prep
+%setup -q
+%patch -P0 -p1
+%patch -P1 -p1
+
+%if %{with perl}
+%{__tar} xf Interface-TNC/Interface-TNC-%{perl_int_ver}.tar.gz
+%patch -P2 -p0
+%endif
+
+%build
+%configure \
+	%{!?with_static_libs:--disable-static}
+%{__make}
+
+%if %{with perl}
+topdir=$(pwd)
+cd Interface-TNC-%{perl_int_ver}
+%{__perl} Makefile.PL \
+	INSTALLDIRS=vendor
+
+%{__make} \
+	INC="-I. -I${topdir}/src/libtnc" \
+	LDLOADLIBS="-L${topdir}/src/libtnc/.libs -ltnc"
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+%if %{with perl}
+%{__make} -C Interface-TNC-%{perl_int_ver} install \
+	DESTDIR=$RPM_BUILD_ROOT
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS COPYING ChangeLog README TODO
+%attr(755,root,root) %{_libdir}/libosc_imc.so.*.*.*
+%ghost %{_libdir}/libosc_imc.so.0
+%attr(755,root,root) %{_libdir}/libosc_imv.so.*.*.*
+%ghost %{_libdir}/libosc_imv.so.0
+%attr(755,root,root) %{_libdir}/libsample_imc.so.*.*.*
+%ghost %{_libdir}/libsample_imc.so.0
+%attr(755,root,root) %{_libdir}/libsample_imv.so.*.*.*
+%ghost %{_libdir}/libsample_imv.so.0
+%attr(755,root,root) %{_libdir}/libtnc.so.*.*.*
+%ghost %{_libdir}/libtnc.so.0
+
+%files devel
+%defattr(644,root,root,755)
+%doc doc/libtnc.pdf
+%{_libdir}/libosc_imc.so
+%{_libdir}/libosc_imc.la
+%{_libdir}/libosc_imv.so
+%{_libdir}/libosc_imv.la
+%{_libdir}/libsample_imc.so
+%{_libdir}/libsample_imc.la
+%{_libdir}/libsample_imv.so
+%{_libdir}/libsample_imv.la
+%{_libdir}/libtnc.so
+%{_libdir}/libtnc.la
+%{_includedir}/libtnc*.h
+%{_includedir}/tncif*.h
+
+%if %{with static_libs}
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libosc_imc.a
+%{_libdir}/libosc_imv.a
+%{_libdir}/libsample_imc.a
+%{_libdir}/libsample_imv.a
+%{_libdir}/libtnc.a
+%endif
+
+%if %{with perl}
+%files -n perl-Interface-TNC
+%defattr(644,root,root,755)
+%doc Interface-TNC-%{perl_int_ver}/{Changes,README}
+%dir %{perl_vendorarch}/Interface
+%dir %{perl_vendorarch}/Interface/TNC
+%{perl_vendorarch}/Interface/TNC/IMC.pm
+%{perl_vendorarch}/Interface/TNC/IMV.pm
+%dir %{perl_vendorarch}/auto/Interface
+%dir %{perl_vendorarch}/auto/Interface/TNC
+%dir %{perl_vendorarch}/auto/Interface/TNC/IMC
+%attr(755,root,root) %{perl_vendorarch}/auto/Interface/TNC/IMC/IMC.so
+%{perl_vendorarch}/auto/Interface/TNC/IMC/autosplit.ix
+%dir %{perl_vendorarch}/auto/Interface/TNC/IMV
+%attr(755,root,root) %{perl_vendorarch}/auto/Interface/TNC/IMV/IMV.so
+%{perl_vendorarch}/auto/Interface/TNC/IMV/autosplit.ix
+%{_mandir}/man3/Interface::TNC::IMC.3pm*
+%{_mandir}/man3/Interface::TNC::IMV.3pm*
+%endif
diff --git a/libtnc-includes.patch b/libtnc-includes.patch
new file mode 100644
index 0000000..f19211d
--- /dev/null
+++ b/libtnc-includes.patch
@@ -0,0 +1,180 @@
+--- libtnc-1.25/src/libtnc/libtncxml.c.orig	2011-02-08 21:52:41.000000000 +0100
++++ libtnc-1.25/src/libtnc/libtncxml.c	2025-04-05 12:03:41.859275840 +0200
+@@ -16,6 +16,7 @@
+ #include <libtncxml.h>
+ #include <libtncdebug.h>
+ #include <base64.h>
++#include <stdlib.h>
+ 
+ ///////////////////////////////////////////////////////////
+ // debug dump doc details to stdout
+--- libtnc-1.25/src/libtnc/libtnctncc.c.orig	2011-02-08 21:52:41.000000000 +0100
++++ libtnc-1.25/src/libtnc/libtnctncc.c	2025-04-05 12:06:03.638507756 +0200
+@@ -16,6 +16,9 @@
+ #include <libtncxml.h>
+ #include <libtncdebug.h>
+ #include <libtncarray.h>
++#include <base64.h>
++#include <mutex.h>
++#include <stdlib.h>
+ 
+ // The clients preferred language (NULL if not set)
+ static const char* preferredLanguage = NULL;
+--- libtnc-1.25/src/libtnc/libtnctncs.c.orig	2011-02-08 21:55:11.000000000 +0100
++++ libtnc-1.25/src/libtnc/libtnctncs.c	2025-04-05 12:06:45.701613214 +0200
+@@ -20,6 +20,7 @@
+ #include <libtncarray.h>
+ #include <mutex.h>
+ #include <base64.h>
++#include <stdlib.h>
+ 
+ // Dynamic array of libtnc_tncs_connection indexed by connectionID
+ // Protected by mutex
+--- libtnc-1.25/src/libtnc/libtncimc.c.orig	2009-03-18 12:28:38.000000000 +0100
++++ libtnc-1.25/src/libtnc/libtncimc.c	2025-04-05 12:08:38.517668704 +0200
+@@ -12,6 +12,7 @@
+ // $Id: libtncimc.c,v 1.5 2009/03/18 11:28:35 mikem Exp mikem $
+ 
+ #include <libtncconfig.h>
++#include <ctype.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -113,6 +114,11 @@ TNC_Result TNC_TNCC_ReportMessageTypes(
+     return TNC_RESULT_SUCCESS;
+ }
+ 
++TNC_Result libtnc_tncc_BindFunction(
++    TNC_IMCID imcID,
++    char *functionName,
++    void **pOutfunctionPointer);
++
+ ///////////////////////////////////////////////////////////
+ // Resolve function pointers
+ // Called by the IMC when it needs the address of a functions in here
+--- libtnc-1.25/src/libtnc/libtncimv.c.orig	2009-03-18 12:28:39.000000000 +0100
++++ libtnc-1.25/src/libtnc/libtncimv.c	2025-04-05 12:10:02.957211255 +0200
+@@ -17,6 +17,7 @@
+ // $Id: libtncimv.c,v 1.4 2009/03/18 11:28:35 mikem Exp mikem $
+ 
+ #include <libtncconfig.h>
++#include <ctype.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -117,6 +118,11 @@ TNC_Result TNC_TNCS_ReportMessageTypes(
+     return TNC_RESULT_SUCCESS;
+ }
+ 
++TNC_Result libtnc_tncs_BindFunction(
++    TNC_IMVID imcID,
++    char *functionName,
++    void **pOutfunctionPointer);
++
+ ///////////////////////////////////////////////////////////
+ // Resolve function pointers
+ // Called by the IMV when it needs the address of a functions in here
+--- libtnc-1.25/src/libtnc/tncs_attributes.c.orig	2011-02-08 21:52:41.000000000 +0100
++++ libtnc-1.25/src/libtnc/tncs_attributes.c	2025-04-05 12:10:34.887038277 +0200
+@@ -14,6 +14,7 @@
+ // as defined in IF-TNCCS v1.2, Revision 6.00, section 2.8.5.5
+ 
+ #include <libtncconfig.h>
++#include <stdlib.h>
+ #include <string.h>
+ #include <libtncimv.h>
+ #include <libtncdebug.h>
+--- libtnc-1.25/src/libtnc/libtnchash.c.orig	2009-03-18 12:31:29.000000000 +0100
++++ libtnc-1.25/src/libtnc/libtnchash.c	2025-04-05 12:11:33.810052397 +0200
+@@ -15,6 +15,8 @@
+ #include <stdlib.h>
+ #include <string.h>
+ 
++TNC_UInt32 libtnc_array_size(libtnc_array* array);
++
+ static libtnc_hash_node* 
+ // PERFORMANCE ALERT: linear search
+ find_node(libtnc_hash* hash, TNC_BufferReference key, TNC_UInt32 keylen)
+--- libtnc-1.25/src/osc/osc_imc.c.orig	2008-05-07 00:08:27.000000000 +0200
++++ libtnc-1.25/src/osc/osc_imc.c	2025-04-05 12:12:25.036441546 +0200
+@@ -34,6 +34,7 @@
+ #include <errno.h>
+ #include <sys/wait.h>
+ #include <pwd.h>
++#include <unistd.h>
+ #endif
+ #include <sys/types.h>
+ #include <sys/stat.h>
+--- libtnc-1.25/src/osc/policy_tree.c.orig	2025-04-05 13:01:18.070551936 +0200
++++ libtnc-1.25/src/osc/policy_tree.c	2025-04-05 13:01:21.593866182 +0200
+@@ -36,6 +36,8 @@ yyerror(pt_node* n)
+     fprintf(stderr, "OSC_IMV syntax error at '%s' line %d: '%s'\n", lexer_filename, lexer_lineno, yytext);
+ }
+ 
++int yyparse (pt_node** policy);
++
+ ////////////////////////////////////////////////////////////////////////////////
+ // pt_parse_policy
+ // Parse the text of a policy
+@@ -59,7 +61,7 @@ pt_parse_policy(char* filename)
+     }
+     else
+     {
+-	fprintf(stderr, "OSC_IMV could not open policy file '%s': %s\n", filename, sys_errlist[errno]);
++	fprintf(stderr, "OSC_IMV could not open policy file '%s': %s\n", filename, strerror(errno));
+     }
+     return policy;
+ }
+@@ -82,6 +84,8 @@ pt_evaluate(pt_node* n, osc_imv_connecti
+     return n->evaluate(n, conn);
+ }
+ 
++TNC_UInt32 libtnc_array_size(libtnc_array* array);
++
+ ////////////////////////////////////////////////////////////////////////////////
+ // statement
+ int
+@@ -262,6 +266,9 @@ pt_conjunction_new(pt_node* pred1, pt_no
+     return (pt_node*)p;
+ }
+ 
++void
++connRequestClientData(osc_imv_connection* conn, char* sysname, char* dataname);
++
+ ////////////////////////////////////////////////////////////////////////////////
+ // function
+ int
+@@ -399,6 +406,10 @@ pt_predicate_new(pt_node* function, int
+ }
+ 
+ 
++TNC_Result connUserMessage(
++    osc_imv_connection* conn,
++    char* message);
++
+ ////////////////////////////////////////////////////////////////////////////////
+ // usermessage
+ int
+@@ -433,6 +444,11 @@ pt_usermessage_new(char* s)
+     return (pt_node*)p;
+ }
+ 
++TNC_Result connLogMessage(
++    osc_imv_connection* conn,
++    /*in*/ TNC_UInt32 severity,
++    /*in*/ const char* format, ...);
++
+ ////////////////////////////////////////////////////////////////////////////////
+ // log
+ int
+@@ -467,6 +483,10 @@ pt_log_new(int loglevel, char* string)
+     return (pt_node*)p;
+ }
+ 
++TNC_Result connSetRecommendation(
++    osc_imv_connection* conn,
++    TNC_IMV_Action_Recommendation recommendation);
++
+ ////////////////////////////////////////////////////////////////////////////////
+ // recommend
+ int
diff --git a/libtnc-perl-symbolfix.patch b/libtnc-perl-symbolfix.patch
new file mode 100644
index 0000000..b65c7ab
--- /dev/null
+++ b/libtnc-perl-symbolfix.patch
@@ -0,0 +1,18 @@
+--- Interface-TNC-1.0/IMC/IMC.xs.symbolfix	2006-05-16 19:45:50.000000000 -0400
++++ Interface-TNC-1.0/IMC/IMC.xs	2023-01-11 14:44:08.456038230 -0500
+@@ -169,6 +169,4 @@ libtnc_imc *
+ libtnc_imc_new(filename)
+ 	char *	filename
+ 
+-TNC_Result
+-libtnc_imc_unload()
+ 
+--- Interface-TNC-1.0/IMV/IMV.xs.symbolfix	2023-01-11 14:44:41.300408846 -0500
++++ Interface-TNC-1.0/IMV/IMV.xs	2023-01-11 14:44:48.762493051 -0500
+@@ -184,6 +184,3 @@ libtnc_imv *
+ libtnc_imv_new(filename)
+ 	char *	filename
+ 
+-TNC_Result
+-libtnc_imv_unload()
+-
diff --git a/libtnc-symbolfix.patch b/libtnc-symbolfix.patch
new file mode 100644
index 0000000..f8967ba
--- /dev/null
+++ b/libtnc-symbolfix.patch
@@ -0,0 +1,39 @@
+diff -up libtnc-1.25/src/libtnc/libtnctncc.c.symbolfix libtnc-1.25/src/libtnc/libtnctncc.c
+--- libtnc-1.25/src/libtnc/libtnctncc.c.symbolfix	2011-02-08 15:52:41.000000000 -0500
++++ libtnc-1.25/src/libtnc/libtnctncc.c	2023-01-11 14:44:08.456038230 -0500
+@@ -71,6 +71,16 @@ TNC_Result libtnc_tncc_add_imc_imv_messa
+ }
+ 
+ ///////////////////////////////////////////////////////////
++// Called by TNCC when a finished batch is ready to send
++__attribute__((weak)) TNC_Result TNC_TNCC_SendBatch(
++    /*in*/ libtnc_tncc_connection* conn,
++    /*in*/ const char* messageBuffer,
++    /*in*/ size_t messageLength)
++{
++    return libtnc_tncs_ReceiveBatch(conn, messageBuffer, messageLength);
++}
++
++///////////////////////////////////////////////////////////
+ static
+ TNC_Result libtnc_tncc_EndBatch(
+     /*in*/ libtnc_tncc_connection* conn)
+diff -up libtnc-1.25/src/libtnc/libtnctncs.c.symbolfix libtnc-1.25/src/libtnc/libtnctncs.c
+--- libtnc-1.25/src/libtnc/libtnctncs.c.symbolfix	2011-02-08 15:55:11.000000000 -0500
++++ libtnc-1.25/src/libtnc/libtnctncs.c	2023-01-11 14:44:08.456038230 -0500
+@@ -144,6 +144,15 @@ TNC_Result libtnc_tncs_recommend(
+     return TNC_RESULT_SUCCESS;
+ }
+ 
++///////////////////////////////////////////////////////////
++// Called by TNCS when a finished batch is ready to send
++__attribute__((weak)) TNC_Result TNC_TNCS_SendBatch(
++    /*in*/ libtnc_tncs_connection* conn,
++    /*in*/ const char* messageBuffer,
++    /*in*/ size_t messageLength)
++{
++    return libtnc_tncc_ReceiveBatch(conn, messageBuffer, messageLength);
++}
+ 
+ ///////////////////////////////////////////////////////////
+ static
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libtnc.git/commitdiff/01c7d5b6281c9647a1f47150dff1323d7ce0c65e



More information about the pld-cvs-commit mailing list