From 31169e4821d6bd14d35682da6d808ee96cfc0ae8 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 27 Oct 2020 19:01:58 -0400 Subject: Rewrite compat and add configure script --- notemap.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'notemap.c') 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 #include #include @@ -40,18 +38,21 @@ #include #include -#ifndef NO_READPASSPHRASE_H +#ifdef __APPLE__ +#include +#endif + +#ifdef DECLARE_RPP +#define RPP_STDIN 1 +char * readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags); +#else #include #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; -- cgit 1.4.1