* Treat an empty Filter argument as "*".
* Make sure we allocate enough memory to hold SourceProtocolInfo response data.
This commit is contained in:
parent
40a37fbd78
commit
3ae378cdc9
@ -297,19 +297,16 @@ static void upnp_event_prepare(struct upnp_event_notify * obj)
|
|||||||
xml = NULL;
|
xml = NULL;
|
||||||
l = 0;
|
l = 0;
|
||||||
}
|
}
|
||||||
obj->buffersize = 2048;
|
obj->tosend = asprintf(&(obj->buffer), notifymsg,
|
||||||
obj->buffer = malloc(obj->buffersize);
|
|
||||||
/*if(!obj->buffer) {
|
|
||||||
}*/
|
|
||||||
obj->tosend = snprintf(obj->buffer, obj->buffersize, notifymsg,
|
|
||||||
obj->path, obj->addrstr, obj->portstr, l+2,
|
obj->path, obj->addrstr, obj->portstr, l+2,
|
||||||
obj->sub->uuid, obj->sub->seq,
|
obj->sub->uuid, obj->sub->seq,
|
||||||
l, xml);
|
l, xml);
|
||||||
|
obj->buffersize = obj->tosend;
|
||||||
if(xml) {
|
if(xml) {
|
||||||
free(xml);
|
free(xml);
|
||||||
xml = NULL;
|
xml = NULL;
|
||||||
}
|
}
|
||||||
//DEBUG printf("Preparing buffer:\n%s\n", obj->buffer);
|
DPRINTF(E_DEBUG, L_HTTP, "Sending UPnP Event response:\n%s\n", obj->buffer);
|
||||||
obj->state = ESending;
|
obj->state = ESending;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
upnpsoap.c
25
upnpsoap.c
@ -112,11 +112,10 @@ GetProtocolInfo(struct upnphttp * h, const char * action)
|
|||||||
"<Sink></Sink>"
|
"<Sink></Sink>"
|
||||||
"</u:%sResponse>";
|
"</u:%sResponse>";
|
||||||
|
|
||||||
|
char * body;
|
||||||
char body[1536];
|
|
||||||
int bodylen;
|
int bodylen;
|
||||||
|
|
||||||
bodylen = snprintf(body, sizeof(body), resp,
|
bodylen = asprintf(&body, resp,
|
||||||
action, "urn:schemas-upnp-org:service:ConnectionManager:1",
|
action, "urn:schemas-upnp-org:service:ConnectionManager:1",
|
||||||
action);
|
action);
|
||||||
BuildSendAndCloseSoapResp(h, body, bodylen);
|
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||||
@ -431,7 +430,7 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
memset(&args, 0, sizeof(args));
|
memset(&args, 0, sizeof(args));
|
||||||
strcpy(resp, resp0);
|
strcpy(resp, resp0);
|
||||||
/* See if we need to include DLNA namespace reference */
|
/* See if we need to include DLNA namespace reference */
|
||||||
if( (strlen(Filter) <= 1) || strstr(Filter, "dlna") )
|
if( Filter && ((strlen(Filter) <= 1) || strstr(Filter, "dlna")) )
|
||||||
strcat(resp, DLNA_NAMESPACE);
|
strcat(resp, DLNA_NAMESPACE);
|
||||||
strcat(resp, ">\n");
|
strcat(resp, ">\n");
|
||||||
|
|
||||||
@ -460,13 +459,7 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
ObjectId, RequestedCount, StartingIndex,
|
ObjectId, RequestedCount, StartingIndex,
|
||||||
BrowseFlag, Filter, SortCriteria);
|
BrowseFlag, Filter, SortCriteria);
|
||||||
|
|
||||||
if( !Filter )
|
if( Filter && (strlen(Filter) > 1) )
|
||||||
{
|
|
||||||
ClearNameValueList(&data);
|
|
||||||
SoapError(h, 402, "Invalid Args");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if( strlen(Filter) > 1 )
|
|
||||||
args.filter = Filter;
|
args.filter = Filter;
|
||||||
|
|
||||||
args.resp = resp;
|
args.resp = resp;
|
||||||
@ -566,17 +559,11 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
|
|
||||||
strcpy(resp, resp0);
|
strcpy(resp, resp0);
|
||||||
/* See if we need to include DLNA namespace reference */
|
/* See if we need to include DLNA namespace reference */
|
||||||
if( (strlen(Filter) <= 1) || strstr(Filter, "dlna") )
|
if( Filter && ((strlen(Filter) <= 1) || strstr(Filter, "dlna")) )
|
||||||
strcat(resp, DLNA_NAMESPACE);
|
strcat(resp, DLNA_NAMESPACE);
|
||||||
strcat(resp, ">\n");
|
strcat(resp, ">\n");
|
||||||
|
|
||||||
if( !Filter )
|
if( Filter && (strlen(Filter) > 1) )
|
||||||
{
|
|
||||||
ClearNameValueList(&data);
|
|
||||||
SoapError(h, 402, "Invalid Args");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if( strlen(Filter) > 1 )
|
|
||||||
args.filter = Filter;
|
args.filter = Filter;
|
||||||
if( strcmp(ContainerID, "0") == 0 )
|
if( strcmp(ContainerID, "0") == 0 )
|
||||||
*ContainerID = '*';
|
*ContainerID = '*';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user