提交 dffd72f1 编写于 作者: R Richard Levitte

Make it possible for people to tell where the EGD socket is through

the RANDEGD environment variable.
上级 3b3bc455
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
* *
*/ */
#include <stdlib.h>
#include <openssl/rand.h> #include <openssl/rand.h>
/* Query the EGD <URL: http://www.lothar.com/tech/crypto/>. /* Query the EGD <URL: http://www.lothar.com/tech/crypto/>.
...@@ -83,12 +84,17 @@ int RAND_egd_bytes(const char *path,int bytes) ...@@ -83,12 +84,17 @@ int RAND_egd_bytes(const char *path,int bytes)
int RAND_egd(const char *path) int RAND_egd(const char *path)
{ {
const char *s;
int ret = -1; int ret = -1;
struct sockaddr_un addr; struct sockaddr_un addr;
int len, num; int len, num;
int fd = -1; int fd = -1;
unsigned char buf[256]; unsigned char buf[256];
s=getenv("RANDEGD");
if (s != NULL)
path = s;
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
if (strlen(path) > sizeof(addr.sun_path)) if (strlen(path) > sizeof(addr.sun_path))
...@@ -115,12 +121,17 @@ int RAND_egd(const char *path) ...@@ -115,12 +121,17 @@ int RAND_egd(const char *path)
int RAND_egd_bytes(const char *path,int bytes) int RAND_egd_bytes(const char *path,int bytes)
{ {
const char *s;
int ret = 0; int ret = 0;
struct sockaddr_un addr; struct sockaddr_un addr;
int len, num; int len, num;
int fd = -1; int fd = -1;
unsigned char buf[255]; unsigned char buf[255];
s=getenv("RANDEGD");
if (s != NULL)
path = s;
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
if (strlen(path) > sizeof(addr.sun_path)) if (strlen(path) > sizeof(addr.sun_path))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册