[PUP-7241] AIX - Errors when parsing lsuser output with special characters (#!) Created: 2017/02/21  Updated: 2018/09/11  Resolved: 2018/09/11

Status: Resolved
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: Rodney Treweek Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: aix, maintenance, type_and_provider, user
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

AIX, PE 2016.4.0+


Issue Links:
Blocks
is blocked by PUP-9049 Refactor the AIX user/group providers Resolved
Template: PUP Bug Template
Epic Link: who USERs AIX anyway?
Team: Platform OS
Sprint: Platform OS Kanban
Method Found: Customer Feedback
QA Risk Assessment: Needs Assessment

 Description   

Description
When attempting to manage a user on AIX, the puppet agent runs fail with the following error.

Error: /User[username]: Could not evaluate: undefined method `to_sym' for nil:NilClass

The problem is occurring when the attributes have an odd number of colons in the output of lsuser -c.

Reproduction Steps

This can be reproduced with following these steps:
1. Login to the AIX node with an IPv6 address
2. Run the puppet agent

Technical details

The host_last_login from lsuser -c -R files username contains : characters, which are not parsed properly since it is a colon seperated list. This fails in <https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/aixobject.rb#L199>. A IPv6 address of the form 2001:0db8:85a3:0000:0000:8a2e:0370:7334 will need to have the : escaped to fit into a colon separated list. Since the regex does not account for these escaped characters, the property list has more values than keys (i.e 8a2e would be a value without a key).

Proposed fix
Use lsuser -f instead of lsuser -c to output a list of attribute pairs instead of a colon list, as it should automatically use parse_attr_list instead. Since lsuser -f will not have to escape the colons, this issue should no longer be seen.



 Comments   
Comment by Moses Mendoza [ 2017/02/22 ]

Rodney Treweek thanks for filing. Added to queue. We try to eventually open all PUP project issues to the public, and I see this one has customer data attached which would prevent that. Is there any way you could file a public PUP ticket without customer-specific information that details the problem? We'll use this to publicly track the fix on github.com puppet

Comment by Tommy McNeely [ 2018/08/02 ]

It appears that the colons are escaped with "#!" in an IPv6 address.

# /usr/sbin/lsuser -c -R files root
#name:id:pgrp:groups:home:shell:gecos:auditclasses:login:su:rlogin:daemon:admin:sugroups:tpath:ttys:expires:auth1:auth2:umask:registry:SYSTEM:loginretries:pwdwarntime:account_locked:minage:maxage:maxexpired:minalpha:minloweralpha:minupperalpha:minother:mindigit:minspecialchar:mindiff:maxrepeats:minlen:histexpire:histsize:fsize:cpu:data:stack:core:rss:nofiles:time_last_login:time_last_unsuccessful_login:tty_last_login:tty_last_unsuccessful_login:host_last_login:host_last_unsuccessful_login:unsuccessful_login_count
root:0:system:system,bin,sys,security,cron,audit,lp:/:/usr/bin/ksh:root:general:true:false:false:true:true:system:nosak:ALL:0:SYSTEM:NONE:22:files:compat:0:0:false:0:0:-1:0:0:0:0:0:0:0:8:0:0:0:-1:-1:-1:-1:-1:-1:-1:1527849270:1533085305:ssh:ssh:fd8c#!:215d#!:178e#!:12#!:290#!:fa72#!:fab2#!:882:10.10.28.247:147

Comment by Casey Williams [ 2018/08/14 ]

This is addressed as part of a PR for PUP-9049 and PUP-3021 here

Generated at Tue Nov 19 14:46:47 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.