mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 15:32:35 +00:00
socat V1.6.0.0 (initial GIT commit)
This commit is contained in:
commit
b819572f5e
170 changed files with 59193 additions and 0 deletions
18
BUGREPORTS
Normal file
18
BUGREPORTS
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
* If you have found a bug, i.e. socat SIGSEGV'ed, terminated abnormally without
|
||||||
|
error message, did not comply to the documentation, or behaves different from
|
||||||
|
your expectations, please send the following infos to socat@dest-unreach.org,
|
||||||
|
as available:
|
||||||
|
. output of "make info" in socat.out (you may remove the hostname in the first
|
||||||
|
line to keep your privacy)
|
||||||
|
. config.log
|
||||||
|
. run your example with "socat -d -d -d -d -D ..." options, and include the log
|
||||||
|
output
|
||||||
|
. describe what you've done, and why you think socat did wrong
|
||||||
|
|
||||||
|
* If you fixed a bug:
|
||||||
|
Please do as described in the above paragraph, and include the modified files
|
||||||
|
(or a patch file)
|
||||||
|
|
||||||
|
* If you have contributions, problems etc: send available info and a
|
||||||
|
description to the above address.
|
771
CHANGES
Normal file
771
CHANGES
Normal file
|
@ -0,0 +1,771 @@
|
||||||
|
|
||||||
|
####################### V 1.6.0.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
new addresses IP-DATAGRAM and UDP-DATAGRAM allow versatile broadcast
|
||||||
|
and multicast modes
|
||||||
|
|
||||||
|
new option ip-add-membership for control of multicast group membership
|
||||||
|
|
||||||
|
new address TUN for generation of Linux TUN/TAP pseudo network
|
||||||
|
interfaces (suggested by Mat Caughron); associated options tun-device,
|
||||||
|
tun-name, tun-type; iff-up, iff-promisc, iff-noarp, iff-no-pi etc.
|
||||||
|
|
||||||
|
new addresses ABSTRACT-CONNECT, ABSTRACT-LISTEN, ABSTRACT-SENDTO,
|
||||||
|
ABSTRACT-RECV, and ABSTRACT-RECVFROM for abstract UNIX domain addresses
|
||||||
|
on Linux (requested by Zeeshan Ali); option unix-tightsocklen controls
|
||||||
|
socklen parameter on system calls.
|
||||||
|
|
||||||
|
option end-close for control of connection closing allows FD sharing
|
||||||
|
by sub processes
|
||||||
|
|
||||||
|
range option supports form address:mask with IPv4
|
||||||
|
|
||||||
|
changed behaviour of SSL-LISTEN to require and verify client
|
||||||
|
certificate per default
|
||||||
|
|
||||||
|
options f-setlkw-rd, f-setlkw-wr, f-setlk-rd, f-setlk-wr allow finer
|
||||||
|
grained locking on regular files
|
||||||
|
|
||||||
|
uninstall target in Makefile (lack reported by Zeeshan Ali)
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
fixed bug where only first tcpwrap option was applied; fixed bug where
|
||||||
|
tcpwrap IPv6 check always failed (thanks to Rudolf Cejka for reporting
|
||||||
|
and fixing this bug)
|
||||||
|
|
||||||
|
filan (and socat -D) could hang when a socket was involved
|
||||||
|
|
||||||
|
corrected PTYs on HP-UX (and maybe others) using STREAMS (inspired by
|
||||||
|
Roberto Mackun)
|
||||||
|
|
||||||
|
correct bind with udp6-listen (thanks to Jan Horak for reporting this
|
||||||
|
bug)
|
||||||
|
|
||||||
|
corrected filan.c peekbuff[0] which did not compile with Sun Studio Pro
|
||||||
|
(thanks to Leo Zhadanovsky for reporting this problem)
|
||||||
|
|
||||||
|
corrected problem with read data buffered in OpenSSL layer (thanks to
|
||||||
|
Jon Nelson for reporting this bug)
|
||||||
|
|
||||||
|
corrected problem with option readbytes when input stream stayed idle
|
||||||
|
after so many bytes
|
||||||
|
|
||||||
|
fixed a bug where a datagram receiver with option fork could fork two
|
||||||
|
sub processes per packet
|
||||||
|
|
||||||
|
further changes:
|
||||||
|
moved documentation to new doc/ subdir
|
||||||
|
|
||||||
|
new documents (kind of mini tutorials) are provided in doc/
|
||||||
|
|
||||||
|
####################### V 1.5.0.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
new datagram modes for udp, rawip, unix domain sockets
|
||||||
|
|
||||||
|
socat option -T specifies inactivity timeout
|
||||||
|
|
||||||
|
rewrote lexical analysis to allow nested socat calls
|
||||||
|
|
||||||
|
addresses tcp, udp, tcp-l, udp-l, and rawip now support IPv4 and IPv6
|
||||||
|
|
||||||
|
socat options -4, -6 and environment variables SOCAT_DEFAULT_LISTEN_IP,
|
||||||
|
SOCAT_PREFERRED_RESOLVE_IP for control of protocol selection
|
||||||
|
|
||||||
|
addresses ssl, ssl-l, socks, proxy now support IPv4 and IPv6
|
||||||
|
|
||||||
|
option protocol-family (pf), esp. for openssl-listen
|
||||||
|
|
||||||
|
range option supports IPv6 - syntax: range=[::1/128]
|
||||||
|
|
||||||
|
option ipv6-v6only (ipv6only)
|
||||||
|
|
||||||
|
new tcp-wrappers options allow-table, deny-table, tcpwrap-etc
|
||||||
|
|
||||||
|
FIPS version of OpenSSL can be integrated - initial patch provided by
|
||||||
|
David Acker. See README.FIPS
|
||||||
|
|
||||||
|
support for resolver options res-debug, aaonly, usevc, primary, igntc,
|
||||||
|
recurse, defnames, stayopen, dnsrch
|
||||||
|
|
||||||
|
options for file attributes on advanced filesystems (ext2, ext3,
|
||||||
|
reiser): secrm, unrm, compr, ext2-sync, immutable, ext2-append, nodump,
|
||||||
|
ext2-noatime, journal-data etc.
|
||||||
|
|
||||||
|
option cool-write controls severeness of write failure (EPIPE,
|
||||||
|
ECONNRESET)
|
||||||
|
|
||||||
|
option o-noatime
|
||||||
|
|
||||||
|
socat option -lh for hostname in log output
|
||||||
|
|
||||||
|
traffic dumping provides packet headers
|
||||||
|
|
||||||
|
configure.in became part of distribution
|
||||||
|
|
||||||
|
socats unpack directory now has full version, e.g. socat-1.5.0.0/
|
||||||
|
|
||||||
|
corrected docu of option verify
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
fixed tcpwrappers integration - initial fix provided by Rudolf Cejka
|
||||||
|
|
||||||
|
exec with pipes,stderr produced error
|
||||||
|
|
||||||
|
setuid-early was ignored with many address types
|
||||||
|
|
||||||
|
some minor corrections
|
||||||
|
|
||||||
|
####################### V 1.4.3.1:
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
PROBLEM: UNIX socket listen accepted only one (or a few) connections.
|
||||||
|
FIX: do not remove listening UNIX socket in child process
|
||||||
|
|
||||||
|
PROBLEM: SIGSEGV when TCP part of SSL connect failed
|
||||||
|
FIX: check ssl pointer before calling SSL_shutdown
|
||||||
|
|
||||||
|
In debug mode, show connect client port even when connect fails
|
||||||
|
|
||||||
|
####################### V 1.4.3.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
socat options -L, -W for application level locking
|
||||||
|
|
||||||
|
options "lockfile", "waitlock" for address level locking
|
||||||
|
(Stefan Luethje)
|
||||||
|
|
||||||
|
option "readbytes" limits read length (Adam Osuchowski)
|
||||||
|
|
||||||
|
option "retry" for unix-connect, unix-listen, tcp6-listen (Dale Dude)
|
||||||
|
|
||||||
|
pty symlink, unix listen socket, and named pipe are per default removed
|
||||||
|
after use; option unlink-close overrides this new behaviour and also
|
||||||
|
controls removal of other socat generated files (Stefan Luethje)
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
option "retry" did not work with tcp-listen
|
||||||
|
|
||||||
|
EPIPE condition could result in a 100% CPU loop
|
||||||
|
|
||||||
|
further changes:
|
||||||
|
support systems without SHUT_RD etc.
|
||||||
|
handle more size_t types
|
||||||
|
try to find makedepend options with gcc 3 (richard/OpenMacNews)
|
||||||
|
|
||||||
|
####################### V 1.4.2.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
option "connect-timeout" limits wait time for connect operations
|
||||||
|
(requested by Giulio Orsero)
|
||||||
|
|
||||||
|
option "dhparam" for explicit Diffie-Hellman parameter file
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
support for OpenSSL DSA certificates (Miika Komu)
|
||||||
|
|
||||||
|
create install directories before copying files (Miika Komu)
|
||||||
|
|
||||||
|
when exiting on signal, return status 128+signum instead of 1
|
||||||
|
|
||||||
|
on EPIPE and ECONNRESET, only issue a warning (Santiago Garcia
|
||||||
|
Mantinan)
|
||||||
|
|
||||||
|
-lu could cause a core dump on long messages
|
||||||
|
|
||||||
|
further changes:
|
||||||
|
modifications to simplify using socats features in applications
|
||||||
|
|
||||||
|
####################### V 1.4.1.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
option "wait-slave" blocks open of pty master side until a client
|
||||||
|
connects, "pty-intervall" controls polling
|
||||||
|
|
||||||
|
option -h as synonym to -? for help (contributed by Christian
|
||||||
|
Lademann)
|
||||||
|
|
||||||
|
filan prints formatted time stamps and rdev (disable with -r)
|
||||||
|
|
||||||
|
redirect filan's output, so stdout is not affected (contributed by
|
||||||
|
Luigi Iotti)
|
||||||
|
|
||||||
|
filan option -L to follow symbolic links
|
||||||
|
|
||||||
|
filan shows termios control characters
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
proxy address no longer performs unsolicited retries
|
||||||
|
|
||||||
|
filan -f no longer needs read permission to analyze a file (but still
|
||||||
|
needs access permission to directory, of course)
|
||||||
|
|
||||||
|
porting:
|
||||||
|
Option dsusp
|
||||||
|
FreeBSD options noopt, nopush, md5sig
|
||||||
|
OpenBSD options sack-disable, signature-enable
|
||||||
|
HP-UX, Solaris options abort-threshold, conn-abort-threshold
|
||||||
|
HP-UX options b900, b3600, b7200
|
||||||
|
Tru64/OSF1 options keepinit, paws, sackena, tsoptena
|
||||||
|
|
||||||
|
further corrections:
|
||||||
|
address pty now uses ptmx as default if openpty is also available
|
||||||
|
|
||||||
|
####################### V 1.4.0.3:
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
fix to a syslog() based format string vulnerability that can lead to
|
||||||
|
remote code execution. See advisory socat-adv-1.txt
|
||||||
|
|
||||||
|
####################### V 1.4.0.2:
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
exec'd write-only addresses get a chance to flush before being killed
|
||||||
|
|
||||||
|
error handler: print notice on error-exit
|
||||||
|
|
||||||
|
filan printed wrong file type information
|
||||||
|
|
||||||
|
####################### V 1.4.0.1:
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
socks4a constructed invalid header. Problem found, reported, and fixed
|
||||||
|
by Thomas Themel, by Peter Palfrader, and by rik
|
||||||
|
|
||||||
|
with nofork, don't forget to apply some process related options
|
||||||
|
(chroot, setsid, setpgid, ...)
|
||||||
|
|
||||||
|
####################### V 1.4.0.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
simple openssl server (ssl-l), experimental openssl trust
|
||||||
|
|
||||||
|
new options "cafile", "capath", "key", "cert", "egd", and "pseudo" for
|
||||||
|
openssl
|
||||||
|
|
||||||
|
new options "retry", "forever", and "intervall"
|
||||||
|
|
||||||
|
option "fork" for address TCP improves `gender changer´
|
||||||
|
|
||||||
|
options "sigint", "sigquit", and "sighup" control passing of signals to
|
||||||
|
sub process (thanks to David Shea who contributed to this issue)
|
||||||
|
|
||||||
|
readline takes respect to the prompt issued by the peer address
|
||||||
|
|
||||||
|
options "prompt" and "noprompt" allow to override readline's new
|
||||||
|
default behaviour
|
||||||
|
|
||||||
|
readline supports invisible password with option "noecho"
|
||||||
|
|
||||||
|
socat option -lp allows to set hostname in log output
|
||||||
|
|
||||||
|
socat option -lu turns on microsecond resolution in log output
|
||||||
|
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
before reading available data, check if writing on other channel is
|
||||||
|
possible
|
||||||
|
|
||||||
|
tcp6, udp6: support hostname specification (not only IP address), and
|
||||||
|
map IP4 names to IP6 addresses
|
||||||
|
|
||||||
|
openssl client checks server certificate per default
|
||||||
|
|
||||||
|
support unidirectional communication with exec/system subprocess
|
||||||
|
|
||||||
|
try to restore original terminal settings when terminating
|
||||||
|
|
||||||
|
test.sh uses tmp dir /tmp/$USER/$$ instead of /tmp/$$
|
||||||
|
|
||||||
|
socks4 failed on platforms where long does not have 32 bits
|
||||||
|
(thanks to Peter Palfrader and Thomas Seyrat)
|
||||||
|
|
||||||
|
hstrerror substitute wrote wrong messages (HP-UX, Solaris)
|
||||||
|
|
||||||
|
proxy error message was truncated when answer contained multiple spaces
|
||||||
|
|
||||||
|
|
||||||
|
porting:
|
||||||
|
compiles with AIX xlc, HP-UX cc, Tru64 cc (but might not link)
|
||||||
|
|
||||||
|
####################### V 1.3.2.2:
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
PROXY CONNECT failed when the status reply from the proxy server
|
||||||
|
contained more than one consecutive spaces. Problem reported by
|
||||||
|
Alexandre Bezroutchko
|
||||||
|
|
||||||
|
do not SIGSEGV when proxy address fails to resolve server name
|
||||||
|
|
||||||
|
udp-listen failed on systems where AF_INET != SOCK_DGRAM (e.g. SunOS).
|
||||||
|
Problem reported by Christoph Schittel
|
||||||
|
|
||||||
|
test.sh only tests available features
|
||||||
|
|
||||||
|
added missing IP and TCP options in filan analyzer
|
||||||
|
|
||||||
|
do not apply stdio address options to both directions when in
|
||||||
|
unidirectional mode
|
||||||
|
|
||||||
|
on systems lacking /dev/*random and egd, provide (weak) entropy from
|
||||||
|
libc random()
|
||||||
|
|
||||||
|
|
||||||
|
porting:
|
||||||
|
changes for HP-UX (VREPRINT, h_NETDB_INTERNAL)
|
||||||
|
|
||||||
|
compiles on True64, FreeBSD (again), NetBSD, OpenBSD
|
||||||
|
|
||||||
|
support for long long as st_ino type (Cygwin 1.5)
|
||||||
|
|
||||||
|
compile on systems where pty can not be featured
|
||||||
|
|
||||||
|
####################### V 1.3.2.1:
|
||||||
|
|
||||||
|
corrections:
|
||||||
|
"final" solution for the ENOCHLD problem
|
||||||
|
|
||||||
|
corrected "make strip"
|
||||||
|
|
||||||
|
default gcc debug/opt is "-O" again
|
||||||
|
|
||||||
|
check for /proc at runtime, even if configure found it
|
||||||
|
|
||||||
|
src.rpm accidently supported SuSE instead of RedHat
|
||||||
|
|
||||||
|
####################### V 1.3.2.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
option "nofork" connects an exec'd script or program directly
|
||||||
|
to the file descriptors of the other address, circumventing the socat
|
||||||
|
transfer engine
|
||||||
|
|
||||||
|
support for files >2GB, using ftruncate64(), lseek64(), stat64()
|
||||||
|
|
||||||
|
filan has new "simple" output style (filan -s)
|
||||||
|
|
||||||
|
|
||||||
|
porting:
|
||||||
|
options "binary" and "text" for controlling line termination on Cygwin
|
||||||
|
file system access (hint from Yang Wu-Zhou)
|
||||||
|
|
||||||
|
fix by Yang Wu-Zhou for the Cygwin "No Children" problem
|
||||||
|
|
||||||
|
improved support for OSR: _SVID3; no IS_SOCK, no F_GETOWN (thanks to
|
||||||
|
John DuBois)
|
||||||
|
|
||||||
|
minor corrections to avoid warnings with gcc 3
|
||||||
|
|
||||||
|
|
||||||
|
further corrections and minor improvements:
|
||||||
|
configure script is generated with autoconf 2.57 (no longer 2.52)
|
||||||
|
|
||||||
|
configure passes CFLAGS to Makefile
|
||||||
|
|
||||||
|
option -??? for complete list of address options and their short forms
|
||||||
|
|
||||||
|
program name in syslog messages is derived from argv[0]
|
||||||
|
|
||||||
|
SIGHUP now prints notice instead of error
|
||||||
|
|
||||||
|
EIO during read of pty now gives Notice instead of Error, and
|
||||||
|
triggers EOF
|
||||||
|
|
||||||
|
use of hstrerror() for printing resolver error messages
|
||||||
|
|
||||||
|
setgrent() got required endgrent()
|
||||||
|
|
||||||
|
####################### V 1.3.1.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
integration of Wietse Venema's tcpwrapper library (libwrap)
|
||||||
|
|
||||||
|
with "proxy" address, option "resolve" controls if hostname or IP
|
||||||
|
address is sent in request
|
||||||
|
|
||||||
|
option "lowport" establishes limited authorization for TCP and UDP
|
||||||
|
connections
|
||||||
|
|
||||||
|
improvement of .spec file for RPM creation (thanks to Gerd v. Egidy)
|
||||||
|
An accompanying change in the numbering scheme results in an
|
||||||
|
incompatibility with earlier socat RPMs!
|
||||||
|
|
||||||
|
|
||||||
|
solved problems and bugs:
|
||||||
|
PROBLEM: socat daemon terminated when the address of a connecting
|
||||||
|
client did not match range option value instead of continue listening
|
||||||
|
SOLVED: in this case, print warning instead of error to keep daemon
|
||||||
|
active
|
||||||
|
|
||||||
|
PROBLEM: tcp-listen with fork sometimes left excessive number of zombie
|
||||||
|
processes
|
||||||
|
SOLVED: dont assume that each exiting child process generates SIGCHLD
|
||||||
|
|
||||||
|
when converting CRNL to CR, socat converted to NL
|
||||||
|
|
||||||
|
|
||||||
|
further corrections:
|
||||||
|
configure script now disables features that depend on missing files
|
||||||
|
making it more robust in "unsupported" environments
|
||||||
|
|
||||||
|
server.pem permissions corrected to 600
|
||||||
|
|
||||||
|
"make install" now does not strip; use "make strip; make install"
|
||||||
|
if you like strip (suggested by Peter Bray)
|
||||||
|
|
||||||
|
####################### V 1.3.0.1:
|
||||||
|
|
||||||
|
solved problems and bugs:
|
||||||
|
PROBLEM: OPENSSL did not apply tcp, ip, and socket options
|
||||||
|
SOLVED: OPENSSL now correctly handles the options list
|
||||||
|
|
||||||
|
PROBLEM: CRNL to NL and CRNL to CR conversions failed when CRNL crossed
|
||||||
|
block boundary
|
||||||
|
SOLVED: these conversions now simply strip all CR's or NL's from input
|
||||||
|
stream
|
||||||
|
|
||||||
|
|
||||||
|
porting:
|
||||||
|
SunOS ptys now work on x86, too (thanks to Peter Bray)
|
||||||
|
|
||||||
|
configure looks for freeware libs in /pkgs/lib/ (thanks to Peter Bray)
|
||||||
|
|
||||||
|
|
||||||
|
further corrections:
|
||||||
|
added WITH_PROXY value to -V output
|
||||||
|
|
||||||
|
added compile dependencies of WITH_PTY and WITH_PROXY
|
||||||
|
|
||||||
|
-?? did not print option group of proxy options
|
||||||
|
|
||||||
|
corrected syntax for bind option in docu
|
||||||
|
|
||||||
|
corrected an issue with stdio in unidirectional mode
|
||||||
|
|
||||||
|
options socksport and proxyport support service names
|
||||||
|
|
||||||
|
ftp.sh script supports proxy address
|
||||||
|
|
||||||
|
man page no longer installed with execute permissions (thanks to Peter
|
||||||
|
Bray)
|
||||||
|
|
||||||
|
fixed a malloc call bug that could cause SIGSEGV or false "out of
|
||||||
|
memory" errors on EXEC and SYSTEM, depending on program name length and
|
||||||
|
libc.
|
||||||
|
|
||||||
|
####################### V 1.3.0.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
proxy connect with optional proxy authentication
|
||||||
|
|
||||||
|
combined hex and text dump mode, credits to Gregory Margo
|
||||||
|
|
||||||
|
address pty applies options user, group, and perm to device
|
||||||
|
|
||||||
|
|
||||||
|
solved problems and bugs:
|
||||||
|
PROBLEM: option reuseport was not applied (BSD, AIX)
|
||||||
|
SOLVED: option reuseport now in phase PASTSOCKET instead of PREBIND,
|
||||||
|
credits to Jean-Baptiste Marchand
|
||||||
|
|
||||||
|
PROBLEM: ignoreeof with stdio was ignored
|
||||||
|
SOLVED: ignoreeof now works correctly with address stdio
|
||||||
|
|
||||||
|
PROBLEM: ftp.sh did not use user supplied password
|
||||||
|
SOLVED: ftp.sh now correctly passes password from command line
|
||||||
|
|
||||||
|
PROBLEM: server.pem had expired
|
||||||
|
SOLVED: new server.pem valid for ten years
|
||||||
|
|
||||||
|
PROBLEM: socks notice printed wrong port on some platforms
|
||||||
|
SOLVED: socks now uses correct byte-order for port number in notice
|
||||||
|
|
||||||
|
|
||||||
|
further corrections:
|
||||||
|
option name o_trunc corrected to o-trunc
|
||||||
|
|
||||||
|
combined use of -u and -U is now detected and prevented
|
||||||
|
|
||||||
|
made message system a little more robust against format string attacks
|
||||||
|
|
||||||
|
|
||||||
|
####################### V 1.2.0.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
address pty for putting socat behind a new pseudo terminal that may
|
||||||
|
fake a serial line, modem etc.
|
||||||
|
|
||||||
|
experimental openssl integration
|
||||||
|
(it does not provide any trust between the peers because is does not
|
||||||
|
check certificates!)
|
||||||
|
|
||||||
|
options flock-ex, flock-ex-nb, flock-sh, flock-sh-nb to control all
|
||||||
|
locking mechanism provided by flock()
|
||||||
|
|
||||||
|
options setsid and setpgid now available with all address types
|
||||||
|
|
||||||
|
option ctty (controlling terminal) now available for all TERMIOS
|
||||||
|
addresses
|
||||||
|
|
||||||
|
option truncate (a hybrid of open(.., O_TRUNC) and ftruncate()) is
|
||||||
|
replaced by options o-trunc and ftruncate=offset
|
||||||
|
|
||||||
|
option sourceport now available with TCP and UDP listen addresses to
|
||||||
|
restrict incoming client connections
|
||||||
|
|
||||||
|
unidirectional mode right-to-left (-U)
|
||||||
|
|
||||||
|
|
||||||
|
solved problems and bugs:
|
||||||
|
PROBLEM: addresses without required parameters but an option containing
|
||||||
|
a '/' were incorrectly interpreted as implicit GOPEN address
|
||||||
|
SOLVED: if an address does not have ':' separator but contains '/',
|
||||||
|
check if the slash is before the first ',' before assuming
|
||||||
|
implicit GOPEN.
|
||||||
|
|
||||||
|
|
||||||
|
porting:
|
||||||
|
ptys under SunOS work now due to use of stream options
|
||||||
|
|
||||||
|
|
||||||
|
further corrections:
|
||||||
|
with -d -d -d -d -D, don't print debug info during file analysis
|
||||||
|
|
||||||
|
|
||||||
|
####################### V 1.1.0.1:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
.spec file for RPM generation
|
||||||
|
|
||||||
|
|
||||||
|
solved problems and bugs:
|
||||||
|
PROBLEM: GOPEN on socket did not apply option unlink-late
|
||||||
|
SOLUTION: GOPEN for socket now applies group NAMED, phase PASTOPEN
|
||||||
|
options
|
||||||
|
|
||||||
|
PROBLEM: with unidirectional mode, an unnecessary close timeout was
|
||||||
|
applied
|
||||||
|
SOLUTION: in unidirectional mode, terminate without wait time
|
||||||
|
|
||||||
|
PROBLEM: using GOPEN on a unix domain socket failed for datagram
|
||||||
|
sockets
|
||||||
|
SOLUTION: when connect() fails with EPROTOTYPE, use a datagram socket
|
||||||
|
|
||||||
|
|
||||||
|
further corrections:
|
||||||
|
|
||||||
|
open() flag options had names starting with "o_", now corrected to "o-"
|
||||||
|
|
||||||
|
in docu, *-listen addresses were called *_listen
|
||||||
|
|
||||||
|
address unix now called unix-connect because it does not handle unix
|
||||||
|
datagram sockets
|
||||||
|
|
||||||
|
in test.sh, apply global command line options with all tests
|
||||||
|
|
||||||
|
|
||||||
|
####################### V 1.1.0.0:
|
||||||
|
|
||||||
|
new features:
|
||||||
|
regular man page and html doc - thanks to kromJx for prototype
|
||||||
|
|
||||||
|
new address type "readline", utilizing GNU readline and history libs
|
||||||
|
|
||||||
|
address option "history-file" for readline
|
||||||
|
|
||||||
|
new option "dash" to "exec" address that allows to start login shells
|
||||||
|
|
||||||
|
syslog facility can be set per command line option
|
||||||
|
|
||||||
|
new address option "tcp-quickack", found in Linux 2.4
|
||||||
|
|
||||||
|
option -g prevents option group checking
|
||||||
|
|
||||||
|
filan and procan can print usage
|
||||||
|
|
||||||
|
procan prints rlimit infos
|
||||||
|
|
||||||
|
|
||||||
|
solved problems and bugs:
|
||||||
|
PROBLEM: raw IP socket SIGSEGV'ed when it had been shut down.
|
||||||
|
SOLVED: set eof flag of channel on shutdown.
|
||||||
|
|
||||||
|
PROBLEM: if channel 2 uses a single non-socket FD in bidirectional mode
|
||||||
|
and has data available while channel 1 reaches EOF, the data is
|
||||||
|
lost.
|
||||||
|
SOLVED: during one loop run, first handle all data transfers and
|
||||||
|
_afterwards_ handle EOF.
|
||||||
|
|
||||||
|
PROBLEM: despite to option NONBLOCK, the connect() call blocked
|
||||||
|
SOLVED: option NONBLOCK is now applied in phase FD instead of LATE
|
||||||
|
|
||||||
|
PROBLEM: UNLINK options issued error when file did not exist,
|
||||||
|
terminating socat
|
||||||
|
SOLVED: failure of unlink() is only warning if errno==ENOENT
|
||||||
|
|
||||||
|
PROBLEM: TCP6-LISTEN required numeric port specification
|
||||||
|
SOLVED: now uses common TCP service resolver
|
||||||
|
|
||||||
|
PROBLEM: with PIPE, wrong FDs were shown for data transfer loop
|
||||||
|
SOLVED: retrieval of FDs now pays respect to PIPE pecularities
|
||||||
|
|
||||||
|
PROBLEM: using address EXEC against an address with IGNOREEOF, socat
|
||||||
|
never terminated
|
||||||
|
SOLVED: corrected EOF handling of sigchld
|
||||||
|
|
||||||
|
|
||||||
|
porting:
|
||||||
|
MacOS and old AIX versions now have pty
|
||||||
|
|
||||||
|
flock() now available on Linux (configure check was wrong)
|
||||||
|
|
||||||
|
named pipe were generated using mknod(), which requires root under BSD
|
||||||
|
now they are generated using mkfifo
|
||||||
|
|
||||||
|
|
||||||
|
further corrections:
|
||||||
|
lots of address options that were "forgotten" at runtime are now
|
||||||
|
available
|
||||||
|
|
||||||
|
option BINDTODEVICE now also called SO-BINDTODEVICE, IF
|
||||||
|
|
||||||
|
"make install" now installs binaries with ownership 0:0
|
||||||
|
|
||||||
|
|
||||||
|
####################### V 1.0.4.2:
|
||||||
|
|
||||||
|
solved problems and bugs:
|
||||||
|
PROBLEM: EOF of one stream caused close of other stream, giving it no
|
||||||
|
chance to go down regularly
|
||||||
|
SOLVED: EOF of one stream now causes shutdown of write part of other
|
||||||
|
stream
|
||||||
|
|
||||||
|
PROBLEM: sending mail via socks address to qmail showed that crlf
|
||||||
|
option does not work
|
||||||
|
SOLVED: socks address applies PH_LATE options
|
||||||
|
|
||||||
|
PROBLEM: in debug mode, no info about socat and platform was issued
|
||||||
|
SOLVED: print socat version and uname output in debug mode
|
||||||
|
|
||||||
|
PROBLEM: invoking socat with -t and no following parameters caused
|
||||||
|
SIGSEGV
|
||||||
|
SOLVED: -t and -b now check next argv entry
|
||||||
|
|
||||||
|
PROBLEM: when opening of logfile (-lf) failed, no error was reported
|
||||||
|
and no further messages were printed
|
||||||
|
SOLVED: check result of fopen and print error message if it failed
|
||||||
|
|
||||||
|
new features:
|
||||||
|
address type UDP-LISTEN now supports option fork: it internally applies
|
||||||
|
socket option SO_REUSEADDR so a new UDP socket can bind to port after
|
||||||
|
`accepting´ a connection (child processes might live forever though)
|
||||||
|
(suggestion from Damjan Lango)
|
||||||
|
|
||||||
|
|
||||||
|
####################### V 1.0.4.1:
|
||||||
|
|
||||||
|
solved problems and bugs:
|
||||||
|
PROB: assert in libc caused an endless recursion
|
||||||
|
SOLVED: no longer catch SIGABRT
|
||||||
|
|
||||||
|
PROB: socat printed wrong verbose prefix for "right to left" packets
|
||||||
|
SOLVED: new parameter for xiotransfer() passes correct prefix
|
||||||
|
|
||||||
|
new features:
|
||||||
|
in debug mode, socat prints its command line arguments
|
||||||
|
in verbose mode, escape special characters and replace unprintables
|
||||||
|
with '.'. Patch from Adrian Thurston.
|
||||||
|
|
||||||
|
|
||||||
|
####################### V 1.0.4.0:
|
||||||
|
|
||||||
|
solved problems and bugs:
|
||||||
|
Debug output for lstat and fstat said "stat"
|
||||||
|
|
||||||
|
further corrections:
|
||||||
|
FreeBSD now includes libutil.h
|
||||||
|
|
||||||
|
new features:
|
||||||
|
option setsid with exec/pty
|
||||||
|
option setpgid with exec/pty
|
||||||
|
option ctty with exec/pty
|
||||||
|
TCP V6 connect test
|
||||||
|
gettimeofday in sycls.c (no use yet)
|
||||||
|
|
||||||
|
porting:
|
||||||
|
before Gethostbyname, invoke inet_aton for MacOSX
|
||||||
|
|
||||||
|
|
||||||
|
####################### V 1.0.3.0:
|
||||||
|
|
||||||
|
solved problems and bugs:
|
||||||
|
|
||||||
|
PROB: test 9 of test.sh (echo via file) failed on some platforms,
|
||||||
|
socat exited without error message
|
||||||
|
SOLVED: _xioopen_named_early(): preset statbuf.st_mode with 0
|
||||||
|
|
||||||
|
PROB: test 17 hung forever
|
||||||
|
REASON: child death before select loop did not result in EOF
|
||||||
|
SOLVED: check of existence of children before starting select loop
|
||||||
|
|
||||||
|
PROB: test 17 failed
|
||||||
|
REASON: child dead triggered EOF before last data was read
|
||||||
|
SOLVED: after child death, read last data before setting EOF
|
||||||
|
|
||||||
|
PROB: filan showed that exec processes incorrectly had fd3 open
|
||||||
|
REASON: inherited open fd3 from main process
|
||||||
|
SOLVED: set CLOEXEC flag on pty fd in main process
|
||||||
|
|
||||||
|
PROB: help printed "undef" instead of group "FORK"
|
||||||
|
SOLVED: added "FORK" to group name array
|
||||||
|
|
||||||
|
PROB: fatal messages did not include severity classifier
|
||||||
|
SOLVED: added "F" to severity classifier array
|
||||||
|
|
||||||
|
PROB: IP6 addresses where printed incorrectly
|
||||||
|
SOLVED: removed type casts to unsigned short *
|
||||||
|
|
||||||
|
further corrections:
|
||||||
|
socat catches illegal -l modes
|
||||||
|
corrected error message on setsockopt(linger)
|
||||||
|
option tabdly is of type uint
|
||||||
|
correction for UDP over IP6
|
||||||
|
more cpp conditionals, esp. for IP6 situations
|
||||||
|
better handling of group NAMED options with listening UNIX sockets
|
||||||
|
applyopts2 now includes last given phase
|
||||||
|
corrected option group handling for most address types
|
||||||
|
introduce dropping of unappliable options (dropopts, dropopts2)
|
||||||
|
gopen now accepts socket and unix-socket options
|
||||||
|
exec and system now accept all socket and termios options
|
||||||
|
child process for exec and system addresses with option pty
|
||||||
|
improved descriptions and options for EXAMPLES
|
||||||
|
printf format for file mode changed to "0%03o" with length spec.
|
||||||
|
added va_end() in branch of msg()
|
||||||
|
changed phase of lock options from PASTOPEN to FD
|
||||||
|
support up to four early dying processes
|
||||||
|
|
||||||
|
structural changes:
|
||||||
|
xiosysincludes now includes sysincludes.h for non xio files
|
||||||
|
|
||||||
|
new features:
|
||||||
|
option umask
|
||||||
|
CHANGES file
|
||||||
|
TYPE_DOUBLE, u_double
|
||||||
|
OFUNC_OFFSET
|
||||||
|
added getsid(), setsid(), send() to sycls
|
||||||
|
procan prints sid (session id)
|
||||||
|
mail.sh gets -f (from) option
|
||||||
|
new EXAMPLEs for file creation
|
||||||
|
gatherinfo.sh now tells about failures
|
||||||
|
test.sh can check for much more address/option combinations
|
||||||
|
|
||||||
|
porting:
|
||||||
|
ispeed, ospeed for termios on FreeBSD
|
||||||
|
getpgid() conditional for MacOS 10
|
||||||
|
added ranlib in Makefile.in for MacOS 10
|
||||||
|
disable pty option if no pty mechanism is available (MacOS 10)
|
||||||
|
now compiles and runs on MacOS 10 (still some tests fail)
|
||||||
|
setgroups() conditional for cygwin
|
||||||
|
sighandler_t defined conditionally
|
||||||
|
use gcc option -D_GNU_SOURCE
|
339
COPYING
Normal file
339
COPYING
Normal file
|
@ -0,0 +1,339 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
675 Mass Ave, Cambridge, MA 02139, USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) 19yy <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
127
COPYING.OpenSSL
Normal file
127
COPYING.OpenSSL
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
|
||||||
|
LICENSE ISSUES
|
||||||
|
==============
|
||||||
|
|
||||||
|
The OpenSSL toolkit stays under a dual license, i.e. both the conditions of
|
||||||
|
the OpenSSL License and the original SSLeay license apply to the toolkit.
|
||||||
|
See below for the actual license texts. Actually both licenses are BSD-style
|
||||||
|
Open Source licenses. In case of any license issues related to OpenSSL
|
||||||
|
please contact openssl-core@openssl.org.
|
||||||
|
|
||||||
|
OpenSSL License
|
||||||
|
---------------
|
||||||
|
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
Original SSLeay License
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This package is an SSL implementation written
|
||||||
|
* by Eric Young (eay@cryptsoft.com).
|
||||||
|
* The implementation was written so as to conform with Netscapes SSL.
|
||||||
|
*
|
||||||
|
* This library is free for commercial and non-commercial use as long as
|
||||||
|
* the following conditions are aheared to. The following conditions
|
||||||
|
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||||
|
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||||
|
* included with this distribution is covered by the same copyright terms
|
||||||
|
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||||
|
* the code are not to be removed.
|
||||||
|
* If this package is used in a product, Eric Young should be given attribution
|
||||||
|
* as the author of the parts of the library used.
|
||||||
|
* This can be in the form of a textual message at program startup or
|
||||||
|
* in documentation (online or textual) provided with the package.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* "This product includes cryptographic software written by
|
||||||
|
* Eric Young (eay@cryptsoft.com)"
|
||||||
|
* The word 'cryptographic' can be left out if the rouines from the library
|
||||||
|
* being used are not cryptographic related :-).
|
||||||
|
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||||
|
* the apps directory (application code) you must include an acknowledgement:
|
||||||
|
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The licence and distribution terms for any publically available version or
|
||||||
|
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||||
|
* copied and put under another distribution licence
|
||||||
|
* [including the GNU Public Licence.]
|
||||||
|
*/
|
||||||
|
|
171
Config/Makefile.AIX-5-1
Normal file
171
Config/Makefile.AIX-5-1
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
# $Id: Makefile.AIX-5-1,v 1.16 2006/07/13 21:29:05 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2006
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
MANDEST = ${prefix}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS = -D__GNUC__=2 -D__GNUC_MINOR__=9 -D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_LONG_LONG -D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_LONG_LONG -D__CHAR_UNSIGNED__ -D_ARCH_COM
|
||||||
|
CPPFLAGS = -I. -I/usr/local/include
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -L/usr/local/lib -lwrap -lbsd -L/opt/freeware/lib -lreadline -lssl -lcrypto
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = ./install-sh -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c \
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c fdname.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
||||||
|
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT socat.1 socat.html xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-4-20 Config/config.Linux-2-4-20.h \
|
||||||
|
Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
||||||
|
Config/Makefile.MacOS-10-2 Config/config.MacOS-10-2.h \
|
||||||
|
Config/Makefile.SunOS-5-9 Config/config.SunOS-5-9.h \
|
||||||
|
Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
||||||
|
Config/Makefile.FreeBSD-4-10 Config/config.FreeBSD-4-10.h \
|
||||||
|
Config/Makefile.FreeBSD-5-4 Config/config.FreeBSD-5-4.h \
|
||||||
|
Config/Makefile.OpenBSD-3-4 Config/config.OpenBSD-3-4.h \
|
||||||
|
Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
||||||
|
|
||||||
|
|
||||||
|
all: progs
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
procan: procan_main.o procan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ procan_main.o procan.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
177
Config/Makefile.FreeBSD-6-1
Normal file
177
Config/Makefile.FreeBSD-6-1
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
# $Id: Makefile.FreeBSD-6-1,v 1.2 2007/03/06 21:44:34 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2006
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
MANDEST = ${prefix}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS = -D_LONGLONG
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lutil -lreadline -lssl
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c \
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
||||||
|
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-16 Config/config.Linux-2-6-16.h \
|
||||||
|
Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
||||||
|
Config/Makefile.SunOS-5-8 Config/config.SunOS-5-8.h \
|
||||||
|
Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-2-0-2 Config/config.NetBSD-2-0-2.h \
|
||||||
|
Config/Makefile.OpenBSD-3-8 Config/config.OpenBSD-3-8.h \
|
||||||
|
Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
||||||
|
|
||||||
|
|
||||||
|
all: progs
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
177
Config/Makefile.HP-UX-B-11-11
Normal file
177
Config/Makefile.HP-UX-B-11-11
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
# $Id: Makefile.HP-UX-B-11-11,v 1.7 2007/03/06 21:44:34 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2006
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
MANDEST = ${prefix}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS =
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lssl
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /opt/imake/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c \
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
||||||
|
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-16 Config/config.Linux-2-6-16.h \
|
||||||
|
Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
||||||
|
Config/Makefile.SunOS-5-8 Config/config.SunOS-5-8.h \
|
||||||
|
Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-2-0-2 Config/config.NetBSD-2-0-2.h \
|
||||||
|
Config/Makefile.OpenBSD-3-8 Config/config.OpenBSD-3-8.h \
|
||||||
|
Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
||||||
|
|
||||||
|
|
||||||
|
all: progs
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
177
Config/Makefile.Linux-2-6-16
Normal file
177
Config/Makefile.Linux-2-6-16
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
# $Id: Makefile.Linux-2-6-16,v 1.1 2007/03/06 21:51:57 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2006
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
MANDEST = ${prefix}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS =
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lutil -lreadline -lssl
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c \
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
||||||
|
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-16 Config/config.Linux-2-6-16.h \
|
||||||
|
Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
||||||
|
Config/Makefile.SunOS-5-8 Config/config.SunOS-5-8.h \
|
||||||
|
Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-2-0-2 Config/config.NetBSD-2-0-2.h \
|
||||||
|
Config/Makefile.OpenBSD-3-8 Config/config.OpenBSD-3-8.h \
|
||||||
|
Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
||||||
|
|
||||||
|
|
||||||
|
all: progs
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
171
Config/Makefile.NetBSD-2-0-2
Normal file
171
Config/Makefile.NetBSD-2-0-2
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
# $Id: Makefile.NetBSD-2-0-2,v 1.1 2006/07/13 21:40:28 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2006
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
MANDEST = ${prefix}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS = -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lutil -lssl -lcrypto
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c \
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c fdname.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
||||||
|
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT socat.1 socat.html xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-4-20 Config/config.Linux-2-4-20.h \
|
||||||
|
Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
||||||
|
Config/Makefile.MacOS-10-2 Config/config.MacOS-10-2.h \
|
||||||
|
Config/Makefile.SunOS-5-9 Config/config.SunOS-5-9.h \
|
||||||
|
Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
||||||
|
Config/Makefile.FreeBSD-4-10 Config/config.FreeBSD-4-10.h \
|
||||||
|
Config/Makefile.FreeBSD-5-4 Config/config.FreeBSD-5-4.h \
|
||||||
|
Config/Makefile.OpenBSD-3-4 Config/config.OpenBSD-3-4.h \
|
||||||
|
Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
||||||
|
|
||||||
|
|
||||||
|
all: progs
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
procan: procan_main.o procan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ procan_main.o procan.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
171
Config/Makefile.OpenBSD-3-8
Normal file
171
Config/Makefile.OpenBSD-3-8
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
# $Id: Makefile.OpenBSD-3-8,v 1.1 2006/07/13 21:40:31 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2006
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
MANDEST = ${prefix}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS = -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=5
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lutil -lreadline -lcurses -lssl -lcrypto
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c \
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c fdname.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
||||||
|
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT socat.1 socat.html xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-4-20 Config/config.Linux-2-4-20.h \
|
||||||
|
Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
||||||
|
Config/Makefile.MacOS-10-2 Config/config.MacOS-10-2.h \
|
||||||
|
Config/Makefile.SunOS-5-9 Config/config.SunOS-5-9.h \
|
||||||
|
Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
||||||
|
Config/Makefile.FreeBSD-4-10 Config/config.FreeBSD-4-10.h \
|
||||||
|
Config/Makefile.FreeBSD-5-4 Config/config.FreeBSD-5-4.h \
|
||||||
|
Config/Makefile.OpenBSD-3-4 Config/config.OpenBSD-3-4.h \
|
||||||
|
Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
||||||
|
|
||||||
|
|
||||||
|
all: progs
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
procan: procan_main.o procan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ procan_main.o procan.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
177
Config/Makefile.SunOS-5-8
Normal file
177
Config/Makefile.SunOS-5-8
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
# $Id: Makefile.SunOS-5-8,v 1.24 2007/03/06 21:44:34 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2006
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
MANDEST = ${prefix}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS =
|
||||||
|
CPPFLAGS = -I. -I/usr/local/ssl/include
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lwrap -lrt -lsocket -lnsl -lresolv -lreadline -lcurses -L/usr/local/ssl/lib -lssl -lcrypto
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = ./install-sh -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c \
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c hostan.c fdname.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
||||||
|
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-16 Config/config.Linux-2-6-16.h \
|
||||||
|
Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
||||||
|
Config/Makefile.SunOS-5-8 Config/config.SunOS-5-8.h \
|
||||||
|
Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-2-0-2 Config/config.NetBSD-2-0-2.h \
|
||||||
|
Config/Makefile.OpenBSD-3-8 Config/config.OpenBSD-3-8.h \
|
||||||
|
Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
||||||
|
|
||||||
|
|
||||||
|
all: progs
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
171
Config/Makefile.Tru64-5-1B
Normal file
171
Config/Makefile.Tru64-5-1B
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
# $Id: Makefile.Tru64-5-1B,v 1.6 2006/07/13 21:30:05 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2006
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
BINDEST = ${exec_prefix}/bin
|
||||||
|
|
||||||
|
MANDEST = ${prefix}/man
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS = -D__GNUC__=2 -D__GNUC_MINOR__=9 -Dunix -D__osf__ -D_LONGLONG -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__unix__ -D__osf__ -D_LONGLONG -D__SYSTYPE_BSD__ -D_SYSTYPE_BSD -D__unix -D__SYSTYPE_BSD -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C -D__alpha -D__alpha__ -D__alpha_ev4__
|
||||||
|
CPPFLAGS = -I.
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = -DHAVE_CONFIG_H
|
||||||
|
LIBS = -lutil -lbsd -lrt -lreadline -lcurses -lssl -lcrypto
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
INSTALL = /usr/local/bin/install -c
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = -O -D_GNU_SOURCE $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c \
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c sysutils.c utils.c nestlex.c filan.c sycls.c sslcls.c
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c fdname.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
||||||
|
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT socat.1 socat.html xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-4-20 Config/config.Linux-2-4-20.h \
|
||||||
|
Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
||||||
|
Config/Makefile.MacOS-10-2 Config/config.MacOS-10-2.h \
|
||||||
|
Config/Makefile.SunOS-5-9 Config/config.SunOS-5-9.h \
|
||||||
|
Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
||||||
|
Config/Makefile.FreeBSD-4-10 Config/config.FreeBSD-4-10.h \
|
||||||
|
Config/Makefile.FreeBSD-5-4 Config/config.FreeBSD-5-4.h \
|
||||||
|
Config/Makefile.OpenBSD-3-4 Config/config.OpenBSD-3-4.h \
|
||||||
|
Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
||||||
|
|
||||||
|
|
||||||
|
all: progs
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
procan: procan_main.o procan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ procan_main.o procan.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
450
Config/config.AIX-5-1.h
Normal file
450
Config/config.AIX-5-1.h
Normal file
|
@ -0,0 +1,450 @@
|
||||||
|
/* config.h. Generated by configure. */
|
||||||
|
/* $Id: config.AIX-5-1.h,v 1.14 2006/07/13 21:33:50 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
#define HAVE_GETIPNODEBYNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
#define HAVE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
#define HAVE_FSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
#define HAVE_LSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
#define HAVE_LSEEK64 1
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
#define HAVE_TRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
#define HAVE_FTRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
/* #undef HAVE_PROTOTYPE_HSTRERROR */
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
/* #undef HAVE_STDINT_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
#define HAVE_SYS_STROPTS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
/* #undef HAVE_TERMIOS_ISPEED */
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
/* #undef ISPEED_OFFSET */
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
#define HAVE_STRUCT_SOCKADDR_SALEN 1
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
/* #undef HAVE_FLOCK */
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
/* #undef HAVE_OPENPTY */
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTMX */
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTC 1
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
#define HAVE_TYPE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
#define HAVE_TYPE_OFF64 1
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT 8
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT 10
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 4
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
#define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* #undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 6 /* unsigned long */
|
||||||
|
#define HAVE_BASIC_MODE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_GID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_TIME_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_OFF64_T 7 /* long long */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 6 /* unsigned long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 1 /* short */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 3 /* int */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 3 /* int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST64_DEV 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST64_INO 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST64_NLINK 1 /* short */
|
||||||
|
#define HAVE_TYPEOF_ST64_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLKSIZE 3 /* int */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLOCKS 3 /* int */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 6 /* unsigned long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
/* #undef HAVE_PROC_DIR_FD */
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
485
Config/config.FreeBSD-6-1.h
Normal file
485
Config/config.FreeBSD-6-1.h
Normal file
|
@ -0,0 +1,485 @@
|
||||||
|
/* config.h. Generated by configure. */
|
||||||
|
/* $Id: config.FreeBSD-6-1.h,v 1.2 2007/03/06 21:44:34 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
#define HAVE_GETIPNODEBYNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
/* #undef HAVE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
/* #undef HAVE_FSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
/* #undef HAVE_LSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
/* #undef HAVE_LSEEK64 */
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
/* #undef HAVE_TRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
/* #undef HAVE_FTRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_IF_TUN_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
#define HAVE_LIBUTIL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
/* #undef HAVE_SYS_STROPTS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#define ISPEED_OFFSET 9
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
/* #undef HAVE_STRUCT_IP_MREQN */
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#define HAVE_STRUCT_IPV6_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
#define HAVE_STRUCT_IFREQ_IFR_INDEX 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
#define HAVE_STRUCT_SOCKADDR_SALEN 1
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTMX */
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
/* #undef HAVE_TYPE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
/* #undef HAVE_TYPE_OFF64 */
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 8
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_MODE_T 2 /* unsigned short */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_GID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_TIME_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_OFF64_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 4 /* unsigned int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 2 /* unsigned short */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_DEV */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_INO */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_NLINK */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_SIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLKSIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLOCKS */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 7 /* long long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
/* #undef HAVE_PROC_DIR_FD */
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
/* #undef WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
/* #undef WITH_TUN */
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
485
Config/config.HP-UX-B-11-11.h
Normal file
485
Config/config.HP-UX-B-11-11.h
Normal file
|
@ -0,0 +1,485 @@
|
||||||
|
/* config.h. Generated by configure. */
|
||||||
|
/* $Id: config.HP-UX-B-11-11.h,v 1.7 2007/03/06 21:44:34 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
#define HAVE_GETIPNODEBYNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
#define HAVE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
#define HAVE_FSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
#define HAVE_LSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
#define HAVE_LSEEK64 1
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
#define HAVE_TRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
#define HAVE_FTRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
/* #undef HAVE_STRTOLL */
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
/* #undef HAVE_HSTRERROR */
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
/* #undef HAVE_PROTOTYPE_HSTRERROR */
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
/* #undef HAVE_STDINT_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_IF_TUN_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
/* #undef HAVE_SYS_SELECT_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
#define HAVE_SYS_STROPTS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
/* #undef HAVE_READLINE_READLINE_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
/* #undef HAVE_READLINE_HISTORY_H */
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
/* #undef HAVE_LIBREADLINE */
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
/* #undef HAVE_TERMIOS_ISPEED */
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
/* #undef ISPEED_OFFSET */
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
/* #undef HAVE_STRUCT_IP_MREQN */
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#define HAVE_STRUCT_IPV6_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
#define HAVE_STRUCT_IFREQ_IFR_INDEX 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
/* #undef HAVE_STRUCT_SOCKADDR_SALEN */
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGCONTROL */
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGCONTROLLEN */
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGFLAGS */
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
/* #undef HAVE_SETENV */
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
/* #undef HAVE_FLOCK */
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
/* #undef HAVE_OPENPTY */
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTMX 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
/* #undef HAVE_TYPE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
#define HAVE_TYPE_OFF64 1
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT 9
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT 11
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 5
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
/* #undef HAVE_HOSTS_ALLOW_TABLE */
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 6 /* unsigned long */
|
||||||
|
#define HAVE_BASIC_MODE_T 2 /* unsigned short */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_GID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_TIME_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_OFF64_T 7 /* long long */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 6 /* unsigned long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 3 /* int */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 2 /* unsigned short */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 5 /* long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST64_DEV 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST64_INO 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST64_NLINK 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST64_SIZE 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLKSIZE 0 /* unknown, taking default */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLOCKS 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 6 /* unsigned long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
/* #undef HAVE_PROC_DIR */
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
/* #undef HAVE_PROC_DIR_FD */
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
/* #undef WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
/* #undef WITH_READLINE */
|
||||||
|
/* #undef WITH_TUN */
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
/* #undef WITH_LIBWRAP */
|
||||||
|
/* #undef HAVE_TCPD_H */
|
||||||
|
/* #undef HAVE_LIBWRAP */
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
485
Config/config.Linux-2-6-16.h
Normal file
485
Config/config.Linux-2-6-16.h
Normal file
|
@ -0,0 +1,485 @@
|
||||||
|
/* config.h. Generated by configure. */
|
||||||
|
/* $Id: config.Linux-2-6-16.h,v 1.1 2007/03/06 21:51:57 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
/* #undef HAVE_GETIPNODEBYNAME */
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
#define HAVE_MEMRCHR 1
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
#define HAVE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
#define HAVE_FSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
#define HAVE_LSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
#define HAVE_LSEEK64 1
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
#define HAVE_TRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
#define HAVE_FTRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
#define HAVE_PTY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
#define HAVE_LINUX_IF_TUN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
#define HAVE_SYS_STROPTS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
#define HAVE_LINUX_FS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
#define HAVE_LINUX_EXT2_FS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#define ISPEED_OFFSET 13
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
#define HAVE_STRUCT_IP_MREQN 1
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#define HAVE_STRUCT_IPV6_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_INDEX */
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex */
|
||||||
|
#define HAVE_STRUCT_IFREQ_IFR_IFINDEX 1
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
/* #undef HAVE_STRUCT_SOCKADDR_SALEN */
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTMX 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
#define HAVE_TYPE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
#define HAVE_TYPE_OFF64 1
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SIGHANDLER 1
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
#define HAVE_FORMAT_Z 1
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT 9
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT 11
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 4
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_MODE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_GID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_TIME_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_OFF64_T 7 /* long long */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 4 /* unsigned int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 5 /* long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST64_DEV 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_INO 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_NLINK 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST64_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 6 /* unsigned long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
#define HAVE_PROC_DIR_FD 1
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
#define WITH_ABSTRACT_UNIXSOCKET 1
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
#define WITH_TUN 1
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
450
Config/config.NetBSD-2-0-2.h
Normal file
450
Config/config.NetBSD-2-0-2.h
Normal file
|
@ -0,0 +1,450 @@
|
||||||
|
/* config.h. Generated by configure. */
|
||||||
|
/* $Id: config.NetBSD-2-0-2.h,v 1.1 2006/07/13 21:44:07 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
/* #undef HAVE_GETIPNODEBYNAME */
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
/* #undef HAVE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
/* #undef HAVE_FSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
/* #undef HAVE_LSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
/* #undef HAVE_LSEEK64 */
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
/* #undef HAVE_TRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
/* #undef HAVE_FTRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
#define HAVE_UTIL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
/* #undef HAVE_SYS_STROPTS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
/* #undef HAVE_LIBREADLINE */
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#define ISPEED_OFFSET 9
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
#define HAVE_STRUCT_SOCKADDR_SALEN 1
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
/* #undef HAVE_GRANTPT */
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
/* #undef HAVE_UNLOCKPT */
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
/* #undef HAVE_PTSNAME */
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTMX */
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
/* #undef HAVE_TYPE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
/* #undef HAVE_TYPE_OFF64 */
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 8
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
#define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* #undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_MODE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_GID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_TIME_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_OFF64_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 4 /* unsigned int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_DEV */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_INO */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_NLINK */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_SIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLKSIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLOCKS */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 7 /* long long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
/* #undef HAVE_PROC_DIR_FD */
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
/* #undef WITH_READLINE */
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
450
Config/config.OpenBSD-3-8.h
Normal file
450
Config/config.OpenBSD-3-8.h
Normal file
|
@ -0,0 +1,450 @@
|
||||||
|
/* config.h. Generated by configure. */
|
||||||
|
/* $Id: config.OpenBSD-3-8.h,v 1.1 2006/07/13 21:44:11 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
/* #undef HAVE_GETIPNODEBYNAME */
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
/* #undef HAVE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
/* #undef HAVE_FSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
/* #undef HAVE_LSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
/* #undef HAVE_LSEEK64 */
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
/* #undef HAVE_TRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
/* #undef HAVE_FTRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
/* #undef HAVE_STDINT_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
#define HAVE_UTIL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
/* #undef HAVE_SYS_STROPTS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#define ISPEED_OFFSET 9
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
#define HAVE_STRUCT_SOCKADDR_SALEN 1
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
/* #undef HAVE_STRUCT_IOVEC */
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROL 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGCONTROLLEN 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#define HAVE_STRUCT_MSGHDR_MSGFLAGS 1
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
/* #undef HAVE_GRANTPT */
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
/* #undef HAVE_UNLOCKPT */
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
/* #undef HAVE_PTSNAME */
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTMX */
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
/* #undef HAVE_TYPE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
/* #undef HAVE_TYPE_OFF64 */
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT -1
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 8
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
#define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* #undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_MODE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_GID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_TIME_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_OFF64_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 4 /* unsigned int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 3 /* int */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_DEV */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_INO */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_NLINK */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_SIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLKSIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLOCKS */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 8 /* unsigned long long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
/* #undef HAVE_PROC_DIR */
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
/* #undef HAVE_PROC_DIR_FD */
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
485
Config/config.SunOS-5-8.h
Normal file
485
Config/config.SunOS-5-8.h
Normal file
|
@ -0,0 +1,485 @@
|
||||||
|
/* config.h. Generated by configure. */
|
||||||
|
/* $Id: config.SunOS-5-8.h,v 1.18 2007/03/06 21:44:34 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
#define HAVE_GETIPNODEBYNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
#define HAVE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
#define HAVE_FSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
#define HAVE_LSTAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
#define HAVE_LSEEK64 1
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
#define HAVE_TRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
#define HAVE_FTRUNCATE64 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#define HAVE_INET_NTOP 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#define HAVE_PROTOTYPE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
/* #undef HAVE_STDINT_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
/* #undef HAVE_PTY_H */
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_IF_TUN_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
#define HAVE_SYS_STROPTS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
/* #undef HAVE_TERMIOS_ISPEED */
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
/* #undef ISPEED_OFFSET */
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#define HAVE_STRUCT_IP_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
/* #undef HAVE_STRUCT_IP_MREQN */
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#define HAVE_STRUCT_IPV6_MREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#define HAVE_STRUCT_IFREQ 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
#define HAVE_STRUCT_IFREQ_IFR_INDEX 1
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex */
|
||||||
|
/* #undef HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
/* #undef HAVE_STRUCT_SOCKADDR_SALEN */
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGCONTROL */
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGCONTROLLEN */
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGFLAGS */
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#define HAVE_STRUCT_IP_IP_HL 1
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
/* #undef HAVE_SETENV */
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
/* #undef HAVE_FLOCK */
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
/* #undef HAVE_OPENPTY */
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTMX 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#define HAVE_TYPE_SOCKLEN 1
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
#define HAVE_TYPE_STAT64 1
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
#define HAVE_TYPE_OFF64 1
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT64 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT 9
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT 11
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 4
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#define HAVE_HOSTS_ALLOW_TABLE 1
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* # undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_MODE_T 6 /* unsigned long */
|
||||||
|
#define HAVE_BASIC_PID_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_UID_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_GID_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_TIME_T 5 /* long */
|
||||||
|
#define HAVE_BASIC_OFF64_T 7 /* long long */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 4 /* unsigned int */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 5 /* long */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST64_DEV 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST64_INO 8 /* unsigned long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_NLINK 6 /* unsigned long */
|
||||||
|
#define HAVE_TYPEOF_ST64_SIZE 7 /* long long */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST64_BLOCKS 7 /* long long */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 6 /* unsigned long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
#define HAVE_PROC_DIR_FD 1
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
/* #undef WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
/* #undef WITH_TUN */
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
#define WITH_LIBWRAP 1
|
||||||
|
#define HAVE_TCPD_H 1
|
||||||
|
#define HAVE_LIBWRAP 1
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
450
Config/config.Tru64-5-1B.h
Normal file
450
Config/config.Tru64-5-1B.h
Normal file
|
@ -0,0 +1,450 @@
|
||||||
|
/* config.h. Generated by configure. */
|
||||||
|
/* $Id: config.Tru64-5-1B.h,v 1.5 2006/07/13 21:35:43 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef gid_t */
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#define HAVE_ST_BLKSIZE 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#define HAVE_ST_BLOCKS 1
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#define HAVE_ST_RDEV 1
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#define HAVE_SYS_WAIT_H 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef mode_t */
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef pid_t */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef uid_t */
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#define HAVE_SELECT 1
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#define HAVE_POLL 1
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#define HAVE_SOCKET 1
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#define HAVE_STRDUP 1
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#define HAVE_UNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#define HAVE_GETPGID 1
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#define HAVE_GETSID 1
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#define HAVE_NANOSLEEP 1
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
#define HAVE_GETIPNODEBYNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#define HAVE_SETGROUPS 1
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#define HAVE_INET_ATON 1
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
/* #undef HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
/* #undef HAVE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
/* #undef HAVE_FSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
/* #undef HAVE_LSTAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
/* #undef HAVE_LSEEK64 */
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
/* #undef HAVE_TRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
/* #undef HAVE_FTRUNCATE64 */
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
/* #undef HAVE_STRTOLL */
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#define HAVE_HSTRERROR 1
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
/* #undef HAVE_PROTOTYPE_HSTRERROR */
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#define HAVE_SYSLOG_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#define HAVE_PWD_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#define HAVE_GRP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
/* #undef HAVE_STDINT_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#define HAVE_SYS_POLL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#define HAVE_SYS_UN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
#define HAVE_PTY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_SYSTM_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#define HAVE_NETINET_TCP_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#define HAVE_NETINET_IP6_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#define HAVE_NET_IF_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#define HAVE_SYS_FILE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
/* #undef HAVE_LIBUTIL_H */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
#define HAVE_SYS_STROPTS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#define HAVE_REGEX_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
/* #undef HAVE_LINUX_EXT2_FS_H */
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#define HAVE_READLINE_READLINE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#define HAVE_READLINE_HISTORY_H 1
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
/* #undef HAVE_LIBM */
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
/* #undef HAVE_FLOOR */
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
/* #undef _XOPEN_EXTENDED_SOURCE */
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#define HAVE_FDS_BITS 1
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#define HAVE_TERMIOS_ISPEED 1
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#define ISPEED_OFFSET 9
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
/* # undef OSPEED_OFFSET */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
/* #undef _SVID3 */
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#define HAVE_STRUCT_LINGER 1
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
/* #undef HAVE_STRUCT_SOCKADDR_SALEN */
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#define HAVE_IP6_SOCKADDR 0
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#define HAVE_STRUCT_IOVEC 1
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGCONTROL */
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGCONTROLLEN */
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
/* #undef HAVE_STRUCT_MSGHDR_MSGFLAGS */
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
/* #undef HAVE_STRUCT_IP_IP_HL */
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#define HAVE_GRANTPT 1
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#define HAVE_UNLOCKPT 1
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#define HAVE_PTSNAME 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
#define HAVE_DEV_PTMX 1
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
/* #undef HAVE_DEV_PTC */
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#define HAVE_TYPE_LONGLONG 1
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SOCKLEN */
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
/* #undef HAVE_TYPE_STAT64 */
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
/* #undef HAVE_TYPE_OFF64 */
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
/* #undef HAVE_TYPE_SIGHANDLER */
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT8 1
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT16 1
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#define HAVE_TYPE_UINT32 1
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
/* #undef HAVE_FORMAT_Z */
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#define CRDLY_SHIFT 12
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#define TABDLY_SHIFT 10
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#define CSIZE_SHIFT 8
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
/* #undef HAVE_HOSTS_ALLOW_TABLE */
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
#define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
/* #undef HAVE_HOSTS_DENY_TABLE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#define HAVE_BASIC_SIZE_T 6 /* unsigned long */
|
||||||
|
#define HAVE_BASIC_MODE_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_PID_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_UID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_GID_T 4 /* unsigned int */
|
||||||
|
#define HAVE_BASIC_TIME_T 3 /* int */
|
||||||
|
#define HAVE_BASIC_OFF64_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_BASIC_SOCKLEN_T 0 /* unknown, taking default */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_ST_DEV 3 /* int */
|
||||||
|
#define HAVE_TYPEOF_ST_INO 4 /* unsigned int */
|
||||||
|
#define HAVE_TYPEOF_ST_NLINK 2 /* unsigned short */
|
||||||
|
#define HAVE_TYPEOF_ST_SIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLKSIZE 5 /* long */
|
||||||
|
#define HAVE_TYPEOF_ST_BLOCKS 5 /* long */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_DEV */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_INO */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_NLINK */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_SIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLKSIZE */
|
||||||
|
/* #undef HAVE_TYPEOF_ST64_BLOCKS */
|
||||||
|
|
||||||
|
/* #undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC */
|
||||||
|
|
||||||
|
#define HAVE_TYPEOF_RLIM_MAX 6 /* unsigned long */
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#define HAVE_PROC_DIR 1
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
/* #undef HAVE_PROC_DIR_FD */
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
#define WITH_STDIO 1
|
||||||
|
#define WITH_FDNUM 1
|
||||||
|
#define WITH_FILE 1
|
||||||
|
#define WITH_CREAT 1
|
||||||
|
#define WITH_GOPEN 1
|
||||||
|
#define WITH_TERMIOS 1
|
||||||
|
#define WITH_PIPE 1
|
||||||
|
#define WITH_UNIX 1
|
||||||
|
#define WITH_IP4 1
|
||||||
|
#define WITH_IP6 1
|
||||||
|
#define WITH_RAWIP 1
|
||||||
|
#define WITH_TCP 1
|
||||||
|
#define WITH_UDP 1
|
||||||
|
#define WITH_LISTEN 1
|
||||||
|
#define WITH_SOCKS4 1
|
||||||
|
#define WITH_SOCKS4A 1
|
||||||
|
#define WITH_PROXY 1
|
||||||
|
#define WITH_EXEC 1
|
||||||
|
#define WITH_SYSTEM 1
|
||||||
|
#define WITH_READLINE 1
|
||||||
|
#define WITH_PTY 1
|
||||||
|
#define WITH_EXT2 1
|
||||||
|
#define WITH_OPENSSL 1
|
||||||
|
/* #undef WITH_FIPS */
|
||||||
|
/* #undef OPENSSL_FIPS */
|
||||||
|
/* #undef WITH_LIBWRAP */
|
||||||
|
/* #undef HAVE_TCPD_H */
|
||||||
|
/* #undef HAVE_LIBWRAP */
|
||||||
|
|
||||||
|
#define WITH_SYCLS 1
|
||||||
|
#define WITH_FILAN 1
|
||||||
|
#define WITH_RETRY 1
|
||||||
|
|
||||||
|
#define WITH_MSGLEVEL 0
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
205
DEVELOPMENT
Normal file
205
DEVELOPMENT
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
|
||||||
|
This file should help you to add new address types and address options to
|
||||||
|
socat.
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
socat will in future releases be split into a library "libxio" containing all
|
||||||
|
the address stuff, useful also for many other purposes, and the socat main()
|
||||||
|
and data shuffler. If you intend to perform major changes to the xio part and
|
||||||
|
to publish them, please contact me before!
|
||||||
|
|
||||||
|
|
||||||
|
ADDING A NEW ADDRESS TYPE:
|
||||||
|
|
||||||
|
* Create new files xio-newaddr.c and xio-newaddr.h
|
||||||
|
|
||||||
|
* Create a new record of struct addrdesc in xio-newaddr.c, with declaration in xio-newaddr.h.
|
||||||
|
|
||||||
|
* Make a new entry to addressnames[] in xioopen.c with the addresses main name
|
||||||
|
and maybe with alias names. Keep this array ASCII sorted, without uppercase
|
||||||
|
chars.
|
||||||
|
|
||||||
|
* config.h.in: #undef WITH_NEWADDR
|
||||||
|
|
||||||
|
* configure.in: Copy the disable part of, e.g., WITH_SOCKS4 and adapt it to
|
||||||
|
NEWADDR
|
||||||
|
|
||||||
|
* In socat.c, add to socat_version
|
||||||
|
|
||||||
|
* Write a function xioopen_newaddr() in xio-newaddr.c, declaration in
|
||||||
|
xio-newaddr.h
|
||||||
|
Do not forget the following option processing calls:
|
||||||
|
All groups: _xio_openlate()
|
||||||
|
Group FD: applyopts_cloexec()
|
||||||
|
Group NAMED: applyopts_file() for phases PREOPEN, OPEN, and FD
|
||||||
|
|
||||||
|
* Describe a tested example in file EXAMPLES, and maybe in the socat manpage
|
||||||
|
source.
|
||||||
|
|
||||||
|
* Try to define a test for this address type in test.sh
|
||||||
|
|
||||||
|
* Update file CHANGES
|
||||||
|
|
||||||
|
|
||||||
|
ADDING A NEW ADDRESS OPTION:
|
||||||
|
|
||||||
|
xioopen.c:
|
||||||
|
|
||||||
|
* If this option depends on a #define that is probably not available on all
|
||||||
|
platforms, make all new code for this option dependent on the existence of this
|
||||||
|
C header define:
|
||||||
|
#ifdef PREFIX_NEWOPTION
|
||||||
|
...
|
||||||
|
#endif
|
||||||
|
|
||||||
|
* Add an OPT_NEWOPTION to enum e_optcode in xioopts.h, preferably keeping
|
||||||
|
alphabetic order
|
||||||
|
|
||||||
|
* Add a struct optdesc opt_newoption record in xio-newaddr.c and its
|
||||||
|
declaration in xio-newaddr.h. The complete structure definition must be in one
|
||||||
|
line without breaks for automatic docu extraction.
|
||||||
|
Build the record from the following components:
|
||||||
|
. A canonical default name (e.g. "newoption")
|
||||||
|
. A short, preferable name (e.g. "newopt") or NULL
|
||||||
|
. OPT_NEWOPTION (from enum e_optcode, see above)
|
||||||
|
. A group membership that restricts appliance of the new option to matching
|
||||||
|
address types (e.g., one of GROUP_ANY, GROUP_IP_TCP, GROUP_EXEC)
|
||||||
|
. A phase specification that positions this option within address processing.
|
||||||
|
Note that the function code can override this value.
|
||||||
|
. A representation type for option arguments (e.g., TYPE_INT, TYPE_STRING etc.;
|
||||||
|
use TYPE_BOOL if this option just triggers an action)
|
||||||
|
. A function or action definition for applying this option. If it does not use
|
||||||
|
one of the standard functions (open(), ioctl(), setsockopt()...), then use
|
||||||
|
OFUNC_SPEC (specific).
|
||||||
|
|
||||||
|
* For the canonical name and all its aliases and abbreviations, add entries to
|
||||||
|
the array optionnames in xioopts.c. KEEP STRICT ALPHABETIC (ASCII) ORDER!
|
||||||
|
The entries must be embedded in an IF_... macro of their group for conditional
|
||||||
|
compiling.
|
||||||
|
|
||||||
|
* For options using some predefined action (see OFUNC above), this might be
|
||||||
|
enough - test the option and document it in xio.help!
|
||||||
|
For OFUNC_SPEC, it might suffice to add another "case" to the OFUNC_SPEC branch
|
||||||
|
in applyopts() in xioopts.c. If you need more special handling, you should try
|
||||||
|
to understand the address specific functions and add your code there.
|
||||||
|
|
||||||
|
* If you use system or low level C library calls or library calls that might
|
||||||
|
hang or induce problems, please invoke them with capitalized name; if no such
|
||||||
|
name is defined, add an appropriate debug function to sycls.c, and a header
|
||||||
|
entry and a wrapper "define" to sycls.h
|
||||||
|
|
||||||
|
* Update file CHANGES
|
||||||
|
|
||||||
|
|
||||||
|
INFO ABOUT ADDRESS PHASES:
|
||||||
|
|
||||||
|
Each option entry has a field specifying a default phase for its application.
|
||||||
|
Of course, the code that analyses and applies an address may override this
|
||||||
|
default phase.
|
||||||
|
|
||||||
|
Depending on the type of address there are several major phase sequences:
|
||||||
|
|
||||||
|
|
||||||
|
OPEN addresses:
|
||||||
|
|
||||||
|
PH_INIT retrieving info from original state
|
||||||
|
PH_EARLY before any other processing
|
||||||
|
PH_PREOPEN before file creation/opening (not UNIX sockets)
|
||||||
|
PH_OPEN during file creation/opening (not UNIX sockets)
|
||||||
|
PH_PASTOPEN past file creation/opening (not UNIX sockets)
|
||||||
|
PH_FD soon after FD creation or identification
|
||||||
|
PH_LATE FD is ready, before start of data loop
|
||||||
|
PH_LATE2 FD is ready, dropping privileges
|
||||||
|
|
||||||
|
|
||||||
|
SOCKET addresses:
|
||||||
|
|
||||||
|
PH_INIT retrieving info from original state
|
||||||
|
PH_EARLY before any other processing
|
||||||
|
PH_PRESOCKET before socket call
|
||||||
|
PH_SOCKET for socket call
|
||||||
|
PH_PASTSOCKET after socket call
|
||||||
|
PH_FD soon after FD creation or identification
|
||||||
|
PH_PREBIND before socket bind()
|
||||||
|
PH_BIND during socket bind()
|
||||||
|
PH_PASTBIND past socket bind()
|
||||||
|
PH_PRECONNECT before connect()
|
||||||
|
PH_CONNECT during connect()
|
||||||
|
PH_PASTCONNECT after connect()
|
||||||
|
PH_CONNECTED phase common with listen
|
||||||
|
PH_LATE FD is ready, before start of data loop
|
||||||
|
PH_LATE2 FD is ready, dropping privileges
|
||||||
|
|
||||||
|
|
||||||
|
SOCKET with LISTEN and FORK:
|
||||||
|
|
||||||
|
PH_INIT retrieving info from original state
|
||||||
|
PH_EARLY before any other processing
|
||||||
|
PH_PRESOCKET before socket call
|
||||||
|
PH_SOCKET for socket call
|
||||||
|
PH_PASTSOCKET after socket call
|
||||||
|
PH_PREBIND before socket bind()
|
||||||
|
PH_BIND during socket bind()
|
||||||
|
PH_PASTBIND past socket bind()
|
||||||
|
PH_PRELISTEN before listen()
|
||||||
|
PH_LISTEN during listen()
|
||||||
|
PH_PASTLISTEN after listen()
|
||||||
|
PH_PREACCEPT before accept()
|
||||||
|
PH_ACCEPT during accept()
|
||||||
|
PH_PASTACCEPT after accept()
|
||||||
|
PH_FD soon after FD creation or identification
|
||||||
|
PH_CONNECTED phase common with connect
|
||||||
|
PH_PREFORK before forking
|
||||||
|
PH_FORK during fork()
|
||||||
|
PH_PASTFORK after fork()
|
||||||
|
PH_LATE FD is ready, before start of data loop
|
||||||
|
PH_LATE2 FD is ready, dropping privileges
|
||||||
|
|
||||||
|
|
||||||
|
FD addresses:
|
||||||
|
|
||||||
|
PH_INIT retrieving info from original state
|
||||||
|
PH_EARLY before any other processing
|
||||||
|
PH_FD soon after FD identification
|
||||||
|
PH_LATE FD is ready, before start of data loop
|
||||||
|
PH_LATE2 FD is ready, dropping privileges
|
||||||
|
|
||||||
|
|
||||||
|
EXEC addresses:
|
||||||
|
|
||||||
|
PH_INIT retrieving info from original state
|
||||||
|
PH_EARLY before any other processing
|
||||||
|
PH_PREBIGEN before socketpair() pipe() openpty()
|
||||||
|
PH_BIGEN during socketpair() pipe() openpty()
|
||||||
|
PH_PASTBIGEN past socketpair() pipe() openpty()
|
||||||
|
PH_PASTSOCKET for socketpair()
|
||||||
|
PH_FD soon after FD creation or identification
|
||||||
|
PH_PREFORK before forking
|
||||||
|
PH_FORK during fork()
|
||||||
|
PH_PASTFORK after fork()
|
||||||
|
PH_LATE FD is ready, before start of data loop
|
||||||
|
PH_LATE2 FD is ready, dropping privileges
|
||||||
|
PH_PREEXEC before exec() or system()
|
||||||
|
PH_EXEC during exec() or system()
|
||||||
|
|
||||||
|
|
||||||
|
There are lots of semantic relations between group, phase, and func fields of
|
||||||
|
an option.
|
||||||
|
|
||||||
|
|
||||||
|
There exists something like an overall phase sequence:
|
||||||
|
PH_INIT # su-d.1
|
||||||
|
PH_EARLY # chroot-early
|
||||||
|
PH_PREOPEN, PH_OPEN, PH_PASTOPEN # (chroot before/after?)
|
||||||
|
PH_PRESOCKET, PH_SOCKET, PH_PASTSOCKET # (su after (root for raw)?)
|
||||||
|
PH_PREBIGEN, PH_BIGEN, PH_PASTBIGEN # (chroot before/after (/dev..)?)
|
||||||
|
PH_FD
|
||||||
|
PH_PREBIND, PH_BIND, PH_PASTBIND # (su after(before?))
|
||||||
|
PH_PRELISTEN, PH_LISTEN, PH_PASTLISTEN
|
||||||
|
PH_PRECONNECT, PH_CONNECT, PH_PASTCONNECT # (chroot before/after (AF_UNIX)?)
|
||||||
|
PH_PREACCEPT, PH_ACCEPT, PH_PASTACCEPT
|
||||||
|
PH_CONNECTED
|
||||||
|
PH_PREFORK, PH_FORK, PH_PASTFORK # (all before/after?)
|
||||||
|
PH_LATE # chroot
|
||||||
|
PH_LATE2 # su, su-d.2
|
||||||
|
PH_PREEXEC, PH_EXEC # (all before)
|
326
EXAMPLES
Normal file
326
EXAMPLES
Normal file
|
@ -0,0 +1,326 @@
|
||||||
|
|
||||||
|
// Examples for using socat (and filan)
|
||||||
|
|
||||||
|
|
||||||
|
//"$" means normal user, "#" requires privileges, "//" starts a comment
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// similar to netcat
|
||||||
|
|
||||||
|
// connect to 10.1.1.1 on port 80 and relay to and from stdio
|
||||||
|
$ socat - TCP:10.1.1.1:80 # similar to "netcat 10.1.1.1 80"
|
||||||
|
|
||||||
|
// listen on port 25, wait for an incoming connection, use CR+NL on this
|
||||||
|
// connection, relay data to and from stdio;
|
||||||
|
// then emulate a mailserver by hand :-)
|
||||||
|
# socat - TCP-LISTEN:25,crlf
|
||||||
|
|
||||||
|
// listen on port 25, wait for an incoming connection, use CR+NL on this
|
||||||
|
// connection, relay data to and from stdio, but have line editing and history;
|
||||||
|
// then emulate a mailserver by hand :-)
|
||||||
|
# socat readline TCP-LISTEN:25,crlf
|
||||||
|
|
||||||
|
// provide a transient history enabled front end to stupid line based
|
||||||
|
// interactive programs
|
||||||
|
$ socat readline exec:"nslookup",pty,ctty,setsid,echo=0
|
||||||
|
// same works for ftp (but password is not hidden)
|
||||||
|
|
||||||
|
// you may also use a file based history list
|
||||||
|
$ socat readline,history=.nslookup_hist exec:"nslookup",pty,ctty,setsid,echo=0
|
||||||
|
// using ~ as abbreviation for $HOME does not work!
|
||||||
|
|
||||||
|
// poor mans 'telnetd' replacement
|
||||||
|
# socat tcp-l:2023,reuseaddr,fork exec:/bin/login,pty,setsid,setpgid,stderr,ctty
|
||||||
|
// and here an appropriate client:
|
||||||
|
$ socat -,raw,echo=0 tcp:172.16.181.130:2023
|
||||||
|
// use ssl with client and server certificate for improved security;
|
||||||
|
// replace /bin/login by /bin/bash when using SSL client authentication, can be
|
||||||
|
// run without root then
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// a very primitive HTTP/1.0 echo server (problems: sends reply headers before
|
||||||
|
// request; hangs if client does not shutdown - HTTP keep-alive)
|
||||||
|
// wait for a connection on port 8000; do not wait for request, but immediately
|
||||||
|
// start a shell that sends reply headers and an empty line; then echo all
|
||||||
|
// incoming data back to client
|
||||||
|
$ socat TCP-LISTEN:8000,crlf SYSTEM:"echo HTTP/1.0 200; echo Content-Type: text/plain; echo; cat"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// for communicating with an attached modem, I had reasonable results with
|
||||||
|
// following command line. Required privileges depend on device mode.
|
||||||
|
// after leaving socat, type "sane".
|
||||||
|
// replace /dev/ttyS0 by the correct serial line or with /dev/modem
|
||||||
|
$ socat readline /dev/ttyS0,raw,echo=0,crlf
|
||||||
|
// or
|
||||||
|
$ socat readline /dev/ttyS0,raw,echo=0,crlf,nonblock
|
||||||
|
// then enter "at$"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// relay TCP port 80 from everywhere (internet, intranet, dmz) through your
|
||||||
|
// firewall to your DMZ webserver (like plug-gw)
|
||||||
|
// listen on port 80; whenever a connection is made, fork a new process (parent
|
||||||
|
// process keeps accepting connections), su to nobody, and connect to
|
||||||
|
// www.dmz.mydomain.org on port 80.
|
||||||
|
// attention: this is a substitute for a reverse proxy without providing
|
||||||
|
// application level security.
|
||||||
|
# socat TCP-LISTEN:80,reuseaddr,fork,su=nobody TCP:www.dmz.mydomain.org:80
|
||||||
|
// Note: parent process keeps running as root, su after forking
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// relay mail from your DMZ server through your firewall.
|
||||||
|
// accept connections only on dmz interface and allow connections only from
|
||||||
|
// smtp.dmz.mydomain.org.
|
||||||
|
// the advantages over plug-gw and other relays are:
|
||||||
|
// * you can bind to an IP address (even an alias), therefore enhance security
|
||||||
|
// * in your OS you can create several IP aliases and bind another socat daemon
|
||||||
|
// to each, making several application servers addressable
|
||||||
|
// * lots of options, like switching user, chroot, IP performance tuning
|
||||||
|
// * no need for inetd
|
||||||
|
# socat -lm -d -d TCP-LISTEN:25,bind=fw.dmz.mydomain.org,fork,su=nobody,range=smtp.dmz.mydomain.org/32 TCP:smtp.intra.mydomain.org:25
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// convert line terminator in ascii streams, stdin to stdout
|
||||||
|
// use unidirectional mode, convert nl to crnl
|
||||||
|
$ socat -u - -,crlf
|
||||||
|
// or cr to nl
|
||||||
|
$ socat -u -,cr -
|
||||||
|
|
||||||
|
// save piped data similar to 'tee':
|
||||||
|
// copies stdin to stdout, but writes everything to the file too
|
||||||
|
$ socat -,echo=0 open:/tmp/myfile,create,trunc,ignoreeof!!/tmp/myfile
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// intrusion testing
|
||||||
|
|
||||||
|
// found an XWindow Server behind IP filters with FTP data hole? (you are
|
||||||
|
// lucky!)
|
||||||
|
// prepare your host:
|
||||||
|
# rm -f /tmp/.X11-unix/X1
|
||||||
|
// relay a pseudo display :1 on your machine to victim:0
|
||||||
|
# socat UNIX-LISTEN:/tmp/.X11-unix/X1,fork TCP:host.victim.org:6000,sp=20 &
|
||||||
|
// and try to take a screendump (must be very lucky - when server has not even
|
||||||
|
// host based authentication!)
|
||||||
|
# xwd -root -display :1 -silent >victim.xwd
|
||||||
|
|
||||||
|
// you sit behind a socks firewall that has IP filters but lazily allows socks
|
||||||
|
// connections to loopback and has only host based X11 security.
|
||||||
|
// like above, but from your inside client:
|
||||||
|
# socat UNIX-LISTEN:/tmp/.X11-unix/X1,fork SOCKS4:firewall:loopback:6000
|
||||||
|
// or for the HTTP proxy:
|
||||||
|
# socat UNIX-LISTEN:/tmp/.X11-unix/X1,fork PROXY:firewall:loopback:6000
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// forms of stdin with stdout, all equivalent
|
||||||
|
$ socat echo -
|
||||||
|
$ socat echo STDIO
|
||||||
|
$ socat echo STDIN!!STDOUT
|
||||||
|
$ socat echo STDIO!!STDIO
|
||||||
|
$ socat echo -!!-
|
||||||
|
$ socat echo FD:0!!FD:1
|
||||||
|
$ socat echo 0!!1
|
||||||
|
$ socat echo /dev/stdin!!/dev/stdout // if your OS provides these
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// some echo address examples
|
||||||
|
$ socat - PIPE
|
||||||
|
$ socat - PIPE:/tmp/pipi // other version of echo
|
||||||
|
$ socat - PIPE:/tmp/pipi,nonblock!!/tmp/pipi // other version of echo
|
||||||
|
$ socat - EXEC:/bin/cat // another echo
|
||||||
|
$ socat - SYSTEM:/bin/cat // another echo
|
||||||
|
$ socat - TCP:loopback:7 // if inetd echo/TCP service activated
|
||||||
|
$ socat - UDP:loopback:7 // if inetd echo/UDP service activated
|
||||||
|
$ socat - /tmp/hugo,trunc,ignoreeof!!/tmp/hugo // with delay
|
||||||
|
$ socat - UDP:loopback:2000,bind=:2000 // self "connection"
|
||||||
|
$ socat - TCP:loopback:2000,bind=:2000 // Linux bug?
|
||||||
|
# socat - IP:loopback:222 // raw protocol, self "connected" (attention,
|
||||||
|
// Linux might drop packets with less than 8 bytes payload)
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// unidirectional data transfer
|
||||||
|
$ socat -u - -
|
||||||
|
// like "tail -f", but start with showing all file contents
|
||||||
|
$ socat -u FILE:/var/log/syslog.debug,ignoreeof -
|
||||||
|
// like "tail -f", but do not show existing file contents
|
||||||
|
$ socat -u FILE:/var/log/syslog.debug,ignoreeof,seek-end -
|
||||||
|
// write to new file, create with given permission and group (must be member) - race condition with group!!!
|
||||||
|
$ socat -u - CREATE:/tmp/outfile1,group=floppy,perm=0640
|
||||||
|
//
|
||||||
|
// for an existing file /tmp/outfile1
|
||||||
|
# socat -u - FILE:/tmp/outfile1,group=floppy,perm=0700,user=4321
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// file handling
|
||||||
|
$ socat - FILE:/tmp/outfile1,ignoreeof!!FILE:/tmp/outfile1,append // prints outfile1, then echoes input and protocols into file (appends to old data)
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// unix socket handling
|
||||||
|
|
||||||
|
// create a listening unix socket
|
||||||
|
$ rm -f /tmp/mysocket; socat UNIX-LISTEN:/tmp/mysocket -
|
||||||
|
// from another terminal, connect to this socket
|
||||||
|
$ socat UNIX:/tmp/mysocket -
|
||||||
|
// then transfer data bidirectionally
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// transport examples
|
||||||
|
|
||||||
|
// socks relay (externally socksify applications);
|
||||||
|
// your ssh client and OS are not socksified, but you want to pass a socks
|
||||||
|
// server with ssh:
|
||||||
|
$ socat TCP-LISTEN:10022,fork SOCKS4:socks.mydomain.org:ssh-serv:22
|
||||||
|
$ ssh -p 10022 loopback
|
||||||
|
// or better define a ProxyCommand in ~/.ssh/config:
|
||||||
|
ProxyCommand socat - SOCKS:socks.mydomain.org:%h:%p
|
||||||
|
// and with proxy:
|
||||||
|
ProxyCommand socat - PROXY:proxy.mydomain.org:%h:%p,proxyport=8000
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// application examples
|
||||||
|
|
||||||
|
// run sendmail daemon with your favorite network options
|
||||||
|
# socat TCP-LISTEN:25,fork,ip-ttl=4,ip-tos=7,tcp-maxseg=576 EXEC:"/usr/sbin/sendmail -bs",nofork
|
||||||
|
|
||||||
|
// local mail delivery over UNIX socket - no SUID program required
|
||||||
|
# socat UNIX-LISTEN:/tmp/postoffice,fork,perm-early=0666 EXEC:"/usr/sbin/sendmail -bs"
|
||||||
|
$ socat - /tmp/postoffice
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// uses of filan
|
||||||
|
// see what your operating system opens for you
|
||||||
|
$ filan
|
||||||
|
// or if that was too detailled
|
||||||
|
$ filan -s
|
||||||
|
// see what file descriptors are passed via exec function
|
||||||
|
$ socat - EXEC:filan,nofork
|
||||||
|
$ socat - EXEC:filan
|
||||||
|
$ socat - EXEC:filan,pipes,stderr
|
||||||
|
$ socat - EXEC:filan,pipes
|
||||||
|
$ socat - EXEC:filan,pty
|
||||||
|
// see what's done by your shell and with option "pipes"
|
||||||
|
$ socat - SYSTEM:filan,pipes
|
||||||
|
// see if gdb gives you an equivalent environment or opens some files for your program
|
||||||
|
$ gdb ./filan
|
||||||
|
(gdb) r
|
||||||
|
(gdb) r -s
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// want to use chat from the ppp package?
|
||||||
|
// note: some OS's do not need "-e" for echo to print control characters
|
||||||
|
// note: chat might send bytes one by one
|
||||||
|
// with AIX, a similar program is available under the name "pppdial"
|
||||||
|
$ socat -d -d system:'/usr/sbin/chat "220 " "HELO loopback" "250 " "MAIL FROM: <hugo@localhost>" "250 " "RCPT TO: root" "250 " "DATA" "354 " "test1'$(echo -e "\r.")'" "250 " "QUIT"',pty,echo=0,cr tcp:localhost:25,crlf,nodelay
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
// IP6
|
||||||
|
|
||||||
|
# socat readline TCP6:::1:21 # if your inetd/ftp is listening on ip6
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// application server solutions
|
||||||
|
// run a program (here: /bin/sh) chrooted, unprivileged;
|
||||||
|
// parent process stays in real / running as root
|
||||||
|
# socat -d -d - EXEC:/bin/sh,chroot=/home/sandbox,su=sandbox,pty
|
||||||
|
|
||||||
|
// make a program available on the network chrooted, unprivileged;
|
||||||
|
// parent process stays in / running as root
|
||||||
|
// script path is already chrooted
|
||||||
|
# ./socat -lm -d -d TCP-LISTEN:5555,fork EXEC:/bin/myscript,chroot=/home/sandbox,su=sandbox,pty,stderr
|
||||||
|
// to avoid terminal problems, you might - instead of telnet - connect using
|
||||||
|
$ socat -,icanon=0,echo=0 tcp:target:5555; reset
|
||||||
|
|
||||||
|
|
||||||
|
// access local display from ssh server, when ssh port forwarding is disabled
|
||||||
|
// socat must be installed on ssh server host
|
||||||
|
// might have to use xauth...
|
||||||
|
// this example is one-shot, because ',' cannot be passed to remote socat
|
||||||
|
xterm1$ socat -d -d exec:"ssh target ~/bin/socat -d -d unix-l:/tmp/.X11-unix/X1 -" unix:/tmp/.X11-unix/X0
|
||||||
|
xterm2$ ssh target
|
||||||
|
target$ DISPLAY=:1 myxapplication
|
||||||
|
|
||||||
|
// touch with perms:
|
||||||
|
// no race condition for perms (applied with creat() call)
|
||||||
|
$ socat -u /dev/null creat:/tmp/tempfile,perm=0600
|
||||||
|
|
||||||
|
// touch with owner and perms:
|
||||||
|
// race condition before changing owner, but who cares - only root may access
|
||||||
|
# socat -u /dev/null creat:/tmp/tempfile,user=user1,perm=0600
|
||||||
|
|
||||||
|
// invoke an interactive ssh with exec
|
||||||
|
// first example passes control chars (^C etc.) to remote server as usual
|
||||||
|
socat -,echo=0,raw exec:'ssh server',pty,setsid,ctty
|
||||||
|
// second example interprets control chars on local command line
|
||||||
|
socat -,echo=0,icanon=0 exec:'ssh server',pty,setsid,ctty
|
||||||
|
// afterwards, type "reset"!
|
||||||
|
|
||||||
|
// convince ssh to provide an "interactive" shell to your script
|
||||||
|
// three main versions for entering password:
|
||||||
|
// 1) from your TTY; have 10 seconds to enter password:
|
||||||
|
(sleep 10; echo "ls"; sleep 1) |socat - exec:'ssh server',pty
|
||||||
|
// 2) from XWindows (DISPLAY !); again 10 seconds
|
||||||
|
(sleep 10; echo "ls"; sleep 1) |socat - exec:'ssh server',pty,setsid
|
||||||
|
// 3) from script
|
||||||
|
(echo PASSWORD; echo ls; sleep 1) |./socat - exec:'ssh server',pty,setsid,ctty
|
||||||
|
|
||||||
|
|
||||||
|
// download with proxy CONNECT
|
||||||
|
// use echo -e if required for \n
|
||||||
|
$ (echo -e "CONNECT 128.129.130.131:80 HTTP/1.0\n"; sleep 5; echo -e "GET
|
||||||
|
/download/file HTTP/1.0\n"; sleep 10) |socat -d -d -t 3600 - tcp:proxy:8080,crlf
|
||||||
|
|
||||||
|
// retrieve a file from an sshd site with sourceforge style entry menu;
|
||||||
|
// fill in your personal values; cat lets you enter your password (will be
|
||||||
|
// visible on screen)
|
||||||
|
$ (sleep 10; read pass; echo $pass; sleep 10; echo M; sleep 5; echo cat FILENAME; sleep 10) |./socat -d -d -ly - EXEC:'ssh -c 3des -l USER cf.sourceforge.net',pty,setsid,ctty |tee FILENAME
|
||||||
|
|
||||||
|
// multicast community on local network: start the following command on all
|
||||||
|
// participating hosts; like a conference call:
|
||||||
|
# socat -d -d -d -d - udp-datagram:224.0.0.2:6666,bind=:6666,ip-add-membership=224.0.0.2:eth0,bindtodevice=eth0
|
||||||
|
// or
|
||||||
|
$ socat -d -d -d -d - udp-datagram:224.0.0.2:6666,bind=:6666,ip-add-membership=224.0.0.2:eth0
|
||||||
|
// possible reasons for failure:
|
||||||
|
// iptables or other filters (open your filters as required)
|
||||||
|
// packets leave via wrong interface (set route: ...)
|
||||||
|
// socket bound to specific address
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
// not tested, just ideas, or have problems
|
||||||
|
|
||||||
|
|
||||||
|
// traverse firewall for making internal telnet server accessible for outside
|
||||||
|
// telnet client, when only outbound traffic (syn-filter) is allowed:
|
||||||
|
// on external client run "double server". this process waits for a
|
||||||
|
// connection from localhost on port 10023, and, when it is established, waits
|
||||||
|
// for a connection from anywhere to port 20023:
|
||||||
|
ext$ socat -d TCP-LISTEN:10023,range=localhost TCP-LISTEN:20023
|
||||||
|
// on internal server run double client:
|
||||||
|
int$ socat -d TCP:localhost:23 TCP:extclient:10023
|
||||||
|
// or, with socks firewall:
|
||||||
|
int$ socat -d TCP:localhost:23 SOCKS:socksserver:extclient:10023
|
||||||
|
// login with:
|
||||||
|
ext$ telnet localhost 20023
|
||||||
|
|
||||||
|
// you can make a double server capable of handling multiple instances:
|
||||||
|
ext$ socat -d TCP-LISTEN:10023,range=localhost,fork TCP-LISTEN:20023,reuseaddr
|
||||||
|
|
||||||
|
// access remote display via ssh, when ssh port forwarding is disabled
|
||||||
|
$ socat -d -d EXEC:"ssh target socat - UNIX:/tmp/.X11-unix/X0" TCP-LISTEN:6030
|
||||||
|
$ xclock -display localhost:30
|
||||||
|
|
||||||
|
// relay multiple webserver addresses through your firewall into your DMZ:
|
||||||
|
// make IP aliases on your firewall, and then:
|
||||||
|
# socat -d -d TCP-L:80,bind=fw-addr1,fork TCP:dmz-www1:80
|
||||||
|
# socat -d -d TCP-L:80,bind=fw-addr2,fork TCP:dmz-www2:80
|
||||||
|
// and for improved security:
|
||||||
|
# socat -d -d TCP-L:80,bind=fw-addr3,su=nobody,fork TCP:dmz-www3:80
|
||||||
|
|
||||||
|
// pass an arbitrary IP protocol through your firewall (answers won't work)
|
||||||
|
# socat -d -d IP:0.0.0.0:150,bind=fwnonsec IP:sec-host:150,bind=fwsec
|
||||||
|
|
||||||
|
// pass an unsupported IP protocol through your firewall, point to point
|
||||||
|
// end points see firewall interfaces as IP peers!
|
||||||
|
# socat -d -d IP:nonsec-host:150,bind=fwnonsec IP:sec-host:150,bind=fwsec
|
||||||
|
// note that, for IPsec, you might face problems that are known with NAT
|
85
FAQ
Normal file
85
FAQ
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
|
||||||
|
Q: What is the clue of socat?
|
||||||
|
|
||||||
|
A: socat probably doesn't have any clue. It is more an attempt to smoothly
|
||||||
|
integrate similar I/O features that are usually handled differently under
|
||||||
|
UNIX.
|
||||||
|
|
||||||
|
|
||||||
|
Q: What does the prefix XIO mean?
|
||||||
|
|
||||||
|
A: XIO means "extended input/output". It is a library/API that provides a
|
||||||
|
common way for handling files, sockets and other forms of I/O. Its advantage is
|
||||||
|
that the application may reduce its I/O to open / read+write / close calls,
|
||||||
|
while the user controls all I/O details (and even basic process properties) by
|
||||||
|
packing options into the filename string. This is the basic part of socat.
|
||||||
|
|
||||||
|
|
||||||
|
Q: Is there a Windows port of socat available?
|
||||||
|
|
||||||
|
A: Try with Cygwin from http://www.cygwin.com/, or upgrade to Linux.
|
||||||
|
|
||||||
|
|
||||||
|
Q: I succeeded to configure and make socat, but ./test.sh says something
|
||||||
|
like:
|
||||||
|
./test.sh: No such file or directory
|
||||||
|
|
||||||
|
A: You need a bash shell, and its location must be correctly specified in the
|
||||||
|
first line of test.sh, e.g. /usr/local/bin/bash instead of /bin/bash.
|
||||||
|
|
||||||
|
|
||||||
|
Q: configure disables readline / openssl / libwrap support because it does not
|
||||||
|
find an include file / the library. How can I tell configure where these files
|
||||||
|
are?
|
||||||
|
|
||||||
|
A: For include locations, use the environment variable CPPFLAGS, for library
|
||||||
|
locations use LIBS, e.g.:
|
||||||
|
export CPPFLAGS="-I/home/user/ssl/include"
|
||||||
|
export LIBS="-L/home/user/ssl/lib"
|
||||||
|
On some systems (SunOS), you might also need to set LD_LIBRARY_PATH:
|
||||||
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/user/ssl/lib"
|
||||||
|
Then try again:
|
||||||
|
make distclean; ./configure; make
|
||||||
|
|
||||||
|
|
||||||
|
Q: I succeeded to make socat, but the test.sh script fails for many tests.
|
||||||
|
Is my socat build corrupt?
|
||||||
|
|
||||||
|
A: Probably your socat program is ok; the tests have been developed on Linux
|
||||||
|
2.4, and there they usually succeed.
|
||||||
|
But the following OS differences result in errors on non Linux systems:
|
||||||
|
* Linux allows to bind a socket to any address of range 127.0.0.0/8, not
|
||||||
|
only 127.0.0.1. Some tests are built on this feature, but they might fail on
|
||||||
|
other systems.
|
||||||
|
* Your OS might have no IP6 implementation
|
||||||
|
* MacOS X has some difficulties, e.g. distinguishing sockets and pipes.
|
||||||
|
* the OpenSSL tests require OpenSSL support by socat, must have openssl in
|
||||||
|
$PATH, and "openssl s_server ..." needs enough entropy to generate a key.
|
||||||
|
|
||||||
|
|
||||||
|
Q: When I specify a dual address (two partial addresses linked with "!!") on
|
||||||
|
the command line, I get some message "event not found", and my shell history
|
||||||
|
has the line truncated. Not even protecting the '!'s with '\' helps.
|
||||||
|
|
||||||
|
A: '!' is appearently used by your shell as history expansion character. Say
|
||||||
|
"set +H" and add this line to your (bash) profile.
|
||||||
|
|
||||||
|
|
||||||
|
Q: On Solaris, socat was built successfully, but when started, it gets killed
|
||||||
|
with something like "ld.so.1: ./socat: fatal: libreadline.so.4: open failed: no
|
||||||
|
such file or directory"
|
||||||
|
|
||||||
|
A: The configure script finds your libreadline, but the runtime loader
|
||||||
|
doesn't. Add the directory where the library resides to your LD_LIBRARY_PATH
|
||||||
|
variable, e.g.:
|
||||||
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/sfw/lib/
|
||||||
|
make distclean; ./configure; make
|
||||||
|
|
||||||
|
|
||||||
|
Q: On Solaris, socat was built successfully, but when started, an assertion
|
||||||
|
fails: "xioinitialize.c:25: failed assertion `3 << opt_crdly.arg3 == CRDLY'
|
||||||
|
|
||||||
|
A: Probably, in a second attempt you set the correct LD_LIBARY_PATH for socat,
|
||||||
|
but it had not been set during the ./configure run, or you did not "make clean"
|
||||||
|
before running configure. Try it again:
|
||||||
|
make distclean; ./configure; make
|
82
FILES
Normal file
82
FILES
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
|
||||||
|
The socat distribution contains the following files:
|
||||||
|
|
||||||
|
* README: an introduction to socat
|
||||||
|
|
||||||
|
* FILES: a navigator through the socat distribution (this file)
|
||||||
|
|
||||||
|
* EXAMPLES: a collection of simple examples how to use socat.
|
||||||
|
|
||||||
|
* COPYING: what you and others are allowed to do with socat.
|
||||||
|
|
||||||
|
* PORTING: instructions and tips if you want to try socat on a new platform.
|
||||||
|
|
||||||
|
* BUGREPORTS: instructions what to do with problems and contributions.
|
||||||
|
|
||||||
|
* SECURITY: tips if you want to use socat in a security relevant environment.
|
||||||
|
|
||||||
|
* DEVELOPMENT: infos for programmers
|
||||||
|
|
||||||
|
* VERSION: the version of the socat distribution, for inclusion during
|
||||||
|
compilation
|
||||||
|
|
||||||
|
* CHANGES: what happened since first public release
|
||||||
|
|
||||||
|
* socat.1: man page of socat
|
||||||
|
* socat.html: html version of man page
|
||||||
|
* xio.help: reference manual of the address definitions (xioopen function)
|
||||||
|
|
||||||
|
* daemon.sh: example shell script for running socat as TCP relay daemon
|
||||||
|
* ftp.sh: example shell based ftp client, using socat for transport
|
||||||
|
* mail.sh: example shell based smtp client, for execution by socat
|
||||||
|
|
||||||
|
* gatherinfo.sh: shell script for gathering info about platform and socat
|
||||||
|
implementation
|
||||||
|
|
||||||
|
* server.pem: a self signed test cerificate, for self test only
|
||||||
|
|
||||||
|
|
||||||
|
The source code system:
|
||||||
|
|
||||||
|
* configure: the autoconf generated configurator script
|
||||||
|
|
||||||
|
* Makefile.in: the Makefile source input to configure
|
||||||
|
|
||||||
|
* config.h.in: the config.h source input to configure
|
||||||
|
|
||||||
|
* Config/config.<platform>.h: sample config.h for platform.
|
||||||
|
* Config/Makefile.<platform>: sample Makefile for platform.
|
||||||
|
Copy the appropriate files to ./config.h and ./Makefile if configure fails
|
||||||
|
|
||||||
|
* socat.c: the main C source, including option parsing, general control, and
|
||||||
|
the data shuffler
|
||||||
|
|
||||||
|
* xio-*.c, xio-*.h: the source of the different address type implementations
|
||||||
|
with all their modes and options
|
||||||
|
|
||||||
|
* xio*.c, xio*.h: the source of the xio API and xio utilities
|
||||||
|
|
||||||
|
* filan.c, filan.h: file descriptor analyzer function
|
||||||
|
|
||||||
|
* dalan.c, dalan.h: data language, a most primitive subset of what should
|
||||||
|
become a language for describing/generating all kinds of binary data.
|
||||||
|
|
||||||
|
* error.c, error.h: the logging subsystem
|
||||||
|
|
||||||
|
* sycls.c, sycls.h: explicit system call and C library trace functions
|
||||||
|
* sslcls.c, sslcls.h: explicit openssl call trace functions
|
||||||
|
|
||||||
|
* xioconfig.h: ensures some dependencies between configure WITH defines; to be
|
||||||
|
included immediately after config.h
|
||||||
|
|
||||||
|
* sysutils.c, sysutils.h: some more general system (socket, IP) related
|
||||||
|
functions, e.g. converting socket addresses to human readable form
|
||||||
|
|
||||||
|
* utils.c, utils.h: useful additions to C library; currently memdup, binary
|
||||||
|
search, and setenv.
|
||||||
|
|
||||||
|
* mytypes.h: some types and macros I miss in C89
|
||||||
|
|
||||||
|
* test.sh: an incomplete attempt to automate tests of socat
|
||||||
|
|
||||||
|
* compat.h: ensure some features that might be missing on some platforms
|
177
Makefile.in
Normal file
177
Makefile.in
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
# $Id: Makefile.in,v 1.114 2007/03/06 21:52:34 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2007
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# note: @...@ forms are filled in by configure script
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
AR = @AR@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
|
BINDEST = @bindir@
|
||||||
|
|
||||||
|
MANDEST = @mandir@
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
|
||||||
|
CC = @CC@
|
||||||
|
CCOPTS = $(CCOPT) -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
SYSDEFS = @SYSDEFS@
|
||||||
|
CPPFLAGS = -I. @CPPFLAGS@
|
||||||
|
#0 INCLS = -I. @V_INCL@
|
||||||
|
DEFS = @DEFS@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
|
||||||
|
#OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
|
||||||
|
|
||||||
|
|
||||||
|
#0 CFLAGS = @CFLAGS@ $(CCOPTS) $(DEFS) $(INCLS)
|
||||||
|
CFLAGS = @CFLAGS@ $(CCOPTS) $(DEFS) $(CPPFLAGS)
|
||||||
|
CLIBS = $(LIBS)
|
||||||
|
#CLIBS = $(LIBS) -lm -lefence
|
||||||
|
XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
|
||||||
|
xiosignal.c xiosigchld.c xioread.c xiowrite.c \
|
||||||
|
xiolayer.c xioshutdown.c xioclose.c xioexit.c \
|
||||||
|
xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
|
||||||
|
xio-gopen.c xio-creat.c xio-file.c xio-named.c \
|
||||||
|
xio-socket.c xio-listen.c xio-unix.c xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c xio-socks.c xio-proxy.c xio-udp.c \
|
||||||
|
xio-rawip.c \
|
||||||
|
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
|
||||||
|
xio-pty.c xio-openssl.c \
|
||||||
|
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
|
||||||
|
XIOOBJS = $(XIOSRCS:.c=.o)
|
||||||
|
UTLSRCS = error.c dalan.c procan.c hostan.c fdname.c sysutils.c utils.c nestlex.c @FILAN@ @SYCLS@ @SSLCLS@
|
||||||
|
UTLOBJS = $(UTLSRCS:.c=.o)
|
||||||
|
CFILES = $(XIOSRCS) $(UTLSRCS) socat.c procan_main.c filan_main.c
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
PROGS = socat procan filan
|
||||||
|
|
||||||
|
HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h compat.h \
|
||||||
|
xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
|
||||||
|
xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
|
||||||
|
xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h xio-socket.h \
|
||||||
|
xio-listen.h xio-unix.h xio-rawip.h xio-ip.h xio-ip4.h xio-ip6.h \
|
||||||
|
xio-ipapp.h xio-tcp.h xio-udp.h xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
|
||||||
|
xio-system.h xio-termios.h xio-readline.h \
|
||||||
|
xio-pty.h xio-openssl.h \
|
||||||
|
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
|
||||||
|
|
||||||
|
|
||||||
|
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html
|
||||||
|
SHFILES = daemon.sh mail.sh ftp.sh readline.sh
|
||||||
|
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
|
||||||
|
proxy.sh socks4a-echo.sh testcert.conf
|
||||||
|
OSFILES = Config/Makefile.Linux-2-6-16 Config/config.Linux-2-6-16.h \
|
||||||
|
Config/Makefile.AIX-5-1 Config/config.AIX-5-1.h \
|
||||||
|
Config/Makefile.SunOS-5-8 Config/config.SunOS-5-8.h \
|
||||||
|
Config/Makefile.HP-UX-B-11-11 Config/config.HP-UX-B-11-11.h \
|
||||||
|
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \
|
||||||
|
Config/Makefile.NetBSD-2-0-2 Config/config.NetBSD-2-0-2.h \
|
||||||
|
Config/Makefile.OpenBSD-3-8 Config/config.OpenBSD-3-8.h \
|
||||||
|
Config/Makefile.Tru64-5-1B Config/config.Tru64-5-1B.h
|
||||||
|
|
||||||
|
|
||||||
|
all: progs
|
||||||
|
|
||||||
|
progs: $(PROGS)
|
||||||
|
|
||||||
|
depend: $(CFILES) $(HFILES)
|
||||||
|
makedepend $(SYSDEFS) $(CFILES)
|
||||||
|
|
||||||
|
socat: socat.o libxio.a
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ socat.o libxio.a $(CLIBS)
|
||||||
|
|
||||||
|
PROCAN_OBJS=procan_main.o procan.o hostan.o error.o sycls.o sysutils.o utils.o
|
||||||
|
procan: $(PROCAN_OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PROCAN_OBJS) $(CLIBS)
|
||||||
|
|
||||||
|
filan: filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o $(CLIBS)
|
||||||
|
|
||||||
|
libxio.a: $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(AR) r $@ $(XIOOBJS) $(UTLOBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
doc: doc/xio.help
|
||||||
|
#
|
||||||
|
|
||||||
|
strip: progs
|
||||||
|
strip $(PROGS)
|
||||||
|
|
||||||
|
install: progs doc/socat.1
|
||||||
|
mkdir -p $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
|
||||||
|
$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
|
||||||
|
mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||||
|
$(INSTALL) -m 644 doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/socat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/procat
|
||||||
|
rm -f $(DESTDIR)$(BINDEST)/filan
|
||||||
|
rm -f $(DESTDIR)$(MANDEST)/man1/socat.1
|
||||||
|
|
||||||
|
# make a GNU-zipped tar ball of the source files
|
||||||
|
dist: socat.tar.gz socat.tar.bz2
|
||||||
|
|
||||||
|
socat.tar.gz: socat.tar
|
||||||
|
gzip -9 <socat.tar >socat.tar.gz
|
||||||
|
|
||||||
|
socat.tar.bz2: socat.tar
|
||||||
|
bzip2 -9 <socat.tar >socat.tar.bz2
|
||||||
|
|
||||||
|
VERSION = `sed 's/"//g' VERSION`
|
||||||
|
TARDIR = socat-$(VERSION)
|
||||||
|
socat.tar: configure.in configure Makefile.in config.h.in install-sh VERSION $(CFILES) $(HFILES) $(DOCFILES) $(SHFILES) $(OSFILES) $(TESTFILES) socat.spec
|
||||||
|
if [ ! -d $(TARDIR) ]; then mkdir $(TARDIR); fi
|
||||||
|
tar cf - $+ |(cd $(TARDIR); tar xf -)
|
||||||
|
tar cvf socat.tar $(TARDIR)
|
||||||
|
rm -f $(TARDIR)/COPYING # write protected
|
||||||
|
rm -r $(TARDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libxio.a socat procan filan \
|
||||||
|
socat.tar socat.tar.Z socat.tar.gz socat.tar.bz2 \
|
||||||
|
socat.out compile.log test.log
|
||||||
|
|
||||||
|
# remove all files that are generated from the original socat distribution
|
||||||
|
# note that Makefile is also removed, so you have to start with ./configure
|
||||||
|
# again
|
||||||
|
distclean: clean
|
||||||
|
rm -f config.status config.cache config.log config.h Makefile
|
||||||
|
rm -rf autom4te.cache
|
||||||
|
|
||||||
|
info: socat
|
||||||
|
uname -a >socat.out
|
||||||
|
./socat -V >>socat.out
|
||||||
|
./socat -hh >>socat.out
|
||||||
|
|
||||||
|
# perform some tests on socat
|
||||||
|
test: progs
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
cert:
|
||||||
|
# prepare critical files with correct permissions to avoid race cond
|
||||||
|
>cert.key
|
||||||
|
>cert.pem
|
||||||
|
chmod 600 cert.key cert.pem
|
||||||
|
# generate a private key
|
||||||
|
openssl genrsa -out cert.key 1024
|
||||||
|
# generate a self signed cert
|
||||||
|
openssl req -new -key cert.key -x509 -days 3653 -out cert.crt
|
||||||
|
# ...enter fields
|
||||||
|
# generate the pem file
|
||||||
|
cat cert.key cert.crt >cert.pem
|
||||||
|
#echo use cert.pem on requestors side, i.e. with option cert=cert.pem
|
||||||
|
#echo use cert.crt on checkers side, i.e. with option cafile=cert.crt
|
72
PORTING
Normal file
72
PORTING
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
|
||||||
|
DEVELOPMENT PLATFORMS
|
||||||
|
|
||||||
|
Primary development platform for socat is currently SuSE Linux 8.2 with
|
||||||
|
a 2.4.20 kernel. New features are then ported to the non-Linux platforms on the
|
||||||
|
Sourceforge compile farm (per July 2003: SunOS 5.8 with gcc, and MacOS X 10.2),
|
||||||
|
and AIX 5.1 with gcc. But due to limited time resources and restricted
|
||||||
|
(non-root) access to these systems I cannot extensively test socat there.
|
||||||
|
|
||||||
|
|
||||||
|
PORTING STEPS
|
||||||
|
|
||||||
|
If you want to port socat to another operating system you will typically go
|
||||||
|
through two phases: First, you might just try to compile and run the actual
|
||||||
|
socat distribution (passive phase). Then, you should see if your platform
|
||||||
|
has some nice features that are not yet used in socat, and add code for
|
||||||
|
supporting them (active phase). At last, I encourage you to send me your
|
||||||
|
changes so I can integrate them into the main socat distribution.
|
||||||
|
|
||||||
|
|
||||||
|
PASSIVE PHASE:
|
||||||
|
|
||||||
|
* Generate Makefile and config.h:
|
||||||
|
. If you have gcc, then just invoke "./configure".
|
||||||
|
. If you use another C compiler, configure might not work properly;
|
||||||
|
You will have to adapt config.h and Makefile manually.
|
||||||
|
Change compiler options or defines to use all features of the operating
|
||||||
|
system (not only ANSI-C; e.g. HP-UX: -Ae!)
|
||||||
|
Some practical config.<platform>.h examples have been included in the
|
||||||
|
Config directory of the source that might serve as starting point.
|
||||||
|
|
||||||
|
* Try to "make" socat; correct the errors. If some constants are undefined,
|
||||||
|
please disable these parts option-dependent, not platform-dependent (use
|
||||||
|
#ifdef TCP_OPTION instead of #if MY_OS)
|
||||||
|
|
||||||
|
* If you have big troubles compiling socat then try configure with options
|
||||||
|
--disable-filan --disable-sycls; this excludes some of the most system
|
||||||
|
dependent parts.
|
||||||
|
|
||||||
|
* After successful compilation and linking, run "make test" and try some
|
||||||
|
examples.
|
||||||
|
|
||||||
|
|
||||||
|
ACTIVE PHASE:
|
||||||
|
|
||||||
|
* Check the man pages of your operating system for open(2), fcntl(2),
|
||||||
|
setsockopt(2), ioctl(2), socket(7), ip(7), tcp(7), termios etc. and the
|
||||||
|
include files where you find the definitions of existing options, for new
|
||||||
|
options and implement them - again option-dependent.
|
||||||
|
Places to add code for the new options:
|
||||||
|
. xioopts.h: enum e_optcode (sorted numerically/alphabetically by name)
|
||||||
|
. xio-*.c: select the appropriate address file (e.g., xio-tcp.c for
|
||||||
|
TCP-options) and make a record of type struct optdesc: opt_newoption
|
||||||
|
. xio-*.h: the declation of struct optdesc
|
||||||
|
. xioopts.c: add records to struct optname optionnames for all appropriate
|
||||||
|
names (sorted strictly ASCII for binary search)
|
||||||
|
. filan.c: add the option to the appropriate array (sockopts, ipopts,
|
||||||
|
tcpopts)
|
||||||
|
. socat.html, socat.1, xio.help: write a short documentation and tell which
|
||||||
|
platform and version implements this option
|
||||||
|
|
||||||
|
* problems may occur especially:
|
||||||
|
. with 16 or 64 bit systems
|
||||||
|
. if snprintf() etc. is missing
|
||||||
|
. on UNIX emulations, e.g. Cygwin
|
||||||
|
|
||||||
|
|
||||||
|
INTEGRATION
|
||||||
|
|
||||||
|
* If you ported socat to another platform:
|
||||||
|
To let other people participate please send the modified files or a patch
|
||||||
|
file and the files generated by ./gatherinfo.sh to socat@dest-unreach.org.
|
272
README
Normal file
272
README
Normal file
|
@ -0,0 +1,272 @@
|
||||||
|
|
||||||
|
about
|
||||||
|
-----
|
||||||
|
|
||||||
|
socat is a relay for bidirectional data transfer between two independent data
|
||||||
|
channels. Each of these data channels may be a file, pipe, device (serial line
|
||||||
|
etc. or a pseudo terminal), a socket (UNIX, IP4, IP6 - raw, UDP, TCP), an
|
||||||
|
SSL socket, proxy CONNECT connection, a file descriptor (stdin etc.), the GNU
|
||||||
|
line editor (readline), a program, or a combination of two of these.
|
||||||
|
These modes include generation of "listening" sockets, named pipes, and pseudo
|
||||||
|
terminals.
|
||||||
|
|
||||||
|
socat can be used, e.g., as TCP port forwarder (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 to a serial line, to
|
||||||
|
logically connect serial lines on different computers, or to establish a
|
||||||
|
relatively secure environment (su and chroot) for running client or server
|
||||||
|
shell scripts with network connections.
|
||||||
|
|
||||||
|
Many options are available to refine socats behaviour:
|
||||||
|
terminal parameters, open() options, file permissions, file and process owners,
|
||||||
|
basic socket options like bind address, advanced socket options like IP source
|
||||||
|
routing, linger, TTL, TOS (type of service), or TCP performance tuning.
|
||||||
|
|
||||||
|
More capabilities, like daemon mode with forking, client address check,
|
||||||
|
"tail -f" mode, some stream data processing (line terminator conversion),
|
||||||
|
choosing sockets, pipes, or ptys for interprocess communication, debug and
|
||||||
|
trace options, logging to syslog, stderr or file, and last but not least
|
||||||
|
precise error messages make it a versatile tool for many different purposes.
|
||||||
|
|
||||||
|
In fact, many of these features already exist in specialized tools; but until
|
||||||
|
now, there does not seem to exists another tool that provides such a generic,
|
||||||
|
flexible, simple and almost comprehensive (UNIX) byte stream connector.
|
||||||
|
|
||||||
|
|
||||||
|
packages
|
||||||
|
--------
|
||||||
|
|
||||||
|
before bothering with compilers, dependencies and include files, you might
|
||||||
|
try to get a binary distribution that matches your platform. Have a look at
|
||||||
|
the projects home page for actual information regarding socat binary
|
||||||
|
distributions.
|
||||||
|
|
||||||
|
|
||||||
|
platforms
|
||||||
|
---------
|
||||||
|
|
||||||
|
socat 1.6.0 was compiled and more or less successfully tested under the
|
||||||
|
following operating systems:
|
||||||
|
|
||||||
|
SuSE Linux 10.1 on x86
|
||||||
|
AIX 5.2 on PPC with gcc
|
||||||
|
Solaris 9 on Sparc with gcc
|
||||||
|
FreeBSD 6.1 on x86
|
||||||
|
HP-UX B 11.11 on PA-RISC with gcc
|
||||||
|
|
||||||
|
tests on Tru64 can no longer be performed because HP testdrive has taken down
|
||||||
|
these hosts.
|
||||||
|
|
||||||
|
tests on Mac OS X can no longer be performed because the Sourceforge
|
||||||
|
compilefarm was discontinued.
|
||||||
|
|
||||||
|
tests on NetBSD and OpenBSD can no longer be performed for the above reasons.
|
||||||
|
|
||||||
|
Some versions of socat have been reported to successfully compile under older
|
||||||
|
Linux versions back to RedHat 2.1 (kernel 1.2.13, gcc 2.7.0), under AIX 4.1 and
|
||||||
|
4.3, SunOS 5.7-5.8, FreeBSD 4.2 - 4.9, MacOS X 10.1, Cygwin, Solaris 8 on x86,
|
||||||
|
OSR 5.0.6, NetBSD 1.6.1 and 2.0.2, OpenBSD 3.4 and 3.8, Tru64 5.1B, and Mac OS
|
||||||
|
X 10.1-10.2.
|
||||||
|
|
||||||
|
It might well compile and run under other UNIX like operating systems.
|
||||||
|
|
||||||
|
|
||||||
|
install
|
||||||
|
-------
|
||||||
|
|
||||||
|
Get the tarball and extract it:
|
||||||
|
gtar xzf socat.tar.gz
|
||||||
|
cd socat-1.6.0.0
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
su
|
||||||
|
make install # installs socat, filan, and procan in /usr/local/bin
|
||||||
|
|
||||||
|
For compiling socat, gcc (or egc) is recommended.
|
||||||
|
If gcc is not available, the configure script will fail to determine
|
||||||
|
some features; then you'd better begin with one of the Makefiles and config.h's
|
||||||
|
from the Config directory.
|
||||||
|
|
||||||
|
If you have problems with the OpenSSL library, you can apply the option
|
||||||
|
"--disable-openssl" to configure.
|
||||||
|
|
||||||
|
If you have problems with the readline library or (n)curses, you can apply the
|
||||||
|
option "--disable-readline" to configure.
|
||||||
|
|
||||||
|
If you have problems with the tcp wrappers library, you can apply the option
|
||||||
|
"--disable-libwrap" to configure.
|
||||||
|
|
||||||
|
If you still get errors or a tremendous amount of warnings you can exclude
|
||||||
|
the features for system call tracing and file descriptor analyzing by
|
||||||
|
applying the options "--disable-sycls --disable-filan" to configure.
|
||||||
|
|
||||||
|
You still need the functions vsnprintf and snprintf that are in the GNU libc,
|
||||||
|
but might not be available with some proprietary libc's.
|
||||||
|
|
||||||
|
The configure script looks for headers and libraries of openssl, readline, and
|
||||||
|
tcp wrappers in the OS'es standard places and in the subdirectories include/
|
||||||
|
and lib/ of the following places:
|
||||||
|
/sw/
|
||||||
|
/usr/local/
|
||||||
|
/opt/freeware/
|
||||||
|
/usr/sfw/
|
||||||
|
and for openssl also in:
|
||||||
|
/usr/local/ssl/
|
||||||
|
In case of unexpected behaviour it is important to understand that configure
|
||||||
|
first searches for the appropriate include file and then expects to find the
|
||||||
|
library in the associated lib directory. That means, when e.g. a OpenSSL
|
||||||
|
installation resides under /usr/local and there is a symbolic link from
|
||||||
|
/usr/include/ssl/ssl.h to /usr/local/ssl/include/ssl/ssl.h, configure will find
|
||||||
|
the /usr/include/... header and will therefore expect libssl in /usr/lib
|
||||||
|
instead of /usr/local/...
|
||||||
|
|
||||||
|
If configure does not find a header file or library but you know where it is,
|
||||||
|
you can specify additional search locations, e.g.:
|
||||||
|
export LIBS="-L$HOME/lib"
|
||||||
|
export CPPFLAGS="-I$HOME/include"
|
||||||
|
before running configure and make.
|
||||||
|
|
||||||
|
For other operating systems, if socat does not compile without errors, refer to
|
||||||
|
the file PORTING.
|
||||||
|
|
||||||
|
|
||||||
|
platform specifics - redhat
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
On RedHat Linux 9.0, including openssl/ssl.h might fail due to problems with
|
||||||
|
the krb5-devel package. configure reacts with disabling openssl integration.
|
||||||
|
To solve this issue, help cpp to find the krb5.h include file:
|
||||||
|
CPPFLAGS="-I/usr/kerberos/include" ./configure
|
||||||
|
|
||||||
|
|
||||||
|
platform specifics - aix
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
The flock() prototype is not available but the function is. Thus, to enable the
|
||||||
|
socat flock options, run configure and then change in config.h the line
|
||||||
|
/* #undef HAVE_FLOCK */
|
||||||
|
to
|
||||||
|
#define HAVE_FLOCK 1
|
||||||
|
and continue the build process.
|
||||||
|
|
||||||
|
When using the OpenSSL rpm provided by IBM, configure might need the
|
||||||
|
environment variable setting:
|
||||||
|
LIBS="-L/opt/freeware/lib"
|
||||||
|
|
||||||
|
When using the OpenSSL bundle provided by IBM, egd needs to be installed too
|
||||||
|
to get enough entropy.
|
||||||
|
|
||||||
|
socat compiles not only with gcc, but also with xlc. Just adapt the Makefile:
|
||||||
|
replace gcc by /usr/vac/bin/xlc and remove gcc specific options
|
||||||
|
"-Wall -Wno-parentheses".
|
||||||
|
|
||||||
|
When linking with the OpenSSL library provided by IBM, errors may occur:
|
||||||
|
ld: 0711-317 ERROR: Undefined symbol: .__umoddi3
|
||||||
|
In this case, you need to link with libgcc or compile libcrypt yourself using
|
||||||
|
xlc, or disable SSL (in config.h, undefine WITH_OPENSSL and recompile)
|
||||||
|
|
||||||
|
The score of test.sh can be improved by uncommenting MISCDELAY=1 in this
|
||||||
|
script.
|
||||||
|
|
||||||
|
|
||||||
|
platform specifics - solaris
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
If libreadline or libssl are in a directory not searched by the loader per
|
||||||
|
default, e.g. /opt/sfw/lib, you must add this directory to $LD_LIBRARY_PATH,
|
||||||
|
for running both configure and the socat executables, e.g.:
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/sfw/lib
|
||||||
|
|
||||||
|
For some shell scripts, it is preferable to have /usr/xpg4/bin at a prominent
|
||||||
|
position in $PATH.
|
||||||
|
|
||||||
|
|
||||||
|
platform specifics - hp-ux
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
Shutting down the write channel of a UNIX domain socket does not seem to
|
||||||
|
trigger an EOF on the other socket. This makes problems with the exec and
|
||||||
|
system addresses.
|
||||||
|
|
||||||
|
This OS provides the type "long long", but not the strtoll() function to read
|
||||||
|
data into a long long variable.
|
||||||
|
|
||||||
|
UNIX domain sockets are only supported with SOCK_STREAM, not with datagrams
|
||||||
|
(see man 7 unix).
|
||||||
|
|
||||||
|
With UDP sockets it seems to happen that the select() call reports available
|
||||||
|
data (or EOF) but a subsequent read() call hangs.
|
||||||
|
|
||||||
|
|
||||||
|
platform specifics - tru64
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
When the use of the readline address fails with an error like:
|
||||||
|
socat: /sbin/loader: Fatal Error: Reference to unresolvable symbol "tgetent" in ".../libreadline.so.4"
|
||||||
|
and you still want to use shared libraries, try the following workaround:
|
||||||
|
$ make distclean; LIBS="-static" ./configure
|
||||||
|
remove the "-static" occurrence in Makefile
|
||||||
|
$ make
|
||||||
|
|
||||||
|
|
||||||
|
documentation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
These files reside in the doc subdirectory:
|
||||||
|
|
||||||
|
socat.1 is the man page, socat.html is the HTML based man page. It is actual,
|
||||||
|
but describes only the more useful options.
|
||||||
|
|
||||||
|
xio.help is an older, but more exact description in text form; with socat
|
||||||
|
version 1.6.0 it is outdated.
|
||||||
|
|
||||||
|
doc/socat-openssltunnel.html is a simple tutorial for a private SSL connection.
|
||||||
|
doc/socat-multicast.html is a short tutorial for multicast and broadcast
|
||||||
|
communications.
|
||||||
|
doc/socat-tun shows how to build a virtual network between two hosts.
|
||||||
|
|
||||||
|
|
||||||
|
license
|
||||||
|
-------
|
||||||
|
|
||||||
|
socat is distributed under the terms of the GNU GPL;
|
||||||
|
except for install-sh, which is copyright MIT, with its own license;
|
||||||
|
|
||||||
|
In addition, as a special exception, the copyright holder
|
||||||
|
gives permission to link the code of this program with
|
||||||
|
any version of the OpenSSL library which is distributed
|
||||||
|
under a license identical to that listed in the included
|
||||||
|
COPYING.OpenSSL file, and distribute linked combinations
|
||||||
|
including the two. You must obey the GNU General Public
|
||||||
|
License in all respects for all of the code used other
|
||||||
|
than OpenSSL. If you modify this file, you may extend this
|
||||||
|
exception to your version of the file, but you are not
|
||||||
|
obligated to do so. If you do not wish to do so, delete
|
||||||
|
this exception statement from your version.
|
||||||
|
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, version 2 of the License
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
|
||||||
|
contact
|
||||||
|
-------
|
||||||
|
|
||||||
|
For questions, bug reports, ideas, contributions etc. please contact
|
||||||
|
socat@dest-unreach.org
|
||||||
|
|
||||||
|
For socat source distribution, bug fixes, and latest news see
|
||||||
|
http://www.dest-unreach.org/socat/
|
||||||
|
|
||||||
|
www.socat.org is an alternate site providing the same contents.
|
||||||
|
|
67
README.FIPS
Normal file
67
README.FIPS
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
|
||||||
|
David Acker has patched socat to add OpenSSL FIPS.
|
||||||
|
See http://oss-institute.org/fips-faq.html and
|
||||||
|
http://linuxdevices.com/news/NS4742716157.html for more information.
|
||||||
|
|
||||||
|
The patch that is integrated into socat 1.5 does the following:
|
||||||
|
|
||||||
|
Add support for LDFLAGS in Makefile. LDFLAGS can be specified on the
|
||||||
|
configure command line and then will be carried over into the make.
|
||||||
|
|
||||||
|
Add fips support. Requires OpenSSL 0.9.7j-fips-dev from
|
||||||
|
http://www.openssl.org/source/OpenSSL-fips-1.0.tar.gz built with fips
|
||||||
|
support turned on. use ./Configure fips [os-arc], for example
|
||||||
|
./Configure fips linux-pentium
|
||||||
|
|
||||||
|
The LDFLAGS is needed to point a build against a library
|
||||||
|
located in a non-standard location. For example, if you download and
|
||||||
|
build openssl manually, it gets installed in /usr/local/ssl by default.
|
||||||
|
|
||||||
|
The FIPS support patches involve adding an option to enable/disable fips
|
||||||
|
in configure (enabled by default), checking the system for FIPS support
|
||||||
|
during configure, and then adding a fips option to socats openssl address
|
||||||
|
to turn on fips mode. The openssl binary uses an environment variable
|
||||||
|
instead of a command line flag.
|
||||||
|
FIPS mode requires both a compile time flag of OPENSSL_FIPS and a
|
||||||
|
runtime call of FIPS_mode_set(1). Fips mode requires building with the
|
||||||
|
fipsld script provided by OpenSSL. FIPS tracks the pid of the process that
|
||||||
|
initializes things so after a fork, the child must reinitialize. When the
|
||||||
|
ssl code detects a forks occur and if FIPS mode was enabled, it reinitializes
|
||||||
|
FIPS by disabling and then enabling it again.
|
||||||
|
|
||||||
|
To produce Davids enviroment, do the following:
|
||||||
|
To build openssl
|
||||||
|
download OpenSSL 0.9.7j-fips-dev from
|
||||||
|
http://www.openssl.org/source/OpenSSL-fips-1.0.tar.gz
|
||||||
|
tar xzf OpenSSL-fips-1.0.tar.gz
|
||||||
|
cd openssl
|
||||||
|
./Configure fips linux-pentium
|
||||||
|
make
|
||||||
|
make test
|
||||||
|
(become root)
|
||||||
|
make install
|
||||||
|
This leaves an install in /usr/local/ssl
|
||||||
|
|
||||||
|
To build socat:
|
||||||
|
setup directory with socat 1.5 or higher.
|
||||||
|
cd socat-1.5.0.0
|
||||||
|
./configure CPPFLAGS=-I/usr/local/ssl/include/ LDFLAGS=-L/usr/local/ssl/lib/ FIPSLD=/usr/local/ssl/bin/fipsld
|
||||||
|
make
|
||||||
|
(become root)
|
||||||
|
make install
|
||||||
|
|
||||||
|
To run tests we make sure the new openssl is used:
|
||||||
|
|
||||||
|
export PATH=/usr/local/ssl/bin:$PATH
|
||||||
|
./test.sh fips
|
||||||
|
|
||||||
|
There are two tests in test.sh that depend on fips:
|
||||||
|
|
||||||
|
OPENSSL_FIPS_BOTHAUTH performs a SSL client to server connection with
|
||||||
|
certificate based authentication in both directions. If it works FIPS mode
|
||||||
|
seems to be ok.
|
||||||
|
|
||||||
|
OPENSSL_FIPS_SECURITY generates a certificaet/key pair without fips support. It
|
||||||
|
then tries a SSL connection in "normal" mode which is expected to work. In the
|
||||||
|
second phase it uses fips mode with these credentials which is expected to
|
||||||
|
fail. If so, the test succeeded.
|
41
SECURITY
Normal file
41
SECURITY
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
|
||||||
|
Tips for using socat in secured environments:
|
||||||
|
|
||||||
|
* Configure socat to only enable the required features, e.g. to protect your
|
||||||
|
filesystem from any accesses through socat:
|
||||||
|
make distclean
|
||||||
|
./configure --disable-file --disable-creat --disable-gopen \
|
||||||
|
--disable-pipe --disable-unix --disable-exec --disable-system
|
||||||
|
use "socat -V" to see what features are still enabled; see
|
||||||
|
./configure --help for more options to disable
|
||||||
|
|
||||||
|
* Do NOT install socat SUID root or so when you have untrusted users or
|
||||||
|
unprivileged daemons on your machine, because the full install of socat can
|
||||||
|
override arbitrary files and execute arbitrary programs!
|
||||||
|
|
||||||
|
* Set logging to "-d -d" (in special cases even higher)
|
||||||
|
|
||||||
|
* With files, protect against symlink attacks with nofollow (Linux), and
|
||||||
|
avoid accessing files in world-writable directories like /tmp
|
||||||
|
|
||||||
|
* When listening, use bind option (except UNIX domain sockets)
|
||||||
|
|
||||||
|
* When listening, use range option (currently only for IP4 sockets)
|
||||||
|
|
||||||
|
* When using socat with system, exec, or in a shell script, know what you do
|
||||||
|
|
||||||
|
* With system and exec, use absolute pathes or set the path option
|
||||||
|
|
||||||
|
* When starting programs with socat, consider using the chroot option (this
|
||||||
|
requires root, so use the substuser option too).
|
||||||
|
|
||||||
|
* Start socat as root only if required; if so, use substuser option
|
||||||
|
Note: starting a SUID program after applying substuser or setuid gives the
|
||||||
|
process the SUID owner, which might give root privileges again.
|
||||||
|
|
||||||
|
* Socat, like netcat, is what intruders like to have on their victims machine:
|
||||||
|
once they have gained a toehold they try to establish a versatile connection
|
||||||
|
back to their attack base, and they want to attack other systems. For both
|
||||||
|
purposes, socat could be helpful. Therefore, it might be useful to install
|
||||||
|
socat with owner/permissions root:socatgrp/750, and to make all trusted users
|
||||||
|
members of group socatgrp.
|
1
VERSION
Normal file
1
VERSION
Normal file
|
@ -0,0 +1 @@
|
||||||
|
"1.6.0.0"
|
640
compat.h
Normal file
640
compat.h
Normal file
|
@ -0,0 +1,640 @@
|
||||||
|
/* $Id: compat.h,v 1.32 2006/06/19 20:28:52 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __compat_h_included
|
||||||
|
#define __compat_h_included 1
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* I dont like this system dependent part, but it would be quit a challenge for
|
||||||
|
configure */
|
||||||
|
|
||||||
|
/* define if the following does not work:
|
||||||
|
socket()
|
||||||
|
connect() -> Connection refused
|
||||||
|
connect() -> ok
|
||||||
|
instead, it needs close() and socket() between the two connect() attmpts: */
|
||||||
|
#if __FreeBSD__ || __APPLE__ || _AIX || __hpux__ || __osf__
|
||||||
|
# undef SOCKET_CAN_RECOVER
|
||||||
|
#else
|
||||||
|
# define SOCKET_CAN_RECOVER 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* define if stat() says that pipes are sockets */
|
||||||
|
#if __APPLE__
|
||||||
|
# define PIPE_STATES_SOCKET 1
|
||||||
|
#else
|
||||||
|
# undef PIPE_STATES_SOCKET
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/* substitute some features that might be missing on some platforms */
|
||||||
|
|
||||||
|
#ifndef SHUT_RD
|
||||||
|
# define SHUT_RD 0
|
||||||
|
#endif
|
||||||
|
#ifndef SHUT_WR
|
||||||
|
# define SHUT_WR 1
|
||||||
|
#endif
|
||||||
|
#ifndef SHUT_RDWR
|
||||||
|
# define SHUT_RDWR 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
# define MIN(x,y) ((x)<=(y)?(x):(y))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX
|
||||||
|
# define MAX(x,y) ((x)>=(y)?(x):(y))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* O_ASYNC: Linux 2.2.10 */
|
||||||
|
#if !defined(O_ASYNC) && defined(FASYNC)
|
||||||
|
# define O_ASYNC FASYNC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* NGROUPS not defined on Solaris */
|
||||||
|
#if !defined(NGROUPS) && defined(NGROUPS_MAX)
|
||||||
|
# define NGROUPS NGROUPS_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* UNIX_PATH_MAX: AIX 4.3.3 */
|
||||||
|
#ifndef UNIX_PATH_MAX
|
||||||
|
# define UNIX_PATH_MAX 104 /*! why 104? Linux: 108 ! */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* SOL_IP: AIX 4.3.3 */
|
||||||
|
#ifndef SOL_IP
|
||||||
|
# define SOL_IP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* SOL_TCP: AIX 4.3.3 */
|
||||||
|
#ifndef SOL_TCP
|
||||||
|
# define SOL_TCP IPPROTO_TCP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* POSIX.1 doesn't seem to know sockets */
|
||||||
|
#ifndef S_ISSOCK
|
||||||
|
# define S_ISSOCK(fmode) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(IPPROTO_IPV6) && !defined(SOL_IPV6)
|
||||||
|
# define SOL_IPV6 IPPROTO_IPV6
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* all unsigned */
|
||||||
|
#if !defined(HAVE_BASIC_SIZE_T) || !HAVE_BASIC_SIZE_T
|
||||||
|
# undef HAVE_BASIC_SIZE_T
|
||||||
|
# define HAVE_BASIC_SIZE_T 6
|
||||||
|
#endif
|
||||||
|
#if HAVE_BASIC_SIZE_T==2
|
||||||
|
# define SIZET_MAX USHRT_MAX
|
||||||
|
# define SSIZET_MIN SHRT_MIN
|
||||||
|
# define SSIZET_MAX SHRT_MAX
|
||||||
|
# define F_Zd "%hd"
|
||||||
|
# define F_Zu "%hu"
|
||||||
|
#elif HAVE_BASIC_SIZE_T==4
|
||||||
|
# define SIZET_MAX UINT_MAX
|
||||||
|
# define SSIZET_MIN INT_MIN
|
||||||
|
# define SSIZET_MAX INT_MAX
|
||||||
|
# define F_Zd "%d"
|
||||||
|
# define F_Zu "%u"
|
||||||
|
#elif HAVE_BASIC_SIZE_T==6
|
||||||
|
# define SIZET_MAX ULONG_MAX
|
||||||
|
# define SSIZET_MIN LONG_MIN
|
||||||
|
# define SSIZET_MAX LONG_MAX
|
||||||
|
# define F_Zd "%ld"
|
||||||
|
# define F_Zu "%lu"
|
||||||
|
#elif HAVE_BASIC_SIZE_T==8
|
||||||
|
# define SIZET_MAX ULLONG_MAX
|
||||||
|
# define SSIZET_MIN LLONG_MIN
|
||||||
|
# define SSIZET_MAX LLONG_MAX
|
||||||
|
# define F_Zd "%Ld"
|
||||||
|
# define F_Zu "%Lu"
|
||||||
|
#else
|
||||||
|
# error "HAVE_BASIC_SIZE_T is out of range:" HAVE_BASIC_SIZE_T
|
||||||
|
#endif
|
||||||
|
#if HAVE_FORMAT_Z
|
||||||
|
# undef F_Zd
|
||||||
|
# undef F_Zu
|
||||||
|
# define F_Zd "%Zd"
|
||||||
|
# define F_Zu "%Zu"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* mode_t is always unsigned; default: unsigned int */
|
||||||
|
#if !defined(HAVE_BASIC_MODE_T) || !HAVE_BASIC_MODE_T
|
||||||
|
# undef HAVE_BASIC_MODE_T
|
||||||
|
# define HAVE_BASIC_MODE_T 4
|
||||||
|
#endif
|
||||||
|
#ifndef F_mode
|
||||||
|
# if HAVE_BASIC_MODE_T==1 || HAVE_BASIC_MODE_T==2
|
||||||
|
#define F_mode "0%03ho"
|
||||||
|
# elif HAVE_BASIC_MODE_T==3 || HAVE_BASIC_MODE_T==4
|
||||||
|
#define F_mode "0%03o"
|
||||||
|
# elif HAVE_BASIC_MODE_T==5 || HAVE_BASIC_MODE_T==6
|
||||||
|
#define F_mode "0%03lo"
|
||||||
|
# else
|
||||||
|
#error "HAVE_BASIC_MODE_T is out of range:" HAVE_BASIC_MODE_T
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* default: unsigned int */
|
||||||
|
#if !defined(HAVE_BASIC_PID_T) || !HAVE_BASIC_PID_T
|
||||||
|
# undef HAVE_BASIC_PID_T
|
||||||
|
# define HAVE_BASIC_PID_T 4
|
||||||
|
#endif
|
||||||
|
#ifndef F_pid
|
||||||
|
# if HAVE_BASIC_PID_T==1
|
||||||
|
#define F_pid "%hd"
|
||||||
|
# elif HAVE_BASIC_PID_T==2
|
||||||
|
#define F_pid "%hu"
|
||||||
|
# elif HAVE_BASIC_PID_T==3
|
||||||
|
#define F_pid "%d"
|
||||||
|
# elif HAVE_BASIC_PID_T==4
|
||||||
|
#define F_pid "%u"
|
||||||
|
# elif HAVE_BASIC_PID_T==5
|
||||||
|
#define F_pid "%ld"
|
||||||
|
# elif HAVE_BASIC_PID_T==6
|
||||||
|
#define F_pid "%lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_BASIC_PID_T is out of range:" HAVE_BASIC_PID_T
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* default: unsigned int */
|
||||||
|
#if !defined(HAVE_BASIC_UID_T) || !HAVE_BASIC_UID_T
|
||||||
|
# undef HAVE_BASIC_UID_T
|
||||||
|
# define HAVE_BASIC_UID_T 4
|
||||||
|
#endif
|
||||||
|
#ifndef F_uid
|
||||||
|
# if HAVE_BASIC_UID_T==1
|
||||||
|
#define F_uid "%hd"
|
||||||
|
# elif HAVE_BASIC_UID_T==2
|
||||||
|
#define F_uid "%hu"
|
||||||
|
# elif HAVE_BASIC_UID_T==3
|
||||||
|
#define F_uid "%d"
|
||||||
|
# elif HAVE_BASIC_UID_T==4
|
||||||
|
#define F_uid "%u"
|
||||||
|
# elif HAVE_BASIC_UID_T==5
|
||||||
|
#define F_uid "%ld"
|
||||||
|
# elif HAVE_BASIC_UID_T==6
|
||||||
|
#define F_uid "%lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_BASIC_UID_T is out of range:" HAVE_BASIC_UID_T
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* default: unsigned int */
|
||||||
|
#if !defined(HAVE_BASIC_GID_T) || !HAVE_BASIC_GID_T
|
||||||
|
# undef HAVE_BASIC_GID_T
|
||||||
|
# define HAVE_BASIC_GID_T 4
|
||||||
|
#endif
|
||||||
|
#ifndef F_gid
|
||||||
|
# if HAVE_BASIC_GID_T==1
|
||||||
|
#define F_gid "%hd"
|
||||||
|
# elif HAVE_BASIC_GID_T==2
|
||||||
|
#define F_gid "%hu"
|
||||||
|
# elif HAVE_BASIC_GID_T==3
|
||||||
|
#define F_gid "%d"
|
||||||
|
# elif HAVE_BASIC_GID_T==4
|
||||||
|
#define F_gid "%u"
|
||||||
|
# elif HAVE_BASIC_GID_T==5
|
||||||
|
#define F_gid "%ld"
|
||||||
|
# elif HAVE_BASIC_GID_T==6
|
||||||
|
#define F_gid "%lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_BASIC_GID_T is out of range:" HAVE_BASIC_GID_T
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* all signed; default: long */
|
||||||
|
#if !defined(HAVE_BASIC_TIME_T) || !HAVE_BASIC_TIME_T
|
||||||
|
# undef HAVE_BASIC_TIME_T
|
||||||
|
# define HAVE_BASIC_TIME_T 5
|
||||||
|
#endif
|
||||||
|
#ifndef F_time
|
||||||
|
# if HAVE_BASIC_TIME_T==1
|
||||||
|
#define F_time "%hd"
|
||||||
|
# elif HAVE_BASIC_TIME_T==2
|
||||||
|
#define F_time "%hu"
|
||||||
|
# elif HAVE_BASIC_TIME_T==3
|
||||||
|
#define F_time "%d"
|
||||||
|
# elif HAVE_BASIC_TIME_T==4
|
||||||
|
#define F_time "%u"
|
||||||
|
# elif HAVE_BASIC_TIME_T==5
|
||||||
|
#define F_time "%ld"
|
||||||
|
# elif HAVE_BASIC_TIME_T==6
|
||||||
|
#define F_time "%lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_BASIC_TIME_T is out of range:" HAVE_BASIC_TIME_T
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* default: int */
|
||||||
|
#if !defined(HAVE_BASIC_SOCKLEN_T) || !HAVE_BASIC_SOCKLEN_T
|
||||||
|
# undef HAVE_BASIC_SOCKLEN_T
|
||||||
|
# define HAVE_BASIC_SOCKLEN_T 3
|
||||||
|
#endif
|
||||||
|
#ifndef F_socklen
|
||||||
|
# if HAVE_BASIC_SOCKLEN_T==1
|
||||||
|
#define F_socklen "%hd"
|
||||||
|
# elif HAVE_BASIC_SOCKLEN_T==2
|
||||||
|
#define F_socklen "%hu"
|
||||||
|
# elif HAVE_BASIC_SOCKLEN_T==3
|
||||||
|
#define F_socklen "%d"
|
||||||
|
# elif HAVE_BASIC_SOCKLEN_T==4
|
||||||
|
#define F_socklen "%u"
|
||||||
|
# elif HAVE_BASIC_SOCKLEN_T==5
|
||||||
|
#define F_socklen "%ld"
|
||||||
|
# elif HAVE_BASIC_SOCKLEN_T==6
|
||||||
|
#define F_socklen "%lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_BASIC_SOCKLEN_T is out of range:" HAVE_BASIC_SOCKLEN_T
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* might be checked in later versions */
|
||||||
|
#ifndef F_off
|
||||||
|
#define F_off "%ld"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* default: long long */
|
||||||
|
#if !defined(HAVE_BASIC_OFF64_T) || !HAVE_BASIC_OFF64_T
|
||||||
|
# undef HAVE_BASIC_OFF64_T
|
||||||
|
# define HAVE_BASIC_OFF64_T 7
|
||||||
|
#endif
|
||||||
|
#ifndef F_off64
|
||||||
|
# if HAVE_BASIC_OFF64_T==1
|
||||||
|
#define F_off64 "%hd"
|
||||||
|
# elif HAVE_BASIC_OFF64_T==2
|
||||||
|
#define F_off64 "%hu"
|
||||||
|
# elif HAVE_BASIC_OFF64_T==3
|
||||||
|
#define F_off64 "%d"
|
||||||
|
# elif HAVE_BASIC_OFF64_T==4
|
||||||
|
#define F_off64 "%u"
|
||||||
|
# elif HAVE_BASIC_OFF64_T==5
|
||||||
|
#define F_off64 "%ld"
|
||||||
|
# elif HAVE_BASIC_OFF64_T==6
|
||||||
|
#define F_off64 "%lu"
|
||||||
|
# elif HAVE_BASIC_OFF64_T==7
|
||||||
|
#define F_off64 "%Ld"
|
||||||
|
# elif HAVE_BASIC_OFF64_T==8
|
||||||
|
#define F_off64 "%Lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_BASIC_OFF64_T is out of range:" HAVE_BASIC_OFF64_T
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* all unsigned; default: unsigned long */
|
||||||
|
#if !defined(HAVE_TYPEOF_ST_DEV) || !HAVE_TYPEOF_ST_DEV
|
||||||
|
# undef HAVE_TYPEOF_ST_DEV
|
||||||
|
# define HAVE_TYPEOF_ST_DEV 6
|
||||||
|
#endif
|
||||||
|
#ifndef F_st_dev
|
||||||
|
# if HAVE_TYPEOF_ST_DEV==1
|
||||||
|
#define F_st_dev "%hd"
|
||||||
|
# elif HAVE_TYPEOF_ST_DEV==2
|
||||||
|
#define F_st_dev "%hu"
|
||||||
|
# elif HAVE_TYPEOF_ST_DEV==3
|
||||||
|
#define F_st_dev "%d"
|
||||||
|
# elif HAVE_TYPEOF_ST_DEV==4
|
||||||
|
#define F_st_dev "%u"
|
||||||
|
# elif HAVE_TYPEOF_ST_DEV==5
|
||||||
|
#define F_st_dev "%ld"
|
||||||
|
# elif HAVE_TYPEOF_ST_DEV==6
|
||||||
|
#define F_st_dev "%lu"
|
||||||
|
# elif HAVE_TYPEOF_ST_DEV==7
|
||||||
|
#define F_st_dev "%Ld"
|
||||||
|
# elif HAVE_TYPEOF_ST_DEV==8
|
||||||
|
#define F_st_dev "%Lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_ST_DEV is out of range:" HAVE_TYPEOF_ST_DEV
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* all unsigned; default; unsigned long */
|
||||||
|
#if !defined(HAVE_TYPEOF_ST_INO) || !HAVE_TYPEOF_ST_INO
|
||||||
|
# undef HAVE_TYPEOF_ST_INO
|
||||||
|
# define HAVE_TYPEOF_ST_INO 6
|
||||||
|
#endif
|
||||||
|
#ifndef F_st_ino
|
||||||
|
# if HAVE_TYPEOF_ST_INO==1
|
||||||
|
#define F_st_ino "%hd"
|
||||||
|
# elif HAVE_TYPEOF_ST_INO==2
|
||||||
|
#define F_st_ino "%hu"
|
||||||
|
# elif HAVE_TYPEOF_ST_INO==3
|
||||||
|
#define F_st_ino "%d"
|
||||||
|
# elif HAVE_TYPEOF_ST_INO==4
|
||||||
|
#define F_st_ino "%u"
|
||||||
|
# elif HAVE_TYPEOF_ST_INO==5
|
||||||
|
#define F_st_ino "%ld"
|
||||||
|
# elif HAVE_TYPEOF_ST_INO==6
|
||||||
|
#define F_st_ino "%lu"
|
||||||
|
# elif HAVE_TYPEOF_ST_INO==7 /* Cygwin 1.5 */
|
||||||
|
#define F_st_ino "%Ld"
|
||||||
|
# elif HAVE_TYPEOF_ST_INO==8
|
||||||
|
#define F_st_ino "%Lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_ST_INO is out of range:" HAVE_TYPEOF_ST_INO
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* all unsigned; default; unsigned long long */
|
||||||
|
#if !defined(HAVE_TYPEOF_ST64_INO) || !HAVE_TYPEOF_ST64_INO
|
||||||
|
# undef HAVE_TYPEOF_ST64_INO
|
||||||
|
# define HAVE_TYPEOF_ST64_INO 8
|
||||||
|
#endif
|
||||||
|
#ifndef F_st64_ino
|
||||||
|
# if HAVE_TYPEOF_ST64_INO==1
|
||||||
|
#define F_st64_ino "%hd"
|
||||||
|
# elif HAVE_TYPEOF_ST64_INO==2
|
||||||
|
#define F_st64_ino "%hu"
|
||||||
|
# elif HAVE_TYPEOF_ST64_INO==3
|
||||||
|
#define F_st64_ino "%d"
|
||||||
|
# elif HAVE_TYPEOF_ST64_INO==4
|
||||||
|
#define F_st64_ino "%u"
|
||||||
|
# elif HAVE_TYPEOF_ST64_INO==5
|
||||||
|
#define F_st64_ino "%ld"
|
||||||
|
# elif HAVE_TYPEOF_ST64_INO==6
|
||||||
|
#define F_st64_ino "%lu"
|
||||||
|
# elif HAVE_TYPEOF_ST64_INO==7
|
||||||
|
#define F_st64_ino "%Ld"
|
||||||
|
# elif HAVE_TYPEOF_ST64_INO==8
|
||||||
|
#define F_st64_ino "%Lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_ST64_INO is out of range:" HAVE_TYPEOF_ST64_INO
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* default: unsigned short */
|
||||||
|
#if !defined(HAVE_TYPEOF_ST_NLINK) || !HAVE_TYPEOF_ST_NLINK
|
||||||
|
# undef HAVE_TYPEOF_ST_NLINK
|
||||||
|
# define HAVE_TYPEOF_ST_NLINK 2
|
||||||
|
#endif
|
||||||
|
#ifndef F_st_nlink
|
||||||
|
# if HAVE_TYPEOF_ST_NLINK==1
|
||||||
|
#define F_st_nlink "%hd"
|
||||||
|
# elif HAVE_TYPEOF_ST_NLINK==2
|
||||||
|
#define F_st_nlink "%hu"
|
||||||
|
# elif HAVE_TYPEOF_ST_NLINK==3
|
||||||
|
#define F_st_nlink "%d"
|
||||||
|
# elif HAVE_TYPEOF_ST_NLINK==4
|
||||||
|
#define F_st_nlink "%u"
|
||||||
|
# elif HAVE_TYPEOF_ST_NLINK==5
|
||||||
|
#define F_st_nlink "%ld"
|
||||||
|
# elif HAVE_TYPEOF_ST_NLINK==6
|
||||||
|
#define F_st_nlink "%lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_ST_NLINK is out of range:" HAVE_TYPEOF_ST_NLINK
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* all signed; default: long */
|
||||||
|
#if !defined(HAVE_TYPEOF_ST_SIZE) || !HAVE_TYPEOF_ST_SIZE
|
||||||
|
# undef HAVE_TYPEOF_ST_SIZE
|
||||||
|
# define HAVE_TYPEOF_ST_SIZE 5
|
||||||
|
#endif
|
||||||
|
#ifndef F_st_size
|
||||||
|
# if HAVE_TYPEOF_ST_SIZE==1
|
||||||
|
#define F_st_size "%hd"
|
||||||
|
# elif HAVE_TYPEOF_ST_SIZE==2
|
||||||
|
#define F_st_size "%hu"
|
||||||
|
# elif HAVE_TYPEOF_ST_SIZE==3
|
||||||
|
#define F_st_size "%d"
|
||||||
|
# elif HAVE_TYPEOF_ST_SIZE==4
|
||||||
|
#define F_st_size "%u"
|
||||||
|
# elif HAVE_TYPEOF_ST_SIZE==5
|
||||||
|
#define F_st_size "%ld"
|
||||||
|
# elif HAVE_TYPEOF_ST_SIZE==6
|
||||||
|
#define F_st_size "%lu"
|
||||||
|
# elif HAVE_TYPEOF_ST_SIZE==7
|
||||||
|
#define F_st_size "%Ld"
|
||||||
|
# elif HAVE_TYPEOF_ST_SIZE==8
|
||||||
|
#define F_st_size "%Lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_ST_SIZE is out of range:" HAVE_TYPEOF_ST_SIZE
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* all signed; default: long long */
|
||||||
|
#if !defined(HAVE_TYPEOF_ST64_SIZE) || !HAVE_TYPEOF_ST64_SIZE
|
||||||
|
# undef HAVE_TYPEOF_ST64_SIZE
|
||||||
|
# define HAVE_TYPEOF_ST64_SIZE 7
|
||||||
|
#endif
|
||||||
|
#ifndef F_st64_size
|
||||||
|
# if HAVE_TYPEOF_ST64_SIZE==1
|
||||||
|
#define F_st64_size "%hd"
|
||||||
|
# elif HAVE_TYPEOF_ST64_SIZE==2
|
||||||
|
#define F_st64_size "%hu"
|
||||||
|
# elif HAVE_TYPEOF_ST64_SIZE==3
|
||||||
|
#define F_st64_size "%d"
|
||||||
|
# elif HAVE_TYPEOF_ST64_SIZE==4
|
||||||
|
#define F_st64_size "%u"
|
||||||
|
# elif HAVE_TYPEOF_ST64_SIZE==5
|
||||||
|
#define F_st64_size "%ld"
|
||||||
|
# elif HAVE_TYPEOF_ST64_SIZE==6
|
||||||
|
#define F_st64_size "%lu"
|
||||||
|
# elif HAVE_TYPEOF_ST64_SIZE==7
|
||||||
|
#define F_st64_size "%Ld"
|
||||||
|
# elif HAVE_TYPEOF_ST64_SIZE==8
|
||||||
|
#define F_st64_size "%Lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_ST64_SIZE is out of range:" HAVE_TYPEOF_ST64_SIZE
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* very different results; default: long */
|
||||||
|
#if !defined(HAVE_TYPEOF_ST_BLKSIZE) || !HAVE_TYPEOF_ST_BLKSIZE
|
||||||
|
# undef HAVE_TYPEOF_ST_BLKSIZE
|
||||||
|
# define HAVE_TYPEOF_ST_BLKSIZE 5
|
||||||
|
#endif
|
||||||
|
#ifndef F_st_blksize
|
||||||
|
# if HAVE_TYPEOF_ST_BLKSIZE==1
|
||||||
|
#define F_st_blksize "%hd"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLKSIZE==2
|
||||||
|
#define F_st_blksize "%hu"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLKSIZE==3
|
||||||
|
#define F_st_blksize "%d"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLKSIZE==4
|
||||||
|
#define F_st_blksize "%u"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLKSIZE==5
|
||||||
|
#define F_st_blksize "%ld"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLKSIZE==6
|
||||||
|
#define F_st_blksize "%lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_ST_BLKSIZE is out of range:" HAVE_TYPEOF_ST_BLKSIZE
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* default: long */
|
||||||
|
#if !defined(HAVE_TYPEOF_ST_BLOCKS) || !HAVE_TYPEOF_ST_BLOCKS
|
||||||
|
# undef HAVE_TYPEOF_ST_BLOCKS
|
||||||
|
# define HAVE_TYPEOF_ST_BLOCKS 5
|
||||||
|
#endif
|
||||||
|
#ifndef F_st_blocks
|
||||||
|
# if HAVE_TYPEOF_ST_BLOCKS==1
|
||||||
|
#define F_st_blocks "%hd"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLOCKS==2
|
||||||
|
#define F_st_blocks "%hu"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLOCKS==3
|
||||||
|
#define F_st_blocks "%d"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLOCKS==4
|
||||||
|
#define F_st_blocks "%u"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLOCKS==5
|
||||||
|
#define F_st_blocks "%ld"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLOCKS==6
|
||||||
|
#define F_st_blocks "%lu"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLOCKS==7
|
||||||
|
#define F_st_blocks "%Ld"
|
||||||
|
# elif HAVE_TYPEOF_ST_BLOCKS==8
|
||||||
|
#define F_st_blocks "%Lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_ST_BLOCKS is out of range:" HAVE_TYPEOF_ST_BLOCKS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* default: long long */
|
||||||
|
#if !defined(HAVE_TYPEOF_ST64_BLOCKS) || !HAVE_TYPEOF_ST64_BLOCKS
|
||||||
|
# undef HAVE_TYPEOF_ST64_BLOCKS
|
||||||
|
# define HAVE_TYPEOF_ST64_BLOCKS 7
|
||||||
|
#endif
|
||||||
|
#ifndef F_st64_blocks
|
||||||
|
# if HAVE_TYPEOF_ST64_BLOCKS==1
|
||||||
|
#define F_st64_blocks "%hd"
|
||||||
|
# elif HAVE_TYPEOF_ST64_BLOCKS==2
|
||||||
|
#define F_st64_blocks "%hu"
|
||||||
|
# elif HAVE_TYPEOF_ST64_BLOCKS==3
|
||||||
|
#define F_st64_blocks "%d"
|
||||||
|
# elif HAVE_TYPEOF_ST64_BLOCKS==4
|
||||||
|
#define F_st64_blocks "%u"
|
||||||
|
# elif HAVE_TYPEOF_ST64_BLOCKS==5
|
||||||
|
#define F_st64_blocks "%ld"
|
||||||
|
# elif HAVE_TYPEOF_ST64_BLOCKS==6
|
||||||
|
#define F_st64_blocks "%lu"
|
||||||
|
# elif HAVE_TYPEOF_ST64_BLOCKS==7
|
||||||
|
#define F_st64_blocks "%Ld"
|
||||||
|
# elif HAVE_TYPEOF_ST64_BLOCKS==8
|
||||||
|
#define F_st64_blocks "%Lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_ST64_BLOCKS is out of range:" HAVE_TYPEOF_ST64_BLOCKS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* at least for Linux */
|
||||||
|
#define F_tv_sec "%ld"
|
||||||
|
|
||||||
|
/* default: long */
|
||||||
|
#if !defined(HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC) || !HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC
|
||||||
|
# undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC
|
||||||
|
# define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 5
|
||||||
|
#endif
|
||||||
|
#ifndef F_tv_usec
|
||||||
|
# if HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==1
|
||||||
|
#define F_tv_usec "%06hd"
|
||||||
|
# elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==2
|
||||||
|
#define F_tv_usec "%06hu"
|
||||||
|
# elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==3
|
||||||
|
#define F_tv_usec "%06d"
|
||||||
|
# elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==4
|
||||||
|
#define F_tv_usec "%06u"
|
||||||
|
# elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==5
|
||||||
|
#define F_tv_usec "%06ld"
|
||||||
|
# elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==6
|
||||||
|
#define F_tv_usec "%06lu"
|
||||||
|
# elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==7
|
||||||
|
#define F_tv_usec "%06Ld"
|
||||||
|
# elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==8
|
||||||
|
#define F_tv_usec "%06Lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC is out of range:" HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* default: long */
|
||||||
|
#if !defined(HAVE_TYPEOF_RLIM_MAX) || !HAVE_TYPEOF_RLIM_MAX
|
||||||
|
# undef HAVE_TYPEOF_RLIM_MAX
|
||||||
|
# define HAVE_TYPEOF_RLIM_MAX 5
|
||||||
|
#endif
|
||||||
|
#ifndef F_rlim_max
|
||||||
|
# if HAVE_TYPEOF_RLIM_MAX==1
|
||||||
|
#define F_rlim_max "hd"
|
||||||
|
# elif HAVE_TYPEOF_RLIM_MAX==2
|
||||||
|
#define F_rlim_max "hu"
|
||||||
|
# elif HAVE_TYPEOF_RLIM_MAX==3
|
||||||
|
#define F_rlim_max "d"
|
||||||
|
# elif HAVE_TYPEOF_RLIM_MAX==4
|
||||||
|
#define F_rlim_max "u"
|
||||||
|
# elif HAVE_TYPEOF_RLIM_MAX==5
|
||||||
|
#define F_rlim_max "ld"
|
||||||
|
# elif HAVE_TYPEOF_RLIM_MAX==6
|
||||||
|
#define F_rlim_max "lu"
|
||||||
|
# elif HAVE_TYPEOF_RLIM_MAX==7
|
||||||
|
#define F_rlim_max "Ld"
|
||||||
|
# elif HAVE_TYPEOF_RLIM_MAX==8
|
||||||
|
#define F_rlim_max "Lu"
|
||||||
|
# else
|
||||||
|
#error "HAVE_TYPEOF_RLIM_MAX is out of range:" HAVE_TYPEOF_RLIM_MAX
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Cygwin 1.3.22 has the prototypes, but not the type... */
|
||||||
|
#ifndef HAVE_TYPE_STAT64
|
||||||
|
# undef HAVE_STAT64
|
||||||
|
# undef HAVE_FSTAT64
|
||||||
|
# undef HAVE_LSTAT64
|
||||||
|
#endif
|
||||||
|
#ifndef HAVE_TYPE_OFF64
|
||||||
|
# undef HAVE_LSEEK64
|
||||||
|
# undef HAVE_FTRUNCATE64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(NETDB_INTERNAL) && defined(h_NETDB_INTERNAL)
|
||||||
|
# define NETDB_INTERNAL h_NETDB_INTERNAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !HAVE_PROTOTYPE_HSTRERROR
|
||||||
|
/* with MacOSX this is char * */
|
||||||
|
extern const char *hstrerror(int);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* here are the declarations of compat.c */
|
||||||
|
|
||||||
|
#if !HAVE_SIGACTION
|
||||||
|
struct sigaction {
|
||||||
|
void (*sa_handler)(int);
|
||||||
|
void (*sa_sigaction)(int, siginfo_t *, void *);
|
||||||
|
sigset_t sa_mask;
|
||||||
|
int sa_flags;
|
||||||
|
} ;
|
||||||
|
struct siginfo {
|
||||||
|
int si_signo;
|
||||||
|
int si_errno;
|
||||||
|
int si_code;
|
||||||
|
pid_t si_pid;
|
||||||
|
uid_t si_uid;
|
||||||
|
int si_status;
|
||||||
|
/*clock_t si_utime;*/
|
||||||
|
/*clock_t si_stime;*/
|
||||||
|
sigval_t si_value;
|
||||||
|
int si_int;
|
||||||
|
void *si_ptr;
|
||||||
|
void *si_addr;
|
||||||
|
/*int si_band;*/
|
||||||
|
/*int si_fd;*/
|
||||||
|
} ;
|
||||||
|
extern int sigaction(int signum, const struct sigaction *act,
|
||||||
|
struct sigaction *oldact);
|
||||||
|
#endif /* !HAVE_SIGACTION */
|
||||||
|
|
||||||
|
#endif /* !defined(__compat_h_included) */
|
484
config.h.in
Normal file
484
config.h.in
Normal file
|
@ -0,0 +1,484 @@
|
||||||
|
/* $Id: config.h.in,v 1.63 2007/03/06 21:00:16 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __config_h_included
|
||||||
|
#define __config_h_included 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
#undef const
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef gid_t
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blksize. */
|
||||||
|
#undef HAVE_ST_BLKSIZE
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_blocks. */
|
||||||
|
#undef HAVE_ST_BLOCKS
|
||||||
|
|
||||||
|
/* Define if your struct stat has st_rdev. */
|
||||||
|
#undef HAVE_ST_RDEV
|
||||||
|
|
||||||
|
/* Define if you have the strftime function. */
|
||||||
|
#undef HAVE_STRFTIME
|
||||||
|
|
||||||
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
#undef HAVE_SYS_WAIT_H
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef mode_t
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
|
#undef off_t
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef pid_t
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#undef RETSIGTYPE
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
#undef size_t
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
#undef TIME_WITH_SYS_TIME
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||||
|
#undef uid_t
|
||||||
|
|
||||||
|
/* Define if you have the putenv function. */
|
||||||
|
#undef HAVE_PUTENV
|
||||||
|
|
||||||
|
/* Define if you have the select function. */
|
||||||
|
#undef HAVE_SELECT
|
||||||
|
|
||||||
|
/* Define if you have the poll function. */
|
||||||
|
#undef HAVE_POLL
|
||||||
|
|
||||||
|
/* Define if you have the socket function. */
|
||||||
|
#undef HAVE_SOCKET
|
||||||
|
|
||||||
|
/* Define if you have the strdup function. */
|
||||||
|
#undef HAVE_STRDUP
|
||||||
|
|
||||||
|
/* Define if you have the strerror function. */
|
||||||
|
#undef HAVE_STRERROR
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#undef HAVE_STRSTR
|
||||||
|
|
||||||
|
/* Define if you have the strtod function. */
|
||||||
|
#undef HAVE_STRTOD
|
||||||
|
|
||||||
|
/* Define if you have the strtol function. */
|
||||||
|
#undef HAVE_STRTOL
|
||||||
|
|
||||||
|
/* Define if you have the strtoul function. */
|
||||||
|
#undef HAVE_STRTOUL
|
||||||
|
|
||||||
|
/* Define if you have the uname function. */
|
||||||
|
#undef HAVE_UNAME
|
||||||
|
|
||||||
|
/* Define if you have the getpgid function. */
|
||||||
|
#undef HAVE_GETPGID
|
||||||
|
|
||||||
|
/* Define if you have the getsid function. */
|
||||||
|
#undef HAVE_GETSID
|
||||||
|
|
||||||
|
/* Define if you have the nanosleep function. */
|
||||||
|
#undef HAVE_NANOSLEEP
|
||||||
|
|
||||||
|
/* Define if you have the getaddrinfo function. */
|
||||||
|
#undef HAVE_GETADDRINFO
|
||||||
|
|
||||||
|
/* Define if you have the getipnodebyname function. */
|
||||||
|
#undef HAVE_GETIPNODEBYNAME
|
||||||
|
|
||||||
|
/* Define if you have the setgroups function. */
|
||||||
|
#undef HAVE_SETGROUPS
|
||||||
|
|
||||||
|
/* Define if you have the inet_aton function. */
|
||||||
|
#undef HAVE_INET_ATON
|
||||||
|
|
||||||
|
/* Define if you have the memrchr function. */
|
||||||
|
#undef HAVE_MEMRCHR
|
||||||
|
|
||||||
|
/* Define if you have the sigaction function */
|
||||||
|
#undef HAVE_SIGACTION
|
||||||
|
|
||||||
|
/* Define if you have the stat64 function */
|
||||||
|
#undef HAVE_STAT64
|
||||||
|
|
||||||
|
/* Define if you have the fstat64 function */
|
||||||
|
#undef HAVE_FSTAT64
|
||||||
|
|
||||||
|
/* Define if you have the lstat64 function */
|
||||||
|
#undef HAVE_LSTAT64
|
||||||
|
|
||||||
|
/* Define if you have the lseek64 function */
|
||||||
|
#undef HAVE_LSEEK64
|
||||||
|
|
||||||
|
/* Define if you have the truncate64 function */
|
||||||
|
#undef HAVE_TRUNCATE64
|
||||||
|
|
||||||
|
/* Define if you have the ftruncate64 function */
|
||||||
|
#undef HAVE_FTRUNCATE64
|
||||||
|
|
||||||
|
/* Define if you have the strtoll function */
|
||||||
|
#undef HAVE_STRTOLL
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function */
|
||||||
|
#undef HAVE_HSTRERROR
|
||||||
|
|
||||||
|
/* Define if you have the inet_ntop function */
|
||||||
|
#undef HAVE_INET_NTOP
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror prototype */
|
||||||
|
#undef HAVE_PROTOTYPE_HSTRERROR
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#undef HAVE_FCNTL_H
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#undef HAVE_LIMITS_H
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#undef HAVE_STRINGS_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#undef HAVE_SYS_PARAM_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/ioctl.h> header file. */
|
||||||
|
#undef HAVE_SYS_IOCTL_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
#undef HAVE_SYS_TIME_H
|
||||||
|
|
||||||
|
/* Define if you have the <syslog.h> header file. */
|
||||||
|
#undef HAVE_SYSLOG_H
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define if you have the <pwd.h> header file. */
|
||||||
|
#undef HAVE_PWD_H
|
||||||
|
|
||||||
|
/* Define if you have the <grp.h> header file. */
|
||||||
|
#undef HAVE_GRP_H
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/poll.h> header file. */
|
||||||
|
#undef HAVE_SYS_POLL_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/socket.h> header file. */
|
||||||
|
#undef HAVE_SYS_SOCKET_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/uio.h> header file. */
|
||||||
|
#undef HAVE_SYS_UIO_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
/* Define if you have the <netdb.h> header file. */
|
||||||
|
#undef HAVE_NETDB_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/un.h> header file. */
|
||||||
|
#undef HAVE_SYS_UN_H
|
||||||
|
|
||||||
|
/* Define if you have the <pty.h> header file. */
|
||||||
|
#undef HAVE_PTY_H
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in.h> header file. */
|
||||||
|
#undef HAVE_NETINET_IN_H
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/in_systm.h> header file. */
|
||||||
|
#undef HAVE_NETINET_IN_SYSTM_H
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip.h> header file. */
|
||||||
|
#undef HAVE_NETINET_IP_H
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/tcp.h> header file. */
|
||||||
|
#undef HAVE_NETINET_TCP_H
|
||||||
|
|
||||||
|
/* Define if you have the <netinet/ip6.h> header file. */
|
||||||
|
#undef HAVE_NETINET_IP6_H
|
||||||
|
|
||||||
|
/* Define if you have the <arpa/nameser.h> header file. */
|
||||||
|
#undef HAVE_ARPA_NAMESER_H
|
||||||
|
|
||||||
|
/* Define if you have the <resolv.h> header file. */
|
||||||
|
#undef HAVE_RESOLV_H
|
||||||
|
|
||||||
|
/* Define if you have the <termios.h> header file. */
|
||||||
|
#undef HAVE_TERMIOS_H
|
||||||
|
|
||||||
|
/* Define if you have the <net/if.h> header file. */
|
||||||
|
#undef HAVE_NET_IF_H
|
||||||
|
|
||||||
|
/* Define if you have the <linux/if_tun.h> header file. */
|
||||||
|
#undef HAVE_LINUX_IF_TUN_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utsname.h> header file. */
|
||||||
|
#undef HAVE_SYS_UTSNAME_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/select.h> header file. (AIX) */
|
||||||
|
#undef HAVE_SYS_SELECT_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/file.h> header file. (AIX) */
|
||||||
|
#undef HAVE_SYS_FILE_H
|
||||||
|
|
||||||
|
/* Define if you have the <util.h> header file. (NetBSD, OpenBSD: openpty()) */
|
||||||
|
#undef HAVE_UTIL_H
|
||||||
|
|
||||||
|
/* Define if you have the <libutil.h> header file. (FreeBSD: openpty()) */
|
||||||
|
#undef HAVE_LIBUTIL_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stropts.h> header file. (stream opts on SunOS)*/
|
||||||
|
#undef HAVE_SYS_STROPTS_H
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
|
#undef HAVE_REGEX_H
|
||||||
|
|
||||||
|
/* Define if you have the <linux/fs.h> header file. */
|
||||||
|
#undef HAVE_LINUX_FS_H
|
||||||
|
|
||||||
|
/* Define if you have the <linux/ext2_fs.h> header file. */
|
||||||
|
#undef HAVE_LINUX_EXT2_FS_H
|
||||||
|
|
||||||
|
/* Define if you have the <readline/readline.h> header file. */
|
||||||
|
#undef HAVE_READLINE_READLINE_H
|
||||||
|
|
||||||
|
/* Define if you have the <readline/history.h> header file. */
|
||||||
|
#undef HAVE_READLINE_HISTORY_H
|
||||||
|
|
||||||
|
/* Define if you have the readline library. */
|
||||||
|
#undef HAVE_LIBREADLINE
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
#undef HAVE_LIBM
|
||||||
|
|
||||||
|
/* Define if you have the floor function */
|
||||||
|
#undef HAVE_FLOOR
|
||||||
|
|
||||||
|
/* some platforms need _XOPEN_EXTENDED_SOURCE to get syslog headers (AIX4.1) */
|
||||||
|
#undef _XOPEN_EXTENDED_SOURCE
|
||||||
|
|
||||||
|
/* fdset may have component fds_bits or __fds_bits */
|
||||||
|
#undef HAVE_FDS_BITS
|
||||||
|
|
||||||
|
/* Define if your struct termios has component c_ispeed */
|
||||||
|
#undef HAVE_TERMIOS_ISPEED
|
||||||
|
|
||||||
|
/* the offset of c_ispeed in struct termios - usable in an speed_t array.
|
||||||
|
Applies only when HAVE_TERMIOS_ISPEED is set */
|
||||||
|
#undef ISPEED_OFFSET
|
||||||
|
|
||||||
|
/* the offset of c_ospeed in struct termios - see ISPEED_OFFSET */
|
||||||
|
#ifdef ISPEED_OFFSET
|
||||||
|
# define OSPEED_OFFSET (ISPEED_OFFSET+1)
|
||||||
|
#else
|
||||||
|
# undef OSPEED_OFFSET
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define if your termios.h likes _SVID3 defined */
|
||||||
|
#undef _SVID3
|
||||||
|
|
||||||
|
/* Define if you have struct timespec (e.g. for nanosleep) */
|
||||||
|
#undef HAVE_STRUCT_TIMESPEC
|
||||||
|
|
||||||
|
/* Define if you have struct linger */
|
||||||
|
#undef HAVE_STRUCT_LINGER
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreq */
|
||||||
|
#undef HAVE_STRUCT_IP_MREQ
|
||||||
|
|
||||||
|
/* Define if you have struct ip_mreqn */
|
||||||
|
#undef HAVE_STRUCT_IP_MREQN
|
||||||
|
|
||||||
|
/* Define if you have struct ipv6_mreq */
|
||||||
|
#undef HAVE_STRUCT_IPV6_MREQ
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq */
|
||||||
|
#undef HAVE_STRUCT_IFREQ
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_index */
|
||||||
|
#undef HAVE_STRUCT_IFREQ_IFR_INDEX
|
||||||
|
|
||||||
|
/* Define if you have struct ifreq.ifr_ifindex */
|
||||||
|
#undef HAVE_STRUCT_IFREQ_IFR_IFINDEX
|
||||||
|
|
||||||
|
/* Define if your struct sockaddr has sa_len */
|
||||||
|
#undef HAVE_STRUCT_SOCKADDR_SALEN
|
||||||
|
|
||||||
|
/* there are several implementations of sockaddr_in6 */
|
||||||
|
#undef HAVE_IP6_SOCKADDR
|
||||||
|
|
||||||
|
/* Define if you have struct iovec */
|
||||||
|
#undef HAVE_STRUCT_IOVEC
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_control */
|
||||||
|
#undef HAVE_STRUCT_MSGHDR_MSGCONTROL
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_controllen */
|
||||||
|
#undef HAVE_STRUCT_MSGHDR_MSGCONTROLLEN
|
||||||
|
|
||||||
|
/* define if your struct msghdr has msg_flag */
|
||||||
|
#undef HAVE_STRUCT_MSGHDR_MSGFLAGS
|
||||||
|
|
||||||
|
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */
|
||||||
|
#undef HAVE_STRUCT_IP_IP_HL
|
||||||
|
|
||||||
|
/* Define if you have the setenv function */
|
||||||
|
#undef HAVE_SETENV
|
||||||
|
|
||||||
|
/* Define if you have the flock function */
|
||||||
|
#undef HAVE_FLOCK
|
||||||
|
|
||||||
|
/* Define if you have the openpty function */
|
||||||
|
#undef HAVE_OPENPTY
|
||||||
|
|
||||||
|
/* Define if you have the grantpt function */
|
||||||
|
#undef HAVE_GRANTPT
|
||||||
|
|
||||||
|
/* Define if you have the unlockpt function */
|
||||||
|
#undef HAVE_UNLOCKPT
|
||||||
|
|
||||||
|
/* Define if you have the ptsname function */
|
||||||
|
#undef HAVE_PTSNAME
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */
|
||||||
|
#undef HAVE_DEV_PTMX
|
||||||
|
|
||||||
|
/* Define if you have the /dev/ptc pseudo terminal multiplexer */
|
||||||
|
#undef HAVE_DEV_PTC
|
||||||
|
|
||||||
|
/* Define if you have the long long type */
|
||||||
|
#undef HAVE_TYPE_LONGLONG
|
||||||
|
|
||||||
|
/* is socklen_t already typedef'd? */
|
||||||
|
#undef HAVE_TYPE_SOCKLEN
|
||||||
|
|
||||||
|
/* Define if you have the struct stat64 type */
|
||||||
|
#undef HAVE_TYPE_STAT64
|
||||||
|
|
||||||
|
/* Define if you have the struct off64_t type */
|
||||||
|
#undef HAVE_TYPE_OFF64
|
||||||
|
|
||||||
|
/* is sighandler_t already typedef'd? */
|
||||||
|
#undef HAVE_TYPE_SIGHANDLER
|
||||||
|
|
||||||
|
/* is uint8_t already defined? */
|
||||||
|
#undef HAVE_TYPE_UINT8
|
||||||
|
|
||||||
|
/* is uint16_t already defined? */
|
||||||
|
#undef HAVE_TYPE_UINT16
|
||||||
|
|
||||||
|
/* is uint32_t already defined? */
|
||||||
|
#undef HAVE_TYPE_UINT32
|
||||||
|
|
||||||
|
/* is uint64_t already defined? */
|
||||||
|
#undef HAVE_TYPE_UINT64
|
||||||
|
|
||||||
|
/* Define if you have the printf "Z" modifier */
|
||||||
|
#undef HAVE_FORMAT_Z
|
||||||
|
|
||||||
|
/* Define the shift offset of the CRDLY mask */
|
||||||
|
#undef CRDLY_SHIFT
|
||||||
|
|
||||||
|
/* Define the shift offset of the TABDLY mask */
|
||||||
|
#undef TABDLY_SHIFT
|
||||||
|
|
||||||
|
/* Define the shift offset of the CSIZE mask */
|
||||||
|
#undef CSIZE_SHIFT
|
||||||
|
|
||||||
|
/* Define if you have tcpwrappers (libwrap, tcpd) and it declares hosts_allow_table */
|
||||||
|
#undef HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
#if defined(HAVE_HOSTS_ALLOW_TABLE) && HAVE_HOSTS_ALLOW_TABLE
|
||||||
|
# define HAVE_HOSTS_DENY_TABLE 1
|
||||||
|
#else
|
||||||
|
# undef HAVE_HOSTS_DENY_TABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||||
|
#undef HAVE_BASIC_SIZE_T
|
||||||
|
#undef HAVE_BASIC_MODE_T
|
||||||
|
#undef HAVE_BASIC_PID_T
|
||||||
|
#undef HAVE_BASIC_UID_T
|
||||||
|
#undef HAVE_BASIC_GID_T
|
||||||
|
#undef HAVE_BASIC_TIME_T
|
||||||
|
#undef HAVE_BASIC_OFF64_T
|
||||||
|
|
||||||
|
#undef HAVE_BASIC_SOCKLEN_T
|
||||||
|
|
||||||
|
#undef HAVE_TYPEOF_ST_DEV
|
||||||
|
#undef HAVE_TYPEOF_ST_INO
|
||||||
|
#undef HAVE_TYPEOF_ST_NLINK
|
||||||
|
#undef HAVE_TYPEOF_ST_SIZE
|
||||||
|
#undef HAVE_TYPEOF_ST_BLKSIZE
|
||||||
|
#undef HAVE_TYPEOF_ST_BLOCKS
|
||||||
|
|
||||||
|
#undef HAVE_TYPEOF_ST64_DEV
|
||||||
|
#undef HAVE_TYPEOF_ST64_INO
|
||||||
|
#undef HAVE_TYPEOF_ST64_NLINK
|
||||||
|
#undef HAVE_TYPEOF_ST64_SIZE
|
||||||
|
#undef HAVE_TYPEOF_ST64_BLKSIZE
|
||||||
|
#undef HAVE_TYPEOF_ST64_BLOCKS
|
||||||
|
|
||||||
|
#undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC
|
||||||
|
|
||||||
|
#undef HAVE_TYPEOF_RLIM_MAX
|
||||||
|
|
||||||
|
/* Define if you have the /proc filesystem */
|
||||||
|
#undef HAVE_PROC_DIR
|
||||||
|
|
||||||
|
/* Define if you have the /proc/$$/fd directories */
|
||||||
|
#undef HAVE_PROC_DIR_FD
|
||||||
|
|
||||||
|
#undef WITH_HELP
|
||||||
|
#undef WITH_STDIO
|
||||||
|
#undef WITH_FDNUM
|
||||||
|
#undef WITH_FILE
|
||||||
|
#undef WITH_CREAT
|
||||||
|
#undef WITH_GOPEN
|
||||||
|
#undef WITH_TERMIOS
|
||||||
|
#undef WITH_PIPE
|
||||||
|
#undef WITH_UNIX
|
||||||
|
#undef WITH_ABSTRACT_UNIXSOCKET
|
||||||
|
#undef WITH_IP4
|
||||||
|
#undef WITH_IP6
|
||||||
|
#undef WITH_RAWIP
|
||||||
|
#undef WITH_TCP
|
||||||
|
#undef WITH_UDP
|
||||||
|
#undef WITH_LISTEN
|
||||||
|
#undef WITH_SOCKS4
|
||||||
|
#undef WITH_SOCKS4A
|
||||||
|
#undef WITH_PROXY
|
||||||
|
#undef WITH_EXEC
|
||||||
|
#undef WITH_SYSTEM
|
||||||
|
#undef WITH_READLINE
|
||||||
|
#undef WITH_TUN
|
||||||
|
#undef WITH_PTY
|
||||||
|
#undef WITH_EXT2
|
||||||
|
#undef WITH_OPENSSL
|
||||||
|
#undef WITH_FIPS
|
||||||
|
#undef OPENSSL_FIPS
|
||||||
|
#undef WITH_LIBWRAP
|
||||||
|
#undef HAVE_TCPD_H
|
||||||
|
#undef HAVE_LIBWRAP
|
||||||
|
|
||||||
|
#undef WITH_SYCLS
|
||||||
|
#undef WITH_FILAN
|
||||||
|
#undef WITH_RETRY
|
||||||
|
|
||||||
|
#undef WITH_MSGLEVEL
|
||||||
|
|
||||||
|
#endif /* !defined(__config_h_included) */
|
1459
configure.in
Normal file
1459
configure.in
Normal file
File diff suppressed because it is too large
Load diff
34
daemon.sh
Executable file
34
daemon.sh
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# $Id: daemon.sh,v 1.4 2001/10/29 09:52:47 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# This script assumes that you create group daemon1 and user daemon1 before.
|
||||||
|
# they need only the right to exist (no login etc.)
|
||||||
|
|
||||||
|
# Note: this pid file mechanism is not robust!
|
||||||
|
|
||||||
|
# You will adapt these variables
|
||||||
|
USER=daemon1
|
||||||
|
GROUP=daemon1
|
||||||
|
INIF=fwnonsec.domain.org
|
||||||
|
OUTIF=fwsec.domain.org
|
||||||
|
TARGET=w3.intra.domain.org
|
||||||
|
INPORT=80
|
||||||
|
DSTPORT=80
|
||||||
|
#
|
||||||
|
INOPTS="fork,setgid=$GROUP,setuid=$USER"
|
||||||
|
OUTOPTS=
|
||||||
|
PIDFILE=/var/run/socat-$INPORT.pid
|
||||||
|
OPTS="-d -d -lm" # notice to stderr, then to syslog
|
||||||
|
SOCAT=/usr/local/bin/socat
|
||||||
|
|
||||||
|
if [ "$1" = "start" -o -z "$1" ]; then
|
||||||
|
|
||||||
|
$SOCAT $OPTS tcp-l:$INPORT,bind=$INIF,$INOPTS tcp:$TARGET:$DSTPORT,bind=$OUTIF,$OUTOPTS </dev/null &
|
||||||
|
echo $! >$PIDFILE
|
||||||
|
|
||||||
|
elif [ "$1" = "stop" ]; then
|
||||||
|
|
||||||
|
/bin/kill $(/bin/cat $PIDFILE)
|
||||||
|
fi
|
224
dalan.c
Normal file
224
dalan.c
Normal file
|
@ -0,0 +1,224 @@
|
||||||
|
/* $Id: dalan.c,v 1.8 2004/06/20 21:49:11 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2004 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* idea of a low level data description language. currently only a most
|
||||||
|
primitive subset exists. */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "dalan.h"
|
||||||
|
|
||||||
|
/* test structure to find maximal alignment */
|
||||||
|
static struct {
|
||||||
|
char a;
|
||||||
|
long double b;
|
||||||
|
} maxalign;
|
||||||
|
|
||||||
|
/* test structure to find minimal alignment */
|
||||||
|
static struct {
|
||||||
|
char a;
|
||||||
|
char b;
|
||||||
|
} minalign;
|
||||||
|
|
||||||
|
/* test union to find kind of byte ordering */
|
||||||
|
static union {
|
||||||
|
char a[2];
|
||||||
|
short b;
|
||||||
|
} byteorder = { "01" };
|
||||||
|
|
||||||
|
struct dalan_opts_s dalan_opts = {
|
||||||
|
sizeof(int),
|
||||||
|
sizeof(short),
|
||||||
|
sizeof(long),
|
||||||
|
sizeof(char),
|
||||||
|
sizeof(float),
|
||||||
|
sizeof(double)
|
||||||
|
} ;
|
||||||
|
|
||||||
|
/* fill the dalan_opts structure with machine dependent defaults values. */
|
||||||
|
static void _dalan_dflts(struct dalan_opts_s *dlo) {
|
||||||
|
dlo->c_int = sizeof(int);
|
||||||
|
dlo->c_short = sizeof(short);
|
||||||
|
dlo->c_long = sizeof(long);
|
||||||
|
dlo->c_char = sizeof(char);
|
||||||
|
dlo->c_float = sizeof(float);
|
||||||
|
dlo->c_double = sizeof(double);
|
||||||
|
dlo->maxalign = (char *)&maxalign.b-&maxalign.a;
|
||||||
|
dlo->minalign = &minalign.b-&minalign.a;
|
||||||
|
dlo->byteorder = (byteorder.b!=7711);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* allocate a new dalan_opts structure, fills it with machine dependent
|
||||||
|
defaults values, and returns the pointer. */
|
||||||
|
struct dalan_opts_s *dalan_props(void) {
|
||||||
|
struct dalan_opts_s *dlo;
|
||||||
|
dlo = malloc(sizeof(struct dalan_opts_s));
|
||||||
|
if (dlo == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
_dalan_dflts(dlo);
|
||||||
|
return dlo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dalan_init(void) {
|
||||||
|
_dalan_dflts(&dalan_opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* read data description from line, write result to data; do not write
|
||||||
|
so much data that *p exceeds n !
|
||||||
|
return 0 on success,
|
||||||
|
-1 if the data was cut due to n limit,
|
||||||
|
1 if a syntax error occurred
|
||||||
|
*p is a global data counter; especially it must be used when calculating
|
||||||
|
alignment. On successful return from the function *p must be actual!
|
||||||
|
*/
|
||||||
|
int dalan(const char *line, char *data, size_t *p, size_t n) {
|
||||||
|
int align, mask, i, x;
|
||||||
|
size_t p1 = *p;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
fputs(line, stderr); fputc('\n', stderr);
|
||||||
|
while (c = *line++) {
|
||||||
|
switch (c) {
|
||||||
|
case ' ':
|
||||||
|
case '\t':
|
||||||
|
case '\r':
|
||||||
|
case '\n':
|
||||||
|
break;
|
||||||
|
case ',':
|
||||||
|
align = 2;
|
||||||
|
while (*line == ',') {
|
||||||
|
align <<= 1;
|
||||||
|
++line;
|
||||||
|
}
|
||||||
|
mask = align - 1; /* create the bitmask */
|
||||||
|
i = (align - (p1 & mask)) & mask;
|
||||||
|
while (i && p1<n) data[p1++] = 0, --i;
|
||||||
|
if (i) { *p = p1; return -1; }
|
||||||
|
break;
|
||||||
|
case ';':
|
||||||
|
align = dalan_opts.c_int;
|
||||||
|
mask = align - 1;
|
||||||
|
i = (align - (p1 & mask)) & mask;
|
||||||
|
while (i && p1<n) data[p1++] = 0, --i;
|
||||||
|
if (i) { *p = p1; return -1; }
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
while (1) {
|
||||||
|
switch (c = *line++) {
|
||||||
|
case '\0': fputs("unterminated string\n", stderr);
|
||||||
|
return 1;
|
||||||
|
case '"':
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
if (!(c = *line++)) {
|
||||||
|
fputs("continuation line not implemented\n", stderr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
switch (c) {
|
||||||
|
case 'n': c = '\n'; break;
|
||||||
|
case 'r': c = '\r'; break;
|
||||||
|
case 't': c = '\t'; break;
|
||||||
|
case 'f': c = '\f'; break;
|
||||||
|
case 'b': c = '\b'; break;
|
||||||
|
case 'a': c = '\a'; break;
|
||||||
|
#if 0
|
||||||
|
case 'e': c = '\e'; break;
|
||||||
|
#else
|
||||||
|
case 'e': c = '\033'; break;
|
||||||
|
#endif
|
||||||
|
case '0': c = '\0'; break;
|
||||||
|
}
|
||||||
|
/* PASSTHROUGH */
|
||||||
|
default:
|
||||||
|
if (p1 >= n) { *p = p1; return -1; }
|
||||||
|
data[p1++] = c;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c == '"')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
switch (c = *line++) {
|
||||||
|
case '\0': fputs("unterminated character\n", stderr);
|
||||||
|
return 1;
|
||||||
|
case '\'': fputs("error in character\n", stderr);
|
||||||
|
return 1;
|
||||||
|
case '\\':
|
||||||
|
if (!(c = *line++)) {
|
||||||
|
fputs("continuation line not implemented\n", stderr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
switch (c) {
|
||||||
|
case 'n': c = '\n'; break;
|
||||||
|
case 'r': c = '\r'; break;
|
||||||
|
case 't': c = '\t'; break;
|
||||||
|
case 'f': c = '\f'; break;
|
||||||
|
case 'b': c = '\b'; break;
|
||||||
|
case 'a': c = '\a'; break;
|
||||||
|
#if 0
|
||||||
|
case 'e': c = '\e'; break;
|
||||||
|
#else
|
||||||
|
case 'e': c = '\033'; break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
/* PASSTHROUGH */
|
||||||
|
default:
|
||||||
|
if (p1 >= n) { *p = p1; return -1; }
|
||||||
|
data[p1++] = c;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*line != '\'') {
|
||||||
|
fputs("error in character termination\n", stderr);
|
||||||
|
*p = p1; return 1;
|
||||||
|
}
|
||||||
|
++line;
|
||||||
|
break;
|
||||||
|
#if LATER
|
||||||
|
case '0':
|
||||||
|
c = *line++;
|
||||||
|
if (c == 'x') {
|
||||||
|
/* hexadecimal */ ;
|
||||||
|
} else if (isdigit(c&0xff)) {
|
||||||
|
/* octal */
|
||||||
|
} else {
|
||||||
|
/* it was only 0 */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif /* LATER */
|
||||||
|
case 'x':
|
||||||
|
/* expecting hex data, must be an even number of digits!! */
|
||||||
|
while (true) {
|
||||||
|
c = *line;
|
||||||
|
if (isdigit(c&0xff)) {
|
||||||
|
x = (c-'0') << 4;
|
||||||
|
} else if (isxdigit(c&0xff)) {
|
||||||
|
x = ((c&0x07) + 9) << 4;
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
++line;
|
||||||
|
c = *line;
|
||||||
|
if (isdigit(c&0xff)) {
|
||||||
|
x |= (c-'0');
|
||||||
|
} else if (isxdigit(c&0xff)) {
|
||||||
|
x |= (c&0x07) + 9;
|
||||||
|
} else {
|
||||||
|
fputs("odd number of hexadecimal digits\n", stderr);
|
||||||
|
*p = p1; return 1;
|
||||||
|
}
|
||||||
|
++line;
|
||||||
|
if (p1 >= n) { *p = p1; return -1; }
|
||||||
|
data[p1++] = x;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'A': case 'a':
|
||||||
|
case 'C': case 'c':
|
||||||
|
default: fprintf(stderr, "syntax error in \"%s\"\n", line-1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*p = p1; return 0;
|
||||||
|
}
|
30
dalan.h
Normal file
30
dalan.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/* $Id: dalan.h,v 1.3 2001/06/30 14:02:39 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __dalan_h_included
|
||||||
|
#define __dalan_h_included 1
|
||||||
|
|
||||||
|
#include "mytypes.h"
|
||||||
|
|
||||||
|
/* machine properties and command line options */
|
||||||
|
struct dalan_opts_s {
|
||||||
|
int c_int; /* natural int size / C int size */
|
||||||
|
int c_short; /* C short size */
|
||||||
|
int c_long; /* C long size */
|
||||||
|
int c_char; /* C char size */
|
||||||
|
int c_float; /* C float size */
|
||||||
|
int c_double; /* C double size */
|
||||||
|
int maxalign; /* maximal alignment (double after char) */
|
||||||
|
int minalign; /* minimal alignment (char after char) */
|
||||||
|
int byteorder; /* 0: Motorola, network, big endian; 1: Intel, little
|
||||||
|
endian */
|
||||||
|
} ;
|
||||||
|
|
||||||
|
extern struct dalan_opts_s dalan_opts;
|
||||||
|
|
||||||
|
extern void dalan_init(void);
|
||||||
|
extern struct dalan_opts_s *dalan_props(void);
|
||||||
|
extern int dalan(const char *line, char *data, size_t *p, size_t n);
|
||||||
|
|
||||||
|
#endif /* !defined(__dalan_h_included) */
|
15
doc/dest-unreach.css
Normal file
15
doc/dest-unreach.css
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<!-- $Revision: 1.1 $ $Date: 2007/03/06 20:42:56 $ -->
|
||||||
|
<html><head>
|
||||||
|
<title>dest-unreach.org stylesheet</title>
|
||||||
|
<style type="text/css">
|
||||||
|
.frame { border-style:solid; border-width:4px; border-color:black; }
|
||||||
|
.shell { font-family:Courier;
|
||||||
|
padding:2px; padding-left:6px; padding-right:6px;
|
||||||
|
border-style:solid; border-width:1px; border-color:gray;
|
||||||
|
color:lightgreen; background-color:black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
340
doc/socat-multicast.html
Normal file
340
doc/socat-multicast.html
Normal file
|
@ -0,0 +1,340 @@
|
||||||
|
<!-- $Revision: 1.1 $ $Date: 2007/03/06 20:54:43 $ -->
|
||||||
|
<html><head>
|
||||||
|
<title>IP Multicasting with Socat</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="dest-unreach.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>IP Multicasting with Socat</h1>
|
||||||
|
|
||||||
|
<h2>Introduction</h2>
|
||||||
|
<p>
|
||||||
|
Multicasting (and broadcasting which is also discussed in this article)
|
||||||
|
provides a means to direct a single packet to more than one host. Special
|
||||||
|
addresses are defined for this purpose and are handled specially by network
|
||||||
|
adapters, networking hardware, and IP stacks.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
IPv4 specifications provide broadcasting and multicasting; IPv6 provides
|
||||||
|
multicasting but replaces broadcasting by special multicast modes. UNIX domain
|
||||||
|
sockets do not know broadcasting or multicasting.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The following examples use UDP/IPv4 only. However, they can easily be
|
||||||
|
adapted for raw IPv4 sockets. IPv6 multicasting has not yet been successfully
|
||||||
|
used with socat; please contact the author if you have positive experiences or
|
||||||
|
ideas that go beyond <tt>IPV6_ADD_MEMBERSHIP</tt>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
All multicast examples presented in this document use multicast address
|
||||||
|
224.1.0.1; it can be replaced by any valid IPv4 multicast address (except
|
||||||
|
<a href="#ALLSYSTEMS">all-systems</a>).
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
We assume a local network with address 192.168.10.0 and mask 255.255.255.0; an
|
||||||
|
eventual "client" has 192.168.10.1, example "server" and example peer have
|
||||||
|
192.168.10.2 in all examples. Change these addresses and mask to your own
|
||||||
|
requirements.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
All the following examples work bidirectionally except when otherwise noticed.
|
||||||
|
For "clients" we just use <tt>STDIO</tt>, and for "servers" we use <tt>EXEC:hostname</tt> which
|
||||||
|
ingores its input but shows us which host the reply comes from. Replace these
|
||||||
|
addresses with what is appropriate for you (e.g. shell script
|
||||||
|
invokations). Port 6666 can be replaced with any other port (but for ports <
|
||||||
|
1024 root privilege might be required).
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Different kinds of broadcast addresses exist: 255.255.255.255 is local network
|
||||||
|
only; for the IPv4 network 192.168.10.0/24 the "official" broadcast address
|
||||||
|
is 192.168.10.255; the network address 192.168.10.0 is also interpreted as
|
||||||
|
broadcast by some hosts. The two latter forms are routed by gateways. In the
|
||||||
|
following examples we only use broadcast address 192.168.10.255.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2>Example 1: Multicast client and servers</h2>
|
||||||
|
|
||||||
|
<p>This example builds something like a "supervisor" or "client" that
|
||||||
|
communicates with a set of "servers". The supervisor may send packets to the
|
||||||
|
multicast address, and the servers may send response packets. Note that the
|
||||||
|
servers would also respond to other clients' requests.</p>
|
||||||
|
|
||||||
|
<p>Multicast server:</p>
|
||||||
|
|
||||||
|
<span class="frame"><span class="shell">
|
||||||
|
socat UDP4-RECVFROM:6666,ip-add-membership=224.1.0.1:192.168.10.2,fork EXEC:hostname
|
||||||
|
</span></span>
|
||||||
|
<p>
|
||||||
|
This command receives multicast packets addressed to 224.1.0.1 and forks a
|
||||||
|
child process for each. The child processes may each send one or more reply
|
||||||
|
packets back to the particular sender. 192.168.10.2 means the address of the
|
||||||
|
interface where multicasts should be received.
|
||||||
|
Run this command on a number of hosts, and they will all respond in
|
||||||
|
parallel.</p>
|
||||||
|
|
||||||
|
<p>Multicast client:</p>
|
||||||
|
|
||||||
|
<span class="frame"><span class="shell">
|
||||||
|
socat STDIO UDP4-DATAGRAM:224.1.0.1:6666,range=192.168.10.0/24
|
||||||
|
</span></span>
|
||||||
|
<p>
|
||||||
|
This process transfers data from stdin to the multicast address, and transfers
|
||||||
|
packets received from the local network to stdout. It does not matter in which
|
||||||
|
direction the first data is passed.
|
||||||
|
A packet from the network is accepted by the IP stack for our socket if:
|
||||||
|
<ul>
|
||||||
|
<li>it is an incoming UDP/IPv4 packet</li>
|
||||||
|
<li>its target port matches the local port assigned to the socket (6666)</li>
|
||||||
|
<li>its target address matches one of the hosts local addresses or the any-host
|
||||||
|
multicast address</li>
|
||||||
|
</ul>
|
||||||
|
Of these packets, socat handles only those matching the following criteria:
|
||||||
|
<ul>
|
||||||
|
<li>the source address is within the given range</li>
|
||||||
|
<li>the source port is 6666</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Example 2: Broadcast client and servers</h2>
|
||||||
|
|
||||||
|
<p>Broadcast server:</p>
|
||||||
|
|
||||||
|
<span class="frame"><span class="shell">
|
||||||
|
socat UDP4-RECVFROM:6666,broadcast,fork EXEC:hostname
|
||||||
|
</span></span>
|
||||||
|
<p>
|
||||||
|
This command receives packets addressed to a local broadcast address and forks
|
||||||
|
a child process for each. The child processes may each send one or more reply
|
||||||
|
packets back to the particular sender.
|
||||||
|
Run this command on a number of hosts, and they will all respond in
|
||||||
|
parallel.</p>
|
||||||
|
|
||||||
|
<p>Broadcast client:</p>
|
||||||
|
|
||||||
|
<span class="frame"><span class="shell">
|
||||||
|
socat STDIO UDP4-DATAGRAM:192.168.10.255:6666,broadcast,range=192.168.10.0/24
|
||||||
|
</span></span>
|
||||||
|
<p>
|
||||||
|
This process transfers data from stdin to the broadcast address, and transfers
|
||||||
|
packets received from the local network to stdout. It does not matter in which
|
||||||
|
direction the first data is passed.
|
||||||
|
A packet from the network is accepted by the IP stack for our socket if:
|
||||||
|
<ul>
|
||||||
|
<li>it is an incoming UDP/IPv4 packet</li>
|
||||||
|
<li>its target port matches the local port assigned to the socket (6666)</li>
|
||||||
|
<li>its target address matches one of the hosts local addresses or the any-host
|
||||||
|
multicast address, or a local broadcast address</li>
|
||||||
|
</ul>
|
||||||
|
Of these packets, socat handles only those matching the following criteria:
|
||||||
|
<ul>
|
||||||
|
<li>the source address is within the given range</li>
|
||||||
|
<li>the source port is 6666</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
<p>The <tt>broadcast</tt> option is only required for sending or receiving
|
||||||
|
local broadcasts.</p>
|
||||||
|
|
||||||
|
<h2>Example 3: Multicast peers</h2>
|
||||||
|
|
||||||
|
<p>It is possible to combine multicast sender and receiver in one socat
|
||||||
|
address. This allows to start processes on different hosts on the local network
|
||||||
|
that will communicate symmetrically, so each process can send messages that are
|
||||||
|
received by all the other ones.</p>
|
||||||
|
|
||||||
|
<span class="frame"><span class="shell">
|
||||||
|
socat STDIO UDP4-DATAGRAM:224.1.0.1:6666,bind=:6666,range=192.168.10.0/24,ip-add-membership=224.1.0.1:192.168.10.2
|
||||||
|
</span></span>
|
||||||
|
<p>
|
||||||
|
This command is valid for host 192.168.10.2; adapt this address to the
|
||||||
|
particular interface addresses of the hosts.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Starting this process opens a socket on port 6666 that will receive packets
|
||||||
|
directed to multicast address 224.1.0.1. Only packets with matching source
|
||||||
|
address and source port 6666 will be handled though. When this process sends
|
||||||
|
data to the network the packets will be addressed to 224.1.0.1:6666 and have a
|
||||||
|
source address of 192.168.10.2:6666, matching the accept criteria of the peers
|
||||||
|
on the local network.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Note: this command receives the packets it just has sent; add option
|
||||||
|
<tt>ip-multicast-loop=0</tt> if this in undesired.</p>
|
||||||
|
|
||||||
|
<h2>Example 4: Broadcast peers</h2>
|
||||||
|
|
||||||
|
<p>Just as with multicast, it is possible to combine broadcast sender and
|
||||||
|
receiver in one socat address.</p>
|
||||||
|
|
||||||
|
<span class="frame"><span class="shell">
|
||||||
|
socat STDIO UDP4-DATAGRAM:255.255.255.255:6666,bind=:6666,range=192.168.10.0/24,broadcast
|
||||||
|
</span></span>
|
||||||
|
<p>
|
||||||
|
Starting this process opens a socket on port 6666 that will receive packets
|
||||||
|
directed to a local broadcast addresses. Only packets with matching source
|
||||||
|
address and source port 6666 will be handled though. When this process sends
|
||||||
|
data to the network the packets will be addressed to 255.255.255.255:6666 and
|
||||||
|
have a source address of 192.168.10.2:6666, matching the accept criteria of
|
||||||
|
the peers on the local network.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Note: this command receives the packets it just has sent; there does not
|
||||||
|
seem to exist a simple way to prevent this.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Troubleshooting</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If you do not get an error message during operation, but the packets do not
|
||||||
|
reach the target processes, use <tt>tcpdump</tt> to see if the packets have the
|
||||||
|
correct source and destination addresses and ports, and if they leave and enter
|
||||||
|
the hosts as expected.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The following subsections discuss some typical sources of trouble.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>IP filters</h3>
|
||||||
|
<p>
|
||||||
|
If you do not succeed in receiving multicast or broadcast packets, check if
|
||||||
|
iptables are activated on the receiving or sending host. They might be
|
||||||
|
configured to disallow this traffic.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>Do not bind()</h3>
|
||||||
|
<p>
|
||||||
|
When using multicast communications, you should not bind the sockets to a
|
||||||
|
specific IP address. It seems that the (Linux) IP stack compares the
|
||||||
|
destination address with the bind address, not taking care of the multicast
|
||||||
|
property of the incoming packet.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>Routing</h3>
|
||||||
|
<p>
|
||||||
|
When you receive an error like:</p>
|
||||||
|
<table border="1" bgcolor="#e08080"><tr><td><tt>... E sendto(3, 0x80c2e44, 4,
|
||||||
|
0, AF=2 224.1.0.1:6666, 16): Network is unreachable</tt></td></tr></table>
|
||||||
|
<p>you have a routing problem. The (Linux) IP stack seems to handle multicast
|
||||||
|
addresses just like unicast addresses when determining their route (interface and gateway).</p>
|
||||||
|
<p>
|
||||||
|
For the same reason, multicast packets will probably leave your host on the
|
||||||
|
interface with the default route.</p>
|
||||||
|
<p>
|
||||||
|
Set a multicast/broadcast route with the following command:</p>
|
||||||
|
<span class="frame"><span class="shell">
|
||||||
|
route add -net 224.0.0.0/3 gw 192.168.10.2
|
||||||
|
</span></span>
|
||||||
|
|
||||||
|
<h3>ALL-SYSTEMS multicast address</h3>
|
||||||
|
<p>
|
||||||
|
<a name="ALLSYSTEMS"><tt>224.0.0.1</tt></a> is the all-systems multicast address: all
|
||||||
|
datagram sockets appear to be automatically member of this group on all
|
||||||
|
interfaces. This membership cannot be dropped on Linux.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<h2>(In)Security</h2>
|
||||||
|
|
||||||
|
<p>When you use the above examples you should understand that all datagram
|
||||||
|
sockets without exception accept packets that are directly addressed to them;
|
||||||
|
the multi- and broadcast receiving features are just extensions to the normal
|
||||||
|
functionality. socat has no way to find out if an incoming packet is addressed
|
||||||
|
to a unicast, multicast or broadcast address. Please contact the author if you
|
||||||
|
know how the target address can be determined.</p>
|
||||||
|
|
||||||
|
<p>Authentication or encryption are not available.</p>
|
||||||
|
|
||||||
|
<p>It is very easy to fake the source address of UDP (or raw IP) packets. You
|
||||||
|
should understand whether your network is protected from address spoofing
|
||||||
|
attacks.</p>
|
||||||
|
|
||||||
|
<p>Broadcast and multicast traffic can trivially be received by <em>any</em>
|
||||||
|
host on the local network.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<h2>History</h2>
|
||||||
|
|
||||||
|
Starting with version 1.5.0, socat provides a set of address types that
|
||||||
|
allow various operations on datagram oriented sockets:
|
||||||
|
<dl>
|
||||||
|
<dt>SENDTO</dt><dd>send packets to a remote socket and receive packet from this
|
||||||
|
remote socket only</dd>
|
||||||
|
<dt>RECV</dt><dd>receive all packets that arrive on the local socket, but do
|
||||||
|
not reply</dd>
|
||||||
|
<dt>RECVFROM</dt><dd>receive all packets that arrive on the local socket, and
|
||||||
|
reply using child processes</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
These modes already enable several different client/server oriented operations.
|
||||||
|
Moreover, the SENDTO addresses can send to multicast and broadcast addresses
|
||||||
|
(the latter requires the <tt>broadcast</tt> option though). RECV and RECVFROM
|
||||||
|
also would accept packets addressed to a local broadcast address (with option
|
||||||
|
<tt>broadcast</tt>) or the all-systems multicast address.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
These address types had, however, two major caveats:
|
||||||
|
<ul>
|
||||||
|
<li>Missing control of multicast group membership in the RECV and RECVFROM
|
||||||
|
addresses</li>
|
||||||
|
<li>The SENDTO address would never accept a reply to a broadcast or multicast
|
||||||
|
addressed packet because the source address of incoming replies would not match
|
||||||
|
the target address of the sent packet.
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>New Features in socat 1.6.0</h3>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
socat version 1.6.0 addresses these problems and provides a new more generic
|
||||||
|
datagram address type (*-DATAGRAM) and the new address option IP-ADD-MEMBERSHIP.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Please note that the new features could not be successfully tested on IPv6;
|
||||||
|
these sections thus apply to IPv4 only.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>This document was last modified in March 2007.</p>
|
||||||
|
|
||||||
|
<h2>More info about socat datagrams</h2>
|
||||||
|
|
||||||
|
<h3>Links regarding this tutorial</h3>
|
||||||
|
<a href="socat.html#ADDRESS_UDP4_DATAGRAM">address udp4-datagram</a><br>
|
||||||
|
<a href="socat.html#ADDRESS_UDP4_RECVFROM">address udp4-recvfrom</a><br>
|
||||||
|
<a href="socat.html#OPTION_RANGE">option range</a><br>
|
||||||
|
<a href="socat.html#OPTION_SO_BROADCAST">option broadcast</a><br>
|
||||||
|
<a href="socat.html#OPTION_IP_ADD_MEMBERSHIP">option ip-add-membership</a><br>
|
||||||
|
<a href="socat.html#OPTION_FORK">option fork</a><br>
|
||||||
|
<a href="socat.html#OPTION_BIND">option bind</a><br>
|
||||||
|
|
||||||
|
<h3>Other datagram addresses</h3>
|
||||||
|
<a href="socat.html#ADDRESS_UDP4_RECV">address udp4-recv</a>: pure datagram receiver<br>
|
||||||
|
<a href="socat.html#ADDRESS_UDP4_SENDTO">address udp4-sendto</a>: communicate
|
||||||
|
with one peer address<br>
|
||||||
|
<a href="socat.html#ADDRESS_UDP4_LISTEN">address udp4-listen</a>: pseudo stream server<br>
|
||||||
|
<a href="socat.html#ADDRESS_UDP4_CONNECT">address udp4-connect</a>: pseudo stream client<br>
|
||||||
|
|
||||||
|
<h3>Related socat option groups</h3>
|
||||||
|
<a href="socat.html#GROUP_IP">IP options</a><br>
|
||||||
|
<a href="socat.html#GROUP_SOCKET">socket options</a><br>
|
||||||
|
<a href="socat.html#GROUP_FD">file descriptor options</a><br>
|
||||||
|
<a href="socat.html#GROUP_RANGE">range options</a><br>
|
||||||
|
<a href="socat.html#GROUP_CHILD">child process options</a><br>
|
||||||
|
|
||||||
|
|
||||||
|
<h2>References</h2>
|
||||||
|
<a href="http://www.dest-unreach.org/socat">socat home page</a><br>
|
||||||
|
<a href="socat.html">socat man page</a><br>
|
||||||
|
<a href="http://en.wikipedia.org/wiki/Multicast">multicasting on Wikipedia</a><br>
|
||||||
|
<a href="http://en.wikipedia.org/wiki/Broadcast_address">broadcasting on Wikipedia</a><br>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<small>Copyright: Gerhard Rieger 2007</small><br>
|
||||||
|
<small>License: <a href="http://www.fsf.org/licensing/licenses/fdl.html">GNU Free Documentation License (FDL)</a></small>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
192
doc/socat-openssltunnel.html
Normal file
192
doc/socat-openssltunnel.html
Normal file
|
@ -0,0 +1,192 @@
|
||||||
|
<!-- $Revision: 1.1 $ $Date: 2007/03/06 20:54:43 $ -->
|
||||||
|
<html><head>
|
||||||
|
<title>Securing Traffic Between two Socat Instances Using SSL</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="dest-unreach.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Securing Traffic Between two Socat Instances Using SSL</h1>
|
||||||
|
|
||||||
|
<h2>Introduction</h2>
|
||||||
|
<p>
|
||||||
|
When you want to connect two socat processes running on different machines and
|
||||||
|
feel that you need to protect the connection against unauthorized access,
|
||||||
|
sniffing, data manipulation etc., you might want to encrypt the communications.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
For this purpose socat integrates the OpenSSL library and provides SSL client
|
||||||
|
and server features.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
SSL is a complex protocol that provides much more features than required for
|
||||||
|
protecting a single connection; in this document we present only a simple
|
||||||
|
scenario that provides just the basic security requirements.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- discussion -->
|
||||||
|
<h2>Configuring OpenSSL in socat</h2>
|
||||||
|
<p>
|
||||||
|
This section shows how the SSL addresses can be configured in socat.
|
||||||
|
In this docu we only use self signed certificates for the sake of simplicity.
|
||||||
|
</p>
|
||||||
|
<p>We assume that the server host is called <tt>server.domain.org</tt> and the
|
||||||
|
server process uses port 4433. To keep it simple, we use a very simple server
|
||||||
|
funtionality that just echos data (<tt>echo</tt>), and <tt>stdio</tt> on the
|
||||||
|
client.</p>
|
||||||
|
<h3>Generate a server certificate</h3>
|
||||||
|
|
||||||
|
<p>Perform the following steps on a trusted host where OpenSSL is
|
||||||
|
installed. It might as well be the client or server host themselves.</p>
|
||||||
|
<p>Prepare a basename for the files related to the server certificate:</p>
|
||||||
|
<span class="frame"><span class="shell">FILENAME=server</span></span>
|
||||||
|
|
||||||
|
<p>Generate a public/private key pair:</p>
|
||||||
|
<span class="frame"><span class="shell">openssl genrsa -out $FILENAME.key 1024</span></span>
|
||||||
|
|
||||||
|
<p>Generate a self signed certificate:</p>
|
||||||
|
<span class="frame"><span class="shell">
|
||||||
|
openssl req -new -key $FILENAME.key -x509 -days 3653 -out $FILENAME.crt</span></span>
|
||||||
|
<p>You will be prompted for your country code, name etc.; you may quit all prompts
|
||||||
|
with the enter key.</p>
|
||||||
|
<p>Generate the PEM file by just appending the key and certificate files:<p>
|
||||||
|
<span class="frame"><span class="shell">cat $FILENAME.key $FILENAME.crt >$FILENAME.pem</span></span>
|
||||||
|
|
||||||
|
<p>The files that contain the private key should be kept secret, thus adapt
|
||||||
|
their permissions:<p>
|
||||||
|
<span class="frame"><span class="shell">chmod 600 $FILENAME.key $FILENAME.pem</span></span>
|
||||||
|
|
||||||
|
<p>Now bring the file <tt>server.pem</tt> to the SSL server, e.g. to directory
|
||||||
|
<tt>$HOME/etc/</tt>, using a secure channel like USB memory stick or SSH. Keep
|
||||||
|
tight permissions on the file even on the target host, and remove all other
|
||||||
|
instances of <tt>server.key</tt> and <tt>server.pem</tt>.
|
||||||
|
</p>
|
||||||
|
<p>Copy the trust certificate server.crt to the SSL client host, e.g. to directory
|
||||||
|
<tt>$HOME/etc/</tt>; a secure channel is not required here, and the permissions
|
||||||
|
are not critical.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>Generate a client certificate</h3>
|
||||||
|
<p>First prepare a different basename for the files related to the client certificate:</p>
|
||||||
|
<span class="frame"><span class="shell">FILENAME=client</span></span>
|
||||||
|
|
||||||
|
<p>Repeat the procedure for certificate generation described above.
|
||||||
|
Copy <tt>client.pem</tt> to the SSL client, and <tt>client.crt</tt> to the
|
||||||
|
server.</p>
|
||||||
|
|
||||||
|
<h3>OpenSSL Server</h3>
|
||||||
|
|
||||||
|
<p>Instead of using a tcp-listen (tcp-l) address, we use openssl-listen (ssl-l)
|
||||||
|
for the server, <tt>cert=...</tt> tells the program to the file containing its
|
||||||
|
ceritificate and private key, and <tt>cafile=...</tt> points to the file
|
||||||
|
containing the certificate of the peer; we trust clients only if they can proof
|
||||||
|
that they have the related private key (OpenSSL handles this for us):<p>
|
||||||
|
<span class="frame"><span class="shell">socat openssl-listen:4433,reuseaddr,cert=$HOME/etc/server.pem,cafile=$HOME/etc/client.crt echo</span></span>
|
||||||
|
<p>After starting this command, socat should be listening on port 4433, but
|
||||||
|
will require client authentication.</p>
|
||||||
|
|
||||||
|
<h3>OpenSSL Client</h3>
|
||||||
|
<p>Substitute your <tt>tcp-connect</tt> or <tt>tcp</tt> address keyword with
|
||||||
|
<tt>openssl-connect</tt> or just <tt>ssl</tt> and here too add the
|
||||||
|
<tt>cert</tt> and <tt>cafile</tt> options:<p>
|
||||||
|
<span class="frame"><span class="shell">socat stdio openssl-connect:server.domain.org:4433,cert=$HOME/etc/client.pem,cafile=$HOME/etc/server.crt</span></span>
|
||||||
|
<p>This command should establish a secured connection to the server
|
||||||
|
process.</p>
|
||||||
|
|
||||||
|
<h3>TCP/IP version 6</h3>
|
||||||
|
|
||||||
|
<p>If the communication is to go over IPv6, the above described commands have
|
||||||
|
to be adapted; <tt>ip6name.domain.org</tt> is assumed to resolve to the IPv6
|
||||||
|
address of the server:</p>
|
||||||
|
<p>Server:</p>
|
||||||
|
<span class="frame"><span class="shell">socat
|
||||||
|
openssl-listen:4433,<b style="color:yellow">pf=ip6</b>,reuseaddr,cert=$HOME/etc/server.pem,cafile=$HOME/etc/client.crt echo</span></span>
|
||||||
|
|
||||||
|
<p>Client:</p>
|
||||||
|
<span class="frame"><span class="shell">socat stdio openssl-connect:<b style="color:yellow">ip6name</b>.domain.org:4433,cert=$HOME/etc/client.pem,cafile=$HOME/etc/server.crt</span></span>
|
||||||
|
|
||||||
|
<h2>Troubleshooting</h2>
|
||||||
|
|
||||||
|
<h3>Test OpenSSL Integration</h3>
|
||||||
|
<p>
|
||||||
|
If you get error messages like this:</p>
|
||||||
|
<table border="1" bgcolor="#e08080"><tr><td><tt>... E unknown device/address "openssl-listen"</tt></td></tr></table>
|
||||||
|
<p>your socat executable probably does not have the OpenSSL library linked in.
|
||||||
|
Check socat's compile time configuration with the following command:</p>
|
||||||
|
<span class="frame"><span class="shell">socat -V |grep SSL</span></span>
|
||||||
|
<p>Positive output:
|
||||||
|
<tt>#define WITH_OPENSSL 1</tt><br>
|
||||||
|
Negative output:
|
||||||
|
<tt>#undef WITH_OPENSSL</tt><br>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
In the latter case, make sure you have OpenSSL and its development package
|
||||||
|
(include files) installed, and check the run of the configure script.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<h2>History</h2>
|
||||||
|
<p>
|
||||||
|
A first OpenSSL client was implemented in socat 1.2.0; it did not support
|
||||||
|
client certificates and could not verify server certificates. It was rather
|
||||||
|
considered as a tool for probing typical SSL secured Internet services.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
From version 1.4.0 on, socat provided experimental support for SSL client and
|
||||||
|
SSL server, implemented using the OpenSSL libraries. Only TCP/IPv4 transport
|
||||||
|
was supported. With both SSL client and server, trust certificates for checking
|
||||||
|
the peers authentication, and certificates for authentication could be
|
||||||
|
specified. This allowed for non interactive secure connection establishing.
|
||||||
|
The features were considered experimental; like most Internet sites, socat
|
||||||
|
server did not require the client to present a certificate per default, but the
|
||||||
|
client required a server certificate.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
DSA certificate support is implemented since version 1.4.2.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Socat version 1.5.0 extended SSL to TCP/IPv6 transports.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
With socat version 1.6.0, the SSL server per default requires the client to
|
||||||
|
present a trusted certificate. socat's OpenSSL implementation still does not
|
||||||
|
check the contents of a certificate like host name or host address.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>This document was last modified in March 2007.</p>
|
||||||
|
|
||||||
|
<h2>More info about socat OpenSSL</h2>
|
||||||
|
|
||||||
|
<h3>Links regarding this tutorial</h3>
|
||||||
|
<a href="socat.html#ADDRESS_OPENSSL_CONNECT">address openssl-connect</a><br>
|
||||||
|
<a href="socat.html#ADDRESS_OPENSSL_LISTEN">address openssl-listen</a><br>
|
||||||
|
<a href="socat.html#OPTION_OPENSSL_CERTIFICATE">option cert</a><br>
|
||||||
|
<a href="socat.html#OPTION_OPENSSL_CAFILE">option cafile</a><br>
|
||||||
|
|
||||||
|
<h3>More socat options for OpenSSL addresses</h3>
|
||||||
|
<a href="socat.html#GROUP_OPENSSL">OpenSSL options</a><br>
|
||||||
|
<a href="socat.html#GROUP_TCP">TCP options</a><br>
|
||||||
|
<a href="socat.html#GROUP_IP">IP options</a><br>
|
||||||
|
<a href="socat.html#GROUP_SOCKET">socket options</a><br>
|
||||||
|
<a href="socat.html#GROUP_FD">file descriptor options</a><br>
|
||||||
|
<a href="socat.html#GROUP_RETRY">retry options</a><br>
|
||||||
|
<p>For openssl-listen only:</p>
|
||||||
|
<a href="socat.html#GROUP_LISTEN">listen options</a><br>
|
||||||
|
<a href="socat.html#GROUP_CHILD">child options</a><br>
|
||||||
|
<a href="socat.html#GROUP_RANGE">range options</a><br>
|
||||||
|
|
||||||
|
<h2>References</h2>
|
||||||
|
<a href="http://www.dest-unreach.org/socat">socat home page</a><br>
|
||||||
|
<a href="socat.html">socat man page</a><br>
|
||||||
|
<a href="http://www.openssl.org/">OpenSSL home page</a><br>
|
||||||
|
<a href="http://www.stunnel.org/">stunnel home page</a><br>
|
||||||
|
<a href="http://en.wikipedia.org/wiki/Secure_Sockets_Layer">secure sockets layer on Wikipedia</a><br>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<small>Copyright: Gerhard Rieger 2007</small><br>
|
||||||
|
<small>License: <a href="http://www.fsf.org/licensing/licenses/fdl.html">GNU Free Documentation License (FDL)</a></small>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
165
doc/socat-tun.html
Normal file
165
doc/socat-tun.html
Normal file
|
@ -0,0 +1,165 @@
|
||||||
|
<!-- $Revision: 1.1 $ $Date: 2007/03/06 20:54:43 $ -->
|
||||||
|
<html><head>
|
||||||
|
<title>Building TUN based virtual networks with socat</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="dest-unreach.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Building TUN based virtual networks with socat</h1>
|
||||||
|
|
||||||
|
<h2>Introduction</h2>
|
||||||
|
<p>
|
||||||
|
Some operating systems allow the generation of virtual network interfaces that
|
||||||
|
do not connect to a wire but to a process that simulates the network. Often
|
||||||
|
these devices are called TUN or TAP.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
socat provides an address type that creates a TUN device on Linux; the other
|
||||||
|
socat address can be any type; it transfer the "wire" data as desired.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
This document shows how a simple virtual network can be created between
|
||||||
|
two hosts that may be far (many network hops) apart. On both hosts a socat
|
||||||
|
instance is started that connects to the other host using TCP and creates a TUN
|
||||||
|
device. See <a href="socat-openssltunnel.html">socat-openssltunnel.html</a> for
|
||||||
|
a guide on securing the connection using SSL.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The following IP addresses are used in the example; replace them in the
|
||||||
|
following commands with the requirements of your situation:</p>
|
||||||
|
<table border="1">
|
||||||
|
<tr><th>host</th><th>address</th><th>mask</th></tr>
|
||||||
|
<tr><td>physical "server" address</td><td>1.2.3.4</td><td>n/a</td></tr>
|
||||||
|
<tr><td>physical "client" address</td><td>223.2.3.4</td><td>n/a</td></tr>
|
||||||
|
<tr><td>TUN on "server"</td><td>192.168.255.1</td><td>255.255.255.0</td></tr>
|
||||||
|
<tr><td>TUN on "client"</td><td>192.168.255.2</td><td>255.255.255.0</td></tr>
|
||||||
|
</table>
|
||||||
|
<p>The TCP connection uses port 11443.</p>
|
||||||
|
|
||||||
|
<p>On "default" Linux installations, creating TUN/TAP devices might require
|
||||||
|
root privilege.</p>
|
||||||
|
|
||||||
|
<!-- discussion -->
|
||||||
|
<h2>Generate TUN devices with socat</h2>
|
||||||
|
<p>In this section two instances of socat are used to generate TUN devices on
|
||||||
|
different hosts and connect the "wire" sides, providing a simple virtual
|
||||||
|
network.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
We distinguish server and client only with respect to the connection between
|
||||||
|
the two socat instances; the TUN interfaces both have the same quality.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>TUN Server</h3>
|
||||||
|
|
||||||
|
<span class="frame"><span class="shell">socat -d -d TCP-LISTEN:11443,reuseaddr TUN:192.168.255.1/24,up</span></span>
|
||||||
|
<p>After starting this command, socat will wait for a connection and then
|
||||||
|
create a TUN pseudo network device with address 192.168.255.1; the bit number
|
||||||
|
specifies the mask of the network that is pretended to be connected on this
|
||||||
|
interface.</p>
|
||||||
|
|
||||||
|
<h3>TUN Client</h3>
|
||||||
|
<span class="frame"><span class="shell">socat TCP:1.2.3.4:11443 TUN:192.168.255.2/24,up</span></span>
|
||||||
|
<p>This command should establish a connection to the server and create the TUN
|
||||||
|
device on the client.</p>
|
||||||
|
|
||||||
|
<h3>Seeing it work</h3>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
After successful connection both TUN interfaces should be active and transfer
|
||||||
|
date between each other using the TCP connection. Try this by pinging
|
||||||
|
192.168.255.1 from the client and 192.168.255.2 from the server.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>TCP/IP version 6</h3>
|
||||||
|
|
||||||
|
<p>IPv6 as transport should work just like any TCP/IPv6 connection.</p>
|
||||||
|
|
||||||
|
<p>Creation of an IPv6 virtual interface is not directly possible, but you can
|
||||||
|
generate an IPv4 interface as described above, and add IPv6 addresses using
|
||||||
|
the <tt>ifconfig</tt> command.
|
||||||
|
|
||||||
|
<h2>Troubleshooting</h2>
|
||||||
|
|
||||||
|
<h3>Test TUN integration</h3>
|
||||||
|
<p>
|
||||||
|
If you get error messages like this:</p>
|
||||||
|
<table border="1" bgcolor="#e08080"><tr><td><tt>... E unknown device/address "tun"</tt></td></tr></table>
|
||||||
|
<p>your socat executable probably does not provide TUN/TAP support. Potential
|
||||||
|
reasons: you are not on Linux or are using an older version of socat.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>Missing kernel support</h3>
|
||||||
|
<p>An error message like:</p>
|
||||||
|
<table border="1" bgcolor="#e08080"><tr><td><tt>... E open("/dev/net/tun", 02, 0666): No such file or directory</tt></td></tr></table>
|
||||||
|
<p>indicates that your kernel does not have TUN/TAP support compiled
|
||||||
|
in. Rebuild your kernel with the appropriate configuration (probably under
|
||||||
|
<b>Device driver / Network device support / Network device / Universal TUN/TAP</b>).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>TUN cloning device permissions</h3>
|
||||||
|
<p>An error message like:</p>
|
||||||
|
<table border="1" bgcolor="#e08080"><tr><td><tt>... E open("/dev/net/tun", 02, 0666): Permission denied</tt></td></tr></table>
|
||||||
|
<p>indicates that you do not have permission to read or write the TUN cloning
|
||||||
|
device. Check its permission and ownership.</p>
|
||||||
|
|
||||||
|
<h3>Interface down</h3>
|
||||||
|
<p>If no error occurs but the pings do not work check if the network devices
|
||||||
|
have been created:</p>
|
||||||
|
<span class="frame"><span class="shell">ifconfig tun0</span></span>
|
||||||
|
<p>The output should look like:</p>
|
||||||
|
<pre>
|
||||||
|
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
|
||||||
|
inet addr:192.168.255.1 P-t-P:192.168.255.1 Mask:255.255.255.0
|
||||||
|
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
|
||||||
|
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
|
||||||
|
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
|
||||||
|
collisions:0 txqueuelen:500
|
||||||
|
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
|
||||||
|
</pre>
|
||||||
|
<p>Check the "UP" keyword; you forget the "up" option in the socat command if
|
||||||
|
it is missing.<p>
|
||||||
|
<p>Check if the correct IP address and network mask are displayed.</p>
|
||||||
|
|
||||||
|
<h3>Routing</h3>
|
||||||
|
<p></p>
|
||||||
|
<span class="frame"><span class="shell">netstat -an |fgrep 192.168.255</span></span>
|
||||||
|
<p>The output should look like:</p>
|
||||||
|
<pre>
|
||||||
|
192.168.255.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<h3>Other problems</h3>
|
||||||
|
<p>Another reason for failure might be iptables.</p>
|
||||||
|
<p>Run socat with options <tt>-d -d -d</tt>, this will show every data transfer
|
||||||
|
between the two processes. Each ping probe should cause a forth and a back
|
||||||
|
transfer.<p>
|
||||||
|
|
||||||
|
<h2>History</h2>
|
||||||
|
<p>
|
||||||
|
Linux TUN/TAP support was added to socat in version 1.6.0.</p>
|
||||||
|
|
||||||
|
<p>This document was last modified in March 2007.</p>
|
||||||
|
|
||||||
|
<h2>More info about socat TUN/TAP support</h2>
|
||||||
|
|
||||||
|
<h3>Links regarding this tutorial</h3>
|
||||||
|
<a href="socat.html#ADDRESS_TUN">socat address tun</a><br>
|
||||||
|
|
||||||
|
<h3>socat options for TUN/TAP addresses</h3>
|
||||||
|
<a href="socat.html#GROUP_TUN">TUN/TAP options</a><br>
|
||||||
|
|
||||||
|
<h2>References</h2>
|
||||||
|
<a href="http://www.dest-unreach.org/socat">socat home page</a><br>
|
||||||
|
<a href="socat.html">socat man page</a><br>
|
||||||
|
<a href="http://openvpn.net/">OpenVPN home page</a><br>
|
||||||
|
<a href="http://en.wikipedia.org/wiki/TUN/TAP">TUN/TAP on Wikipedia</a><br>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<small>Copyright: Gerhard Rieger 2007</small><br>
|
||||||
|
<small>License: <a href="http://www.fsf.org/licensing/licenses/fdl.html">GNU Free Documentation License (FDL)</a></small>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
2877
doc/socat.1
Normal file
2877
doc/socat.1
Normal file
File diff suppressed because it is too large
Load diff
2686
doc/socat.html
Normal file
2686
doc/socat.html
Normal file
File diff suppressed because it is too large
Load diff
3026
doc/socat.yo
Normal file
3026
doc/socat.yo
Normal file
File diff suppressed because it is too large
Load diff
4959
doc/xio.help
Normal file
4959
doc/xio.help
Normal file
File diff suppressed because it is too large
Load diff
249
error.c
Normal file
249
error.c
Normal file
|
@ -0,0 +1,249 @@
|
||||||
|
/* $Id: error.c,v 1.29 2007/02/08 18:22:23 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* the logging subsystem */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#if HAVE_SYSLOG_H
|
||||||
|
#include <syslog.h>
|
||||||
|
#endif
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
#include <time.h> /* time_t, strftime() */
|
||||||
|
#include <sys/time.h> /* gettimeofday() */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include "mytypes.h"
|
||||||
|
#include "compat.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
/* translate MSG level to SYSLOG level */
|
||||||
|
int syslevel[] = {
|
||||||
|
LOG_DEBUG,
|
||||||
|
LOG_INFO,
|
||||||
|
LOG_NOTICE,
|
||||||
|
LOG_WARNING,
|
||||||
|
LOG_ERR,
|
||||||
|
LOG_CRIT };
|
||||||
|
|
||||||
|
struct diag_opts {
|
||||||
|
const char *progname;
|
||||||
|
int msglevel;
|
||||||
|
int exitlevel;
|
||||||
|
int logstderr;
|
||||||
|
int syslog;
|
||||||
|
FILE *logfile;
|
||||||
|
int logfacility;
|
||||||
|
bool micros;
|
||||||
|
int exitstatus; /* pass signal number to error exit */
|
||||||
|
bool withhostname; /* in custom logs add hostname */
|
||||||
|
char *hostname;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
struct diag_opts diagopts =
|
||||||
|
{ NULL, E_ERROR, E_ERROR, 1, 0, NULL, LOG_DAEMON, false, 0 } ;
|
||||||
|
|
||||||
|
static void _msg(int level, const char *buff, const char *syslp);
|
||||||
|
|
||||||
|
static struct wordent facilitynames[] = {
|
||||||
|
{"auth", (void *)LOG_AUTH},
|
||||||
|
#ifdef LOG_AUTHPRIV
|
||||||
|
{"authpriv", (void *)LOG_AUTHPRIV},
|
||||||
|
#endif
|
||||||
|
#ifdef LOG_CONSOLE
|
||||||
|
{"console", (void *)LOG_CONSOLE},
|
||||||
|
#endif
|
||||||
|
{"cron", (void *)LOG_CRON},
|
||||||
|
{"daemon", (void *)LOG_DAEMON},
|
||||||
|
#ifdef LOG_FTP
|
||||||
|
{"ftp", (void *)LOG_FTP},
|
||||||
|
#endif
|
||||||
|
{"kern", (void *)LOG_KERN},
|
||||||
|
{"local0", (void *)LOG_LOCAL0},
|
||||||
|
{"local1", (void *)LOG_LOCAL1},
|
||||||
|
{"local2", (void *)LOG_LOCAL2},
|
||||||
|
{"local3", (void *)LOG_LOCAL3},
|
||||||
|
{"local4", (void *)LOG_LOCAL4},
|
||||||
|
{"local5", (void *)LOG_LOCAL5},
|
||||||
|
{"local6", (void *)LOG_LOCAL6},
|
||||||
|
{"local7", (void *)LOG_LOCAL7},
|
||||||
|
{"lpr", (void *)LOG_LPR},
|
||||||
|
{"mail", (void *)LOG_MAIL},
|
||||||
|
{"news", (void *)LOG_NEWS},
|
||||||
|
#ifdef LOG_SECURITY
|
||||||
|
{"security", (void *)LOG_SECURITY},
|
||||||
|
#endif
|
||||||
|
{"syslog", (void *)LOG_SYSLOG},
|
||||||
|
{"user", (void *)LOG_USER},
|
||||||
|
{"uucp", (void *)LOG_UUCP}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
void diag_set(char what, const char *arg) {
|
||||||
|
switch (what) {
|
||||||
|
const struct wordent *keywd;
|
||||||
|
|
||||||
|
case 'y': diagopts.syslog = true;
|
||||||
|
if (arg && arg[0]) {
|
||||||
|
if ((keywd =
|
||||||
|
keyw(facilitynames, arg,
|
||||||
|
sizeof(facilitynames)/sizeof(struct wordent))) == NULL) {
|
||||||
|
Error1("unknown syslog facility \"%s\"", arg);
|
||||||
|
} else {
|
||||||
|
diagopts.logfacility = (int)keywd->desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
openlog(diagopts.progname, LOG_PID, diagopts.logfacility);
|
||||||
|
diagopts.logstderr = false; break;
|
||||||
|
case 'f': if ((diagopts.logfile = fopen(arg, "a")) == NULL) {
|
||||||
|
Error2("cannot open log file \"%s\": %s", arg, strerror(errno));
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
diagopts.logstderr = false; break;
|
||||||
|
}
|
||||||
|
case 's': diagopts.logstderr = true; break; /* logging to stderr is default */
|
||||||
|
case 'p': diagopts.progname = arg;
|
||||||
|
openlog(diagopts.progname, LOG_PID, diagopts.logfacility);
|
||||||
|
break;
|
||||||
|
case 'd': --diagopts.msglevel; break;
|
||||||
|
case 'u': diagopts.micros = true; break;
|
||||||
|
default: msg(E_ERROR, "unknown diagnostic option %c", what);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void diag_set_int(char what, int arg) {
|
||||||
|
switch (what) {
|
||||||
|
case 'D': diagopts.msglevel = arg; break;
|
||||||
|
case 'e': diagopts.exitlevel = arg; break;
|
||||||
|
case 'x': diagopts.exitstatus = arg; break;
|
||||||
|
case 'h': diagopts.withhostname = arg;
|
||||||
|
if ((diagopts.hostname = getenv("HOSTNAME")) == NULL) {
|
||||||
|
struct utsname ubuf;
|
||||||
|
uname(&ubuf);
|
||||||
|
diagopts.hostname = strdup(ubuf.nodename);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: msg(E_ERROR, "unknown diagnostic option %c", what);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int diag_get_int(char what) {
|
||||||
|
switch (what) {
|
||||||
|
case 'y': return diagopts.syslog;
|
||||||
|
case 's': return diagopts.logstderr;
|
||||||
|
case 'd': case 'D': return diagopts.msglevel;
|
||||||
|
case 'e': return diagopts.exitlevel;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *diag_get_string(char what) {
|
||||||
|
switch (what) {
|
||||||
|
case 'p': return diagopts.progname;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Linux and AIX syslog format:
|
||||||
|
Oct 4 17:10:37 hostname socat[52798]: D signal(13, 1)
|
||||||
|
*/
|
||||||
|
void msg(int level, const char *format, ...) {
|
||||||
|
#if HAVE_GETTIMEOFDAY || 1
|
||||||
|
struct timeval now;
|
||||||
|
int result;
|
||||||
|
time_t nowt;
|
||||||
|
#else /* !HAVE_GETTIMEOFDAY */
|
||||||
|
time_t now;
|
||||||
|
#endif /* !HAVE_GETTIMEOFDAY */
|
||||||
|
#define BUFLEN 512
|
||||||
|
char buff[BUFLEN], *bufp, *syslp;
|
||||||
|
size_t bytes;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
if (level < diagopts.msglevel) return;
|
||||||
|
va_start(ap, format);
|
||||||
|
#if HAVE_GETTIMEOFDAY || 1
|
||||||
|
result = gettimeofday(&now, NULL);
|
||||||
|
if (result < 0) {
|
||||||
|
/* invoking msg() might create endless recursion; by hand instead */
|
||||||
|
sprintf(buff, "cannot read time: %s["F_pid"] E %s",
|
||||||
|
diagopts.progname, getpid(), strerror(errno));
|
||||||
|
_msg(LOG_ERR, buff, strstr(buff, " E "+1));
|
||||||
|
strcpy(buff, "unknown time "); bytes = 20;
|
||||||
|
} else {
|
||||||
|
nowt = now.tv_sec;
|
||||||
|
#if HAVE_STRFTIME
|
||||||
|
if (diagopts.micros) {
|
||||||
|
bytes = strftime(buff, 20, "%Y/%m/%d %H:%M:%S", localtime(&nowt));
|
||||||
|
bytes += sprintf(buff+19, "."F_tv_usec" ", now.tv_usec);
|
||||||
|
} else {
|
||||||
|
bytes =
|
||||||
|
strftime(buff, 21, "%Y/%m/%d %H:%M:%S ", localtime(&nowt));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
strcpy(buff, ctime(&nowt));
|
||||||
|
bytes = strlen(buff);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#else /* !HAVE_GETTIMEOFDAY */
|
||||||
|
now = time(NULL); if (now == (time_t)-1) {
|
||||||
|
/* invoking msg() might create endless recursion; by hand instead */
|
||||||
|
sprintf(buff, "cannot read time: %s["F_pid"] E %s",
|
||||||
|
diagopts.progname, getpid(), strerror(errno));
|
||||||
|
_msg(LOG_ERR, buff, strstr(buff, " E "+1));
|
||||||
|
strcpy(buff, "unknown time "); bytes = 20;
|
||||||
|
} else {
|
||||||
|
#if HAVE_STRFTIME
|
||||||
|
bytes = strftime(buff, 21, "%Y/%m/%d %H:%M:%S ", localtime(&now));
|
||||||
|
#else
|
||||||
|
strcpy(buff, ctime(&now));
|
||||||
|
bytes = strlen(buff);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif /* !HAVE_GETTIMEOFDAY */
|
||||||
|
bufp = buff + bytes;
|
||||||
|
if (diagopts.withhostname) {
|
||||||
|
bytes = sprintf(bufp, "%s ", diagopts.hostname), bufp+=bytes;
|
||||||
|
}
|
||||||
|
bytes = sprintf(bufp, "%s["F_pid"] ", diagopts.progname, getpid());
|
||||||
|
bufp += bytes;
|
||||||
|
syslp = bufp;
|
||||||
|
*bufp++ = "DINWEF"[level];
|
||||||
|
*bufp++ = ' ';
|
||||||
|
vsnprintf(bufp, BUFLEN-(bufp-buff)-1, format, ap);
|
||||||
|
strcat(bufp, "\n");
|
||||||
|
_msg(level, buff, syslp);
|
||||||
|
if (level >= diagopts.exitlevel) {
|
||||||
|
va_end(ap);
|
||||||
|
if (E_NOTICE >= diagopts.msglevel) {
|
||||||
|
sprintf(syslp, "N exit(1)\n");
|
||||||
|
_msg(E_NOTICE, buff, syslp);
|
||||||
|
}
|
||||||
|
exit(diagopts.exitstatus ? diagopts.exitstatus : 1);
|
||||||
|
}
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void _msg(int level, const char *buff, const char *syslp) {
|
||||||
|
if (diagopts.logstderr) {
|
||||||
|
fputs(buff, stderr); fflush(stderr);
|
||||||
|
}
|
||||||
|
if (diagopts.syslog) {
|
||||||
|
/* prevent format string attacks (thanks to CoKi) */
|
||||||
|
syslog(syslevel[level], "%s", syslp);
|
||||||
|
}
|
||||||
|
if (diagopts.logfile) {
|
||||||
|
fputs(buff, diagopts.logfile); fflush(diagopts.logfile);
|
||||||
|
}
|
||||||
|
}
|
208
error.h
Normal file
208
error.h
Normal file
|
@ -0,0 +1,208 @@
|
||||||
|
/* $Id: error.h,v 1.14 2007/03/06 21:19:18 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __error_h_included
|
||||||
|
#define __error_h_included 1
|
||||||
|
|
||||||
|
/* these must be defines because they are used by cpp! */
|
||||||
|
#define E_DEBUG 0 /* all, including trace */
|
||||||
|
#define E_INFO 1 /* all status changes etc. */
|
||||||
|
#define E_NOTICE 2 /* all interesting, e.g. for firewall relay */
|
||||||
|
#define E_WARN 3 /* all unusual */
|
||||||
|
#define E_ERROR 4 /* errors */
|
||||||
|
#define E_FATAL 5 /* emergency abort */
|
||||||
|
|
||||||
|
|
||||||
|
/* here are the macros for diag invocation; use WITH_MSGLEVEL to specify the
|
||||||
|
lowest priority that is compiled into your program */
|
||||||
|
#ifndef WITH_MSGLEVEL
|
||||||
|
# define WITH_MSGLEVEL E_NOTICE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if WITH_MSGLEVEL <= E_FATAL
|
||||||
|
#define Fatal(m) msg(E_FATAL,"%s",m)
|
||||||
|
#define Fatal1(m,a1) msg(E_FATAL,m,a1)
|
||||||
|
#define Fatal2(m,a1,a2) msg(E_FATAL,m,a1,a2)
|
||||||
|
#define Fatal3(m,a1,a2,a3) msg(E_FATAL,m,a1,a2,a3)
|
||||||
|
#define Fatal4(m,a1,a2,a3,a4) msg(E_FATAL,m,a1,a2,a3,a4)
|
||||||
|
#define Fatal5(m,a1,a2,a3,a4,a5) msg(E_FATAL,m,a1,a2,a3,a4,a5)
|
||||||
|
#define Fatal6(m,a1,a2,a3,a4,a5,a6) msg(E_FATAL,m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Fatal7(m,a1,a2,a3,a4,a5,a6,a7) msg(E_FATAL,m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#else /* !(WITH_MSGLEVEL <= E_FATAL) */
|
||||||
|
#define Fatal(m)
|
||||||
|
#define Fatal1(m,a1)
|
||||||
|
#define Fatal2(m,a1,a2)
|
||||||
|
#define Fatal3(m,a1,a2,a3)
|
||||||
|
#define Fatal4(m,a1,a2,a3,a4)
|
||||||
|
#define Fatal5(m,a1,a2,a3,a4,a5)
|
||||||
|
#define Fatal6(m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Fatal7(m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#endif /* !(WITH_MSGLEVEL <= E_FATAL) */
|
||||||
|
|
||||||
|
#if WITH_MSGLEVEL <= E_ERROR
|
||||||
|
#define Error(m) msg(E_ERROR,"%s",m)
|
||||||
|
#define Error1(m,a1) msg(E_ERROR,m,a1)
|
||||||
|
#define Error2(m,a1,a2) msg(E_ERROR,m,a1,a2)
|
||||||
|
#define Error3(m,a1,a2,a3) msg(E_ERROR,m,a1,a2,a3)
|
||||||
|
#define Error4(m,a1,a2,a3,a4) msg(E_ERROR,m,a1,a2,a3,a4)
|
||||||
|
#define Error5(m,a1,a2,a3,a4,a5) msg(E_ERROR,m,a1,a2,a3,a4,a5)
|
||||||
|
#define Error6(m,a1,a2,a3,a4,a5,a6) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Error7(m,a1,a2,a3,a4,a5,a6,a7) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#define Error8(m,a1,a2,a3,a4,a5,a6,a7,a8) msg(E_ERROR,m,a1,a2,a3,a4,a5,a6,a7,a8)
|
||||||
|
#else /* !(WITH_MSGLEVEL >= E_ERROR) */
|
||||||
|
#define Error(m)
|
||||||
|
#define Error1(m,a1)
|
||||||
|
#define Error2(m,a1,a2)
|
||||||
|
#define Error3(m,a1,a2,a3)
|
||||||
|
#define Error4(m,a1,a2,a3,a4)
|
||||||
|
#define Error5(m,a1,a2,a3,a4,a5)
|
||||||
|
#define Error6(m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Error7(m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#define Error8(m,a1,a2,a3,a4,a5,a6,a7,a8)
|
||||||
|
#endif /* !(WITH_MSGLEVEL <= E_ERROR) */
|
||||||
|
|
||||||
|
#if WITH_MSGLEVEL <= E_WARN
|
||||||
|
#define Warn(m) msg(E_WARN,"%s",m)
|
||||||
|
#define Warn1(m,a1) msg(E_WARN,m,a1)
|
||||||
|
#define Warn2(m,a1,a2) msg(E_WARN,m,a1,a2)
|
||||||
|
#define Warn3(m,a1,a2,a3) msg(E_WARN,m,a1,a2,a3)
|
||||||
|
#define Warn4(m,a1,a2,a3,a4) msg(E_WARN,m,a1,a2,a3,a4)
|
||||||
|
#define Warn5(m,a1,a2,a3,a4,a5) msg(E_WARN,m,a1,a2,a3,a4,a5)
|
||||||
|
#define Warn6(m,a1,a2,a3,a4,a5,a6) msg(E_WARN,m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Warn7(m,a1,a2,a3,a4,a5,a6,a7) msg(E_WARN,m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#else /* !(WITH_MSGLEVEL <= E_WARN) */
|
||||||
|
#define Warn(m)
|
||||||
|
#define Warn1(m,a1)
|
||||||
|
#define Warn2(m,a1,a2)
|
||||||
|
#define Warn3(m,a1,a2,a3)
|
||||||
|
#define Warn4(m,a1,a2,a3,a4)
|
||||||
|
#define Warn5(m,a1,a2,a3,a4,a5)
|
||||||
|
#define Warn6(m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Warn7(m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#endif /* !(WITH_MSGLEVEL <= E_WARN) */
|
||||||
|
|
||||||
|
#if WITH_MSGLEVEL <= E_NOTICE
|
||||||
|
#define Notice(m) msg(E_NOTICE,"%s",m)
|
||||||
|
#define Notice1(m,a1) msg(E_NOTICE,m,a1)
|
||||||
|
#define Notice2(m,a1,a2) msg(E_NOTICE,m,a1,a2)
|
||||||
|
#define Notice3(m,a1,a2,a3) msg(E_NOTICE,m,a1,a2,a3)
|
||||||
|
#define Notice4(m,a1,a2,a3,a4) msg(E_NOTICE,m,a1,a2,a3,a4)
|
||||||
|
#define Notice5(m,a1,a2,a3,a4,a5) msg(E_NOTICE,m,a1,a2,a3,a4,a5)
|
||||||
|
#define Notice6(m,a1,a2,a3,a4,a5,a6) msg(E_NOTICE,m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Notice7(m,a1,a2,a3,a4,a5,a6,a7) msg(E_NOTICE,m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#define Notice8(m,a1,a2,a3,a4,a5,a6,a7,a8) msg(E_NOTICE,m,a1,a2,a3,a4,a5,a6,a7,a8)
|
||||||
|
#define Notice9(m,a1,a2,a3,a4,a5,a6,a7,a8,a9) msg(E_NOTICE,m,a1,a2,a3,a4,a5,a6,a7,a8,a9)
|
||||||
|
#else /* !(WITH_MSGLEVEL <= E_NOTICE) */
|
||||||
|
#define Notice(m)
|
||||||
|
#define Notice1(m,a1)
|
||||||
|
#define Notice2(m,a1,a2)
|
||||||
|
#define Notice3(m,a1,a2,a3)
|
||||||
|
#define Notice4(m,a1,a2,a3,a4)
|
||||||
|
#define Notice5(m,a1,a2,a3,a4,a5)
|
||||||
|
#define Notice6(m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Notice7(m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#define Notice8(m,a1,a2,a3,a4,a5,a6,a7,a8)
|
||||||
|
#define Notice9(m,a1,a2,a3,a4,a5,a6,a7,a8,a9)
|
||||||
|
#endif /* !(WITH_MSGLEVEL <= E_NOTICE) */
|
||||||
|
|
||||||
|
#if WITH_MSGLEVEL <= E_INFO
|
||||||
|
#define Info(m) msg(E_INFO,"%s",m)
|
||||||
|
#define Info1(m,a1) msg(E_INFO,m,a1)
|
||||||
|
#define Info2(m,a1,a2) msg(E_INFO,m,a1,a2)
|
||||||
|
#define Info3(m,a1,a2,a3) msg(E_INFO,m,a1,a2,a3)
|
||||||
|
#define Info4(m,a1,a2,a3,a4) msg(E_INFO,m,a1,a2,a3,a4)
|
||||||
|
#define Info5(m,a1,a2,a3,a4,a5) msg(E_INFO,m,a1,a2,a3,a4,a5)
|
||||||
|
#define Info6(m,a1,a2,a3,a4,a5,a6) msg(E_INFO,m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Info7(m,a1,a2,a3,a4,a5,a6,a7) msg(E_INFO,m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#define Info8(m,a1,a2,a3,a4,a5,a6,a7,a8) msg(E_INFO,m,a1,a2,a3,a4,a5,a6,a7,a8)
|
||||||
|
#define Info9(m,a1,a2,a3,a4,a5,a6,a7,a8,a9) msg(E_INFO,m,a1,a2,a3,a4,a5,a6,a7,a8,a9)
|
||||||
|
#define Info10(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) msg(E_INFO,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||||
|
#define Info11(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) msg(E_INFO,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
|
||||||
|
#else /* !(WITH_MSGLEVEL <= E_INFO) */
|
||||||
|
#define Info(m)
|
||||||
|
#define Info1(m,a1)
|
||||||
|
#define Info2(m,a1,a2)
|
||||||
|
#define Info3(m,a1,a2,a3)
|
||||||
|
#define Info4(m,a1,a2,a3,a4)
|
||||||
|
#define Info5(m,a1,a2,a3,a4,a5)
|
||||||
|
#define Info6(m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Info7(m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#define Info8(m,a1,a2,a3,a4,a5,a6,a7,a8)
|
||||||
|
#define Info9(m,a1,a2,a3,a4,a5,a6,a7,a8,a9)
|
||||||
|
#define Info10(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||||
|
#define Info11(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
|
||||||
|
#endif /* !(WITH_MSGLEVEL <= E_INFO) */
|
||||||
|
|
||||||
|
#if WITH_MSGLEVEL <= E_DEBUG
|
||||||
|
#define Debug(m) msg(E_DEBUG,"%s",m)
|
||||||
|
#define Debug1(m,a1) msg(E_DEBUG,m,a1)
|
||||||
|
#define Debug2(m,a1,a2) msg(E_DEBUG,m,a1,a2)
|
||||||
|
#define Debug3(m,a1,a2,a3) msg(E_DEBUG,m,a1,a2,a3)
|
||||||
|
#define Debug4(m,a1,a2,a3,a4) msg(E_DEBUG,m,a1,a2,a3,a4)
|
||||||
|
#define Debug5(m,a1,a2,a3,a4,a5) msg(E_DEBUG,m,a1,a2,a3,a4,a5)
|
||||||
|
#define Debug6(m,a1,a2,a3,a4,a5,a6) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Debug7(m,a1,a2,a3,a4,a5,a6,a7) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#define Debug8(m,a1,a2,a3,a4,a5,a6,a7,a8) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8)
|
||||||
|
#define Debug9(m,a1,a2,a3,a4,a5,a6,a7,a8,a9) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8,a9)
|
||||||
|
#define Debug10(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||||
|
#define Debug11(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
|
||||||
|
#define Debug12(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
|
||||||
|
#define Debug13(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
|
||||||
|
#define Debug14(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14)
|
||||||
|
#define Debug15(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15)
|
||||||
|
#define Debug16(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16)
|
||||||
|
#define Debug17(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17)
|
||||||
|
#define Debug18(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18) msg(E_DEBUG,m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18)
|
||||||
|
#else /* !(WITH_MSGLEVEL <= E_DEBUG) */
|
||||||
|
#define Debug(m)
|
||||||
|
#define Debug1(m,a1)
|
||||||
|
#define Debug2(m,a1,a2)
|
||||||
|
#define Debug3(m,a1,a2,a3)
|
||||||
|
#define Debug4(m,a1,a2,a3,a4)
|
||||||
|
#define Debug5(m,a1,a2,a3,a4,a5)
|
||||||
|
#define Debug6(m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Debug7(m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#define Debug8(m,a1,a2,a3,a4,a5,a6,a7,a8)
|
||||||
|
#define Debug9(m,a1,a2,a3,a4,a5,a6,a7,a8,a9)
|
||||||
|
#define Debug10(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||||
|
#define Debug11(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
|
||||||
|
#define Debug12(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
|
||||||
|
#define Debug13(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
|
||||||
|
#define Debug14(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14)
|
||||||
|
#define Debug15(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15)
|
||||||
|
#define Debug16(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16)
|
||||||
|
#define Debug17(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17)
|
||||||
|
#define Debug18(m,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18)
|
||||||
|
#endif /* !(WITH_MSGLEVEL <= E_DEBUG) */
|
||||||
|
|
||||||
|
/* message with software controlled serverity */
|
||||||
|
#if WITH_MSGLEVEL <= E_FATAL
|
||||||
|
#define Msg(l,m) msg(l,"%s",m)
|
||||||
|
#define Msg1(l,m,a1) msg(l,m,a1)
|
||||||
|
#define Msg2(l,m,a1,a2) msg(l,m,a1,a2)
|
||||||
|
#define Msg3(l,m,a1,a2,a3) msg(l,m,a1,a2,a3)
|
||||||
|
#define Msg4(l,m,a1,a2,a3,a4) msg(l,m,a1,a2,a3,a4)
|
||||||
|
#define Msg5(l,m,a1,a2,a3,a4,a5) msg(l,m,a1,a2,a3,a4,a5)
|
||||||
|
#define Msg6(l,m,a1,a2,a3,a4,a5,a6) msg(l,m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Msg7(l,m,a1,a2,a3,a4,a5,a6,a7) msg(l,m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#else /* !(WITH_MSGLEVEL >= E_FATAL) */
|
||||||
|
#define Msg(l,m)
|
||||||
|
#define Msg1(l,m,a1)
|
||||||
|
#define Msg2(l,m,a1,a2)
|
||||||
|
#define Msg3(l,m,a1,a2,a3)
|
||||||
|
#define Msg4(l,m,a1,a2,a3,a4)
|
||||||
|
#define Msg5(l,m,a1,a2,a3,a4,a5)
|
||||||
|
#define Msg6(l,m,a1,a2,a3,a4,a5,a6)
|
||||||
|
#define Msg7(l,m,a1,a2,a3,a4,a5,a6,a7)
|
||||||
|
#endif /* !(WITH_MSGLEVEL <= E_FATAL) */
|
||||||
|
|
||||||
|
|
||||||
|
extern void diag_set(char what, const char *arg);
|
||||||
|
extern void diag_set_int(char what, int arg);
|
||||||
|
extern int diag_get_int(char what);
|
||||||
|
extern const char *diag_get_string(char what);
|
||||||
|
|
||||||
|
extern void msg(int level, const char *format, ...);
|
||||||
|
|
||||||
|
#endif /* !defined(__error_h_included) */
|
327
fdname.c
Normal file
327
fdname.c
Normal file
|
@ -0,0 +1,327 @@
|
||||||
|
/* $Id: fdname.c,v 1.9 2007/02/08 18:27:00 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2003-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* the subroutine sockname prints the basic info about the address of a socket
|
||||||
|
NOTE: it works on UNIX (kernel) file descriptors, not on libc files! */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "xioconfig.h" /* what features are enabled */
|
||||||
|
|
||||||
|
#include "sysincludes.h"
|
||||||
|
|
||||||
|
#include "mytypes.h"
|
||||||
|
#include "compat.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "sycls.h"
|
||||||
|
#include "sysutils.h"
|
||||||
|
|
||||||
|
#include "filan.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct sockopt {
|
||||||
|
int so;
|
||||||
|
char *name;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int statname(const char *file, int fd, int filetype, FILE *outfile);
|
||||||
|
int cdevname(int fd, FILE *outfile);
|
||||||
|
int sockname(int fd, FILE *outfile);
|
||||||
|
int unixame(int fd, FILE *outfile);
|
||||||
|
int tcpname(int fd, FILE *outfile);
|
||||||
|
|
||||||
|
|
||||||
|
int fdname(const char *file, int fd, FILE *outfile) {
|
||||||
|
struct stat buf = {0};
|
||||||
|
int filetype;
|
||||||
|
Debug1("checking file descriptor %u", fd);
|
||||||
|
if (fd >= 0) {
|
||||||
|
if (Fstat(fd, &buf) < 0) {
|
||||||
|
if (errno == EBADF) {
|
||||||
|
Debug2("fstat(%d): %s", fd, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
Error2("fstat(%d): %s", fd, strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filetype = (buf.st_mode&S_IFMT)>>12;
|
||||||
|
return statname(file, fd, filetype, outfile);
|
||||||
|
} else {
|
||||||
|
if (Stat(file, &buf) < 0) {
|
||||||
|
Error2("stat(\"%s\"): %s", file, strerror(errno));
|
||||||
|
}
|
||||||
|
filetype = (buf.st_mode&S_IFMT)>>12;
|
||||||
|
return statname(file, -1, filetype, outfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if HAVE_PROC_DIR_FD
|
||||||
|
static int procgetfdname(int fd, char *filepath, size_t pathsize) {
|
||||||
|
static pid_t pid = -1;
|
||||||
|
char procpath[PATH_MAX];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
/* even if configure has shown that we have /proc, we must check if it
|
||||||
|
exists at runtime, because we might be in a chroot environment */
|
||||||
|
#if HAVE_STAT64
|
||||||
|
{
|
||||||
|
struct stat64 buf;
|
||||||
|
if (Stat64("/proc", &buf) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!S_ISDIR(buf.st_mode)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else /* !HAVE_STAT64 */
|
||||||
|
{
|
||||||
|
struct stat buf;
|
||||||
|
if (Stat("/proc", &buf) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!S_ISDIR(buf.st_mode)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* !HAVE_STAT64 */
|
||||||
|
|
||||||
|
if (pid < 0) pid = Getpid();
|
||||||
|
snprintf(procpath, sizeof(procpath), "/proc/"F_pid"/fd/%d", pid, fd);
|
||||||
|
if ((len = Readlink(procpath, filepath, pathsize-1)) < 0) {
|
||||||
|
Error4("readlink(\"%s\", %p, "F_Zu"): %s",
|
||||||
|
procpath, filepath, pathsize, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
filepath[len] = '\0';
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_PROC_DIR_FD */
|
||||||
|
|
||||||
|
int statname(const char *file, int fd, int filetype, FILE *outfile) {
|
||||||
|
char filepath[PATH_MAX];
|
||||||
|
int result;
|
||||||
|
|
||||||
|
filepath[0] = '\0';
|
||||||
|
#if HAVE_PROC_DIR_FD
|
||||||
|
if (fd >= 0) {
|
||||||
|
procgetfdname(fd, filepath, sizeof(filepath));
|
||||||
|
if (filepath[0] == '/') {
|
||||||
|
file = filepath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* HAVE_PROC_DIR_FD */
|
||||||
|
/* now see for type specific infos */
|
||||||
|
switch (filetype) {
|
||||||
|
case (S_IFIFO>>12): /* 1, FIFO */
|
||||||
|
fputs("pipe", outfile);
|
||||||
|
if (file) fprintf(outfile, " %s", file);
|
||||||
|
break;
|
||||||
|
case (S_IFCHR>>12): /* 2, character device */
|
||||||
|
if (cdevname(fd, outfile) == 0) {
|
||||||
|
if (file) fprintf(outfile, " %s", file);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case (S_IFDIR>>12): /* 4, directory */
|
||||||
|
fputs("dir", outfile);
|
||||||
|
if (file) fprintf(outfile, " %s", file);
|
||||||
|
break;
|
||||||
|
case (S_IFBLK>>12): /* 6, block device */
|
||||||
|
fputs("blkdev", outfile);
|
||||||
|
if (file) fprintf(outfile, " %s", file);
|
||||||
|
break;
|
||||||
|
case (S_IFREG>>12): /* 8, regular file */
|
||||||
|
fputs("file", outfile);
|
||||||
|
if (file) fprintf(outfile, " %s", file);
|
||||||
|
break;
|
||||||
|
case (S_IFLNK>>12): /* 10, symbolic link */
|
||||||
|
fputs("link", outfile);
|
||||||
|
if (file) fprintf(outfile, " %s", file);
|
||||||
|
break;
|
||||||
|
case (S_IFSOCK>>12): /* 12, socket */
|
||||||
|
#if WITH_SOCKET
|
||||||
|
if (fd >= 0) {
|
||||||
|
result = sockname(fd, outfile);
|
||||||
|
} else if (file) {
|
||||||
|
fprintf(outfile, "socket %s", file);
|
||||||
|
} else {
|
||||||
|
fputs("socket", outfile);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Error("SOCKET support not compiled in");
|
||||||
|
return -1;
|
||||||
|
#endif /* !WITH_SOCKET */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* ioctl() */
|
||||||
|
fputc('\n', outfile);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* character device analysis */
|
||||||
|
/* return -1 on error, 0 if no name was found, or 1 if it printed ttyname */
|
||||||
|
int cdevname(int fd, FILE *outfile) {
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if ((ret = Isatty(fd)) < 0) {
|
||||||
|
Error2("isatty(%d): %s", fd, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (ret > 0) {
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
fputs("tty", outfile);
|
||||||
|
if ((name = Ttyname(fd)) != NULL) {
|
||||||
|
fputc(' ', outfile);
|
||||||
|
fputs(name, outfile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fputs("chrdev", outfile);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_SOCKET
|
||||||
|
int sockname(int fd, FILE *outfile) {
|
||||||
|
#define FDNAME_OPTLEN 256
|
||||||
|
#define FDNAME_NAMELEN 256
|
||||||
|
socklen_t optlen;
|
||||||
|
int opttype;
|
||||||
|
#ifdef SO_ACCEPTCONN
|
||||||
|
int optacceptconn;
|
||||||
|
#endif
|
||||||
|
int result /*0, i*/;
|
||||||
|
char namebuff[FDNAME_NAMELEN];
|
||||||
|
char peerbuff[FDNAME_NAMELEN];
|
||||||
|
/* in Linux these optcodes are 'enum', but on AIX they are bits! */
|
||||||
|
union sockaddr_union sockname, peername; /* the longest I know of */
|
||||||
|
socklen_t namelen;
|
||||||
|
#if 0 && defined(SIOCGIFNAME)
|
||||||
|
/*Linux struct ifreq ifc = {{{ 0 }}};*/
|
||||||
|
struct ifreq ifc = {{ 0 }};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
optlen = FDNAME_OPTLEN;
|
||||||
|
|
||||||
|
Getsockopt(fd, SOL_SOCKET, SO_TYPE, &opttype, &optlen);
|
||||||
|
#ifdef SO_ACCEPTCONN
|
||||||
|
Getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &optacceptconn, &optlen);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namelen = sizeof(sockname);
|
||||||
|
result = Getsockname(fd, &sockname.soa, &namelen);
|
||||||
|
if (result < 0) {
|
||||||
|
Error2("getsockname(%d): %s", fd, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
namelen = sizeof(peername);
|
||||||
|
result = Getpeername(fd, (struct sockaddr *)&peername, &namelen);
|
||||||
|
if (result < 0) {
|
||||||
|
Error2("getpeername(%d): %s", fd, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (sockname.soa.sa_family) {
|
||||||
|
#if WITH_UNIX
|
||||||
|
case AF_UNIX:
|
||||||
|
fprintf(outfile, "unix%s%s %s",
|
||||||
|
opttype==SOCK_DGRAM?"datagram":"",
|
||||||
|
#ifdef SO_ACCEPTCONN
|
||||||
|
optacceptconn?"(listening)":
|
||||||
|
#endif
|
||||||
|
"",
|
||||||
|
sockaddr_unix_info(&sockname.un, namelen,
|
||||||
|
namebuff, sizeof(namebuff)));
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if WITH_IP4
|
||||||
|
case AF_INET:
|
||||||
|
switch (opttype) {
|
||||||
|
#if WITH_TCP
|
||||||
|
case SOCK_STREAM:
|
||||||
|
fprintf(outfile, "tcp%s %s %s",
|
||||||
|
#ifdef SO_ACCEPTCONN
|
||||||
|
optacceptconn?"(listening)":
|
||||||
|
#endif
|
||||||
|
"",
|
||||||
|
sockaddr_inet4_info(&sockname.ip4,
|
||||||
|
namebuff, sizeof(namebuff)),
|
||||||
|
sockaddr_inet4_info(&peername.ip4,
|
||||||
|
peerbuff, sizeof(peerbuff)));
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if WITH_UDP
|
||||||
|
case SOCK_DGRAM:
|
||||||
|
fprintf(outfile, "udp%s %s %s",
|
||||||
|
#ifdef SO_ACCEPTCONN
|
||||||
|
optacceptconn?"(listening)":
|
||||||
|
#endif
|
||||||
|
"",
|
||||||
|
sockaddr_inet4_info(&sockname.ip4,
|
||||||
|
namebuff, sizeof(namebuff)),
|
||||||
|
sockaddr_inet4_info(&peername.ip4,
|
||||||
|
peerbuff, sizeof(peerbuff)));
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
fprintf(outfile, "ip %s",
|
||||||
|
sockaddr_inet4_info(&sockname.ip4,
|
||||||
|
namebuff, sizeof(namebuff)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
|
||||||
|
#if WITH_IP6
|
||||||
|
case AF_INET6:
|
||||||
|
switch (opttype) {
|
||||||
|
#if WITH_TCP
|
||||||
|
case SOCK_STREAM:
|
||||||
|
fprintf(outfile, "tcp6%s %s %s",
|
||||||
|
#ifdef SO_ACCEPTCONN
|
||||||
|
optacceptconn?"(listening)":
|
||||||
|
#endif
|
||||||
|
"",
|
||||||
|
sockaddr_inet6_info(&sockname.ip6,
|
||||||
|
namebuff, sizeof(namebuff)),
|
||||||
|
sockaddr_inet6_info(&peername.ip6,
|
||||||
|
peerbuff, sizeof(peerbuff)));
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if WITH_UDP
|
||||||
|
case SOCK_DGRAM:
|
||||||
|
fprintf(outfile, "udp6%s %s %s",
|
||||||
|
#ifdef SO_ACCEPTCONN
|
||||||
|
optacceptconn?"(listening)":
|
||||||
|
#endif
|
||||||
|
"",
|
||||||
|
sockaddr_inet6_info(&sockname.ip6,
|
||||||
|
namebuff, sizeof(namebuff)),
|
||||||
|
sockaddr_inet6_info(&peername.ip6,
|
||||||
|
peerbuff, sizeof(peerbuff)));
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
fprintf(outfile, "ip6 %s",
|
||||||
|
sockaddr_inet6_info(&sockname.ip6,
|
||||||
|
namebuff, sizeof(namebuff)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
default:
|
||||||
|
fputs("socket", outfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
#undef FDNAME_OPTLEN
|
||||||
|
#undef FDNAME_NAMELEN
|
||||||
|
}
|
||||||
|
#endif /* WITH_SOCKET */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
918
filan.c
Normal file
918
filan.c
Normal file
|
@ -0,0 +1,918 @@
|
||||||
|
/* $Id: filan.c,v 1.45 2007/02/08 19:42:34 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* the subroutine filan makes a "FILe descriptor ANalysis". It checks the
|
||||||
|
type of file descriptor and tries to retrieve as much info about it as
|
||||||
|
possible without modifying its state.
|
||||||
|
NOTE: it works on UNIX (kernel) file descriptors, not on libc files! */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "xioconfig.h" /* what features are enabled */
|
||||||
|
|
||||||
|
#include "sysincludes.h"
|
||||||
|
|
||||||
|
#include "mytypes.h"
|
||||||
|
#include "compat.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "sycls.h"
|
||||||
|
#include "sysutils.h"
|
||||||
|
|
||||||
|
#include "filan.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct sockopt {
|
||||||
|
int so;
|
||||||
|
char *name;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* dirty workaround so we dont get an error on AIX when getting linked with
|
||||||
|
libwrap */
|
||||||
|
int allow_severity, deny_severity;
|
||||||
|
|
||||||
|
/* global variables for configuring filan */
|
||||||
|
bool filan_followsymlinks;
|
||||||
|
bool filan_rawoutput;
|
||||||
|
|
||||||
|
|
||||||
|
int sockoptan(int fd, const struct sockopt *optname, int socklay, FILE *outfile);
|
||||||
|
int tcpan(int fd, FILE *outfile);
|
||||||
|
const char *getfiletypestring(int st_mode);
|
||||||
|
|
||||||
|
static int printtime(FILE *outfile, time_t time);
|
||||||
|
|
||||||
|
static int headprinted;
|
||||||
|
|
||||||
|
/* analyse a file system entry, referred by file name */
|
||||||
|
int filan_file(const char *filename, FILE *outfile) {
|
||||||
|
int fd = -1;
|
||||||
|
int result;
|
||||||
|
#if HAVE_STAT64
|
||||||
|
struct stat64 buf = {0};
|
||||||
|
#else
|
||||||
|
struct stat buf = {0};
|
||||||
|
#endif /* !HAVE_STAT64 */
|
||||||
|
|
||||||
|
if (filan_followsymlinks) {
|
||||||
|
#if HAVE_STAT64
|
||||||
|
result = Stat64(filename, &buf);
|
||||||
|
#else
|
||||||
|
result = Stat(filename, &buf);
|
||||||
|
#endif /* !HAVE_STAT64 */
|
||||||
|
if (result < 0) {
|
||||||
|
Warn3("stat(\"%s\", %p): %s", filename, &buf, strerror(errno));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
#if HAVE_STAT64
|
||||||
|
result = Lstat64(filename, &buf);
|
||||||
|
#else
|
||||||
|
result = Lstat(filename, &buf);
|
||||||
|
#endif /* !HAVE_STAT64 */
|
||||||
|
if (result < 0) {
|
||||||
|
Warn3("lstat(\"%s\", %p): %s", filename, &buf, strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (buf.st_mode&S_IFMT) {
|
||||||
|
#ifdef S_IFSOCK
|
||||||
|
case S_IFSOCK: /* probably, it's useless to make a socket and describe it */
|
||||||
|
break;
|
||||||
|
#endif /* S_IFSOCK */
|
||||||
|
default:
|
||||||
|
if ((fd =
|
||||||
|
Open(filename, O_RDONLY|O_NOCTTY|O_NONBLOCK
|
||||||
|
#ifdef O_LARGEFILE
|
||||||
|
|O_LARGEFILE
|
||||||
|
#endif
|
||||||
|
, 0700))
|
||||||
|
< 0) {
|
||||||
|
Warn2("open(\"%s\", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0700): %s",
|
||||||
|
filename, strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = filan_stat(&buf, fd, -1, outfile);
|
||||||
|
fputc('\n', outfile);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* analyze a file descriptor */
|
||||||
|
int filan_fd(int fd, FILE *outfile) {
|
||||||
|
#if HAVE_STAT64
|
||||||
|
struct stat64 buf = {0};
|
||||||
|
#else
|
||||||
|
struct stat buf = {0};
|
||||||
|
#endif /* !HAVE_STAT64 */
|
||||||
|
int result;
|
||||||
|
|
||||||
|
Debug1("checking file descriptor %u", fd);
|
||||||
|
#if HAVE_STAT64
|
||||||
|
result = Fstat64(fd, &buf);
|
||||||
|
#else
|
||||||
|
result = Fstat(fd, &buf);
|
||||||
|
#endif /* !HAVE_STAT64 */
|
||||||
|
if (result < 0) {
|
||||||
|
if (errno == EBADF) {
|
||||||
|
Debug2("fstat(%d): %s", fd, strerror(errno));
|
||||||
|
} else {
|
||||||
|
Warn2("fstat(%d): %s", fd, strerror(errno));
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Debug2("fd %d is a %s", fd, getfiletypestring(buf.st_mode));
|
||||||
|
|
||||||
|
result = filan_stat(&buf, fd, fd, outfile);
|
||||||
|
|
||||||
|
if (result >= 0) {
|
||||||
|
/* even more dynamic info */
|
||||||
|
{ /* see if data is available */
|
||||||
|
struct pollfd ufds;
|
||||||
|
ufds.fd = fd;
|
||||||
|
ufds.events = POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|POLLWRNORM|POLLWRBAND
|
||||||
|
#ifdef POLLMSG
|
||||||
|
|POLLMSG
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
if (Poll(&ufds, 1, 0) < 0) {
|
||||||
|
Warn4("poll({%d, %hd, %hd}, 1, 0): %s",
|
||||||
|
ufds.fd, ufds.events, ufds.revents, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fputs("poll: ", outfile);
|
||||||
|
if (ufds.revents & POLLIN) fputs("IN,", outfile);
|
||||||
|
if (ufds.revents & POLLPRI) fputs("PRI,", outfile);
|
||||||
|
if (ufds.revents & POLLOUT) fputs("OUT,", outfile);
|
||||||
|
if (ufds.revents & POLLERR) fputs("ERR,", outfile);
|
||||||
|
if (ufds.revents & POLLNVAL) fputs("NVAL,", outfile);
|
||||||
|
#ifdef FIONREAD
|
||||||
|
if (ufds.revents & POLLIN) {
|
||||||
|
size_t sizet;
|
||||||
|
if ((result = Ioctl(fd, FIONREAD, &sizet) >= 0)) {
|
||||||
|
fprintf (outfile, "; FIONREAD="F_Zu, sizet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* defined(FIONREAD) */
|
||||||
|
#if WITH_SOCKET && defined(MSG_DONTWAIT)
|
||||||
|
if ((ufds.revents & POLLIN) && isasocket(fd)) {
|
||||||
|
char _peername[SOCKADDR_MAX];
|
||||||
|
struct sockaddr *pa = (struct sockaddr *)_peername;
|
||||||
|
struct msghdr msgh = {0};
|
||||||
|
char peekbuff[1]; /* [0] fails with some compilers */
|
||||||
|
#if HAVE_STRUCT_IOVEC
|
||||||
|
struct iovec iovec;
|
||||||
|
#endif
|
||||||
|
char ctrlbuff[5120];
|
||||||
|
ssize_t bytes;
|
||||||
|
|
||||||
|
fputs("; ", outfile);
|
||||||
|
msgh.msg_name = pa;
|
||||||
|
msgh.msg_namelen = sizeof(*pa);
|
||||||
|
#if HAVE_STRUCT_IOVEC
|
||||||
|
iovec.iov_base = peekbuff;
|
||||||
|
iovec.iov_len = sizeof(peekbuff);
|
||||||
|
msgh.msg_iov = &iovec;
|
||||||
|
msgh.msg_iovlen = 1;
|
||||||
|
#endif
|
||||||
|
#if HAVE_STRUCT_MSGHDR_MSGCONTROL
|
||||||
|
msgh.msg_control = ctrlbuff;
|
||||||
|
#endif
|
||||||
|
#if HAVE_STRUCT_MSGHDR_MSGCONTROLLEN
|
||||||
|
msgh.msg_controllen = sizeof(ctrlbuff);
|
||||||
|
#endif
|
||||||
|
#if HAVE_STRUCT_MSGHDR_MSGFLAGS
|
||||||
|
msgh.msg_flags = 0;
|
||||||
|
#endif
|
||||||
|
if ((bytes = Recvmsg(fd, &msgh, MSG_PEEK|MSG_DONTWAIT)) < 0) {
|
||||||
|
Warn1("recvmsg(): %s", strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile, "recvmsg="F_Zd", ", bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* WITH_SOCKET && defined(MSG_DONTWAIT) */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fputc('\n', outfile);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int filan_stat(
|
||||||
|
#if HAVE_STAT64
|
||||||
|
struct stat64 *buf
|
||||||
|
#else
|
||||||
|
struct stat *buf
|
||||||
|
#endif /* !HAVE_STAT64 */
|
||||||
|
, int statfd, int dynfd, FILE *outfile) {
|
||||||
|
char stdevstr[8];
|
||||||
|
int result;
|
||||||
|
|
||||||
|
/* print header */
|
||||||
|
if (!headprinted) {
|
||||||
|
if (filan_rawoutput) {
|
||||||
|
fputs(" FD type\tdevice\tinode\tmode\tlinks\tuid\tgid"
|
||||||
|
#if HAVE_ST_RDEV
|
||||||
|
"\trdev"
|
||||||
|
#endif
|
||||||
|
"\tsize"
|
||||||
|
#if HAVE_ST_BLKSIZE
|
||||||
|
"\tblksize"
|
||||||
|
#endif
|
||||||
|
#if HAVE_ST_BLOCKS
|
||||||
|
"\tblocks"
|
||||||
|
#endif
|
||||||
|
"\tatime\t\tmtime\t\tctime\t\tcloexec\tflags"
|
||||||
|
#if defined(F_GETOWN)
|
||||||
|
"\tsigown"
|
||||||
|
#endif
|
||||||
|
, outfile);
|
||||||
|
} else /* !rawoutput */ {
|
||||||
|
fputs(" FD type\tdevice\tinode\tmode\tlinks\tuid\tgid"
|
||||||
|
#if HAVE_ST_RDEV
|
||||||
|
"\trdev"
|
||||||
|
#endif
|
||||||
|
"\tsize"
|
||||||
|
#if HAVE_ST_BLKSIZE
|
||||||
|
"\tblksize"
|
||||||
|
#endif
|
||||||
|
#if HAVE_ST_BLOCKS
|
||||||
|
"\tblocks"
|
||||||
|
#endif
|
||||||
|
"\tatime\t\t\t\tmtime\t\t\t\tctime\t\t\t\tcloexec\tflags"
|
||||||
|
#if defined(F_GETOWN)
|
||||||
|
"\tsigown"
|
||||||
|
#endif
|
||||||
|
, outfile);
|
||||||
|
|
||||||
|
} /* endif !rawoutput */
|
||||||
|
|
||||||
|
#if defined(F_GETSIG)
|
||||||
|
fputs("\tsigio", outfile);
|
||||||
|
#endif /* defined(F_GETSIG) */
|
||||||
|
fputc('\n', outfile);
|
||||||
|
headprinted = 1;
|
||||||
|
}
|
||||||
|
if (filan_rawoutput) {
|
||||||
|
snprintf(stdevstr, 8, F_st_dev, buf->st_dev);
|
||||||
|
} else {
|
||||||
|
snprintf(stdevstr, 8, "%hu,%hu", (unsigned short)buf->st_dev>>8, (unsigned short)buf->st_dev&0xff);
|
||||||
|
}
|
||||||
|
fprintf(outfile, "%4d: %s\t%s\t"
|
||||||
|
#if HAVE_STAT64
|
||||||
|
F_st64_ino
|
||||||
|
#else
|
||||||
|
F_st_ino
|
||||||
|
#endif /* HAVE_STAT64 */
|
||||||
|
"\t"F_mode"\t"F_st_nlink"\t"F_uid"\t"F_gid
|
||||||
|
#if HAVE_ST_RDEV
|
||||||
|
"\t%hu,%hu"
|
||||||
|
#endif
|
||||||
|
"\t"
|
||||||
|
#if HAVE_STAT64
|
||||||
|
F_st64_size
|
||||||
|
#else
|
||||||
|
F_st_size
|
||||||
|
#endif /* HAVE_STAT64 */
|
||||||
|
#if HAVE_ST_BLKSIZE
|
||||||
|
"\t"F_st_blksize
|
||||||
|
#endif
|
||||||
|
#if HAVE_ST_BLOCKS
|
||||||
|
#if HAVE_STAT64
|
||||||
|
"\t"F_st64_blocks
|
||||||
|
#else
|
||||||
|
"\t"F_st_blocks
|
||||||
|
#endif /* HAVE_STAT64 */
|
||||||
|
#endif
|
||||||
|
,
|
||||||
|
(dynfd>=0?dynfd:statfd), getfiletypestring(buf->st_mode),
|
||||||
|
stdevstr,
|
||||||
|
buf->st_ino,
|
||||||
|
buf->st_mode, buf->st_nlink, buf->st_uid,
|
||||||
|
buf->st_gid,
|
||||||
|
#if HAVE_ST_RDEV
|
||||||
|
(unsigned short)buf->st_rdev>>8, (unsigned short)buf->st_rdev&0xff,
|
||||||
|
#endif
|
||||||
|
buf->st_size
|
||||||
|
#if HAVE_ST_BLKSIZE
|
||||||
|
, buf->st_blksize
|
||||||
|
#endif
|
||||||
|
#if HAVE_ST_BLOCKS
|
||||||
|
, buf->st_blocks /* on Linux, this applies to stat and stat64 */
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
|
printtime(outfile, buf->st_atime);
|
||||||
|
printtime(outfile, buf->st_mtime);
|
||||||
|
printtime(outfile, buf->st_ctime);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
fputc('\t', outfile);
|
||||||
|
time = asctime(localtime(&buf->st_mtime));
|
||||||
|
if (strchr(time, '\n')) *strchr(time, '\n') = '\0';
|
||||||
|
fputs(time, outfile);
|
||||||
|
|
||||||
|
fputc('\t', outfile);
|
||||||
|
time = asctime(localtime(&buf->st_ctime));
|
||||||
|
if (strchr(time, '\n')) *strchr(time, '\n') = '\0';
|
||||||
|
fputs(time, outfile);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* here comes dynamic info - it is only meaningful with preexisting FDs */
|
||||||
|
if (dynfd >= 0) { /*!indent */
|
||||||
|
int cloexec, flags;
|
||||||
|
#if defined(F_GETOWN)
|
||||||
|
int sigown;
|
||||||
|
#endif
|
||||||
|
#if defined(F_GETSIG)
|
||||||
|
int sigio;
|
||||||
|
#endif /* defined(F_GETSIG) */
|
||||||
|
|
||||||
|
cloexec = Fcntl(dynfd, F_GETFD);
|
||||||
|
flags = Fcntl(dynfd, F_GETFL);
|
||||||
|
#if defined(F_GETOWN)
|
||||||
|
sigown = Fcntl(dynfd, F_GETOWN);
|
||||||
|
#endif
|
||||||
|
#if defined(F_GETSIG)
|
||||||
|
sigio = Fcntl(dynfd, F_GETSIG);
|
||||||
|
#endif /* defined(F_GETSIG) */
|
||||||
|
fprintf(outfile, "\t%d\tx%06x", cloexec, flags);
|
||||||
|
#if defined(F_GETOWN)
|
||||||
|
fprintf(outfile, "\t%d", sigown);
|
||||||
|
#endif
|
||||||
|
#if defined(F_GETSIG)
|
||||||
|
fprintf(outfile, "\t%d", sigio);
|
||||||
|
#endif /* defined(F_GETSIG) */
|
||||||
|
} else {
|
||||||
|
fputs("\t\t"
|
||||||
|
#if defined(F_GETOWN)
|
||||||
|
"\t"
|
||||||
|
#endif
|
||||||
|
#if defined(F_GETSIG)
|
||||||
|
"\t"
|
||||||
|
#endif /* defined(F_GETSIG) */
|
||||||
|
, outfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now see for type specific infos */
|
||||||
|
if (statfd >= 0) { /*!indent */
|
||||||
|
switch (buf->st_mode&S_IFMT) {
|
||||||
|
case (S_IFIFO): /* 1, FIFO */
|
||||||
|
break;
|
||||||
|
case (S_IFCHR): /* 2, character device */
|
||||||
|
result = cdevan(statfd, outfile);
|
||||||
|
break;
|
||||||
|
case (S_IFDIR): /* 4, directory */
|
||||||
|
break;
|
||||||
|
case (S_IFBLK): /* 6, block device */
|
||||||
|
break;
|
||||||
|
case (S_IFREG): /* 8, regular file */
|
||||||
|
break;
|
||||||
|
case (S_IFLNK): /* 10, symbolic link */
|
||||||
|
break;
|
||||||
|
#ifdef S_IFSOCK
|
||||||
|
case (S_IFSOCK): /* 12, socket */
|
||||||
|
#if WITH_SOCKET
|
||||||
|
result = sockan(statfd, outfile);
|
||||||
|
#else
|
||||||
|
Warn("SOCKET support not compiled in");
|
||||||
|
return -1;
|
||||||
|
#endif /* !WITH_SOCKET */
|
||||||
|
break;
|
||||||
|
#endif /* S_IFSOCK */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* ioctl() */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if LATER
|
||||||
|
int fdinfo(int fd) {
|
||||||
|
int result;
|
||||||
|
|
||||||
|
result = Fcntl(fd, F_GETFD);
|
||||||
|
fcntl(fd, F_GETFL, );
|
||||||
|
fcntl(fd, F_GETLK, );
|
||||||
|
#ifdef F_GETOWN
|
||||||
|
fcntl(fd, F_GETOWN, );
|
||||||
|
#endif
|
||||||
|
#ifdef F_GETSIG
|
||||||
|
fcntl(fd, F_GETSIG, );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int devinfo(int fd) {
|
||||||
|
ioctl();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* character device analysis */
|
||||||
|
int cdevan(int fd, FILE *outfile) {
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if ((ret = Isatty(fd)) < 0) {
|
||||||
|
Warn2("isatty(%d): %s", fd, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (ret > 0) {
|
||||||
|
struct termios termarg;
|
||||||
|
char *name;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((name = Ttyname(fd)) == NULL) {
|
||||||
|
/*Warn2("ttyname(%d): %s", fd, strerror(errno));*/
|
||||||
|
fputs("\tNULL", outfile);
|
||||||
|
} else {
|
||||||
|
fprintf(outfile, "\t%s", name);
|
||||||
|
}
|
||||||
|
if (Tcgetattr(fd, &termarg) < 0) {
|
||||||
|
Warn3("tcgetattr(%d, %p): %s", fd, &termarg, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fprintf(outfile, " \tIFLAGS=%08x OFLAGS=%08x CFLAGS=%08x LFLAGS=%08x",
|
||||||
|
termarg.c_iflag, termarg.c_oflag, termarg.c_cflag, termarg.c_lflag);
|
||||||
|
|
||||||
|
/* and the control characters */
|
||||||
|
if (filan_rawoutput) {
|
||||||
|
for (i=0; i<NCCS; ++i) {
|
||||||
|
fprintf(outfile, " cc[%d]=%d", i, termarg.c_cc[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (i=0; i<NCCS; ++i) {
|
||||||
|
int ch;
|
||||||
|
unsigned char s[4];
|
||||||
|
ch = termarg.c_cc[i];
|
||||||
|
if (isprint(ch)) {
|
||||||
|
s[0] = ch; s[1]= '\0';
|
||||||
|
} else if (ch < ' ') {
|
||||||
|
s[0] = '^'; s[1] = ch+'@'; s[2] = '\0';
|
||||||
|
} else {
|
||||||
|
s[0] = 'x';
|
||||||
|
s[1] = (ch>>4)>=10?(ch>>4)-10+'A':(ch>>4)+'0';
|
||||||
|
s[2] = (ch&0x0f)>=10?(ch&0x0f)-10+'A':(ch&0x0f)+'0';
|
||||||
|
s[3] = '\0';
|
||||||
|
}
|
||||||
|
fprintf(outfile, " cc[%d]=%s", i, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_SOCKET
|
||||||
|
int sockan(int fd, FILE *outfile) {
|
||||||
|
#define FILAN_OPTLEN 256
|
||||||
|
#define FILAN_NAMELEN 256
|
||||||
|
socklen_t optlen;
|
||||||
|
int result /*0, i*/;
|
||||||
|
static const char *socktypes[] = {
|
||||||
|
"undef", "STREAM", "DGRAM", "RAW", "RDM",
|
||||||
|
"SEQPACKET", "undef", "undef", "undef", "undef",
|
||||||
|
"PACKET", "undef" } ;
|
||||||
|
char nambuff[FILAN_NAMELEN];
|
||||||
|
/* in Linux these optcodes are 'enum', but on AIX they are bits! */
|
||||||
|
static const struct sockopt sockopts[] = {
|
||||||
|
{SO_DEBUG, "DEBUG"},
|
||||||
|
{SO_REUSEADDR, "REUSEADDR"},
|
||||||
|
{SO_TYPE, "TYPE"},
|
||||||
|
{SO_ERROR, "ERROR"},
|
||||||
|
{SO_DONTROUTE, "DONTROUTE"},
|
||||||
|
{SO_BROADCAST, "BROADCAST"},
|
||||||
|
{SO_SNDBUF, "SNDBUF"},
|
||||||
|
{SO_RCVBUF, "RCVBUF"},
|
||||||
|
{SO_KEEPALIVE, "KEEPALIVE"},
|
||||||
|
{SO_OOBINLINE, "OOBINLINE"},
|
||||||
|
#ifdef SO_NO_CHECK
|
||||||
|
{SO_NO_CHECK, "NO_CHECK"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_PRIORITY
|
||||||
|
{SO_PRIORITY, "PRIORITY"},
|
||||||
|
#endif
|
||||||
|
{SO_LINGER, "LINGER"},
|
||||||
|
#ifdef SO_BSDCOMPAT
|
||||||
|
{SO_BSDCOMPAT, "BSDCOMPAT"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_REUSEPORT
|
||||||
|
{SO_REUSEPORT, "REUSEPORT"},
|
||||||
|
#endif /* defined(SO_REUSEPORT) */
|
||||||
|
#ifdef SO_PASSCRED
|
||||||
|
{SO_PASSCRED, "PASSCRED"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_PEERCRED
|
||||||
|
{SO_PEERCRED, "PEERCRED"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_RCVLOWAT
|
||||||
|
{SO_RCVLOWAT, "RCVLOWAT"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_SNDLOWAT
|
||||||
|
{SO_SNDLOWAT, "SNDLOWAT"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_RCVTIMEO
|
||||||
|
{SO_RCVTIMEO, "RCVTIMEO"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_SNDTIMEO
|
||||||
|
{SO_SNDTIMEO, "SNDTIMEO"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_SECURITY_AUTHENTICATION
|
||||||
|
{SO_SECURITY_AUTHENTICATION, "SECURITY_AUTHENTICATION"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
|
||||||
|
{SO_SECURITY_ENCRYPTION_TRANSPORT, "SECURITY_ENCRYPTION_TRANSPORT"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_SECURITY_ENCRYPTION_NETWORK
|
||||||
|
{SO_SECURITY_ENCRYPTION_NETWORK, "SECURITY_ENCRYPTION_NETWORK"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_BINDTODEVICE
|
||||||
|
{SO_BINDTODEVICE, "BINDTODEVICE"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_ATTACH_FILTER
|
||||||
|
{SO_ATTACH_FILTER, "ATTACH_FILTER"},
|
||||||
|
#endif
|
||||||
|
#ifdef SO_DETACH_FILTER
|
||||||
|
{SO_DETACH_FILTER, "DETACH_FILTER"},
|
||||||
|
#endif
|
||||||
|
{0, NULL} } ;
|
||||||
|
char optval[FILAN_OPTLEN];
|
||||||
|
const struct sockopt *optname;
|
||||||
|
union sockaddr_union sockname, peername; /* the longest I know of */
|
||||||
|
socklen_t namelen;
|
||||||
|
#if 0 && defined(SIOCGIFNAME)
|
||||||
|
/*Linux struct ifreq ifc = {{{ 0 }}};*/
|
||||||
|
struct ifreq ifc = {{ 0 }};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
optlen = FILAN_OPTLEN;
|
||||||
|
result = Getsockopt(fd, SOL_SOCKET, SO_TYPE, optval, &optlen);
|
||||||
|
if (result < 0) {
|
||||||
|
Debug4("getsockopt(%d, SOL_SOCKET, SO_TYPE, %p, {"F_socklen"}): %s",
|
||||||
|
fd, optval, optlen, strerror(errno));
|
||||||
|
} else {
|
||||||
|
Debug3("fd %d: socket of type %d (\"%s\")", fd, *(int *)optval,
|
||||||
|
socktypes[*(int *)optval]);
|
||||||
|
}
|
||||||
|
|
||||||
|
optname = sockopts; while (optname->so) {
|
||||||
|
optlen = FILAN_OPTLEN;
|
||||||
|
result =
|
||||||
|
Getsockopt(fd, SOL_SOCKET, optname->so, (void *)optval, &optlen);
|
||||||
|
if (result < 0) {
|
||||||
|
Debug5("getsockopt(%d, SOL_SOCKET, %d, %p, {"F_socklen"}): %s",
|
||||||
|
fd, optname->so, optval, optlen, strerror(errno));
|
||||||
|
fputc('\t', outfile);
|
||||||
|
} else if (optlen == sizeof(int)) {
|
||||||
|
Debug2("getsockopt(,,, {%d}, %d)",
|
||||||
|
*(int *)optval, optlen);
|
||||||
|
/*Info2("%s: %d", optname->name, *(int *)optval);*/
|
||||||
|
fprintf(outfile, "%s=%d\t", optname->name, *(int *)optval);
|
||||||
|
} else {
|
||||||
|
Debug3("getsockopt(,,, {%d,%d}, %d)",
|
||||||
|
((int *)optval)[0], ((int *)optval)[1], optlen);
|
||||||
|
fprintf(outfile, "%s={%d,%d}\t", optname->name,
|
||||||
|
((int *)optval)[0], ((int *)optval)[1]);
|
||||||
|
}
|
||||||
|
++optname;
|
||||||
|
}
|
||||||
|
|
||||||
|
namelen = sizeof(sockname);
|
||||||
|
result = Getsockname(fd, (struct sockaddr *)&sockname, &namelen);
|
||||||
|
if (result < 0) {
|
||||||
|
putc('\n', outfile);
|
||||||
|
Warn2("getsockname(%d): %s", fd, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fputc('\t', outfile);
|
||||||
|
fputs(sockaddr_info((struct sockaddr *)&sockname, namelen, nambuff, sizeof(nambuff)),
|
||||||
|
outfile);
|
||||||
|
|
||||||
|
namelen = sizeof(peername);
|
||||||
|
result = Getpeername(fd, (struct sockaddr *)&peername, &namelen);
|
||||||
|
if (result < 0) {
|
||||||
|
putc('\n', outfile);
|
||||||
|
Warn2("getpeername(%d): %s", fd, strerror(errno));
|
||||||
|
} else {
|
||||||
|
/* only valid if getpeername() succeeded */
|
||||||
|
fputs(" <-> ", outfile);
|
||||||
|
fprintf(outfile, "%s\t",
|
||||||
|
sockaddr_info((struct sockaddr *)&peername, namelen,
|
||||||
|
nambuff, sizeof(nambuff)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0 && defined(SIOCGIFNAME)
|
||||||
|
if ((result = Ioctl(fd, SIOCGIFNAME, &ifc)) < 0) {
|
||||||
|
Warn3("ioctl(%d, SIOCGIFNAME, %p): %s", fd, &ifc, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile, "IFNAME=\"%s\"\t", ifc.ifr_name);
|
||||||
|
}
|
||||||
|
#endif /* SIOCGIFNAME */
|
||||||
|
|
||||||
|
switch (((struct sockaddr *)&sockname)->sa_family) {
|
||||||
|
#if WITH_UNIX
|
||||||
|
case AF_UNIX:
|
||||||
|
/* no options for unix domain sockets known yet -> no unixan() */
|
||||||
|
result = 0;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if WITH_IP4
|
||||||
|
case AF_INET:
|
||||||
|
result = ipan(fd, outfile);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if WITH_IP6
|
||||||
|
case AF_INET6:
|
||||||
|
result = ipan(fd, outfile);
|
||||||
|
result |= ip6an(fd, outfile);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
fputs("**** NO FURTHER ANALYSIS FOR THIS SOCKET TYPE IMPLEMENTED", outfile);
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
#undef FILAN_OPTLEN
|
||||||
|
#undef FILAN_NAMELEN
|
||||||
|
}
|
||||||
|
#endif /* WITH_SOCKET */
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_IP4 || WITH_IP6
|
||||||
|
/* prints the option values for the IP protocol and the IP based protocols */
|
||||||
|
/* no distinction between IP4 and IP6 yet */
|
||||||
|
int ipan(int fd, FILE *outfile) {
|
||||||
|
/* in Linux these optcodes are 'enum', but on AIX they are bits! */
|
||||||
|
static const struct sockopt ipopts[] = {
|
||||||
|
{IP_TOS, "IP_TOS"},
|
||||||
|
{IP_TTL, "IP_TTL"},
|
||||||
|
#ifdef IP_HDRINCL
|
||||||
|
{IP_HDRINCL, "IP_HDRINCL"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_OPTIONS
|
||||||
|
{IP_OPTIONS, "IP_OPTIONS"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_ROUTER_ALERT
|
||||||
|
{IP_ROUTER_ALERT, "IP_ROUTER_ALERT"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RECVOPTS
|
||||||
|
{IP_RECVOPTS, "IP_RECVOPTS"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RETOPTS
|
||||||
|
{IP_RETOPTS, "IP_RETOPTS"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_PKTINFO
|
||||||
|
{IP_PKTINFO, "IP_PKTINFO"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_PKTOPTIONS
|
||||||
|
{IP_PKTOPTIONS, "IP_PKTOPTIONS"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_MTU_DISCOVER
|
||||||
|
{IP_MTU_DISCOVER, "IP_MTU_DISCOVER"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RECVERR
|
||||||
|
{IP_RECVERR, "IP_RECVERR"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RECVTTL
|
||||||
|
{IP_RECVTTL, "IP_RECVTTL"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RECVTOS
|
||||||
|
{IP_RECVTOS, "IP_RECVTOS"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_MTU
|
||||||
|
{IP_MTU, "IP_MTU"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_FREEBIND
|
||||||
|
{IP_FREEBIND, "IP_FREEBIND"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_MULTICAST_TTL
|
||||||
|
{IP_MULTICAST_TTL, "IP_MULTICAST_TTL"},
|
||||||
|
#endif
|
||||||
|
#ifdef IP_MULTICAST_LOOP
|
||||||
|
{IP_MULTICAST_LOOP, "IP_MULTICAST_LOOP"},
|
||||||
|
#endif
|
||||||
|
{0, NULL} } ;
|
||||||
|
const struct sockopt *optname;
|
||||||
|
int opttype;
|
||||||
|
socklen_t optlen = sizeof(opttype);
|
||||||
|
|
||||||
|
optname = ipopts; while (optname->so) {
|
||||||
|
sockoptan(fd, optname, SOL_IP, outfile);
|
||||||
|
++optname;
|
||||||
|
}
|
||||||
|
/* want to pass the fd to the next layer protocol. dont know how to get the
|
||||||
|
protocol number from the fd? use TYPE to identify TCP. */
|
||||||
|
if (Getsockopt(fd, SOL_SOCKET, SO_TYPE, &opttype, &optlen) >= 0) {
|
||||||
|
switch (opttype) {
|
||||||
|
#if WITH_TCP
|
||||||
|
case SOCK_STREAM: tcpan(fd, outfile); break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* WITH_IP */
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_IP6
|
||||||
|
/* prints the option values for the IPv6 protocol */
|
||||||
|
int ip6an(int fd, FILE *outfile) {
|
||||||
|
static const struct sockopt ip6opts[] = {
|
||||||
|
#ifdef IPV6_V6ONLY
|
||||||
|
{IPV6_V6ONLY, "IPV6_V6ONLY"},
|
||||||
|
#endif
|
||||||
|
{0, NULL} } ;
|
||||||
|
const struct sockopt *optname;
|
||||||
|
|
||||||
|
optname = ip6opts; while (optname->so) {
|
||||||
|
sockoptan(fd, optname, SOL_IPV6, outfile);
|
||||||
|
++optname;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_TCP
|
||||||
|
int tcpan(int fd, FILE *outfile) {
|
||||||
|
static const struct sockopt tcpopts[] = {
|
||||||
|
#ifdef TCP_NODELAY
|
||||||
|
{ TCP_NODELAY, "TCP_NODELAY" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_MAXSEG
|
||||||
|
{ TCP_MAXSEG, "TCP_MAXSEG" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_STDURG
|
||||||
|
{ TCP_STDURG, "TCP_STDURG" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_RFC1323
|
||||||
|
{ TCP_RFC1323, "TCP_RFC1323" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_CORK
|
||||||
|
{ TCP_CORK, "TCP_CORK" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_KEEPIDLE
|
||||||
|
{ TCP_KEEPIDLE, "TCP_KEEPIDLE" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_KEEPINTVL
|
||||||
|
{ TCP_KEEPINTVL, "TCP_KEEPINTVL" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_KEEPCNT
|
||||||
|
{ TCP_KEEPCNT, "TCP_KEEPCNT" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_SYNCNT
|
||||||
|
{ TCP_SYNCNT, "TCP_SYNCNT" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_LINGER2
|
||||||
|
{ TCP_LINGER2, "TCP_LINGER2" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_DEFER_ACCEPT
|
||||||
|
{ TCP_DEFER_ACCEPT, "TCP_ACCEPT" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_WINDOW_CLAMP
|
||||||
|
{ TCP_WINDOW_CLAMP, "TCP_WINDOW_CLAMP" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_INFO
|
||||||
|
{ TCP_INFO, "TCP_INFO" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_QUICKACK
|
||||||
|
{ TCP_QUICKACK, "TCP_QUICKACK" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_MD5SIG
|
||||||
|
{ TCP_MD5SIG, "TCP_MD5SIG" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_NOOPT
|
||||||
|
{ TCP_NOOPT, "TCP_NOOPT" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_NOPUSH
|
||||||
|
{ TCP_NOPUSH, "TCP_NOPUSH" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_SACK_DISABLE
|
||||||
|
{ TCP_SACK_DISABLE, "TCP_SACK_DISABLE" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_SIGNATURE_ENABLE
|
||||||
|
{ TCP_SIGNATURE_ENABLE, "TCP_SIGNATURE_ENABLE" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_ABORT_THRESHOLD
|
||||||
|
{ TCP_ABORT_THRESHOLD, "TCP_ABORT_THRESHOLD" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_CONN_ABORT_THRESHOLD
|
||||||
|
{ TCP_CONN_ABORT_THRESHOLD, "TCP_CONN_ABORT_THRESHOLD" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_KEEPINIT
|
||||||
|
{ TCP_KEEPINIT, "TCP_KEEPINIT" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_PAWS
|
||||||
|
{ TCP_PAWS, "TCP_PAWS" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_SACKENA
|
||||||
|
{ TCP_SACKENA, "TCP_SACKENA" },
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_TSOPTENA
|
||||||
|
{ TCP_TSOPTENA, "TCP_TSOPTENA" },
|
||||||
|
#endif
|
||||||
|
{0, NULL}
|
||||||
|
} ;
|
||||||
|
const struct sockopt *optname;
|
||||||
|
|
||||||
|
optname = tcpopts; while (optname->so) {
|
||||||
|
sockoptan(fd, optname, SOL_TCP, outfile);
|
||||||
|
++optname;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* WITH_TCP */
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_SOCKET
|
||||||
|
int sockoptan(int fd, const struct sockopt *optname, int socklay, FILE *outfile) {
|
||||||
|
#define FILAN_OPTLEN 256
|
||||||
|
char optval[FILAN_OPTLEN];
|
||||||
|
socklen_t optlen;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
optlen = FILAN_OPTLEN;
|
||||||
|
result =
|
||||||
|
Getsockopt(fd, socklay, optname->so, (void *)optval, &optlen);
|
||||||
|
if (result < 0) {
|
||||||
|
Debug6("getsockopt(%d, %d, %d, %p, {"F_socklen"}): %s",
|
||||||
|
fd, socklay, optname->so, optval, optlen, strerror(errno));
|
||||||
|
fputc('\t', outfile);
|
||||||
|
return -1;
|
||||||
|
} else if (optlen == 0) {
|
||||||
|
Debug1("getsockopt(,,, {}, %d)", optlen);
|
||||||
|
fprintf(outfile, "%s=\"\"\t", optname->name);
|
||||||
|
} else if (optlen == sizeof(int)) {
|
||||||
|
Debug2("getsockopt(,,, {%d}, %d)",
|
||||||
|
*(int *)optval, optlen);
|
||||||
|
fprintf(outfile, "%s=%d\t", optname->name, *(int *)optval);
|
||||||
|
} else {
|
||||||
|
char outbuf[FILAN_OPTLEN*9+128], *cp = outbuf;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < optlen/sizeof(unsigned int); ++i) {
|
||||||
|
cp += sprintf(cp, "%08x ", ((unsigned int *)optval)[i]);
|
||||||
|
}
|
||||||
|
*--cp = '\0'; /* delete trailing space */
|
||||||
|
Debug2("getsockopt(,,, {%s}, %d)", outbuf, optlen);
|
||||||
|
fflush(outfile);
|
||||||
|
fprintf(outfile, "%s={%s}\t", optname->name, outbuf);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
#undef FILAN_OPTLEN
|
||||||
|
}
|
||||||
|
#endif /* WITH_SOCKET */
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_SOCKET
|
||||||
|
int isasocket(int fd) {
|
||||||
|
int retval;
|
||||||
|
#if HAVE_STAT64
|
||||||
|
struct stat64 props;
|
||||||
|
#else
|
||||||
|
struct stat props;
|
||||||
|
#endif /* HAVE_STAT64 */
|
||||||
|
retval =
|
||||||
|
#if HAVE_STAT64
|
||||||
|
Fstat64(fd, &props);
|
||||||
|
#else
|
||||||
|
Fstat(fd, &props);
|
||||||
|
#endif
|
||||||
|
if (retval < 0) {
|
||||||
|
Info3("fstat(%d, %p): %s", fd, &props, strerror(errno));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* note: when S_ISSOCK was undefined, it always gives 0 */
|
||||||
|
return S_ISSOCK(props.st_mode);
|
||||||
|
}
|
||||||
|
#endif /* WITH_SOCKET */
|
||||||
|
|
||||||
|
|
||||||
|
const char *getfiletypestring(int st_mode) {
|
||||||
|
const char *s;
|
||||||
|
|
||||||
|
switch (st_mode&S_IFMT) {
|
||||||
|
case S_IFIFO: s = "pipe"; break;
|
||||||
|
case S_IFCHR: s = "chrdev"; break;
|
||||||
|
case S_IFDIR: s = "dir"; break;
|
||||||
|
case S_IFBLK: s = "blkdev"; break;
|
||||||
|
case S_IFREG: s = "file"; break;
|
||||||
|
case S_IFLNK: s = "symlink"; break;
|
||||||
|
case S_IFSOCK: s = "socket"; break;
|
||||||
|
/*! AIX: MT? */
|
||||||
|
default: s = "undef"; break;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int printtime(FILE *outfile, time_t time) {
|
||||||
|
const char *s;
|
||||||
|
|
||||||
|
if (filan_rawoutput) {
|
||||||
|
fprintf(outfile, "\t"F_time, time);
|
||||||
|
} else {
|
||||||
|
fputc('\t', outfile);
|
||||||
|
s = asctime(localtime(&time));
|
||||||
|
if (strchr(s, '\n')) *strchr(s, '\n') = '\0';
|
||||||
|
fputs(s, outfile);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
38
filan.h
Normal file
38
filan.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/* $Id: filan.h,v 1.8 2007/03/06 21:19:18 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __filan_h_included
|
||||||
|
#define __filan_h_included 1
|
||||||
|
|
||||||
|
struct sockaddr; /* prevent gcc from spitting silly warning */
|
||||||
|
struct sockaddr_un; /* prevent gcc from spitting silly warning */
|
||||||
|
struct sockaddr_in; /* prevent gcc from spitting silly warning */
|
||||||
|
struct sockaddr_in6; /* prevent gcc from spitting silly warning */
|
||||||
|
|
||||||
|
extern bool filan_followsymlinks;
|
||||||
|
extern bool filan_rawoutput;
|
||||||
|
|
||||||
|
extern int filan_file(const char *filename, FILE *outfile);
|
||||||
|
extern int filan_fd(int fd, FILE *outfile);
|
||||||
|
extern int filan_stat(
|
||||||
|
#if HAVE_STAT64
|
||||||
|
struct stat64 *buf
|
||||||
|
#else
|
||||||
|
struct stat *buf
|
||||||
|
#endif /* !HAVE_STAT64 */
|
||||||
|
, int statfd, int dynfd, FILE *outfile);
|
||||||
|
|
||||||
|
extern int cdevan(int fd, FILE *outfile);
|
||||||
|
|
||||||
|
#if WITH_SOCKET
|
||||||
|
extern int isasocket(int fd);
|
||||||
|
extern int sockan(int fd, FILE *outfile);
|
||||||
|
extern int ipan(int fd, FILE *outfile);
|
||||||
|
extern int ip6an(int fd, FILE *outfile);
|
||||||
|
#endif /* WITH_SOCKET */
|
||||||
|
|
||||||
|
extern int fdname(const char *file, int fd, FILE *outfile);
|
||||||
|
|
||||||
|
#endif /* !defined(__filan_h_included) */
|
240
filan_main.c
Normal file
240
filan_main.c
Normal file
|
@ -0,0 +1,240 @@
|
||||||
|
/* $Id: filan_main.c,v 1.19 2006/07/12 21:59:15 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
const char copyright[] = "filan by Gerhard Rieger - see http://www.dest-unreach.org/socat/";
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "xioconfig.h"
|
||||||
|
#include "sysincludes.h"
|
||||||
|
|
||||||
|
#include "mytypes.h"
|
||||||
|
#include "compat.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "sycls.h"
|
||||||
|
#include "filan.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
|
||||||
|
static void filan_usage(FILE *fd);
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, const char *argv[]) {
|
||||||
|
const char **arg1, *a;
|
||||||
|
const char *filename = NULL, *waittimetxt;
|
||||||
|
unsigned int m = 0, n = 1024; /* this is default on my Linux */
|
||||||
|
unsigned int i;
|
||||||
|
int style = 0;
|
||||||
|
struct timespec waittime = { 0, 0 };
|
||||||
|
FILE *fdout = stdout;
|
||||||
|
const char *outfname = NULL;
|
||||||
|
unsigned long fildes;
|
||||||
|
|
||||||
|
diag_set('p', strchr(argv[0], '/') ? strrchr(argv[0], '/')+1 : argv[0]);
|
||||||
|
|
||||||
|
arg1 = argv+1; --argc;
|
||||||
|
while (arg1[0] && (arg1[0][0] == '-')) {
|
||||||
|
switch (arg1[0][1]) {
|
||||||
|
#if WITH_HELP
|
||||||
|
case '?': case 'h':
|
||||||
|
filan_usage(stdout); exit(0);
|
||||||
|
#endif
|
||||||
|
#if LATER
|
||||||
|
case 'V': filan_version(stdout); exit(0);
|
||||||
|
#endif
|
||||||
|
case 'L': filan_followsymlinks = true; break;
|
||||||
|
case 'd': diag_set('d', NULL); break;
|
||||||
|
case 's': style = 1; break;
|
||||||
|
case 'r': filan_rawoutput = true; break;
|
||||||
|
case 'i': if (arg1[0][2]) {
|
||||||
|
a = *arg1+2;
|
||||||
|
} else {
|
||||||
|
++arg1, --argc;
|
||||||
|
if ((a = *arg1) == NULL) {
|
||||||
|
Error("option -i requires an argument");
|
||||||
|
filan_usage(stderr); exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m = strtoul(a, (char **)&a, 0);
|
||||||
|
n = m+1;
|
||||||
|
break;
|
||||||
|
case 'n': if (arg1[0][2]) {
|
||||||
|
a = *arg1+2;
|
||||||
|
} else {
|
||||||
|
++arg1, --argc;
|
||||||
|
if ((a = *arg1) == NULL) {
|
||||||
|
Error("option -n requires an argument");
|
||||||
|
filan_usage(stderr); exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n = strtoul(a, (char **)&a, 0);
|
||||||
|
break;
|
||||||
|
case 'f': if (arg1[0][2]) {
|
||||||
|
filename = *arg1+2;
|
||||||
|
} else {
|
||||||
|
++arg1, --argc;
|
||||||
|
if ((filename = *arg1) == NULL) {
|
||||||
|
Error("option -f requires an argument");
|
||||||
|
filan_usage(stderr); exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'T': if (arg1[0][2]) {
|
||||||
|
waittimetxt = *arg1+2;
|
||||||
|
} else {
|
||||||
|
++arg1, --argc;
|
||||||
|
if ((waittimetxt = *arg1) == NULL) {
|
||||||
|
Error("option -T requires an argument");
|
||||||
|
filan_usage(stderr); exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
double waittimedbl;
|
||||||
|
waittimedbl = strtod(waittimetxt, NULL);
|
||||||
|
waittime.tv_sec = waittimedbl;
|
||||||
|
waittime.tv_nsec = (waittimedbl-waittime.tv_sec) * 1000000000;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'o': if (arg1[0][2]) {
|
||||||
|
outfname = *arg1+2;
|
||||||
|
} else {
|
||||||
|
++arg1, --argc;
|
||||||
|
if ((outfname = *arg1) == NULL) {
|
||||||
|
Error("option -o requires an argument");
|
||||||
|
filan_usage(stderr); exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '\0': break;
|
||||||
|
default:
|
||||||
|
diag_set_int('e', E_FATAL);
|
||||||
|
Error1("unknown option %s", arg1[0]);
|
||||||
|
#if WITH_HELP
|
||||||
|
filan_usage(stderr);
|
||||||
|
#endif
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
if (arg1[0][1] == '\0')
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
++arg1; --argc;
|
||||||
|
}
|
||||||
|
if (argc != 0) {
|
||||||
|
Error1("%d superfluous arguments", argc);
|
||||||
|
filan_usage(stderr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (outfname) {
|
||||||
|
// special cases
|
||||||
|
if (!strcmp(outfname,"stdin")) { fdout=stdin; }
|
||||||
|
else if (!strcmp(outfname,"stdout")) { fdout=stdout; }
|
||||||
|
else if (!strcmp(outfname,"stderr")) { fdout=stderr; }
|
||||||
|
// file descriptor
|
||||||
|
else if (*outfname == '+') {
|
||||||
|
a = outfname+1;
|
||||||
|
fildes = strtoul(a, (char **)&a, 0);
|
||||||
|
if ((fdout = fdopen(fildes, "w")) == NULL) {
|
||||||
|
Error2("can't fdopen file descriptor %lu: %s\n", fildes, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// file name
|
||||||
|
if ((fdout = fopen(outfname, "w")) == NULL) {
|
||||||
|
Error2("can't fopen '%s': %s\n",
|
||||||
|
outfname, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Nanosleep(&waittime, NULL);
|
||||||
|
|
||||||
|
if (style == 0) {
|
||||||
|
/* this style gives detailled infos, but requires a file descriptor */
|
||||||
|
if (filename) {
|
||||||
|
#if LATER /* this is just in case that S_ISSOCK does not work */
|
||||||
|
struct stat buf;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
if (Stat(filename, &buf) < 0) {
|
||||||
|
Error3("stat(\"%s\", %p): %s", filename, &buf, strerror(errno));
|
||||||
|
}
|
||||||
|
/* note: when S_ISSOCK was undefined, it always gives 0 */
|
||||||
|
if (S_ISSOCK(buf.st_mode)) {
|
||||||
|
Error("cannot analyze UNIX domain socket");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
filan_file(filename, fdout);
|
||||||
|
} else {
|
||||||
|
for (i = m; i < n; ++i) {
|
||||||
|
filan_fd(i, fdout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* this style gives only type and path / socket addresses, and works from
|
||||||
|
file descriptor or filename (with restrictions) */
|
||||||
|
if (filename) {
|
||||||
|
/* filename: NULL means yet unknown; "" means no name at all */
|
||||||
|
#if LATER
|
||||||
|
int fd;
|
||||||
|
if ((fd =
|
||||||
|
Open(filename, O_RDONLY|O_NOCTTY|O_NONBLOCK
|
||||||
|
#ifdef O_LARGEFILE
|
||||||
|
|O_LARGEFILE
|
||||||
|
#endif
|
||||||
|
, 0700))
|
||||||
|
< 0) {
|
||||||
|
Debug2("open(\"%s\", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0700): %s",
|
||||||
|
filename, strerror(errno));
|
||||||
|
}
|
||||||
|
fdname(filename, fd, fdout);
|
||||||
|
#endif
|
||||||
|
fdname(filename, -1, fdout);
|
||||||
|
} else {
|
||||||
|
for (i = m; i < n; ++i) {
|
||||||
|
fdname("", i, fdout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (outfname && fdout != stdout && fdout != stderr) {
|
||||||
|
fclose(fdout);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_HELP
|
||||||
|
static void filan_usage(FILE *fd) {
|
||||||
|
fputs(copyright, fd); fputc('\n', fd);
|
||||||
|
fputs("Analyze file descriptors of the process\n", fd);
|
||||||
|
fputs("Usage:\n", fd);
|
||||||
|
fputs("filan [options]\n", fd);
|
||||||
|
fputs(" options:\n", fd);
|
||||||
|
#if LATER
|
||||||
|
fputs(" -V print version information to stdout, and exit\n", fd);
|
||||||
|
#endif
|
||||||
|
#if WITH_HELP
|
||||||
|
fputs(" -?|-h print this help text\n", fd);
|
||||||
|
fputs(" -d increase verbosity (use up to 4 times)\n", fd);
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
fputs(" -ly[facility] log to syslog, using facility (default is daemon)\n", fd);
|
||||||
|
fputs(" -lf<logfile> log to file\n", fd);
|
||||||
|
fputs(" -ls log to stderr (default if no other log)\n", fd);
|
||||||
|
#endif
|
||||||
|
fputs(" -i<fdnum> only analyze this fd\n", fd);
|
||||||
|
fputs(" -n<fdnum> analyze all fds from 0 up to fdnum-1 (default: 1024)\n", fd);
|
||||||
|
fputs(" -s simple output with just type and socket address or path\n", fd);
|
||||||
|
/* fputs(" -c alternate device visualization\n", fd);*/
|
||||||
|
fputs(" -f<filename> analyze file system entry\n", fd);
|
||||||
|
fputs(" -T<seconds> wait before analyzing, useful to connect with debugger\n", fd);
|
||||||
|
fputs(" -r raw output for time stamps and rdev\n", fd);
|
||||||
|
fputs(" -L show symlink properties instead of following it\n", fd);
|
||||||
|
fputs(" -o<filename> output goes to filename, that can be:\n", fd);
|
||||||
|
fputs(" a regular file name, the output goes to that\n", fd);
|
||||||
|
fputs(" +<filedes> , output goes to the file descriptor (which must be open writable)\n", fd);
|
||||||
|
fputs(" the 3 special names stdin stdout and stderr\n", fd);
|
||||||
|
}
|
||||||
|
#endif /* WITH_HELP */
|
158
ftp.sh
Executable file
158
ftp.sh
Executable file
|
@ -0,0 +1,158 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# $Id: ftp.sh,v 1.11 2006/12/28 07:27:01 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2006
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# example how to write a shell script that communicates with stdio on the front
|
||||||
|
# end and with a socat address on the back end
|
||||||
|
|
||||||
|
# usage:
|
||||||
|
# ftp.sh [opts] server directory/ # show directory contents on stdout
|
||||||
|
# ftp.sh [opts] server file # print file contents to stdout
|
||||||
|
# opts:
|
||||||
|
# -socks socksserver # use given socks server, port 1080
|
||||||
|
# -proxy proxyserver # use given proxy server, port 8080
|
||||||
|
# # must be http proxy that accepts CONNECT
|
||||||
|
# # method to ports 21 and >=1024
|
||||||
|
# -user username # default: "ftp"
|
||||||
|
# -passwd password # default: "anonymous@domain.org"
|
||||||
|
# -t # shell script trace+debug
|
||||||
|
# -d # debug on control connection (use up to 4 times)
|
||||||
|
# -D # debug on data connection (use up to 4 times)
|
||||||
|
# -b # block size for data connection
|
||||||
|
# -v # verbose
|
||||||
|
# -l* # socat logging options
|
||||||
|
# example:
|
||||||
|
# ftp.sh -v -d -d -D -D -D -b 65536 -proxy proxy ftp.ftp.org /README >README
|
||||||
|
|
||||||
|
user="ftp"
|
||||||
|
passwd="anonymous@domain.org"
|
||||||
|
#method="socks4:socks" # socks4 is address spec, socks is socks server name
|
||||||
|
method=tcp
|
||||||
|
addropts=
|
||||||
|
|
||||||
|
# socat options
|
||||||
|
SO1=
|
||||||
|
SO2=
|
||||||
|
|
||||||
|
while :; do
|
||||||
|
case "$1" in
|
||||||
|
-socks|-socks4) shift;
|
||||||
|
case "$1" in
|
||||||
|
*:*) method="socks4:${1%%:*}"; addropts="socksport=${1#*:}" ;;
|
||||||
|
*) method="socks4:$1" ;;
|
||||||
|
esac ;;
|
||||||
|
-socks4a) shift;
|
||||||
|
case "$1" in
|
||||||
|
*:*) method="socks4a:${1%%:*}"; addropts="socksport=${1#*:}" ;;
|
||||||
|
*) method="socks4a:$1" ;;
|
||||||
|
esac ;;
|
||||||
|
-proxy) shift;
|
||||||
|
case "$1" in
|
||||||
|
*:*) method="proxy:${1%%:*}"; addropts="proxyport=${1#*:}" ;;
|
||||||
|
*) method="proxy:$1" ;;
|
||||||
|
esac ;;
|
||||||
|
-user) shift; user="$1" ;;
|
||||||
|
-passwd) shift; passwd="$1" ;;
|
||||||
|
-t) set -vx ;;
|
||||||
|
-d) SO1="$SO1 -d" ;;
|
||||||
|
-D) SO2="$SO2 -d" ;;
|
||||||
|
-b) SO2="$SO2 -b $2"; shift ;;
|
||||||
|
-v) SO1="$SO1 -v" ;;
|
||||||
|
-l*) SO1="$SO1 $1"; SO2="$SO2 $1" ;;
|
||||||
|
-*) echo "unknown option \"$1\"" >&2; exit 1;;
|
||||||
|
*) break ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
export SO2
|
||||||
|
|
||||||
|
server="$1"
|
||||||
|
dir="$2"
|
||||||
|
|
||||||
|
echo "addr=$method:$server:21,$addropts"; exit
|
||||||
|
|
||||||
|
### this is the central part to establish communication with socat ###
|
||||||
|
### copy these lines to make new communication shell scripts
|
||||||
|
TMPDIR=$(if [ -x /bin/mktemp ]; then
|
||||||
|
/bin/mktemp -d /tmp/$USER/FTPSH.XXXXXX
|
||||||
|
else
|
||||||
|
(umask 077; d=/tmp/$USER/FTPSH.$$; mkdir $d; echo $d)
|
||||||
|
fi)
|
||||||
|
TO="$TMPDIR/to"; FROM="$TMPDIR/from"
|
||||||
|
socat $SO1 fifo:$TO,nonblock,ignoreeof!!fifo:$FROM $method:$server:21,$addropts &
|
||||||
|
S1=$!
|
||||||
|
while ! [ -p "$TO" -a -p "$FROM" ]; do sleep 1; done
|
||||||
|
exec 4>$TMPDIR/to 3<$TMPDIR/from
|
||||||
|
trap "S1=" 17
|
||||||
|
#trap "echo cleaning up...>&2; rm -r $TMPDIR; [ -n "$S1" ] && kill $S1" 0 3
|
||||||
|
trap "rm -r $TMPDIR" 0 3
|
||||||
|
### here the central part ends
|
||||||
|
|
||||||
|
|
||||||
|
# this function waits for a complete server message, checks if its status
|
||||||
|
# is in the permitted range (terminates session if not), and returns.
|
||||||
|
ftp_chat () {
|
||||||
|
local cmd="$1"
|
||||||
|
local errlevel="$2"; [ -z "$errlevel" ] && errlevel=300
|
||||||
|
if [ -n "$cmd" ]; then echo "$cmd" >&4; fi
|
||||||
|
while read status message <&3;
|
||||||
|
( case "$status" in [0-9][0-9][0-9]-*) exit 0;; [0-9][0-9][0-9]*) exit 1;; *) exit 1;; esac )
|
||||||
|
do :; done
|
||||||
|
#echo "got \"$status $message\"" >&2
|
||||||
|
if [ -z "$status" ]; then echo ftp data connection failed >&2; exit; fi
|
||||||
|
if [ "$status" -ge "$errlevel" ]; then
|
||||||
|
echo $message >&2
|
||||||
|
echo "QUIT" >&4; exit 1
|
||||||
|
fi
|
||||||
|
set +vx
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# wait for server greeting
|
||||||
|
ftp_chat
|
||||||
|
|
||||||
|
ftp_chat "USER $user" 400
|
||||||
|
|
||||||
|
ftp_chat "PASS $passwd"
|
||||||
|
|
||||||
|
#ftp_chat "CWD $dir"
|
||||||
|
|
||||||
|
case "$dir" in
|
||||||
|
*/) ftp_chat "TYPE A" ;;
|
||||||
|
*) ftp_chat "TYPE I" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "PASV" >&4; read status message <&3
|
||||||
|
info=$(expr "$message" : '.*[^0-9]\([0-9]*,[0-9]*,[0-9]*,[0-9]*,[0-9]*,[0-9]*\).*')
|
||||||
|
echo $info |tr ',' ' ' |(read i1 i2 i3 i4 p1 p2
|
||||||
|
|
||||||
|
addr=$i1.$i2.$i3.$i4
|
||||||
|
port=$(echo "256*$p1+$p2" |bc)
|
||||||
|
#echo $addr:$port
|
||||||
|
|
||||||
|
trap : 20
|
||||||
|
# open data connection and transfer data
|
||||||
|
socat -u $SO2 $method:$server:$port,$addropts -
|
||||||
|
) &
|
||||||
|
S2=$!
|
||||||
|
|
||||||
|
case "$dir" in
|
||||||
|
*/) ftp_chat "NLST $dir" ;;
|
||||||
|
#*/) ftp_chat "LIST $dir" ;;
|
||||||
|
*) ftp_chat "RETR $dir" ;;
|
||||||
|
esac
|
||||||
|
case "$status" in
|
||||||
|
[45]*) kill $S2;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#echo "waiting for process $S2 to terminate" >&2
|
||||||
|
wait $S2
|
||||||
|
|
||||||
|
ftp_chat
|
||||||
|
|
||||||
|
ftp_chat "QUIT"
|
||||||
|
|
||||||
|
#echo "waiting for process $S1 to terminate" >&2
|
||||||
|
wait $S1
|
||||||
|
exit
|
172
gatherinfo.sh
Executable file
172
gatherinfo.sh
Executable file
|
@ -0,0 +1,172 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# $Id: gatherinfo.sh,v 1.12 2007/03/06 21:01:07 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001, 2002
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
#set -vx
|
||||||
|
|
||||||
|
# use this script after successful porting
|
||||||
|
# provide the platform name as argument with no dots, e.g. HPUX-11-0
|
||||||
|
# it generates the files:
|
||||||
|
# Config/Makefile.PLATFORM
|
||||||
|
# Config/config.PLATFORM.h
|
||||||
|
# Config/socat.PLATFORM.out
|
||||||
|
#
|
||||||
|
# Config/config.PLATFORM.log
|
||||||
|
# Config/compile.PLATFORM.log
|
||||||
|
# Config/test.PLATFORM.log
|
||||||
|
|
||||||
|
VERBOSE=
|
||||||
|
LOGGING=
|
||||||
|
INTERACTIVE=
|
||||||
|
CONFOPTS=
|
||||||
|
PLATFORM=
|
||||||
|
OUTPUT='>/dev/null'
|
||||||
|
|
||||||
|
# how to echo special characters?
|
||||||
|
if [ `echo "x\c"` = "x" ]; then E=""
|
||||||
|
elif [ `echo -e "x\c"` = "x" ]; then E="-e"
|
||||||
|
fi
|
||||||
|
|
||||||
|
while [ -n "$1" ]; do
|
||||||
|
case "$1" in
|
||||||
|
-v) VERBOSE=1; shift;; # tell about progress
|
||||||
|
-d) LOGGING=1; shift;; # show complete output
|
||||||
|
-i) INTERACTIVE=1; shift;; # diff and ask before overriding old files
|
||||||
|
-*) CONFOPTS="$CONFOPTS $1"; shift;;
|
||||||
|
*) PLATFORM="$1"; break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
#if [ -z "$PLATFORM" ]; then
|
||||||
|
# echo "please specify a configuration name, e.g. `uname -s`-`uname -r|tr '.' '-'`!" >&2; exit 1;
|
||||||
|
#fi
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo $E "usage: $0 [-v] [-i] [configure options ...] platform" >&2
|
||||||
|
echo $E "\t-v\t\tverbose (print actual command)" >&2
|
||||||
|
echo $E "\t-d\t\tdump command outputs" >&2
|
||||||
|
echo $E "\t-i\t\tinteractive (ask before overwriting something)" >&2
|
||||||
|
echo $E "\tconfigure options\toptions for configure script, e.g. --disable-ip6" >&2
|
||||||
|
echo $E "\tplatform\tdescribe your OS, e.g. `uname -s`-`uname -r|tr '.' '-'`" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$PLATFORM" in
|
||||||
|
*.*) echo "platform name must not contain '.'" >&2; exit 1;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
# now, lets begin!
|
||||||
|
|
||||||
|
if [ -f Makefile ]; then
|
||||||
|
COMMAND="make distclean"
|
||||||
|
[ "$VERBOSE" ] && echo "$COMMAND"
|
||||||
|
$COMMAND >/dev/null 2>&1 || echo "*** failed: $COMMAND" 1>&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# implicitly generates Makefile, config.h, config.log
|
||||||
|
COMMAND="./configure $CONFOPTS"
|
||||||
|
LOGFILE="compile.log"
|
||||||
|
[ "$VERBOSE" ] && echo "$COMMAND"
|
||||||
|
if [ "$LOGGING" ]; then
|
||||||
|
{ $COMMAND; echo "$?" >socat.rc; } 2>&1 |tee $LOGFILE;
|
||||||
|
if [ `cat socat.rc` -ne 0 ]; then echo "*** failed: $COMMAND" 1>&2; exit 1; fi
|
||||||
|
else
|
||||||
|
$COMMAND >$LOGFILE 2>&1 || { echo "*** failed: $COMMAND" 1>&2; exit 1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMMAND="make -k"
|
||||||
|
LOGFILE="compile.log"
|
||||||
|
[ "$VERBOSE" ] && echo "$COMMAND"
|
||||||
|
if [ "$LOGGING" ]; then
|
||||||
|
{ $COMMAND; echo "$?" >socat.rc; } 2>&1 |tee -a $LOGFILE;
|
||||||
|
if [ `cat socat.rc` -ne 0 ]; then echo "*** failed: $COMMAND" 1>&2; exit 1; fi
|
||||||
|
else
|
||||||
|
$COMMAND >>$LOGFILE 2>&1 || { echo "*** failed: $COMMAND" 1>&2; exit 1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
# generates socat.out
|
||||||
|
COMMAND="make info"
|
||||||
|
[ "$VERBOSE" ] && echo "$COMMAND"
|
||||||
|
$COMMAND >/dev/null || echo "*** failed: $COMMAND" 1>&2
|
||||||
|
|
||||||
|
COMMAND="./test.sh"
|
||||||
|
LOGFILE="test.log"
|
||||||
|
[ "$VERBOSE" ] && echo "$COMMAND"
|
||||||
|
if [ "$LOGGING" ]; then
|
||||||
|
{ $COMMAND; echo "$?" >socat.rc; } 2>&1 |tee $LOGFILE;
|
||||||
|
if [ `cat socat.rc` -ne 0 ]; then
|
||||||
|
echo "*** failed: $COMMAND" 1>&2
|
||||||
|
if [ `cat socat.rc` -ge 128 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
$COMMAND >$LOGFILE 2>&1 || echo "*** failed: $COMMAND" 1>&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILES=
|
||||||
|
|
||||||
|
b=Makefile; e=; f=$b; p=Config/$b.$PLATFORM
|
||||||
|
if [ "$INTERACTIVE" -a -f $p ]; then
|
||||||
|
if ! diff $p $f; then
|
||||||
|
cp -pi $f $p
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
cp -p $f $p
|
||||||
|
fi
|
||||||
|
FILES="$p"
|
||||||
|
|
||||||
|
b=config; e=h; f=$b.$e; p=Config/$b.$PLATFORM.$e
|
||||||
|
if [ "$INTERACTIVE" -a -f $p ]; then
|
||||||
|
if ! diff $p $f; then
|
||||||
|
cp -pi $f $p
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
cp -p $f $p
|
||||||
|
fi
|
||||||
|
FILES="$FILES $p"
|
||||||
|
|
||||||
|
b=socat; e=out; f=$b.$e; p=Config/$b.$PLATFORM.$e
|
||||||
|
if [ "$INTERACTIVE" -a -f $p ]; then
|
||||||
|
if ! diff $p $f; then
|
||||||
|
cp -pi $f $p
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
cp -p $f $p
|
||||||
|
fi
|
||||||
|
FILES="$FILES $p"
|
||||||
|
|
||||||
|
b=config; e=log; f=$b.$e; p=Config/$b.$PLATFORM.$e
|
||||||
|
if [ "$INTERACTIVE" -a -f $p ]; then
|
||||||
|
if ! diff $p $f; then
|
||||||
|
cp -pi $f $p
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
cp -p $f $p
|
||||||
|
fi
|
||||||
|
FILES="$FILES $p"
|
||||||
|
|
||||||
|
b=compile; e=log; f=$b.$e; p=Config/$b.$PLATFORM.$e
|
||||||
|
if [ "$INTERACTIVE" -a -f $p ]; then
|
||||||
|
if ! diff $p $f; then
|
||||||
|
cp -pi $f $p
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
cp -p $f $p
|
||||||
|
fi
|
||||||
|
FILES="$FILES $p"
|
||||||
|
|
||||||
|
b=test; e=log; f=$b.$e; p=Config/$b.$PLATFORM.$e
|
||||||
|
if [ "$INTERACTIVE" -a -f $p ]; then
|
||||||
|
if ! diff $p $f; then
|
||||||
|
cp -pi $f $p
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
cp -p $f $p
|
||||||
|
fi
|
||||||
|
FILES="$FILES $p"
|
||||||
|
|
||||||
|
echo "output files:"
|
||||||
|
echo "$FILES"
|
82
hostan.c
Normal file
82
hostan.c
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
/* $Id: hostan.c,v 1.2 2007/03/06 21:02:01 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2006-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* the subroutine hostan makes a "HOST ANalysis". It gathers information
|
||||||
|
about the host environment it is running in without modifying its state
|
||||||
|
(almost).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
#include "mytypes.h"
|
||||||
|
#include "compat.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "sycls.h"
|
||||||
|
#include "sysutils.h"
|
||||||
|
#include "filan.h"
|
||||||
|
|
||||||
|
#include "hostan.h"
|
||||||
|
|
||||||
|
static int iffan(FILE *outfile);
|
||||||
|
|
||||||
|
int hostan(FILE *outfile) {
|
||||||
|
#if WITH_SOCKET
|
||||||
|
iffan(outfile);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WITH_SOCKET
|
||||||
|
static int iffan(FILE *outfile) {
|
||||||
|
/* Linux: man 7 netdevice */
|
||||||
|
/* FreeBSD: man 4 networking */
|
||||||
|
/* Solaris: man 7 if_tcp */
|
||||||
|
|
||||||
|
/* currently we support Linux and a little FreeBSD */
|
||||||
|
#ifdef SIOCGIFCONF /* not Solaris */
|
||||||
|
#ifdef SIOCGIFINDEX /* not OpenBSD */
|
||||||
|
|
||||||
|
#define IFBUFSIZ 32*sizeof(struct ifreq) /*1024*/
|
||||||
|
int s;
|
||||||
|
unsigned char buff[IFBUFSIZ];
|
||||||
|
struct ifconf ic;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((s = Socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) {
|
||||||
|
Error1("socket(PF_INET, SOCK_DGRAM, IPPROTO_IP): %s", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i < IFBUFSIZ; ++i) {
|
||||||
|
buff[i] = 255;
|
||||||
|
}
|
||||||
|
ic.ifc_len = sizeof(buff);
|
||||||
|
ic.ifc_ifcu.ifcu_buf = (caddr_t)buff;
|
||||||
|
if (Ioctl(s, SIOCGIFCONF, &ic) < 0) {
|
||||||
|
Error3("ioctl(%d, SIOCGIFCONF, %p): %s", s, &ic, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < ic.ifc_len; i += sizeof(struct ifreq)) {
|
||||||
|
struct ifreq *ifp = (struct ifreq *)((caddr_t)ic.ifc_req + i);
|
||||||
|
struct ifreq ifr;
|
||||||
|
|
||||||
|
strcpy(ifr.ifr_name, ifp->ifr_name);
|
||||||
|
if (Ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
|
Error3("ioctl(%d, SIOCGIFINDEX, {\"%s\"}): %s",
|
||||||
|
s, &ifr.ifr_name, strerror(errno));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*fprintf(outfile, "%2d: %s\n", ifr.ifr_ifindex, ifp->ifr_ifrn.ifrn_name);*/
|
||||||
|
#if HAVE_STRUCT_IFREQ_IFR_INDEX
|
||||||
|
fprintf(outfile, "%2d: %s\n", ifr.ifr_index, ifp->ifr_name);
|
||||||
|
#elif HAVE_STRUCT_IFREQ_IFR_IFINDEX
|
||||||
|
fprintf(outfile, "%2d: %s\n", ifr.ifr_ifindex, ifp->ifr_name);
|
||||||
|
#endif /* HAVE_STRUCT_IFREQ_IFR_INDEX */
|
||||||
|
}
|
||||||
|
Close(s);
|
||||||
|
#endif /* defined(SIOCGIFCONF) */
|
||||||
|
#endif /* defined(SIOCGIFINDEX) */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* WITH_SOCKET */
|
10
hostan.h
Normal file
10
hostan.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* $Id: hostan.h,v 1.1 2006/12/31 17:49:25 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __hostan_h_included
|
||||||
|
#define __hostan_h_included 1
|
||||||
|
|
||||||
|
extern int hostan(FILE *outfile);
|
||||||
|
|
||||||
|
#endif /* !defined(__hostan_h_included) */
|
250
install-sh
Executable file
250
install-sh
Executable file
|
@ -0,0 +1,250 @@
|
||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# install - install a program, script, or datafile
|
||||||
|
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||||
|
#
|
||||||
|
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
|
# documentation for any purpose is hereby granted without fee, provided that
|
||||||
|
# the above copyright notice appear in all copies and that both that
|
||||||
|
# copyright notice and this permission notice appear in supporting
|
||||||
|
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||||
|
# publicity pertaining to distribution of the software without specific,
|
||||||
|
# written prior permission. M.I.T. makes no representations about the
|
||||||
|
# suitability of this software for any purpose. It is provided "as is"
|
||||||
|
# without express or implied warranty.
|
||||||
|
#
|
||||||
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||||
|
# `make' implicit rules from creating a file called install from it
|
||||||
|
# when there is no Makefile.
|
||||||
|
#
|
||||||
|
# This script is compatible with the BSD install script, but was written
|
||||||
|
# from scratch. It can only install one file at a time, a restriction
|
||||||
|
# shared with many OS's install programs.
|
||||||
|
|
||||||
|
|
||||||
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
|
doit="${DOITPROG-}"
|
||||||
|
|
||||||
|
|
||||||
|
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||||
|
|
||||||
|
mvprog="${MVPROG-mv}"
|
||||||
|
cpprog="${CPPROG-cp}"
|
||||||
|
chmodprog="${CHMODPROG-chmod}"
|
||||||
|
chownprog="${CHOWNPROG-chown}"
|
||||||
|
chgrpprog="${CHGRPPROG-chgrp}"
|
||||||
|
stripprog="${STRIPPROG-strip}"
|
||||||
|
rmprog="${RMPROG-rm}"
|
||||||
|
mkdirprog="${MKDIRPROG-mkdir}"
|
||||||
|
|
||||||
|
transformbasename=""
|
||||||
|
transform_arg=""
|
||||||
|
instcmd="$mvprog"
|
||||||
|
chmodcmd="$chmodprog 0755"
|
||||||
|
chowncmd=""
|
||||||
|
chgrpcmd=""
|
||||||
|
stripcmd=""
|
||||||
|
rmcmd="$rmprog -f"
|
||||||
|
mvcmd="$mvprog"
|
||||||
|
src=""
|
||||||
|
dst=""
|
||||||
|
dir_arg=""
|
||||||
|
|
||||||
|
while [ x"$1" != x ]; do
|
||||||
|
case $1 in
|
||||||
|
-c) instcmd="$cpprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-d) dir_arg=true
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-m) chmodcmd="$chmodprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-o) chowncmd="$chownprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-s) stripcmd="$stripprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
*) if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
src=$1
|
||||||
|
else
|
||||||
|
# this colon is to work around a 386BSD /bin/sh bug
|
||||||
|
:
|
||||||
|
dst=$1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no input file specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]; then
|
||||||
|
dst=$src
|
||||||
|
src=""
|
||||||
|
|
||||||
|
if [ -d $dst ]; then
|
||||||
|
instcmd=:
|
||||||
|
else
|
||||||
|
instcmd=mkdir
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||||
|
# might cause directories to be created, which would be especially bad
|
||||||
|
# if $src (and thus $dsttmp) contains '*'.
|
||||||
|
|
||||||
|
if [ -f $src -o -d $src ]
|
||||||
|
then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
echo "install: $src does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dst" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no destination specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If destination is a directory, append the input filename; if your system
|
||||||
|
# does not like double slashes in filenames, you may need to add some logic
|
||||||
|
|
||||||
|
if [ -d $dst ]
|
||||||
|
then
|
||||||
|
dst="$dst"/`basename $src`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
## this sed command emulates the dirname command
|
||||||
|
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||||
|
|
||||||
|
# Make sure that the destination directory exists.
|
||||||
|
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||||
|
|
||||||
|
# Skip lots of stat calls in the usual case.
|
||||||
|
if [ ! -d "$dstdir" ]; then
|
||||||
|
defaultIFS='
|
||||||
|
'
|
||||||
|
IFS="${IFS-${defaultIFS}}"
|
||||||
|
|
||||||
|
oIFS="${IFS}"
|
||||||
|
# Some sh's can't handle IFS=/ for some reason.
|
||||||
|
IFS='%'
|
||||||
|
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||||
|
IFS="${oIFS}"
|
||||||
|
|
||||||
|
pathcomp=''
|
||||||
|
|
||||||
|
while [ $# -ne 0 ] ; do
|
||||||
|
pathcomp="${pathcomp}${1}"
|
||||||
|
shift
|
||||||
|
|
||||||
|
if [ ! -d "${pathcomp}" ] ;
|
||||||
|
then
|
||||||
|
$mkdirprog "${pathcomp}"
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="${pathcomp}/"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]
|
||||||
|
then
|
||||||
|
$doit $instcmd $dst &&
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# If we're going to rename the final executable, determine the name now.
|
||||||
|
|
||||||
|
if [ x"$transformarg" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
dstfile=`basename $dst $transformbasename |
|
||||||
|
sed $transformarg`$transformbasename
|
||||||
|
fi
|
||||||
|
|
||||||
|
# don't allow the sed command to completely eliminate the filename
|
||||||
|
|
||||||
|
if [ x"$dstfile" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make a temp file name in the proper directory.
|
||||||
|
|
||||||
|
dsttmp=$dstdir/#inst.$$#
|
||||||
|
|
||||||
|
# Move or copy the file name to the temp name
|
||||||
|
|
||||||
|
$doit $instcmd $src $dsttmp &&
|
||||||
|
|
||||||
|
trap "rm -f ${dsttmp}" 0 &&
|
||||||
|
|
||||||
|
# and set any options; do chmod last to preserve setuid bits
|
||||||
|
|
||||||
|
# If any of these fail, we abort the whole thing. If we want to
|
||||||
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
|
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
|
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||||
|
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||||
|
|
||||||
|
fi &&
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
71
mail.sh
Executable file
71
mail.sh
Executable file
|
@ -0,0 +1,71 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# $Id: mail.sh,v 1.11 2005/09/10 16:48:38 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2001-2005
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
#set -vx
|
||||||
|
|
||||||
|
# This is an example for a shell script that can be fed to socat with exec.
|
||||||
|
# Its clue is that it does not use stdin/stdout for communication with socat,
|
||||||
|
# so you may feed the mail message via stdin to the script. The message should
|
||||||
|
# contain appropriate mail headers.
|
||||||
|
# Lines with only a dot are not permitted - use two dots as escape.
|
||||||
|
# This script supports multiline answers from server, but not much more yet.
|
||||||
|
|
||||||
|
# Usage: cat message.txt |socat exec:"mail.sh target@domain.com",fdin=3,fdout=4 tcp:mail.relay.org:25,crlf
|
||||||
|
|
||||||
|
while [ "$1" ]; do
|
||||||
|
case "$1" in
|
||||||
|
-f) shift; mailfrom="$1"; shift;;
|
||||||
|
*) break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
rcptto="$1"
|
||||||
|
[ -z "$1" ] && rcptto="root@loopback"
|
||||||
|
#server=$(expr "$rcptto" : '[^@]*@\(.*\)')
|
||||||
|
[ -z "$mailfrom" ] && mailfrom="$USER@$(hostname)"
|
||||||
|
|
||||||
|
# this function waits for a complete server message, checks if its status
|
||||||
|
# is in the permitted range (terminates session if not), and returns.
|
||||||
|
mail_chat () {
|
||||||
|
local cmd="$1"
|
||||||
|
local errlevel="$2"; [ -z "$errlevel" ] && errlevel=300
|
||||||
|
|
||||||
|
if [ "$cmd" ]; then echo "> $cmd" >&2; fi
|
||||||
|
if [ -n "$cmd" ]; then echo "$cmd" >&4; fi
|
||||||
|
while read status message <&3;
|
||||||
|
(
|
||||||
|
case "$status" in
|
||||||
|
[0-9][0-9][0-9]-*) exit 0;;
|
||||||
|
[0-9][0-9][0-9]*) exit 1;;
|
||||||
|
*) exit 1;;
|
||||||
|
esac
|
||||||
|
)
|
||||||
|
do :; done
|
||||||
|
if [ -z "$status" ]; then echo smtp connection failed >&2; exit; fi
|
||||||
|
echo "< $status $message" >&2
|
||||||
|
if [ "$status" -ge "$errlevel" ]; then
|
||||||
|
echo $message >&2
|
||||||
|
echo "QUIT" >&4; exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# expect server greeting
|
||||||
|
mail_chat
|
||||||
|
|
||||||
|
mail_chat "HELO $(hostname)"
|
||||||
|
|
||||||
|
mail_chat "MAIL FROM: $mailfrom"
|
||||||
|
|
||||||
|
mail_chat "RCPT TO: $rcptto"
|
||||||
|
|
||||||
|
mail_chat "DATA" 400
|
||||||
|
|
||||||
|
while read l; do echo "$l" >&4; done
|
||||||
|
mail_chat "."
|
||||||
|
|
||||||
|
mail_chat "QUIT"
|
||||||
|
|
||||||
|
exit 0
|
17
mytypes.h
Normal file
17
mytypes.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/* $Id: mytypes.h,v 1.4 2006/05/06 14:15:47 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __mytypes_h_included
|
||||||
|
#define __mytypes_h_included 1
|
||||||
|
|
||||||
|
/* some types and macros I miss in C89 */
|
||||||
|
|
||||||
|
typedef enum { false, true } bool;
|
||||||
|
|
||||||
|
#define Min(x,y) ((x)<=(y)?(x):(y))
|
||||||
|
#define Max(x,y) ((x)>=(y)?(x):(y))
|
||||||
|
|
||||||
|
#define SOCKADDR_MAX UNIX_PATH_MAX
|
||||||
|
|
||||||
|
#endif /* __mytypes_h_included */
|
237
nestlex.c
Normal file
237
nestlex.c
Normal file
|
@ -0,0 +1,237 @@
|
||||||
|
/* $Id: nestlex.c,v 1.4 2006/06/23 17:04:36 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* a function for lexical scanning of nested character patterns */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "mytypes.h"
|
||||||
|
|
||||||
|
#include "sysincludes.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* sub: scan a string and copy its value to output string
|
||||||
|
end scanning when an unescaped, unnested string from ends array is found
|
||||||
|
does not copy the end pattern
|
||||||
|
does not write a trailing \0 to token
|
||||||
|
allows escaping with \ and quoting (\ and quotes are removed)
|
||||||
|
allows nesting with div. parens
|
||||||
|
returns -1 if out string was too small
|
||||||
|
returns 1 if addr ended unexpectedly
|
||||||
|
returns 0 if token could be extracted successfully
|
||||||
|
*/
|
||||||
|
int nestlex(const char **addr, /* input string; aft points to end token */
|
||||||
|
char **token, /* output token; aft points to first unwritten
|
||||||
|
char (caller might want to set it to \0) */
|
||||||
|
size_t *len, /* remaining bytes in token space (incl. \0) */
|
||||||
|
const char *ends[], /* list of end strings */
|
||||||
|
const char *hquotes[],/* list of strings that quote (hard qu.) */
|
||||||
|
const char *squotes[],/* list of strings that quote softly */
|
||||||
|
const char *nests[],/* list of strings that start nesting;
|
||||||
|
every second one is matching end */
|
||||||
|
bool dropquotes, /* drop the outermost quotes */
|
||||||
|
bool c_esc, /* solve C char escapes: \n \t \0 etc */
|
||||||
|
bool html_esc /* solve HTML char escapes: %0d %08 etc */
|
||||||
|
) {
|
||||||
|
const char *in = *addr; /* pointer into input string */
|
||||||
|
const char **endx; /* loops over end patterns */
|
||||||
|
const char **quotx; /* loops over quote patterns */
|
||||||
|
const char **nestx; /* loops over nest patterns */
|
||||||
|
char *out = *token; /* pointer into output token */
|
||||||
|
char c;
|
||||||
|
int i;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
/* is this end of input string? */
|
||||||
|
if (*in == 0) {
|
||||||
|
|
||||||
|
break; /* end of string */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* first check the end patterns (e.g. for ']') */
|
||||||
|
endx = ends; i = 0;
|
||||||
|
while (*endx) {
|
||||||
|
if (!strncmp(in, *endx, strlen(*endx))) {
|
||||||
|
/* this end pattern matches */
|
||||||
|
*addr = in;
|
||||||
|
*token = out;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
++endx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check for hard quoting pattern */
|
||||||
|
quotx = hquotes;
|
||||||
|
while (hquotes && *quotx) {
|
||||||
|
if (!strncmp(in, *quotx, strlen(*quotx))) {
|
||||||
|
/* this quote pattern matches */
|
||||||
|
const char *endnest[2];
|
||||||
|
if (dropquotes) {
|
||||||
|
/* we strip this quote */
|
||||||
|
in += strlen(*quotx);
|
||||||
|
} else {
|
||||||
|
for (i = strlen(*quotx); i > 0; --i) {
|
||||||
|
*out++ = *in++;
|
||||||
|
if (--*len <= 0) { *addr = in; *token = out; return -1; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* we call nestlex recursively */
|
||||||
|
endnest[0] = *quotx;
|
||||||
|
endnest[1] = NULL;
|
||||||
|
result =
|
||||||
|
nestlex(&in, &out, len, endnest, NULL/*hquotes*/,
|
||||||
|
NULL/*squotes*/, NULL/*nests*/,
|
||||||
|
false, c_esc, html_esc);
|
||||||
|
if (result == 0 && dropquotes) {
|
||||||
|
/* we strip this quote */
|
||||||
|
in += strlen(*quotx);
|
||||||
|
} else {
|
||||||
|
/* we copy the trailing quote */
|
||||||
|
for (i = strlen(*quotx); i > 0; --i) {
|
||||||
|
*out++ = *in++;
|
||||||
|
if (--*len <= 0) { *addr = in; *token = out; return -1; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++quotx;
|
||||||
|
}
|
||||||
|
if (hquotes && *quotx != NULL) {
|
||||||
|
/* there was a quote; string might continue with hard quote */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check for soft quoting pattern */
|
||||||
|
quotx = squotes;
|
||||||
|
while (squotes && *quotx) {
|
||||||
|
if (!strncmp(in, *quotx, strlen(*quotx))) {
|
||||||
|
/* this quote pattern matches */
|
||||||
|
/* we strip this quote */
|
||||||
|
/* we call nestlex recursively */
|
||||||
|
const char *endnest[2];
|
||||||
|
if (dropquotes) {
|
||||||
|
/* we strip this quote */
|
||||||
|
in += strlen(*quotx);
|
||||||
|
} else {
|
||||||
|
for (i = strlen(*quotx); i > 0; --i) {
|
||||||
|
*out++ = *in++;
|
||||||
|
if (--*len <= 0) { *addr = in; *token = out; return -1; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endnest[0] = *quotx;
|
||||||
|
endnest[1] = NULL;
|
||||||
|
result =
|
||||||
|
nestlex(&in, &out, len, endnest, hquotes,
|
||||||
|
squotes, nests,
|
||||||
|
false, c_esc, html_esc);
|
||||||
|
|
||||||
|
if (result == 0 && dropquotes) {
|
||||||
|
/* we strip the trailing quote */
|
||||||
|
in += strlen(*quotx);
|
||||||
|
} else {
|
||||||
|
/* we copy the trailing quote */
|
||||||
|
for (i = strlen(*quotx); i > 0; --i) {
|
||||||
|
*out++ = *in++;
|
||||||
|
if (--*len <= 0) { *addr = in; *token = out; return -1; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++quotx;
|
||||||
|
}
|
||||||
|
if (squotes && *quotx != NULL) {
|
||||||
|
/* there was a soft quote; string might continue with any quote */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check patterns that start a nested clause */
|
||||||
|
nestx = nests; i = 0;
|
||||||
|
while (nests && *nestx) {
|
||||||
|
if (!strncmp(in, *nestx, strlen(*nestx))) {
|
||||||
|
/* this nest pattern matches */
|
||||||
|
const char *endnest[2];
|
||||||
|
endnest[0] = nestx[1];
|
||||||
|
endnest[1] = NULL;
|
||||||
|
|
||||||
|
for (i = strlen(nestx[1]); i > 0; --i) {
|
||||||
|
*out++ = *in++;
|
||||||
|
if (--*len <= 0) { *addr = in; *token = out; return -1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
result =
|
||||||
|
nestlex(&in, &out, len, endnest, hquotes, squotes, nests,
|
||||||
|
false, c_esc, html_esc);
|
||||||
|
if (result == 0) {
|
||||||
|
/* copy endnest */
|
||||||
|
i = strlen(nestx[1]); while (i > 0) {
|
||||||
|
*out++ = *in++;
|
||||||
|
if (--*len <= 0) {
|
||||||
|
*addr = in;
|
||||||
|
*token = out;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
nestx += 2; /* skip matching end pattern in table */
|
||||||
|
}
|
||||||
|
if (nests && *nestx) {
|
||||||
|
/* we handled a nested expression, continue loop */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* "normal" data, possibly escaped */
|
||||||
|
c = *in++;
|
||||||
|
if (c == '\\') {
|
||||||
|
/* found a plain \ escaped part */
|
||||||
|
c = *in++;
|
||||||
|
if (c == 0) { /* Warn("trailing '\\'");*/ break; }
|
||||||
|
if (c_esc) { /* solve C char escapes: \n \t \0 etc */
|
||||||
|
switch (c) {
|
||||||
|
case '0': c = '\0'; break;
|
||||||
|
case 'a': c = '\a'; break;
|
||||||
|
case 'b': c = '\b'; break;
|
||||||
|
case 'f': c = '\f'; break;
|
||||||
|
case 'n': c = '\n'; break;
|
||||||
|
case 'r': c = '\r'; break;
|
||||||
|
case 't': c = '\t'; break;
|
||||||
|
case 'v': c = '\v'; break;
|
||||||
|
#if LATER
|
||||||
|
case 'x': !!! 1 to 2 hex digits; break;
|
||||||
|
case 'u': !!! 4 hex digits?; break;
|
||||||
|
case 'U': !!! 8 hex digits?; break;
|
||||||
|
#endif
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*out++ = c;
|
||||||
|
--*len;
|
||||||
|
if (len == 0) {
|
||||||
|
*addr = in;
|
||||||
|
*token = out;
|
||||||
|
return -1; /* output overflow */
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* just a simple char */
|
||||||
|
*out++ = c;
|
||||||
|
--*len;
|
||||||
|
if (len == 0) {
|
||||||
|
*addr = in;
|
||||||
|
*token = out;
|
||||||
|
return -1; /* output overflow */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/* never come here? */
|
||||||
|
|
||||||
|
*addr = in;
|
||||||
|
*token = out;
|
||||||
|
return 0; /* OK */
|
||||||
|
}
|
23
nestlex.h
Normal file
23
nestlex.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/* $Id: nestlex.h,v 1.3 2006/06/23 17:04:39 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __nestlex_h_included
|
||||||
|
#define __nestlex_h_included 1
|
||||||
|
|
||||||
|
extern
|
||||||
|
int nestlex(const char **addr, /* input string; aft points to end token */
|
||||||
|
char **token, /* output token; aft points to first unwritten
|
||||||
|
char (caller might want to set it to \0) */
|
||||||
|
size_t *len, /* remaining bytes in token space (incl. \0) */
|
||||||
|
const char *ends[], /* list of end strings */
|
||||||
|
const char *hquotes[],/* list of strings that quote (hard qu.) */
|
||||||
|
const char *squotes[],/* list of strings that quote softly */
|
||||||
|
const char *nests[],/* list of strings that start nesting;
|
||||||
|
every second one is matching end */
|
||||||
|
bool dropquotes, /* drop the outermost quotes */
|
||||||
|
bool c_esc, /* solve C char escapes: \n \t \0 etc */
|
||||||
|
bool html_esc /* solve HTML char escapes: %0d %08 etc */
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif /* !defined(__nestlex_h_included) */
|
169
procan.c
Normal file
169
procan.c
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
/* $Id: procan.c,v 1.17 2006/12/28 07:25:01 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* the subroutine procan makes a "PROCess ANalysis". It gathers information
|
||||||
|
about the process environment it is running in without modifying its state
|
||||||
|
(almost).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
#include "mytypes.h"
|
||||||
|
#include "compat.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "sycls.h"
|
||||||
|
#include "sysutils.h"
|
||||||
|
#include "filan.h"
|
||||||
|
|
||||||
|
#include <sys/resource.h>
|
||||||
|
|
||||||
|
#include "procan.h"
|
||||||
|
|
||||||
|
/* dirty workaround so we dont get an error on AIX when getting linked with
|
||||||
|
libwrap */
|
||||||
|
int allow_severity, deny_severity;
|
||||||
|
|
||||||
|
|
||||||
|
int procan(FILE *outfile) {
|
||||||
|
|
||||||
|
/*filan(0, outfile);*/
|
||||||
|
|
||||||
|
/* controlling terminal */
|
||||||
|
fprintf(outfile, "process id = "F_pid"\n", Getpid());
|
||||||
|
fprintf(outfile, "process parent id = "F_pid"\n", Getppid());
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
if ((fd = Open("/dev/tty", O_NOCTTY, 0)) < 0) {
|
||||||
|
fprintf(outfile, "controlling terminal: -\n");
|
||||||
|
} else {
|
||||||
|
#if 1
|
||||||
|
fprintf(outfile, "controlling terminal: \"%s\"\n", Ttyname(fd));
|
||||||
|
#else
|
||||||
|
char procpath[PATH_MAX], devpath[PATH_MAX+1];
|
||||||
|
int devlen;
|
||||||
|
sprintf(procpath, "/proc/"F_pid"/fd/%d", Getpid(), 0 /*! fd*/);
|
||||||
|
if ((devlen = Readlink(procpath, devpath, sizeof(devpath))) < 0) {
|
||||||
|
;
|
||||||
|
} else {
|
||||||
|
devpath[devlen] = '\0';
|
||||||
|
fprintf(outfile, "controlling terminal: \"%s\"\n", devpath);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(outfile, "process group id = "F_pid"\n", Getpgrp());
|
||||||
|
#if HAVE_GETSID
|
||||||
|
fprintf(outfile, "process session id = "F_pid"\n", Getsid(0));
|
||||||
|
#endif
|
||||||
|
fprintf(outfile, "process group id if fg process / stdin = "F_pid"\n", Tcgetpgrp(0));
|
||||||
|
fprintf(outfile, "process group id if fg process / stdout = "F_pid"\n", Tcgetpgrp(1));
|
||||||
|
fprintf(outfile, "process group id if fg process / stderr = "F_pid"\n", Tcgetpgrp(2));
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
if ((fd = Open("/dev/tty", O_RDWR, 0600)) >= 0) {
|
||||||
|
fprintf(outfile, "process has a controlling terminal\n");
|
||||||
|
Close(fd);
|
||||||
|
} else {
|
||||||
|
fprintf(outfile, "process does not have a controlling terminal\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* process owner, groups */
|
||||||
|
fprintf(outfile, "user id = "F_uid"\n", Getuid());
|
||||||
|
fprintf(outfile, "effective user id = "F_uid"\n", Geteuid());
|
||||||
|
fprintf(outfile, "group id = "F_gid"\n", Getgid());
|
||||||
|
fprintf(outfile, "effective group id = "F_gid"\n", Getegid());
|
||||||
|
|
||||||
|
{
|
||||||
|
struct rlimit rlim;
|
||||||
|
|
||||||
|
fprintf(outfile, "\nRESOURCE LIMITS\n");
|
||||||
|
fprintf(outfile, "resource current maximum\n");
|
||||||
|
if (getrlimit(RLIMIT_CPU, &rlim) < 0) {
|
||||||
|
Warn2("getrlimit(RLIMIT_CPU, %p): %s", &rlim, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile,
|
||||||
|
"cpu time (seconds) %16"F_rlim_max"%16"F_rlim_max"\n",
|
||||||
|
rlim.rlim_cur, rlim.rlim_max);
|
||||||
|
}
|
||||||
|
if (getrlimit(RLIMIT_FSIZE, &rlim) < 0) {
|
||||||
|
Warn2("getrlimit(RLIMIT_FSIZE, %p): %s", &rlim, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile,
|
||||||
|
"file size (blocks) %16"F_rlim_max"%16"F_rlim_max"\n",
|
||||||
|
rlim.rlim_cur, rlim.rlim_max);
|
||||||
|
}
|
||||||
|
if (getrlimit(RLIMIT_DATA, &rlim) < 0) {
|
||||||
|
Warn2("getrlimit(RLIMIT_DATA, %p): %s", &rlim, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile,
|
||||||
|
"data seg size (kbytes) %16"F_rlim_max"%16"F_rlim_max"\n",
|
||||||
|
rlim.rlim_cur, rlim.rlim_max);
|
||||||
|
}
|
||||||
|
if (getrlimit(RLIMIT_STACK, &rlim) < 0) {
|
||||||
|
Warn2("getrlimit(RLIMIT_STACK, %p): %s", &rlim, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile,
|
||||||
|
"stack size (blocks) %16"F_rlim_max"%16"F_rlim_max"\n",
|
||||||
|
rlim.rlim_cur, rlim.rlim_max);
|
||||||
|
}
|
||||||
|
if (getrlimit(RLIMIT_CORE, &rlim) < 0) {
|
||||||
|
Warn2("getrlimit(RLIMIT_CORE, %p): %s", &rlim, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile,
|
||||||
|
"core file size (blocks) %16"F_rlim_max"%16"F_rlim_max"\n",
|
||||||
|
rlim.rlim_cur, rlim.rlim_max);
|
||||||
|
}
|
||||||
|
#ifdef RLIMIT_RSS /* Linux, AIX; not Cygwin */
|
||||||
|
if (getrlimit(RLIMIT_RSS, &rlim) < 0) {
|
||||||
|
Warn2("getrlimit(RLIMIT_RSS, %p): %s", &rlim, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile,
|
||||||
|
"max resident set size %16"F_rlim_max"%16"F_rlim_max"\n",
|
||||||
|
rlim.rlim_cur, rlim.rlim_max);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef RLIMIT_NPROC /* Linux, not AIX, Cygwin */
|
||||||
|
if (getrlimit(RLIMIT_NPROC, &rlim) < 0) {
|
||||||
|
Warn2("getrlimit(RLIMIT_NPROC, %p): %s", &rlim, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile,
|
||||||
|
"max user processes %16"F_rlim_max"%16"F_rlim_max"\n",
|
||||||
|
rlim.rlim_cur, rlim.rlim_max);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef RLIMIT_NOFILE /* not AIX 4.1 */
|
||||||
|
if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) {
|
||||||
|
Warn2("getrlimit(RLIMIT_NOFILE, %p): %s", &rlim, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile,
|
||||||
|
"open files %16"F_rlim_max"%16"F_rlim_max"\n",
|
||||||
|
rlim.rlim_cur, rlim.rlim_max);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef RLIMIT_MEMLOCK /* Linux, not AIX, Cygwin */
|
||||||
|
if (getrlimit(RLIMIT_MEMLOCK, &rlim) < 0) {
|
||||||
|
Warn2("getrlimit(RLIMIT_MEMLOCK, %p): %s", &rlim, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile,
|
||||||
|
"max locked-in-memory address space %16"F_rlim_max"%16"F_rlim_max"\n",
|
||||||
|
rlim.rlim_cur, rlim.rlim_max);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef RLIMIT_AS
|
||||||
|
if (getrlimit(RLIMIT_AS, &rlim) < 0) {
|
||||||
|
Warn2("getrlimit(RLIMIT_AS, %p): %s", &rlim, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fprintf(outfile,
|
||||||
|
"virtual memory (kbytes) %16"F_rlim_max"%16"F_rlim_max"\n",
|
||||||
|
rlim.rlim_cur, rlim.rlim_max);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* file descriptors */
|
||||||
|
|
||||||
|
/* what was this for?? */
|
||||||
|
/*Sleep(1);*/
|
||||||
|
return 0;
|
||||||
|
}
|
10
procan.h
Normal file
10
procan.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* $Id: procan.h,v 1.2 2001/06/30 14:02:39 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __procan_h_included
|
||||||
|
#define __procan_h_included 1
|
||||||
|
|
||||||
|
extern int procan(FILE *outfile);
|
||||||
|
|
||||||
|
#endif /* !defined(__procan_h_included) */
|
94
procan_main.c
Normal file
94
procan_main.c
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
/* $Id: procan_main.c,v 1.13 2007/03/06 21:19:18 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
const char copyright[] = "procan by Gerhard Rieger - send bug reports to socat@dest-unreach.org";
|
||||||
|
|
||||||
|
#include <stdlib.h> /* strtoul() */
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "mytypes.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "procan.h"
|
||||||
|
#include "hostan.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define WITH_HELP 1
|
||||||
|
|
||||||
|
static void procan_usage(FILE *fd);
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, const char *argv[]) {
|
||||||
|
const char **arg1;
|
||||||
|
#if 0
|
||||||
|
unsigned int n = 1024; /* this is default on my Linux */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
diag_set('p', strchr(argv[0], '/') ? strrchr(argv[0], '/')+1 : argv[0]);
|
||||||
|
|
||||||
|
arg1 = argv+1; --argc;
|
||||||
|
while (arg1[0] && (arg1[0][0] == '-')) {
|
||||||
|
switch (arg1[0][1]) {
|
||||||
|
#if WITH_HELP
|
||||||
|
case '?': case 'h': procan_usage(stdout); exit(0);
|
||||||
|
#endif /* WITH_HELP */
|
||||||
|
#if LATER
|
||||||
|
case 'V': procan_version(stdout); exit(0);
|
||||||
|
case 'l': diag_set(arg1[0][2], &arg1[0][3]); break;
|
||||||
|
case 'd': diag_set('d', NULL); break;
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
case 'n': n = strtoul(&arg1[0][2], NULL, 0); break;
|
||||||
|
#endif
|
||||||
|
case '\0': break;
|
||||||
|
default:
|
||||||
|
diag_set_int('e', E_FATAL);
|
||||||
|
Error1("unknown option \"%s\"", arg1[0]);
|
||||||
|
#if WITH_HELP
|
||||||
|
procan_usage(stderr);
|
||||||
|
#endif
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (arg1[0][1] == '\0')
|
||||||
|
break;
|
||||||
|
++arg1; --argc;
|
||||||
|
}
|
||||||
|
if (argc != 0) {
|
||||||
|
Error1("%d superfluous arguments", argc);
|
||||||
|
#if WITH_HELP
|
||||||
|
procan_usage(stderr);
|
||||||
|
#endif
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
procan(stdout);
|
||||||
|
hostan(stdout);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_HELP
|
||||||
|
static void procan_usage(FILE *fd) {
|
||||||
|
fputs(copyright, fd); fputc('\n', fd);
|
||||||
|
fputs("Analyze system parameters of process\n", fd);
|
||||||
|
fputs("Usage:\n", fd);
|
||||||
|
fputs("procan [options]\n", fd);
|
||||||
|
fputs(" options:\n", fd);
|
||||||
|
#if LATER
|
||||||
|
fputs(" -V print version information to stdout, and exit\n", fd);
|
||||||
|
#endif
|
||||||
|
#if WITH_HELP
|
||||||
|
fputs(" -?|-h print a help text describing command line options\n", fd);
|
||||||
|
#endif
|
||||||
|
#if LATER
|
||||||
|
fputs(" -d increase verbosity (use up to 4 times; 2 are recommended)\n", fd);
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
fputs(" -ly[facility] log to syslog, using facility (default is daemon)\n", fd);
|
||||||
|
fputs(" -lf<logfile> log to file\n", fd);
|
||||||
|
fputs(" -ls log to stderr (default if no other log)\n", fd);
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
fputs(" -n<fdnum> first file descriptor number not analyzed\n", fd);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif /* WITH_HELP */
|
76
proxy.sh
Executable file
76
proxy.sh
Executable file
|
@ -0,0 +1,76 @@
|
||||||
|
#! /bin/bash
|
||||||
|
# $Id: proxy.sh,v 1.3 2004/07/11 07:55:57 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2003-2004
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# perform primitive simulation of a proxy server.
|
||||||
|
# accepts and answers correct HTTP CONNECT requests on stdio, and tries to
|
||||||
|
# establish the connection to the given server.
|
||||||
|
# it is required for socats test.sh
|
||||||
|
# for TCP, use this script as:
|
||||||
|
# socat tcp-l:8080,reuseaddr,fork exec:"proxy.sh",nofork
|
||||||
|
|
||||||
|
if [ -z "$SOCAT" ]; then
|
||||||
|
if type socat >/dev/null 2>&1; then
|
||||||
|
SOCAT=socat
|
||||||
|
else
|
||||||
|
SOCAT="./socat"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $(echo "x\c") = "x" ]; then E=""
|
||||||
|
elif [ $(echo -e "x\c") = "x" ]; then E="-e"
|
||||||
|
else
|
||||||
|
echo "cannot suppress trailing newline on echo" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
ECHO="echo $E"
|
||||||
|
CR=$($ECHO "\r")
|
||||||
|
#echo "CR=$($ECHO "$CR\c" |od -c)" >&2
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
HP-UX|OSF1)
|
||||||
|
# their cats are too stupid to work with unix domain sockets
|
||||||
|
CAT="$SOCAT -u stdin stdout"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CAT=cat
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
SPACES=" "
|
||||||
|
while [ -n "$1" ]; do
|
||||||
|
case "$1" in
|
||||||
|
-w) n="$2"; while [ "$n" -gt 0 ]; do SPACES="$SPACES "; n=$((n-1)); done
|
||||||
|
shift ;;
|
||||||
|
#-s) STAT="$2"; shift ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# read and parse HTTP request
|
||||||
|
read l
|
||||||
|
if echo "$l" |egrep '^CONNECT +[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+ +HTTP/1.[01]' >/dev/null
|
||||||
|
then
|
||||||
|
: go on below
|
||||||
|
else
|
||||||
|
$ECHO "HTTP/1.0${SPACES}500 Bad Request$CR"
|
||||||
|
$ECHO "$CR"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# extract target server name/address
|
||||||
|
s=`echo $l |awk '{print($2);}'`
|
||||||
|
|
||||||
|
# read more headers until empty line
|
||||||
|
while [ "$l" != "$CR" ]; do
|
||||||
|
read l
|
||||||
|
done
|
||||||
|
|
||||||
|
# send status
|
||||||
|
$ECHO "HTTP/1.0${SPACES}200 OK$CR"
|
||||||
|
# send empty line
|
||||||
|
$ECHO "$CR"
|
||||||
|
|
||||||
|
# perform proxy (relay) function
|
||||||
|
exec $SOCAT $SOCAT_OPTS - tcp:$s
|
59
proxyecho.sh
Executable file
59
proxyecho.sh
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#! /bin/bash
|
||||||
|
# $Id: proxyecho.sh,v 1.5 2004/06/06 17:33:22 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2003
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# perform primitive simulation of a proxy server with echo function via stdio.
|
||||||
|
# accepts and answers correct HTTP CONNECT requests, but then just echoes data.
|
||||||
|
# it is required for test.sh
|
||||||
|
# for TCP, use this script as:
|
||||||
|
# socat tcp-l:8080,reuseaddr,crlf system:"proxyecho.sh"
|
||||||
|
|
||||||
|
if type socat >/dev/null 2>&1; then
|
||||||
|
SOCAT=socat
|
||||||
|
else
|
||||||
|
SOCAT=./socat
|
||||||
|
fi
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
HP-UX|OSF1)
|
||||||
|
CAT="$SOCAT -u stdin stdout"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CAT=cat
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
SPACES=" "
|
||||||
|
while [ -n "$1" ]; do
|
||||||
|
case "$1" in
|
||||||
|
-w) n="$2"; while [ "$n" -gt 0 ]; do SPACES="$SPACES "; n=$((n-1)); done
|
||||||
|
shift ;;
|
||||||
|
#-s) STAT="$2"; shift ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# read and parse HTTP request
|
||||||
|
read l
|
||||||
|
if echo "$l" |egrep '^CONNECT +[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+ +HTTP/1.[01]$' >/dev/null
|
||||||
|
then
|
||||||
|
: go on below
|
||||||
|
else
|
||||||
|
echo "HTTP/1.0${SPACES}500 Bad Request"
|
||||||
|
echo
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# read more headers until empty line
|
||||||
|
while [ -n "$l" ]; do
|
||||||
|
read l
|
||||||
|
done
|
||||||
|
|
||||||
|
# send status
|
||||||
|
echo "HTTP/1.0${SPACES}200 OK"
|
||||||
|
# send empty line
|
||||||
|
echo
|
||||||
|
|
||||||
|
# perform echo function
|
||||||
|
$CAT
|
46
readline-test.sh
Executable file
46
readline-test.sh
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#! /bin/bash
|
||||||
|
# $Id: readline-test.sh,v 1.1 2003/12/23 21:28:12 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2003
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# script that simulates a simple program with authentication.
|
||||||
|
# is just for testing the readline features
|
||||||
|
# perform the test with something like:
|
||||||
|
# ./socat readline,history=$HOME/.history,noecho='^Password: ' system:./readline-test.sh,pty,setsid,ctty,stderr,sigint,sigquit,echo=0,raw
|
||||||
|
|
||||||
|
|
||||||
|
BANNER='readline feature test program'
|
||||||
|
USERPROMPT='Authentication required\nUsername: '
|
||||||
|
PWDPROMPT='Password: '
|
||||||
|
PROMPT='prog> '
|
||||||
|
|
||||||
|
# degenerated user database
|
||||||
|
CREDUSER="user"
|
||||||
|
CREDPASS="password"
|
||||||
|
|
||||||
|
if [ $(echo "x\c") = "x" ]; then ECHO="echo"
|
||||||
|
elif [ $(echo -e "x\c") = "x" ]; then ECHO="echo -e"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#trap "$ECHO $0 got SIGINT" INT
|
||||||
|
trap "$ECHO $0 got SIGINT" INT
|
||||||
|
trap "$ECHO $0 got SIGQUIT" QUIT
|
||||||
|
|
||||||
|
# print banner
|
||||||
|
$ECHO "$BANNER"
|
||||||
|
|
||||||
|
read -r -p "$($ECHO "$USERPROMPT")" USERNAME
|
||||||
|
read -rs -p "$PWDPROMPT" PASSWORD
|
||||||
|
$ECHO
|
||||||
|
|
||||||
|
if [ "$USERNAME" != "$CREDUSER" -o "$PASSWORD" != "$CREDPASS" ]; then
|
||||||
|
$ECHO "Authentication failed" >&2
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r -p "$PROMPT" COMMAND; do
|
||||||
|
if [ "$COMMAND" = "exit" ]; then
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
$ECHO "executing $COMMAND"
|
||||||
|
done
|
30
readline.sh
Executable file
30
readline.sh
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#! /bin/bash
|
||||||
|
# $Id: readline.sh,v 1.3 2004/08/25 15:52:59 gerhard Exp $
|
||||||
|
# Copyright Gerhard Rieger 2003-2004
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# this is an attempt for a socat based readline wrapper
|
||||||
|
# usage: readline.sh <command>
|
||||||
|
|
||||||
|
withhistfile=1
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
case "X$1" in
|
||||||
|
X-nh|X-nohist*) withhistfile=; shift; continue ;;
|
||||||
|
*) break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
PROGRAM="$@"
|
||||||
|
if [ "$withhistfile" ]; then
|
||||||
|
HISTFILE="$HOME/.$1_history"
|
||||||
|
HISTOPT=",history=$HISTFILE"
|
||||||
|
else
|
||||||
|
HISTOPT=
|
||||||
|
fi
|
||||||
|
mkdir -p /tmp/$USER || exit 1
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
exec socat -d readline"$HISTOPT",noecho='[Pp]assword:' exec:"$PROGRAM",sigint,pty,setsid,ctty,raw,echo=0,stderr 2>/tmp/$USER/stderr2
|
||||||
|
|
52
socat.spec
Normal file
52
socat.spec
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
%define majorver 1.6
|
||||||
|
%define minorver 0.0
|
||||||
|
|
||||||
|
Summary: socat - multipurpose relay
|
||||||
|
Name: socat
|
||||||
|
Version: %{majorver}.%{minorver}
|
||||||
|
Release: 1
|
||||||
|
Copyright: GPL
|
||||||
|
Group: Applications/Communications
|
||||||
|
Source0: http://www.dest-unreach.org/socat/download/socat-%{version}.tar.gz
|
||||||
|
Requires: readline
|
||||||
|
Requires: openssl
|
||||||
|
BuildRoot: /var/tmp/%{name}-buildroot
|
||||||
|
|
||||||
|
%description
|
||||||
|
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.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -n %{name}-%{majorver}
|
||||||
|
|
||||||
|
%build
|
||||||
|
# the CPPFLAGS setting is required for RedHat Linux
|
||||||
|
if [ -d /usr/kerberos/include ]; then
|
||||||
|
CPPFLAGS="-I/usr/kerberos/include" ./configure --prefix=%{_prefix} --mandir=%{_mandir}
|
||||||
|
else
|
||||||
|
./configure --prefix=%{_prefix} --mandir=%{_mandir}
|
||||||
|
fi
|
||||||
|
make
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{_bindir}
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
|
||||||
|
|
||||||
|
make install DESTDIR=$RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%doc README CHANGES EXAMPLES SECURITY xio.help socat.html FAQ BUGREPORTS
|
||||||
|
%doc COPYING COPYING.OpenSSL FILES PORTING DEVELOPMENT
|
||||||
|
%{_bindir}/socat
|
||||||
|
%{_bindir}/procan
|
||||||
|
%{_bindir}/filan
|
||||||
|
%{_mandir}/man1/socat.1*
|
114
socks4a-echo.sh
Executable file
114
socks4a-echo.sh
Executable file
|
@ -0,0 +1,114 @@
|
||||||
|
#! /bin/bash
|
||||||
|
# $Id: socks4a-echo.sh,v 1.2 2004/08/25 16:01:30 gerhard Exp $
|
||||||
|
#set -vx
|
||||||
|
|
||||||
|
# Copyright Gerhard Rieger 2004
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# perform primitive simulation of a socks4a server with echo function via stdio.
|
||||||
|
# accepts and answers correct SOCKS4a requests, but then just echoes data.
|
||||||
|
# it is required for test.sh
|
||||||
|
# for TCP, use this script as:
|
||||||
|
# socat tcp-l:1080,reuseaddr,crlf system:"socks4a-echo.sh"
|
||||||
|
|
||||||
|
# older bash and ksh do not have -n option to read command; we try dd then
|
||||||
|
if echo a |read -n 1 null >/dev/null 2>&1; then
|
||||||
|
HAVE_READ_N=1
|
||||||
|
else
|
||||||
|
HAVE_READ_N=
|
||||||
|
fi
|
||||||
|
|
||||||
|
if type socat >/dev/null 2>&1; then
|
||||||
|
SOCAT=socat
|
||||||
|
else
|
||||||
|
SOCAT=./socat
|
||||||
|
fi
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
HP-UX|OSF1)
|
||||||
|
CAT="$SOCAT -u stdin stdout"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CAT=cat
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ $(echo "x\c") = "x" ]; then E=""
|
||||||
|
elif [ $(echo -e "x\c") = "x" ]; then E="-e"
|
||||||
|
else
|
||||||
|
echo "cannot suppress trailing newline on echo" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
ECHO="echo $E"
|
||||||
|
|
||||||
|
if [ $($ECHO "\0101") = "A" ]; then
|
||||||
|
SOCKSREPLY_FAILED="\0\0133\0\0\0\0\0\0\c"
|
||||||
|
SOCKSREPLY_OK="\0\0132\0\0\0\0\0\0\c"
|
||||||
|
else
|
||||||
|
SOCKSREPLY_FAILED="\0\133\0\0\0\0\0\0\c"
|
||||||
|
SOCKSREPLY_OK="\0\132\0\0\0\0\0\0\c"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# read and parse SOCKS4a header
|
||||||
|
if [ "$HAVE_READ_N" ]; then
|
||||||
|
read -r -n 1 vn # bash 2.0.3 does not support -n
|
||||||
|
else
|
||||||
|
vn=$(dd bs=1 count=1 2>/dev/null)
|
||||||
|
fi
|
||||||
|
if [ "$vn" != $($ECHO "\04") ]; then
|
||||||
|
$ECHO "$SOCKSREPLY_FAILED"
|
||||||
|
echo "invalid socks version requested" >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$HAVE_READ_N" ]; then
|
||||||
|
read -r -n 1 cd
|
||||||
|
else
|
||||||
|
cd=$(dd bs=1 count=1 2>/dev/null)
|
||||||
|
fi
|
||||||
|
if [ "$cd" != $($ECHO "\01") ]; then
|
||||||
|
$ECHO "$SOCKSREPLY_FAILED"
|
||||||
|
echo "invalid socks operation requested" >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
a=$(dd bs=1 count=6 2>/dev/null)
|
||||||
|
#echo a a a >/dev/tty
|
||||||
|
#echo "$a" |od -c >/dev/tty
|
||||||
|
#$ECHO "$a" |od -c >/dev/tty
|
||||||
|
#echo>/dev/tty
|
||||||
|
#echo a a a >/dev/tty
|
||||||
|
if [ "$a" != "$($ECHO "}m\0\0\0\01")" ]; then
|
||||||
|
sleep 1
|
||||||
|
$ECHO "$SOCKSREPLY_FAILED"
|
||||||
|
echo "wrong socks address or port requested" >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$HAVE_READ_N" ]; then
|
||||||
|
read -r -n 7 u
|
||||||
|
else
|
||||||
|
u=$(dd bs=1 count=7 2>/dev/null)
|
||||||
|
fi
|
||||||
|
if [ "$u" != "nobody" ]; then
|
||||||
|
$ECHO "$SOCKSREPLY_FAILED"
|
||||||
|
echo "wrong socks user requested" >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$HAVE_READ_N" ]; then
|
||||||
|
read -r -n 10 h
|
||||||
|
else
|
||||||
|
h=$(dd bs=1 count=10 2>/dev/null)
|
||||||
|
fi
|
||||||
|
if [ "$h" != "localhost" ]; then
|
||||||
|
$ECHO "$SOCKSREPLY_FAILED"
|
||||||
|
echo "wrong socks address requested" >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# send ok status
|
||||||
|
$ECHO "$SOCKSREPLY_OK"
|
||||||
|
|
||||||
|
# perform echo function
|
||||||
|
$CAT
|
101
socks4echo.sh
Executable file
101
socks4echo.sh
Executable file
|
@ -0,0 +1,101 @@
|
||||||
|
#! /bin/bash
|
||||||
|
# $Id: socks4echo.sh,v 1.4 2006/03/21 18:48:53 gerhard Exp $
|
||||||
|
|
||||||
|
# Copyright Gerhard Rieger 2004-2006
|
||||||
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
||||||
|
# perform primitive simulation of a socks4 server with echo function via stdio.
|
||||||
|
# accepts and answers correct SOCKS4 requests, but then just echoes data.
|
||||||
|
# it is required for test.sh
|
||||||
|
# for TCP, use this script as:
|
||||||
|
# socat tcp-l:1080,reuseaddr,crlf system:"socks4echo.sh"
|
||||||
|
|
||||||
|
# older bash and ksh do not have -n option to read command; we try dd then
|
||||||
|
if echo a |read -n 1 null >/dev/null 2>&1; then
|
||||||
|
HAVE_READ_N=1
|
||||||
|
else
|
||||||
|
HAVE_READ_N=
|
||||||
|
fi
|
||||||
|
|
||||||
|
if type socat >/dev/null 2>&1; then
|
||||||
|
SOCAT=socat
|
||||||
|
else
|
||||||
|
SOCAT=./socat
|
||||||
|
fi
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
HP-UX|OSF1)
|
||||||
|
CAT="$SOCAT -u stdin stdout"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CAT=cat
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ $(echo "x\c") = "x" ]; then E=""
|
||||||
|
elif [ $(echo -e "x\c") = "x" ]; then E="-e"
|
||||||
|
else
|
||||||
|
echo "cannot suppress trailing newline on echo" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
ECHO="echo $E"
|
||||||
|
|
||||||
|
if [ $($ECHO "\0101") = "A" ]; then
|
||||||
|
SOCKSREPLY_FAILED="\0\0133\0\0\0\0\0\0\c"
|
||||||
|
SOCKSREPLY_OK="\0\0132\0\0\0\0\0\0\c"
|
||||||
|
else
|
||||||
|
SOCKSREPLY_FAILED="\0\133\0\0\0\0\0\0\c"
|
||||||
|
SOCKSREPLY_OK="\0\132\0\0\0\0\0\0\c"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# read and parse SOCKS4 header
|
||||||
|
if [ "$HAVE_READ_N" ]; then
|
||||||
|
read -r -n 1 vn # bash 2.0.3 does not support -n
|
||||||
|
else
|
||||||
|
vn=$(dd bs=1 count=1 2>/dev/null)
|
||||||
|
fi
|
||||||
|
if [ "$vn" != $($ECHO "\04") ]; then
|
||||||
|
$ECHO "$SOCKSREPLY_FAILED"
|
||||||
|
echo "invalid socks version requested" >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$HAVE_READ_N" ]; then
|
||||||
|
read -r -n 1 cd
|
||||||
|
else
|
||||||
|
cd=$(dd bs=1 count=1 2>/dev/null)
|
||||||
|
fi
|
||||||
|
if [ "$cd" != $($ECHO "\01") ]; then
|
||||||
|
$ECHO "$SOCKSREPLY_FAILED"
|
||||||
|
echo "invalid socks operation requested" >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$HAVE_READ_N" ]; then
|
||||||
|
read -r -n 6 a
|
||||||
|
else
|
||||||
|
a=$(dd bs=1 count=6 2>/dev/null)
|
||||||
|
fi
|
||||||
|
if [ "$a" != "$($ECHO "}m bL6")" ]; then
|
||||||
|
$ECHO "$SOCKSREPLY_FAILED"
|
||||||
|
echo "$0: wrong socks address or port requested" >&2
|
||||||
|
echo "$0: expected $($ECHO "}m bL6"|od -t x1), received $($ECHO "$a"|od -t x1)" >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$HAVE_READ_N" ]; then
|
||||||
|
read -r -n 7 u
|
||||||
|
else
|
||||||
|
u=$(dd bs=1 count=7 2>/dev/null)
|
||||||
|
fi
|
||||||
|
if [ "$u" != "nobody" ]; then
|
||||||
|
$ECHO "$SOCKSREPLY_FAILED"
|
||||||
|
echo "wrong socks user requested" >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# send ok status
|
||||||
|
$ECHO "$SOCKSREPLY_OK"
|
||||||
|
|
||||||
|
# perform echo function
|
||||||
|
$CAT
|
318
sslcls.c
Normal file
318
sslcls.c
Normal file
|
@ -0,0 +1,318 @@
|
||||||
|
/* $Id: sslcls.c,v 1.8 2007/02/26 21:30:58 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* explicit system call and C library trace function, for those who miss strace
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "xioconfig.h" /* what features are enabled */
|
||||||
|
|
||||||
|
#if WITH_SYCLS && WITH_OPENSSL
|
||||||
|
|
||||||
|
#include "sysincludes.h"
|
||||||
|
|
||||||
|
#include "mytypes.h"
|
||||||
|
#include "compat.h"
|
||||||
|
#include "errno.h"
|
||||||
|
|
||||||
|
#include "error.h"
|
||||||
|
#include "filan.h"
|
||||||
|
#include "sysutils.h"
|
||||||
|
#include "sycls.h"
|
||||||
|
|
||||||
|
void sycSSL_load_error_strings(void) {
|
||||||
|
Debug("SSL_load_error_strings()");
|
||||||
|
SSL_load_error_strings();
|
||||||
|
Debug("SSL_load_error_strings() ->");
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_library_init(void) {
|
||||||
|
int result;
|
||||||
|
Debug("SSL_library_init()");
|
||||||
|
result = SSL_library_init();
|
||||||
|
Debug1("SSL_library_init() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSL_METHOD *sycSSLv2_client_method(void) {
|
||||||
|
SSL_METHOD *result;
|
||||||
|
Debug("SSLv2_client_method()");
|
||||||
|
result = SSLv2_client_method();
|
||||||
|
Debug1("SSLv2_client_method() -> %p", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSL_METHOD *sycSSLv2_server_method(void) {
|
||||||
|
SSL_METHOD *result;
|
||||||
|
Debug("SSLv2_server_method()");
|
||||||
|
result = SSLv2_server_method();
|
||||||
|
Debug1("SSLv2_server_method() -> %p", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSL_METHOD *sycSSLv3_client_method(void) {
|
||||||
|
SSL_METHOD *result;
|
||||||
|
Debug("SSLv3_client_method()");
|
||||||
|
result = SSLv3_client_method();
|
||||||
|
Debug1("SSLv3_client_method() -> %p", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSL_METHOD *sycSSLv3_server_method(void) {
|
||||||
|
SSL_METHOD *result;
|
||||||
|
Debug("SSLv3_server_method()");
|
||||||
|
result = SSLv3_server_method();
|
||||||
|
Debug1("SSLv3_server_method() -> %p", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSL_METHOD *sycSSLv23_client_method(void) {
|
||||||
|
SSL_METHOD *result;
|
||||||
|
Debug("SSLv23_client_method()");
|
||||||
|
result = SSLv23_client_method();
|
||||||
|
Debug1("SSLv23_client_method() -> %p", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSL_METHOD *sycSSLv23_server_method(void) {
|
||||||
|
SSL_METHOD *result;
|
||||||
|
Debug("SSLv23_server_method()");
|
||||||
|
result = SSLv23_server_method();
|
||||||
|
Debug1("SSLv23_server_method() -> %p", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSL_METHOD *sycTLSv1_client_method(void) {
|
||||||
|
SSL_METHOD *result;
|
||||||
|
Debug("TLSv1_client_method()");
|
||||||
|
result = TLSv1_client_method();
|
||||||
|
Debug1("TLSv1_client_method() -> %p", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSL_METHOD *sycTLSv1_server_method(void) {
|
||||||
|
SSL_METHOD *result;
|
||||||
|
Debug("TLSv1_server_method()");
|
||||||
|
result = TLSv1_server_method();
|
||||||
|
Debug1("TLSv1_server_method() -> %p", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSL_CTX *sycSSL_CTX_new(SSL_METHOD *method) {
|
||||||
|
SSL_CTX *result;
|
||||||
|
Debug1("SSL_CTX_new(%p)", method);
|
||||||
|
result = SSL_CTX_new(method);
|
||||||
|
Debug1("SSL_CTX_new() -> %p", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSL *sycSSL_new(SSL_CTX *ctx) {
|
||||||
|
SSL *result;
|
||||||
|
Debug1("SSL_new(%p)", ctx);
|
||||||
|
result = SSL_new(ctx);
|
||||||
|
Debug1("SSL_new() -> %p", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
|
||||||
|
const char *CApath) {
|
||||||
|
int result;
|
||||||
|
Debug7("SSL_CTX_load_verify_locations(%p, %s%s%s, %s%s%s)", ctx,
|
||||||
|
CAfile?"\"":"", CAfile?CAfile:NULL, CAfile?"\"":"",
|
||||||
|
CApath?"\"":"", CApath?CApath:NULL, CApath?"\"":"");
|
||||||
|
result = SSL_CTX_load_verify_locations(ctx, CAfile, CApath);
|
||||||
|
Debug1("SSL_CTX_load_verify_locations() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type) {
|
||||||
|
int result;
|
||||||
|
Debug3("SSL_CTX_use_certificate_file(%p, \"%s\", %d)", ctx, file, type);
|
||||||
|
result = SSL_CTX_use_certificate_file(ctx, file, type);
|
||||||
|
Debug1("SSL_CTX_use_certificate_file() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file) {
|
||||||
|
int result;
|
||||||
|
Debug2("SSL_CTX_use_certificate_chain_file(%p, \"%s\")", ctx, file);
|
||||||
|
result = SSL_CTX_use_certificate_chain_file(ctx, file);
|
||||||
|
Debug1("SSL_CTX_use_certificate_chain_file() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type) {
|
||||||
|
int result;
|
||||||
|
Debug3("SSL_CTX_use_PrivateKey_file(%p, \"%s\", %d)", ctx, file, type);
|
||||||
|
result = SSL_CTX_use_PrivateKey_file(ctx, file, type);
|
||||||
|
Debug1("SSL_CTX_use_PrivateKey_file() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sycSSL_CTX_set_verify(SSL_CTX *ctx, int mode,
|
||||||
|
int (*verify_callback)(int, X509_STORE_CTX *)) {
|
||||||
|
Debug3("SSL_CTX_set_verify(%p, %u, %p)", ctx, mode, verify_callback);
|
||||||
|
SSL_CTX_set_verify(ctx, mode, verify_callback);
|
||||||
|
Debug("SSL_CTX_set_verify() -> ");
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) {
|
||||||
|
int result;
|
||||||
|
Debug2("SSL_CTX_set_cipher_list(%p, \"%s\")", ctx, str);
|
||||||
|
result = SSL_CTX_set_cipher_list(ctx, str);
|
||||||
|
Debug1("SSL_CTX_set_cipher_list() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh) {
|
||||||
|
int result;
|
||||||
|
Debug2("SSL_CTX_set_tmp_dh(%p, %p)", ctx, dh);
|
||||||
|
result = SSL_CTX_set_tmp_dh(ctx, dh);
|
||||||
|
Debug1("SSL_CTX_set_tmp_dh() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_set_cipher_list(SSL *ssl, const char *str) {
|
||||||
|
int result;
|
||||||
|
Debug2("SSL_set_cipher_list(%p, \"%s\")", ssl, str);
|
||||||
|
result = SSL_set_cipher_list(ssl, str);
|
||||||
|
Debug1("SSL_set_cipher_list() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
long sycSSL_get_verify_result(SSL *ssl) {
|
||||||
|
long result;
|
||||||
|
Debug1("SSL_get_verify_result(%p)", ssl);
|
||||||
|
result = SSL_get_verify_result(ssl);
|
||||||
|
Debug1("SSL_get_verify_result() -> %lx", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_set_fd(SSL *ssl, int fd) {
|
||||||
|
int result;
|
||||||
|
Debug2("SSL_set_fd(%p, %d)", ssl, fd);
|
||||||
|
result = SSL_set_fd(ssl, fd);
|
||||||
|
Debug1("SSL_set_fd() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_connect(SSL *ssl) {
|
||||||
|
int result;
|
||||||
|
Debug1("SSL_connect(%p)", ssl);
|
||||||
|
result = SSL_connect(ssl);
|
||||||
|
Debug1("SSL_connect() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_accept(SSL *ssl) {
|
||||||
|
int result;
|
||||||
|
Debug1("SSL_accept(%p)", ssl);
|
||||||
|
result = SSL_accept(ssl);
|
||||||
|
Debug1("SSL_accept() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_read(SSL *ssl, void *buf, int num) {
|
||||||
|
int result;
|
||||||
|
Debug3("SSL_read(%p, %p, %d)", ssl, buf, num);
|
||||||
|
result = SSL_read(ssl, buf, num);
|
||||||
|
Debug1("SSL_read() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_pending(SSL *ssl) {
|
||||||
|
int result;
|
||||||
|
Debug1("SSL_pending(%p)", ssl);
|
||||||
|
result = SSL_pending(ssl);
|
||||||
|
Debug1("SSL_pending() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_write(SSL *ssl, const void *buf, int num) {
|
||||||
|
int result;
|
||||||
|
Debug3("SSL_write(%p, %p, %d)", ssl, buf, num);
|
||||||
|
result = SSL_write(ssl, buf, num);
|
||||||
|
Debug1("SSL_write() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
X509 *sycSSL_get_peer_certificate(SSL *ssl) {
|
||||||
|
X509 *result;
|
||||||
|
Debug1("SSL_get_peer_certificate(%p)", ssl);
|
||||||
|
result = SSL_get_peer_certificate(ssl);
|
||||||
|
if (result) {
|
||||||
|
Debug1("SSL_get_peer_certificate() -> %p", result);
|
||||||
|
} else {
|
||||||
|
Debug("SSL_get_peer_certificate() -> NULL");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycSSL_shutdown(SSL *ssl) {
|
||||||
|
int result;
|
||||||
|
Debug1("SSL_shutdown(%p)", ssl);
|
||||||
|
result = SSL_shutdown(ssl);
|
||||||
|
Debug1("SSL_shutdown() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sycSSL_CTX_free(SSL_CTX *ctx) {
|
||||||
|
Debug1("SSL_CTX_free(%p)", ctx);
|
||||||
|
SSL_CTX_free(ctx);
|
||||||
|
Debug("SSL_CTX_free() -> void");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sycSSL_free(SSL *ssl) {
|
||||||
|
Debug1("SSL_free(%p)", ssl);
|
||||||
|
SSL_free(ssl);
|
||||||
|
Debug("SSL_free() -> void");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sycRAND_egd(const char *path) {
|
||||||
|
int result;
|
||||||
|
Debug1("RAND_egd(\"%s\")", path);
|
||||||
|
result = RAND_egd(path);
|
||||||
|
Debug1("RAND_egd() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
DH *sycPEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u) {
|
||||||
|
DH *result;
|
||||||
|
Debug4("PEM_read_bio_DHparams(%p, %p, %p, %p)",
|
||||||
|
bp, x, cb, u);
|
||||||
|
result = PEM_read_bio_DHparams(bp, x, cb, u);
|
||||||
|
if (result) {
|
||||||
|
/*Debug2("PEM_read_bio_DHparams(, {%p},,) -> %p", *x, result);*/
|
||||||
|
Debug1("PEM_read_bio_DHparams() -> %p", result);
|
||||||
|
} else {
|
||||||
|
Debug("PEM_read_bio_DHparams() -> NULL");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
BIO *sycBIO_new_file(const char *filename, const char *mode) {
|
||||||
|
BIO *result;
|
||||||
|
Debug2("BIO_new_file(\"%s\", \"%s\")", filename, mode);
|
||||||
|
result = BIO_new_file(filename, mode);
|
||||||
|
if (result) {
|
||||||
|
Debug1("BIO_new_file() -> %p", result);
|
||||||
|
} else {
|
||||||
|
Debug("BIO_new_file() -> NULL");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WITH_FIPS
|
||||||
|
int sycFIPS_mode_set(int onoff) {
|
||||||
|
int result;
|
||||||
|
Debug1("FIPS_mode_set(%d)", onoff);
|
||||||
|
result = FIPS_mode_set(onoff);
|
||||||
|
Debug1("FIPS_mode_set() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif /* WITH_FIPS */
|
||||||
|
|
||||||
|
#endif /* WITH_SYCLS && WITH_OPENSSL */
|
102
sslcls.h
Normal file
102
sslcls.h
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
/* $Id: sslcls.h,v 1.9 2007/02/26 21:30:58 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __sslcls_h_included
|
||||||
|
#define __sslcls_h_included 1
|
||||||
|
|
||||||
|
#if WITH_SYCLS
|
||||||
|
#if WITH_OPENSSL
|
||||||
|
|
||||||
|
void sycSSL_load_error_strings(void);
|
||||||
|
int sycSSL_library_init(void);
|
||||||
|
SSL_METHOD *sycSSLv2_client_method(void);
|
||||||
|
SSL_METHOD *sycSSLv2_server_method(void);
|
||||||
|
SSL_METHOD *sycSSLv3_client_method(void);
|
||||||
|
SSL_METHOD *sycSSLv3_server_method(void);
|
||||||
|
SSL_METHOD *sycSSLv23_client_method(void);
|
||||||
|
SSL_METHOD *sycSSLv23_server_method(void);
|
||||||
|
SSL_METHOD *sycTLSv1_client_method(void);
|
||||||
|
SSL_METHOD *sycTLSv1_server_method(void);
|
||||||
|
SSL_CTX *sycSSL_CTX_new(SSL_METHOD *method);
|
||||||
|
SSL *sycSSL_new(SSL_CTX *ctx);
|
||||||
|
int sycSSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
|
||||||
|
const char *CApath);
|
||||||
|
int sycSSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);
|
||||||
|
int sycSSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file);
|
||||||
|
int sycSSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type);
|
||||||
|
void sycSSL_CTX_set_verify(SSL_CTX *ctx, int mode,
|
||||||
|
int (*verify_callback)(int, X509_STORE_CTX *));
|
||||||
|
int sycSSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh);
|
||||||
|
int sycSSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);
|
||||||
|
int sycSSL_set_cipher_list(SSL *ssl, const char *str);
|
||||||
|
long sycSSL_get_verify_result(SSL *ssl);
|
||||||
|
int sycSSL_set_fd(SSL *ssl, int fd);
|
||||||
|
int sycSSL_connect(SSL *ssl);
|
||||||
|
int sycSSL_accept(SSL *ssl);
|
||||||
|
int sycSSL_read(SSL *ssl, void *buf, int num);
|
||||||
|
int sycSSL_pending(SSL *ssl);
|
||||||
|
int sycSSL_write(SSL *ssl, const void *buf, int num);
|
||||||
|
X509 *sycSSL_get_peer_certificate(SSL *ssl);
|
||||||
|
int sycSSL_shutdown(SSL *ssl);
|
||||||
|
void sycSSL_CTX_free(SSL_CTX *ctx);
|
||||||
|
void sycSSL_free(SSL *ssl);
|
||||||
|
int sycRAND_egd(const char *path);
|
||||||
|
|
||||||
|
DH *sycPEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u);
|
||||||
|
|
||||||
|
BIO *sycBIO_new_file(const char *filename, const char *mode);
|
||||||
|
|
||||||
|
int sycFIPS_mode_set(int onoff);
|
||||||
|
|
||||||
|
#endif /* WITH_OPENSSL */
|
||||||
|
|
||||||
|
#else /* !WITH_SYCLS */
|
||||||
|
|
||||||
|
#if WITH_OPENSSL
|
||||||
|
|
||||||
|
#define sycSSL_load_error_strings() SSL_load_error_strings()
|
||||||
|
#define sycSSL_library_init() SSL_library_init()
|
||||||
|
#define sycSSLv2_client_method() SSLv2_client_method()
|
||||||
|
#define sycSSLv2_server_method() SSLv2_server_method()
|
||||||
|
#define sycSSLv3_client_method() SSLv3_client_method()
|
||||||
|
#define sycSSLv3_server_method() SSLv3_server_method()
|
||||||
|
#define sycSSLv23_client_method() SSLv23_client_method()
|
||||||
|
#define sycSSLv23_server_method() SSLv23_server_method()
|
||||||
|
#define sycTLSv1_client_method() TLSv1_client_method()
|
||||||
|
#define sycTLSv1_server_method() TLSv1_server_method()
|
||||||
|
#define sycSSL_CTX_new(m) SSL_CTX_new(m)
|
||||||
|
#define sycSSL_new(c) SSL_new(c)
|
||||||
|
#define sycSSL_CTX_load_verify_locations(c,f,p) SSL_CTX_load_verify_locations(c,f,p)
|
||||||
|
#define sycSSL_CTX_use_certificate_file(c,f,t) SSL_CTX_use_certificate_file(c,f,t)
|
||||||
|
#define sycSSL_CTX_use_certificate_chain_file(c,f) SSL_CTX_use_certificate_chain_file(c,f)
|
||||||
|
#define sycSSL_CTX_use_PrivateKey_file(c,f,t) SSL_CTX_use_PrivateKey_file(c,f,t)
|
||||||
|
#define sycSSL_CTX_set_verify(c,m,v) SSL_CTX_set_verify(c,m,v)
|
||||||
|
#define sycSSL_CTX_set_tmp_dh(c,d) SSL_CTX_set_tmp_dh(c,d)
|
||||||
|
#define sycSSL_CTX_set_cipher_list(c,s) SSL_CTX_set_cipher_list(c,s)
|
||||||
|
#define sycSSL_set_cipher_list(s,t) SSL_set_cipher_list(s,t)
|
||||||
|
#define sycSSL_get_verify_result(s) SSL_get_verify_result(s)
|
||||||
|
#define sycSSL_set_fd(s,f) SSL_set_fd(s,f)
|
||||||
|
#define sycSSL_connect(s) SSL_connect(s)
|
||||||
|
#define sycSSL_accept(s) SSL_accept(s)
|
||||||
|
#define sycSSL_read(s,b,n) SSL_read(s,b,n)
|
||||||
|
#define sycSSL_pending(s) SSL_pending(s)
|
||||||
|
#define sycSSL_write(s,b,n) SSL_write(s,b,n)
|
||||||
|
#define sycSSL_get_peer_certificate(s) SSL_get_peer_certificate(s)
|
||||||
|
#define sycSSL_shutdown(s) SSL_shutdown(s)
|
||||||
|
#define sycSSL_CTX_free(c) SSL_CTX_free(c)
|
||||||
|
#define sycSSL_free(s) SSL_free(s)
|
||||||
|
#define sycRAND_egd(p) RAND_egd(p)
|
||||||
|
|
||||||
|
#define sycPEM_read_bio_DHparams(b,x,p,u) PEM_read_bio_DHparams(b,x,p,u)
|
||||||
|
|
||||||
|
#define sycBIO_new_file(f,m) BIO_new_file(f,m)
|
||||||
|
|
||||||
|
#endif /* WITH_OPENSSL */
|
||||||
|
|
||||||
|
#define sycFIPS_mode_set(o) FIPS_mode_set(o)
|
||||||
|
|
||||||
|
#endif /* !WITH_SYCLS */
|
||||||
|
|
||||||
|
#endif /* !defined(__sslcls_h_included) */
|
||||||
|
|
270
sycls.h
Normal file
270
sycls.h
Normal file
|
@ -0,0 +1,270 @@
|
||||||
|
/* $Id: sycls.h,v 1.50 2007/03/06 21:04:26 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __sycls_h_included
|
||||||
|
#define __sycls_h_included 1
|
||||||
|
|
||||||
|
#if WITH_SYCLS
|
||||||
|
struct termios; /* prevent gcc from spitting silly warning */
|
||||||
|
struct utsname;
|
||||||
|
struct flock;
|
||||||
|
struct addrinfo;
|
||||||
|
|
||||||
|
mode_t Umask(mode_t mask);
|
||||||
|
int Open(const char *pathname, int flags, mode_t mode);
|
||||||
|
int Creat(const char *pathname, mode_t mode);
|
||||||
|
off_t Lseek(int fildes, off_t offset, int whence);
|
||||||
|
#if HAVE_LSEEK64
|
||||||
|
off64_t Lseek64(int fildes, off64_t offset, int whence);
|
||||||
|
#endif
|
||||||
|
pid_t Getpid(void);
|
||||||
|
pid_t Getppid(void);
|
||||||
|
pid_t Getpgrp(void);
|
||||||
|
int Getpgid(pid_t pid);
|
||||||
|
int Setpgid(pid_t pid, pid_t pgid);
|
||||||
|
int Setpgrp(void);
|
||||||
|
pid_t Tcgetpgrp(int fd);
|
||||||
|
int Tcsetpgrp(int fd, pid_t pgrpid);
|
||||||
|
pid_t Getsid(pid_t pid);
|
||||||
|
pid_t Setsid(void);
|
||||||
|
uid_t Getuid(void);
|
||||||
|
uid_t Geteuid(void);
|
||||||
|
int Setuid(uid_t uid);
|
||||||
|
gid_t Getgid(void);
|
||||||
|
gid_t Getegid(void);
|
||||||
|
int Setgid(gid_t gid);
|
||||||
|
int Initgroups(const char *user, gid_t group);
|
||||||
|
int Getgroups(int size, gid_t list[]);
|
||||||
|
int Setgroups(size_t size, const gid_t *list);
|
||||||
|
int Chdir(const char *path);
|
||||||
|
int Chroot(const char *path);
|
||||||
|
int Gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||||
|
int Mknod(const char *pathname, mode_t mode, dev_t dev);
|
||||||
|
int Mkfifo(const char *pathname, mode_t mode);
|
||||||
|
int Stat(const char *file_name, struct stat *buf);
|
||||||
|
int Fstat(int filedes, struct stat *buf);
|
||||||
|
int Lstat(const char *file_name, struct stat *buf);
|
||||||
|
#if HAVE_STAT64
|
||||||
|
int Stat64(const char *file_name, struct stat64 *buf);
|
||||||
|
int Fstat64(int filedes, struct stat64 *buf);
|
||||||
|
int Lstat64(const char *file_name, struct stat64 *buf);
|
||||||
|
#endif /* HAVE_STAT64 */
|
||||||
|
int Dup(int oldfd);
|
||||||
|
int Dup2(int oldfd, int newfd);
|
||||||
|
int Pipe(int filedes[2]);
|
||||||
|
ssize_t Read(int fd, void *buf, size_t count);
|
||||||
|
ssize_t Write(int fd, const void *buf, size_t count);
|
||||||
|
int Fcntl(int fd, int cmd);
|
||||||
|
int Fcntl_l(int fd, int cmd, long arg);
|
||||||
|
int Fcntl_lock(int fd, int cmd, struct flock *l);
|
||||||
|
int Ftruncate(int fd, off_t length);
|
||||||
|
#if HAVE_FTRUNCATE64
|
||||||
|
int Ftruncate64(int fd, off64_t length);
|
||||||
|
#endif /* HAVE_FTRUNCATE64 */
|
||||||
|
int Flock(int fd, int operation);
|
||||||
|
int Ioctl(int d, int request, void *argp);
|
||||||
|
int Close(int fd);
|
||||||
|
int Fchown(int fd, uid_t owner, gid_t group);
|
||||||
|
int Fchmod(int fd, mode_t mode);
|
||||||
|
int Unlink(const char *pathname);
|
||||||
|
int Symlink(const char *oldpath, const char *newpath);
|
||||||
|
int Readlink(const char *path, char *buf, size_t bufsiz);
|
||||||
|
int Chown(const char *path, uid_t owner, gid_t group);
|
||||||
|
int Chmod(const char *path, mode_t mode);
|
||||||
|
int Poll(struct pollfd *ufds, unsigned int nfds, int timeout);
|
||||||
|
int Select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||||
|
struct timeval *timeout);
|
||||||
|
pid_t Fork(void);
|
||||||
|
pid_t Waitpid(pid_t pid, int *status, int options);
|
||||||
|
#ifndef HAVE_TYPE_SIGHANDLER
|
||||||
|
typedef RETSIGTYPE (*sighandler_t)(int);
|
||||||
|
#endif
|
||||||
|
sighandler_t Signal(int signum, sighandler_t handler);
|
||||||
|
int Sigaction(int signum, const struct sigaction *act,
|
||||||
|
struct sigaction *oldact);
|
||||||
|
int Sigprocmask(int how, const sigset_t *set, sigset_t *oset);
|
||||||
|
unsigned int Alarm(unsigned int seconds);
|
||||||
|
int Kill(pid_t pid, int sig);
|
||||||
|
int Link(const char *oldpath, const char *newpath);
|
||||||
|
int Execvp(const char *file, char *const argv[]);
|
||||||
|
int System(const char *string);
|
||||||
|
int Socketpair(int d, int type, int protocol, int sv[2]);
|
||||||
|
#if _WITH_SOCKET
|
||||||
|
int Socket(int domain, int type, int protocol);
|
||||||
|
int Bind(int sockfd, struct sockaddr *my_addr, int addrlen);
|
||||||
|
int Connect(int sockfd, const struct sockaddr *serv_addr, int addrlen);
|
||||||
|
int Listen(int s, int backlog);
|
||||||
|
int Accept(int s, struct sockaddr *addr, socklen_t *addrlen);
|
||||||
|
int Getsockname(int s, struct sockaddr *name, socklen_t *namelen);
|
||||||
|
int Getpeername(int s, struct sockaddr *name, socklen_t *namelen);
|
||||||
|
int Getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen);
|
||||||
|
int Setsockopt(int s, int level, int optname, const void *optval, int optlen);
|
||||||
|
int Recv(int s, void *buf, size_t len, int flags);
|
||||||
|
int Recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from,
|
||||||
|
socklen_t *fromlen);
|
||||||
|
int Recvmsg(int s, struct msghdr *msg, int flags);
|
||||||
|
int Send(int s, const void *mesg, size_t len, int flags);
|
||||||
|
int Sendto(int s, const void *msg, size_t len, int flags,
|
||||||
|
const struct sockaddr *to, socklen_t tolen);
|
||||||
|
int Shutdown(int fd, int how);
|
||||||
|
#endif /* _WITH_SOCKET */
|
||||||
|
unsigned int Sleep(unsigned int seconds);
|
||||||
|
void Usleep(unsigned long usec);
|
||||||
|
unsigned int Nanosleep(const struct timespec *req, struct timespec *rem);
|
||||||
|
int Pause(void);
|
||||||
|
struct hostent *Gethostbyname(const char *name);
|
||||||
|
int Getaddrinfo(const char *node, const char *service,
|
||||||
|
const struct addrinfo *hints, struct addrinfo **res);
|
||||||
|
struct hostent *Getipnodebyname(const char *name, int af, int flags,
|
||||||
|
int *error_num);
|
||||||
|
void *Malloc(size_t size);
|
||||||
|
void *Calloc(size_t nmemb, size_t size);
|
||||||
|
void *Realloc(void *ptr, size_t size);
|
||||||
|
int Tcgetattr(int fd, struct termios *termios_p);
|
||||||
|
int Tcsetattr(int fd, int optional_actions, struct termios *termios_p);
|
||||||
|
char *Ttyname(int fd);
|
||||||
|
int Isatty(int fd);
|
||||||
|
struct winsize; /* avoid warnings */
|
||||||
|
int Openpty(int *ptyfd, int *ttyfd, char *ptyname, struct termios *termp,
|
||||||
|
struct winsize *winp);
|
||||||
|
char *Ptsname(int fd);
|
||||||
|
int Grantpt(int fd);
|
||||||
|
int Unlockpt(int fd);
|
||||||
|
int Gethostname(char *name, size_t len);
|
||||||
|
int Uname(struct utsname *buf);
|
||||||
|
int Atexit(void (*func)(void));
|
||||||
|
void Exit(int status);
|
||||||
|
void Abort(void);
|
||||||
|
int Mkstemp(char *template);
|
||||||
|
|
||||||
|
char *Readline(const char *prompt);
|
||||||
|
void Using_history(void);
|
||||||
|
int Read_history(const char *filename);
|
||||||
|
int Write_history(const char *filename);
|
||||||
|
int Append_history(int nelements, const char *filename);
|
||||||
|
int Read_history(const char *filename);
|
||||||
|
void Add_history(const char *string);
|
||||||
|
|
||||||
|
#else /* !WITH_SYCLS */
|
||||||
|
|
||||||
|
#define Umask(m) umask(m)
|
||||||
|
#define Open(p,f,m) open(p,f,m)
|
||||||
|
#define Creat(p,m) creat(p,m)
|
||||||
|
#define Lseek(f,o,w) lseek(f,o,w)
|
||||||
|
#define Lseek64(f,o,w) lseek64(f,o,w)
|
||||||
|
#define Getpid() getpid()
|
||||||
|
#define Getppid() getppid()
|
||||||
|
#define Getpgrp() getpgrp()
|
||||||
|
#define Getpgid(p) getpgid(p)
|
||||||
|
#define Setpgid(p,g) setpgid(p,g)
|
||||||
|
#define Setpgrp() setpgrp()
|
||||||
|
#define Tcgetpgrp(f) tcgetpgrp(f)
|
||||||
|
#define Tcsetpgrp(f,p) tcsetpgrp(f,p)
|
||||||
|
#define Getsid(p) getsid(p)
|
||||||
|
#define Setsid() setsid()
|
||||||
|
#define Getuid() getuid()
|
||||||
|
#define Geteuid() geteuid()
|
||||||
|
#define Setuid(u) setuid(u)
|
||||||
|
#define Getgid() getgid()
|
||||||
|
#define Getegid() getegid()
|
||||||
|
#define Setgid(g) setgid(g)
|
||||||
|
#define Initgroups(u,g) initgroups(u,g)
|
||||||
|
#define Getgroups(s,l) getgroups(s,l)
|
||||||
|
#define Setgroups(s,l) setgroups(s,l)
|
||||||
|
#define Chdir(p) chdir(p)
|
||||||
|
#define Chroot(p) chroot(p)
|
||||||
|
#define Gettimeofday(tv,tz) gettimeofday(tv,tz)
|
||||||
|
#define Mknod(p,m,d) mknod(p,m,d)
|
||||||
|
#define Mkfifo(p,m) mkfifo(p,m)
|
||||||
|
#define Stat(f,b) stat(f,b)
|
||||||
|
#define Stat64(f,b) stat64(f,b)
|
||||||
|
#define Fstat(f,b) fstat(f,b)
|
||||||
|
#define Fstat64(f,b) fstat64(f,b)
|
||||||
|
#define Lstat(f,b) lstat(f,b)
|
||||||
|
#define Lstat64(f,b) lstat64(f,b)
|
||||||
|
#define Dup(o) dup(o)
|
||||||
|
#define Dup2(o,n) dup2(o,n)
|
||||||
|
#define Pipe(f) pipe(f)
|
||||||
|
#define Read(f,b,c) read(f,b,c)
|
||||||
|
#define Write(f,b,c) write(f,b,c)
|
||||||
|
#define Fcntl(f,c) fcntl(f,c)
|
||||||
|
#define Fcntl_l(f,c,a) fcntl(f,c,a)
|
||||||
|
#define Fcntl_lock(f,c,l) fcntl(f,c,l)
|
||||||
|
#define Ftruncate(f,l) ftruncate(f,l)
|
||||||
|
#define Ftruncate64(f,l) ftruncate64(f,l)
|
||||||
|
#define Flock(f,o) flock(f,o)
|
||||||
|
#define Ioctl(d,r,a) ioctl(d,r,a)
|
||||||
|
#define Close(f) close(f)
|
||||||
|
#define Fchown(f,o,g) fchown(f,o,g)
|
||||||
|
#define Fchmod(f,m) fchmod(f,m)
|
||||||
|
#define Unlink(p) unlink(p)
|
||||||
|
#define Symlink(op,np) symlink(op,np)
|
||||||
|
#define Readlink(p,b,s) readlink(p,b,s)
|
||||||
|
#define Chown(p,o,g) chown(p,o,g)
|
||||||
|
#define Chmod(p,m) chmod(p,m)
|
||||||
|
#define Poll(u, n, t) poll(u, n, t)
|
||||||
|
#define Select(n,r,w,e,t) select(n,r,w,e,t)
|
||||||
|
#define Fork() fork()
|
||||||
|
#define Waitpid(p,s,o) waitpid(p,s,o)
|
||||||
|
#define Signal(s,h) signal(s,h)
|
||||||
|
#define Sigaction(s,a,o) sigaction(s,a,o)
|
||||||
|
#define Sigprocmask(h,s,o) sigprocmask(h,s,o)
|
||||||
|
#define Alarm(s) alarm(s)
|
||||||
|
#define Kill(p,s) kill(p,s)
|
||||||
|
#define Link(o,n) link(o,n)
|
||||||
|
#define Execvp(f,a) execvp(f,a)
|
||||||
|
#define System(s) system(s)
|
||||||
|
#define Socketpair(d,t,p,s) socketpair(d,t,p,s)
|
||||||
|
#define Socket(d,t,p) socket(d,t,p)
|
||||||
|
#define Bind(s,m,a) bind(s,m,a)
|
||||||
|
#define Connect(s,a,l) connect(s,a,l)
|
||||||
|
#define Listen(s,b) listen(s,b)
|
||||||
|
#define Accept(s,a,l) accept(s,a,l)
|
||||||
|
#define Getsockname(s,n,l) getsockname(s,n,l)
|
||||||
|
#define Getpeername(s,n,l) getpeername(s,n,l)
|
||||||
|
#define Getsockopt(s,d,n,v,l) getsockopt(s,d,n,v,l)
|
||||||
|
#define Setsockopt(s,d,n,v,l) setsockopt(s,d,n,v,l)
|
||||||
|
#define Recv(s,b,l,f) recv(s,b,l,f)
|
||||||
|
#define Recvfrom(s,b,bl,f,fr,fl) recvfrom(s,b,bl,f,fr,fl)
|
||||||
|
#define Recvmsg(s,m,f) recvmsg(s,m,f)
|
||||||
|
#define Send(s,m,l,f) send(s,m,l,f)
|
||||||
|
#define Sendto(s,b,bl,f,t,tl) sendto(s,b,bl,f,t,tl)
|
||||||
|
#define Shutdown(f,h) shutdown(f,h)
|
||||||
|
#define Sleep(s) sleep(s)
|
||||||
|
#define Usleep(u) usleep(u)
|
||||||
|
#define Nanosleep(req,rem) nanosleep(req,rem)
|
||||||
|
#define Pause() pause()
|
||||||
|
#define Gethostbyname(n) gethostbyname(n)
|
||||||
|
#define Getaddrinfo(n,s,h,r) getaddrinfo(n,s,h,r)
|
||||||
|
#define Getipnodebyname(n,a,f,e) getipnodebyname(n,a,f,e)
|
||||||
|
#define Malloc(s) malloc(s)
|
||||||
|
#define Calloc(n,s) calloc(n,s)
|
||||||
|
#define Realloc(p,s) realloc(p,s)
|
||||||
|
#define Tcgetattr(f,t) tcgetattr(f,t)
|
||||||
|
#define Tcsetattr(f,o,t) tcsetattr(f,o,t)
|
||||||
|
#define Ttyname(f) ttyname(f)
|
||||||
|
#define Isatty(f) isatty(f)
|
||||||
|
#define Openpty(p,t,n,i,f) openpty(p,t,n,i,f)
|
||||||
|
#define Ptsname(f) ptsname(f)
|
||||||
|
#define Grantpt(f) grantpt(f)
|
||||||
|
#define Unlockpt(f) unlockpt(f)
|
||||||
|
#define Getpgid(p) getpgid(p)
|
||||||
|
#define Gethostname(n,l) gethostname(n,l)
|
||||||
|
#define Uname(b) uname(b)
|
||||||
|
#define Atexit(f) atexit(f)
|
||||||
|
#define Exit(s) exit(s)
|
||||||
|
#define Abort() abort()
|
||||||
|
#define Mkstemp(t) mkstemp(t)
|
||||||
|
|
||||||
|
#define Readline(p) readline(p)
|
||||||
|
#define Using_history() using_history()
|
||||||
|
#define Read_history(f) read_history(f)
|
||||||
|
#define Write_history(f) write_history(f)
|
||||||
|
#define Append_history(n,f) append_history(n,f)
|
||||||
|
#define Read_history(f) read_history(f)
|
||||||
|
#define Add_history(s) add_history(s)
|
||||||
|
|
||||||
|
#endif /* !WITH_SYCLS */
|
||||||
|
|
||||||
|
#endif /* !defined(__sycls_h_included) */
|
161
sysincludes.h
Normal file
161
sysincludes.h
Normal file
|
@ -0,0 +1,161 @@
|
||||||
|
/* $Id: sysincludes.h,v 1.23 2007/03/06 21:04:58 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __sysincludes_h_included
|
||||||
|
#define __sysincludes_h_included 1
|
||||||
|
|
||||||
|
#if HAVE_LIMITS_H
|
||||||
|
#include <limits.h> /* USHRT_MAX */
|
||||||
|
#endif
|
||||||
|
#include <math.h> /* HUGE_VAL */
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdarg.h> /* for msg() */
|
||||||
|
#include <string.h> /* strerror(), strchr() */
|
||||||
|
#if HAVE_STRINGS_H
|
||||||
|
#include <strings.h> /* strcasecmp(), bzero() for FD_ZERO */
|
||||||
|
#endif
|
||||||
|
#include <stdlib.h> /* malloc(), free() */
|
||||||
|
#include <ctype.h> /* isdigit() */
|
||||||
|
#include <stdio.h> /* FILE */
|
||||||
|
#include <errno.h> /* errno */
|
||||||
|
#if HAVE_SYSLOG_H
|
||||||
|
#include <syslog.h> /* openlog(), syslog(), closelog() */
|
||||||
|
#endif
|
||||||
|
#include <signal.h> /* signal(), SIGPIPE, SIG_IGN */
|
||||||
|
#include <time.h> /* struct timeval, strftime() */
|
||||||
|
#include <sys/timeb.h> /* struct timeb */
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
#include <unistd.h> /* select(), read(), write(), stat(), fork() */
|
||||||
|
#endif
|
||||||
|
#if HAVE_PWD_H
|
||||||
|
#include <pwd.h> /* getpwnam() */
|
||||||
|
#endif
|
||||||
|
#if HAVE_GRP_H
|
||||||
|
#include <grp.h> /* getgrnam() */
|
||||||
|
#endif
|
||||||
|
#if HAVE_PTY_H
|
||||||
|
#include <pty.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_PARAM_H
|
||||||
|
#include <sys/param.h> /* Linux 2.4 NGROUPS */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_TIME_H
|
||||||
|
#include <sys/time.h> /* select(); OpenBSD: struct timespec */
|
||||||
|
#endif
|
||||||
|
#if HAVE_STDINT_H
|
||||||
|
#include <stdint.h> /* uint8_t */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h> /* pid_t, select(), socket(), connect(), open(), u_short */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_POLL_H
|
||||||
|
#include <sys/poll.h> /* poll() */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h> /* struct sockaddr, struct linger, socket(), connect() */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_UIO_H
|
||||||
|
#include <sys/uio.h> /* struct iovec */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_STAT_H
|
||||||
|
#include <sys/stat.h> /* struct stat, stat(), open() */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_WAIT_H
|
||||||
|
#include <sys/wait.h> /* WNOHANG */
|
||||||
|
#endif
|
||||||
|
#if HAVE_FCNTL_H
|
||||||
|
#include <fcntl.h> /* open(), O_RDWR */
|
||||||
|
#endif
|
||||||
|
#if HAVE_NETDB_H && (_WITH_IP4 || _WITH_IP6)
|
||||||
|
#include <netdb.h> /* struct hostent, gethostbyname() */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_UN_H && WITH_UNIX
|
||||||
|
#include <sys/un.h> /* struct sockaddr_un, unix domain sockets */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_IOCTL_H
|
||||||
|
#include <sys/ioctl.h> /* ioctl() */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_SELECT_H
|
||||||
|
#include <sys/select.h> /* select(), fdset on AIX 4.1 */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_FILE_H
|
||||||
|
#include <sys/file.h> /* LOCK_EX, on AIX directly included */
|
||||||
|
#endif
|
||||||
|
#if _WITH_SOCKET
|
||||||
|
# if HAVE_NETINET_IN_H
|
||||||
|
#include <netinet/in.h> /* struct sockaddr_in, htonl() */
|
||||||
|
# endif
|
||||||
|
#endif /* _WITH_SOCKET */
|
||||||
|
#if _WITH_SOCKET && (_WITH_IP4 || _WITH_IP6)
|
||||||
|
# if HAVE_NETINET_IN_SYSTM_H
|
||||||
|
#include <netinet/in_systm.h> /* Solaris, FreeBSD: n_long */
|
||||||
|
# endif
|
||||||
|
# if HAVE_NETINET_IP_H
|
||||||
|
#include <netinet/ip.h> /* struct ip - past netinet/in.h on AIX! */
|
||||||
|
# endif
|
||||||
|
# if HAVE_NETINET_TCP_H
|
||||||
|
#include <netinet/tcp.h> /* TCP_RFC1323 */
|
||||||
|
# endif
|
||||||
|
# if HAVE_NETINET_IP6_H && _WITH_IP6
|
||||||
|
#include <netinet/ip6.h>
|
||||||
|
# endif
|
||||||
|
# if HAVE_NETINET6_IN6_H && _WITH_IP6
|
||||||
|
#include <netinet6/in6.h>
|
||||||
|
# endif
|
||||||
|
#include <arpa/inet.h> /* Linux: inet_aton() */
|
||||||
|
#if HAVE_ARPA_NAMESER_H
|
||||||
|
#include <arpa/nameser.h> /* req for resolv.h (esp. on MacOSX) */
|
||||||
|
#endif
|
||||||
|
#include <net/if.h>
|
||||||
|
#if HAVE_RESOLV_H
|
||||||
|
#include <resolv.h> /* _res */
|
||||||
|
#endif
|
||||||
|
#endif /* _WITH_IP4 || _WITH_IP6 */
|
||||||
|
/*#include <linux/sockios.h>*/
|
||||||
|
#if HAVE_NET_IF_H
|
||||||
|
#include <net/if.h>
|
||||||
|
#endif /* HAVE_NET_IF_H */
|
||||||
|
#if HAVE_LINUX_IF_TUN_H
|
||||||
|
#include <linux/if_tun.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_TERMIOS_H && WITH_TERMIOS
|
||||||
|
#include <termios.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_UTSNAME_H
|
||||||
|
#include <sys/utsname.h> /* uname(), struct utsname */
|
||||||
|
#endif
|
||||||
|
#if HAVE_UTIL_H
|
||||||
|
#include <util.h> /* NetBSD, OpenBSD openpty() */
|
||||||
|
#endif
|
||||||
|
#if HAVE_LIBUTIL_H
|
||||||
|
#include <libutil.h> /* FreeBSD openpty() */
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_STROPTS_H
|
||||||
|
#include <sys/stropts.h> /* SunOS I_PUSH ... */
|
||||||
|
#endif
|
||||||
|
#if HAVE_REGEX_H
|
||||||
|
#include <regex.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_LINUX_FS_H
|
||||||
|
#include <linux/fs.h> /* somewhere required for ext2_fs.h */
|
||||||
|
#endif
|
||||||
|
#if HAVE_LINUX_EXT2_FS_H
|
||||||
|
#include <linux/ext2_fs.h> /* Linux ext2 filesystem definitions */
|
||||||
|
#endif
|
||||||
|
#if WITH_READLINE
|
||||||
|
# if HAVE_READLINE_READLINE_H
|
||||||
|
#include <readline/readline.h>
|
||||||
|
# endif
|
||||||
|
# if HAVE_READLINE_HISTORY_H
|
||||||
|
#include <readline/history.h>
|
||||||
|
# endif
|
||||||
|
#endif /* WITH_READLINE */
|
||||||
|
#if WITH_OPENSSL
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
#include <openssl/err.h>
|
||||||
|
#include <openssl/rand.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !defined(__sysincludes_h_included) */
|
495
sysutils.c
Normal file
495
sysutils.c
Normal file
|
@ -0,0 +1,495 @@
|
||||||
|
/* $Id: sysutils.c,v 1.44 2007/03/06 21:05:11 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* translate socket addresses into human readable form */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "xioconfig.h"
|
||||||
|
|
||||||
|
#include "sysincludes.h"
|
||||||
|
|
||||||
|
#include "compat.h" /* socklen_t */
|
||||||
|
#include "mytypes.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "sycls.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "sysutils.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_UNIX
|
||||||
|
void socket_un_init(struct sockaddr_un *sa) {
|
||||||
|
#if HAVE_STRUCT_SOCKADDR_SALEN
|
||||||
|
sa->sun_len = sizeof(struct sockaddr_un);
|
||||||
|
#endif
|
||||||
|
sa->sun_family = AF_UNIX;
|
||||||
|
memset(sa->sun_path, '\0', sizeof(sa->sun_path));
|
||||||
|
}
|
||||||
|
#endif /* WITH_UNIX */
|
||||||
|
|
||||||
|
#if WITH_IP4
|
||||||
|
void socket_in_init(struct sockaddr_in *sa) {
|
||||||
|
#if HAVE_STRUCT_SOCKADDR_SALEN
|
||||||
|
sa->sin_len = sizeof(struct sockaddr_in);
|
||||||
|
#endif
|
||||||
|
sa->sin_family = AF_INET;
|
||||||
|
sa->sin_port = 0;
|
||||||
|
sa->sin_addr.s_addr = 0;
|
||||||
|
sa->sin_zero[0] = 0;
|
||||||
|
sa->sin_zero[1] = 0;
|
||||||
|
sa->sin_zero[2] = 0;
|
||||||
|
sa->sin_zero[3] = 0;
|
||||||
|
sa->sin_zero[4] = 0;
|
||||||
|
sa->sin_zero[5] = 0;
|
||||||
|
sa->sin_zero[6] = 0;
|
||||||
|
sa->sin_zero[7] = 0;
|
||||||
|
}
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
|
||||||
|
#if WITH_IP6
|
||||||
|
void socket_in6_init(struct sockaddr_in6 *sa) {
|
||||||
|
#if HAVE_STRUCT_SOCKADDR_SALEN
|
||||||
|
sa->sin6_len = sizeof(struct sockaddr_in6);
|
||||||
|
#endif
|
||||||
|
sa->sin6_family = AF_INET6;
|
||||||
|
sa->sin6_port = 0;
|
||||||
|
sa->sin6_flowinfo = 0;
|
||||||
|
#if HAVE_IP6_SOCKADDR==0
|
||||||
|
sa->sin6_addr.s6_addr[0] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[1] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[2] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[3] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[4] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[5] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[6] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[7] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[8] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[9] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[10] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[11] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[12] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[13] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[14] = 0;
|
||||||
|
sa->sin6_addr.s6_addr[15] = 0;
|
||||||
|
#elif HAVE_IP6_SOCKADDR==1
|
||||||
|
sa->sin6_addr.u6_addr.u6_addr32[0] = 0;
|
||||||
|
sa->sin6_addr.u6_addr.u6_addr32[1] = 0;
|
||||||
|
sa->sin6_addr.u6_addr.u6_addr32[2] = 0;
|
||||||
|
sa->sin6_addr.u6_addr.u6_addr32[3] = 0;
|
||||||
|
#elif HAVE_IP6_SOCKADDR==2
|
||||||
|
sa->sin6_addr.u6_addr32[0] = 0;
|
||||||
|
sa->sin6_addr.u6_addr32[1] = 0;
|
||||||
|
sa->sin6_addr.u6_addr32[2] = 0;
|
||||||
|
sa->sin6_addr.u6_addr32[3] = 0;
|
||||||
|
#elif HAVE_IP6_SOCKADDR==3
|
||||||
|
sa->sin6_addr.in6_u.u6_addr32[0] = 0;
|
||||||
|
sa->sin6_addr.in6_u.u6_addr32[1] = 0;
|
||||||
|
sa->sin6_addr.in6_u.u6_addr32[2] = 0;
|
||||||
|
sa->sin6_addr.in6_u.u6_addr32[3] = 0;
|
||||||
|
#elif HAVE_IP6_SOCKADDR==4
|
||||||
|
sa->sin6_addr._S6_un._S6_u32[0] = 0;
|
||||||
|
sa->sin6_addr._S6_un._S6_u32[1] = 0;
|
||||||
|
sa->sin6_addr._S6_un._S6_u32[2] = 0;
|
||||||
|
sa->sin6_addr._S6_un._S6_u32[3] = 0;
|
||||||
|
#elif HAVE_IP6_SOCKADDR==5
|
||||||
|
sa->sin6_addr.__u6_addr.__u6_addr32[0] = 0;
|
||||||
|
sa->sin6_addr.__u6_addr.__u6_addr32[1] = 0;
|
||||||
|
sa->sin6_addr.__u6_addr.__u6_addr32[2] = 0;
|
||||||
|
sa->sin6_addr.__u6_addr.__u6_addr32[3] = 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
|
||||||
|
|
||||||
|
#if _WITH_SOCKET
|
||||||
|
/* initializes the socket address of the specified address family. Returns the
|
||||||
|
length of the specific socket address, or 0 on error. */
|
||||||
|
socklen_t socket_init(int af, union sockaddr_union *sa) {
|
||||||
|
switch (af) {
|
||||||
|
#if WITH_UNIX
|
||||||
|
case AF_UNIX: socket_un_init(&sa->un); return sizeof(sa->un);
|
||||||
|
#endif
|
||||||
|
#if WITH_IP4
|
||||||
|
case AF_INET: socket_in_init(&sa->ip4); return sizeof(sa->ip4);
|
||||||
|
#endif
|
||||||
|
#if WITH_IP6
|
||||||
|
case AF_INET6: socket_in6_init(&sa->ip6); return sizeof(sa->ip6);
|
||||||
|
#endif
|
||||||
|
default: Error1("socket_init(): unknown address family %d", af);
|
||||||
|
memset(sa, 0, sizeof(union sockaddr_union));
|
||||||
|
sa->soa.sa_family = af;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
|
#if WITH_UNIX
|
||||||
|
#define XIOUNIXSOCKOVERHEAD (sizeof(struct sockaddr_un)-sizeof(((struct sockaddr_un*)0)->sun_path))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _WITH_SOCKET
|
||||||
|
char *sockaddr_info(const struct sockaddr *sa, socklen_t salen, char *buff, size_t blen) {
|
||||||
|
char ubuff[5*UNIX_PATH_MAX+3];
|
||||||
|
char *lbuff = buff;
|
||||||
|
char *cp = lbuff;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if ((n = snprintf(cp, blen, "AF=%d ", sa->sa_family)) < 0) {
|
||||||
|
Warn1("sockaddr_info(): buffer too short ("F_Zu")", blen);
|
||||||
|
*buff = '\0';
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
cp += n, blen -= n;
|
||||||
|
|
||||||
|
switch (sa->sa_family) {
|
||||||
|
#if WITH_UNIX
|
||||||
|
case 0:
|
||||||
|
case AF_UNIX:
|
||||||
|
#if WITH_ABSTRACT_UNIXSOCKET
|
||||||
|
if (salen > XIOUNIXSOCKOVERHEAD &&
|
||||||
|
sa->sa_data[0] == '\0') {
|
||||||
|
char *nextc;
|
||||||
|
// nextc =
|
||||||
|
// sanitize_string((char *)&sa->sa_data+1, salen-XIOUNIXSOCKOVERHEAD-1,
|
||||||
|
// ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
||||||
|
nextc =
|
||||||
|
sanitize_string((char *)&sa->sa_data, salen-XIOUNIXSOCKOVERHEAD,
|
||||||
|
ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
||||||
|
*nextc = '\0';
|
||||||
|
// snprintf(cp, blen, "\"\\0%s\"", ubuff);
|
||||||
|
snprintf(cp, blen, "\"%s\"", ubuff);
|
||||||
|
} else
|
||||||
|
#endif /* WITH_ABSTRACT_UNIXSOCKET */
|
||||||
|
{
|
||||||
|
char *nextc;
|
||||||
|
nextc =
|
||||||
|
sanitize_string((char *)&sa->sa_data,
|
||||||
|
MIN(UNIX_PATH_MAX, strlen((char *)&sa->sa_data)),
|
||||||
|
ubuff, XIOSAN_DEFAULT_BACKSLASH_OCT_3);
|
||||||
|
*nextc = '\0';
|
||||||
|
snprintf(cp, blen, "\"%s\"", ubuff);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if WITH_IP4
|
||||||
|
case AF_INET: sockaddr_inet4_info((struct sockaddr_in *)sa, cp, blen);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if WITH_IP6
|
||||||
|
case AF_INET6: sockaddr_inet6_info((struct sockaddr_in6 *)sa, cp, blen);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
if ((snprintf(cp, blen,
|
||||||
|
"0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||||
|
sa->sa_data[0], sa->sa_data[1], sa->sa_data[2],
|
||||||
|
sa->sa_data[3], sa->sa_data[4], sa->sa_data[5],
|
||||||
|
sa->sa_data[6], sa->sa_data[7], sa->sa_data[8],
|
||||||
|
sa->sa_data[9], sa->sa_data[10], sa->sa_data[11],
|
||||||
|
sa->sa_data[12], sa->sa_data[13])) < 0) {
|
||||||
|
Warn("sockaddr_info(): buffer too short");
|
||||||
|
*buff = '\0';
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lbuff;
|
||||||
|
}
|
||||||
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_UNIX
|
||||||
|
char *sockaddr_unix_info(const struct sockaddr_un *sa, socklen_t salen, char *buff, size_t blen) {
|
||||||
|
blen = Min(blen, sizeof(sa->sun_path));
|
||||||
|
strncpy(buff, sa->sun_path, blen);
|
||||||
|
if (strlen(buff) >= blen) {
|
||||||
|
buff[blen-1] = '\0';
|
||||||
|
}
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
#endif /* WITH_UNIX */
|
||||||
|
|
||||||
|
#if WITH_IP4
|
||||||
|
/* addr in host byte order! */
|
||||||
|
char *inet4addr_info(uint32_t addr, char *buff, size_t blen) {
|
||||||
|
if (snprintf(buff, blen, "%u.%u.%u.%u",
|
||||||
|
(unsigned int)(addr >> 24), (unsigned int)((addr >> 16) & 0xff),
|
||||||
|
(unsigned int)((addr >> 8) & 0xff), (unsigned int)(addr & 0xff)) < 0) {
|
||||||
|
Warn("inet4addr_info(): buffer too short");
|
||||||
|
buff[blen-1] = '\0';
|
||||||
|
}
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
|
||||||
|
#if WITH_IP4
|
||||||
|
char *sockaddr_inet4_info(const struct sockaddr_in *sa, char *buff, size_t blen) {
|
||||||
|
if (snprintf(buff, blen, "%u.%u.%u.%u:%hu",
|
||||||
|
((unsigned char *)&sa->sin_addr.s_addr)[0],
|
||||||
|
((unsigned char *)&sa->sin_addr.s_addr)[1],
|
||||||
|
((unsigned char *)&sa->sin_addr.s_addr)[2],
|
||||||
|
((unsigned char *)&sa->sin_addr.s_addr)[3],
|
||||||
|
htons(sa->sin_port)) < 0) {
|
||||||
|
Warn("sockaddr_inet4_info(): buffer too short");
|
||||||
|
buff[blen-1] = '\0';
|
||||||
|
}
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
|
||||||
|
#if !HAVE_INET_NTOP
|
||||||
|
/* http://www.opengroup.org/onlinepubs/000095399/functions/inet_ntop.html */
|
||||||
|
const char *inet_ntop(int pf, const void *binaddr,
|
||||||
|
char *addrtext, socklen_t textlen) {
|
||||||
|
size_t retlen;
|
||||||
|
switch (pf) {
|
||||||
|
case PF_INET:
|
||||||
|
if ((retlen =
|
||||||
|
snprintf(addrtext, textlen, "%u.%u.%u.%u",
|
||||||
|
((unsigned char *)binaddr)[0],
|
||||||
|
((unsigned char *)binaddr)[1],
|
||||||
|
((unsigned char *)binaddr)[2],
|
||||||
|
((unsigned char *)binaddr)[3]))
|
||||||
|
< 0) {
|
||||||
|
return NULL; /* errno is valid */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PF_INET6:
|
||||||
|
if ((retlen =
|
||||||
|
snprintf(addrtext, textlen, "%x:%x:%x:%x:%x:%x:%x:%x",
|
||||||
|
ntohs(((uint16_t *)binaddr)[0]),
|
||||||
|
ntohs(((uint16_t *)binaddr)[1]),
|
||||||
|
ntohs(((uint16_t *)binaddr)[2]),
|
||||||
|
ntohs(((uint16_t *)binaddr)[3]),
|
||||||
|
ntohs(((uint16_t *)binaddr)[4]),
|
||||||
|
ntohs(((uint16_t *)binaddr)[5]),
|
||||||
|
ntohs(((uint16_t *)binaddr)[6]),
|
||||||
|
ntohs(((uint16_t *)binaddr)[7])
|
||||||
|
))
|
||||||
|
< 0) {
|
||||||
|
return NULL; /* errno is valid */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errno = EAFNOSUPPORT;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
addrtext[retlen] = '\0';
|
||||||
|
return addrtext;
|
||||||
|
}
|
||||||
|
#endif /* !HAVE_INET_NTOP */
|
||||||
|
|
||||||
|
#if WITH_IP6
|
||||||
|
/* convert the IP6 socket address to human readable form. buff should be at
|
||||||
|
least 50 chars long */
|
||||||
|
char *sockaddr_inet6_info(const struct sockaddr_in6 *sa, char *buff, size_t blen) {
|
||||||
|
if (snprintf(buff, blen, "[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]:%hu",
|
||||||
|
#if HAVE_IP6_SOCKADDR==0
|
||||||
|
(sa->sin6_addr.s6_addr[0]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[1],
|
||||||
|
(sa->sin6_addr.s6_addr[2]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[3],
|
||||||
|
(sa->sin6_addr.s6_addr[4]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[5],
|
||||||
|
(sa->sin6_addr.s6_addr[6]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[7],
|
||||||
|
(sa->sin6_addr.s6_addr[8]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[9],
|
||||||
|
(sa->sin6_addr.s6_addr[10]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[11],
|
||||||
|
(sa->sin6_addr.s6_addr[12]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[13],
|
||||||
|
(sa->sin6_addr.s6_addr[14]<<8)+
|
||||||
|
sa->sin6_addr.s6_addr[15],
|
||||||
|
#elif HAVE_IP6_SOCKADDR==1
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr.u6_addr16)[0]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr.u6_addr16)[1]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr.u6_addr16)[2]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr.u6_addr16)[3]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr.u6_addr16)[4]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr.u6_addr16)[5]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr.u6_addr16)[6]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr.u6_addr16)[7]),
|
||||||
|
#elif HAVE_IP6_SOCKADDR==2
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr16)[0]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr16)[1]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr16)[2]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr16)[3]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr16)[4]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr16)[5]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr16)[6]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.u6_addr16)[7]),
|
||||||
|
#elif HAVE_IP6_SOCKADDR==3
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.in6_u.u6_addr16)[0]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.in6_u.u6_addr16)[1]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.in6_u.u6_addr16)[2]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.in6_u.u6_addr16)[3]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.in6_u.u6_addr16)[4]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.in6_u.u6_addr16)[5]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.in6_u.u6_addr16)[6]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.in6_u.u6_addr16)[7]),
|
||||||
|
#elif HAVE_IP6_SOCKADDR==4
|
||||||
|
(sa->sin6_addr._S6_un._S6_u8[0]<<8)|(sa->sin6_addr._S6_un._S6_u8[1]&0xff),
|
||||||
|
(sa->sin6_addr._S6_un._S6_u8[2]<<8)|(sa->sin6_addr._S6_un._S6_u8[3]&0xff),
|
||||||
|
(sa->sin6_addr._S6_un._S6_u8[4]<<8)|(sa->sin6_addr._S6_un._S6_u8[5]&0xff),
|
||||||
|
(sa->sin6_addr._S6_un._S6_u8[6]<<8)|(sa->sin6_addr._S6_un._S6_u8[7]&0xff),
|
||||||
|
(sa->sin6_addr._S6_un._S6_u8[8]<<8)|(sa->sin6_addr._S6_un._S6_u8[9]&0xff),
|
||||||
|
(sa->sin6_addr._S6_un._S6_u8[10]<<8)|(sa->sin6_addr._S6_un._S6_u8[11]&0xff),
|
||||||
|
(sa->sin6_addr._S6_un._S6_u8[12]<<8)|(sa->sin6_addr._S6_un._S6_u8[13]&0xff),
|
||||||
|
(sa->sin6_addr._S6_un._S6_u8[14]<<8)|(sa->sin6_addr._S6_un._S6_u8[15]&0xff),
|
||||||
|
#elif HAVE_IP6_SOCKADDR==5
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.__u6_addr.__u6_addr16)[0]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.__u6_addr.__u6_addr16)[1]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.__u6_addr.__u6_addr16)[2]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.__u6_addr.__u6_addr16)[3]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.__u6_addr.__u6_addr16)[4]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.__u6_addr.__u6_addr16)[5]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.__u6_addr.__u6_addr16)[6]),
|
||||||
|
ntohs(((unsigned short *)&sa->sin6_addr.__u6_addr.__u6_addr16)[7]),
|
||||||
|
#endif
|
||||||
|
ntohs(sa->sin6_port)) < 0) {
|
||||||
|
Warn("sockaddr_inet6_info(): buffer too short");
|
||||||
|
buff[blen-1] = '\0';
|
||||||
|
}
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
|
||||||
|
/* fill the list with the supplementary group ids of user.
|
||||||
|
caller passes size of list in ngroups, function returns number of groups in
|
||||||
|
ngroups.
|
||||||
|
function returns 0 if 0 or more groups were found, or 1 if the list is too
|
||||||
|
short. */
|
||||||
|
int getusergroups(const char *user, gid_t *list, size_t *ngroups) {
|
||||||
|
struct group *grp;
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
|
setgrent();
|
||||||
|
while (grp = getgrent()) {
|
||||||
|
char **gusr = grp->gr_mem;
|
||||||
|
while (*gusr) {
|
||||||
|
if (!strcmp(*gusr, user)) {
|
||||||
|
if (i == *ngroups)
|
||||||
|
return 1;
|
||||||
|
list[i++] = grp->gr_gid;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++gusr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endgrent();
|
||||||
|
*ngroups = i;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !HAVE_HSTRERROR
|
||||||
|
const char *hstrerror(int err) {
|
||||||
|
static const char *h_messages[] = {
|
||||||
|
"success",
|
||||||
|
"authoritative answer not found",
|
||||||
|
"non-authoritative, host not found, or serverfail",
|
||||||
|
"Host name lookup failure", /* "non recoverable error" */
|
||||||
|
"valid name, no data record of requested type" };
|
||||||
|
|
||||||
|
assert(HOST_NOT_FOUND==1);
|
||||||
|
assert(TRY_AGAIN==2);
|
||||||
|
assert(NO_RECOVERY==3);
|
||||||
|
assert(NO_DATA==4);
|
||||||
|
if ((err < 0) || err > sizeof(h_messages)/sizeof(const char *)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return h_messages[err];
|
||||||
|
}
|
||||||
|
#endif /* !HAVE_HSTRERROR */
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_TCP || WITH_UDP
|
||||||
|
/* returns port in network byte order */
|
||||||
|
int parseport(const char *portname, int ipproto) {
|
||||||
|
struct servent *se;
|
||||||
|
char *extra;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if (isdigit(portname[0]&0xff)) {
|
||||||
|
result = htons(strtoul(portname, &extra, 0));
|
||||||
|
if (*extra != '\0') {
|
||||||
|
Error3("parseport(\"%s\", %d): extra trailing data \"%s\"",
|
||||||
|
portname, ipproto, extra);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((se = getservbyname(portname, ipproto==IPPROTO_TCP?"tcp":"udp")) == NULL) {
|
||||||
|
Error2("cannot resolve service \"%s/%d\"", portname, ipproto);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return se->s_port;
|
||||||
|
}
|
||||||
|
#endif /* WITH_TCP || WITH_UDP */
|
||||||
|
|
||||||
|
#if WITH_IP4 || WITH_IP6
|
||||||
|
/* check the systems interfaces for ifname and return its index
|
||||||
|
or -1 if no interface with this name was found */
|
||||||
|
int ifindexbyname(const char *ifname) {
|
||||||
|
/* Linux: man 7 netdevice */
|
||||||
|
/* FreeBSD: man 4 networking */
|
||||||
|
/* Solaris: man 7 if_tcp */
|
||||||
|
|
||||||
|
#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCGIFCONF) && defined(SIOCGIFINDEX)
|
||||||
|
/* currently we support Linux, FreeBSD; not Solaris */
|
||||||
|
|
||||||
|
#define IFBUFSIZ 1024
|
||||||
|
int s;
|
||||||
|
struct ifreq ifr;
|
||||||
|
|
||||||
|
if (ifname[0] == '\0') {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if ((s = Socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) {
|
||||||
|
Error1("socket(PF_INET, SOCK_DGRAM, IPPROTO_IP): %s", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
|
||||||
|
if (Ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
|
Close(s);
|
||||||
|
Info3("ioctl(%d, SIOCGIFINDEX, {%s}): %s",
|
||||||
|
s, ifr.ifr_name, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Close(s);
|
||||||
|
#if HAVE_STRUCT_IFREQ_IFR_INDEX
|
||||||
|
return ifr.ifr_index;
|
||||||
|
#elif HAVE_STRUCT_IFREQ_IFR_IFINDEX
|
||||||
|
return ifr.ifr_ifindex;
|
||||||
|
#endif /* HAVE_STRUCT_IFREQ_IFR_IFINDEX */
|
||||||
|
|
||||||
|
#else /* !defined(HAVE_ STRUCT_IFREQ) && defined(SIOCGIFCONF) && defined(SIOCGIFINDEX) */
|
||||||
|
return -1;
|
||||||
|
#endif /* !defined(HAVE_ STRUCT_IFREQ) && defined(SIOCGIFCONF) && defined(SIOCGIFINDEX) */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* like ifindexbyname(), but allows an index number as input.
|
||||||
|
writes the resulting index to *ifindex and returns 0,
|
||||||
|
or returns -1 on error */
|
||||||
|
int ifindex(const char *ifname, unsigned int *ifindex) {
|
||||||
|
char *endptr;
|
||||||
|
long int val;
|
||||||
|
|
||||||
|
if (ifname[0] == '\0') {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
val = strtol(ifname, &endptr, 0);
|
||||||
|
if (endptr[0] == '\0') {
|
||||||
|
*ifindex = val;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((val = ifindexbyname(ifname)) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*ifindex = val;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* WITH_IP4 || WITH_IP6 */
|
98
sysutils.h
Normal file
98
sysutils.h
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/* $Id: sysutils.h,v 1.23 2007/03/06 21:05:37 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __sysutils_h_included
|
||||||
|
#define __sysutils_h_included 1
|
||||||
|
|
||||||
|
#if WITH_IP6
|
||||||
|
/* not all OSes provide in6_addr that allows splitting to 16 or 32 bit junks of
|
||||||
|
the host address part of sockaddr_in6; here we help ourselves */
|
||||||
|
union xioin6_u {
|
||||||
|
uint8_t u6_addr8[16];
|
||||||
|
uint16_t u6_addr16[8];
|
||||||
|
uint32_t u6_addr32[4];
|
||||||
|
} ;
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
|
||||||
|
union sockaddr_union {
|
||||||
|
struct sockaddr soa;
|
||||||
|
#if WITH_UNIX
|
||||||
|
struct sockaddr_un un;
|
||||||
|
#endif /* WITH_UNIX */
|
||||||
|
#if WITH_IP4
|
||||||
|
struct sockaddr_in ip4;
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
#if WITH_IP6
|
||||||
|
struct sockaddr_in6 ip6;
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
} ;
|
||||||
|
|
||||||
|
#if _WITH_IP4
|
||||||
|
struct xiorange_ip4 {
|
||||||
|
struct in_addr netaddr; /* network byte order */
|
||||||
|
struct in_addr netmask; /* network byte order */
|
||||||
|
} ;
|
||||||
|
#endif /* _WITH_IP4 */
|
||||||
|
|
||||||
|
#if _WITH_IP6
|
||||||
|
struct xiorange_ip6 {
|
||||||
|
struct in6_addr addr;
|
||||||
|
struct in6_addr mask;
|
||||||
|
} ;
|
||||||
|
#endif /* _WITH_IP4 */
|
||||||
|
|
||||||
|
#if _WITH_SOCKET
|
||||||
|
union xiorange_union {
|
||||||
|
#if _WITH_IP4
|
||||||
|
struct xiorange_ip4 ip4;
|
||||||
|
#endif /* _WITH_IP4 */
|
||||||
|
#if _WITH_IP6
|
||||||
|
struct xiorange_ip6 ip6;
|
||||||
|
#endif /* _WITH_IP6 */
|
||||||
|
} ;
|
||||||
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
|
#if _WITH_SOCKET
|
||||||
|
extern socklen_t socket_init(int af, union sockaddr_union *sa);
|
||||||
|
#endif
|
||||||
|
#if WITH_UNIX
|
||||||
|
extern void socket_un_init(struct sockaddr_un *sa);
|
||||||
|
#endif /* WITH_UNIX */
|
||||||
|
#if _WITH_IP4
|
||||||
|
extern void socket_in_init(struct sockaddr_in *sa);
|
||||||
|
#endif /* _WITH_IP4 */
|
||||||
|
#if _WITH_IP6
|
||||||
|
extern void socket_in6_init(struct sockaddr_in6 *sa);
|
||||||
|
#endif /* _WITH_IP4 */
|
||||||
|
|
||||||
|
#if _WITH_SOCKET
|
||||||
|
extern char *sockaddr_info(const struct sockaddr *sa, socklen_t salen, char *buff, size_t blen);
|
||||||
|
#endif
|
||||||
|
#if WITH_UNIX
|
||||||
|
extern char *sockaddr_unix_info(const struct sockaddr_un *sa, socklen_t salen, char *buff, size_t blen);
|
||||||
|
#endif /* WITH_UNIX */
|
||||||
|
#if WITH_IP4
|
||||||
|
extern char *inet4addr_info(uint32_t addr, char *buff, size_t blen);
|
||||||
|
extern char *sockaddr_inet4_info(const struct sockaddr_in *sa, char *buff, size_t blen);
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
#if WITH_IP6
|
||||||
|
extern char *sockaddr_inet6_info(const struct sockaddr_in6 *sa, char *buff, size_t blen);
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
#if !HAVE_INET_NTOP
|
||||||
|
extern const char *inet_ntop(int pf, const void *binaddr,
|
||||||
|
char *addrtext, socklen_t textlen);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int getusergroups(const char *user, gid_t *list, size_t *ngroups);
|
||||||
|
|
||||||
|
#if !HAVE_HSTRERROR
|
||||||
|
extern const char *hstrerror(int err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int parseport(const char *portname, int proto);
|
||||||
|
|
||||||
|
extern int ifindexbyname(const char *ifname);
|
||||||
|
extern int ifindex(const char *ifname, unsigned int *ifindex);
|
||||||
|
|
||||||
|
#endif /* !defined(__sysutils_h_included) */
|
9
testcert.conf
Normal file
9
testcert.conf
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
prompt=no
|
||||||
|
|
||||||
|
[ req ]
|
||||||
|
default_bits = 768
|
||||||
|
distinguished_name=Test
|
||||||
|
|
||||||
|
[ Test ]
|
||||||
|
countryName = XY
|
||||||
|
|
147
utils.c
Normal file
147
utils.c
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
/* $Id: utils.c,v 1.17 2007/02/08 18:36:16 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* useful additions to C library */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "sysincludes.h"
|
||||||
|
|
||||||
|
#include "compat.h" /* socklen_t */
|
||||||
|
#include "mytypes.h"
|
||||||
|
#include "sycls.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if !HAVE_MEMRCHR
|
||||||
|
/* GNU extension, available since glibc 2.1.91 */
|
||||||
|
void *memrchr(const void *s, int c, size_t n) {
|
||||||
|
const unsigned char *t = ((unsigned char *)s)+n;
|
||||||
|
while (--t >= (unsigned char *)s) {
|
||||||
|
if (*t == c) break;
|
||||||
|
}
|
||||||
|
if (t < (unsigned char *)s)
|
||||||
|
return NULL;
|
||||||
|
return (void *)t;
|
||||||
|
}
|
||||||
|
#endif /* !HAVE_MEMRCHR */
|
||||||
|
|
||||||
|
void *memdup(const void *src, size_t n) {
|
||||||
|
void *dest;
|
||||||
|
|
||||||
|
if ((dest = Malloc(n)) == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(dest, src, n);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* search the keyword-table for a match of the leading part of name. */
|
||||||
|
/* returns the pointer to the matching field of the keyword or NULL if no
|
||||||
|
keyword was found. */
|
||||||
|
const struct wordent *keyw(const struct wordent *keywds, const char *name, unsigned int nkeys) {
|
||||||
|
unsigned int lower, upper, mid;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
lower = 0;
|
||||||
|
upper = nkeys;
|
||||||
|
|
||||||
|
while (upper - lower > 1)
|
||||||
|
{
|
||||||
|
mid = (upper + lower) >> 1;
|
||||||
|
if (!(r = strcasecmp(keywds[mid].name, name)))
|
||||||
|
{
|
||||||
|
return &keywds[mid];
|
||||||
|
}
|
||||||
|
if (r < 0)
|
||||||
|
lower = mid;
|
||||||
|
else
|
||||||
|
upper = mid;
|
||||||
|
}
|
||||||
|
if (nkeys > 0 && !(strcasecmp(keywds[lower].name, name)))
|
||||||
|
{
|
||||||
|
return &keywds[lower];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Linux: setenv(), AIX: putenv() */
|
||||||
|
#if !HAVE_SETENV
|
||||||
|
int setenv(const char *name, const char *value, int overwrite) {
|
||||||
|
int result;
|
||||||
|
char *env;
|
||||||
|
if (!overwrite) {
|
||||||
|
if (getenv(name)) return 0; /* already exists */
|
||||||
|
}
|
||||||
|
if ((env = Malloc(strlen(name)+strlen(value)+2)) != NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
sprintf(env, "%s=%s", name, value);
|
||||||
|
if ((result = putenv(env)) != 0) { /* AIX docu says "... nonzero ..." */
|
||||||
|
free(env);
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
|
/* linux "man putenv" says: ...this string becomes part of the environment*/
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif /* !HAVE_SETENV */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* sanitize an "untrusted" character. output buffer must provide at least 5
|
||||||
|
characters space.
|
||||||
|
Does not append null. returns length out output (currently: max 4) */
|
||||||
|
static size_t sanitize_char(char c, char *o, int style) {
|
||||||
|
int hn; /* high nibble */
|
||||||
|
int ln; /* low nibble */
|
||||||
|
int n; /* written chars */
|
||||||
|
if (isprint(c)) {
|
||||||
|
*o = c;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
*o++ = '\\';
|
||||||
|
n = 2;
|
||||||
|
switch (c) {
|
||||||
|
case '\0': *o++ = '0'; break;
|
||||||
|
case '\a': *o++ = 'a'; break;
|
||||||
|
case '\b': *o++ = 'b'; break;
|
||||||
|
case '\t': *o++ = 't'; break;
|
||||||
|
case '\n': *o++ = 'n'; break;
|
||||||
|
case '\v': *o++ = 'v'; break;
|
||||||
|
case '\f': *o++ = 'f'; break;
|
||||||
|
case '\r': *o++ = 'r'; break;
|
||||||
|
case '\'': *o++ = '\''; break;
|
||||||
|
case '\"': *o++ = '"'; break;
|
||||||
|
case '\\': *o++ = '\\'; break;
|
||||||
|
default:
|
||||||
|
*o++ = 'x';
|
||||||
|
hn = (c>>4)&0x0f;
|
||||||
|
ln = c&0x0f;
|
||||||
|
*o++ = (hn>=10 ? (('A'-1)+(hn-10)) : ('0'+hn));
|
||||||
|
*o++ = (ln>=10 ? (('A'-1)+(ln-10)) : ('0'+ln));
|
||||||
|
n = 4;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sanitize "untrusted" text, replacing special control characters with the C
|
||||||
|
string version ("\x"), and replacing unprintable chars with ".".
|
||||||
|
text can grow to four times of input, so keep output buffer long enough!
|
||||||
|
returns a pointer to the first untouched byte of the output buffer.
|
||||||
|
*/
|
||||||
|
char *sanitize_string(const char *data, /* input data */
|
||||||
|
size_t bytes, /* length of input data, >=0 */
|
||||||
|
char *coded, /* output buffer, must be long enough */
|
||||||
|
int style
|
||||||
|
) {
|
||||||
|
int c;
|
||||||
|
|
||||||
|
while (bytes > 0) {
|
||||||
|
c = *(unsigned char *)data++;
|
||||||
|
coded += sanitize_char(c, coded, style);
|
||||||
|
--bytes;
|
||||||
|
}
|
||||||
|
return coded;
|
||||||
|
}
|
68
utils.h
Normal file
68
utils.h
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/* $Id: utils.h,v 1.7 2007/02/08 18:36:16 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __utils_h_included
|
||||||
|
#define __utils_h_included 1
|
||||||
|
|
||||||
|
/* a generic name table entry */
|
||||||
|
struct wordent {
|
||||||
|
const char *name;
|
||||||
|
void *desc;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
#if !HAVE_MEMRCHR
|
||||||
|
extern void *memrchr(const void *s, int c, size_t n);
|
||||||
|
#endif
|
||||||
|
extern void *memdup(const void *src, size_t n);
|
||||||
|
#if !HAVE_SETENV
|
||||||
|
extern int setenv(const char *name, const char *value, int overwrite);
|
||||||
|
#endif /* !HAVE_SETENV */
|
||||||
|
|
||||||
|
extern const struct wordent *keyw(const struct wordent *keywds, const char *name, unsigned int nkeys);
|
||||||
|
|
||||||
|
|
||||||
|
#define XIOSAN_ZERO_MASK 0x000f
|
||||||
|
#define XIOSAN_ZERO_DEFAULT 0x0000
|
||||||
|
#define XIOSAN_ZERO_DOT 0x0001
|
||||||
|
#define XIOSAN_ZERO_BACKSLASH_OCT_3 0x0002
|
||||||
|
#define XIOSAN_ZERO_BACKSLASH_OCT_4 0x0003
|
||||||
|
#define XIOSAN_ZERO_BACKSLASHX_HEX_UP 0x0004
|
||||||
|
#define XIOSAN_ZERO_BACKSLASHX_HEX_LOW 0x0005
|
||||||
|
#define XIOSAN_ZERO_PERCENT_HEX_UP 0x0006
|
||||||
|
#define XIOSAN_ZERO_PERCENT_HEX_LOW 0x0007
|
||||||
|
#define XIOSAN_CONTROL_MASK 0x00f0
|
||||||
|
#define XIOSAN_CONTROL_DEFAULT 0x0000
|
||||||
|
#define XIOSAN_CONTROL_DOT 0x0010
|
||||||
|
#define XIOSAN_CONTROL_BACKSLASH_OCT_3 0x0020
|
||||||
|
#define XIOSAN_CONTROL_BACKSLASH_OCT_4 0x0030
|
||||||
|
#define XIOSAN_CONTROL_BACKSLASHX_HEX_UP 0x0040
|
||||||
|
#define XIOSAN_CONTROL_BACKSLASHX_HEX_LOW 0x0050
|
||||||
|
#define XIOSAN_CONTROL_PERCENT_HEX_UP 0x0060
|
||||||
|
#define XIOSAN_CONTROL_PERCENT_HEX_LOW 0x0070
|
||||||
|
#define XIOSAN_UNPRINT_MASK 0x0f00
|
||||||
|
#define XIOSAN_UNPRINT_DEFAULT 0x0000
|
||||||
|
#define XIOSAN_UNPRINT_DOT 0x0100
|
||||||
|
#define XIOSAN_UNPRINT_BACKSLASH_OCT_3 0x0200
|
||||||
|
#define XIOSAN_UNPRINT_BACKSLASH_OCT_4 0x0300
|
||||||
|
#define XIOSAN_UNPRINT_BACKSLASHX_HEX_UP 0x0400
|
||||||
|
#define XIOSAN_UNPRINT_BACKSLASHX_HEX_LOW 0x0500
|
||||||
|
#define XIOSAN_UNPRINT_PERCENT_HEX_UP 0x0600
|
||||||
|
#define XIOSAN_UNPRINT_PERCENT_HEX_LOW 0x0700
|
||||||
|
#define XIOSAN_DEFAULT_MASK 0xf000
|
||||||
|
#define XIOSAN_DEFAULT_BACKSLASH_DOT 0x1000
|
||||||
|
#define XIOSAN_DEFAULT_BACKSLASH_OCT_3 0x2000
|
||||||
|
#define XIOSAN_DEFAULT_BACKSLASH_OCT_4 0x3000
|
||||||
|
#define XIOSAN_DEFAULT_BACKSLASHX_HEX_UP 0x4000
|
||||||
|
#define XIOSAN_DEFAULT_BACKSLASHX_HEX_LOW 0x5000
|
||||||
|
#define XIOSAN_DEFAULT_PERCENT_HEX_UP 0x6000
|
||||||
|
#define XIOSAN_DEFAULT_PERCENT_HEX_LOW 0x7000
|
||||||
|
|
||||||
|
extern
|
||||||
|
char *sanitize_string(const char *data, /* input data */
|
||||||
|
size_t bytes, /* length of input data, >=0 */
|
||||||
|
char *coded, /* output buffer, must be long enough */
|
||||||
|
int style);
|
||||||
|
|
||||||
|
#endif /* !defined(__utils_h_included) */
|
||||||
|
|
107
xio-ascii.c
Normal file
107
xio-ascii.c
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
/* $Id: xio-ascii.c,v 1.5 2006/07/23 07:30:46 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2002-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains functions for text encoding, decoding, and conversions */
|
||||||
|
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "xio-ascii.h"
|
||||||
|
|
||||||
|
/* for each 6 bit pattern we have an ASCII character in the arry */
|
||||||
|
const static int base64chars[] = {
|
||||||
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||||
|
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
||||||
|
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
||||||
|
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||||
|
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||||
|
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
||||||
|
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
||||||
|
'4', '5', '6', '7', '8', '9', '+', '/',
|
||||||
|
} ;
|
||||||
|
|
||||||
|
#define CHAR64(c) (base64chars[c])
|
||||||
|
|
||||||
|
char *
|
||||||
|
xiob64encodeline(const char *data, /* input data */
|
||||||
|
size_t bytes, /* length of input data, >=0 */
|
||||||
|
char *coded /* output buffer, must be long enough */
|
||||||
|
) {
|
||||||
|
int c1, c2, c3;
|
||||||
|
|
||||||
|
while (bytes > 0) {
|
||||||
|
c1 = *data++;
|
||||||
|
*coded++ = CHAR64(c1>>2);
|
||||||
|
if (--bytes == 0) {
|
||||||
|
*coded++ = CHAR64((c1&0x03)<<4);
|
||||||
|
*coded++ = '=';
|
||||||
|
*coded++ = '=';
|
||||||
|
} else {
|
||||||
|
c2 = *data++;
|
||||||
|
*coded++ = CHAR64(((c1&0x03)<<4)|(c2>>4));
|
||||||
|
if (--bytes == 0) {
|
||||||
|
*coded++ = CHAR64((c2&0x0f)<<2);
|
||||||
|
*coded++ = '=';
|
||||||
|
} else {
|
||||||
|
c3 = *data++; --bytes;
|
||||||
|
*coded++ = CHAR64(((c2&0x0f)<<2)|(c3>>6));
|
||||||
|
*coded++ = CHAR64(c3&0x3f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return coded;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* sanitize "untrusted" text, replacing special control characters with the C
|
||||||
|
string version ("\x"), and replacing unprintable chars with ".".
|
||||||
|
text can grow to double size, so keep output buffer long enough!
|
||||||
|
returns a pointer to the first untouched byte of the output buffer.
|
||||||
|
*/
|
||||||
|
char *xiosanitize(const char *data, /* input data */
|
||||||
|
size_t bytes, /* length of input data, >=0 */
|
||||||
|
char *coded /* output buffer, must be long enough */
|
||||||
|
) {
|
||||||
|
int c;
|
||||||
|
|
||||||
|
while (bytes > 0) {
|
||||||
|
c = *(unsigned char *)data++;
|
||||||
|
switch (c) {
|
||||||
|
case '\0' : *coded++ = '\\'; *coded++ = '0'; break;
|
||||||
|
case '\a' : *coded++ = '\\'; *coded++ = 'a'; break;
|
||||||
|
case '\b' : *coded++ = '\\'; *coded++ = 'b'; break;
|
||||||
|
case '\t' : *coded++ = '\\'; *coded++ = 't'; break;
|
||||||
|
case '\n' : *coded++ = '\\'; *coded++ = 'n'; break;
|
||||||
|
case '\v' : *coded++ = '\\'; *coded++ = 'v'; break;
|
||||||
|
case '\f' : *coded++ = '\\'; *coded++ = 'f'; break;
|
||||||
|
case '\r' : *coded++ = '\\'; *coded++ = 'r'; break;
|
||||||
|
case '\'' : *coded++ = '\\'; *coded++ = '\''; break;
|
||||||
|
case '\"' : *coded++ = '\\'; *coded++ = '"'; break;
|
||||||
|
case '\\' : *coded++ = '\\'; *coded++ = '\\'; break;
|
||||||
|
default:
|
||||||
|
if (!isprint(c))
|
||||||
|
c = '.';
|
||||||
|
*coded++ = c;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
--bytes;
|
||||||
|
}
|
||||||
|
return coded;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* print the bytes in hex */
|
||||||
|
char *
|
||||||
|
xiohexdump(const unsigned char *data, size_t bytes, char *coded) {
|
||||||
|
int space = 0;
|
||||||
|
while (bytes-- > 0) {
|
||||||
|
if (space) { *coded++ = ' '; }
|
||||||
|
coded += sprintf(coded, "%02x", *data++);
|
||||||
|
space = 1;
|
||||||
|
}
|
||||||
|
return coded;
|
||||||
|
}
|
20
xio-ascii.h
Normal file
20
xio-ascii.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/* $Id: xio-ascii.h,v 1.4 2006/07/23 07:30:49 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2002-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_ascii_h_included
|
||||||
|
#define __xio_ascii_h_included 1
|
||||||
|
|
||||||
|
extern char *
|
||||||
|
xiob64encodeline(const char *data, /* input data */
|
||||||
|
size_t bytes, /* length of input data, >=0 */
|
||||||
|
char *coded /* output buffer, must be long enough */
|
||||||
|
);
|
||||||
|
extern char *xiosanitize(const char *data, /* input data */
|
||||||
|
size_t bytes, /* length of input data, >=0 */
|
||||||
|
char *coded /* output buffer, must be long enough */
|
||||||
|
);
|
||||||
|
extern char *
|
||||||
|
xiohexdump(const unsigned char *data, size_t bytes, char *coded);
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_ascii_h_included) */
|
79
xio-creat.c
Normal file
79
xio-creat.c
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/* $Id: xio-creat.c,v 1.16 2006/07/13 06:39:01 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains the source for opening addresses of create type */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
|
||||||
|
#if WITH_CREAT
|
||||||
|
|
||||||
|
#include "xioopen.h"
|
||||||
|
#include "xio-named.h"
|
||||||
|
#include "xio-creat.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int xioopen_creat(int arg, const char *argv[], struct opt *opts, int rw, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
||||||
|
|
||||||
|
|
||||||
|
/*! within stream model, this is a write-only address - use 2 instead of 3 */
|
||||||
|
const struct addrdesc addr_creat = { "create", 3, xioopen_creat, GROUP_FD|GROUP_NAMED|GROUP_FILE, 0, 0, 0 HELP(":<filename>") };
|
||||||
|
|
||||||
|
|
||||||
|
/* retrieve the mode option and perform the creat() call.
|
||||||
|
returns the file descriptor or a negative value. */
|
||||||
|
static int _xioopen_creat(const char *path, int rw, struct opt *opts) {
|
||||||
|
mode_t mode = 0666;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
retropt_modet(opts, OPT_PERM, &mode);
|
||||||
|
|
||||||
|
if ((fd = Creat(path, mode)) < 0) {
|
||||||
|
Error3("creat(\"%s\", 0%03o): %s",
|
||||||
|
path, mode, strerror(errno));
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int xioopen_creat(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3) {
|
||||||
|
const char *filename = argv[1];
|
||||||
|
int rw = (xioflags&XIO_ACCMODE);
|
||||||
|
bool exists;
|
||||||
|
bool opt_unlink_close = false;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
/* remove old file, or set user/permissions on old file; parse options */
|
||||||
|
if ((result = _xioopen_named_early(argc, argv, fd, groups, &exists, opts)) < 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
|
if (opt_unlink_close) {
|
||||||
|
if ((fd->stream.unlink_close = strdup(filename)) == NULL) {
|
||||||
|
Error1("strdup(\"%s\"): out of memory", filename);
|
||||||
|
}
|
||||||
|
fd->stream.opt_unlink_close = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Notice2("creating regular file \"%s\" for %s", filename, ddirection[rw]);
|
||||||
|
if ((result = _xioopen_creat(filename, rw, opts)) < 0)
|
||||||
|
return result;
|
||||||
|
fd->stream.fd = result;
|
||||||
|
|
||||||
|
applyopts_named(filename, opts, PH_PASTOPEN);
|
||||||
|
if ((result = applyopts2(fd->stream.fd, opts, PH_PASTOPEN, PH_LATE2)) < 0)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
applyopts_cloexec(fd->stream.fd, opts);
|
||||||
|
|
||||||
|
applyopts_fchown(fd->stream.fd, opts);
|
||||||
|
|
||||||
|
if ((result = _xio_openlate(&fd->stream, opts)) < 0)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* WITH_CREAT */
|
10
xio-creat.h
Normal file
10
xio-creat.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* $Id: xio-creat.h,v 1.4 2001/11/04 17:19:20 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_creat_h_included
|
||||||
|
#define __xio_creat_h_included 1
|
||||||
|
|
||||||
|
extern const struct addrdesc addr_creat;
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_creat_h_included) */
|
137
xio-exec.c
Normal file
137
xio-exec.c
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
/* $Id: xio-exec.c,v 1.19 2006/07/12 21:59:28 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains the source for opening addresses of exec type */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
#include "xioopen.h"
|
||||||
|
#include "nestlex.h"
|
||||||
|
|
||||||
|
#include "xio-progcall.h"
|
||||||
|
#include "xio-exec.h"
|
||||||
|
|
||||||
|
#if WITH_EXEC
|
||||||
|
|
||||||
|
static int xioopen_exec(int argc, const char *argv[], struct opt *opts,
|
||||||
|
int xioflags, /* XIO_RDONLY etc. */
|
||||||
|
xiofile_t *fd,
|
||||||
|
unsigned groups,
|
||||||
|
int dummy1, int dummy2, int dummy3
|
||||||
|
);
|
||||||
|
|
||||||
|
const struct addrdesc addr_exec = { "exec", 3, xioopen_exec, GROUP_FD|GROUP_FORK|GROUP_EXEC|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_TERMIOS|GROUP_FIFO|GROUP_PTY|GROUP_PARENT, 0, 0, 0 HELP(":<command-line>") };
|
||||||
|
|
||||||
|
const struct optdesc opt_dash = { "dash", "login", OPT_DASH, GROUP_EXEC, PH_PREEXEC, TYPE_BOOL, OFUNC_SPEC };
|
||||||
|
|
||||||
|
static int xioopen_exec(int argc, const char *argv[], struct opt *opts,
|
||||||
|
int xioflags, /* XIO_RDONLY, XIO_MAYCHILD etc. */
|
||||||
|
xiofile_t *fd,
|
||||||
|
unsigned groups,
|
||||||
|
int dummy1, int dummy2, int dummy3
|
||||||
|
) {
|
||||||
|
int status;
|
||||||
|
bool dash = false;
|
||||||
|
|
||||||
|
if (argc != 2) {
|
||||||
|
Error3("\"%s:%s\": wrong number of parameters (%d instead of 1)", argv[0], argv[1], argc-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
retropt_bool(opts, OPT_DASH, &dash);
|
||||||
|
|
||||||
|
status = _xioopen_foxec(xioflags, &fd->stream, groups, &opts);
|
||||||
|
if (status < 0) return status;
|
||||||
|
if (status == 0) { /* child */
|
||||||
|
const char *ends[] = { " ", NULL };
|
||||||
|
const char *hquotes[] = { "'", NULL };
|
||||||
|
const char *squotes[] = { "\"", NULL };
|
||||||
|
const char *nests[] = {
|
||||||
|
"'", "'",
|
||||||
|
"(", ")",
|
||||||
|
"[", "]",
|
||||||
|
"{", "}",
|
||||||
|
NULL
|
||||||
|
} ;
|
||||||
|
char **pargv = NULL;
|
||||||
|
int pargc, i;
|
||||||
|
size_t len;
|
||||||
|
const char *strp;
|
||||||
|
char *token; /*! */
|
||||||
|
char *tokp;
|
||||||
|
char *path = NULL;
|
||||||
|
char *tmp;
|
||||||
|
int numleft;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
/*! Close(something) */
|
||||||
|
/* parse command line */
|
||||||
|
Debug1("child: args = \"%s\"", argv[1]);
|
||||||
|
pargv = Malloc(8*sizeof(char *));
|
||||||
|
if (pargv == NULL) return STAT_RETRYLATER;
|
||||||
|
i = 0;
|
||||||
|
len = strlen(argv[1])+1;
|
||||||
|
strp = argv[1];
|
||||||
|
token = Malloc(len); /*! */
|
||||||
|
tokp = token;
|
||||||
|
if (nestlex(&strp, &tokp, &len, ends, hquotes, squotes, nests,
|
||||||
|
true, true, false) < 0) {
|
||||||
|
Error("internal: miscalculated string lengths");
|
||||||
|
}
|
||||||
|
*tokp++ = '\0';
|
||||||
|
pargv[0] = strrchr(tokp-1, '/');
|
||||||
|
if (pargv[0] == NULL) pargv[0] = token; else ++pargv[0];
|
||||||
|
pargc = 1;
|
||||||
|
while (*strp == ' ') {
|
||||||
|
if ((pargc & 0x07) == 0) {
|
||||||
|
pargv = Realloc(pargv, (pargc+8)*sizeof(char *));
|
||||||
|
if (pargv == NULL) return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
++strp;
|
||||||
|
pargv[pargc++] = tokp;
|
||||||
|
if (nestlex(&strp, &tokp, &len, ends, hquotes, squotes, nests,
|
||||||
|
true, true, false) < 0) {
|
||||||
|
Error("internal: miscalculated string lengths");
|
||||||
|
}
|
||||||
|
*tokp++ = '\0';
|
||||||
|
}
|
||||||
|
pargv[pargc] = NULL;
|
||||||
|
|
||||||
|
if ((tmp = Malloc(strlen(pargv[0])+2)) == NULL) {
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
if (dash) {
|
||||||
|
tmp[0] = '-';
|
||||||
|
strcpy(tmp+1, pargv[0]);
|
||||||
|
} else {
|
||||||
|
strcpy(tmp, pargv[0]);
|
||||||
|
}
|
||||||
|
pargv[0] = tmp;
|
||||||
|
|
||||||
|
if (setopt_path(opts, &path) < 0) {
|
||||||
|
/* this could be dangerous, so let us abort this child... */
|
||||||
|
Exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((numleft = leftopts(opts)) > 0) {
|
||||||
|
Error1("%d option(s) could not be used", numleft);
|
||||||
|
showleft(opts);
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
|
||||||
|
Notice1("execvp'ing \"%s\"", token);
|
||||||
|
result = Execvp(token, pargv);
|
||||||
|
/* here we come only if execvp() failed */
|
||||||
|
switch (pargc) {
|
||||||
|
case 1: Error3("execvp(\"%s\", \"%s\"): %s", token, pargv[0], strerror(errno)); break;
|
||||||
|
case 2: Error4("execvp(\"%s\", \"%s\", \"%s\"): %s", token, pargv[0], pargv[1], strerror(errno)); break;
|
||||||
|
case 3:
|
||||||
|
default:
|
||||||
|
Error5("execvp(\"%s\", \"%s\", \"%s\", \"%s\", ...): %s", token, pargv[0], pargv[1], pargv[2], strerror(errno)); break;
|
||||||
|
}
|
||||||
|
Exit(1); /* this child process */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* parent */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* WITH_EXEC */
|
12
xio-exec.h
Normal file
12
xio-exec.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/* $Id: xio-exec.h,v 1.6 2002/05/19 08:05:36 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001, 2002 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_exec_h_included
|
||||||
|
#define __xio_exec_h_included 1
|
||||||
|
|
||||||
|
extern const struct addrdesc addr_exec;
|
||||||
|
|
||||||
|
extern const struct optdesc opt_dash;
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_exec_h_included) */
|
91
xio-ext2.c
Normal file
91
xio-ext2.c
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
/* $Id: xio-ext2.c,v 1.1 2006/05/07 17:06:53 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2005-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains the source for handling Linux ext2fs options
|
||||||
|
they can also be set with chattr(1) and viewed with lsattr(1) */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
#include "xioopen.h"
|
||||||
|
|
||||||
|
#include "xio-ext2.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_EXT2
|
||||||
|
|
||||||
|
/****** FD options ******/
|
||||||
|
|
||||||
|
#ifdef EXT2_SECRM_FL
|
||||||
|
/* secure deletion, chattr 's' */
|
||||||
|
const struct optdesc opt_ext2_secrm = { "ext2-secrm", "secrm", OPT_EXT2_SECRM, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_SECRM_FL };
|
||||||
|
#endif /* EXT2_SECRM_FL */
|
||||||
|
|
||||||
|
#ifdef EXT2_UNRM_FL
|
||||||
|
/* undelete, chattr 'u' */
|
||||||
|
const struct optdesc opt_ext2_unrm = { "ext2-unrm", "unrm", OPT_EXT2_UNRM, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_UNRM_FL };
|
||||||
|
#endif /* EXT2_UNRM_FL */
|
||||||
|
|
||||||
|
#ifdef EXT2_COMPR_FL
|
||||||
|
/* compress file, chattr 'c' */
|
||||||
|
const struct optdesc opt_ext2_compr = { "ext2-compr", "compr", OPT_EXT2_COMPR, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_COMPR_FL };
|
||||||
|
#endif /* EXT2_COMPR_FL */
|
||||||
|
|
||||||
|
#ifdef EXT2_SYNC_FL
|
||||||
|
/* synchronous update, chattr 'S' */
|
||||||
|
const struct optdesc opt_ext2_sync = { "ext2-sync", "sync", OPT_EXT2_SYNC, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_SYNC_FL };
|
||||||
|
#endif /* EXT2_SYNC_FL */
|
||||||
|
|
||||||
|
#ifdef EXT2_IMMUTABLE_FL
|
||||||
|
/* immutable file, chattr 'i' */
|
||||||
|
const struct optdesc opt_ext2_immutable = { "ext2-immutable", "immutable", OPT_EXT2_IMMUTABLE, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_IMMUTABLE_FL };
|
||||||
|
#endif /* EXT2_IMMUTABLE_FL */
|
||||||
|
|
||||||
|
#ifdef EXT2_APPEND_FL
|
||||||
|
/* writes to file may only append, chattr 'a' */
|
||||||
|
const struct optdesc opt_ext2_append = { "ext2-append", "append", OPT_EXT2_APPEND, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_APPEND_FL };
|
||||||
|
#endif /* EXT2_APPEND_FL */
|
||||||
|
|
||||||
|
#ifdef EXT2_NODUMP_FL
|
||||||
|
/* do not dump file, chattr 'd' */
|
||||||
|
const struct optdesc opt_ext2_nodump = { "ext2-nodump", "nodump", OPT_EXT2_NODUMP, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_NODUMP_FL };
|
||||||
|
#endif /* EXT2_NODUMP_FL */
|
||||||
|
|
||||||
|
#ifdef EXT2_NOATIME_FL
|
||||||
|
/* do not update atime, chattr 'A' */
|
||||||
|
const struct optdesc opt_ext2_noatime = { "ext2-noatime", "noatime", OPT_EXT2_NOATIME, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_NOATIME_FL };
|
||||||
|
#endif /* EXT2_NOATIME_FL */
|
||||||
|
|
||||||
|
/* EXT2_DIRTY_FL ??? */
|
||||||
|
/* EXT2_COMPRBLK_FL one ore more compress clusters */
|
||||||
|
/* EXT2_NOCOMPR_FL access raw compressed data */
|
||||||
|
/* EXT2_ECOMPR_FL compression error */
|
||||||
|
/* EXT2_BTREE_FL btree format dir */
|
||||||
|
/* EXT2_INDEX_FL hash indexed directory */
|
||||||
|
/* EXT2_IMAGIC ??? */
|
||||||
|
|
||||||
|
#ifdef EXT2_JOURNAL_DATA_FL
|
||||||
|
/* file data should be journaled, chattr 'j' */
|
||||||
|
const struct optdesc opt_ext2_journal_data = { "ext2-journal-data", "journal-data", OPT_EXT2_JOURNAL_DATA, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_JOURNAL_DATA_FL };
|
||||||
|
#endif /* EXT2_JOURNAL_DATA_FL */
|
||||||
|
|
||||||
|
#ifdef EXT2_NOTAIL_FL
|
||||||
|
/* file tail should not be merged, chattr 't' */
|
||||||
|
const struct optdesc opt_ext2_notail = { "ext2-notail", "notail", OPT_EXT2_NOTAIL, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_NOTAIL_FL };
|
||||||
|
#endif /* EXT2_NOTAIL_FL */
|
||||||
|
|
||||||
|
#ifdef EXT2_DIRSYNC_FL
|
||||||
|
/* synchronous directory modifications, chattr 'D' */
|
||||||
|
const struct optdesc opt_ext2_dirsync = { "ext2-dirsync", "dirsync", OPT_EXT2_DIRSYNC, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_DIRSYNC_FL };
|
||||||
|
#endif /* EXT2_DIRSYNC_FL */
|
||||||
|
|
||||||
|
#ifdef EXT2_TOPDIR_FL
|
||||||
|
/* top of directory hierarchies, chattr 'T' */
|
||||||
|
const struct optdesc opt_ext2_topdir = { "ext2-topdir", "topdir", OPT_EXT2_TOPDIR, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_TOPDIR_FL };
|
||||||
|
#endif /* EXT2_TOPDIR_FL */
|
||||||
|
|
||||||
|
/* EXTENTS inode uses extents */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* WITH_EXT2 */
|
||||||
|
|
||||||
|
|
21
xio-ext2.h
Normal file
21
xio-ext2.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/* $Id: xio-ext2.h,v 1.2 2006/05/31 19:28:24 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_ext2_h_included
|
||||||
|
#define __xio_ext2_h_included 1
|
||||||
|
|
||||||
|
extern const struct optdesc opt_ext2_secrm;
|
||||||
|
extern const struct optdesc opt_ext2_unrm;
|
||||||
|
extern const struct optdesc opt_ext2_compr;
|
||||||
|
extern const struct optdesc opt_ext2_sync;
|
||||||
|
extern const struct optdesc opt_ext2_immutable;
|
||||||
|
extern const struct optdesc opt_ext2_append;
|
||||||
|
extern const struct optdesc opt_ext2_nodump;
|
||||||
|
extern const struct optdesc opt_ext2_noatime;
|
||||||
|
extern const struct optdesc opt_ext2_journal_data;
|
||||||
|
extern const struct optdesc opt_ext2_notail;
|
||||||
|
extern const struct optdesc opt_ext2_dirsync;
|
||||||
|
extern const struct optdesc opt_ext2_topdir;
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_ext2_h_included) */
|
77
xio-fd.c
Normal file
77
xio-fd.c
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
/* $Id: xio-fd.c,v 1.26 2006/12/28 07:35:50 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains common file descriptor related option definitions */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
#include "xioopen.h"
|
||||||
|
|
||||||
|
#include "xio-fd.h"
|
||||||
|
|
||||||
|
/****** for ALL addresses - with open() or fcntl(F_SETFL) ******/
|
||||||
|
const struct optdesc opt_append = { "append", NULL, OPT_O_APPEND, GROUP_OPEN|GROUP_FD, PH_LATE, TYPE_BOOL, OFUNC_FCNTL, F_SETFL, O_APPEND };
|
||||||
|
const struct optdesc opt_nonblock = { "o-nonblock", "nonblock", OPT_O_NONBLOCK, GROUP_OPEN|GROUP_FD, PH_FD, TYPE_BOOL, OFUNC_FCNTL, F_SETFL, O_NONBLOCK };
|
||||||
|
#if defined(O_NDELAY) && (!defined(O_NONBLOCK) || O_NDELAY != O_NONBLOCK)
|
||||||
|
const struct optdesc opt_o_ndelay = { "o-ndelay", NULL, OPT_O_NDELAY, GROUP_OPEN|GROUP_FD, PH_LATE, TYPE_BOOL, OFUNC_FCNTL, F_SETFL, O_NDELAY };
|
||||||
|
#endif
|
||||||
|
#ifdef O_ASYNC
|
||||||
|
const struct optdesc opt_async = { "async", NULL, OPT_O_ASYNC, GROUP_OPEN|GROUP_FD, PH_LATE, TYPE_BOOL, OFUNC_FCNTL, F_SETFL, O_ASYNC };
|
||||||
|
#endif
|
||||||
|
#ifdef O_BINARY
|
||||||
|
const struct optdesc opt_o_binary = { "o-binary", "binary", OPT_O_BINARY, GROUP_OPEN|GROUP_FD, PH_OPEN, TYPE_BOOL, OFUNC_FCNTL, F_SETFL, O_BINARY };
|
||||||
|
#endif
|
||||||
|
#ifdef O_TEXT
|
||||||
|
const struct optdesc opt_o_text = { "o-text", "text", OPT_O_TEXT, GROUP_OPEN|GROUP_FD, PH_OPEN, TYPE_BOOL, OFUNC_FCNTL, F_SETFL, O_TEXT };
|
||||||
|
#endif
|
||||||
|
#ifdef O_NOINHERIT
|
||||||
|
const struct optdesc opt_o_noinherit = { "o-noinherit", "noinherit", OPT_O_NOINHERIT, GROUP_OPEN|GROUP_FD, PH_OPEN, TYPE_BOOL, OFUNC_FCNTL, F_SETFL, O_NOINHERIT };
|
||||||
|
#endif
|
||||||
|
#ifdef O_NOATIME
|
||||||
|
const struct optdesc opt_o_noatime = { "o-noatime", "noatime", OPT_O_NOATIME, GROUP_OPEN|GROUP_FD, PH_FD, TYPE_BOOL, OFUNC_FCNTL, F_SETFL, O_NOATIME };
|
||||||
|
#endif
|
||||||
|
/****** for ALL addresses - with fcntl(F_SETFD) ******/
|
||||||
|
const struct optdesc opt_cloexec = { "cloexec", NULL, OPT_CLOEXEC, GROUP_FD, PH_LATE, TYPE_BOOL, OFUNC_FCNTL, F_SETFD, FD_CLOEXEC };
|
||||||
|
/****** ftruncate() ******/
|
||||||
|
/* this record is good for ftruncate() or ftruncate64() if available */
|
||||||
|
#if HAVE_FTRUNCATE64
|
||||||
|
const struct optdesc opt_ftruncate32 = { "ftruncate32", NULL, OPT_FTRUNCATE32, GROUP_REG, PH_LATE, TYPE_OFF32, OFUNC_SPEC };
|
||||||
|
const struct optdesc opt_ftruncate64 = { "ftruncate64", "truncate", OPT_FTRUNCATE64, GROUP_REG, PH_LATE, TYPE_OFF64, OFUNC_SPEC };
|
||||||
|
#else
|
||||||
|
const struct optdesc opt_ftruncate32 = { "ftruncate32", "truncate", OPT_FTRUNCATE32, GROUP_REG, PH_LATE, TYPE_OFF32, OFUNC_SPEC };
|
||||||
|
#endif /* !HAVE_FTRUNCATE64 */
|
||||||
|
/****** for ALL addresses - permissions, ownership, and positioning ******/
|
||||||
|
const struct optdesc opt_group = { "group", "gid", OPT_GROUP, GROUP_FD|GROUP_NAMED,PH_FD,TYPE_GIDT,OFUNC_SPEC };
|
||||||
|
const struct optdesc opt_group_late= { "group-late","gid-l", OPT_GROUP_LATE,GROUP_FD, PH_LATE, TYPE_GIDT, OFUNC_SPEC };
|
||||||
|
const struct optdesc opt_perm = { "perm", "mode", OPT_PERM, GROUP_FD|GROUP_NAMED, PH_FD, TYPE_MODET,OFUNC_SPEC };
|
||||||
|
const struct optdesc opt_perm_late = { "perm-late", NULL, OPT_PERM_LATE, GROUP_FD, PH_LATE, TYPE_MODET,OFUNC_SPEC };
|
||||||
|
const struct optdesc opt_user = { "user", "uid", OPT_USER, GROUP_FD|GROUP_NAMED, PH_FD, TYPE_UIDT, OFUNC_SPEC };
|
||||||
|
const struct optdesc opt_user_late = { "user-late", "uid-l", OPT_USER_LATE, GROUP_FD, PH_LATE, TYPE_UIDT, OFUNC_SPEC };
|
||||||
|
/* for something like random access files */
|
||||||
|
#if HAVE_LSEEK64
|
||||||
|
const struct optdesc opt_lseek32_cur = { "lseek32-cur", NULL, OPT_SEEK32_CUR, GROUP_REG|GROUP_BLK, PH_LATE, TYPE_OFF32, OFUNC_SEEK32, SEEK_CUR };
|
||||||
|
const struct optdesc opt_lseek32_end = { "lseek32-end", NULL, OPT_SEEK32_END, GROUP_REG|GROUP_BLK, PH_LATE, TYPE_OFF32, OFUNC_SEEK32, SEEK_END };
|
||||||
|
const struct optdesc opt_lseek32_set = { "lseek32-set", NULL, OPT_SEEK32_SET, GROUP_REG|GROUP_BLK, PH_LATE, TYPE_OFF32, OFUNC_SEEK32, SEEK_SET };
|
||||||
|
const struct optdesc opt_lseek64_cur = { "lseek64-cur", "seek-cur", OPT_SEEK64_CUR, GROUP_REG|GROUP_BLK, PH_LATE, TYPE_OFF64, OFUNC_SEEK64, SEEK_CUR };
|
||||||
|
const struct optdesc opt_lseek64_end = { "lseek64-end", "seek-end", OPT_SEEK64_END, GROUP_REG|GROUP_BLK, PH_LATE, TYPE_OFF64, OFUNC_SEEK64, SEEK_END };
|
||||||
|
const struct optdesc opt_lseek64_set = { "lseek64-set", "seek", OPT_SEEK64_SET, GROUP_REG|GROUP_BLK, PH_LATE, TYPE_OFF64, OFUNC_SEEK64, SEEK_SET };
|
||||||
|
#else
|
||||||
|
const struct optdesc opt_lseek32_cur = { "lseek32-cur", "seek-cur", OPT_SEEK32_CUR, GROUP_REG|GROUP_BLK, PH_LATE, TYPE_OFF32, OFUNC_SEEK32, SEEK_CUR };
|
||||||
|
const struct optdesc opt_lseek32_end = { "lseek32-end", "seek-end", OPT_SEEK32_END, GROUP_REG|GROUP_BLK, PH_LATE, TYPE_OFF32, OFUNC_SEEK32, SEEK_END };
|
||||||
|
const struct optdesc opt_lseek32_set = { "lseek32-set", "seek", OPT_SEEK32_SET, GROUP_REG|GROUP_BLK, PH_LATE, TYPE_OFF32, OFUNC_SEEK32, SEEK_SET };
|
||||||
|
#endif /* !HAVE_LSEEK64 */
|
||||||
|
/* for all addresses (?) */
|
||||||
|
const struct optdesc opt_f_setlk_rd = { "f-setlk-rd", "setlk-rd", OPT_F_SETLK_RD, GROUP_FD, PH_FD,TYPE_BOOL, OFUNC_SPEC, F_SETLK, F_RDLCK };
|
||||||
|
const struct optdesc opt_f_setlkw_rd = { "f-setlkw-rd", "setlkw-rd",OPT_F_SETLKW_RD, GROUP_FD, PH_FD,TYPE_BOOL, OFUNC_SPEC, F_SETLKW, F_RDLCK };
|
||||||
|
const struct optdesc opt_f_setlk_wr = { "f-setlk-wr", "setlk", OPT_F_SETLK_WR, GROUP_FD, PH_FD,TYPE_BOOL, OFUNC_SPEC, F_SETLK, F_WRLCK };
|
||||||
|
const struct optdesc opt_f_setlkw_wr = { "f-setlkw-wr", "setlkw", OPT_F_SETLKW_WR, GROUP_FD, PH_FD,TYPE_BOOL, OFUNC_SPEC, F_SETLKW, F_WRLCK };
|
||||||
|
#if HAVE_FLOCK
|
||||||
|
const struct optdesc opt_flock_sh = { "flock-sh", NULL, OPT_FLOCK_SH, GROUP_FD, PH_FD,TYPE_BOOL, OFUNC_FLOCK, LOCK_SH };
|
||||||
|
const struct optdesc opt_flock_sh_nb = { "flock-sh-nb", NULL, OPT_FLOCK_SH_NB, GROUP_FD, PH_FD,TYPE_BOOL, OFUNC_FLOCK, LOCK_SH|LOCK_NB };
|
||||||
|
const struct optdesc opt_flock_ex = { "flock-ex", "flock", OPT_FLOCK_EX, GROUP_FD, PH_FD,TYPE_BOOL, OFUNC_FLOCK, LOCK_EX };
|
||||||
|
const struct optdesc opt_flock_ex_nb = { "flock-ex-nb", "flock-nb", OPT_FLOCK_EX_NB, GROUP_FD, PH_FD,TYPE_BOOL, OFUNC_FLOCK, LOCK_EX|LOCK_NB };
|
||||||
|
#endif /* HAVE_FLOCK */
|
||||||
|
const struct optdesc opt_cool_write = { "cool-write", "coolwrite", OPT_COOL_WRITE, GROUP_FD, PH_INIT, TYPE_BOOL, OFUNC_OFFSET, (bool)&((xiofile_t *)0)->stream.cool_write };
|
||||||
|
|
||||||
|
/* control closing of connections */
|
||||||
|
const struct optdesc opt_end_close = { "end-close", "close", OPT_END_CLOSE, GROUP_FD, PH_INIT, TYPE_CONST, OFUNC_OFFSET, (bool)&((xiofile_t *)0)->stream.howtoend, END_CLOSE };
|
41
xio-fd.h
Normal file
41
xio-fd.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/* $Id: xio-fd.h,v 1.12 2006/12/28 07:35:50 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_fd_h_included
|
||||||
|
#define __xio_fd_h_included 1
|
||||||
|
|
||||||
|
extern const struct optdesc opt_append;
|
||||||
|
extern const struct optdesc opt_nonblock;
|
||||||
|
extern const struct optdesc opt_o_ndelay;
|
||||||
|
extern const struct optdesc opt_async;
|
||||||
|
extern const struct optdesc opt_o_binary;
|
||||||
|
extern const struct optdesc opt_o_text;
|
||||||
|
extern const struct optdesc opt_o_noinherit;
|
||||||
|
extern const struct optdesc opt_cloexec;
|
||||||
|
extern const struct optdesc opt_ftruncate32;
|
||||||
|
extern const struct optdesc opt_ftruncate64;
|
||||||
|
extern const struct optdesc opt_group;
|
||||||
|
extern const struct optdesc opt_group_late;
|
||||||
|
extern const struct optdesc opt_perm;
|
||||||
|
extern const struct optdesc opt_perm_late;
|
||||||
|
extern const struct optdesc opt_user;
|
||||||
|
extern const struct optdesc opt_user_late;
|
||||||
|
extern const struct optdesc opt_lseek32_cur;
|
||||||
|
extern const struct optdesc opt_lseek32_end;
|
||||||
|
extern const struct optdesc opt_lseek32_set;
|
||||||
|
extern const struct optdesc opt_lseek64_cur;
|
||||||
|
extern const struct optdesc opt_lseek64_end;
|
||||||
|
extern const struct optdesc opt_lseek64_set;
|
||||||
|
extern const struct optdesc opt_flock_sh;
|
||||||
|
extern const struct optdesc opt_flock_sh_nb;
|
||||||
|
extern const struct optdesc opt_flock_ex;
|
||||||
|
extern const struct optdesc opt_flock_ex_nb;
|
||||||
|
extern const struct optdesc opt_f_setlk_rd;
|
||||||
|
extern const struct optdesc opt_f_setlkw_rd;
|
||||||
|
extern const struct optdesc opt_f_setlk_wr;
|
||||||
|
extern const struct optdesc opt_f_setlkw_wr;
|
||||||
|
extern const struct optdesc opt_cool_write;
|
||||||
|
extern const struct optdesc opt_end_close;
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_fd_h_included) */
|
78
xio-fdnum.c
Normal file
78
xio-fdnum.c
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
/* $Id: xio-fdnum.c,v 1.13 2006/07/08 10:03:14 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains the source for opening addresses of fdnum type */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
#include "xioopen.h"
|
||||||
|
|
||||||
|
#include "xio-fdnum.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_FDNUM
|
||||||
|
|
||||||
|
static int xioopen_fdnum(int argc, const char *argv[], struct opt *opts, int rw, xiofile_t *xfd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
||||||
|
|
||||||
|
|
||||||
|
const struct addrdesc addr_fd = { "fd", 3, xioopen_fdnum, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 0, 0, 0 HELP(":<num>") };
|
||||||
|
|
||||||
|
|
||||||
|
/* use some file descriptor and apply the options. Set the FD_CLOEXEC flag. */
|
||||||
|
static int xioopen_fdnum(int argc, const char *argv[], struct opt *opts,
|
||||||
|
int xioflags, xiofile_t *xfd, unsigned groups,
|
||||||
|
int dummy1, int dummy2, int dummy3) {
|
||||||
|
char *a1;
|
||||||
|
int rw = (xioflags&XIO_ACCMODE);
|
||||||
|
int numfd;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if (argc != 2) {
|
||||||
|
Error3("%s:%s: wrong number of parameters (%d instead of 1)", argv[0], argv[1], argc-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
numfd = strtoul(argv[1], &a1, 0);
|
||||||
|
if (*a1 != '\0') {
|
||||||
|
Error1("error in FD number \"%s\"", argv[1]);
|
||||||
|
}
|
||||||
|
/* we dont want to see these fds in child processes */
|
||||||
|
if (Fcntl_l(numfd, F_SETFD, FD_CLOEXEC) < 0) {
|
||||||
|
Warn2("fcntl(%d, F_SETFD, FD_CLOEXEC): %s", numfd, strerror(errno));
|
||||||
|
}
|
||||||
|
Notice2("using file descriptor %d for %s", numfd, ddirection[rw]);
|
||||||
|
if ((result = xioopen_fd(opts, rw, &xfd->stream, numfd, dummy2, dummy3)) < 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* WITH_FDNUM */
|
||||||
|
|
||||||
|
#if WITH_FD
|
||||||
|
|
||||||
|
/* retrieve and apply options to a standard file descriptor.
|
||||||
|
Do not set FD_CLOEXEC flag. */
|
||||||
|
int xioopen_fd(struct opt *opts, int rw, xiosingle_t *xfd, int numfd, int dummy2, int dummy3) {
|
||||||
|
|
||||||
|
xfd->fd = numfd;
|
||||||
|
xfd->howtoend = END_NONE;
|
||||||
|
|
||||||
|
#if WITH_TERMIOS
|
||||||
|
if (Isatty(xfd->fd)) {
|
||||||
|
if (Tcgetattr(xfd->fd, &xfd->savetty) < 0) {
|
||||||
|
Warn2("cannot query current terminal settings on fd %d: %s",
|
||||||
|
xfd->fd, strerror(errno));
|
||||||
|
} else {
|
||||||
|
xfd->ttyvalid = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* WITH_TERMIOS */
|
||||||
|
if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1;
|
||||||
|
applyopts(-1, opts, PH_INIT);
|
||||||
|
|
||||||
|
applyopts2(xfd->fd, opts, PH_INIT, PH_FD);
|
||||||
|
|
||||||
|
return _xio_openlate(xfd, opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* WITH_FD */
|
12
xio-fdnum.h
Normal file
12
xio-fdnum.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/* $Id: xio-fdnum.h,v 1.6 2006/03/21 20:48:31 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_fdnum_h_included
|
||||||
|
#define __xio_fdnum_h_included 1
|
||||||
|
|
||||||
|
extern const struct addrdesc addr_fd;
|
||||||
|
|
||||||
|
extern int xioopen_fd(struct opt *opts, int rw, xiosingle_t *xfd, int numfd, int dummy2, int dummy3);
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_fdnum_h_included) */
|
124
xio-file.c
Normal file
124
xio-file.c
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
/* $Id: xio-file.c,v 1.21 2007/03/06 21:07:25 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains the source for opening addresses of open type */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
#include "xioopen.h"
|
||||||
|
|
||||||
|
#include "xio-named.h"
|
||||||
|
#include "xio-file.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int xioopen_open(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_OPEN
|
||||||
|
|
||||||
|
/****** OPEN addresses ******/
|
||||||
|
const struct optdesc opt_o_rdonly = { "o-rdonly", "rdonly", OPT_O_RDONLY, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG_PATTERN, O_RDONLY, O_ACCMODE };
|
||||||
|
const struct optdesc opt_o_wronly = { "o-wronly", "wronly", OPT_O_WRONLY, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG_PATTERN, O_WRONLY, O_ACCMODE };
|
||||||
|
const struct optdesc opt_o_rdwr = { "o-rdwr", "rdwr", OPT_O_RDWR, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG_PATTERN, O_RDWR, O_ACCMODE };
|
||||||
|
const struct optdesc opt_o_create = { "o-create", "creat", OPT_O_CREATE, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_CREAT };
|
||||||
|
const struct optdesc opt_o_excl = { "o-excl", "excl", OPT_O_EXCL, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_EXCL };
|
||||||
|
const struct optdesc opt_o_noctty = { "o-noctty", "noctty", OPT_O_NOCTTY, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_NOCTTY };
|
||||||
|
#ifdef O_SYNC
|
||||||
|
const struct optdesc opt_o_sync = { "o-sync", "sync", OPT_O_SYNC, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_SYNC };
|
||||||
|
#endif
|
||||||
|
#ifdef O_NOFOLLOW
|
||||||
|
const struct optdesc opt_o_nofollow = { "o-nofollow", "nofollow",OPT_O_NOFOLLOW, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_NOFOLLOW };
|
||||||
|
#endif
|
||||||
|
#ifdef O_DIRECTORY
|
||||||
|
const struct optdesc opt_o_directory = { "o-directory", "directory",OPT_O_DIRECTORY, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_DIRECTORY };
|
||||||
|
#endif
|
||||||
|
#ifdef O_LARGEFILE
|
||||||
|
const struct optdesc opt_o_largefile = { "o-largefile", "largefile",OPT_O_LARGEFILE, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_LARGEFILE };
|
||||||
|
#endif
|
||||||
|
#ifdef O_NSHARE
|
||||||
|
const struct optdesc opt_o_nshare = { "o-nshare", "nshare", OPT_O_NSHARE, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_NSHARE };
|
||||||
|
#endif
|
||||||
|
#ifdef O_RSHARE
|
||||||
|
const struct optdesc opt_o_rshare = { "o-rshare", "rshare", OPT_O_RSHARE, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_RSHARE };
|
||||||
|
#endif
|
||||||
|
#ifdef O_DEFER
|
||||||
|
const struct optdesc opt_o_defer = { "o-defer", "defer", OPT_O_DEFER, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_DEFER };
|
||||||
|
#endif
|
||||||
|
#ifdef O_DIRECT
|
||||||
|
const struct optdesc opt_o_direct = { "o-direct", "direct", OPT_O_DIRECT, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_DIRECT };
|
||||||
|
#endif
|
||||||
|
#ifdef O_DSYNC
|
||||||
|
const struct optdesc opt_o_dsync = { "o-dsync", "dsync", OPT_O_DSYNC, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_DSYNC };
|
||||||
|
#endif
|
||||||
|
#ifdef O_RSYNC
|
||||||
|
const struct optdesc opt_o_rsync = { "o-rsync", "rsync", OPT_O_RSYNC, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_RSYNC };
|
||||||
|
#endif
|
||||||
|
#ifdef O_DELAY
|
||||||
|
const struct optdesc opt_o_delay = { "o-delay", "delay", OPT_O_DELAY, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_DELAY };
|
||||||
|
#endif
|
||||||
|
#ifdef O_PRIV
|
||||||
|
const struct optdesc opt_o_priv = { "o-priv", "priv", OPT_O_PRIV, GROUP_OPEN, PH_OPEN, TYPE_BOOL, OFUNC_FLAG, O_PRIV };
|
||||||
|
#endif
|
||||||
|
const struct optdesc opt_o_trunc = { "o-trunc", "trunc", OPT_O_TRUNC, GROUP_OPEN, PH_LATE, TYPE_BOOL, OFUNC_FLAG, O_TRUNC };
|
||||||
|
|
||||||
|
#endif /* WITH_OPEN */
|
||||||
|
|
||||||
|
|
||||||
|
#if _WITH_FILE /*! inconsistent name FILE vs. OPEN */
|
||||||
|
|
||||||
|
const struct addrdesc addr_open = { "open", 3, xioopen_open, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_REG|GROUP_NAMED|GROUP_OPEN|GROUP_FILE|GROUP_TERMIOS, 0, 0, 0 HELP(":<filename>") };
|
||||||
|
|
||||||
|
/* open for writing:
|
||||||
|
if the filesystem entry already exists, the data is appended
|
||||||
|
if it does not exist, a file is created and the data is appended
|
||||||
|
*/
|
||||||
|
static int xioopen_open(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3) {
|
||||||
|
const char *filename = argv[1];
|
||||||
|
int rw = (xioflags & XIO_ACCMODE);
|
||||||
|
bool exists;
|
||||||
|
bool opt_unlink_close = false;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
/* remove old file, or set user/permissions on old file; parse options */
|
||||||
|
if ((result = _xioopen_named_early(argc, argv, fd, groups, &exists, opts)) < 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
|
if (opt_unlink_close) {
|
||||||
|
if ((fd->stream.unlink_close = strdup(filename)) == NULL) {
|
||||||
|
Error1("strdup(\"%s\"): out of memory", filename);
|
||||||
|
}
|
||||||
|
fd->stream.opt_unlink_close = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Notice3("opening %s \"%s\" for %s",
|
||||||
|
filetypenames[(result&S_IFMT)>>12], filename, ddirection[rw]);
|
||||||
|
if ((result = _xioopen_open(filename, rw, opts)) < 0)
|
||||||
|
return result;
|
||||||
|
fd->stream.fd = result;
|
||||||
|
|
||||||
|
#if WITH_TERMIOS
|
||||||
|
if (Isatty(fd->stream.fd)) {
|
||||||
|
if (Tcgetattr(fd->stream.fd, &fd->stream.savetty) < 0) {
|
||||||
|
Warn2("cannot query current terminal settings on fd %d: %s",
|
||||||
|
fd->stream.fd, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fd->stream.ttyvalid = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* WITH_TERMIOS */
|
||||||
|
|
||||||
|
applyopts_named(filename, opts, PH_FD);
|
||||||
|
applyopts(fd->stream.fd, opts, PH_FD);
|
||||||
|
applyopts_cloexec(fd->stream.fd, opts);
|
||||||
|
|
||||||
|
applyopts_fchown(fd->stream.fd, opts);
|
||||||
|
|
||||||
|
if ((result = _xio_openlate(&fd->stream, opts)) < 0)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _WITH_FILE */
|
31
xio-file.h
Normal file
31
xio-file.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/* $Id: xio-file.h,v 1.8 2006/07/13 21:19:15 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2006 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_file_h_included
|
||||||
|
#define __xio_file_h_included 1
|
||||||
|
|
||||||
|
extern const struct optdesc opt_o_rdonly;
|
||||||
|
extern const struct optdesc opt_o_wronly;
|
||||||
|
extern const struct optdesc opt_o_rdwr;
|
||||||
|
extern const struct optdesc opt_o_create;
|
||||||
|
extern const struct optdesc opt_o_excl;
|
||||||
|
extern const struct optdesc opt_o_noctty;
|
||||||
|
extern const struct optdesc opt_o_sync;
|
||||||
|
extern const struct optdesc opt_o_nofollow;
|
||||||
|
extern const struct optdesc opt_o_directory;
|
||||||
|
extern const struct optdesc opt_o_largefile;
|
||||||
|
extern const struct optdesc opt_o_nshare;
|
||||||
|
extern const struct optdesc opt_o_rshare;
|
||||||
|
extern const struct optdesc opt_o_defer;
|
||||||
|
extern const struct optdesc opt_o_direct;
|
||||||
|
extern const struct optdesc opt_o_dsync;
|
||||||
|
extern const struct optdesc opt_o_rsync;
|
||||||
|
extern const struct optdesc opt_o_delay;
|
||||||
|
extern const struct optdesc opt_o_priv;
|
||||||
|
extern const struct optdesc opt_o_trunc;
|
||||||
|
extern const struct optdesc opt_o_noatime;
|
||||||
|
|
||||||
|
extern const struct addrdesc addr_open;
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_file_h_included) */
|
218
xio-gopen.c
Normal file
218
xio-gopen.c
Normal file
|
@ -0,0 +1,218 @@
|
||||||
|
/* $Id: xio-gopen.c,v 1.32 2007/02/08 18:36:44 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains the source for opening addresses of generic open type */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
#include "xioopen.h"
|
||||||
|
|
||||||
|
#include "xio-named.h"
|
||||||
|
#include "xio-unix.h"
|
||||||
|
#include "xio-gopen.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_GOPEN
|
||||||
|
|
||||||
|
static int xioopen_gopen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
|
||||||
|
|
||||||
|
|
||||||
|
const struct addrdesc addr_gopen = { "gopen", 3, xioopen_gopen, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_REG|GROUP_NAMED|GROUP_OPEN|GROUP_FILE|GROUP_TERMIOS|GROUP_SOCKET|GROUP_SOCK_UNIX, 0, 0, 0 HELP(":<filename>") };
|
||||||
|
|
||||||
|
static int xioopen_gopen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3) {
|
||||||
|
const char *filename = argv[1];
|
||||||
|
flags_t openflags = (xioflags & XIO_ACCMODE);
|
||||||
|
mode_t st_mode;
|
||||||
|
bool exists;
|
||||||
|
bool opt_unlink_close = false;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if ((result =
|
||||||
|
_xioopen_named_early(argc, argv, fd, GROUP_NAMED|groups, &exists, opts)) < 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
st_mode = result;
|
||||||
|
|
||||||
|
if (exists) {
|
||||||
|
/* file (or at least named entry) exists */
|
||||||
|
if ((xioflags&XIO_ACCMODE) != XIO_RDONLY) {
|
||||||
|
openflags |= O_APPEND;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
openflags |= O_CREAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* note: when S_ISSOCK was undefined, it always gives 0 */
|
||||||
|
if (exists && S_ISSOCK(st_mode)) {
|
||||||
|
#if WITH_UNIX
|
||||||
|
int socktype = SOCK_STREAM;
|
||||||
|
int optsotype = -1;
|
||||||
|
struct sockaddr_un sa, us;
|
||||||
|
socklen_t salen, uslen = sizeof(us);
|
||||||
|
bool needbind = false;
|
||||||
|
char infobuff[256];
|
||||||
|
struct opt *opts2;
|
||||||
|
|
||||||
|
socket_un_init(&sa);
|
||||||
|
socket_un_init(&us);
|
||||||
|
|
||||||
|
Info1("\"%s\" is a socket, connecting to it", filename);
|
||||||
|
if (retropt_int(opts, OPT_SO_TYPE, &optsotype) == 0) {
|
||||||
|
socktype = optsotype;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retropt_bind(opts, AF_UNIX, socktype, 0, (struct sockaddr *)&us, &uslen, 0, 0, 0) != STAT_NOACTION) {
|
||||||
|
needbind = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
|
if (opt_unlink_close) {
|
||||||
|
if ((fd->stream.unlink_close = strdup(filename)) == NULL) {
|
||||||
|
Error1("strdup(\"%s\"): out of memory", filename);
|
||||||
|
}
|
||||||
|
fd->stream.opt_unlink_close = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* save options, because we might have to start again with Socket() */
|
||||||
|
opts2 = copyopts(opts, GROUP_ALL);
|
||||||
|
|
||||||
|
if ((fd->stream.fd = Socket(PF_UNIX, socktype, 0)) < 0) {
|
||||||
|
Error2("socket(PF_UNIX, %d, 0): %s", socktype, strerror(errno));
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
/*0 Info2("socket(PF_UNIX, %d, 0) -> %d", socktype, fd->stream.fd);*/
|
||||||
|
applyopts(fd->stream.fd, opts, PH_PASTSOCKET);
|
||||||
|
applyopts(fd->stream.fd, opts, PH_FD);
|
||||||
|
|
||||||
|
applyopts_cloexec(fd->stream.fd, opts);
|
||||||
|
|
||||||
|
sa.sun_family = AF_UNIX;
|
||||||
|
salen = xiosetunix(&sa, filename, false, false);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
applyopts(fd->stream.fd, opts, PH_PREBIND);
|
||||||
|
applyopts(fd->stream.fd, opts, PH_BIND);
|
||||||
|
if (us) {
|
||||||
|
if (Bind(fd->stream.fd, us, uslen) < 0) {
|
||||||
|
Error4("bind(%d, {%s}, "F_Zd"): %s",
|
||||||
|
fd->fd, sockaddr_info(us, infobuff, sizeof(infobuff)),
|
||||||
|
uslen, strerror(errno));
|
||||||
|
if (fd->forever || --fd->retry) {
|
||||||
|
Nanosleep(&fd->intervall, NULL);
|
||||||
|
continue;
|
||||||
|
} else
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
applyopts(fd->stream.fd, opts, PH_PASTBIND);
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
|
applyopts(fd->stream.fd, opts, PH_CONNECT);
|
||||||
|
if ((result = Connect(fd->stream.fd, (struct sockaddr *)&sa, salen)) < 0) {
|
||||||
|
if (errno == EINPROGRESS) {
|
||||||
|
Warn4("connect(%d, %s, "F_Zd"): %s",
|
||||||
|
fd->stream.fd, sockaddr_unix_info(&sa, salen, infobuff, sizeof(infobuff)),
|
||||||
|
sizeof(sa), strerror(errno));
|
||||||
|
} else if (errno == EPROTOTYPE && optsotype != SOCK_STREAM) {
|
||||||
|
Warn4("connect(%d, %s, "F_Zd"): %s",
|
||||||
|
fd->stream.fd, sockaddr_unix_info(&sa, salen, infobuff, sizeof(infobuff)),
|
||||||
|
sizeof(sa), strerror(errno));
|
||||||
|
Info("assuming datagram socket");
|
||||||
|
Close(fd->stream.fd);
|
||||||
|
|
||||||
|
opts = opts2;
|
||||||
|
if ((fd->stream.fd = Socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) {
|
||||||
|
Error1("socket(PF_UNIX, SOCK_DGRAM, 0): %s", strerror(errno));
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
/*0 Info1("socket(PF_UNIX, SOCK_DGRAM, 0) -> %d", fd->stream.fd);*/
|
||||||
|
|
||||||
|
applyopts(fd->stream.fd, opts, PH_PASTSOCKET);
|
||||||
|
applyopts(fd->stream.fd, opts, PH_FD);
|
||||||
|
|
||||||
|
applyopts_cloexec(fd->stream.fd, opts);
|
||||||
|
|
||||||
|
sa.sun_family = AF_UNIX;
|
||||||
|
strncpy(sa.sun_path, filename, sizeof(sa.sun_path));
|
||||||
|
|
||||||
|
fd->stream.dtype = XIODATA_RECVFROM;
|
||||||
|
fd->stream.salen = sizeof(sa);
|
||||||
|
memcpy(&fd->stream.peersa.soa, &sa, fd->stream.salen);
|
||||||
|
} else {
|
||||||
|
Error4("connect(%d, %s, "F_Zd"): %s",
|
||||||
|
fd->stream.fd, sockaddr_unix_info(&sa, fd->stream.salen, infobuff, sizeof(infobuff)),
|
||||||
|
sizeof(sa), strerror(errno));
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fd->stream.howtoend == END_UNSPEC) {
|
||||||
|
fd->stream.howtoend = END_SHUTDOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyopts_fchown(fd->stream.fd, opts);
|
||||||
|
applyopts(fd->stream.fd, opts, PH_CONNECTED);
|
||||||
|
applyopts(fd->stream.fd, opts, PH_LATE);
|
||||||
|
applyopts_named(filename, opts, PH_PASTOPEN); /* unlink-late */
|
||||||
|
|
||||||
|
if (Getsockname(fd->stream.fd, (struct sockaddr *)&us, &uslen) < 0) {
|
||||||
|
Warn4("getsockname(%d, %p, {%d}): %s",
|
||||||
|
fd->stream.fd, &us, uslen, strerror(errno));
|
||||||
|
} else {
|
||||||
|
Notice1("successfully connected via %s",
|
||||||
|
sockaddr_unix_info(&us, uslen, infobuff, sizeof(infobuff)));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Error("\"%s\" is a socket, but UNIX socket support is not compiled in");
|
||||||
|
return -1;
|
||||||
|
#endif /* WITH_UNIX */
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* a file name */
|
||||||
|
|
||||||
|
Info1("\"%s\" is not a socket, open()'ing it", filename);
|
||||||
|
|
||||||
|
retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close);
|
||||||
|
if (opt_unlink_close) {
|
||||||
|
if ((fd->stream.unlink_close = strdup(filename)) == NULL) {
|
||||||
|
Error1("strdup(\"%s\"): out of memory", filename);
|
||||||
|
}
|
||||||
|
fd->stream.opt_unlink_close = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Notice3("opening %s \"%s\" for %s",
|
||||||
|
filetypenames[(st_mode&S_IFMT)>>12], filename, ddirection[(xioflags&XIO_ACCMODE)]);
|
||||||
|
if ((result = _xioopen_open(filename, openflags, opts)) < 0)
|
||||||
|
return result;
|
||||||
|
#ifdef I_PUSH
|
||||||
|
if (S_ISCHR(st_mode)) {
|
||||||
|
Ioctl(result, I_PUSH, "ptem");
|
||||||
|
Ioctl(result, I_PUSH, "ldterm");
|
||||||
|
Ioctl(result, I_PUSH, "ttcompat");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
fd->stream.fd = result;
|
||||||
|
|
||||||
|
#if WITH_TERMIOS
|
||||||
|
if (Isatty(fd->stream.fd)) {
|
||||||
|
if (Tcgetattr(fd->stream.fd, &fd->stream.savetty) < 0) {
|
||||||
|
Warn2("cannot query current terminal settings on fd %d: %s",
|
||||||
|
fd->stream.fd, strerror(errno));
|
||||||
|
} else {
|
||||||
|
fd->stream.ttyvalid = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* WITH_TERMIOS */
|
||||||
|
applyopts_named(filename, opts, PH_FD);
|
||||||
|
applyopts(fd->stream.fd, opts, PH_FD);
|
||||||
|
applyopts_cloexec(fd->stream.fd, opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = applyopts2(fd->stream.fd, opts, PH_PASTSOCKET, PH_CONNECTED)) < 0)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
if ((result = _xio_openlate(&fd->stream, opts)) < 0)
|
||||||
|
return result;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* WITH_GOPEN */
|
10
xio-gopen.h
Normal file
10
xio-gopen.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* $Id: xio-gopen.h,v 1.4 2001/11/04 17:19:20 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_gopen_h_included
|
||||||
|
#define __xio_gopen_h_included 1
|
||||||
|
|
||||||
|
extern const struct addrdesc addr_gopen;
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_gopen_h_included) */
|
510
xio-ip.c
Normal file
510
xio-ip.c
Normal file
|
@ -0,0 +1,510 @@
|
||||||
|
/* $Id: xio-ip.c,v 1.31 2007/03/06 21:08:02 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains the source for IP related functions */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
|
||||||
|
#if _WITH_IP4 || _WITH_IP6
|
||||||
|
|
||||||
|
#include "xioopen.h"
|
||||||
|
#include "xio-socket.h"
|
||||||
|
#include "xio-ip.h"
|
||||||
|
#include "xio-ip6.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if WITH_IP4 || WITH_IP6
|
||||||
|
|
||||||
|
#ifdef IP_OPTIONS
|
||||||
|
const struct optdesc opt_ip_options = { "ip-options", "ipoptions", OPT_IP_OPTIONS, GROUP_SOCK_IP, PH_PASTSOCKET,TYPE_BIN, OFUNC_SOCKOPT_APPEND, SOL_IP, IP_OPTIONS };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_PKTINFO
|
||||||
|
const struct optdesc opt_ip_pktinfo = { "ip-pktinfo", "pktinfo", OPT_IP_PKTINFO, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_PKTINFO };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RECVTOS
|
||||||
|
const struct optdesc opt_ip_recvtos = { "ip-recvtos", "recvtos", OPT_IP_RECVTOS, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RECVTOS };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RECVTTL
|
||||||
|
const struct optdesc opt_ip_recvttl = { "ip-recvttl", "recvttl", OPT_IP_RECVTTL, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RECVTTL };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RECVOPTS
|
||||||
|
const struct optdesc opt_ip_recvopts= { "ip-recvopts","recvopts", OPT_IP_RECVOPTS,GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RECVOPTS };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RETOPTS
|
||||||
|
const struct optdesc opt_ip_retopts = { "ip-retopts", "retopts", OPT_IP_RETOPTS, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RETOPTS };
|
||||||
|
#endif
|
||||||
|
const struct optdesc opt_ip_tos = { "ip-tos", "tos", OPT_IP_TOS, GROUP_SOCK_IP, PH_PASTSOCKET,TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_TOS };
|
||||||
|
const struct optdesc opt_ip_ttl = { "ip-ttl", "ttl", OPT_IP_TTL, GROUP_SOCK_IP, PH_PASTSOCKET,TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_TTL };
|
||||||
|
#ifdef IP_HDRINCL
|
||||||
|
const struct optdesc opt_ip_hdrincl = { "ip-hdrincl", "hdrincl", OPT_IP_HDRINCL, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_HDRINCL };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_RECVERR
|
||||||
|
const struct optdesc opt_ip_recverr = { "ip-recverr", "recverr", OPT_IP_RECVERR, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_RECVERR };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_MTU_DISCOVER
|
||||||
|
const struct optdesc opt_ip_mtu_discover={"ip-mtu-discover","mtudiscover",OPT_IP_MTU_DISCOVER,GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_INT,OFUNC_SOCKOPT,SOL_IP,IP_MTU_DISCOVER };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_MTU
|
||||||
|
const struct optdesc opt_ip_mtu = { "ip-mtu", "mtu", OPT_IP_MTU, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_MTU };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_FREEBIND
|
||||||
|
const struct optdesc opt_ip_freebind= { "ip-freebind","freebind", OPT_IP_FREEBIND,GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_FREEBIND };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_ROUTER_ALERT
|
||||||
|
const struct optdesc opt_ip_router_alert={"ip-router-alert","routeralert",OPT_IP_ROUTER_ALERT,GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_INT,OFUNC_SOCKOPT,SOL_IP,IP_ROUTER_ALERT};
|
||||||
|
#endif
|
||||||
|
/* following: Linux allows int but OpenBSD reqs char/byte */
|
||||||
|
const struct optdesc opt_ip_multicast_ttl={"ip-multicast-ttl","multicastttl",OPT_IP_MULTICAST_TTL,GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_BYTE,OFUNC_SOCKOPT,SOL_IP,IP_MULTICAST_TTL};
|
||||||
|
const struct optdesc opt_ip_multicast_loop={"ip-multicast-loop","multicastloop",OPT_IP_MULTICAST_LOOP,GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_INT,OFUNC_SOCKOPT,SOL_IP,IP_MULTICAST_LOOP};
|
||||||
|
const struct optdesc opt_ip_multicast_if ={"ip-multicast-if", "multicast-if", OPT_IP_MULTICAST_IF, GROUP_SOCK_IP,PH_PASTSOCKET,TYPE_IP4NAME,OFUNC_SOCKOPT,SOL_IP,IP_MULTICAST_IF};
|
||||||
|
#ifdef IP_PKTOPTIONS
|
||||||
|
const struct optdesc opt_ip_pktoptions = { "ip-pktoptions", "pktopts", OPT_IP_PKTOPTIONS, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_INT, OFUNC_SOCKOPT, SOL_IP, IP_PKTOPTIONS };
|
||||||
|
#endif
|
||||||
|
#ifdef IP_ADD_MEMBERSHIP
|
||||||
|
const struct optdesc opt_ip_add_membership = { "ip-add-membership", "membership",OPT_IP_ADD_MEMBERSHIP, GROUP_SOCK_IP, PH_PASTSOCKET, TYPE_IP_MREQN, OFUNC_SOCKOPT, SOL_IP, IP_ADD_MEMBERSHIP };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_RESOLV_H
|
||||||
|
const struct optdesc opt_res_debug = { "res-debug", NULL, OPT_RES_DEBUG, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_DEBUG };
|
||||||
|
const struct optdesc opt_res_aaonly = { "res-aaonly", "aaonly", OPT_RES_AAONLY, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_AAONLY };
|
||||||
|
const struct optdesc opt_res_usevc = { "res-usevc", "usevc", OPT_RES_USEVC, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_USEVC };
|
||||||
|
const struct optdesc opt_res_primary = { "res-primary", "primary", OPT_RES_PRIMARY, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_PRIMARY };
|
||||||
|
const struct optdesc opt_res_igntc = { "res-igntc", "igntc", OPT_RES_IGNTC, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_IGNTC };
|
||||||
|
const struct optdesc opt_res_recurse = { "res-recurse", "recurse", OPT_RES_RECURSE, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_RECURSE };
|
||||||
|
const struct optdesc opt_res_defnames = { "res-defnames", "defnames", OPT_RES_DEFNAMES, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_DEFNAMES };
|
||||||
|
const struct optdesc opt_res_stayopen = { "res-stayopen", "stayopen", OPT_RES_STAYOPEN, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_STAYOPEN };
|
||||||
|
const struct optdesc opt_res_dnsrch = { "res-dnsrch", "dnsrch", OPT_RES_DNSRCH, GROUP_SOCK_IP, PH_INIT, TYPE_BOOL, OFUNC_OFFSET_MASKS, (size_t)&((xiosingle_t *)0)->para.socket.ip.res_opts, sizeof(unsigned long), RES_DNSRCH };
|
||||||
|
#endif /* HAVE_RESOLV_H */
|
||||||
|
|
||||||
|
#endif /* WITH_IP4 || WITH_IP6 */
|
||||||
|
|
||||||
|
|
||||||
|
#if HAVE_RESOLV_H
|
||||||
|
int Res_init(void) {
|
||||||
|
int result;
|
||||||
|
Debug("res_init()");
|
||||||
|
result = res_init();
|
||||||
|
Debug1("res_init() -> %d", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_RESOLV_H */
|
||||||
|
|
||||||
|
#if HAVE_RESOLV_H
|
||||||
|
unsigned long res_opts() {
|
||||||
|
return _res.options;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_RESOLV_H */
|
||||||
|
|
||||||
|
/* the ultimate(?) socat resolver function
|
||||||
|
node: the address to be resolved; supported forms:
|
||||||
|
1.2.3.4 (IPv4 address)
|
||||||
|
[::2] (IPv6 address)
|
||||||
|
hostname (hostname resolving to IPv4 or IPv6 address)
|
||||||
|
hostname.domain (fq hostname resolving to IPv4 or IPv6 address)
|
||||||
|
service: the port specification; may be numeric or symbolic
|
||||||
|
family: PF_INET, PF_INET6, or PF_UNSPEC permitting both
|
||||||
|
socktype: SOCK_STREAM, SOCK_DGRAM
|
||||||
|
protocol: IPPROTO_UDP, IPPROTO_TCP
|
||||||
|
sau: an uninitialized storage for the resulting socket address
|
||||||
|
returns: STAT_OK, STAT_RETRYLATER
|
||||||
|
*/
|
||||||
|
int xiogetaddrinfo(const char *node, const char *service,
|
||||||
|
int family, int socktype, int protocol,
|
||||||
|
union sockaddr_union *sau, socklen_t *socklen,
|
||||||
|
unsigned long res_opts0, unsigned long res_opts1) {
|
||||||
|
int port = -1;
|
||||||
|
char *numnode = NULL;
|
||||||
|
size_t nodelen;
|
||||||
|
unsigned long save_res_opts = 0;
|
||||||
|
#if HAVE_GETADDRINFO
|
||||||
|
struct addrinfo hints = {0};
|
||||||
|
struct addrinfo *res = NULL;
|
||||||
|
#else /* HAVE_GETIPNODEBYNAME || nothing */
|
||||||
|
struct hostent *host;
|
||||||
|
#endif
|
||||||
|
int error_num;
|
||||||
|
|
||||||
|
#if HAVE_RESOLV_H
|
||||||
|
if (res_opts0 | res_opts1) {
|
||||||
|
if (!(_res.options & RES_INIT)) {
|
||||||
|
Res_init(); /*!!! returns -1 on error */
|
||||||
|
}
|
||||||
|
save_res_opts = _res.options;
|
||||||
|
_res.options &= ~res_opts0;
|
||||||
|
_res.options |= res_opts1;
|
||||||
|
Debug2("changed _res.options from 0x%lx to 0x%lx",
|
||||||
|
save_res_opts, _res.options);
|
||||||
|
}
|
||||||
|
#endif /* HAVE_RESOLV_H */
|
||||||
|
memset(sau, 0, *socklen);
|
||||||
|
sau->soa.sa_family = family;
|
||||||
|
|
||||||
|
/* if service is numeric we don't want to have a lookup (might take long
|
||||||
|
with NIS), so we handle this specially */
|
||||||
|
if (service && isdigit(service[0]&0xff)) {
|
||||||
|
char *extra;
|
||||||
|
port = strtoul(service, &extra, 0);
|
||||||
|
if (*extra != '\0') {
|
||||||
|
Warn2("xiogetaddrinfo(, \"%s\", ...): extra trailing data \"%s\"",
|
||||||
|
service, extra);
|
||||||
|
}
|
||||||
|
service = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the resolver functions might handle numeric forms of node names by
|
||||||
|
reverse lookup, that's not what we want.
|
||||||
|
So we detect these and handle them specially */
|
||||||
|
if (node && isdigit(node[0]&0xff)) {
|
||||||
|
#if HAVE_GETADDRINFO
|
||||||
|
hints.ai_flags |= AI_NUMERICHOST;
|
||||||
|
#endif /* HAVE_GETADDRINFO */
|
||||||
|
if (family == PF_UNSPEC) {
|
||||||
|
family = PF_INET;
|
||||||
|
#if HAVE_GETADDRINFO
|
||||||
|
} else if (family == PF_INET6) {
|
||||||
|
/* map "explicitely" into IPv6 address space; getipnodebyname() does
|
||||||
|
this with AI_V4MAPPED, but not getaddrinfo() */
|
||||||
|
if ((numnode = Malloc(strlen(node)+7+1)) == NULL) {
|
||||||
|
#if HAVE_RESOLV_H
|
||||||
|
if (res_opts0 | res_opts1) {
|
||||||
|
_res.options = (_res.options & (~res_opts0&~res_opts1) |
|
||||||
|
save_res_opts& ( res_opts0| res_opts1));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
sprintf(numnode, "::ffff:%s", node);
|
||||||
|
node = numnode;
|
||||||
|
hints.ai_flags |= AI_NUMERICHOST;
|
||||||
|
#endif /* HAVE_GETADDRINFO */
|
||||||
|
}
|
||||||
|
#if WITH_IP6
|
||||||
|
} else if (node && node[0] == '[' && node[(nodelen=strlen(node))-1]==']') {
|
||||||
|
if ((numnode = Malloc(nodelen-1)) == NULL) {
|
||||||
|
#if HAVE_RESOLV_H
|
||||||
|
if (res_opts0 | res_opts1) {
|
||||||
|
_res.options = (_res.options & (~res_opts0&~res_opts1) |
|
||||||
|
save_res_opts& ( res_opts0| res_opts1));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
strncpy(numnode, node+1, nodelen-2);
|
||||||
|
numnode[nodelen-2] = '\0';
|
||||||
|
node = numnode;
|
||||||
|
#if HAVE_GETADDRINFO
|
||||||
|
hints.ai_flags |= AI_NUMERICHOST;
|
||||||
|
#endif /* HAVE_GETADDRINFO */
|
||||||
|
if (family == PF_UNSPEC) family = PF_INET6;
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
}
|
||||||
|
|
||||||
|
#if HAVE_GETADDRINFO
|
||||||
|
if (node != NULL || service != NULL) {
|
||||||
|
struct addrinfo *record;
|
||||||
|
|
||||||
|
hints.ai_flags |= AI_PASSIVE;
|
||||||
|
hints.ai_family = family;
|
||||||
|
hints.ai_socktype = socktype;
|
||||||
|
hints.ai_protocol = protocol;
|
||||||
|
hints.ai_addrlen = 0;
|
||||||
|
hints.ai_addr = NULL;
|
||||||
|
hints.ai_canonname = NULL;
|
||||||
|
hints.ai_next = NULL;
|
||||||
|
|
||||||
|
if ((error_num = Getaddrinfo(node, service, &hints, &res)) != 0) {
|
||||||
|
Error7("getaddrinfo(\"%s\", \"%s\", {%d,%d,%d,%d}, {}): %s",
|
||||||
|
node, service, hints.ai_flags, hints.ai_family,
|
||||||
|
hints.ai_socktype, hints.ai_protocol,
|
||||||
|
(error_num == EAI_SYSTEM)?
|
||||||
|
strerror(errno):gai_strerror(error_num));
|
||||||
|
if (res != NULL) freeaddrinfo(res);
|
||||||
|
if (numnode) free(numnode);
|
||||||
|
|
||||||
|
#if HAVE_RESOLV_H
|
||||||
|
if (res_opts0 | res_opts1) {
|
||||||
|
_res.options = (_res.options & (~res_opts0&~res_opts1) |
|
||||||
|
save_res_opts& ( res_opts0| res_opts1));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
|
||||||
|
record = res;
|
||||||
|
if (family == PF_UNSPEC && xioopts.preferred_ip == '0') {
|
||||||
|
/* we just take the first result */
|
||||||
|
family = res[0].ai_addr->sa_family;
|
||||||
|
}
|
||||||
|
if (family == PF_UNSPEC) {
|
||||||
|
int trypf;
|
||||||
|
trypf = (xioopts.preferred_ip=='6'?PF_INET6:PF_INET);
|
||||||
|
/* we must look for a matching entry */
|
||||||
|
while (record != NULL) {
|
||||||
|
if (record->ai_family == trypf) {
|
||||||
|
family = trypf;
|
||||||
|
break; /* family and record set accordingly */
|
||||||
|
}
|
||||||
|
record = record->ai_next;
|
||||||
|
}
|
||||||
|
if (record == NULL) {
|
||||||
|
/* we did not find a "preferred" entry, take the first */
|
||||||
|
record = res;
|
||||||
|
family = res[0].ai_addr->sa_family;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (family) {
|
||||||
|
#if WITH_IP4
|
||||||
|
case PF_INET:
|
||||||
|
if (*socklen > record->ai_addrlen) {
|
||||||
|
*socklen = record->ai_addrlen;
|
||||||
|
}
|
||||||
|
memcpy(&sau->ip4, record->ai_addr, *socklen);
|
||||||
|
break;
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
#if WITH_IP6
|
||||||
|
case PF_INET6:
|
||||||
|
#if _AIX
|
||||||
|
/* older AIX versions pass wrong length, so we correct it */
|
||||||
|
record->ai_addr->sa_len = sizeof(struct sockaddr_in6);
|
||||||
|
#endif
|
||||||
|
if (*socklen > record->ai_addrlen) {
|
||||||
|
*socklen = record->ai_addrlen;
|
||||||
|
}
|
||||||
|
memcpy(&sau->ip6, record->ai_addr, *socklen);
|
||||||
|
break;
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
default:
|
||||||
|
Error1("address resolved to unknown protocol family %d",
|
||||||
|
record->ai_addr->sa_family);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
freeaddrinfo(res);
|
||||||
|
} else {
|
||||||
|
switch (family) {
|
||||||
|
#if WITH_IP4
|
||||||
|
case PF_INET: *socklen = sizeof(sau->ip4); break;
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
#if WITH_IP6
|
||||||
|
case PF_INET6: *socklen = sizeof(sau->ip6); break;
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif HAVE_GETIPNODEBYNAME /* !HAVE_GETADDRINFO */
|
||||||
|
|
||||||
|
if (node != NULL) {
|
||||||
|
/* first fallback is getipnodebyname() */
|
||||||
|
if (family == PF_UNSPEC) {
|
||||||
|
#if WITH_IP4 && WITH_IP6
|
||||||
|
family = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
|
#elif WITH_IP6
|
||||||
|
family = PF_INET6;
|
||||||
|
#else
|
||||||
|
family = PF_INET;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
host = Getipnodebyname(node, family, AI_V4MAPPED, &error_num);
|
||||||
|
if (host == NULL) {
|
||||||
|
const static char ai_host_not_found[] = "Host not found";
|
||||||
|
const static char ai_no_address[] = "No address";
|
||||||
|
const static char ai_no_recovery[] = "No recovery";
|
||||||
|
const static char ai_try_again[] = "Try again";
|
||||||
|
const char *error_msg = "Unknown error";
|
||||||
|
switch (error_num) {
|
||||||
|
case HOST_NOT_FOUND: error_msg = ai_host_not_found; break;
|
||||||
|
case NO_ADDRESS: error_msg = ai_no_address;
|
||||||
|
case NO_RECOVERY: error_msg = ai_no_recovery;
|
||||||
|
case TRY_AGAIN: error_msg = ai_try_again;
|
||||||
|
}
|
||||||
|
Error2("getipnodebyname(\"%s\", ...): %s", node, error_msg);
|
||||||
|
} else {
|
||||||
|
switch (family) {
|
||||||
|
#if WITH_IP4
|
||||||
|
case PF_INET:
|
||||||
|
*socklen = sizeof(sau->ip4);
|
||||||
|
sau->soa.sa_family = PF_INET;
|
||||||
|
memcpy(&sau->ip4.sin_addr, host->h_addr_list[0], 4);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#if WITH_IP6
|
||||||
|
case PF_INET6:
|
||||||
|
*socklen = sizeof(sau->ip6);
|
||||||
|
sau->soa.sa_family = PF_INET6;
|
||||||
|
memcpy(&sau->ip6.sin6_addr, host->h_addr_list[0], 16);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freehostent(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* !HAVE_GETIPNODEBYNAME */
|
||||||
|
|
||||||
|
if (node != NULL) {
|
||||||
|
/* this is not a typical IP6 resolver function - but Linux
|
||||||
|
"man gethostbyname" says that the only supported address type with
|
||||||
|
this function is AF_INET _at present_, so maybe this fallback will
|
||||||
|
be useful somewhere sometimesin a future even for IP6 */
|
||||||
|
if (family == PF_UNSPEC) {
|
||||||
|
#if WITH_IP4 && WITH_IP6
|
||||||
|
family = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
|
#elif WITH_IP6
|
||||||
|
family = PF_INET6;
|
||||||
|
#else
|
||||||
|
family = PF_INET;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
/*!!! try gethostbyname2 for IP6 */
|
||||||
|
if ((host = Gethostbyname(node)) == NULL) {
|
||||||
|
Error2("gethostbyname(\"%s\"): %s", node,
|
||||||
|
h_errno == NETDB_INTERNAL ? strerror(errno) :
|
||||||
|
hstrerror(h_errno));
|
||||||
|
#if HAVE_RESOLV_H
|
||||||
|
if (res_opts0 | res_opts1) {
|
||||||
|
_res.options = (_res.options & (~res_opts0&~res_opts1) |
|
||||||
|
save_res_opts& ( res_opts0| res_opts1));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
if (host->h_addrtype != family) {
|
||||||
|
Error2("xioaddrinfo(): \"%s\" does not resolve to %s",
|
||||||
|
node, family==PF_INET?"IP4":"IP6");
|
||||||
|
} else {
|
||||||
|
switch (family) {
|
||||||
|
#if WITH_IP4
|
||||||
|
case PF_INET:
|
||||||
|
*socklen = sizeof(sau->ip4);
|
||||||
|
sau->soa.sa_family = PF_INET;
|
||||||
|
memcpy(&sau->ip4.sin_addr, host->h_addr_list[0], 4);
|
||||||
|
break;
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
#if WITH_IP6
|
||||||
|
case PF_INET6:
|
||||||
|
*socklen = sizeof(sau->ip6);
|
||||||
|
sau->soa.sa_family = PF_INET6;
|
||||||
|
memcpy(&sau->ip6.sin6_addr, host->h_addr_list[0], 16);
|
||||||
|
break;
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if WITH_TCP || WITH_UDP
|
||||||
|
if (service) {
|
||||||
|
port = parseport(service, family);
|
||||||
|
}
|
||||||
|
if (port >= 0) {
|
||||||
|
switch (family) {
|
||||||
|
#if WITH_IP4
|
||||||
|
case PF_INET: sau->ip4.sin_port = htons(port); break;
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
#if WITH_IP6
|
||||||
|
case PF_INET6: sau->ip6.sin6_port = htons(port); break;
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* WITH_TCP || WITH_UDP */
|
||||||
|
|
||||||
|
if (numnode) free(numnode);
|
||||||
|
|
||||||
|
#if HAVE_RESOLV_H
|
||||||
|
if (res_opts0 | res_opts1) {
|
||||||
|
_res.options = (_res.options & (~res_opts0&~res_opts1) |
|
||||||
|
save_res_opts& ( res_opts0| res_opts1));
|
||||||
|
}
|
||||||
|
#endif /* HAVE_RESOLV_H */
|
||||||
|
return STAT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int xioparsenetwork(const char *rangename, int pf, union xiorange_union *range) {
|
||||||
|
#if WITH_IP4
|
||||||
|
struct in_addr *netaddr_in = &range->ip4.netaddr;
|
||||||
|
struct in_addr *netmask_in = &range->ip4.netmask;
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
struct hostent *maskaddr;
|
||||||
|
char *delimpos; /* absolute address of delimiter */
|
||||||
|
int bits;
|
||||||
|
|
||||||
|
switch (pf) {
|
||||||
|
#if WITH_IP4
|
||||||
|
char *rangename1; /* a copy of rangename with writing allowed */
|
||||||
|
case PF_INET:
|
||||||
|
if ((rangename1 = strdup(rangename)) == NULL) {
|
||||||
|
Error1("strdup(\"%s\"): out of memory", rangename);
|
||||||
|
return STAT_RETRYLATER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delimpos = strchr(rangename1, '/')) {
|
||||||
|
bits = strtoul(delimpos+1, NULL, 10);
|
||||||
|
netmask_in->s_addr = htonl((0xffffffff << (32-bits)));
|
||||||
|
} else if (delimpos = strchr(rangename1, ':')) {
|
||||||
|
if ((maskaddr = Gethostbyname(delimpos+1)) == NULL) {
|
||||||
|
Error2("gethostbyname(\"%s\"): %s", delimpos+1,
|
||||||
|
h_errno == NETDB_INTERNAL ? strerror(errno) :
|
||||||
|
hstrerror(h_errno));
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
netmask_in->s_addr = *(uint32_t *)maskaddr->h_addr_list[0];
|
||||||
|
} else {
|
||||||
|
Error1("xioparsenetwork(\"%s\",,): missing netmask delimiter", rangename);
|
||||||
|
free(rangename1);
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
struct hostent *nameaddr;
|
||||||
|
*delimpos = 0;
|
||||||
|
if ((nameaddr = Gethostbyname(rangename1)) == NULL) {
|
||||||
|
Error2("gethostbyname(\"%s\"): %s", rangename1,
|
||||||
|
h_errno == NETDB_INTERNAL ? strerror(errno) :
|
||||||
|
hstrerror(h_errno));
|
||||||
|
free(rangename1);
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
netaddr_in->s_addr = *(unsigned long *)nameaddr->h_addr_list[0];
|
||||||
|
}
|
||||||
|
free(rangename1);
|
||||||
|
break;
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
#if WITH_IP6
|
||||||
|
case PF_INET6:
|
||||||
|
return xioparsenetwork_ip6(rangename, &range->ip6);
|
||||||
|
break;
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
default:
|
||||||
|
Error1("range option not supported with address family %d", pf);
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
return STAT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* parses a string of form address/bits or address:mask, and fills the fields
|
||||||
|
of the range union. The addr component is masked with mask. */
|
||||||
|
int parserange(const char *rangename, int pf, union xiorange_union *range) {
|
||||||
|
if (xioparsenetwork(rangename, pf, range) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
switch (pf) {
|
||||||
|
#if WITH_IP4
|
||||||
|
case PF_INET:
|
||||||
|
range->ip4.netaddr.s_addr &= range->ip4.netmask.s_addr;
|
||||||
|
break;
|
||||||
|
#endif /* WITH_IP4 */
|
||||||
|
#if WITH_IP6
|
||||||
|
case PF_INET6:
|
||||||
|
return xiorange_ip6andmask(&range->ip6);
|
||||||
|
break;
|
||||||
|
#endif /* WITH_IP6 */
|
||||||
|
default:
|
||||||
|
Error1("range option not supported with address family %d", pf);
|
||||||
|
return STAT_NORETRY;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _WITH_IP4 || _WITH_IP6 */
|
48
xio-ip.h
Normal file
48
xio-ip.h
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
/* $Id: xio-ip.h,v 1.11 2007/03/06 21:19:18 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
#ifndef __xio_ip_h_included
|
||||||
|
#define __xio_ip_h_included 1
|
||||||
|
|
||||||
|
extern const struct optdesc opt_ip_options;
|
||||||
|
extern const struct optdesc opt_ip_pktinfo;
|
||||||
|
extern const struct optdesc opt_ip_recvtos;
|
||||||
|
extern const struct optdesc opt_ip_recvttl;
|
||||||
|
extern const struct optdesc opt_ip_recvopts;
|
||||||
|
extern const struct optdesc opt_ip_retopts;
|
||||||
|
extern const struct optdesc opt_ip_tos;
|
||||||
|
extern const struct optdesc opt_ip_ttl;
|
||||||
|
extern const struct optdesc opt_ip_hdrincl;
|
||||||
|
extern const struct optdesc opt_ip_recverr;
|
||||||
|
extern const struct optdesc opt_ip_mtu_discover;
|
||||||
|
extern const struct optdesc opt_ip_mtu;
|
||||||
|
extern const struct optdesc opt_ip_freebind;
|
||||||
|
extern const struct optdesc opt_ip_router_alert;
|
||||||
|
extern const struct optdesc opt_ip_multicast_ttl;
|
||||||
|
extern const struct optdesc opt_ip_multicast_loop;
|
||||||
|
extern const struct optdesc opt_ip_multicast_if;
|
||||||
|
extern const struct optdesc opt_ip_pktoptions;
|
||||||
|
extern const struct optdesc opt_ip_add_membership;
|
||||||
|
|
||||||
|
extern const struct optdesc opt_res_debug;
|
||||||
|
extern const struct optdesc opt_res_aaonly;
|
||||||
|
extern const struct optdesc opt_res_usevc;
|
||||||
|
extern const struct optdesc opt_res_primary;
|
||||||
|
extern const struct optdesc opt_res_igntc;
|
||||||
|
extern const struct optdesc opt_res_recurse;
|
||||||
|
extern const struct optdesc opt_res_defnames;
|
||||||
|
extern const struct optdesc opt_res_stayopen;
|
||||||
|
extern const struct optdesc opt_res_dnsrch;
|
||||||
|
|
||||||
|
extern int xiogetaddrinfo(const char *node, const char *service,
|
||||||
|
int family, int socktype, int protocol,
|
||||||
|
union sockaddr_union *sa, socklen_t *socklen,
|
||||||
|
unsigned long res_opts0, unsigned long res_opts1);
|
||||||
|
extern
|
||||||
|
int xioparsenetwork(const char *rangename, int pf,
|
||||||
|
union xiorange_union *range);
|
||||||
|
extern
|
||||||
|
int parserange(const char *rangename, int pf, union xiorange_union *range);
|
||||||
|
|
||||||
|
#endif /* !defined(__xio_ip_h_included) */
|
46
xio-ip4.c
Normal file
46
xio-ip4.c
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/* $Id: xio-ip4.c,v 1.13 2007/03/06 21:08:38 gerhard Exp $ */
|
||||||
|
/* Copyright Gerhard Rieger 2001-2007 */
|
||||||
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
|
/* this file contains the source for IP4 related functions */
|
||||||
|
|
||||||
|
#include "xiosysincludes.h"
|
||||||
|
|
||||||
|
#if WITH_IP4
|
||||||
|
|
||||||
|
#include "xioopen.h"
|
||||||
|
#include "xio-socket.h"
|
||||||
|
#include "xio-ip.h"
|
||||||
|
#include "xio-ip4.h"
|
||||||
|
|
||||||
|
/* check if peer address is within permitted range.
|
||||||
|
return >= 0 if so. */
|
||||||
|
int xiocheckrange_ip4(struct sockaddr_in *pa, struct xiorange_ip4 *range) {
|
||||||
|
struct in_addr *netaddr_in = &range->netaddr;
|
||||||
|
struct in_addr *netmask_in = &range->netmask;
|
||||||
|
char addrbuf[256], maskbuf[256];
|
||||||
|
char peername[256];
|
||||||
|
|
||||||
|
/* is provided client address valid? */
|
||||||
|
if (pa->sin_addr.s_addr == 0) {
|
||||||
|
Warn("invalid client address 0.0.0.0");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* client address restriction */
|
||||||
|
Debug2("permitted client subnet: %s:%s",
|
||||||
|
inet4addr_info(ntohl(netaddr_in->s_addr), addrbuf, sizeof(addrbuf)),
|
||||||
|
inet4addr_info(ntohl(netmask_in->s_addr), maskbuf, sizeof(maskbuf)));
|
||||||
|
Debug1("client address is 0x%08x",
|
||||||
|
ntohl(pa->sin_addr.s_addr));
|
||||||
|
Debug1("masked address is 0x%08x",
|
||||||
|
ntohl(pa->sin_addr.s_addr & netmask_in->s_addr));
|
||||||
|
if ((pa->sin_addr.s_addr & netmask_in->s_addr)
|
||||||
|
!= netaddr_in->s_addr) {
|
||||||
|
Debug1("client address %s is not permitted",
|
||||||
|
sockaddr_inet4_info(pa, peername, sizeof(peername)));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* WITH_IP4 */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue