summaryrefslogtreecommitdiffstats
path: root/libuuid/src
Commit message (Collapse)AuthorAgeFilesLines
* libuuid: fix name-based UUIDsKarel Zak2018-08-311-18/+16Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current version is not fully compatible with RFC4122. It incorrectly encodes UUID variant xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx where M is UUID version and N is UUID variant. $ python -c "import uuid ; print(uuid.uuid5(uuid.UUID(int=0), 'foo'))" aa752cea-8222-5bc8-acd9-555b090c0ccb ^^ Old version: $ uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1 aa752cea-8222-5bc8-8cd9-555b090c0ccb ^^ Fixed version: ./uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1; aa752cea-8222-5bc8-acd9-555b090c0ccb ^^ The patch uses uuid_unpack and uuid_pack. It makes code more readable and allow to access proper octens. The same way we already use for time and random based UUIDs. Addresses: https://github.com/karelzak/util-linux/issues/683 Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: add note about RFC4122 UUID layoutKarel Zak2018-08-311-0/+29
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build: Add missing -lintl linkage to lib{smartcols,uuid}Karel Zak2018-04-091-1/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/pull/615 Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: avoid using prog_DEPENDENCIESRuediger Meier2018-01-221-1/+3
| | | | | | | Use EXTRA_prog_DEPENDENCIES to have the benefit of automake's automatic prog_DEPENDENCIES. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: remove generated headers from dist tar ballRuediger Meier2018-01-221-3/+1Star
| | | | | | | | | | | | | Headers should only be listed in either *_HEADERS or *_SOURCES, especially when we want nodist_*_HEADERS. Since all the generated headers are made by configure we don't even need to use BUILT_SOURCES or other tricks. Also see automake docs 9.4.1 Built Sources Example: case "Build bindir.h from configure" Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib/md5: use ul_/UL_ prefixKarel Zak2017-12-121-6/+6
| | | | | | | The symbols names are too generic. Addresses: https://github.com/karelzak/util-linux/issues/548 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sha1: use ul_/UL_prefix for symbolsKarel Zak2017-12-121-6/+6
| | | | | | | | Unfortunately, the symbols are visible in statically compiled libuuid and the names are too generic. Addresses: https://github.com/karelzak/util-linux/issues/548 Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: cleanup UUID_STR_LEN definitionsKarel Zak2017-09-151-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: replace magic number 37 with UUID_STR_LENPhilip Prindeville2017-09-052-1/+3
| | | | Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* libuuid: add support for hash-based UUIDsPhilip Prindeville2017-09-055-2/+165
| | | | | | | | | Adding V3 and V5 UUIDs per RFC-4122. [kzak@redhat.com: - fix symbols file] Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: use access(2) when checking /dev/random availabilitySami Kerola2017-08-051-3/+2Star
| | | | | | | The access(2) is more lightwight than stat(2), and tells whether random device(s) can be read or not, unlike the earlier stat() call. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build: use --runstatedir instead of --localstatedirAndreas Henriksson2017-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The util-linux code was previously aligned to use @localstatedir@ and the util-linux build system was set to override the default to use /run. Current GNU Coding Standards introduced the @runstatedir@ variable for this purpose. Lets use that instead. The GNU default for @runstatedir@ is ${localstatedir}/run so util-linux still override the default to be /run to preserve the status quo from before. The only difference is that you'll now pass --runstatedir to override the location on the command line instead of --localstatedir. (FWIW, Debhelper in compat 11 will automatically start passing --runstatedir=/run to all autotools configured builds. It already passes --localstatedir=/var (to avoid it ending up with the GNU default /usr/local/var) which breaks the util-linux build system code that tries to default it to /run. This change will thus allow util-linux and debhelper to work better together and avoid the need for a package-specific override.) Relevant historic commits: * commit 07a16b9d1e5a48550a0d19abb9a900853433ffa2 "build-sys: change --localstatedir to /run" * commit 80c51185d50f00a2701f9379f10fc48a0f885dfc "uuidd: use run configured state directory" * commit 01c5b787947aeaffc7e56000827e3edefa357c59 "agetty: use configured run state directory" [kzak@redhat.com: - add $runstatedir fallback for autoconf < 2.70 - check for unmodified $localstatedir] CC: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Andreas Henriksson <andreas@fatal.se> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix library order when linkingRuediger Meier2017-06-011-1/+1
| | | | | | | | | | We got some errors on Alpine Linux where $LTLIBINTL is non-empty: ./.libs/libcommon.a(libcommon_la-blkdev.o): In function `open_blkdev_or_file': lib/blkdev.c:282: undefined reference to `libintl_gettext collect2: error: ld returned 1 exit status Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-5/+5
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libuuid: unused parameter [-Wunused-parameter]Karel Zak2017-01-051-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use AC_PROG_MKDIR_P and remove a few gnuismsRuediger Meier2016-03-131-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: fix if..endif for *_la_LDFLAGSKarel Zak2016-03-101-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: always add AM_CFLAGSRuediger Meier2016-02-231-1/+2
| | | | | | | | We were missing our nice compliler warnings for many programs and libs. See next commits how many trivial and non-trival warnings have to be fixed. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: always use global LDADDRuediger Meier2016-02-231-1/+1
| | | | | | | | This was a major showstopper when building on a system where LTLIBINTL libs are needed (e.g. OSX). Maybe there are a few test programs which wouldn't need LDADD ... never mind. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: check linker support for version scriptsRuediger Meier2016-02-181-1/+3
| | | | | | | The macro AX_CHECK_VSCRIPT was taken from gnu autoconf archive. http://www.gnu.org/software/autoconf-archive/ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix some printf format stringsRuediger Meier2016-02-112-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the warnings below for OSX clang and add a few more casts for timeval: lib/at.c:131:27: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'off_t' (aka 'long long') [-Wformat] printf("%16jd bytes ", st.st_size); ~~~~~ ^~~~~~~~~~ lib/strutils.c:522:52: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat] snprintf(buf, sizeof(buf), "%d%s%jd%s", dec, dp, frac, suffix); ~~~ ^~~~ lib/sysfs.c:468:42: warning: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat] len = snprintf(buf, sizeof(buf), "%ju", num); ~~~ ^~~ libuuid/src/gen_uuid.c:316:34: warning: format specifies type 'unsigned long' but the argument has type '__darwin_suseconds_t' (aka 'int') [-Wformat] clock_seq, last.tv_sec, last.tv_usec, adjustment); ^~~~~~~~~~~~ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* tests: make test_uuid_parser to read filesSami Kerola2015-10-181-111/+45Star
| | | | | | | This allows using the command to check uuidgen and uuidd are generating valid outputs. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* tests: add uuid parser checkSami Kerola2015-10-182-5/+11
| | | | | | | The check is based on code by Theodore Ts'o to test libuuid, from which unstable output is commented out. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libuuid: fix buffer overflow with long pathsKarel Zak2015-09-301-1/+6
| | | | | | | | | | Based on patch from Justin Akers, he wrote: > When building Openembedded inside a Jenkins matrix job the paths can > get quite long. This ensures libuuid won't crash when attempting to > connect to uuidd in such a scenario. Reported-by: Justin Akers <dafugg@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: return correct value for uuid_generate_time_safeRomain Bouvier2015-06-181-0/+3
| | | | | | | | | | Make return value consistent for consecutive calls. If you call uuid_generate_time_safe, it should always return -1 if it can't guarantee uniqueness. Without this patch, on consecutive calls where it can't guarantee uniqueness, the first call returns -1, but later calls return 0. Reported-by: Romain Bouvier <skunnyk@alteroot.org> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* build-sys: cleanup library symbol filesKarel Zak2014-11-202-5/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: remove _SVID_SOURCE pre-processor definitionSami Kerola2014-10-011-6/+0Star
| | | | | | | | | | | | | | | | | | | | | | The _SVID_SOURCE is deprecated. In file included from /usr/include/stdio.h:27:0, from libuuid/src/gen_uuid.c:46: /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp] Notice that the Makefile.am has AM_CPPFLAGS = \ -include config.h \ that enforces the config.h is included before any other hearer. In the configure.ac there is AC_USE_SYSTEM_EXTENSIONS that makes all possible features that can be supported in a system are turned on. With these two there is absolutely no need for any legacy _SOURCE definitions. Reference: https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=c941736c92fa3a319221f65f6755659b2a5e0a20 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libuuid: add extern qualifiers to uuid/uuid.h system headerSami Kerola2014-09-191-15/+15
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Only move shared libraries to /lib if they existsThomas Petazzoni2014-06-161-1/+1
| | | | | | | | | | | | | | | | | | In several Makemodule.am, there is a install-exec-hook-<library> target whose role is to move the shared library from /usr/lib to /lib, while keeping a symbolic link /usr/lib/libuuid.so -> ../../lib/<library>.so.<version>. However, when util-linux is built with --enable-static --disable-shared (as is needed on noMMU platforms that don't support shared libraries), no <library>.so is built, but the install-exec-hook-libuuid creates an invalid /usr/lib/<library>.so symbolic link, pointing to ../../lib (yes, the directory). This causes troubles later one when other libraries/programs are compiled with -l<library>, as gcc thinks a shared library is available because there's a file named /usr/lib/<library>.so. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* build-sys: add CFLAGS and LDFLAGS for daemons and shared libsKarel Zak2013-08-271-1/+6
| | | | | | | | This is necessary for paranoid security guys who believe that things like "-Wl,-z,relro" or "-Wl,-z,bind_now" is a way how to make the world a safer place... Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: use O_CLOEXECKarel Zak2013-04-031-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: move tests to check_PROGRAMSKarel Zak2012-07-301-1/+1
| | | | | | Thanks to Mike Frysinger. Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: use run configured state directorySami Kerola2012-07-101-1/+1
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: convert libuuid/ to moduleKarel Zak2012-06-264-145/+56Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: move from /var/run/uuidd to /run/uuiddKarel Zak2012-06-181-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: move clock.txt path to header fileKarel Zak2012-06-182-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: use max() from c.hPetr Uzel2012-05-231-3/+1Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: move read_all to include/all-io.hPetr Uzel2012-05-151-25/+1Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: avoid double open and leaking fd (reworked)Petr Uzel2012-05-102-11/+19
| | | | | | | | | | | | | | This reverts commit 6126f7a53c57485a9a29ddd772765695f23c92e6 and fixes the double open and leaking descriptor in a different way, that is by using newly introduced function 'have_random_source()' to check whether good random source is available while deciding which uuid type to generate (random/time). This is better than calling random_get_fd() twice, passing the file descriptor down the stack and reusing it in next call to random_get_fd(). Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: avoid double open and leaking descriptorPetr Uzel2012-05-042-8/+11
| | | | | | | | | | | | | We are opening /dev/urandom twice in uuid_generate(): first to check if the file is available and then later __uuid_generate_random() again to actually get the random data. Moreover, descriptor from the first open is leaking. Fix by passign the descriptor down the stack and reusing it there. References: http://marc.info/?l=util-linux-ng&m=133406051131131&w=2 Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: don't exec uuiddPetr Uzel2012-05-042-46/+3Star
| | | | | | | | | | Executing the daemon from the shared library is not quite elegant solution. Drop this functionality and require uuidd (should it be needed) to be started from the initscript or by socket-activation. References: http://www.spinics.net/lists/util-linux-ng/msg05967.html Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: use EXIT_FAILUREPetr Uzel2012-05-041-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: use get_fd_tabsize()Karel Zak2012-04-232-14/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: use randutilsDavidlohr Bueso2012-04-102-95/+7Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* build-sys: enhance readability of the autotools filesSami Kerola2012-02-281-5/+17
| | | | | | | | Several horizontal lists are turned to vertical, and sorted to alphabetical order. Additionally spaces are converted to tabs where ever possible. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libuuid: add limits.h include for OPEN_MAXmaximilian attems2011-09-071-0/+1
| | | | | | | Needed as definition for usage in close_all_fds(). Noticed on klibc build. Signed-off-by: maximilian attems <max@stro.at>
* build-sys: use top-level directory for libuuid rather than shlibs/uuidKarel Zak2011-06-0917-0/+1933
Signed-off-by: Karel Zak <kzak@redhat.com>