Fix crash in visudo introduced in sudo 1.8.9 when an IP address or

network is used in a host-based Defaults entry.  Bug #766
This commit is contained in:
Todd C. Miller
2017-01-07 19:50:05 -07:00
parent 0c3a8085b3
commit 90e1f4ec3e
5 changed files with 21 additions and 3 deletions

View File

@@ -472,6 +472,8 @@ plugins/sudoers/regress/visudo/test7.sh
plugins/sudoers/regress/visudo/test8.err.ok
plugins/sudoers/regress/visudo/test8.out.ok
plugins/sudoers/regress/visudo/test8.sh
plugins/sudoers/regress/visudo/test9.out.ok
plugins/sudoers/regress/visudo/test9.sh
plugins/sudoers/set_perms.c
plugins/sudoers/solaris_audit.c
plugins/sudoers/solaris_audit.h

View File

@@ -43,7 +43,7 @@
# define INADDR_NONE ((unsigned int)-1)
#endif
static struct interface_list interfaces;
static struct interface_list interfaces = SLIST_HEAD_INITIALIZER(interfaces);
/*
* Parse a space-delimited list of IP address/netmask pairs and

View File

@@ -0,0 +1 @@
stdin: parsed OK

View File

@@ -0,0 +1,12 @@
#!/bin/sh
#
# Test IP and network address in host-based Defaults statements
# Bugzilla #766
#
./visudo -cf - <<-EOF
Defaults@127.0.0.1 !authenticate
Defaults@10.0.0.0/8 !always_set_home
EOF
exit 0

View File

@@ -61,6 +61,7 @@
#endif
#include "sudoers.h"
#include "interfaces.h"
#include "parse.h"
#include "redblack.h"
#include "sudoers_version.h"
@@ -815,9 +816,11 @@ group_plugin_query(const char *user, const char *group, const struct passwd *pw)
}
/* STUB */
struct interface *get_interfaces(void)
struct interface_list *
get_interfaces(void)
{
return NULL;
static struct interface_list dummy = SLIST_HEAD_INITIALIZER(interfaces);
return &dummy;
}
/*