Add --enable-unspecified_server

Add --enable-unspecified_server configure option to set to "Unspecified"
the OS name, OS version, product name and product version normally
contained in the SERVER header as this could be used by an attacker.

(forward port of commit 49af91fe4892e30316cceb12eb50c3f2cafb73b4)
This commit is contained in:
Fabrice Fontaine 2012-03-30 21:52:37 +02:00 committed by Marcelo Roberto Jimenez
parent 57af94b287
commit b58ee1930c
6 changed files with 28 additions and 0 deletions

View File

@ -332,6 +332,14 @@ Version 1.8.0
Version 1.6.17
*******************************************************************************
2012-03-30 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
Add --enable-unspecified_server
Add --enable-unspecified_server configure option to set to "Unspecified"
the OS name, OS version, product name and product version normally
contained in the SERVER header as this could be used by an attacker.
2012-03-29 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
Removing implicit casts in miniserver.c

View File

@ -135,6 +135,9 @@
/* see upnpconfig.h */
/* #undef UPNP_ENABLE_OPEN_SSL */
/* see upnpconfig.h */
/* #undef UPNP_ENABLE_UNSPECIFIED_SERVER */
/* see upnpconfig.h */
#define UPNP_HAVE_CLIENT 1

View File

@ -128,6 +128,10 @@
* (i.e. configure --enable-ipv6) */
/* #undef UPNP_ENABLE_IPV6 */
/** Defined to 1 if the library has been compiled with unspecified SERVER
* header (i.e. configure --enable-unspecified_server) */
/* #undef UPNP_ENABLE_UNSPECIFIED_SERVER */
/** Defined to 1 if the library has been compiled with OpenSSL support
* (i.e. configure --enable-open_ssl) */
/* #undef UPNP_ENABLE_OPEN_SSL */

View File

@ -444,6 +444,11 @@ if test "x$enable_ipv6" = xyes ; then
AC_DEFINE(UPNP_ENABLE_IPV6, 1, [see upnpconfig.h])
fi
RT_BOOL_ARG_ENABLE([unspecified_server], [no], [unspecified SERVER header])
if test "x$enable_unspecified_server" = xyes ; then
AC_DEFINE(UPNP_ENABLE_UNSPECIFIED_SERVER, 1, [see upnpconfig.h])
fi
RT_BOOL_ARG_ENABLE([open_ssl], [no], [open-ssl support])
if test "x$enable_open_ssl" = xyes ; then
AC_DEFINE(UPNP_ENABLE_OPEN_SSL, 1, [see upnpconfig.h])

View File

@ -127,6 +127,10 @@
* (i.e. configure --enable-ipv6) */
#undef UPNP_ENABLE_IPV6
/** Defined to 1 if the library has been compiled with unspecified SERVER
* header (i.e. configure --enable-unspecified_server) */
#undef UPNP_ENABLE_UNSPECIFIED_SERVER
/** Defined to 1 if the library has been compiled with OpenSSL support
* (i.e. configure --enable-open_ssl) */
#undef UPNP_ENABLE_OPEN_SSL

View File

@ -1960,6 +1960,9 @@ int http_OpenHttpGetEx(
/* 'info' should have a size of at least 100 bytes */
void get_sdk_info(OUT char *info, IN size_t infoSize)
{
#ifdef UPNP_ENABLE_UNSPECIFIED_SERVER
snprintf(info, infoSize, "Unspecified, UPnP/1.0, Unspecified\r\n");
#else /* UPNP_ENABLE_UNSPECIFIED_SERVER */
#ifdef WIN32
OSVERSIONINFO versioninfo;
versioninfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@ -1983,5 +1986,6 @@ void get_sdk_info(OUT char *info, IN size_t infoSize)
"%s/%s, UPnP/1.0, Portable SDK for UPnP devices/"
PACKAGE_VERSION "\r\n", sys_info.sysname, sys_info.release);
#endif
#endif /* UPNP_ENABLE_UNSPECIFIED_SERVER */
}