mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-03-06 06:47:41 +08:00
better error messages when certificate username limit is reached
This commit is contained in:
@@ -393,8 +393,12 @@ int get_cert_names(worker_st * ws, const gnutls_datum_t * raw)
|
||||
ret = gnutls_x509_crt_get_dn(crt, ws->cert_username, &size);
|
||||
}
|
||||
if (ret < 0) {
|
||||
oclog(ws, LOG_ERR, "cannot obtain user from certificate DN: %s",
|
||||
gnutls_strerror(ret));
|
||||
if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER)
|
||||
oclog(ws, LOG_ERR, "certificate's username exceed the maximum buffer size (%u)",
|
||||
(unsigned)sizeof(ws->cert_username));
|
||||
else
|
||||
oclog(ws, LOG_ERR, "cannot obtain user from certificate DN: %s",
|
||||
gnutls_strerror(ret));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -761,8 +765,12 @@ int get_cert_info(worker_st * ws)
|
||||
|
||||
ret = get_cert_names(ws, cert);
|
||||
if (ret < 0) {
|
||||
oclog(ws, LOG_ERR, "cannot get username (%s) from certificate",
|
||||
ws->config->cert_user_oid);
|
||||
if (ws->config->cert_user_oid == NULL) {
|
||||
oclog(ws, LOG_ERR, "cannot read username from certificate; no cert-user-oid is set");
|
||||
} else {
|
||||
oclog(ws, LOG_ERR, "cannot read username (%s) from certificate",
|
||||
ws->config->cert_user_oid);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user