~mdw
/
yaid
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pull fetching random bytes into the system-specific code.
[yaid]
/
yaid.c
diff --git
a/yaid.c
b/yaid.c
index
da015e1
..
13e1208
100644
(file)
--- a/
yaid.c
+++ b/
yaid.c
@@
-88,7
+88,6
@@
static fwatch polfw; /* Watch policy file for changes */
static unsigned char tokenbuf[4096]; /* Random-ish data for tokens */
static size_t tokenptr = sizeof(tokenbuf); /* Current read position */
static unsigned char tokenbuf[4096]; /* Random-ish data for tokens */
static size_t tokenptr = sizeof(tokenbuf); /* Current read position */
-static int randfd; /* File descriptor for random data */
static struct client *dead_clients = 0; /* List of defunct clients */
static struct proxy *dead_proxies = 0; /* List of defunct proxies */
static struct client *dead_clients = 0; /* List of defunct clients */
static struct proxy *dead_proxies = 0; /* List of defunct proxies */
@@
-626,8
+625,7
@@
static void user_token(char *p)
* from the kernel.
*/
if (tokenptr + TOKENRANDSZ >= sizeof(tokenbuf)) {
* from the kernel.
*/
if (tokenptr + TOKENRANDSZ >= sizeof(tokenbuf)) {
- if (read(randfd, tokenbuf, sizeof(tokenbuf)) < sizeof(tokenbuf))
- die(1, "unexpected short read or error from `/dev/urandom'");
+ fill_random(tokenbuf, sizeof(tokenbuf));
tokenptr = 0;
}
tokenptr = 0;
}
@@
-1092,12
+1090,6
@@
int main(int argc, char *argv[])
if (load_policy_file(policyfile, &policy))
exit(1);
if (load_policy_file(policyfile, &policy))
exit(1);
- /* Open the random data source. */
- if ((randfd = open("/dev/urandom", O_RDONLY)) < 0) {
- die(1, "failed to open `/dev/urandom' for reading: %s",
- strerror(errno));
- }
-
/* Set up the I/O event system. */
sel_init(&sel);
/* Set up the I/O event system. */
sel_init(&sel);