Bug 856

Summary: Add support for padding the increment value in sudoOrder
Product: Sudo Reporter: Daniele Palumbo <daniele>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: enhancement CC: daniele
Priority: low    
Version: 1.8.25   
Hardware: PC   
OS: Linux   
Attachments: patch to support padding
Reworked patch to support padding of cvtsudoers increment

Description Daniele Palumbo 2018-10-19 04:59:57 MDT
Created attachment 518 [details]
patch to support padding

As an user, i have an included file with a very long list of entries (>120).
As an administrator, i want to keep a numeric index for internal management purpose in the filename, to identify it.
As an administrator, i want to keep the same numeric index in sudoOrder in LDAP, to identify it in a fast way.

In example, i have the following include file
/etc/sudoers.d/1201_TeamA_AppplicationA

I want to have a sudoOrder like
# ./cvtsudoers -b ou=SUDOers,dc=my-domain,dc=com -O 1201 -I 1 -P 100 -o testfile.ldif /etc/sudoers.d/1201_TeamA_AppplicationA

The expected sudoOrder are then
[...]
sudoOrder: 1201001
[...]
sudoOrder: 1201002
[...]
sudoOrder: 1201121

Ti do so, it is necessary to fill with zeroes in front of the increment number (padding).

The attached patch, which include a test, implement this functionality.
Comment 1 Todd C. Miller 2018-10-24 10:12:20 MDT
Created attachment 519 [details]
Reworked patch to support padding of cvtsudoers increment

I've attached a reworked diff that uses the number of digits as the pad and exits with an error if the increment grows too big for the pad.
Comment 2 Todd C. Miller 2018-11-16 11:14:20 MST
Fixed in sudo 1.8.26.