diff options
Diffstat (limited to '')
-rw-r--r-- | notemap.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/notemap.c b/notemap.c index 9d65a9a..8cdde70 100644 --- a/notemap.c +++ b/notemap.c @@ -25,8 +25,6 @@ * covered work. */ -#include "compat.h" - #include <err.h> #include <inttypes.h> #include <stdbool.h> @@ -40,18 +38,21 @@ #include <time.h> #include <unistd.h> -#ifndef NO_READPASSPHRASE_H +#ifdef __APPLE__ +#include <sys/random.h> +#endif + +#ifdef DECLARE_RPP +#define RPP_STDIN 1 +char * readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags); +#else #include <readpassphrase.h> #endif #include "imap.h" -#if !defined(DIG_PATH) && !defined(DRILL_PATH) -# ifdef __FreeBSD__ -# define DRILL_PATH "/usr/bin/drill" -# else -# define DIG_PATH "dig" -# endif +#ifndef DIG_PATH +#define DIG_PATH "dig" #endif typedef unsigned char byte; @@ -73,10 +74,10 @@ static void lookup(const char **host, const char **port, const char *domain) { dup2(rw[1], STDERR_FILENO); close(rw[1]); #ifdef DRILL_PATH - execlp(DRILL_PATH, DRILL_PATH, buf, "SRV", NULL); + execlp(DRILL_PATH, "drill", buf, "SRV", NULL); err(EX_CONFIG, "%s", DRILL_PATH); #else - execlp(DIG_PATH, DIG_PATH, "-t", "SRV", "-q", buf, "+short", NULL); + execlp(DIG_PATH, "dig", "-t", "SRV", "-q", buf, "+short", NULL); err(EX_CONFIG, "%s", DIG_PATH); #endif } @@ -124,7 +125,9 @@ static void lookup(const char **host, const char **port, const char *domain) { static const char *uuidGen(void) { byte uuid[16]; - arc4random_buf(uuid, sizeof(uuid)); + int error = getentropy(uuid, sizeof(uuid)); + if (error) err(EX_OSERR, "getentropy"); + uuid[6] &= 0x0F; uuid[6] |= 0x40; uuid[8] &= 0x3F; |