summaryrefslogtreecommitdiffstats
path: root/misc-utils/uuidd.c
Commit message (Collapse)AuthorAgeFilesLines
* uuidd: clean up error messagesKarel Zak2013-05-151-46/+31Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: use UTIL_LINUX_VERSION everywhereKarel Zak2013-01-251-3/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: move read_all to include/all-io.hPetr Uzel2012-05-151-24/+0Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* include: rename writeall.h to all-io.hPetr Uzel2012-05-151-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: avoid double open and leaking fd (reworked)Petr Uzel2012-05-101-2/+2
| | | | | | | | | | | | | | 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>
* uuidd: remove unnecessary variablesKarel Zak2012-05-041-22/+16Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: avoid double open and leaking descriptorPetr Uzel2012-05-041-2/+2
| | | | | | | | | | | | | 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>
* uuidd: introduce uuidd_cxt to pass arguments to server loopPetr Uzel2012-05-041-20/+36
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: do not drop privilegesPetr Uzel2012-05-041-31/+1Star
| | | | | | | | | | | | | libuuid can (for now) spawn uuidd on-demand. To support this scenario, uuidd should be installed setuid/setgid to have access to /var/lib/libuuid/clock.txt. Therefore, dropping the privileges is not functional, so removing this ability. Moreover, the ability to spawn uuidd on-demand will be removed anyway. References: http://www.spinics.net/lists/util-linux-ng/msg05934.html Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: print all debugging information to stderrPetr Uzel2012-05-041-14/+15
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: implement --socket-activation optionPetr Uzel2012-05-041-44/+90
| | | | | | | | | | | | | | Implement --socket-activation option, which is supposed to be used with systemd (or equivalent init system) socket activation mechanism. With this option, the UUID daemon does not create the socket on its own, but instead expect the connection fd to be provided by the calling process. This option is only available if util-linux is configured with --enable-socket-activation option. With this configure option, the uuidd is compiled with sd-daemon.c. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: factor out socket creation into separate functionPetr Uzel2012-05-041-28/+46
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: implement --no-fork optionPetr Uzel2012-05-041-6/+12
| | | | | | | With this option, uuidd does not daemonize itself but stays in the foreground. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: use ignore_result helperPetr Uzel2012-05-041-3/+2Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: implement --no-pid optionPetr Uzel2012-05-041-12/+36
| | | | | | With this option, uuidd does not create the PID file. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: factor out pidfile creation into separate functionPetr Uzel2012-05-041-14/+34
| | | | | | Introduce create_pidfile() function. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: remove useless initialization of cleanup_socketPetr Uzel2012-05-041-1/+0Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: use UUIDD_OP_GETPID instead of magic numberPetr Uzel2012-05-041-2/+2
| | | | | | | | | Make parameters passed to call_daemon() more descriptive: - use UUIDD_OP_GETPID instead of magic number 0 - call_daemon() takes pointer as a last argument, so pass NULL instead of 0 Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* misc-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: use %m in format string instead of %s and strerror(errno)Petr Uzel2011-09-271-16/+9Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: Add missing break to option case statementEric Sandeen2011-09-271-0/+1
| | | | | | | | Specifying the "-n" option to uuidd would incorrectly fall through to the "-p" case, and assign that number to the pidfile_path. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
* uuidd: cleanup usage()Karel Zak2011-08-161-15/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: distinguish between singular and plural in three messagesBenno Schulenberg2011-08-021-4/+10
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* uuidd: fix compiler warnings [-Wsign-compare]Karel Zak2011-08-011-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: coding style fixesSami Kerola2011-06-251-22/+25
| | | | | | Few unnecessary void casts removed, rest is about spacing. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: remove goto statementSami Kerola2011-06-251-8/+10
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: use symbolic exit and return valuesSami Kerola2011-06-251-17/+17
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: die() function removedSami Kerola2011-06-251-14/+9Star
| | | | | | The function is replaced with err(). Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: long options & new usageSami Kerola2011-06-251-10/+45
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: add "-q" to synopsis, order options alphabeticallyBenno Schulenberg2011-03-081-8/+8
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libuuid: rename uuid__generate_* to __uuid_generate_*Petr Uzel2011-02-161-4/+4
| | | | | | | | Having uuid_generate_time and uuid__generate_time at the same time is confusing. These functions are exported, but not part of the official API (used by uuidd only). Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: correctly report number of generated subsequent UUIDsPetr Uzel2011-02-081-2/+2
| | | | | | | | Before this change, "uuidd -t -n 1" reported "6fd0672e-2f9b-11e0-b9c8-000feae00cb0 and subsequent 1 UUIDs". That is two subsequent UUIDs, which is not correct. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: fix -n usagePetr Uzel2011-02-081-1/+1
| | | | | | It does not make sense to request zero UUIDs - report error. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: increase connection backlog size to SOMAXCONNPetr Uzel2011-02-081-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: use write_all from include/writeall.hPetr Uzel2011-02-081-20/+2Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: use die() where possiblePetr Uzel2011-02-081-6/+4Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: use daemon(3) library functionPetr Uzel2011-02-081-17/+2Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: use UUID_STR_LEN and UUID_LENPetr Uzel2011-02-081-11/+17
| | | | | | | | | | Use named constants for lentgh of UUID's binary and textual representation, instead of magic numbers. [kzak@redhat.com: - use sizeof(uuid_t) rather than hardcoded size] Signed-off-by: Petr Uzel <petr.uzel@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: use UUIDD_OP_BULK_*_UUID named constantsPetr Uzel2011-02-081-6/+9
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: fix uuidd -r -n 2Petr Uzel2011-02-081-1/+1
| | | | | | | uuidd -r -n 2 failed with "Unexpected reply length from server 36". Fixed by this patch. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* messages: gettextize a few skipped or forgotten onesBenno Schulenberg2010-06-141-3/+3
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* uuidd: spell the plural of "UUID" consistently as "UUIDs"Benno Schulenberg2010-06-141-3/+3
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libuuid, uuidd: Avoid infinite loop while reading from the socket fdTheodore Ts'o2009-07-011-5/+9
| | | | | | | | | | If for some reason the uuidd daemon or the process calling uuidd exited unexpectely, the read_all() function would end up looping forever, either in uuidd or in libuuid. Fix this terminating the loop if no data can be read after five tries to read from the file descriptor. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* uuidd: Avoid closing the server socket when calling create_daemon()Theodore Ts'o2009-07-011-0/+12
| | | | | | | | | In the event that file descriptors 0-2 are closed when uuidd is started, the server socket could be created as a file descriptor that will get closed when create_daemon() tries detaching the uuidd daemon from its controlling tty. Avoid this case by using dup(2). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* uuidd: new command (UUID daemon from e2fsprogs)Karel Zak2009-05-221-0/+572
Signed-off-by: Karel Zak <kzak@redhat.com>