miniupnpd/upnpsoap: More argument check for SOAP actions in UPNP_STRICT mode
This commit is contained in:
parent
67bd1f9b42
commit
5de71bc396
|
@ -3,6 +3,7 @@ $Id: Changelog.txt,v 1.318 2012/10/04 22:11:55 nanard Exp $
|
|||
2012/10/04:
|
||||
updated DEFAULTCONNECTIONSERVICE_MAGICALVALUE for IGDv2
|
||||
increased default buffer size for HTTP response
|
||||
More argument check for SOAP actions in UPNP_STRICT mode
|
||||
|
||||
2012/10/03:
|
||||
Fix atoi() on null pointer in upnpsoap.c
|
||||
|
|
|
@ -603,7 +603,11 @@ GetSpecificPortMappingEntry(struct upnphttp * h, const char * action)
|
|||
ext_port = GetValueFromNameValueList(&data, "NewExternalPort");
|
||||
protocol = GetValueFromNameValueList(&data, "NewProtocol");
|
||||
|
||||
#ifdef UPNP_STRICT
|
||||
if(!ext_port || !protocol || !r_host)
|
||||
#else
|
||||
if(!ext_port || !protocol)
|
||||
#endif
|
||||
{
|
||||
ClearNameValueList(&data);
|
||||
SoapError(h, 402, "Invalid Args");
|
||||
|
@ -671,7 +675,11 @@ DeletePortMapping(struct upnphttp * h, const char * action)
|
|||
ext_port = GetValueFromNameValueList(&data, "NewExternalPort");
|
||||
protocol = GetValueFromNameValueList(&data, "NewProtocol");
|
||||
|
||||
#ifdef UPNP_STRICT
|
||||
if(!ext_port || !protocol || !r_host)
|
||||
#else
|
||||
if(!ext_port || !protocol)
|
||||
#endif
|
||||
{
|
||||
ClearNameValueList(&data);
|
||||
SoapError(h, 402, "Invalid Args");
|
||||
|
@ -1007,13 +1015,21 @@ SetDefaultConnectionService(struct upnphttp * h, const char * action)
|
|||
ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);
|
||||
p = GetValueFromNameValueList(&data, "NewDefaultConnectionService");
|
||||
if(p) {
|
||||
syslog(LOG_INFO, "%s(%s) : Ignored", action, p);
|
||||
BuildSendAndCloseSoapResp(h, resp, sizeof(resp)-1);
|
||||
/* 720 InvalidDeviceUUID
|
||||
* 721 InvalidServiceID
|
||||
* 723 InvalidConnServiceSelection */
|
||||
#ifdef UPNP_STRICT
|
||||
if(0 != memcmp(uuidvalue, p, sizeof("uuid:00000000-0000-0000-0000-000000000000") - 1)) {
|
||||
SoapError(h, 720, "InvalidDeviceUUID");
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
syslog(LOG_INFO, "%s(%s) : Ignored", action, p);
|
||||
BuildSendAndCloseSoapResp(h, resp, sizeof(resp)-1);
|
||||
}
|
||||
} else {
|
||||
/* missing argument */
|
||||
SoapError(h, 402, "Invalid Args");
|
||||
#endif
|
||||
}
|
||||
ClearNameValueList(&data);
|
||||
}
|
||||
|
@ -1049,6 +1065,13 @@ SetConnectionType(struct upnphttp * h, const char * action)
|
|||
|
||||
ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);
|
||||
connection_type = GetValueFromNameValueList(&data, "NewConnectionType");
|
||||
#ifdef UPNP_STRICT
|
||||
if(!connection_type) {
|
||||
ClearNameValueList(&data);
|
||||
SoapError(h, 402, "Invalid Args");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* Unconfigured, IP_Routed, IP_Bridged */
|
||||
ClearNameValueList(&data);
|
||||
/* always return a ReadOnly error */
|
||||
|
|
Loading…
Reference in New Issue