glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
252 stars 61 forks source link

Agents on Ubuntu trims alternate username field to 8 characters #757

Closed topinet closed 2 months ago

topinet commented 2 months ago

Bug reporting acknowledgment

Yes, I read it

Professional support

Yes, I know

Describe the bug

When executing "glpi-inventory --partial user --debug", on "context:hardware" section, "lastloggeduser" filed is trimmed to 8 characters.

This field is populated on line 153 of lib/GLPI/Agent/Task/Inventory/Generic/Users.pm using "last" command, which will trim usernames longer than 8 characters, to avoid this a "-w" flag must be used.

To reproduce

  1. Install last GPLI agent for Linux:
    $ glpi-agent --version
    GLPI Agent (1.10-1)
    Built by Debian
    Source time: 2024-07-09 09:29
  2. Execute inventory: glpi-inventory --partial user --debug

Expected behavior

lastloggeduser must show full username, not trimmed to 8 characters

Operating system

Linux

GLPI Agent version

v1.10

GLPI version

10.0.16

GLPIInventory plugin or other plugin version

Not applicable

Additional context

No response