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