|
System | : | Linux MiraNet 3.0.0-14-generic-pae #23-Ubuntu SMP Mon Nov 21 22:07:10 UTC 2011 i686 |
Software | : | Apache. PHP/5.3.6-13ubuntu3.10 |
ID | : | uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
|
|
Safe Mode | : | OFF |
Open_Basedir | : | OFF |
Freespace | : | 25.76 GB of 70.42 GB (36.58%) |
|
MySQL: ON MSSQL: OFF Oracle: OFF PostgreSQL: OFF Curl: OFF Sockets: ON Fetch: OFF Wget: ON Perl: ON |
Disabled Functions: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
|
[ System Info ]
[ Processes ]
[ SQL Manager ]
[ Eval ]
[ Encoder ]
[ Mailer ]
[ Back Connection ]
[ Backdoor Server ]
[ Kernel Exploit Search ]
[ MD5 Decrypter ]
[ Reverse IP ]
[ Kill Shell ]
[ FTP Brute-Force ]
|
|
/
usr/
src/
courier-0.66.1/
rfc1035/
- drwxrwxrwx
|
Viewing file: rfc1035ifconf.c (2.86 KB) -rw-rw-rw-Select action/file-type:  ( +) |  ( +) |  ( +) | Code ( +) | Session ( +) |  ( +) | SDB ( +) |  ( +) |  ( +) |  ( +) |  ( +) |  ( +) |
/* ** Copyright 2002 Double Precision, Inc. ** See COPYING for distribution information. */
#include "rfc1035.h"
#include <stdio.h> #include <stdlib.h> #include <string.h>
#if HAVE_UNISTD_H #include <unistd.h> #endif
#if HAVE_SIOCGIFCONF
#if HAVE_SYS_TYPES_H #include <sys/types.h> #endif
#include <sys/ioctl.h> #include <net/if.h>
static int getifconf(int fd, struct rfc1035_ifconf **ifconf_ptr) { struct ifreq ifreq_buf[64]; struct ifconf ifc; int i; const struct sockaddr_in *sin; RFC1035_ADDR addr; char ipaddr[RFC1035_NTOABUFSIZE]; struct rfc1035_ifconf *ifcptr; struct rfc1035_ifconf **ifconf;
ifc.ifc_len=sizeof(ifreq_buf); ifc.ifc_req=ifreq_buf;
if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) return (0);
for (i=0; i * sizeof(struct ifreq) < ifc.ifc_len; i++) { sin=(const struct sockaddr_in *)&ifreq_buf[i].ifr_addr;
#if RFC1035_IPV6 if (sin->sin_family == AF_INET6) { struct sockaddr_in6 sin6;
memcpy(&sin6, sin, sizeof(sin6)); addr=sin6.sin6_addr; } else if (sin->sin_family == AF_INET) rfc1035_ipv4to6(&addr, &sin->sin_addr); else continue; #else if (sin->sin_family == AF_INET) addr=sin->sin_addr; else continue; #endif
rfc1035_ntoa(&addr, ipaddr);
/* ** Eliminate any dupes. */
ifconf=ifconf_ptr;
while ( *ifconf ) { char ipaddr2[RFC1035_NTOABUFSIZE];
rfc1035_ntoa(&(*ifconf)->ifaddr, ipaddr2);
if (strcmp(ipaddr, ipaddr2) == 0) break;
ifconf= &(*ifconf)->next; }
if ( *ifconf ) continue; /* Already have this IP addr */
if ( (ifcptr=malloc(sizeof(struct rfc1035_ifconf))) == NULL || (ifcptr->ifname=strdup(ifreq_buf[i].ifr_name)) == NULL) { if (ifcptr) free(ifcptr); return (-1); }
ifcptr->ifaddr=addr; ifcptr->next=NULL;
*ifconf= ifcptr; } return (0); }
/* ** On systems that support IPv6, issue an SIOCGIFCONF on both an IPv4 and ** an IPv6 socket, for good measure. */
static int doifconf(struct rfc1035_ifconf **ifconf_list) { int fd;
fd=socket(PF_INET, SOCK_STREAM, 0);
if (fd >= 0) { if (getifconf(fd, ifconf_list)) { close(fd); return (-1); } close(fd); }
#if RFC1035_IPV6
fd=socket(PF_INET6, SOCK_STREAM, 0);
if (fd >= 0) { if (getifconf(fd, ifconf_list)) { close(fd); return (-1); } close(fd); } #endif return (0); }
struct rfc1035_ifconf *rfc1035_ifconf(int *errflag) { struct rfc1035_ifconf *ifconf_list=NULL; int dummy;
if (!errflag) errflag= &dummy;
*errflag= -1; if (doifconf(&ifconf_list)) { rfc1035_ifconf_free(ifconf_list); return (NULL); }
*errflag=0; return ifconf_list; }
#else
struct rfc1035_ifconf *rfc1035_ifconf(int *errflag) { if (errflag) *errflag=0; return NULL; } #endif
void rfc1035_ifconf_free(struct rfc1035_ifconf *ifconf_list) { while (ifconf_list) { struct rfc1035_ifconf *p=ifconf_list->next;
free(ifconf_list->ifname); free(ifconf_list); ifconf_list=p; } }
|