summaryrefslogtreecommitdiff
path: root/os/auth.c
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-11-19 18:10:46 -0500
committerEamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil>2007-11-19 18:10:46 -0500
commit2d17f47cc7d6b174857617d31ad1b437d8e97d94 (patch)
tree90fb5d8d63fa0c121eef355affce79d1d84a2bbe /os/auth.c
parent60be452c2e88342f92a76ba5ec7d90b5b0211aaf (diff)
parentea9c63e93b9bb731796e8a8de2d127e6cc720076 (diff)
Merge branch 'master' into XACE-SELINUX
Conflicts: hw/xnest/Pixmap.c include/dix.h
Diffstat (limited to 'os/auth.c')
-rw-r--r--os/auth.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/os/auth.c b/os/auth.c
index d2aa980a8..dab4f60bd 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -314,6 +314,20 @@ GenerateAuthorization(
return -1;
}
+#ifdef HAVE_URANDOM
+
+void
+GenerateRandomData (int len, char *buf)
+{
+ int fd;
+
+ fd = open("/dev/urandom", O_RDONLY);
+ read(fd, buf, len);
+ close(fd);
+}
+
+#else /* !HAVE_URANDOM */
+
/* A random number generator that is more unpredictable
than that shipped with some systems.
This code is taken from the C standard. */
@@ -351,4 +365,6 @@ GenerateRandomData (int len, char *buf)
/* XXX add getrusage, popen("ps -ale") */
}
+#endif /* HAVE_URANDOM */
+
#endif /* XCSECURITY */