Talking to gpg-agent using gpg-connect-agent i saw the getinfo cmd_has_option.
I thought this might be useful for other testing about the evolution of various options.
however, it's pretty clearly wrong:
> help genkey # GENKEY [--no-protection] [--preset] [--inq-passwd] # [--passwd-nonce=<s>] [<cache_nonce>] # # Generate a new key, store the secret part and return the public # part. Here is an example transaction: # # C: GENKEY # S: INQUIRE KEYPARAM # C: D (genkey (rsa (nbits 3072))) # C: END # S: D (public-key # S: D (rsa (n 326487324683264) (e 10001))) # S: OK key created # # When the --preset option is used the passphrase for the generated # key will be added to the cache. When --inq-passwd is used an inquire # with the keyword NEWPASSWD is used to request the passphrase for the # new key. When a --passwd-nonce is used, the corresponding cached # passphrase is used to protect the new key. OK > getinfo cmd_has_option genkey --preset ERR 67109120 False <GPG Agent> >
It seems to be implemented over in agent/command.c:
/* Return true if the command CMD implements the option OPT. */ static int command_has_option (const char *cmd, const char *cmdopt) { if (!strcmp (cmd, "GET_PASSPHRASE")) { if (!strcmp (cmdopt, "repeat")) return 1; } return 0; }
If it's not trustworthy for general use, why is it exposed? or, is it just buggy?