cvtsudoers outputs invalid JSON · Issue #369 · sudo-project/sudo (original) (raw)

Using the following sudoers file in /etc/sudoers.d/test3:

user0   ALL = CHROOT=/var/www CWD=/htdocs /bin/ksh

Using the command:

cvtsudoers --defaults=all --output-format=JSON --input-format=SUDOERS --output=- /etc/sudoers.d/test3

We get the following invalid JSON output:

{
    "User_Specs": [
        {
            "User_List": [
                { "username": "user0" }
            ],
            "Host_List": [
                { "hostname": "ALL" }
            ],
            "Cmnd_Specs": [
                {
                    "Options": [
                        "runchroot": "/var/www",
                        "runcwd": "/htdocs"
                    ],
                    "Commands": [
                        { "command": "/bin/ksh" }
                    ]
                }
            ]
        }
    ]
}

The invalid part is here:

"Options": [
    "runchroot": "/var/www",
    "runcwd": "/htdocs"
],