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
| 6818 | * - Connection is a TLS connection but no client ceritifcate was used |
| 6819 | */ |
| 6820 | RedisModuleString *RM_GetClientCertificate(RedisModuleCtx *ctx, uint64_t client_id) { |
| 6821 | client *c = lookupClientByID(client_id); |
| 6822 | if (c == NULL) return NULL; |
| 6823 | |
| 6824 | sds cert = connTLSGetPeerCert(c->conn); |
| 6825 | if (!cert) return NULL; |
| 6826 | |
| 6827 | RedisModuleString *s = createObject(OBJ_STRING, cert); |
| 6828 | if (ctx != NULL) autoMemoryAdd(ctx, REDISMODULE_AM_STRING, s); |
| 6829 | |
| 6830 | return s; |
| 6831 | } |
| 6832 | |
| 6833 | /* -------------------------------------------------------------------------- |
| 6834 | * ## Modules Dictionary API |
nothing calls this directly
no test coverage detected