diff -ruNp tcp_wrappers_7.6.orig/hosts_access.c tcp_wrappers_7.6/hosts_access.c
--- tcp_wrappers_7.6.orig/hosts_access.c	2007-01-08 01:31:32.000000000 +0100
+++ tcp_wrappers_7.6/hosts_access.c	2007-01-08 01:31:08.000000000 +0100
@@ -232,6 +232,36 @@ int   (*match_fn) ();
     return (NO);
 }
 
+/*
+ * daemon_or_port_match - match server information: if the server endpoint
+ * pattern is a port number, match against port number of connection;
+ * otherwise match against daemon executable name
+ */
+
+static int daemon_or_port_match(char *tok, struct request_info *request) {
+    unsigned int port, sin_port;
+    char junk;
+
+    /* daemon name */
+    if (sscanf(tok, "%u%c", &port, &junk) != 1 || port > 65535)
+	return (string_match(tok, eval_daemon(request)));
+
+    /* port number */
+    if (!request->server->sin)
+	return (NO);
+
+#ifdef INET6
+    sin_port = ntohs(((struct sockaddr_in *)request->server->sin)->sin_port);
+#else
+    sin_port = ntohs(request->server->sin->sin_port);
+#endif
+
+    if (port == sin_port)
+	return (YES);
+    else
+	return (NO);
+}
+
 /* server_match - match server information */
 
 static int server_match(tok, request)
@@ -241,9 +271,9 @@ struct request_info *request;
     char   *host;
 
     if ((host = split_at(tok + 1, '@')) == 0) {	/* plain daemon */
-	return (string_match(tok, eval_daemon(request)));
+	return (daemon_or_port_match(tok, request));
     } else {					/* daemon@host */
-	return (string_match(tok, eval_daemon(request))
+	return (daemon_or_port_match(tok, request)
 		&& host_match(host, request->server));
     }
 }
diff -ruNp tcp_wrappers_7.6.orig/hosts_access.5 tcp_wrappers_7.6/hosts_access.5
--- tcp_wrappers_7.6.orig/hosts_access.5	2007-01-08 01:31:32.000000000 +0100
+++ tcp_wrappers_7.6/hosts_access.5	2007-01-08 01:30:18.000000000 +0100
@@ -51,7 +51,7 @@ being optional:
 daemon_list : client_list [ : shell_command ]
 .PP
 \fIdaemon_list\fR is a list of one or more daemon process names
-(argv[0] values) or wildcards (see below).  
+(argv[0] values) or server port numbers or wildcards (see below).  
 .PP
 \fIclient_list\fR is a list
 of one or more host names, host addresses, patterns or wildcards (see
