Return the X.509 client-side certificate used by the client to authenticate * this connection. * * The return value is an allocated RedisModuleString that is a X.509 certificate * encoded in PEM (Base64) format. It should be freed (or auto-freed) by the caller. * * A NULL value is returned in the following conditions: * * - Connection ID does not exist * - Connection is not a TLS connecti
| 6626 | * - Connection is a TLS connection but no client ceritifcate was used |
| 6627 | */ |
| 6628 | RedisModuleString *RM_GetClientCertificate(RedisModuleCtx *ctx, uint64_t client_id) { |
| 6629 | client *c = lookupClientByID(client_id); |
| 6630 | if (c == NULL) return NULL; |
| 6631 | |
| 6632 | sds cert = connTLSGetPeerCert(c->conn); |
| 6633 | if (!cert) return NULL; |
| 6634 | |
| 6635 | RedisModuleString *s = createObject(OBJ_STRING, cert); |
| 6636 | if (ctx != NULL) autoMemoryAdd(ctx, REDISMODULE_AM_STRING, s); |
| 6637 | |
| 6638 | return s; |
| 6639 | } |
| 6640 | |
| 6641 | /* -------------------------------------------------------------------------- |
| 6642 | * ## Modules Dictionary API |
nothing calls this directly
no test coverage detected