Browse Source

Fixed a bug in the XML parser that made pam_usb segfault if the value of

the result node of the xpath query were empty.
Fixed the volume probing system to abort if there's no UUID configured
Andrea Luzzardi 18 years ago
parent
commit
34f28438fe
2 changed files with 11 additions and 0 deletions
  1. +5
    -0
      src/volume.c
  2. +6
    -0
      src/xpath.c

+ 5
- 0
src/volume.c View File

@ -79,6 +79,11 @@ static LibHalVolume *pusb_volume_probe(t_pusb_options *opts,
int maxtries = 0; int maxtries = 0;
int i; int i;
if (!*(opts->device.volume_uuid))
{
log_debug("No UUID configured for device\n");
return (NULL);
}
log_debug("Searching for volume with uuid %s\n", opts->device.volume_uuid); log_debug("Searching for volume with uuid %s\n", opts->device.volume_uuid);
maxtries = ((opts->probe_timeout * 1000000) / 250000); maxtries = ((opts->probe_timeout * 1000000) / 250000);
for (i = 0; i < maxtries; ++i) for (i = 0; i < maxtries; ++i)


+ 6
- 0
src/xpath.c View File

@ -65,6 +65,12 @@ int pusb_xpath_get_string(xmlDocPtr doc, const char *path,
node = result->nodesetval->nodeTab[0]->xmlChildrenNode; node = result->nodesetval->nodeTab[0]->xmlChildrenNode;
result_string = xmlNodeListGetString(doc, node, 1); result_string = xmlNodeListGetString(doc, node, 1);
if (!result_string)
{
xmlXPathFreeObject(result);
log_debug("Empty value for %s\n", path);
return (0);
}
if (strlen((const char *)result_string) + 1 > size) if (strlen((const char *)result_string) + 1 > size)
{ {
xmlFree(result_string); xmlFree(result_string);


Loading…
Cancel
Save