use name server from query in SOAP responses (continued)
seea4b97cf105
and1e7b2342fa
This commit is contained in:
parent
4ed5bc6fee
commit
92cc93f6f8
|
@ -1485,7 +1485,7 @@ PinholeVerification(struct upnphttp * h, char * int_ip, unsigned short int_port)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
AddPinhole(struct upnphttp * h, const char * action)
|
AddPinhole(struct upnphttp * h, const char * action, const char * ns)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
|
@ -1623,7 +1623,7 @@ AddPinhole(struct upnphttp * h, const char * action)
|
||||||
case 1: /* success */
|
case 1: /* success */
|
||||||
bodylen = snprintf(body, sizeof(body),
|
bodylen = snprintf(body, sizeof(body),
|
||||||
resp, action,
|
resp, action,
|
||||||
"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1",
|
ns/*"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1"*/,
|
||||||
uid, action);
|
uid, action);
|
||||||
BuildSendAndCloseSoapResp(h, body, bodylen);
|
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||||
break;
|
break;
|
||||||
|
@ -1647,12 +1647,20 @@ clear_and_exit:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
UpdatePinhole(struct upnphttp * h, const char * action)
|
UpdatePinhole(struct upnphttp * h, const char * action, const char * ns)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
"<u:UpdatePinholeResponse "
|
"<u:UpdatePinholeResponse "
|
||||||
"xmlns:u=\"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1\">"
|
"xmlns:u=\"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1\">"
|
||||||
"</u:UpdatePinholeResponse>";
|
"</u:UpdatePinholeResponse>";
|
||||||
|
#endif
|
||||||
|
static const char resp[] =
|
||||||
|
"<u:%sResponse "
|
||||||
|
"xmlns:u=\"%s\">"
|
||||||
|
"</u:%sResponse>";
|
||||||
|
char body[512];
|
||||||
|
int bodylen;
|
||||||
struct NameValueParserData data;
|
struct NameValueParserData data;
|
||||||
const char * uid_str, * leaseTime;
|
const char * uid_str, * leaseTime;
|
||||||
char iaddr[INET6_ADDRSTRLEN];
|
char iaddr[INET6_ADDRSTRLEN];
|
||||||
|
@ -1708,12 +1716,15 @@ UpdatePinhole(struct upnphttp * h, const char * action)
|
||||||
SoapError(h, 704, "NoSuchEntry");
|
SoapError(h, 704, "NoSuchEntry");
|
||||||
else if(n < 0)
|
else if(n < 0)
|
||||||
SoapError(h, 501, "ActionFailed");
|
SoapError(h, 501, "ActionFailed");
|
||||||
else
|
else {
|
||||||
BuildSendAndCloseSoapResp(h, resp, sizeof(resp)-1);
|
bodylen = snprintf(body, sizeof(body), resp,
|
||||||
|
action, ns, action);
|
||||||
|
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
GetOutboundPinholeTimeout(struct upnphttp * h, const char * action)
|
GetOutboundPinholeTimeout(struct upnphttp * h, const char * action, const char * ns)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -1727,7 +1738,8 @@ GetOutboundPinholeTimeout(struct upnphttp * h, const char * action)
|
||||||
int bodylen;
|
int bodylen;
|
||||||
struct NameValueParserData data;
|
struct NameValueParserData data;
|
||||||
char * int_ip, * int_port, * rem_host, * rem_port, * protocol;
|
char * int_ip, * int_port, * rem_host, * rem_port, * protocol;
|
||||||
int opt=0, proto=0;
|
int opt=0;
|
||||||
|
/*int proto=0;*/
|
||||||
unsigned short iport, rport;
|
unsigned short iport, rport;
|
||||||
|
|
||||||
if (GETFLAG(IPV6FCFWDISABLEDMASK))
|
if (GETFLAG(IPV6FCFWDISABLEDMASK))
|
||||||
|
@ -1745,7 +1757,7 @@ GetOutboundPinholeTimeout(struct upnphttp * h, const char * action)
|
||||||
|
|
||||||
rport = (unsigned short)atoi(rem_port);
|
rport = (unsigned short)atoi(rem_port);
|
||||||
iport = (unsigned short)atoi(int_port);
|
iport = (unsigned short)atoi(int_port);
|
||||||
proto = atoi(protocol);
|
/*proto = atoi(protocol);*/
|
||||||
|
|
||||||
syslog(LOG_INFO, "%s: retrieving timeout for outbound pinhole from [%s]:%hu to [%s]:%hu protocol %s", action, int_ip, iport,rem_host, rport, protocol);
|
syslog(LOG_INFO, "%s: retrieving timeout for outbound pinhole from [%s]:%hu to [%s]:%hu protocol %s", action, int_ip, iport,rem_host, rport, protocol);
|
||||||
|
|
||||||
|
@ -1756,7 +1768,7 @@ GetOutboundPinholeTimeout(struct upnphttp * h, const char * action)
|
||||||
{
|
{
|
||||||
case 1: /* success */
|
case 1: /* success */
|
||||||
bodylen = snprintf(body, sizeof(body), resp,
|
bodylen = snprintf(body, sizeof(body), resp,
|
||||||
action, "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1",
|
action, ns/*"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1"*/,
|
||||||
opt, action);
|
opt, action);
|
||||||
BuildSendAndCloseSoapResp(h, body, bodylen);
|
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||||
break;
|
break;
|
||||||
|
@ -1770,14 +1782,21 @@ GetOutboundPinholeTimeout(struct upnphttp * h, const char * action)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DeletePinhole(struct upnphttp * h, const char * action)
|
DeletePinhole(struct upnphttp * h, const char * action, const char * ns)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
#if 0
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
"<u:DeletePinholeResponse "
|
"<u:DeletePinholeResponse "
|
||||||
"xmlns:u=\"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1\">"
|
"xmlns:u=\"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1\">"
|
||||||
"</u:DeletePinholeResponse>";
|
"</u:DeletePinholeResponse>";
|
||||||
|
#endif
|
||||||
|
static const char resp[] =
|
||||||
|
"<u:%sResponse "
|
||||||
|
"xmlns:u=\"%s\">"
|
||||||
|
"</u:%sResponse>";
|
||||||
|
char body[512];
|
||||||
|
int bodylen;
|
||||||
|
|
||||||
struct NameValueParserData data;
|
struct NameValueParserData data;
|
||||||
const char * uid_str;
|
const char * uid_str;
|
||||||
|
@ -1834,11 +1853,13 @@ DeletePinhole(struct upnphttp * h, const char * action)
|
||||||
}
|
}
|
||||||
syslog(LOG_INFO, "%s: (inbound) pinhole with ID %d successfully removed",
|
syslog(LOG_INFO, "%s: (inbound) pinhole with ID %d successfully removed",
|
||||||
action, uid);
|
action, uid);
|
||||||
BuildSendAndCloseSoapResp(h, resp, sizeof(resp)-1);
|
bodylen = snprintf(body, sizeof(body), resp,
|
||||||
|
action, ns, action);
|
||||||
|
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CheckPinholeWorking(struct upnphttp * h, const char * action)
|
CheckPinholeWorking(struct upnphttp * h, const char * action, const char * ns)
|
||||||
{
|
{
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
"<u:%sResponse "
|
"<u:%sResponse "
|
||||||
|
@ -1887,7 +1908,7 @@ CheckPinholeWorking(struct upnphttp * h, const char * action)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bodylen = snprintf(body, sizeof(body), resp,
|
bodylen = snprintf(body, sizeof(body), resp,
|
||||||
action, "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1",
|
action, ns/*"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1"*/,
|
||||||
1, action);
|
1, action);
|
||||||
BuildSendAndCloseSoapResp(h, body, bodylen);
|
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||||
}
|
}
|
||||||
|
@ -1898,7 +1919,7 @@ CheckPinholeWorking(struct upnphttp * h, const char * action)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
GetPinholePackets(struct upnphttp * h, const char * action)
|
GetPinholePackets(struct upnphttp * h, const char * action, const char * ns)
|
||||||
{
|
{
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
"<u:%sResponse "
|
"<u:%sResponse "
|
||||||
|
@ -1951,7 +1972,7 @@ GetPinholePackets(struct upnphttp * h, const char * action)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bodylen = snprintf(body, sizeof(body), resp,
|
bodylen = snprintf(body, sizeof(body), resp,
|
||||||
action, "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1",
|
action, ns/*"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1"*/,
|
||||||
packets, action);
|
packets, action);
|
||||||
BuildSendAndCloseSoapResp(h, body, bodylen);
|
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||||
}
|
}
|
||||||
|
@ -1959,7 +1980,7 @@ GetPinholePackets(struct upnphttp * h, const char * action)
|
||||||
|
|
||||||
#ifdef ENABLE_DP_SERVICE
|
#ifdef ENABLE_DP_SERVICE
|
||||||
static void
|
static void
|
||||||
SendSetupMessage(struct upnphttp * h, const char * action)
|
SendSetupMessage(struct upnphttp * h, const char * action, const char * ns)
|
||||||
{
|
{
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
"<u:%sResponse "
|
"<u:%sResponse "
|
||||||
|
@ -1993,14 +2014,14 @@ SendSetupMessage(struct upnphttp * h, const char * action)
|
||||||
/* TODO : put here code for WPS */
|
/* TODO : put here code for WPS */
|
||||||
|
|
||||||
bodylen = snprintf(body, sizeof(body), resp,
|
bodylen = snprintf(body, sizeof(body), resp,
|
||||||
action, "urn:schemas-upnp-org:service:DeviceProtection:1",
|
action, ns/*"urn:schemas-upnp-org:service:DeviceProtection:1"*/,
|
||||||
OutMessage, action);
|
OutMessage, action);
|
||||||
BuildSendAndCloseSoapResp(h, body, bodylen);
|
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||||
ClearNameValueList(&data);
|
ClearNameValueList(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
GetSupportedProtocols(struct upnphttp * h, const char * action)
|
GetSupportedProtocols(struct upnphttp * h, const char * action, const char * ns)
|
||||||
{
|
{
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
"<u:%sResponse "
|
"<u:%sResponse "
|
||||||
|
@ -2020,13 +2041,13 @@ GetSupportedProtocols(struct upnphttp * h, const char * action)
|
||||||
"</SupportedProtocols>";
|
"</SupportedProtocols>";
|
||||||
|
|
||||||
bodylen = snprintf(body, sizeof(body), resp,
|
bodylen = snprintf(body, sizeof(body), resp,
|
||||||
action, "urn:schemas-upnp-org:service:DeviceProtection:1",
|
action, ns/*"urn:schemas-upnp-org:service:DeviceProtection:1"*/,
|
||||||
ProtocolList, action);
|
ProtocolList, action);
|
||||||
BuildSendAndCloseSoapResp(h, body, bodylen);
|
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
GetAssignedRoles(struct upnphttp * h, const char * action)
|
GetAssignedRoles(struct upnphttp * h, const char * action, const char * ns)
|
||||||
{
|
{
|
||||||
static const char resp[] =
|
static const char resp[] =
|
||||||
"<u:%sResponse "
|
"<u:%sResponse "
|
||||||
|
@ -2050,7 +2071,7 @@ GetAssignedRoles(struct upnphttp * h, const char * action)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bodylen = snprintf(body, sizeof(body), resp,
|
bodylen = snprintf(body, sizeof(body), resp,
|
||||||
action, "urn:schemas-upnp-org:service:DeviceProtection:1",
|
action, ns/*"urn:schemas-upnp-org:service:DeviceProtection:1"*/,
|
||||||
RoleList, action);
|
RoleList, action);
|
||||||
BuildSendAndCloseSoapResp(h, body, bodylen);
|
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue