summaryrefslogtreecommitdiff
path: root/usr.bin/sudo/interfaces.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2007-07-26 16:10:17 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2007-07-26 16:10:17 +0000
commit828fe35b0dee0a24eae19e816e9f6bc05c720bc0 (patch)
tree2adb27efde016e50eadcf2e74892e19861268a25 /usr.bin/sudo/interfaces.c
parenteb13f7f0aa17caa3bf79e5518751b3f095fb2445 (diff)
Update to sudo 1.6.9p1. Note that the environment handling in sudo
1.6.9 has changed relative to older versions. Sudo now starts commands with a minimal environment containing the variables in the env_keep and env_check lists. This behavior is configurable in the sudoers file. Please see the "SECURITY NOTES" section in the sudo manual.
Diffstat (limited to 'usr.bin/sudo/interfaces.c')
-rw-r--r--usr.bin/sudo/interfaces.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/sudo/interfaces.c b/usr.bin/sudo/interfaces.c
index 1f1aeae7182..b4b72458796 100644
--- a/usr.bin/sudo/interfaces.c
+++ b/usr.bin/sudo/interfaces.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 1998-2003 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 1996, 1998-2005 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -27,7 +27,7 @@ struct mbuf;
struct rtentry;
#endif
-#include "config.h"
+#include <config.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -65,6 +65,7 @@ struct rtentry;
# include "emul/err.h"
#endif /* HAVE_ERR_H */
#include <netdb.h>
+#include <errno.h>
#ifdef _ISC
# include <sys/stream.h>
# include <sys/sioctl.h>
@@ -88,7 +89,7 @@ struct rtentry;
#include "interfaces.h"
#ifndef lint
-static const char rcsid[] = "$Sudo: interfaces.c,v 1.72 2004/02/13 21:36:43 millert Exp $";
+__unused static const char rcsid[] = "$Sudo: interfaces.c,v 1.72.2.4 2007/06/14 16:24:09 millert Exp $";
#endif /* lint */
@@ -151,7 +152,7 @@ load_interfaces()
#ifdef HAVE_FREEIFADDRS
freeifaddrs(ifaddrs);
#else
- free(ifaddrs);
+ efree(ifaddrs);
#endif
}
@@ -187,14 +188,14 @@ load_interfaces()
ifconf->ifc_len = len - sizeof(struct ifconf);
ifconf->ifc_buf = (caddr_t) (ifconf_buf + sizeof(struct ifconf));
- /* Networking may not be installed in kernel... */
#ifdef _ISC
STRSET(SIOCGIFCONF, (caddr_t) ifconf, len);
if (ioctl(sock, I_STR, (caddr_t) &strioctl) < 0) {
#else
- if (ioctl(sock, SIOCGIFCONF, (caddr_t) ifconf) < 0) {
+ /* Note that some kernels return EINVAL if the buffer is too small */
+ if (ioctl(sock, SIOCGIFCONF, (caddr_t) ifconf) < 0 && errno != EINVAL) {
#endif /* _ISC */
- free(ifconf_buf);
+ efree(ifconf_buf);
(void) close(sock);
return;
}
@@ -284,9 +285,9 @@ load_interfaces()
interfaces = (struct interface *) erealloc3(interfaces,
num_interfaces, sizeof(struct interface));
else
- free(interfaces);
+ efree(interfaces);
}
- free(ifconf_buf);
+ efree(ifconf_buf);
(void) close(sock);
}