glpi-project / android-inventory-library

Inventory client library written in Java for developing applications on Android
GNU General Public License v3.0
19 stars 21 forks source link

Blank NAME property for some Software. #328

Closed kmpm closed 1 year ago

kmpm commented 1 year ago

Describe the bug When this library is used in glpi-android-agent it will sometime produce a report that fails the validation on glpi server because of a blank software name.

To Reproduce Steps to reproduce the behavior:

  1. Install CarPay using Google Pay (by Volvofinans Bank AB in Sweden)
  2. Run tcpdump on your GLPI server to capture the traffic between agent and server.
  3. Install and configure GLPI Agent on you phone
  4. Click "RUN INVENTORY NOW"
  5. Wait for "Done" message in the agent

Nothing shows up on the server but if you look in the capture from tcpdump you will find a HTTP response with something similar to

<?xml version="1.0"?>
<REPLY><ERROR><![CDATA[JSON does not validate. Violations:
Required property missing: name, data: {"comments":"se.volvofinans.carpay","version":"2.26.1","filesize":23983102,"from":"Android","folder":"/data/app/se.volvofinans.carpay-TW-bo-eBV72YY4bitp7lcQ==","no_remove":tru&nbsp;(...)]]></ERROR></REPLY>

Expected behavior When the agent reports "Done" I expect a properly formated inventory to be sent to the server.

Screenshots N/A.

Desktop (please complete the following information): N/A.

Smartphone (please complete the following information):

Additional context When looking at the request from the GLPI Agent which contains the XML built by this library I find that the carpay software has a blank name

<SOFTWARES>
      <NAME></NAME>
      <COMMENTS>se.volvofinans.carpay</COMMENTS>
      <VERSION>2.26.1</VERSION>
      <FILESIZE>23983102</FILESIZE>
      <FROM>Android</FROM>
      <INSTALLDATE>04/10/2019</INSTALLDATE>
      <FOLDER>/data/app/se.volvofinans.carpay-TW-bo-eBV72YY4bitp7lcQ==</FOLDER>
      <NO_REMOVE>1</NO_REMOVE>
      <USERID>10290</USERID>
    </SOFTWARES>

If that happens, perhaps use comments as a fallback instead so that the inventory at least is valid for GLPI.

This is also reported in the GLPI forum at https://forum.glpi-project.org/viewtopic.php?id=287704