diff --git a/config.h b/config.h index 1be817f..1bc483a 100644 --- a/config.h +++ b/config.h @@ -187,8 +187,29 @@ typedef unsigned long u_long; #define EOPTNEG 8 #endif -/* tftp-hpa version */ +/* tftp-hpa version and configuration strings */ #include "version.h" +#ifdef WITH_READLINE +#define WITH_READLINE_STR ", with readline" +#else +#define WITH_READLINE_STR ", without readline" +#endif + +#ifdef WITH_REGEX +#define WITH_REGEX_STR ", with remap" +#else +#define WITH_REGEX_STR ", without remap" +#endif + +#ifdef HAVE_LIBWRAP +#define HAVE_LIBWRAP_STR ", with tcpwrappers" +#else +#define HAVE_LIBWRAP_STR ", without tcpwrappers" +#endif + +#define TFTP_CONFIG_STR VERSION WITH_READLINE_STR +#define TFTPD_CONFIG_STR VERSION WITH_REGEX_STR HAVE_LIBWRAP_STR + #endif diff --git a/tftp/main.c b/tftp/main.c index bc88583..89696a5 100644 --- a/tftp/main.c +++ b/tftp/main.c @@ -192,8 +192,8 @@ main(int argc, char *argv[]) verbose = 1; break; case 'V': - /* Print version to stdout and exit */ - printf("%s\n", VERSION); + /* Print version and configuration to stdout and exit */ + printf("%s\n", TFTP_CONFIG_STR); exit(0); default: fprintf(stderr, "Usage: %s [-v] [host]\n", argv[0]); diff --git a/tftp/tftp.1 b/tftp/tftp.1 index ce2a4af..cf3eb81 100644 --- a/tftp/tftp.1 +++ b/tftp/tftp.1 @@ -59,7 +59,8 @@ command below.) Default to verbose mode. .TP .B \-V -Print the version number to standard output, then exit gracefully. +Print the version number and configuration to standard output, then +exit gracefully. .SH COMMANDS Once .B tftp diff --git a/tftpd/tftpd.8 b/tftpd/tftpd.8 index f786669..62944d7 100644 --- a/tftpd/tftpd.8 +++ b/tftpd/tftpd.8 @@ -107,7 +107,9 @@ default is 900 (15 minutes.) Specify the use of filename remapping. The .I remap-file is a file containing the remapping rules. See the section on filename -remapping below. +remapping below. This option may not be compiled in, see +.B "tftpd \-V" +to verify whether or not it is available. .TP .B \-v Increase the logging verbosity of @@ -119,7 +121,8 @@ Indicate that a specific RFC 2347 TFTP option should never be accepted. .TP .B \-V -Print the version number to standard output, then exit gracefully. +Print the version number and configuration to standard output, then +exit gracefully. .SH "RFC 2347 OPTION NEGOTIATION" This version of .B tftpd @@ -213,12 +216,17 @@ will allow only publicly readable files (o+r) to be accessed. Files may be written only if they already exist and are publicly writable, unless the .B \-c -option is specified. -Note that this extends the concept of ``public'' to include all users -on all hosts that can be reached through the network; this may not be -appropriate on all systems, and its implications should be considered -before enabling TFTP service. Typically, some kind of firewall or -packet-filter solution should be employed. +option is specified. Note that this extends the concept of ``public'' +to include all users on all hosts that can be reached through the +network; this may not be appropriate on all systems, and its +implications should be considered before enabling TFTP service. +Typically, some kind of firewall or packet-filter solution should be +employed. If appropriately compiled (see the output of +.BR "tftpd \-V" ) +.B tftpd +will query the +.BR hosts_access (5) +database for access control information. This may be slow. .PP The server should be set to have the user ID with the lowest possible privilege; please see the @@ -277,5 +285,6 @@ added patches by Markus Gutschke and Gero Kulhman. .SH "SEE ALSO" .BR tftp (1), .BR egrep (1), +.BR hosts_access (5), .BR regex (7), .BR inetd (8). diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c index 8640328..c41ee93 100644 --- a/tftpd/tftpd.c +++ b/tftpd/tftpd.c @@ -259,8 +259,8 @@ main(int argc, char **argv) verbosity++; break; case 'V': - /* Print version to stdout and exit */ - printf("%s\n", VERSION); + /* Print configuration to stdout and exit */ + printf("%s\n", TFTPD_CONFIG_STR); exit(0); break; default: