Changeset View
Changeset View
Standalone View
Standalone View
contrib/tcp_wrappers/tli-sequent.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
/* Forward declarations. */ | /* Forward declarations. */ | ||||
static char *tli_error(); | static char *tli_error(); | ||||
static void tli_sink(); | static void tli_sink(); | ||||
/* tli_host - determine endpoint info */ | /* tli_host - determine endpoint info */ | ||||
int tli_host(request) | int tli_host(struct request_info *request) | ||||
struct request_info *request; | |||||
{ | { | ||||
static struct sockaddr_in client; | static struct sockaddr_in client; | ||||
static struct sockaddr_in server; | static struct sockaddr_in server; | ||||
struct _ti_user *tli_state_ptr; | struct _ti_user *tli_state_ptr; | ||||
union T_primitives *TSI_prim_ptr; | union T_primitives *TSI_prim_ptr; | ||||
struct strpeek peek; | struct strpeek peek; | ||||
int len; | int len; | ||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | request->sink = tli_sink; | ||||
if (getmyinaddr(request->fd, &server, len) < 0) | if (getmyinaddr(request->fd, &server, len) < 0) | ||||
tcpd_warn("can't get local address: %s", tli_error()); | tcpd_warn("can't get local address: %s", tli_error()); | ||||
else | else | ||||
request->server->sin = &server; | request->server->sin = &server; | ||||
} | } | ||||
/* tli_error - convert tli error number to text */ | /* tli_error - convert tli error number to text */ | ||||
static char *tli_error() | static char *tli_error(void) | ||||
{ | { | ||||
static char buf[40]; | static char buf[40]; | ||||
if (t_errno != TSYSERR) { | if (t_errno != TSYSERR) { | ||||
if (t_errno < 0 || t_errno >= t_nerr) { | if (t_errno < 0 || t_errno >= t_nerr) { | ||||
sprintf(buf, "Unknown TLI error %d", t_errno); | sprintf(buf, "Unknown TLI error %d", t_errno); | ||||
return (buf); | return (buf); | ||||
} else { | } else { | ||||
return (t_errlist[t_errno]); | return (t_errlist[t_errno]); | ||||
} | } | ||||
} else { | } else { | ||||
if (errno < 0 || errno >= sys_nerr) { | if (errno < 0 || errno >= sys_nerr) { | ||||
sprintf(buf, "Unknown UNIX error %d", errno); | sprintf(buf, "Unknown UNIX error %d", errno); | ||||
return (buf); | return (buf); | ||||
} else { | } else { | ||||
return (sys_errlist[errno]); | return (sys_errlist[errno]); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/* tli_sink - absorb unreceived datagram */ | /* tli_sink - absorb unreceived datagram */ | ||||
static void tli_sink(fd) | static void tli_sink(int fd) | ||||
int fd; | |||||
{ | { | ||||
struct t_unitdata *unit; | struct t_unitdata *unit; | ||||
int flags; | int flags; | ||||
/* | /* | ||||
* Something went wrong. Absorb the datagram to keep inetd from looping. | * Something went wrong. Absorb the datagram to keep inetd from looping. | ||||
* Allocate storage for address, control and data. If that fails, sleep | * Allocate storage for address, control and data. If that fails, sleep | ||||
* for a couple of seconds in an attempt to keep inetd from looping too | * for a couple of seconds in an attempt to keep inetd from looping too | ||||
Show All 13 Lines |