Check for zlib.h in addition to libz.

This commit is contained in:
Todd C. Miller
2010-06-16 16:51:46 -04:00
parent d018936b4e
commit ebc152ce8f
6 changed files with 585 additions and 442 deletions

View File

@@ -558,8 +558,8 @@
/* Define to 1 if you have the `waitpid' function. */
#undef HAVE_WAITPID
/* Define to 1 if you the `zlib' library. */
#undef HAVE_ZLIB
/* Define to 1 if you have the <zlib.h> header file. */
#undef HAVE_ZLIB_H
/* Define to 1 if you have the `_getpty' function. */
#undef HAVE__GETPTY

991
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1272,11 +1272,11 @@ AC_ARG_ENABLE(env_debug,
AC_ARG_ENABLE(zlib,
[AS_HELP_STRING([--enable-zlib[[=PATH]]], [Whether to enable or disable zlib])],
[ case "$enableval" in
yes) AC_DEFINE(HAVE_ZLIB)
yes) AC_DEFINE(HAVE_ZLIB_H)
ZLIB="-lz"
;;
no) ;;
*) AC_DEFINE(HAVE_ZLIB)
*) AC_DEFINE(HAVE_ZLIB_H)
CPPFLAGS="${CPPFLAGS} -I${enableval}/include"
SUDO_APPEND_LIBPATH(ZLIB, [$enableval/lib])
ZLIB="${ZLIB} -lz"
@@ -1285,8 +1285,7 @@ AC_ARG_ENABLE(zlib,
])
if test X"$enable_zlib" = X""; then
AC_CHECK_LIB(z, gzdopen, [
AC_DEFINE(HAVE_ZLIB)
ZLIB="-lz"
AC_CHECK_HEADERS(zlib.h, [ZLIB="-lz"])
])
fi
@@ -2867,7 +2866,6 @@ AH_TEMPLATE(WITHOUT_PASSWD, [Define to avoid using the passwd/shadow file for au
AH_TEMPLATE(sig_atomic_t, [Define to `int' if <signal.h> does not define.])
AH_TEMPLATE(__signed, [Define to `signed' or nothing if compiler does not support a signed type qualifier.])
AH_TEMPLATE(USING_NONUNIX_GROUPS, [Define to 1 if using a non-Unix group lookup implementation.])
AH_TEMPLATE(HAVE_ZLIB, [Define to 1 if you the `zlib' library.])
dnl
dnl Bits to copy verbatim into config.h.in

View File

@@ -473,7 +473,7 @@ init_defaults(void)
def_timestamp_timeout = TIMEOUT;
def_passwd_timeout = PASSWORD_TIMEOUT;
def_passwd_tries = TRIES_FOR_PASSWORD;
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
def_compress_io = TRUE;
#endif

View File

@@ -47,7 +47,7 @@
#include <signal.h>
#include <pwd.h>
#include <grp.h>
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
# include <zlib.h>
#endif
@@ -55,7 +55,7 @@
union io_fd {
FILE *f;
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
gzFile g;
#endif
void *v;
@@ -196,7 +196,7 @@ open_io_fd(char *pathbuf, int len, const char *suffix, int docompress)
fd = open(pathbuf, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR);
if (fd != -1) {
fcntl(fd, F_SETFD, FD_CLOEXEC);
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
if (docompress)
vfd = gzdopen(fd, "w");
else
@@ -304,7 +304,7 @@ sudoers_io_close(int exit_status, int error)
for (i = 0; i < IOFD_MAX; i++) {
if (io_fds[i].v == NULL)
continue;
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
if (def_compress_io)
gzclose(io_fds[i].g);
else
@@ -329,7 +329,7 @@ sudoers_io_log(const char *buf, unsigned int len, int idx)
gettimeofday(&now, NULL);
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
if (def_compress_io)
gzwrite(io_fds[idx].g, buf, len);
else
@@ -338,7 +338,7 @@ sudoers_io_log(const char *buf, unsigned int len, int idx)
delay.tv_sec = now.tv_sec;
delay.tv_usec = now.tv_usec;
timevalsub(&delay, &last_time);
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
if (def_compress_io)
gzprintf(io_fds[IOFD_TIMING].g, "%d %f %d\n", idx,
delay.tv_sec + ((double)delay.tv_usec / 1000000), len);

View File

@@ -76,7 +76,7 @@
#ifdef HAVE_REGCOMP
# include <regex.h>
#endif
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
# include <zlib.h>
#endif
#include <signal.h>
@@ -107,7 +107,7 @@ extern int optind;
union io_fd {
FILE *f;
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
gzFile g;
#endif
void *v;
@@ -337,7 +337,7 @@ main(int argc, char *argv[])
/*
* Timing file consists of line of the format: "%f %d\n"
*/
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
while (gzgets(io_fds[IOFD_TIMING].g, buf, sizeof(buf)) != NULL) {
#else
while (fgets(buf, sizeof(buf), io_fds[IOFD_TIMING].f) != NULL) {
@@ -379,7 +379,7 @@ main(int argc, char *argv[])
len = sizeof(buf);
else
len = nbytes;
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
nread = gzread(io_fds[idx].g, buf, len);
#else
nread = fread(buf, 1, len, io_fds[idx].f);
@@ -439,7 +439,7 @@ open_io_fd(char *path, int len, const char *suffix)
path[len] = '\0';
strlcat(path, suffix, PATH_MAX);
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB_H
return gzopen(path, "r");
#else
return fopen(path, "r");