Make interfaces pointer private to interfaces.c and add get_interfaces()
accessor.
This commit is contained in:
@@ -52,6 +52,8 @@
|
||||
# define INADDR_NONE ((unsigned int)-1)
|
||||
#endif
|
||||
|
||||
static struct interface *interfaces;
|
||||
|
||||
/*
|
||||
* Parse a space-delimited list of IP address/netmask pairs and
|
||||
* store in a list of interface structures.
|
||||
@@ -101,6 +103,12 @@ set_interfaces(const char *ai)
|
||||
debug_return;
|
||||
}
|
||||
|
||||
struct interface *
|
||||
get_interfaces(void)
|
||||
{
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
void
|
||||
dump_interfaces(const char *ai)
|
||||
{
|
||||
|
@@ -48,12 +48,6 @@ struct interface {
|
||||
int get_net_ifs(char **addrinfo);
|
||||
void dump_interfaces(const char *);
|
||||
void set_interfaces(const char *);
|
||||
|
||||
/*
|
||||
* Definitions for external variables.
|
||||
*/
|
||||
#ifndef _SUDO_MAIN
|
||||
extern struct interface *interfaces;
|
||||
#endif
|
||||
struct interface *get_interfaces(void);
|
||||
|
||||
#endif /* _SUDO_INTERFACES_H */
|
||||
|
@@ -71,7 +71,7 @@ addr_matches_if(char *n)
|
||||
addr.ip4.s_addr = inet_addr(n);
|
||||
}
|
||||
|
||||
for (ifp = interfaces; ifp != NULL; ifp = ifp->next) {
|
||||
for (ifp = get_interfaces(); ifp != NULL; ifp = ifp->next) {
|
||||
if (ifp->family != family)
|
||||
continue;
|
||||
switch (family) {
|
||||
@@ -154,7 +154,7 @@ addr_matches_if_netmask(char *n, char *m)
|
||||
}
|
||||
#endif /* HAVE_STRUCT_IN6_ADDR */
|
||||
|
||||
for (ifp = interfaces; ifp != NULL; ifp = ifp->next) {
|
||||
for (ifp = get_interfaces(); ifp != NULL; ifp = ifp->next) {
|
||||
if (ifp->family != family)
|
||||
continue;
|
||||
switch (family) {
|
||||
|
@@ -109,7 +109,6 @@ static void create_admin_success_flag(void);
|
||||
*/
|
||||
struct sudo_user sudo_user;
|
||||
struct passwd *list_pw;
|
||||
struct interface *interfaces;
|
||||
int long_list;
|
||||
uid_t timestamp_uid;
|
||||
extern int errorlineno;
|
||||
|
@@ -106,7 +106,6 @@ extern int (*trace_print)(const char *msg);
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
struct interface *interfaces;
|
||||
struct sudo_user sudo_user;
|
||||
struct passwd *list_pw;
|
||||
static char *runas_group, *runas_user;
|
||||
|
@@ -76,7 +76,6 @@
|
||||
#endif
|
||||
|
||||
#include "sudoers.h"
|
||||
#include "interfaces.h"
|
||||
#include "parse.h"
|
||||
#include "redblack.h"
|
||||
#include "gettext.h"
|
||||
@@ -136,7 +135,6 @@ extern int optind;
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
struct interface *interfaces;
|
||||
struct sudo_user sudo_user;
|
||||
struct passwd *list_pw;
|
||||
sudo_printf_t sudo_printf = visudo_printf;
|
||||
@@ -693,6 +691,12 @@ group_plugin_query(const char *user, const char *group, const struct passwd *pw)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* STUB */
|
||||
struct interface *get_interfaces(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assuming a parse error occurred, prompt the user for what they want
|
||||
* to do now. Returns the first letter of their choice.
|
||||
|
Reference in New Issue
Block a user