pki-bot / pki-issues-final

0 stars 0 forks source link

Null pointer exception in key-recover CLI #1078

Closed pki-bot closed 4 years ago

pki-bot commented 4 years ago

This issue was migrated from Pagure Issue #1087. Originally filed by edewata (@edewata) on 2014-08-05 16:37:05:


Running key-recover CLI without parameters generates an exception:

[root@vm-084 scripts]# pki key-recover
NullPointerException: null

It looks like the CLI is trying to parse a missing key ID:

[root@vm-084 scripts]# pki -v key-recover
Server URI: http://vm-084.idm.lab.bos.redhat.com:8080
Security database: /root/.dogtag/nssdb
Message format: null
Command: key-recover
Module: key
Module: recover
java.lang.NullPointerException
    at com.netscape.certsrv.dbs.keydb.KeyId.toString(KeyId.java:95)
    at com.netscape.certsrv.key.KeyRecoveryRequest.setKeyId(KeyRecoveryRequest.java:85)
    at com.netscape.certsrv.key.KeyClient.recoverKey(KeyClient.java:284)
    at com.netscape.cmstools.key.KeyRecoverCLI.execute(KeyRecoverCLI.java:101)
    at com.netscape.cmstools.cli.CLI.execute(CLI.java:265)
    at com.netscape.cmstools.key.KeyCLI.execute(KeyCLI.java:86)
    at com.netscape.cmstools.cli.ProxyCLI.execute(ProxyCLI.java:119)
    at com.netscape.cmstools.cli.CLI.execute(CLI.java:265)
    at com.netscape.cmstools.cli.MainCLI.execute(MainCLI.java:345)
    at com.netscape.cmstools.cli.MainCLI.main(MainCLI.java:357)

Right now key ID is an optional parameter:

[root@vm-084 scripts]# pki key-recover --help
usage: key-recover [OPTIONS...]
    --help                      Show help options
    --input <Input file path>   Location of the request template file.
    --keyID <Key Identifier>    Key Identifier for the secret to be
                                recovered.

The parameter should have been required, but it'll probably make more sense to make key ID a required argument instead:

usage: key-recover <key ID> [OPTIONS...]

The key ID specified as an argument should override any key ID specified in the input template file.

Proposed milestone: 10.2 August

pki-bot commented 4 years ago

Comment from kaskahn at 2014-08-29 20:18:07

Fixed and pushed to master in a7f8076a5f20812eceac31f7230e4156adf74471

pki-bot commented 4 years ago

Comment from edewata (@edewata) at 2017-02-27 14:08:44

Metadata Update from @edewata: