Commit Graph

30 Commits (67ab6bc86b19912d970c6b45e63b7bc93ca38494)

Author SHA1 Message Date
Theodore Ts'o edeee8f36f libuuid: Make sure execl() variadic function is properly terminated
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-01-27 00:22:52 -05:00
Theodore Ts'o 29dd9d1e90 Test for sys/syscall.h in configure to fix dietlibc build problem
When compiling with dietlibc, sys/syscall.h isn't supported; as of
dietlibc 0.30, it exists but it references a non-existent asm/unistd.h
header file.  So we have to test for its existence and avoid using it
in lib/uuid/gen_uuid.c if it is not supported.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-31 22:34:25 -05:00
Theodore Ts'o 5610f9924b Add --disable-uuidd configure option
Add a configure option which causes the uuidd helper daemon not to be
built or used by the uuid library.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-31 22:34:19 -05:00
Theodore Ts'o f79fb4976c libuuid: Fix bug which caused uuidd to fail if sizeof(int) != sizeof(int *)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-21 11:32:48 -05:00
Theodore Ts'o d37a4fa788 libuuid: Only try to start the uuidd daemon a limited number of times
If we fail to create the uuidd daemon after 5 or 6 tries, another
10,000 tries probably won't be successful.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-17 15:26:47 -05:00
Theodore Ts'o 9d8c203a46 libuuid: When starting uuidd, use waitpid() to reap the zombie process
The uuidd process will fork and let the parent process exit to create
the daemon.  So use waitpid to reap the zombie, as well as using it to
time when it is safe to try to connect to the daemon.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-17 15:16:44 -05:00
Theodore Ts'o 740837def7 Add uuidd daemon to prevent duplicate time-based UUID's
Also store the clock sequence information in a state file in
/var/lib/misc/uuid-clock so that if the time goes backwards the clock
sequence counter can get bumped.  This allows us to completely
correctly generate time-based (version 1) UUID's according to the
algorithm specified RFC 4122.

Addresses-Sourceforge-Bug: #1529672
Addresses-Red-Hat-Bugzilla: #233471

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-16 17:28:46 -05:00
Theodore Ts'o ae2868acf0 Add failsafe against duplicate UUID's generated by threaded programs
Add in randomness based on Linux's thread id (gettid) to avoid race
conditions when two threads try to generate uuid's at the same time.
This shouldn't be an issue if /dev/urandom has proper locking and is
present, so this is just a failsafe.

Addresses SourceForge Bug: #1529672

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-10-22 00:18:49 -04:00
Theodore Ts'o 2adc320f01 Set FD_CLOEXEC on the /dev/random file descriptor used by libuuid
This avoids a fd leak across an execve() which was causing problems
for the LVM tools.

(Addresses Debian Bug: #345832)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-06 18:10:02 -05:00
Theodore Ts'o 9ee42c9509 gen_uuid.c (get_node_id): glibc always defines AF_LINK, so only
try to use struct sockaddr_dl if HAVE_NET_IF_DL_H is
	defined.  (Addresses Debian Bug #256669)
2004-09-17 20:38:27 -04:00
Theodore Ts'o d1492994a5 gen_uuid.c (uuid_generate_time): Mask off the timestamp to avoid
a Y8.8888K problem.
2004-05-04 20:51:02 -04:00
Theodore Ts'o 2625803ecf Use C99 stdint.h types instead of custom types in the uuid library. 2004-04-03 10:20:26 -05:00
Theodore Ts'o 13be1fff00 gen_uuid.c (get_node_id): Clean up AF_LINK #ifdef's for Darwin. 2004-03-30 01:32:31 -05:00
Theodore Ts'o 1bbfec624c Change the license on the UUID library to be 3-clause BSD-style 2004-03-20 14:02:24 -05:00
Theodore Ts'o 84ea6e70b7 Fix Darwin/Mac OS X support to fetch the ethernet address in the uuid library. 2004-03-19 19:29:17 -05:00
Theodore Ts'o 9c5534d484 gen_uuid.c (uuid_generate_time): Fix bug pointed out by Ralf
S. Engelshall; when generating a random ethernet address
	because one is not available, set the least significant
	bit of the first byte of the MAC address, since it is the
	first bit to be transmitted, and is therefore the
	multicast bit.
2004-01-30 02:07:13 -05:00
Theodore Ts'o fff45483ed Add portability enhancements for Cygwin32 environment. 2003-04-13 00:44:19 -04:00
Theodore Ts'o edab294f1c gen_uuid.c (get_random_bytes): Always xor in a stream of bytes
from the system PRNG (i.e., random/srandom, seeded from
	the time, pid, and uid) in case /dev/random isn't doing
	the right thing on a particular system.  It doesn't hurt,
	and it can help, in the case of a buggy /dev/random.
2003-04-03 08:25:15 -05:00
Theodore Ts'o 61bee88d45 gen_uuid.c (get_random_bytes): Don't spin forever if read()
returns EINTR or EAGAIN, so that when /dev/random is
	opened O_NONBLOCK, we don't end up spinning forever.
2002-10-31 15:17:16 -05:00
Theodore Ts'o b1416db322 ChangeLog, compare.c, gen_uuid.c, parse.c:
parse.c, compare.c: Include string.h to fix gcc -Wall complaints.
  gen_uuid.c: Define _SVID_SOURCE to avoid gcc -Wall errors because some
  	required structures wouldn't be otherwise defined.  Fix a minor gcc
  	-Wall nit in the declaration of get_random_fd().
2001-05-01 15:32:44 +00:00
Theodore Ts'o 96394d11b0 ChangeLog, copy.c, gen_uuid.c, tst_uuid.c, uuid_time.c:
uuid_time.c (main), tst_uuid.c (main): Fix gcc -Wall complaints.
  copy.c (uuid_copy): Change arguments to make it clear which argument
  	is the source and which is the destination.
  gen_uuid.c (get_random_fd): Use gettimeofday to seed the PRNG, so we
  	can take advantage of tv_usec to do (slightly) better at seeding it.
2001-01-12 18:30:54 +00:00
Theodore Ts'o 5dd7ff07d0 ChangeLog, gen_uuid.c:
gen_uuid.c (get_random_bytes): Use O_NONBLOCK when trying to open
  	/dev/random.  Break out the /dev/random initialization code into a
  	get_random_fd() function, and use that function in uuid_generate() to
  	determine whether to use uuid_generate_random() or
  	uuid_generate_time().
2000-06-12 17:35:13 +00:00
Theodore Ts'o 3030daa8ab Many files:
clear.c, compare.c, copy.c, gen_uuid.c, isnull.c, pack.c, parse.c,
  	uuid.h, uuidP.h: Changed copyright to be the LGPL.
2000-04-07 20:06:04 +00:00
Theodore Ts'o fa7cc28004 ChangeLog, gen_uuid.c:
gen_uuid.c (get_clock): Fix bug where the last timeval wasn't getting
  	set, causing potentially duplicate UUID's to be generated.
2000-04-03 16:51:06 +00:00
Theodore Ts'o e589f678e1 ChangeLog, gen_uuid.c:
gen_uuid.c (get_random_bytes): Make more paranoid about misbehaving
  	/dev/urandom.  If we get a return of zero without an error more than 8
  	times in a row, we break out and return an error.  Also, if
  	/dev/urandom doesn't exist, try /dev/random.
ChangeLog, ext2fs.h:
  ext2fs.h: Use AUTOCONF SIZEOF_* macros if available to determine how
  	to define __s64 and __u64.  Turn off "compression is experimental"
  	warning if the cpp macro I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL is
  	defined.
2000-04-03 13:45:40 +00:00
Theodore Ts'o b19d1a959e Many files:
* gen_uuid.c (get_random_bytes): Use a while loop when reading from
  	/dev/urandom so that if we get interrupted while reading the right
  	thing happens.
  	(uuid_generate_random): Add new function which uses the new UUID
  	format which uses 122 random bits to form the 128-bit UUID.
  	(uuid_generate): Rename the old uuid_generate to be
  	uuid_generate_time, and create a new uuid_generate function which
  	calls either uuid_generate_random or uuid_genereate_time depending on
  	whether /dev/urandom is present.
  uuid_generate.3.in: Update to reflect changesin uuid_generate and its
  	two new variants.
  tst_uuid.c: Updated to test new uuid_generate functions, and to
  	reflect new semantics of uuid_compare.  Added tests to make sure the
  	UUID type and variant created by UUID generate is correct.
  uuid_time.c (uuid_variant, uuid_type): Added new functions to return
  	the UUID variant and type information.  The debugging program now
  	prints the UUID variant and type, and warns if the unparsed time
  	information is likely to be incorrect.
  uuid_parse.3.in, libuuid.3.in: Miscellaneous text cleanups.
uuidgen.1.in:
  Miscellaneous text cleanups.
1999-06-18 00:32:03 +00:00
Theodore Ts'o dc3710e5ea ChangeLog, gen_uuid.c:
gen_uuid.c (get_node_id): Use char * instead of caddr_t, which doesn't
  always exist for glibc.
1998-03-09 03:34:48 +00:00
Theodore Ts'o d546447fda ChangeLog, gen_uuid.c:
Use clock_reg instead of clock, since clock conflicts with a header
  file declaration.
1997-10-15 01:52:44 +00:00
Theodore Ts'o 19c78dc07f Many files:
Checked in e2fsprogs-1.07
1997-04-29 16:17:09 +00:00
Theodore Ts'o 1e3472c5f3 Many files:
Checked in e2fsprogs 1.05
1997-04-29 14:53:37 +00:00