dirmngr: Remove use of hardcoded numbers in validate.
authorWerner Koch <wk@gnupg.org>
Fri, 17 Feb 2017 13:19:15 +0000 (14:19 +0100)
committerWerner Koch <wk@gnupg.org>
Fri, 17 Feb 2017 15:41:02 +0000 (16:41 +0100)
commited99af030d19305dd7cd41c41ac581306cb91fd5
tree1d40ffa277dd943b292399bc856a09b7898c82fd
parentdea4b3c742acbd195d6ab12b279b4dda315f2582
dirmngr: Remove use of hardcoded numbers in validate.

* dirmngr/validate.c (enum cert_usage_modes): New.
(cert_usage_p): Change type of arg MODE.  Use enums instead of
hardwired values.  Use a switch instead of tricky bit tests.
(cert_use_cert_p, cert_use_ocsp_p, cert_use_crl_p): Adjust.

* dirmngr/validate.c (cert_usage_p): Rename to check_cert_usage.
(cert_use_cert_p): Rename to check_cert_use_cert.
(cert_use_ocsp_p): Rename to check_cert_use_ocsp.
(cert_use_crl_p): Rename to check_cert_use_crl.

* dirmngr/validate.h (VALIDATE_MODE_CERT_SYSTRUST): New.
(VALIDATE_MODE_TLS, VALIDATE_MODE_TLS_SYSTRUST): New.

--

A function with a "_p" suffix return 0 for a True just looks weird.
We now use names which better indicate that an error code is returned.

Signed-off-by: Werner Koch <wk@gnupg.org>
dirmngr/validate.c
dirmngr/validate.h