Sync from SUSE:SLFO:Main libsmi revision 2f323a46d6fd8ecf60a44fd2e016bb5a

This commit is contained in:
Adrian Schröter 2024-05-03 15:52:47 +02:00
commit bf54585f02
10 changed files with 645 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,11 @@
diff -uNr libsmi-0.4.8-orig/lib/smi.c libsmi-0.4.8/lib/smi.c
--- libsmi-0.4.8-orig/lib/smi.c 2008-04-18 12:42:50.000000000 +0200
+++ libsmi-0.4.8/lib/smi.c 2010-03-23 10:51:12.373123639 +0100
@@ -11,6 +11,7 @@
* @(#) $Id: smi.c 8071 2008-04-17 11:14:46Z schoenw $
*/
+#define _GNU_SOURCE
#include <config.h>
#include <stdlib.h>

14
libsmi-0.4.8-parser.patch Normal file
View File

@ -0,0 +1,14 @@
diff -uNr libsmi-0.4.8-orig/lib/parser-sming.y libsmi-0.4.8/lib/parser-sming.y
--- libsmi-0.4.8-orig/lib/parser-sming.y 2008-04-18 12:42:50.000000000 +0200
+++ libsmi-0.4.8/lib/parser-sming.y 2010-03-23 10:44:11.777122974 +0100
@@ -2161,8 +2161,8 @@
classPtr, thisParserPtr);
setAttributeParentType($$, smiHandle->typeBitsPtr);
if ($1) {
- setAttributeList($$, $1);
- for (p = $1; p; p = p->nextPtr)
+ setAttributeList($$, (void *)$1);
+ for (p = (void *)$1; p; p = (void *)p->nextPtr)
((NamedNumber *)(p->ptr))->typePtr = (Type*)$$;
}

