]> granicus.if.org Git - sudo/commitdiff
Remove support for compilers that don't support void *
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 31 Aug 2007 23:30:07 +0000 (23:30 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 31 Aug 2007 23:30:07 +0000 (23:30 +0000)
31 files changed:
aclocal.m4
alias.c
alloc.c
auth/API
auth/afs.c
auth/bsdauth.c
auth/kerb4.c
auth/kerb5.c
auth/pam.c
auth/securid.c
auth/securid5.c
auth/sia.c
auth/sudo_auth.h
config.h.in
configure.in
env.c
ldap.c
list.c
list.h
memrchr.c
parse.c
parse.h
pwutil.c
redblack.c
redblack.h
snprintf.c
sudo.c
sudo.h
testsudoers.c
visudo.c
zero_bytes.c

index 7e1611f55092a72350419c83b376629ae17dfcd9..42eccae7f695cea968a2843d2932ba85c3bae71f 100644 (file)
@@ -155,15 +155,6 @@ else
 fi
 ])dnl
 
-dnl
-dnl check for fullly working void
-dnl
-AC_DEFUN(SUDO_FULL_VOID, [AC_MSG_CHECKING(for full void implementation)
-AC_TRY_COMPILE(, [void *foo;
-foo = (void *)0; (void *)"test";], AC_DEFINE(VOID, void, [Define to "void" if your compiler supports void pointers, else use "char"].)
-AC_MSG_RESULT(yes), AC_DEFINE(VOID, char)
-AC_MSG_RESULT(no))])
-
 dnl
 dnl SUDO_CHECK_TYPE(TYPE, DEFAULT)
 dnl XXX - should require the check for unistd.h...
diff --git a/alias.c b/alias.c
index 067cbd5347eb0081083a77a51c459bbe221939e5..79c296be57917515f59be324932a9e6bc411fc11 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -56,8 +56,8 @@ struct rbtree *aliases;
 /*
  * Local protoypes
  */
-static int   alias_compare     __P((const VOID *, const VOID *));
-static void  alias_free                __P((VOID *));
+static int   alias_compare     __P((const void *, const void *));
+static void  alias_free                __P((void *));
 
 /*
  * Comparison function for the red-black tree.
@@ -65,7 +65,7 @@ static void  alias_free               __P((VOID *));
  */
 static int
 alias_compare(v1, v2)
