# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= socat VERSION= 1.8.0.0 KEYWORDS= net VARIANTS= standard SDESC[standard]= Multipurpose relay HOMEPAGE= none CONTACT= nobody DOWNLOAD_GROUPS= main SITES[main]= http://www.dest-unreach.org/socat/download/ DISTFILE[1]= socat-1.8.0.0.tar.gz:main DF_INDEX= 1 SPKGS[standard]= complete primary docs OPTIONS_AVAILABLE= none OPTIONS_STANDARD= none USES= cpe ssl:openssl11 LICENSE= GPLv2:primary LICENSE_TERMS= primary:{{WRKDIR}}/TERMS LICENSE_FILE= GPLv2:{{WRKSRC}}/COPYING LICENSE_AWK= TERMS:"^\#include" LICENSE_SOURCE= TERMS:{{WRKSRC}}/socat.c LICENSE_SCHEME= solo CPE_VENDOR= dest-unreach FPC_EQUIVALENT= net/socat MUST_CONFIGURE= gnu CONFIGURE_ARGS= --disable-dccp RC_SUBR= socat:primary CFLAGS= -Wno-unused-variable do-install: .for f in filan procan socat ${INSTALL_PROGRAM} ${WRKSRC}/${f} ${STAGEDIR}${PREFIX}/bin .endfor ${INSTALL_MAN} ${WRKSRC}/doc/socat.1 ${STAGEDIR}${MAN1PREFIX}/man/man1 ${MKDIR} ${STAGEDIR}${STD_DOCDIR} cd ${WRKSRC} && ${INSTALL_DATA} EXAMPLES README SECURITY FAQ \ ${STAGEDIR}${STD_DOCDIR} ${INSTALL_DATA} ${FILESDIR}/socat-instances.conf.sample \ ${STAGEDIR}${PREFIX}/etc [FILE:667:descriptions/desc.primary] socat is a relay for bidirectional data transfer between two independent data channels. Each of these data channels may be a file, pipe, device (terminal or modem etc.), socket (UNIX, IP4, IP6 - raw, UDP, TCP), a file descriptor (stdin etc.), a program, or an arbitrary combination of two of these. socat can be used, e.g., as TCP relay (one-shot or daemon), as an external socksifier, for attacking weak firewalls, as a shell interface to UNIX sockets, IP6 relay, for redirecting TCP oriented programs like brutus to a serial line, or to establish a relatively secure environment (su and chroot) for running client or server shell scripts with network connections. [FILE:99:distinfo] 6010f4f311e5ebe0e63c77f78613d264253680006ac8979f52b0711a9a231e82 712469 socat-1.8.0.0.tar.gz [FILE:93:manifests/plist.primary] @sample etc/socat-instances.conf.sample bin/ filan procan socat share/man/man1/socat.1.gz [FILE:50:manifests/plist.docs] share/doc/socat/ EXAMPLES FAQ README SECURITY [FILE:875:patches/patch-fdname.c] Use correct prototype for getprotobynumber_r() on SunOS --- fdname.c.orig 2023-11-13 19:31:08 UTC +++ fdname.c @@ -250,7 +250,7 @@ int sockname(int fd, FILE *outfile, char /*Linux struct ifreq ifc = {{{ 0 }}};*/ struct ifreq ifc = {{ 0 }}; #endif - int rc; + int rc = 0; #if defined(SO_PROTOCOL) || defined(SO_PROTOTYPE) optlen = sizeof(proto); @@ -280,7 +280,12 @@ int sockname(int fd, FILE *outfile, char #if defined(SO_PROTOCOL) || defined(SO_PROTOTYPE) #if HAVE_GETPROTOBYNUMBER_R==1 /* Linux */ +# if defined(__sun) + protoentp = getprotobynumber_r(proto, &protoent, protoname, sizeof(protoname)); + rc = errno; +# else rc = getprotobynumber_r(proto, &protoent, protoname, sizeof(protoname), &protoentp); +# endif if (protoentp == NULL) { Warn2("sockname(): getprotobynumber_r(proto=%d, ...): %s", proto, strerror(rc)); [FILE:429:patches/patch-filan.c] --- filan.c.orig 2023-11-13 19:31:08 UTC +++ filan.c @@ -939,6 +939,7 @@ int tcpan(int fd, FILE *outfile) { #if WITH_TCP && defined(TCP_INFO) int tcpan2(int fd, FILE *outfile) { +# ifdef TCP_INFO struct tcp_info tcpinfo; socklen_t tcpinfolen = sizeof(tcpinfo); int result; @@ -966,6 +967,9 @@ int tcpan2(int fd, FILE *outfile) { #endif return 0; +# else + return -1; +# endif } #endif /* WITH_TCP */ [FILE:1445:files/socat-instances.conf.sample] # socat-instances.conf.sample # This config file is evaluated by the rc script from the FreeBSD # port of net/socat. # It is not related to socat(1) itself! # This file is shell syntax. # Each instance to be daemonized must be defined with a line starting # with [instancename]. instancename can be any alnum and is case insensitive # (will internally be converted to upper case). #[ntp4] # Default socat_daemonuser=nobody won't be able to open sockets with port numbers # below 1024. #daemonuser=root #flags="UDP4-RECVFROM:123,fork,bind=192.0.2.20 UDP4-SENDTO:169.254.0.53:123" #[ntp6] #daemonuser=root #flags="UDP6-RECVFROM:123,fork,bind=[2001:DB8::1:2:3] UDP4-SENDTO:169.254.0.53:123" # # Variable definitions: # # daemonuser (optional): # Overrides socat_daemonuser= from rc.conf if defined or the # rc scripts builtin default (nobody). # daemon(8) will run socat as this user. # # pidfile (optional): # If not defined, /var/run/socat_INSTANCENAME.pid will be used # (will be derived from rc script's default, which is /var/run/socat.pid). # # flags (mandatory): # See socat(1). # # service(8)/rc(8) "start" commands will skip instances without flags defined, # while "stop" commands will try to stop any present instance section. # # To control a single instance, you can append one instance name to the # rc(8) command. # Otherwise all uncommented instance definitions in this file will be processed. [FILE:5297:files/socat.in] #!/bin/sh # # PROVIDE: socat # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable socat: # socat_enable="YES" # socat_daemonuser="root" for priviledged ports e.g. # socat_flags="" or create %%PREFIX%%/etc/socat-instances.conf . /etc/rc.subr name="socat" rcvar=socat_enable load_rc_config $name : ${socat_enable="NO"} : ${socat_daemonuser:=nobody} : ${socat_config:=%%PREFIX%%/etc/socat-instances.conf} start_precmd="socat_prestart" pidfile=/var/run/socat.pid procname="%%PREFIX%%/bin/socat" command=/usr/sbin/daemon command_args=' -f -p ${pidfile} -u ${socat_daemonuser} ${procname} ${socat_flags}' [ -n "${2}" ] && socat_instance_arg=`echo "${2}" | tr '[:lower:]' '[:upper:]'` socat_prestart() { # socat_flags gets applied too early if we don't do this. # I didn't want to force people to update their rc.conf files # and change the socat_flags to something else. rc_flags="" } socat_parse_instances() { local _line _section_search socat_instances=`grep -Eo "^[[:blank:]]*\[[[:alnum:]_]+\]" ${socat_config} | tr '[:lower:]' '[:upper:]'` if [ -n "${socat_instance_arg}" ] && ! echo "${socat_instances}" | grep -q -E '(^|[[:blank:]])\['${socat_instance_arg}'\]([[:blank:]]|$)' then echo -n "$name: Can't find instance definition " >&2 echo "\"[${1}]\" in config file ${socat_config}." >&2 return 1 fi [ -n "${socat_instance_arg}" ] && socat_instances="[${socat_instance_arg}]" for i in ${socat_instances}; do _section_search=1 _instance=${i#[} _instance=${_instance%]} # Process each line of the optional config file, which # matches the regex, defined at the end of the loop. # There we filter to only process definitions and section separators. while read -r _line; do # Look for ${i} section until found if [ ${_section_search} ]; then if echo "${_line}" | grep -qi "^[[:blank:]]*\[${_instance}\]"; then unset _section_search continue # Nothing to do with section identifiers else # Continue with next line s_instance we haven't reached our section yet continue fi fi # Stop processing if the current line is another section identifier. echo "${_line}" | grep -q "^[[:blank:]]*\[[^]]*\]" && break # Only proceed with lines which contain variable declaration. echo "${_line}" | grep -q -E \ -e "^[[:blank:]]*[[:alpha:]_][[:alnum:]_]{0,30}=" || continue # Filter malformed lines (which could cause command execution) # (shell exits with test result, wich is false as soon as # there's a 2nd argument (1st is considered as 0)) eval sh -c \'[ \$# -eq 0 ]\' "${_line}" \|\| continue eval socat_${_instance}_${_line%%=*}=${_line#*=} done << EOCFF $(cat "${socat_config}") EOCFF done } # Check if daemon(8) handles title and syslog parameters # (as in FreeBSD 11). if [ "${1%start}" != "${1}" ]; then daemon_extended_args=" -l daemon" ${command} -t "test" ${daemon_extended_args} -f -u nobody true \ > /dev/null 2>&1 || unset daemon_extended_args fi # If we can read the config file, handle multiple instances, # else just process a single instance. if [ -r ${socat_config} ]; then # T O D O : Check rc(8) how restarts are handled and make # all-instaces restart working. # For now refuse restart commands without instance argument. # if [ "${1%restart}" != "${1}" ] && [ -z "${socat_instance_arg}" ]; then echo -n "$name: Restart command requires a instance argument," echo "since config file is in use." exit 1 fi if [ -n "${socat_flags}" ]; then echo -n "${name}: WARNING:" echo -n " Ignoring \"socat_flags\" in rc.conf because" echo " \"${socat_config}\" is present." fi socat_parse_instances "${2}" || exit 1 default_pidfile="${pidfile}" default_socat_daemonuser="${socat_daemonuser}" eval default_command_args=\'${command_args}\' for i in ${socat_instances}; do _instance=${i#[} _instance=${_instance%]} eval socat_flags=\"\$\{socat_${_instance}_flags\}\" # We need to have socat_flags to start, else skip start commands if [ "${1%start}" != "${1}" ] && [ -z "${socat_flags}" ]; then echo -n "$name: Missing \"flags\" definition for" echo " instance ${i}, skipping \"${1}\" command." continue fi eval pidfile=\"\$\{socat_${_instance}_pidfile\}\" [ -n "${pidfile}" ] || pidfile="${default_pidfile%.pid}_${_instance}.pid" eval socat_daemonuser=\"\$\{socat_${_instance}_daemonuser\}\" [ -n "${socat_daemonuser}" ] || socat_daemonuser="${default_socat_daemonuser}" eval command_args=\"${default_command_args}\" if [ -n "${daemon_extended_args}" ]; then # A bit confusing, but to keep 80 chars line break: command_args="(${_instance})\" ${command_args}" command_args="-t \"${procname} ${command_args}" command_args="${daemon_extended_args} ${command_args}" fi run_rc_command "$1" done else if [ -n "${socat_instance_arg}" ]; then echo -n "$name: Missing config file (${socat_config}), " >&2 echo "can't handle instance \"${2}\"." >&2 exit 1 fi eval command_args=\"${daemon_extended_args} ${command_args}\" run_rc_command "$1" fi