Remove support for compilers that don't support void *

This commit is contained in:
Todd C. Miller
2007-08-31 23:30:07 +00:00
parent 6b3157d803
commit 19fa259480
31 changed files with 194 additions and 162 deletions

9
aclocal.m4 vendored
View 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...

14
alias.c
View File

@@ -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;

26
alloc.c
View File

@@ -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);

View File

@@ -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));

View File

@@ -46,7 +46,6 @@
#include "sudo.h"
#include "sudo_auth.h"
#undef VOID
#include <afs/stds.h>
#include <afs/kautils.h>

View File

@@ -88,7 +88,7 @@ bsdauth_init(pw, promptp, auth)
return(AUTH_FATAL);
}
auth->data = (VOID *) as;
auth->data = (void *) as;
return(AUTH_SUCCESS);
}

View 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);
}

View 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));

View 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;

View 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);

View 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)

View File

@@ -108,7 +108,7 @@ sia_setup(pw, promptp, auth)
return(AUTH_FATAL);
}
auth->data = (VOID *) siah;
auth->data = (void *) siah;
return(AUTH_SUCCESS);
}

View 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));

View File

@@ -559,10 +559,6 @@
/* 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

View 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

2
env.c
View File

@@ -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 */

83
ldap.c
View File

@@ -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);

24
list.c
View File

@@ -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;

8
list.h
View File

@@ -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 */

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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));

View File

@@ -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);
}

View 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);

View 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 */

View 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;

2
sudo.c
View File

@@ -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";

30
sudo.h
View File

@@ -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 *));

View 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;

View File

@@ -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;

View 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;