--- embedaddon/sudo/plugins/sudoers/interfaces.c 2013/07/22 10:46:12 1.1.1.3 +++ embedaddon/sudo/plugins/sudoers/interfaces.c 2014/06/15 16:12:54 1.1.1.4 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 Todd C. Miller + * Copyright (c) 2010-2013 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -51,7 +51,7 @@ # define INADDR_NONE ((unsigned int)-1) #endif -static struct interface *interfaces; +static struct interface_list interfaces; /* * Parse a space-delimited list of IP address/netmask pairs and @@ -87,25 +87,22 @@ set_interfaces(const char *ai) } else { /* IPv4 */ ifp->family = AF_INET; - ifp->addr.ip4.s_addr = inet_addr(addr); - ifp->netmask.ip4.s_addr = inet_addr(mask); - if (ifp->addr.ip4.s_addr == INADDR_NONE || - ifp->netmask.ip4.s_addr == INADDR_NONE) { + if (inet_pton(AF_INET, addr, &ifp->addr.ip4) != 1 || + inet_pton(AF_INET, mask, &ifp->netmask.ip4) != 1) { efree(ifp); continue; } } - ifp->next = interfaces; - interfaces = ifp; + SLIST_INSERT_HEAD(&interfaces, ifp, entries); } efree(addrinfo); debug_return; } -struct interface * +struct interface_list * get_interfaces(void) { - return interfaces; + return &interfaces; } void