1 diff -ruNp tcp_wrappers_7.6.orig/hosts_access.c tcp_wrappers_7.6/hosts_access.c
2 --- tcp_wrappers_7.6.orig/hosts_access.c 2007-01-08 01:31:32.000000000 +0100
3 +++ tcp_wrappers_7.6/hosts_access.c 2007-01-08 01:31:08.000000000 +0100
4 @@ -232,6 +232,36 @@ int (*match_fn) ();
9 + * daemon_or_port_match - match server information: if the server endpoint
10 + * pattern is a port number, match against port number of connection;
11 + * otherwise match against daemon executable name
14 +static int daemon_or_port_match(char *tok, struct request_info *request) {
15 + unsigned int port, sin_port;
19 + if (sscanf(tok, "%u%c", &port, &junk) != 1 || port > 65535)
20 + return (string_match(tok, eval_daemon(request)));
23 + if (!request->server->sin)
27 + sin_port = ntohs(((struct sockaddr_in *)request->server->sin)->sin_port);
29 + sin_port = ntohs(request->server->sin->sin_port);
32 + if (port == sin_port)
38 /* server_match - match server information */
40 static int server_match(tok, request)
41 @@ -241,9 +271,9 @@ struct request_info *request;
44 if ((host = split_at(tok + 1, '@')) == 0) { /* plain daemon */
45 - return (string_match(tok, eval_daemon(request)));
46 + return (daemon_or_port_match(tok, request));
47 } else { /* daemon@host */
48 - return (string_match(tok, eval_daemon(request))
49 + return (daemon_or_port_match(tok, request)
50 && host_match(host, request->server));
53 diff -ruNp tcp_wrappers_7.6.orig/hosts_access.5 tcp_wrappers_7.6/hosts_access.5
54 --- tcp_wrappers_7.6.orig/hosts_access.5 2007-01-08 01:31:32.000000000 +0100
55 +++ tcp_wrappers_7.6/hosts_access.5 2007-01-08 01:30:18.000000000 +0100
56 @@ -51,7 +51,7 @@ being optional:
57 daemon_list : client_list [ : shell_command ]
59 \fIdaemon_list\fR is a list of one or more daemon process names
60 -(argv[0] values) or wildcards (see below).
61 +(argv[0] values) or server port numbers or wildcards (see below).
63 \fIclient_list\fR is a list
64 of one or more host names, host addresses, patterns or wildcards (see