diff --git a/miniupnpd/upnpsoap.c b/miniupnpd/upnpsoap.c index e329d04..07aa373 100644 --- a/miniupnpd/upnpsoap.c +++ b/miniupnpd/upnpsoap.c @@ -1485,7 +1485,7 @@ PinholeVerification(struct upnphttp * h, char * int_ip, unsigned short int_port) } static void -AddPinhole(struct upnphttp * h, const char * action) +AddPinhole(struct upnphttp * h, const char * action, const char * ns) { int r; static const char resp[] = @@ -1623,7 +1623,7 @@ AddPinhole(struct upnphttp * h, const char * action) case 1: /* success */ bodylen = snprintf(body, sizeof(body), resp, action, - "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1", + ns/*"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1"*/, uid, action); BuildSendAndCloseSoapResp(h, body, bodylen); break; @@ -1647,12 +1647,20 @@ clear_and_exit: } 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[] = "" ""; +#endif + static const char resp[] = + "" + ""; + char body[512]; + int bodylen; struct NameValueParserData data; const char * uid_str, * leaseTime; char iaddr[INET6_ADDRSTRLEN]; @@ -1708,12 +1716,15 @@ UpdatePinhole(struct upnphttp * h, const char * action) SoapError(h, 704, "NoSuchEntry"); else if(n < 0) SoapError(h, 501, "ActionFailed"); - else - BuildSendAndCloseSoapResp(h, resp, sizeof(resp)-1); + else { + bodylen = snprintf(body, sizeof(body), resp, + action, ns, action); + BuildSendAndCloseSoapResp(h, body, bodylen); + } } static void -GetOutboundPinholeTimeout(struct upnphttp * h, const char * action) +GetOutboundPinholeTimeout(struct upnphttp * h, const char * action, const char * ns) { int r; @@ -1727,7 +1738,8 @@ GetOutboundPinholeTimeout(struct upnphttp * h, const char * action) int bodylen; struct NameValueParserData data; 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; if (GETFLAG(IPV6FCFWDISABLEDMASK)) @@ -1745,7 +1757,7 @@ GetOutboundPinholeTimeout(struct upnphttp * h, const char * action) rport = (unsigned short)atoi(rem_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); @@ -1756,7 +1768,7 @@ GetOutboundPinholeTimeout(struct upnphttp * h, const char * action) { case 1: /* success */ 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); BuildSendAndCloseSoapResp(h, body, bodylen); break; @@ -1770,14 +1782,21 @@ GetOutboundPinholeTimeout(struct upnphttp * h, const char * action) } static void -DeletePinhole(struct upnphttp * h, const char * action) +DeletePinhole(struct upnphttp * h, const char * action, const char * ns) { int n; - +#if 0 static const char resp[] = "" ""; +#endif + static const char resp[] = + "" + ""; + char body[512]; + int bodylen; struct NameValueParserData data; 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", action, uid); - BuildSendAndCloseSoapResp(h, resp, sizeof(resp)-1); + bodylen = snprintf(body, sizeof(body), resp, + action, ns, action); + BuildSendAndCloseSoapResp(h, body, bodylen); } static void -CheckPinholeWorking(struct upnphttp * h, const char * action) +CheckPinholeWorking(struct upnphttp * h, const char * action, const char * ns) { static const char 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); BuildSendAndCloseSoapResp(h, body, bodylen); } static void -GetAssignedRoles(struct upnphttp * h, const char * action) +GetAssignedRoles(struct upnphttp * h, const char * action, const char * ns) { static const char resp[] = "