From 5cf4eb497c04022248d3d32f5db91e0eea73b8c9 Mon Sep 17 00:00:00 2001 From: zyppe <210hcl@gmail.com> Date: Wed, 28 Feb 2024 21:19:03 +0800 Subject: [PATCH] Initialize for libmaxminddb --- .gitignore | 1 + .libmaxminddb.metadata | 1 + baselibs.conf | 1 + libmaxminddb.changes | 160 +++++++++++++++++++++++++++++++++++++++++ libmaxminddb.spec | 98 +++++++++++++++++++++++++ 5 files changed, 261 insertions(+) create mode 100644 .gitignore create mode 100644 .libmaxminddb.metadata create mode 100644 baselibs.conf create mode 100644 libmaxminddb.changes create mode 100644 libmaxminddb.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..42cd955 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +libmaxminddb-1.4.3.tar.gz diff --git a/.libmaxminddb.metadata b/.libmaxminddb.metadata new file mode 100644 index 0000000..973bb37 --- /dev/null +++ b/.libmaxminddb.metadata @@ -0,0 +1 @@ +6d9371e8ce83861ad172eea16212eb49c5b104713dd94e98c8a26b3772a374f5 libmaxminddb-1.4.3.tar.gz diff --git a/baselibs.conf b/baselibs.conf new file mode 100644 index 0000000..07ae29f --- /dev/null +++ b/baselibs.conf @@ -0,0 +1 @@ +libmaxminddb0 diff --git a/libmaxminddb.changes b/libmaxminddb.changes new file mode 100644 index 0000000..a3b08a2 --- /dev/null +++ b/libmaxminddb.changes @@ -0,0 +1,160 @@ +* Fri Aug 7 2020 andreas.stieger@gmx.de +- update to 1.4.3: + * Use of uninitialized memory in dump_entry_data_list() could have + cause a heap buffer flow in mmdblookup [bsc#1175006] +* Wed Nov 20 2019 dimstar@opensuse.org +- Add baselibs.conf: build libmaxminddb0-32bit, which is required + by libdns1310-32bit (new dependency gained). +* Sun Nov 3 2019 andreas.stieger@gmx.de +- update to 1.4.2: + * negative array index for MMDB_*get_value specifies the last element + * Fix a memory leak when using custom databases without languages + defined in the metadata + * mmdblookup now displays the prefix length for the record when + using the verbose flag +* Thu May 17 2018 jweberhofer@weberhofer.at +- Run tests +- Packaged LICENSE +- Update to version 1.3.2 + * Allocate memory for MMDB_entry_data_list_s structs in separate chunks + rather than one large chunk. This simplifies accessing memory in + MMDB_get_entry_data_list() and increases performance. It builds on the + changes in 1.3.0 and 1.3.1. + * We no longer export data_pool_* symbols. These are internal functions + but we were previously exporting them. Pull request by Faidon Liambotis. + gh#maxmind/libmaxminddb#162. + * Build with POSIX.1-2008 by default if the system supports it. This allows + use of open() with O_CLOEXEC. We retain support for systems that + provide only POSIX.1-2001. + Open the database with the O_CLOEXEC flag if the system provides it. + * This avoids cases where we could leak fds when called in multi-threaded + programs that fork() and exec(). Original report and PR by Brandon L + Black. + * Added a test to ensure we export only intended symbols (e.g. MMDB_*). +- Update to version 1.3.1 + * Fix build problems related to rpl_malloc(). Pull request by Rainer + Gerhards. gh#maxmind/libmaxminddb + * Fix a race to set and read data in a field on the MMDB_s struct + (ipv4_start_node). gh#maxmind/libmaxminddb#153. + * Fix cases of invalid memory access when using + MMDB_get_entry_data_list(). This was introduced in 1.3.0 and occurred + when performing large lookups. gh#maxmind/libmaxminddb#153. +- Update to version 1.3.0 + * Perform fewer memory allocations in MMDB_get_entry_data_list(). This + significantly improves its performance. gh#maxmind/libmaxminddb#147. + * Fix mmdblookup's build epoch reporting on some systems. Big endian + systems with a 32-bit time_t no longer show a database build date of + 1970-01-01 00:00:00. Pull request by Rainer Jung. gh#maxmind/libmaxminddb#143. +- Update to version 1.2.1 + * Use autoconf to check the system's endianness rather than trying to do this + with compiler-defined macros like __BYTE_ORDER__. Apparently this didn't + work properly on a Sparc system. gh#maxmind/libmaxminddb#120. + * Several compiler warnings on Visual C++ were fixed. Pull request by Marcel + Raad. gh#maxmind/libmaxminddb#130. + * Fix segmentation faults found in MMDB_open() using afl-fuzz. This + occurred on corrupt databases that had a data pointer large enough to + cause an integer overflow when doing bound checking. Reported by Ryan + Whitworth. gh#maxmind/libmaxminddb#140. + * Add --disable-tests option to configure. Pull request by Fabrice + Fontaine. gh#maxmind/libmaxminddb#136. +* Tue Apr 12 2016 p.drouand@gmail.com +- Update to version 1.2.0 + * Four additional fields were added to the end of the + MMDB_search_node_s struct returned by MMDB_read_node. These + fields allow the user to iterate through the search tree without + making undocumented assumptions about how this library works + internally and without knowing the specific details of the database + format. GitHub #110 (https://github.com/maxmind/libmaxminddb/issues/110) +- Changes from version 1.1.5 + * Previously, reading a database with a pointer in the metadata would + cause an MMDB_INVALID_METADATA_ERROR to be returned. This was due to + an invalid offset being used when calculating the pointer. The + data_section and metadata_section fields now both point to the + beginning of the data section. Previously, data_section pointed + to the beginning of the data separator. This will not affect + anyone using only documented fields from MMDB_s. + * MMDB_lookup_sockaddr will set mmdb_error to + MMDB_IPV6_LOOKUP_IN_IPV4_DATABASE_ERROR if an IPv6 sockaddr is + looked up in an IPv4-only database. Previously only + MMDB_lookup_string would set this error code. + * When resolving an address, this library now relies on getaddrinfo + to determine the address family rather than trying to guess it itself. +- Changes from version 1.1.4 + * Packaging fixes. The 1.1.3 tarball release contained a lot of extra + junk in the t/ directory. +- Changes from version 1.1.3 + * Added several additional checks to make sure that we don't attempt to read + past the end of the databases's data section. GitHub #103 + (https://github.com/maxmind/libmaxminddb/pull/103). + * When searching for the database metadata, there was a bug that caused + the code to think it had found valid metadata when none existed. In + addition, this could lead to an attempt to read past the end of the + database entirely. Finally, if there are multiple metadata markers + in the database, we treat the final one as the start of the metdata, + instead of the first. GitHub #102 (https://github.com/maxmind/libmaxminddb/pull/102) + * Don't attempt to mmap a file that is too large to be mmapped on the system. + GitHub #101 (https://github.com/maxmind/libmaxminddb/pull/101). + * Added a missing out of memory check when reading a file's metadata. + GitHub #101 (https://github.com/maxmind/libmaxminddb/pull/101). + * Added several additional checks to make sure that we never attempt + to malloc more than SIZE_MAX memory, which would lead to integer + overflow. This could only happen with pathological databases. + GitHub #101 (https://github.com/maxmind/libmaxminddb/pull/101). +* Wed Nov 18 2015 p.drouand@gmail.com +- Update to version 1.1.2 + * IMPORTANT: This release includes a number of important security + fixes. Among these fixes is improved validation of the database + metadata. Unfortunately, MaxMind GeoIP2 and GeoLite2 databases + created earlier than January 28, 2014, had an invalid data type + for the record_size in the metadata. Previously these databases + worked on little endian machines with libmaxminddb but did not + work on big endian machines. Due to increased safety checks when + reading the file, these databases will no longer work on any + platform. If you are using one of these databases, we recommend + that you upgrade to the latest GeoLite2 or GeoIP2 database + * Added pkg-config support. + * Several segmentation faults found with afl-fuzz were fixed. These + were caused by missing bounds checking and missing verification + of data type. + MMDB_get_entry_data_list will now fail on data structures with a + depth greater than 512 and data structures that are cyclic. This + should not affect any known MaxMind DB in production. All databases + produced by MaxMind have a depth of less than five. +- Add a build dependency to pkg-config +* Sun Jul 26 2015 p.drouand@gmail.com +- Update to version 1.1.1 + * Added `maxminddb-compat-util.h` as a source file to dist. +- Changes from version 1.1.0 + * Previously, when there was an error in `MMDB_open()`, `errno` would + generally be overwritten during cleanup, preventing a useful value from + being returned to the caller. This was changed so that the `errno` value + from the function call that caused the error is restored before returning to + the caller. In particular, this is important for `MMDB_IO_ERROR` errors as + checking `errno` is often the only way to determine what actually failed. + * If `mmap()` fails due to running out of memory space, an + `MMDB_OUT_OF_MEMORY_ERROR` is now returned from `MMDB_open` rather than an + `MMDB_IO_ERROR`. + * On Windows, the `CreateFileMappingA()` handle was not properly closed if + opening the database succeeded. Fixed by Bly Hostetler. GitHub #75 & #76. + * On Windows, we were not checking the return value of `CreateFileMappingA()` + properly for errors. Fixed by Bly Hotetler. GitHub #78. + * Several warnings from Clang's scan-build were fixed. GitHub #86. + * All headers are now installed in `$(includedir)`. GitHub #89. + * We no longer install `maxminddb-compat-util.h`. This header was intended for + internal use only. +* Wed Jan 21 2015 p.drouand@gmail.com +- Update to version 1.0.4 + * If you used a non-integer string as an array index when doing a + lookup with MMDB_get_value, MMDB_vget_value, or MMDB_aget_value, + the first element of the array would be returned rather than an + error. A MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR error will + now be returned. GitHub #61. + * If a number larger than LONG_MAX was used in the same functions, + LONG_MAX would have been used in the lookup. Now a + MMDB_INVALID_LOOKUP_PATH_ERROR error will be returned. + * Visual Studio build files were added for unit tests and some + compatibility issues with the tests were fixed. + * Visual Studio project was updated to use property pages. GitHub #69. + * A test failure in t/compile_c++_t.pl on new installs was fixed. +* Sun Dec 21 2014 p.drouand@gmail.com +- Initial release (version 1.0.3) diff --git a/libmaxminddb.spec b/libmaxminddb.spec new file mode 100644 index 0000000..9b50d62 --- /dev/null +++ b/libmaxminddb.spec @@ -0,0 +1,98 @@ +# +# spec file for package libmaxminddb +# +# Copyright (c) 2022-2023 ZhuningOS +# + + +%define lname libmaxminddb0 +Name: libmaxminddb +Version: 1.4.3 +Release: 1.6.1 +Summary: C library for the MaxMind DB file format +License: Apache-2.0 +URL: https://dev.maxmind.com/ +Source: https://github.com/maxmind/libmaxminddb/releases/download/%{version}/%{name}-%{version}.tar.gz +Source99: baselibs.conf +BuildRequires: fdupes +BuildRequires: gcc-c++ +BuildRequires: pkgconfig + +%description +The libmaxminddb library provides a C library for reading MaxMind DB +files, including the GeoIP2 databases from MaxMind. This is a +custom binary format designed to facilitate fast lookups of IP +addresses while allowing for great flexibility in the type of +data associated with an address. + +%package -n %{lname} +Summary: C library for the MaxMind DB file format + +%description -n %{lname} +The libmaxminddb library provides a C library for reading MaxMind DB +files, including the GeoIP2 databases from MaxMind. This is a +custom binary format designed to facilitate fast lookups of IP +addresses while allowing for great flexibility in the type of +data associated with an address. + +%package -n mmdblookup +Summary: An utility to look up an IP address in a MaxMind DB file + +%description -n mmdblookup +The libmaxminddb library provides a C library for reading MaxMind DB +files, including the GeoIP2 databases from MaxMind. This is a +custom binary format designed to facilitate fast lookups of IP +addresses while allowing for great flexibility in the type of +data associated with an address. + +This package contains the mmdblookup binary. + +%package devel +Summary: Development files for the MaxMind DB file format library +Requires: %{lname} = %{version} + +%description devel +The libmaxminddb library provides a C library for reading MaxMind DB +files, including the GeoIP2 databases from MaxMind. This is a +custom binary format designed to facilitate fast lookups of IP +addresses while allowing for great flexibility in the type of +data associated with an address. + +This package contains the development files for %{name}. + +%prep +%setup -q + +%build +%configure --disable-static +make %{?_smp_mflags} + +%check +make %{?_smp_mflags} check + +%install +%make_install +find %{buildroot} -type f -name "*.la" -delete -print +%fdupes -s %{buildroot}/%{_prefix} + +%post -n %{lname} -p /sbin/ldconfig +%postun -n %{lname} -p /sbin/ldconfig + +%files -n %{lname} +%license LICENSE +%{_libdir}/%{name}.so.* + +%files -n mmdblookup +%doc doc/mmdblookup.md +%{_bindir}/mmdblookup +%{_mandir}/man1/mmdblookup.* + +%files devel +%doc Changes.md NOTICE README.md doc/mmdblookup.md doc/libmaxminddb.md +%license LICENSE +%{_includedir}/* +%{_libdir}/%{name}.so +%{_libdir}/pkgconfig/%{name}.pc +%{_mandir}/man3/* + +%changelog