summaryrefslogtreecommitdiff
path: root/recipes/tcp-wrappers/tcp-wrappers-7.6/expand_remote_port
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/tcp-wrappers/tcp-wrappers-7.6/expand_remote_port
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/tcp-wrappers/tcp-wrappers-7.6/expand_remote_port')
-rw-r--r--recipes/tcp-wrappers/tcp-wrappers-7.6/expand_remote_port71
1 files changed, 71 insertions, 0 deletions
diff --git a/recipes/tcp-wrappers/tcp-wrappers-7.6/expand_remote_port b/recipes/tcp-wrappers/tcp-wrappers-7.6/expand_remote_port
new file mode 100644
index 0000000000..e35fc7ecd9
--- /dev/null
+++ b/recipes/tcp-wrappers/tcp-wrappers-7.6/expand_remote_port
@@ -0,0 +1,71 @@
+diff -ruN tcp_wrappers_7.6.orig/eval.c tcp_wrappers_7.6/eval.c
+--- tcp_wrappers_7.6.orig/eval.c 1995-01-30 19:51:46.000000000 +0100
++++ tcp_wrappers_7.6/eval.c 2004-11-04 13:59:01.000000000 +0100
+@@ -98,6 +98,28 @@
+ }
+ }
+
++/* 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)
+diff -ruN tcp_wrappers_7.6.orig/hosts_access.5 tcp_wrappers_7.6/hosts_access.5
+--- tcp_wrappers_7.6.orig/hosts_access.5 2004-11-04 13:17:45.000000000 +0100
++++ tcp_wrappers_7.6/hosts_access.5 2004-11-04 13:55:32.000000000 +0100
+@@ -175,6 +175,8 @@
+ 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
+diff -ruN tcp_wrappers_7.6.orig/percent_x.c tcp_wrappers_7.6/percent_x.c
+--- tcp_wrappers_7.6.orig/percent_x.c 1994-12-28 17:42:38.000000000 +0100
++++ tcp_wrappers_7.6/percent_x.c 2004-11-04 13:19:29.000000000 +0100
+@@ -63,6 +63,8 @@
+ 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), "");
+diff -ruN tcp_wrappers_7.6.orig/tcpd.h tcp_wrappers_7.6/tcpd.h
+--- tcp_wrappers_7.6.orig/tcpd.h 2004-11-04 13:17:45.000000000 +0100
++++ tcp_wrappers_7.6/tcpd.h 2004-11-04 13:19:13.000000000 +0100
+@@ -145,6 +145,11 @@
+ 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 */
+