Bug 856 - Add support for padding the increment value in sudoOrder
Add support for padding the increment value in sudoOrder
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.25
PC Linux
: low enhancement
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-10-19 04:59 MDT by Daniele Palumbo
Modified: 2018-11-16 11:14 MST (History)
1 user (show)

See Also:


Attachments
patch to support padding (7.60 KB, application/octet-stream)
2018-10-19 04:59 MDT, Daniele Palumbo
Details
Reworked patch to support padding of cvtsudoers increment (14.45 KB, patch)
2018-10-24 10:12 MDT, Todd C. Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.