diff -Nur xinetd-2.3.14/xinetd/child.c xinetd-2.3.14-remote-port/xinetd/child.c --- xinetd-2.3.14/xinetd/child.c 2004-12-23 22:46:02.000000000 +0100 +++ xinetd-2.3.14-remote-port/xinetd/child.c 2009-04-14 03:43:33.000000000 +0200 @@ -358,6 +358,12 @@ msg( LOG_ERR, func, "Error adding REMOTE_HOST variable for %s: %m", SC_NAME(scp) ); _exit( 1 ) ; } + + strx_sprint(buff, sizeof(buff)-1, "REMOTE_PORT=%d", ntohs(cp->co_remote_address.sa_in.sin_port)); + if( env_addstr(SC_ENV(scp)->env_handle, buff) != ENV_OK ) { + msg( LOG_ERR, func, "Error adding REMOTE_PORT variable for %s: %m", SC_NAME(scp) ); + _exit( 1 ) ; + } #endif exec_server( serp ) ; }