Skip to content

Commit ea77732

Browse files
authored
Merge pull request #774 from openziti/issue-733-unmapped-errs
add two error mappings
2 parents 4c0253a + 7156e38 commit ea77732

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

includes/ziti/errors.h

+9-4
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ extern "C" {
3535
#define ZITI_CONFIG_NOT_FOUND (-1)
3636
/** The provided JWT was not found */
3737
#define ZITI_JWT_NOT_FOUND (-2)
38-
/** The provided JWT is not accepted by controller */
38+
/** The provided JWT is not accepted by the controller */
3939
#define ZITI_JWT_INVALID (-3)
40-
/** The provided JWT has invalid format */
40+
/** The provided JWT has an invalid format */
4141
#define ZITI_JWT_INVALID_FORMAT (-4)
4242
/** PKCS7/ASN.1 parsing failed */
4343
#define ZITI_PKCS7_ASN1_PARSING_FAILED (-5)
@@ -49,7 +49,7 @@ extern "C" {
4949
#define ZITI_ENROLLMENT_METHOD_UNSUPPORTED (-8)
5050
/** enrollment method requires client certificate */
5151
#define ZITI_ENROLLMENT_CERTIFICATE_REQUIRED (-9)
52-
/** Attempt to generate an private key failed */
52+
/** Attempt to generate a private key failed */
5353
#define ZITI_KEY_GENERATION_FAILED (-10)
5454
/** Attempt to load TLS key failed */
5555
#define ZITI_KEY_LOAD_FAILED (-11)
@@ -79,7 +79,7 @@ is offline or did not respond to the request*/
7979
#define ZITI_TIMEOUT (-20)
8080
/** The connection has been closed abnormally. */
8181
#define ZITI_CONNABORT (-21)
82-
/** SDK detected invalid state, most likely caaused by improper use. */
82+
/** SDK detected invalid state, most likely caused by improper use. */
8383
#define ZITI_INVALID_STATE (-22)
8484
/** SDK detected invalid cryptographic state of Ziti connection */
8585
#define ZITI_CRYPTO_FAIL (-23)
@@ -105,6 +105,11 @@ is offline or did not respond to the request*/
105105
#define ZITI_INVALID_AUTHENTICATOR_CERT (-33)
106106
/** returned when attempting to set the current certificate and key being used by a ztx when it could not be parsed/applied */
107107
#define ZITI_INVALID_CERT_KEY_PAIR (-34)
108+
/** returned when attempting to enroll the same key/cert with an external CA that has already been used */
109+
#define ZITI_CERT_IN_USE (-35)
110+
/** returned when enrolling a key/cert with an external CA and no CA matches the cert */
111+
#define ZITI_CERT_FAILED_VALIDATION (-36)
112+
108113

109114
// Put new error codes here and add error string in error.c
110115

library/errors.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
XX(PARTIALLY_AUTHENTICATED, "api session is partially authenticated, waiting for auth query resolution") \
5050
XX(INVALID_AUTHENTICATOR_TYPE, "the authenticator could not be extended as it is the incorrect type") \
5151
XX(INVALID_AUTHENTICATOR_CERT, "the authenticator could not be extended as the current client certificate does not match") \
52-
XX(INVALID_CERT_KEY_PAIR, "the active certificate and key could not be set, invalid pair, or could not parse") \
52+
XX(INVALID_CERT_KEY_PAIR, "the active certificate and key could not be set, invalid pair, or could not parse") \
53+
XX(CERT_IN_USE,"the provided certificate already in use") \
54+
XX(CERT_FAILED_VALIDATION, "the provided key/cert are invalid") \
5355
XX(WTF, "WTF: programming error")
5456

5557

library/ziti_ctrl.c

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ XX(MFA_INVALID_TOKEN, ZITI_MFA_INVALID_TOKEN) \
7373
XX(MFA_EXISTS, ZITI_MFA_EXISTS) \
7474
XX(MFA_NOT_ENROLLED, ZITI_MFA_NOT_ENROLLED) \
7575
XX(INVALID_ENROLLMENT_TOKEN, ZITI_JWT_INVALID) \
76+
XX(CERT_IN_USE, ZITI_CERT_IN_USE) \
77+
XX(CERT_FAILED_VALIDATION, ZITI_CERT_FAILED_VALIDATION) \
7678
XX(COULD_NOT_VALIDATE, ZITI_NOT_AUTHORIZED)
7779

7880

0 commit comments

Comments
 (0)