BIN
libsmi-0.4.8.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,21 @@
Index: lib/smi.c
===================================================================
--- lib/smi.c (revision 29144)
+++ lib/smi.c (working copy)
@@ -1793,10 +1793,15 @@
}
if (isdigit((int)node2[0])) {
- for (oidlen = 0, p = strtok(node2, ". "); p;
+ for (oidlen = 0, p = strtok(node2, ". ");
+ p && oidlen < sizeof(oid)/sizeof(oid[0]);
oidlen++, p = strtok(NULL, ". ")) {
oid[oidlen] = strtoul(p, NULL, 0);
}
+ if (p) {
+ /* the numeric OID is too long */
+ return NULL;
+ }
nodePtr = getNode(oidlen, oid);
if (nodePtr) {
if (modulePtr) {

84
libsmi-bison-3.0.patch Normal file
View File

@ -0,0 +1,84 @@
Description: follow flex parameter specification change
Follow change from *_PARAM to %*-param after deprecation in flex.
Follow yyerror() parameterisation changes.
Author: Andy Whitcroft <a...@canonical.com>
Index: libsmi-0.4.8/lib/parser-smi.y
===================================================================
--- libsmi-0.4.8.orig/lib/parser-smi.y
+++ libsmi-0.4.8/lib/parser-smi.y
@@ -11,6 +11,9 @@
* @(#) $Id: parser-smi.y 8090 2008-04-18 12:56:29Z strauss $
*/
+%parse-param { struct Parser *parserPtr }
+%lex-param { struct Parser *parserPtr }
+
%{
#include <config.h>
@@ -43,14 +46,6 @@
-/*
- * These arguments are passed to yyparse() and yylex().
- */
-#define YYPARSE_PARAM parserPtr
-#define YYLEX_PARAM parserPtr
-
-
-
#define thisParserPtr ((Parser *)parserPtr)
#define thisModulePtr (((Parser *)parserPtr)->modulePtr)
Index: libsmi-0.4.8/lib/parser-sming.y
===================================================================
--- libsmi-0.4.8.orig/lib/parser-sming.y
+++ libsmi-0.4.8/lib/parser-sming.y
@@ -11,6 +11,9 @@
* @(#) $Id: parser-sming.y 7966 2008-03-27 21:25:52Z schoenw $
*/
+%parse-param { struct Parser *parserPtr }
+%lex-param { struct Parser *parserPtr }
+
%{
#include <config.h>
@@ -48,13 +51,6 @@
#endif
-/*
- * These arguments are passed to yyparse() and yylex().
- */
-#define YYPARSE_PARAM parserPtr
-#define YYLEX_PARAM parserPtr
-
-
#define thisParserPtr ((Parser *)parserPtr)
#define thisModulePtr (((Parser *)parserPtr)->modulePtr)
@@ -1556,7 +1552,7 @@ identityStatement: identityKeyword sep l
referenceStatement_stmtsep_01
{
setIdentityReference(identityPtr, $14,
- thisParserPtr)
+ thisParserPtr);
}
'}' optsep ';'
{
Index: libsmi-0.4.8/lib/error.h
===================================================================
--- libsmi-0.4.8.orig/lib/error.h
+++ libsmi-0.4.8/lib/error.h
@@ -22,7 +22,7 @@
#ifdef yyerror
#undef yyerror
#endif
-#define yyerror(msg) smiyyerror(msg, parserPtr)
+#define yyerror(parserPtr, msg) smiyyerror(msg, parserPtr)
extern int smiErrorLevel; /* Higher levels produce more warnings */

127
libsmi-exports.patch Normal file
View File

@ -0,0 +1,127 @@
--- libsmi-0.4.8.orig/lib/Makefile.am
+++ libsmi-0.4.8/lib/Makefile.am
@@ -11,6 +11,7 @@
# @(#) $Id: Makefile.am 7735 2008-02-15 08:09:17Z schoenw $
#
+AM_CFLAGS = -fvisibility=hidden
EXTRA_DIST = parser-sming.y parser-smi.y \
scanner-sming.l scanner-smi.l \
errormacros.h data.h check.h error.h util.h \
@@ -29,10 +30,14 @@ man_MANS = libsmi.3 smi_config.3 smi_mo
smi_class.3 smi_attribute.3 smi_identity.3 \
smi_event.3
lib_LTLIBRARIES = libsmi.la
-libsmi_la_SOURCES = data.c check.c error.c util.c snprintf.c smi.c \
+noinst_LTLIBRARIES = libsmi-internal.la
+
+libsmi_la_SOURCES = data.c check.c error.c util.c smi.c \
parser-smi.c scanner-smi.c \
parser-sming.c scanner-sming.c
-libsmi_la_LDFLAGS = -version-info @VERSION_LIBTOOL@
+libsmi_la_LDFLAGS = -no-undefined -version-info @VERSION_LIBTOOL@
+
+libsmi_internal_la_SOURCES = $(libsmi_la_SOURCES)
parser-smi.c parser-smi.tab.h: parser-smi.y scanner-smi.h parser-smi.h
$(BISON) --defines=parser-smi.tab.h -t -psmi -o parser-smi.c parser-smi.y
--- libsmi-0.4.8.orig/lib/smi.h
+++ libsmi-0.4.8/lib/smi.h
@@ -16,14 +16,11 @@
#include <stdlib.h>
#include <stdarg.h>
-#ifdef HAVE_STDINT_H
#include <stdint.h>
-#endif
-#ifdef HAVE_LIMITS_H
-#include "limits.h"
-#endif
+#include <limits.h>
#include <time.h>
+#pragma GCC visibility push(default)
#ifdef __cplusplus
extern "C" {
@@ -623,9 +620,9 @@ extern int smiPack(SmiNode *row, SmiValu
* to free the allocated memory.
*/
-extern int smiAsprintf(char **strp, const char *format, ...);
+extern int smiAsprintf(char **strp, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
-extern int smiVasprintf(char **strp, const char *format, va_list ap);
+extern int smiVasprintf(char **strp, const char *format, va_list ap) __attribute__ ((format (printf, 2, 0)));
/*
@@ -653,8 +650,8 @@ extern void _smiFree(char *, int, void *
#define smiFree(p) _smiFree(__FILE__, __LINE__, p)
#else
-extern void *smiMalloc(size_t size);
-extern void *smiRealloc(void *ptr, size_t size);
+extern void *smiMalloc(size_t size) __attribute((malloc, alloc_size(2)));
+extern void *smiRealloc(void *ptr, size_t size) __attribute((alloc_size(2)));
extern char *smiStrdup(const char *s1);
extern char *smiStrndup(const char *s1, size_t n);
extern void smiFree(void *ptr);
@@ -664,5 +661,6 @@ extern void smiFree(void *ptr);
}
#endif
+#pragma GCC visibility pop
#endif /* _SMI_H */
--- libsmi-0.4.8.orig/lib/smi.h.in
+++ libsmi-0.4.8/lib/smi.h.in
@@ -24,6 +24,7 @@
#endif
#include <time.h>
+#pragma GCC visibility push(default)
#ifdef __cplusplus
extern "C" {
@@ -663,6 +664,6 @@ extern void smiFree(void *ptr);
#ifdef __cplusplus
}
#endif
-
+#pragma GCC visibility pop
#endif /* _SMI_H */
--- libsmi-0.4.8.orig/lib/smi.c
+++ libsmi-0.4.8/lib/smi.c
@@ -30,7 +30,6 @@
#include "data.h"
#include "error.h"
#include "util.h"
-#include "snprintf.h"
#ifdef BACKEND_SMI
#include "scanner-smi.h"
--- libsmi-0.4.8.orig/lib/util.c
+++ libsmi-0.4.8/lib/util.c
@@ -19,8 +19,8 @@
#include <string.h>
#include <time.h>
+#include "smi.h"
#include "util.h"
-#include "snprintf.h"
#ifdef HAVE_DMALLOC_H
#include <dmalloc.h>
--- libsmi-0.4.8.orig/tools/Makefile.am
+++ libsmi-0.4.8/tools/Makefile.am
@@ -29,7 +29,7 @@ smiquery_SOURCES = smiquery.c shhopt.c
smiquery_LDADD = ../lib/libsmi.la
smilint_SOURCES = smilint.c shhopt.c
-smilint_LDADD = ../lib/libsmi.la
+smilint_LDADD = ../lib/libsmi.la ../lib/libsmi-internal.la
smixlate_SOURCES = smixlate.c shhopt.c dstring.h dstring.c
smixlate_LDADD = ../lib/libsmi.la

26
libsmi-flex.patch Normal file
View File

@ -0,0 +1,26 @@
Index: libsmi-0.4.8/lib/scanner-smi.h
===================================================================
--- libsmi-0.4.8.orig/lib/scanner-smi.h
+++ libsmi-0.4.8/lib/scanner-smi.h
@@ -21,7 +21,7 @@
#define YY_NO_UNPUT
extern char *yytext;
-extern int yyleng;
+extern size_t yyleng;
extern int smiEnterLexRecursion(FILE *file);
extern void smiLeaveLexRecursion();
Index: libsmi-0.4.8/lib/scanner-sming.h
===================================================================
--- libsmi-0.4.8.orig/lib/scanner-sming.h
+++ libsmi-0.4.8/lib/scanner-sming.h
@@ -21,7 +21,7 @@
#define YY_NO_UNPUT
extern char *yytext;
-extern int yyleng;
+extern size_t yyleng;
extern int smingEnterLexRecursion(FILE *file);
extern void smingLeaveLexRecursion();

212
libsmi.changes Normal file
View File

@ -0,0 +1,212 @@
-------------------------------------------------------------------
Tue Jan 4 21:45:50 UTC 2022 - Dirk Müller <dmueller@suse.com>
- spec file cleanup
-------------------------------------------------------------------
Fri Feb 27 14:49:24 UTC 2015 - dimstar@opensuse.org
- No longer apply libsmi-flex.patch on openSUSE Tumbleweed (> 13.2).
-------------------------------------------------------------------
Tue Jan 27 22:09:31 UTC 2015 - crrodriguez@opensuse.org
- fix missing pkgconfig buildRequires
- Run make check but ignore failures.
-------------------------------------------------------------------
Tue Jan 27 22:05:41 UTC 2015 - crrodriguez@opensuse.org
- libsmi-exports.patch: Export only the symbols of the public
API, specially hide and avoid using internal
vasprintf and asnprintf implementations that will
name-clash with the C library.
-------------------------------------------------------------------
Wed Jan 21 09:48:31 UTC 2015 - dimstar@opensuse.org
- Disable parallel build to reduce random build failures.
-------------------------------------------------------------------
Tue Jan 20 14:17:06 UTC 2015 - dimstar@opensuse.org
- Add libsmi-bison-3.0.patch: Fix build with bison 3.0.
-------------------------------------------------------------------
Mon Apr 15 13:54:52 UTC 2013 - mmeister@suse.com
- Added url as source.
Please see http://en.opensuse.org/SourceUrls
-------------------------------------------------------------------
Tue Nov 13 10:46:32 UTC 2012 - idonmez@suse.com
- Add libsmi-flex.patch: yyleng should be type of size_t
-------------------------------------------------------------------
Wed Nov 23 09:21:39 UTC 2011 - coolo@suse.com
- add libtool as buildrequire to avoid implicit dependency
-------------------------------------------------------------------
Thu Nov 11 10:38:11 UTC 2010 - nadvornik@novell.com
- fixed buffer overflow CVE-2010-2891 (bnc#649867)
-------------------------------------------------------------------
Mon Mar 29 14:26:21 CEST 2010 - boris@steki.net
- Created subpackage libsmi2 to make rpmlint happy
-------------------------------------------------------------------
Sat Mar 27 13:51:22 CET 2010 - boris@steki.net
- update to 0.4.8
* test/*: updated a couple of checks.
* tools/*: fixed a couple of minor compiler warnings.
* new MIBs
* tools/Makefile.am: added missing files to the distribution.
- patch for cast correction in parser-sming.y
- require of bison and flex in spec so build will rebuild parsers
-------------------------------------------------------------------
Fri Jan 9 03:02:57 CET 2009 - crrodriguez@suse.de
- remove static libraries and "la" files
- remove deprecated run_ldconfig usage
- define _GNU_SOURCE where needed
-------------------------------------------------------------------
Wed Oct 18 13:44:05 CEST 2006 - mjancar@suse.cz
- update to 0.4.5
* bugfixes
* new MIBs
- drop libsmi-0.4.5-sysconf.diff, included upstream
-------------------------------------------------------------------
Wed Jan 25 21:37:44 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Mon Jun 13 15:38:06 CEST 2005 - ro@suse.de
- do not redefine vsnprintf
-------------------------------------------------------------------
Thu Feb 24 20:27:15 CET 2005 - mjancar@suse.cz
- update to 0.4.3
-------------------------------------------------------------------
Fri Feb 27 09:17:45 CET 2004 - mjancar@suse.cz
- update to 0.4.2
-------------------------------------------------------------------
Sat Jan 10 14:10:49 CET 2004 - adrian@suse.de
- build as user
-------------------------------------------------------------------
Thu Jul 31 17:53:52 CEST 2003 - mjancar@suse.cz
- use %run_ldconfig
-------------------------------------------------------------------
Thu May 29 14:48:07 CEST 2003 - mjancar@suse.cz
- update to 0.4.1
-------------------------------------------------------------------
Wed May 28 11:16:32 CEST 2003 - coolo@suse.de
- add the aclocal macro file to the devel package
-------------------------------------------------------------------
Fri May 9 14:01:33 CEST 2003 - ro@suse.de
- do a full autoreconf
-------------------------------------------------------------------
Tue Jan 29 08:56:18 CET 2002 - cihlar@suse.cz
- use %{_libdir}
-------------------------------------------------------------------
Mon Nov 26 11:07:35 CET 2001 - cihlar@suse.cz
- update to version 0.3.0:
* many fixes
* added several files to mibs/... by new RFCs
- devel subpackage created
-------------------------------------------------------------------
Mon Nov 12 11:09:42 CET 2001 - cihlar@suse.cz
- fixed installation with new automake
-------------------------------------------------------------------
Wed Jun 6 09:55:18 CEST 2001 - cihlar@suse.cz
- fixed to compile with new libtool
-------------------------------------------------------------------
Tue Apr 17 08:15:51 CEST 2001 - cihlar@suse.cz
- update to version 0.2.16
-------------------------------------------------------------------
Wed Mar 7 14:07:12 CET 2001 - cihlar@suse.cz
- update to version 0.2.14
-------------------------------------------------------------------
Tue Feb 27 08:36:11 CET 2001 - cihlar@suse.cz
- update to version 0.2.13
- compile with --enable-smi and --enable-sming
-------------------------------------------------------------------
Sun Dec 3 15:07:12 CET 2000 - smid@suse.cz
- new version 0.2.11
-------------------------------------------------------------------
Wed Oct 11 11:21:29 CEST 2000 - smid@suse.cz
- new version 0.2.6
-------------------------------------------------------------------
Thu Jun 8 08:56:33 MEST 2000 - cihlar@suse.cz
- fixed License tag
- added %clean
-------------------------------------------------------------------
Fri Apr 21 12:59:01 CEST 2000 - smid@suse.cz
- upgrade to 0.2.0
- buildroot added
-------------------------------------------------------------------
Sat Apr 8 22:52:58 CEST 2000 - bk@suse.de
- added suse update config macro
-------------------------------------------------------------------
Thu Mar 2 15:35:38 CET 2000 - uli@suse.de
- moved man pages to %{_mandir}
-------------------------------------------------------------------
Mon Oct 25 18:41:03 MEST 1999 - uli@suse.de
- update -> 0.1.7
-------------------------------------------------------------------
Mon Sep 27 16:03:23 MEST 1999 - uli@suse.de
- new package, version 0.1.6

124
libsmi.spec Normal file
View File

@ -0,0 +1,124 @@
#
# spec file for package libsmi
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: libsmi
Version: 0.4.8
Release: 0
Summary: A Library to Access SMI MIB Information
License: MIT
Group: System/Libraries
URL: https://www.ibr.cs.tu-bs.de/projects/libsmi
Source: https://www.ibr.cs.tu-bs.de/projects/%{name}/download/%{name}-%{version}.tar.gz
Patch0: libsmi-0.4.8-parser.patch
Patch1: libsmi-0.4.8-gnu-source.patch
Patch2: libsmi-CVE-2010-2891.patch
Patch3: libsmi-flex.patch
Patch4: libsmi-bison-3.0.patch
Patch5: libsmi-exports.patch
BuildRequires: bison
BuildRequires: flex
BuildRequires: libtool
BuildRequires: pkgconfig
%description
The purpose of libsmi is to
* Give network management applications a concise programmer-friendly
interface to access MIB module information
* Separate the knowledge on SMI from the main parts of management
applications
* Allow addition of new kinds of MIB repositories without the need to
adapt applications that make use of libsmi
%package devel
Summary: Libsmi Header Files And Static Libraries
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Requires: glibc-devel
%package -n libsmi2
Summary: Libsmi Shared Libraries
Group: System/Libraries
Requires: %{name} = %{version}
%description -n libsmi2
The purpose of libsmi is to
* Give network management applications a concise programmer-friendly
interface to access MIB module information
* Separate the knowledge on SMI from the main parts of management
applications
* Allow addition of new kinds of MIB repositories without the need to
adapt applications that make use of libsmi
%description devel
This package contains the header files and static libraries of package
libsmi.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2
%if 0%{?suse_version} > 1220 && 0%{?suse_version} < 1321
%patch3 -p1
%endif
%patch4 -p1
%patch5 -p1
%build
autoreconf --force --install
%configure --disable-static \
--with-pic --enable-smi \
--enable-sming \
--with-mibdir=%{_datadir}/mibs
# Parallel build disabled
%make_build #%{?_smp_mflags}
%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
%check
%make_build check || cat test/test-suite.log && exit 0
%post -n libsmi2 -p /sbin/ldconfig
%postun -n libsmi2 -p /sbin/ldconfig
%files
%license COPYING
%doc ANNOUNCE ChangeLog README THANKS TODO doc/*.txt
%{_mandir}/man?/*
%{_bindir}/*
%{_datadir}/mibs
%{_datadir}/pibs
%files -n libsmi2
%{_libdir}/libsmi.so.*
%files devel
%{_includedir}/*
%{_libdir}/libsmi.so
%{_libdir}/pkgconfig/libsmi.pc
%{_datadir}/aclocal/libsmi.m4
%changelog