o Make EV_PERSIST timeouts more accurate: schedule the next event based on the scheduled time of the previous event, not based on the current time.
o Allow http.c to handle cases where getaddrinfo returns an IPv6 address. Patch from Ryan Phillips.
o Fix a problem with excessive memory allocation when using multiple event priorities.
- o Default to using arc4random for DNS transaction IDs on systems that have it.
+ o Default to using arc4random for DNS transaction IDs on systems that have it; from OpenBSD.
+ o Never check the environment when we're running setuid or setgid; from OpenBSD.
Changes in 2.0.2-alpha:
AC_HEADER_TIME
dnl Checks for library functions.
-AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r strsep getaddrinfo getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random)
+AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r strsep getaddrinfo getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random issetugid geteuid getegid)
AC_CHECK_SIZEOF(long)
evutil_snprintf(environment, sizeof(environment), "EVENT_NO%s", name);
for (i = 8; environment[i] != '\0'; ++i)
environment[i] = toupper(environment[i]);
- return (getenv(environment) != NULL);
+ return (evutil_getenv(environment) != NULL);
}
int
return NULL;
}
- if (getenv("EVENT_SHOW_METHOD"))
+ if (evutil_getenv("EVENT_SHOW_METHOD"))
event_msgx("libevent using: %s", base->evsel->name);
/* allocate a single active event queue */
}
return 0;
}
+
+static int
+evutil_issetugid(void)
+{
+#ifdef _EVENT_HAVE_ISSETUGID
+ return issetugid();
+#else
+
+#ifdef _EVENT_HAVE_GETEUID
+ if (getuid() != geteuid())
+ return 1;
+#endif
+#ifdef _EVENT_HAVE_GETEGID
+ if (getgid() != getegid())
+ return 1;
+#endif
+ return 0;
+#endif
+}
+
+const char *
+evutil_getenv(const char *varname)
+{
+ if (evutil_issetugid())
+ return NULL;
+
+ return getenv(varname);
+}
int evutil_resolve(int family, const char *hostname, struct sockaddr *sa,
ev_socklen_t *socklen, int port);
+const char *evutil_getenv(const char *name);
+
/* Evaluates to the same boolean value as 'p', and hints to the compiler that
* we expect this value to be false. */
#ifdef __GNUC__X