parent
aa8ed4dd41
commit
8eb2bc800a
22
eval.c
22
eval.c
|
@ -98,6 +98,28 @@ struct host_info *host;
|
|||
}
|
||||
}
|
||||
|
||||
/* eval_port - return string with the port */
|
||||
char *eval_port(saddr)
|
||||
#ifdef INET6
|
||||
struct sockaddr *saddr;
|
||||
#else
|
||||
struct sockaddr_in *saddr;
|
||||
#endif
|
||||
{
|
||||
static char port[16];
|
||||
if (saddr != 0) {
|
||||
sprintf(port, "%u",
|
||||
#ifdef INET6
|
||||
ntohs(((struct sockaddr_in *)saddr)->sin_port));
|
||||
#else
|
||||
ntohs(saddr->sin_port));
|
||||
#endif
|
||||
} else {
|
||||
strcpy(port, "0");
|
||||
}
|
||||
return (port);
|
||||
}
|
||||
|
||||
/* eval_client - return string with as much about the client as we know */
|
||||
|
||||
char *eval_client(request)
|
||||
|
|
|
@ -175,6 +175,8 @@ The client (server) host name or address, if the host name is
|
|||
unavailable.
|
||||
.IP "%n (%N)"
|
||||
The client (server) host name (or "unknown" or "paranoid").
|
||||
.IP "%r (%R)"
|
||||
The clients (servers) port number (or "0").
|
||||
.IP %p
|
||||
The daemon process id.
|
||||
.IP %s
|
||||
|
|
|
@ -63,6 +63,8 @@ ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|||
ch == 'n' ? eval_hostname(request->client) :
|
||||
ch == 'N' ? eval_hostname(request->server) :
|
||||
ch == 'p' ? eval_pid(request) :
|
||||
ch == 'r' ? eval_port(request->client->sin) :
|
||||
ch == 'R' ? eval_port(request->server->sin) :
|
||||
ch == 's' ? eval_server(request) :
|
||||
ch == 'u' ? eval_user(request) :
|
||||
ch == '%' ? "%" : (tcpd_warn("unrecognized %%%c", ch), "");
|
||||
|
|
5
tcpd.h
5
tcpd.h
|
@ -155,6 +155,11 @@ extern char *eval_hostaddr(struct host_info *); /* printable host address */
|
|||
extern char *eval_hostinfo(struct host_info *); /* host name or address */
|
||||
extern char *eval_client(struct request_info *);/* whatever is available */
|
||||
extern char *eval_server(struct request_info *);/* whatever is available */
|
||||
#ifdef INET6
|
||||
extern char *eval_port(struct sockaddr *);
|
||||
#else
|
||||
extern char *eval_port(struct sockaddr_in *);
|
||||
#endif
|
||||
#define eval_daemon(r) ((r)->daemon) /* daemon process name */
|
||||
#define eval_pid(r) ((r)->pid) /* process id */
|
||||
|
||||
|
|
Loading…
Reference in New Issue