-    const VOID *v1, *v2;
+    const void *v1, *v2;
 {
     const struct alias *a1 = (const struct alias *)v1;
     const struct alias *a2 = (const struct alias *)v2;
@@ -128,8 +128,8 @@ alias_add(name, type, members)
  */
 void
 alias_apply(func, cookie)
-    int (*func) __P((VOID *, VOID *));
-    VOID *cookie;
+    int (*func) __P((void *, void *));
+    void *cookie;
 {
     rbapply(aliases, func, cookie, inorder);
 }
@@ -148,11 +148,11 @@ no_aliases()
  */
 static void
 alias_free(v)
-    VOID *v;
+    void *v;
 {
     struct alias *a = (struct alias *)v;
     struct member *m;
-    VOID *next;
+    void *next;
 
     for (m = a->members.first; m != NULL; m = next) {
        next = m->next;
diff --git a/alloc.c b/alloc.c
index 58123fb24ca37e9ec453db91b43f85dca6f8208c..f6c3a8aa653f5fd05c745774cdba5275d0da9074 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -66,16 +66,16 @@ __unused static const char rcsid[] = "$Sudo$";
  * emalloc() calls the system malloc(3) and exits with an error if
  * malloc(3) fails.
  */
-VOID *
+void *
 emalloc(size)
     size_t size;
 {
-    VOID *ptr;
+    void *ptr;
 
     if (size == 0)
        errorx(1, "internal error, tried to emalloc(0)");
 
-    if ((ptr = (VOID *) malloc(size)) == NULL)
+    if ((ptr = (void *) malloc(size)) == NULL)
        errorx(1, "unable to allocate memory");
     return(ptr);
 }
@@ -84,12 +84,12 @@ emalloc(size)
  * emalloc2() allocates nmemb * size bytes and exits with an error
  * if overflow would occur or if the system malloc(3) fails.
  */
-VOID *
+void *
 emalloc2(nmemb, size)
     size_t nmemb;
     size_t size;
 {
-    VOID *ptr;
+    void *ptr;
 
     if (nmemb == 0 || size == 0)
        errorx(1, "internal error, tried to emalloc2(0)");
@@ -97,7 +97,7 @@ emalloc2(nmemb, size)
        errorx(1, "internal error, emalloc2() overflow");
 
     size *= nmemb;
-    if ((ptr = (VOID *) malloc(size)) == NULL)
+    if ((ptr = (void *) malloc(size)) == NULL)
        errorx(1, "unable to allocate memory");
     return(ptr);
 }
@@ -107,16 +107,16 @@ emalloc2(nmemb, size)
  * realloc(3) fails.  You can call erealloc() with a NULL pointer even
  * if the system realloc(3) does not support this.
  */
-VOID *
+void *
 erealloc(ptr, size)
-    VOID *ptr;
+    void *ptr;
     size_t size;
 {
 
     if (size == 0)
        errorx(1, "internal error, tried to erealloc(0)");
 
-    ptr = ptr ? (VOID *) realloc(ptr, size) : (VOID *) malloc(size);
+    ptr = ptr ? (void *) realloc(ptr, size) : (void *) malloc(size);
     if (ptr == NULL)
        errorx(1, "unable to allocate memory");
     return(ptr);
@@ -128,9 +128,9 @@ erealloc(ptr, size)
  * You can call erealloc() with a NULL pointer even if the system realloc(3)
  * does not support this.
  */
-VOID *
+void *
 erealloc3(ptr, nmemb, size)
-    VOID *ptr;
+    void *ptr;
     size_t nmemb;
     size_t size;
 {
@@ -141,7 +141,7 @@ erealloc3(ptr, nmemb, size)
        errorx(1, "internal error, erealloc3() overflow");
 
     size *= nmemb;
-    ptr = ptr ? (VOID *) realloc(ptr, size) : (VOID *) malloc(size);
+    ptr = ptr ? (void *) realloc(ptr, size) : (void *) malloc(size);
     if (ptr == NULL)
        errorx(1, "unable to allocate memory");
     return(ptr);
@@ -217,7 +217,7 @@ evasprintf(ret, format, args)
  */
 void
 efree(ptr)
-    VOID *ptr;
+    void *ptr;
 {
     if (ptr != NULL)
        free(ptr);
index d586c640a922ae6cb39790175542f051cc96226d..fd183fe8421054c9f3350adf5dd78a1b8d0bd000 100644 (file)
--- a/auth/API
+++ b/auth/API
@@ -10,7 +10,7 @@ typedef struct sudo_auth {
     short flags;                /* various flags, see below */
     short status;               /* status from verify routine */
     char *name;                        /* name of the method in string form */
-    VOID *data;                 /* method-specific data pointer */
+    void *data;                 /* method-specific data pointer */
 
     int (*init) __P((struct passwd *pw, char **prompt, sudo_auth *auth));
     int (*setup) __P((struct passwd *pw, char **prompt, sudo_auth *auth));
index a12e3c3982224a82128530dc4fca5c958b0fd358..e5b8ea944e04c314dd04b1eafbe8156be929b79a 100644 (file)
@@ -46,7 +46,6 @@
 #include "sudo.h"
 #include "sudo_auth.h"
 
-#undef VOID
 #include <afs/stds.h>
 #include <afs/kautils.h>
 
index 437b44b50916a721955363ca5209b818f03591c3..f76314531dec300cfe5a9fab416eb81907fdbb43 100644 (file)
@@ -88,7 +88,7 @@ bsdauth_init(pw, promptp, auth)
        return(AUTH_FATAL);
     }
 
-    auth->data = (VOID *) as;
+    auth->data = (void *) as;
     return(AUTH_SUCCESS);
 }
 
index 284a2392d067fbd95ea8a48108b5ec34b3a48372..39ea06a68d0e228dfa83c3ad107a54137ecf97d1 100644 (file)
@@ -68,7 +68,7 @@ kerb4_init(pw, promptp, auth)
        return(AUTH_FAILURE);
 
     /* Stash a pointer to the realm (used in kerb4_verify) */
-    auth->data = (VOID *) realm;
+    auth->data = (void *) realm;
 
     return(AUTH_SUCCESS);
 }
index 0824b274791ce0a35e82ce12b7232def24660ae9..b9527475c70cfbb9deeb544fbd58132837ce5c3b 100644 (file)
@@ -89,7 +89,7 @@ kerb5_init(pw, promptp, auth)
     char               cache_name[64];
     char               *pname;
 
-    auth->data = (VOID *) &sudo_krb5_data; /* Stash all our data here */
+    auth->data = (void *) &sudo_krb5_data; /* Stash all our data here */
 
 #ifdef HAVE_KRB5_INIT_SECURE_CONTEXT
     error = krb5_init_secure_context(&(sudo_krb5_data.sudo_context));
index 1c947d9dc6eacd38b10fba5335ccd9db96b98f88..244ea371562bfd674c20c99018f47333297a1333 100644 (file)
@@ -67,7 +67,7 @@ __unused static const char rcsid[] = "$Sudo$";
 #endif /* lint */
 
 static int sudo_conv __P((int, PAM_CONST struct pam_message **,
-                         struct pam_response **, VOID *));
+                         struct pam_response **, void *));
 static char *def_prompt;
 
 #ifndef PAM_DATA_SILENT
@@ -87,7 +87,7 @@ pam_init(pw, promptp, auth)
 
     /* Initial PAM setup */
     if (auth != NULL)
-       auth->data = (VOID *) &pam_status;
+       auth->data = (void *) &pam_status;
     pam_conv.conv = sudo_conv;
     pam_status = pam_start("sudo", pw->pw_name, &pam_conv, &pamh);
     if (pam_status != PAM_SUCCESS) {
@@ -231,7 +231,7 @@ sudo_conv(num_msg, msg, response, appdata_ptr)
     int num_msg;
     PAM_CONST struct pam_message **msg;
     struct pam_response **response;
-    VOID *appdata_ptr;
+    void *appdata_ptr;
 {
     struct pam_response *pr;
     PAM_CONST struct pam_message *pm;
index 8c8dcb916db0c6a55cd52fe0021e34a494f5bb12..7d1fac795ed90bf63a602ba4f2dc3824be049103 100644 (file)
@@ -67,7 +67,7 @@ securid_init(pw, promptp, auth)
 {
     static struct SD_CLIENT sd_dat;            /* SecurID data block */
 
-    auth->data = (VOID *) &sd_dat;             /* For method-specific data */
+    auth->data = (void *) &sd_dat;             /* For method-specific data */
 
     if (creadcfg() == 0)
        return(AUTH_SUCCESS);
index 97d7b12ce0ce4b1698c6d219d99b43ff0bf1a007..25c84b46ec39c45103e33edac780dd31458cf682 100644 (file)
@@ -79,7 +79,7 @@ securid_init(pw, promptp, auth)
 {
     static SDI_HANDLE sd_dat;                  /* SecurID handle */
 
-    auth->data = (VOID *) &sd_dat;             /* For method-specific data */
+    auth->data = (void *) &sd_dat;             /* For method-specific data */
 
     /* Start communications */
     if (AceInitialize() != SD_FALSE)
index 415f0d8e98d5d432341338ea8279ba51aca1d6ba..0fad9081087275aa049abc724f3a49210f4d8dc2 100644 (file)
@@ -108,7 +108,7 @@ sia_setup(pw, promptp, auth)
        return(AUTH_FATAL);
     }
 
-    auth->data = (VOID *) siah;
+    auth->data = (void *) siah;
     return(AUTH_SUCCESS);
 }
 
index fabf95e72c3fb6d6bcadb615bcfcd688d9640968..0a2b231b481269de79987c13b089aedea8d4d93a 100644 (file)
@@ -28,7 +28,7 @@ typedef struct sudo_auth {
     short flags;               /* various flags, see below */
     short status;              /* status from verify routine */
     char *name;                        /* name of the method as a string */
-    VOID *data;                        /* method-specific data pointer */
+    void *data;                        /* method-specific data pointer */
     int (*init) __P((struct passwd *pw, char **prompt, struct sudo_auth *auth));
     int (*setup) __P((struct passwd *pw, char **prompt, struct sudo_auth *auth));
     int (*verify) __P((struct passwd *pw, char *p, struct sudo_auth *auth));
index c2ed862eb527076a1bf149847508ce9804655b67..33d50e7a9d4c6062c8d3235386b6bc833f206faa 100644 (file)
 /* Define to 1 if you want a different ticket file for each tty. */
 #undef USE_TTY_TICKETS
 
-/* Define to "void" if your compiler supports void pointers, else use "char".
-   */
-#undef VOID
-
 /* Define to avoid using the passwd/shadow file for authentication. */
 #undef WITHOUT_PASSWD
 
index 1e612f083c67f3ce67c511786193956485904147..0040ccf3dd9c4d06878df3c25e116244fc5abe97 100644 (file)
@@ -1654,7 +1654,6 @@ SUDO_TYPE_SIZE_T
 SUDO_TYPE_SSIZE_T
 SUDO_TYPE_DEV_T
 SUDO_TYPE_INO_T
-SUDO_FULL_VOID
 SUDO_UID_T_LEN
 SUDO_TYPE_LONG_LONG
 SUDO_SOCK_SA_LEN
diff --git a/env.c b/env.c
index e1d6d12defd1387b644366e4b6fc51546fa8b74e..4fdc5e60e355576915e97479ff2b7800c500bb5e 100644 (file)
--- a/env.c
+++ b/env.c
@@ -88,7 +88,7 @@ __unused static const char rcsid[] = "$Sudo$";
 #define KEPT_MAX       0xff00
 
 #undef VNULL
-#define        VNULL   (VOID *)NULL
+#define        VNULL   (void *)NULL
 
 struct environment {
     char **envp;               /* pointer to the new environment */
diff --git a/ldap.c b/ldap.c
index df0f9b0e9fccc2f7fd796befe061e8e7cc7e0f25..9445bcc92dbcf60df07687bed9464c1e21ab6a6c 100644 (file)
--- a/ldap.c
+++ b/ldap.c
@@ -109,13 +109,14 @@ struct ldap_config {
     int bind_timelimit;
     int use_sasl;
     int rootuse_sasl;
+    int use_ssl;
+    int start_tls;
     char *host;
     char *uri;
     char *binddn;
     char *bindpw;
     char *rootbinddn;
     char *base;
-    char *ssl;
     char *tls_cacertfile;
     char *tls_cacertdir;
     char *tls_random_file;
@@ -125,6 +126,7 @@ struct ldap_config {
     char *sasl_auth_id;
     char *rootsasl_auth_id;
     char *sasl_secprops;
+    char *sslpath;
     char *krb5_ccname;
 } ldap_conf;
 
@@ -491,11 +493,11 @@ int
 sudo_ldap_read_config()
 {
     FILE *f;
-    char buf[LINE_MAX], *c, *keyword, *value;
+    char buf[LINE_MAX], *c, *keyword, *value, *ssl = NULL;
 
     /* defaults */
-    ldap_conf.version = 3;
-    ldap_conf.port = 389;
+    ldap_conf.version = LDAP_VERSION_MAX; /* XXX - use LDAP_VERSION? */
+    ldap_conf.port = -1;
     ldap_conf.tls_checkpeer = -1;
     ldap_conf.timelimit = -1;
     ldap_conf.bind_timelimit = -1;
@@ -549,7 +551,9 @@ sudo_ldap_read_config()
            else
        MATCH_I("port", ldap_conf.port)
            else
-       MATCH_S("ssl", ldap_conf.ssl)
+       MATCH_S("ssl", ssl)
+           else
+       MATCH_S("sslpath", ldap_conf.sslpath)
            else
        MATCH_B("tls_checkpeer", ldap_conf.tls_checkpeer)
            else
@@ -608,6 +612,25 @@ sudo_ldap_read_config()
     }
     fclose(f);
 
+    /*
+     * The ssl option may be a boolean or the string "start_tls".
+     */
+    if (ssl != NULL) {
+       if (strcasecmp(ssl, "start_tls") == 0)
+           ldap_conf.start_tls = 1;
+       else
+           ldap_conf.use_ssl = _atobool(ssl);
+    }
+
+    if (ldap_conf.port == -1) {
+#ifdef HAVE_LDAPSSL_INIT
+       if (ldap_conf.use_ssl)
+           ldap_conf.port = LDAPS_PORT;
+       else
+#endif
+           ldap_conf.port = LDAP_PORT;
+    }
+
     if (!ldap_conf.host)
        ldap_conf.host = estrdup("localhost");
 
@@ -637,9 +660,11 @@ sudo_ldap_read_config()
            ldap_conf.bindpw : "(anonymous)");
        fprintf(stderr, "bind_timelimit   %d\n", ldap_conf.bind_timelimit);
        fprintf(stderr, "timelimit        %d\n", ldap_conf.timelimit);
+#ifdef HAVE_LDAPSSL_INIT
+       fprintf(stderr, "use_ssl          %d\n", ldap_conf.use_ssl);
+#endif
 #ifdef HAVE_LDAP_START_TLS_S
-       fprintf(stderr, "ssl              %s\n", ldap_conf.ssl ?
-           ldap_conf.ssl : "(no)");
+       fprintf(stderr, "start_tls        %d\n", ldap_conf.start_tls);
 #endif
 #ifdef HAVE_LDAP_SASL_INTERACTIVE_BIND_S
        fprintf(stderr, "use_sasl         %d\n", ldap_conf.use_sasl);
@@ -705,7 +730,7 @@ sudo_ldap_read_config()
  */
 void
 sudo_ldap_display_privs(ldv, pw)
-    VOID *ldv;
+    void *ldv;
     struct passwd *pw;
 {
     LDAP *ld = (LDAP *) ldv;
@@ -821,7 +846,7 @@ sudo_ldap_display_privs(ldv, pw)
 
 int
 sudo_ldap_display_cmnd(ldv, pw)
-    VOID *ldv;
+    void *ldv;
     struct passwd *pw;
 {
     LDAP *ld = (LDAP *) ldv;
@@ -936,7 +961,7 @@ sudo_ldap_sasl_interact(ld, flags, _auth_id, _interact)
 /*
  * Open a connection to the LDAP server.
  */
-VOID *
+void *
 sudo_ldap_open()
 {
     LDAP *ld = NULL;
@@ -949,7 +974,7 @@ sudo_ldap_open()
     if (!sudo_ldap_read_config())
        return(NULL);
 
-    /* attempt to setup ssl options */
+    /* attempt to setup TLS options */
 #ifdef LDAP_OPT_X_TLS_CACERTFILE
     SET_OPTS(X_TLS_CACERTFILE, tls_cacertfile);
 #endif /* LDAP_OPT_X_TLS_CACERTFILE */
@@ -1007,14 +1032,26 @@ sudo_ldap_open()
     }
 #endif
 
-    /* attempt connect */
+#ifdef HAVE_LDAPSSL_INIT
+    /* setup SSL before connecting */
+    if (ldap_conf.use_ssl && ldap_conf.sslpath != NULL) {
+       rc = ldapssl_client_init(ldap_conf.sslpath, NULL);
+       if (rc != LDAP_SUCCESS) {
+           fprintf(stderr, "ldapssl_client_init()=%d : %s\n",
+               rc, ldap_err2string(rc));
+           return(NULL);
+       }
+    }
+#endif
+
+    /* attempt connection */
 #ifdef HAVE_LDAP_INITIALIZE
     if (ldap_conf.uri) {
 
        DPRINTF(("ldap_initialize(ld,%s)", ldap_conf.uri), 2);
 
        rc = ldap_initialize(&ld, ldap_conf.uri);
-       if (rc) {
+       if (rc != LDAP_SUCCESS) {
            fprintf(stderr, "ldap_initialize()=%d : %s\n",
                rc, ldap_err2string(rc));
            return(NULL);
@@ -1022,11 +1059,21 @@ sudo_ldap_open()
     } else
 #endif /* HAVE_LDAP_INITIALIZE */
     if (ldap_conf.host) {
+#ifdef HAVE_LDAPSSL_INIT
+       DPRINTF(("ldapssl_init(%s,%d,%d)", ldap_conf.host, ldap_conf.port,
+           ldap_conf.use_ssl), 2);
+       ld = ldapssl_init(ldap_conf.host, ldap_conf.port, ldap_conf.use_ssl);
+       if (ld == NULL) {
+           warning("ldapssl_init()");
+           return(NULL);
+       }
+#else
        DPRINTF(("ldap_init(%s,%d)", ldap_conf.host, ldap_conf.port), 2);
        if ((ld = ldap_init(ldap_conf.host, ldap_conf.port)) == NULL) {
            warning("ldap_init()");
            return(NULL);
        }
+#endif
     }
 
 #ifdef LDAP_OPT_PROTOCOL_VERSION
@@ -1036,7 +1083,7 @@ sudo_ldap_open()
 
 #ifdef HAVE_LDAP_START_TLS_S
     /* Turn on TLS */
-    if (ldap_conf.ssl && !strcasecmp(ldap_conf.ssl, "start_tls")) {
+    if (ldap_conf.start_tls) {
        rc = ldap_start_tls_s(ld, NULL, NULL);
        if (rc != LDAP_SUCCESS) {
            fprintf(stderr, "ldap_start_tls_s(): %d: %s\n", rc,
@@ -1096,12 +1143,12 @@ sudo_ldap_open()
        DPRINTF(("ldap_bind() ok"), 1);
     }
 
-    return((VOID *) ld);
+    return((void *) ld);
 }
 
 void
 sudo_ldap_update_defaults(v)
-    VOID *v;
+    void *v;
 {
     LDAP *ld = (LDAP *) v;
     LDAPMessage *entry = NULL, *result = NULL;  /* used for searches */
@@ -1124,7 +1171,7 @@ sudo_ldap_update_defaults(v)
  */
 int
 sudo_ldap_check(v, pwflag)
-    VOID *v;
+    void *v;
     int pwflag;
 {
     LDAP *ld = (LDAP *) v;
@@ -1278,7 +1325,7 @@ done:
  */
 void
 sudo_ldap_close(v)
-    VOID *v;
+    void *v;
 {
     if (v != NULL)
        ldap_unbind_s((LDAP *) v);
diff --git a/list.c b/list.c
index cba973e6458a8a94bd92d0704dd1f3f9a5af8248..0f1073160bd35055440e623aae7603aa6050a191 100644 (file)
--- a/list.c
+++ b/list.c
@@ -50,15 +50,15 @@ struct list_head_proto {
  * Pop the last element off the end of vh.
  * Returns the popped element.
  */
-VOID *
+void *
 lh_pop(vh)
-    VOID *vh;
+    void *vh;
 {
     struct list_head_proto *h = (struct list_head_proto *)vh;
-    VOID *last = NULL;
+    void *last = NULL;
 
     if (!lh_empty(h)) {
-       last = (VOID *)h->last;
+       last = (void *)h->last;
        if (h->first == h->last) {
            h->first = NULL;
            h->last = NULL;
@@ -76,8 +76,8 @@ lh_pop(vh)
  */
 void
 list2head(vh, vl)
-    VOID *vh;
-    VOID *vl;
+    void *vh;
+    void *vl;
 {
     struct list_head_proto *h = (struct list_head_proto *)vh;
     struct list_proto *l = (struct list_proto *)vl;
@@ -98,12 +98,12 @@ list2head(vh, vl)
  */
 void
 list_append(vl1, vl2)
-    VOID *vl1;
-    VOID *vl2;
+    void *vl1;
+    void *vl2;
 {
     struct list_proto *l1 = (struct list_proto *)vl1;
     struct list_proto *l2 = (struct list_proto *)vl2;
-    VOID *tail = l2->prev;
+    void *tail = l2->prev;
 
     l1->prev->next = l2;
     l2->prev = l1->prev;
@@ -116,12 +116,12 @@ list_append(vl1, vl2)
  */
 void
 lh_append(vh, vl)
-    VOID *vh;
-    VOID *vl;
+    void *vh;
+    void *vl;
 {
     struct list_head_proto *h = (struct list_head_proto *)vh;
     struct list_proto *l = (struct list_proto *)vl;
-    VOID *tail = l->prev;
+    void *tail = l->prev;
 
     if (h->first == NULL)
        h->first = l;
diff --git a/list.h b/list.h
index a852971e51329534d7f32fcb6e668d9f7e62700f..3d75484513a9c21d657e14c009b6d38369669544 100644 (file)
--- a/list.h
+++ b/list.h
@@ -77,9 +77,9 @@ struct n/**/_list {                                   \
 /*
  * Prototypes for list.c
  */
-VOID *lh_pop           __P((VOID *));
-void lh_append         __P((VOID *, VOID *));
-void list_append       __P((VOID *, VOID *));
-void list2head         __P((VOID *, VOID *));
+void *lh_pop           __P((void *));
+void lh_append         __P((void *, void *));
+void list_append       __P((void *, void *));
+void list2head         __P((void *, void *));
 
 #endif /* _SUDO_LIST_H */
index 205d932d8131ba6a7ea47e771731028a27c889d1..1da09ffb363647d437182a33e946c6d50c28dda3 100644 (file)
--- a/memrchr.c
+++ b/memrchr.c
@@ -29,9 +29,9 @@ __unused static const char rcsid[] = "$Sudo$";
  * Reverse memchr()
  * Find the last occurence of 'c' in the buffer 's' of size 'n'.
  */
-VOID *
+void *
 memrchr(s, c, n)
-    const VOID *s;
+    const void *s;
     int c;
     size_t n;
 {
@@ -41,8 +41,8 @@ memrchr(s, c, n)
        cp = (unsigned char *)s + n;
        do {
            if (*(--cp) == (unsigned char)c)
-               return((VOID *)cp);
+               return((void *)cp);
        } while (--n != 0);
     }
-    return((VOID *)0);
+    return((void *)0);
 }
diff --git a/parse.c b/parse.c
index cd0f0a1ca218e3e600c0362f62135db1dbf45d41..dc7ec51391af35bfee6f0d2779f6be9af624216d 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -197,7 +197,7 @@ sudoers_lookup(pwflag)
  */
 void
 display_privs(v, pw)
-    VOID *v;
+    void *v;
     struct passwd *pw;
 {
     struct lbuf lbuf;
@@ -417,7 +417,7 @@ display_bound_defaults(dtype)
  */
 int
 display_cmnd(v, pw)
-    VOID *v;
+    void *v;
     struct passwd *pw;
 {
     struct cmndspec *cs;
diff --git a/parse.h b/parse.h
index 2d614dd814ed00b4acd9b33a3471b435ad2493c1..8244b811880dc2c5b7ec0864ccee7d6a5801ae9e 100644 (file)
--- a/parse.h
+++ b/parse.h
@@ -158,7 +158,7 @@ int userlist_matches        __P((struct passwd *, struct member_list *));
 int usergr_matches     __P((char *, char *, struct passwd *));
 int userpw_matches     __P((char *, char *, struct passwd *));
 struct alias *find_alias __P((char *, int));
-void alias_apply       __P((int (*)(VOID *, VOID *), VOID *));
+void alias_apply       __P((int (*)(void *, void *), void *));
 void init_aliases      __P((void));
 void init_parser       __P((char *, int));
 
index e3849a1e03593a4ba7357dc785fbd7662119cc4e..5c02a44b192480da12d6ec6941e486953ae88faf 100644 (file)
--- a/pwutil.c
+++ b/pwutil.c
@@ -81,18 +81,18 @@ extern struct passwd *(*my_getpwuid) __P((uid_t));
 static struct rbtree *pwcache_byuid, *pwcache_byname;
 static struct rbtree *grcache_bygid, *grcache_byname;
 
-static int  cmp_pwuid  __P((const VOID *, const VOID *));
-static int  cmp_pwnam  __P((const VOID *, const VOID *));
-static int  cmp_grgid  __P((const VOID *, const VOID *));
-static int  cmp_grnam  __P((const VOID *, const VOID *));
+static int  cmp_pwuid  __P((const void *, const void *));
+static int  cmp_pwnam  __P((const void *, const void *));
+static int  cmp_grgid  __P((const void *, const void *));
+static int  cmp_grnam  __P((const void *, const void *));
 
 /*
  * Compare by uid.
  */
 static int
 cmp_pwuid(v1, v2)
-    const VOID *v1;
-    const VOID *v2;
+    const void *v1;
+    const void *v2;
 {
     const struct passwd *pw1 = (const struct passwd *) v1;
     const struct passwd *pw2 = (const struct passwd *) v2;
@@ -104,8 +104,8 @@ cmp_pwuid(v1, v2)
  */
 static int
 cmp_pwnam(v1, v2)
-    const VOID *v1;
-    const VOID *v2;
+    const void *v1;
+    const void *v2;
 {
     const struct passwd *pw1 = (const struct passwd *) v1;
     const struct passwd *pw2 = (const struct passwd *) v2;
@@ -207,16 +207,16 @@ sudo_getpwuid(uid)
            zero_bytes(pw->pw_passwd, strlen(pw->pw_passwd));
        pw->pw_passwd = cp;
 
-       if (rbinsert(pwcache_byname, (VOID *) pw) != NULL)
+       if (rbinsert(pwcache_byname, (void *) pw) != NULL)
            errorx(1, "unable to cache user name, already exists");
-       if (rbinsert(pwcache_byuid, (VOID *) pw) != NULL)
+       if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
            errorx(1, "unable to cache uid, already exists");
        return(pw);
     } else {
        pw = emalloc(sizeof(*pw));
        memset(pw, 0, sizeof(*pw));
        pw->pw_uid = uid;
-       if (rbinsert(pwcache_byuid, (VOID *) pw) != NULL)
+       if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
            errorx(1, "unable to cache uid, already exists");
        return(NULL);
     }
@@ -250,9 +250,9 @@ sudo_getpwnam(name)
            zero_bytes(pw->pw_passwd, strlen(pw->pw_passwd));
        pw->pw_passwd = cp;
 
-       if (rbinsert(pwcache_byname, (VOID *) pw) != NULL)
+       if (rbinsert(pwcache_byname, (void *) pw) != NULL)
            errorx(1, "unable to cache user name, already exists");
-       if (rbinsert(pwcache_byuid, (VOID *) pw) != NULL)
+       if (rbinsert(pwcache_byuid, (void *) pw) != NULL)
            errorx(1, "unable to cache uid, already exists");
        return(pw);
     } else {
@@ -264,7 +264,7 @@ sudo_getpwnam(name)
        memcpy(cp, name, len);
        pw->pw_name = cp;
        pw->pw_uid = (uid_t) -1;
-       if (rbinsert(pwcache_byname, (VOID *) pw) != NULL)
+       if (rbinsert(pwcache_byname, (void *) pw) != NULL)
            errorx(1, "unable to cache user name, already exists");
        return(NULL);
     }
@@ -290,11 +290,11 @@ sudo_fakepwuid(uid)
     /* Store by uid and by name, overwriting cached version. */
     if ((node = rbinsert(pwcache_byuid, pw)) != NULL) {
        efree(node->data);
-       node->data = (VOID *) pw;
+       node->data = (void *) pw;
     }
     if ((node = rbinsert(pwcache_byname, pw)) != NULL) {
        efree(node->data);
-       node->data = (VOID *) pw;
+       node->data = (void *) pw;
     }
     return(pw);
 }
@@ -320,11 +320,11 @@ sudo_fakepwnam(user)
     /* Store by uid and by name, overwriting cached version. */
     if ((node = rbinsert(pwcache_byuid, pw)) != NULL) {
        efree(node->data);
-       node->data = (VOID *) pw;
+       node->data = (void *) pw;
     }
     if ((node = rbinsert(pwcache_byname, pw)) != NULL) {
        efree(node->data);
-       node->data = (VOID *) pw;
+       node->data = (void *) pw;
     }
     return(pw);
 }
@@ -341,7 +341,7 @@ sudo_setpwent()
 }
 
 #ifdef notyet
-static void pw_free    __P((VOID *));
+static void pw_free    __P((void *));
 
 void
 sudo_freepwcache()
@@ -358,7 +358,7 @@ sudo_freepwcache()
 
 static void
 pw_free(v)
-    VOID *v;
+    void *v;
 {
     struct passwd *pw = (struct passwd *) v;
 
@@ -382,8 +382,8 @@ sudo_endpwent()
  */
 static int
 cmp_grgid(v1, v2)
-    const VOID *v1;
-    const VOID *v2;
+    const void *v1;
+    const void *v2;
 {
     const struct group *grp1 = (const struct group *) v1;
     const struct group *grp2 = (const struct group *) v2;
@@ -395,8 +395,8 @@ cmp_grgid(v1, v2)
  */
 static int
 cmp_grnam(v1, v2)
-    const VOID *v1;
-    const VOID *v2;
+    const void *v1;
+    const void *v2;
 {
     const struct group *grp1 = (const struct group *) v1;
     const struct group *grp2 = (const struct group *) v2;
@@ -469,16 +469,16 @@ sudo_getgrgid(gid)
      */
     if ((gr = getgrgid(gid)) != NULL) {
        gr = sudo_grdup(gr);
-       if (rbinsert(grcache_byname, (VOID *) gr) != NULL)
+       if (rbinsert(grcache_byname, (void *) gr) != NULL)
            errorx(1, "unable to cache group name, already exists");
-       if (rbinsert(grcache_bygid, (VOID *) gr) != NULL)
+       if (rbinsert(grcache_bygid, (void *) gr) != NULL)
            errorx(1, "unable to cache gid, already exists");
        return(gr);
     } else {
        gr = emalloc(sizeof(*gr));
        memset(gr, 0, sizeof(*gr));
        gr->gr_gid = gid;
-       if (rbinsert(grcache_bygid, (VOID *) gr) != NULL)
+       if (rbinsert(grcache_bygid, (void *) gr) != NULL)
            errorx(1, "unable to cache gid, already exists");
        return(NULL);
     }
@@ -506,9 +506,9 @@ sudo_getgrnam(name)
      */
     if ((gr = getgrnam(name)) != NULL) {
        gr = sudo_grdup(gr);
-       if (rbinsert(grcache_byname, (VOID *) gr) != NULL)
+       if (rbinsert(grcache_byname, (void *) gr) != NULL)
            errorx(1, "unable to cache group name, already exists");
-       if (rbinsert(grcache_bygid, (VOID *) gr) != NULL)
+       if (rbinsert(grcache_bygid, (void *) gr) != NULL)
            errorx(1, "unable to cache gid, already exists");
        return(gr);
     } else {
@@ -520,7 +520,7 @@ sudo_getgrnam(name)
        memcpy(cp, name, len);
        gr->gr_name = cp;
        gr->gr_gid = (gid_t) -1;
-       if (rbinsert(grcache_byname, (VOID *) gr) != NULL)
+       if (rbinsert(grcache_byname, (void *) gr) != NULL)
            errorx(1, "unable to cache group name, already exists");
        return(NULL);
     }
index 63f6c93afe73ace9cc5f6a1d39781c2db63beb5a..2573410eeda444d450edcc16576ee5011868db17 100644 (file)
@@ -63,7 +63,7 @@ static void rbrepair          __P((struct rbtree *, struct rbnode *));
 static void rotate_left                __P((struct rbtree *, struct rbnode *));
 static void rotate_right       __P((struct rbtree *, struct rbnode *));
 static void _rbdestroy         __P((struct rbtree *, struct rbnode *,
-                                   void (*)(VOID *)));
+                                   void (*)(void *)));
 
 /*
  * Red-Black tree, see http://en.wikipedia.org/wiki/Red-black_tree
@@ -88,7 +88,7 @@ static void _rbdestroy                __P((struct rbtree *, struct rbnode *,
  */
 struct rbtree *
 rbcreate(compar)
-    int (*compar)__P((const VOID *, const VOID*));
+    int (*compar)__P((const void *, const void*));
 {
     struct rbtree *tree;
 
@@ -172,7 +172,7 @@ rotate_right(tree, node)
 struct rbnode *
 rbinsert(tree, data)
     struct rbtree *tree;
-    VOID *data;
+    void *data;
 {
     struct rbnode *node = rbfirst(tree);
     struct rbnode *parent = rbroot(tree);
@@ -266,7 +266,7 @@ rbinsert(tree, data)
 struct rbnode *
 rbfind(tree, key)
     struct rbtree *tree;
-    VOID *key;
+    void *key;
 {
     struct rbnode *node = rbfirst(tree);
     int res;
@@ -288,8 +288,8 @@ int
 rbapply_node(tree, node, func, cookie, order)
     struct rbtree *tree;
     struct rbnode *node;
-    int (*func)__P((VOID *, VOID *));
-    VOID *cookie;
+    int (*func)__P((void *, void *));
+    void *cookie;
     enum rbtraversal order;
 {
     int error;
@@ -342,7 +342,7 @@ static void
 _rbdestroy(tree, node, destroy)
     struct rbtree *tree;
     struct rbnode *node;
-    void (*destroy)__P((VOID *));
+    void (*destroy)__P((void *));
 {
     if (node != rbnil(tree)) {
        _rbdestroy(tree, node->left, destroy);
@@ -360,7 +360,7 @@ _rbdestroy(tree, node, destroy)
 void
 rbdestroy(tree, destroy)
     struct rbtree *tree;
-    void (*destroy)__P((VOID *));
+    void (*destroy)__P((void *));
 {
     _rbdestroy(tree, rbfirst(tree), destroy);
     efree(tree);
@@ -369,13 +369,13 @@ rbdestroy(tree, destroy)
 /*
  * Delete victim from tree and return its data pointer.
  */
-VOID *
+void *
 rbdelete(tree, victim)
     struct rbtree *tree;
     struct rbnode *victim;
 {
     struct rbnode *pred, *succ;
-    VOID *data;
+    void *data;
 
     if (victim->left != rbnil(tree) && victim->right != rbnil(tree)) {
        succ = rbsuccessor(tree, victim);
index 99c1e56cbf6fcc0dd3d923e0f3be2a28b4db7255..c821246ed25b80890a483da48fb56961da495be2 100644 (file)
@@ -32,12 +32,12 @@ enum rbtraversal {
 
 struct rbnode {
     struct rbnode *left, *right, *parent;
-    VOID *data;
+    void *data;
     enum rbcolor color;
 };
 
 struct rbtree {
-    int (*compar) __P((const VOID *, const VOID *));
+    int (*compar) __P((const void *, const void *));
     struct rbnode root;
     struct rbnode nil;
 };
@@ -48,13 +48,13 @@ struct rbtree {
 #define rbroot(t)              (&(t)->root)
 #define rbnil(t)               (&(t)->nil)
 
-VOID *rbdelete                 __P((struct rbtree *, struct rbnode *));
+void *rbdelete                 __P((struct rbtree *, struct rbnode *));
 int rbapply_node               __P((struct rbtree *, struct rbnode *,
-                                   int (*)(VOID *, VOID *), VOID *,
+                                   int (*)(void *, void *), void *,
                                    enum rbtraversal));
-struct rbnode *rbfind          __P((struct rbtree *, VOID *));
-struct rbnode *rbinsert                __P((struct rbtree *, VOID *));
-struct rbtree *rbcreate                __P((int (*)(const VOID *, const VOID *)));
-void rbdestroy                 __P((struct rbtree *, void (*)(VOID *)));
+struct rbnode *rbfind          __P((struct rbtree *, void *));
+struct rbnode *rbinsert                __P((struct rbtree *, void *));
+struct rbtree *rbcreate                __P((int (*)(const void *, const void *)));
+void rbdestroy                 __P((struct rbtree *, void (*)(void *)));
 
 #endif /* _SUDO_REDBLACK_H */
index 5e2452b33b59f1d36dcd6f19010e004a8bdd3764..a96e7e321d14412b5716f89455a1514d52e908ef 100644 (file)
@@ -129,9 +129,9 @@ static int xxxprintf         __P((char **, size_t, int, const char *, va_list));
 #define BUF            68
 
 #ifndef HAVE_MEMCHR
-VOID *
+void *
 memchr(s, c, n)
-       const VOID *s;
+       const void *s;
        unsigned char c;
        size_t n;
 {
@@ -140,7 +140,7 @@ memchr(s, c, n)
 
                do {
                        if (*p++ == c)
-                               return ((VOID *)(p - 1));
+                               return ((void *)(p - 1));
                } while (--n != 0);
        }
        return (NULL);
@@ -537,7 +537,7 @@ reswitch:   switch (ch) {
                         * defined manner.''
                         *      -- ANSI X3J11
                         */
-                       ulval = (unsigned long)va_arg(ap, VOID *);
+                       ulval = (unsigned long)va_arg(ap, void *);
                        base = 16;
                        xdigs = "0123456789abcdef";
                        flags = (flags & ~QUADINT) | HEXPREFIX;
diff --git a/sudo.c b/sudo.c
index 5da0950c6229344e2eba497e35fd4f2aece5c65e..2f3c39370b62453ea4c25da8a980f188551718db 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -161,7 +161,7 @@ main(argc, argv, envp)
     int sudo_mode;
     int pwflag;
     sigaction_t sa;
-    VOID *ld = NULL;
+    void *ld = NULL;
 #if defined(SUDO_DEVEL) && defined(__OpenBSD__)
     extern char *malloc_options;
     malloc_options = "AFGJPR";
diff --git a/sudo.h b/sudo.h
index 659da3a74bafd0a96d8fa5688f6ea94e1605359c..44bc45bbed8491d8195318c9e7d7b883b2507b82 100644 (file)
--- a/sudo.h
+++ b/sudo.h
@@ -212,7 +212,7 @@ size_t strlcat              __P((char *, const char *, size_t));
 size_t strlcpy         __P((char *, const char *, size_t));
 #endif
 #ifndef HAVE_MEMRCHR
-VOID *memrchr          __P((const VOID *, int, size_t));
+void *memrchr          __P((const void *, int, size_t));
 #endif
 #ifndef HAVE_MKSTEMP
 int mkstemp            __P((char *));
@@ -225,12 +225,12 @@ void verify_user  __P((struct passwd *, char *));
 int sudoers_lookup     __P((int));
 int parse_sudoers      __P((const char *));
 #ifdef HAVE_LDAP
-int sudo_ldap_check    __P((VOID *, int));
-void sudo_ldap_display_privs __P((VOID *, struct passwd *));
-int sudo_ldap_display_cmnd __P((VOID *, struct passwd *));
-void sudo_ldap_update_defaults __P((VOID *));
-VOID *sudo_ldap_open   __P((void));
-void sudo_ldap_close   __P((VOID *));
+int sudo_ldap_check    __P((void *, int));
+void sudo_ldap_display_privs __P((void *, struct passwd *));
+int sudo_ldap_display_cmnd __P((void *, struct passwd *));
+void sudo_ldap_update_defaults __P((void *));
+void *sudo_ldap_open   __P((void));
+void sudo_ldap_close   __P((void *));
 #endif
 void set_perms         __P((int));
 void remove_timestamp  __P((int));
@@ -239,16 +239,16 @@ void sia_attempt_auth     __P((void));
 void pam_attempt_auth  __P((void));
 int yyparse            __P((void));
 void pass_warn         __P((FILE *));
-VOID *emalloc          __P((size_t));
-VOID *emalloc2         __P((size_t, size_t));
-VOID *erealloc         __P((VOID *, size_t));
-VOID *erealloc3                __P((VOID *, size_t, size_t));
+void *emalloc          __P((size_t));
+void *emalloc2         __P((size_t, size_t));
+void *erealloc         __P((void *, size_t));
+void *erealloc3                __P((void *, size_t, size_t));
 char *estrdup          __P((const char *));
 int easprintf          __P((char **, const char *, ...))
                            __printflike(2, 3);
 int evasprintf         __P((char **, const char *, va_list))
                            __printflike(2, 0);
-void efree             __P((VOID *));
+void efree             __P((void *));
 void dump_defaults     __P((void));
 void dump_auth_methods __P((void));
 void init_envtables    __P((void));
@@ -259,11 +259,11 @@ void set_fqdn             __P((void));
 int set_runaspw                __P((char *));
 char *sudo_getepw      __P((const struct passwd *));
 int pam_prep_user      __P((struct passwd *));
-void zero_bytes                __P((volatile VOID *, size_t));
+void zero_bytes                __P((volatile void *, size_t));
 int gettime            __P((struct timespec *));
 FILE *open_sudoers     __P((const char *, int *));
-void display_privs     __P((VOID *, struct passwd *));
-int display_cmnd       __P((VOID *, struct passwd *));
+void display_privs     __P((void *, struct passwd *));
+int display_cmnd       __P((void *, struct passwd *));
 int get_ttycols                __P((void));
 void sudo_setenv       __P((const char *, const char *, int));
 void sudo_unsetenv     __P((const char *));
index e34da20bcb98ab5037120ee542cfe14295276f1f..f5507724dc4da5e468177d00654ea3ce38a2e868 100644 (file)
@@ -99,7 +99,7 @@ struct passwd *(*my_getpwuid) __P((uid_t)) = getpwuid;
 extern char *optarg;
 extern int optind;
 
-int  print_alias __P((VOID *, VOID *));
+int  print_alias __P((void *, void *));
 void dump_sudoers __P((void));
 void print_defaults __P((void));
 void print_privilege __P((struct privilege *));
@@ -420,7 +420,7 @@ print_defaults()
 
 int
 print_alias(v1, v2)
-    VOID *v1, *v2;
+    void *v1, *v2;
 {
     struct alias *a = (struct alias *)v1;
     struct member *m;
index 81e1f5f12120588bf594988f8b53fafdf074ec26..0534511b6e6bfc8a8ab7bc8f8d0c40f39f2eb278 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -109,7 +109,7 @@ static int check_aliases    __P((int));
 static int check_syntax                __P((char *, int));
 static int edit_sudoers                __P((struct sudoersfile *, char *, char *, int));
 static int install_sudoers     __P((struct sudoersfile *));
-static int print_unused                __P((VOID *, VOID *));
+static int print_unused                __P((void *, void *));
 static int reparse_sudoers     __P((char *, char *, int, int));
 static int run_command         __P((char *, char **));
 static void setup_signals      __P((void));
@@ -961,8 +961,8 @@ check_aliases(strict)
 
 static int
 print_unused(v1, v2)
-    VOID *v1;
-    VOID *v2;
+    void *v1;
+    void *v2;
 {
     struct alias *a = (struct alias *)v1;
     char *prefix = (char *)v2;
index 30d9d3aac66599eb9a4cc88c2ebfc74d257b3043..aee86dff45330d056c2396e3e800f3312233f29b 100644 (file)
@@ -29,7 +29,7 @@ __unused static const char rcsid[] = "$Sudo$";
  */
 void
 zero_bytes(v, n)
-    volatile VOID *v;
+    volatile void *v;
     size_t n;
 {
     volatile char *p, *ep;