add packaging
authorAnas Nashif <anas.nashif@intel.com>
Sun, 4 Nov 2012 15:11:32 +0000 (07:11 -0800)
committerAnas Nashif <anas.nashif@intel.com>
Sun, 4 Nov 2012 15:11:32 +0000 (07:11 -0800)
packaging/libsmi-0.4.8-gnu-source.patch [new file with mode: 0644]
packaging/libsmi-0.4.8-parser.patch [new file with mode: 0644]
packaging/libsmi-CVE-2010-2891.patch [new file with mode: 0644]
packaging/libsmi.spec [new file with mode: 0644]

diff --git a/packaging/libsmi-0.4.8-gnu-source.patch b/packaging/libsmi-0.4.8-gnu-source.patch
new file mode 100644 (file)
index 0000000..98cd5b8
--- /dev/null
@@ -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>
diff --git a/packaging/libsmi-0.4.8-parser.patch b/packaging/libsmi-0.4.8-parser.patch
new file mode 100644 (file)
index 0000000..68f68d4
--- /dev/null
@@ -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*)$$;
+                           }
+                           
diff --git a/packaging/libsmi-CVE-2010-2891.patch b/packaging/libsmi-CVE-2010-2891.patch
new file mode 100644 (file)
index 0000000..114431d
--- /dev/null
@@ -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) {
diff --git a/packaging/libsmi.spec b/packaging/libsmi.spec
new file mode 100644 (file)
index 0000000..17f8cb3
--- /dev/null
@@ -0,0 +1,80 @@
+Name:           libsmi
+Version:        0.4.8
+Release:        2
+License:        MIT
+Summary:        A Library to Access SMI MIB Information
+Url:            http://www.ibr.cs.tu-bs.de/projects/libsmi
+Group:          System/Libraries
+Source:         %{name}-%{version}.tar.bz2
+Patch0:         libsmi-0.4.8-parser.patch
+Patch1:         libsmi-0.4.8-gnu-source.patch
+Patch2:         libsmi-CVE-2010-2891.patch
+BuildRequires:  bison
+BuildRequires:  flex
+BuildRequires:  libtool
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+
+%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
+License:        MIT
+Summary:        Libsmi Header Files And Static Libraries
+Group:          Development/Libraries/C and C++
+Requires:       %{name} = %{version}
+Requires:       glibc-devel
+
+%description devel
+This package contains the header files and static libraries of package
+libsmi.
+
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2
+
+%build
+autoreconf --force --install
+%configure --disable-static --with-pic --enable-smi \
+       --enable-sming \
+       --with-mibdir=%{_datadir}/mibs
+
+make %{?_smp_mflags}
+
+%install
+%make_install
+
+rm -f %{buildroot}%{_libdir}/*.la
+
+%post -n libsmi -p /sbin/ldconfig
+
+%postun -n libsmi -p /sbin/ldconfig
+
+%files
+%defattr(-, root, root)
+%doc COPYING  doc/*.txt
+%doc %{_mandir}/man?/*
+%{_bindir}/*
+%{_datadir}/mibs
+%{_datadir}/pibs
+%{_libdir}/libsmi.so.*
+
+
+%files devel
+%defattr(-, root, root)
+%{_includedir}/*
+%{_libdir}/libsmi.so
+%{_libdir}/pkgconfig/libsmi.pc
+%{_datadir}/aclocal/libsmi.m4
+
+%changelog