]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-ssl-iostream, login-common: Rename ssl_iostream_get_peer_name() to _get_peer_user...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 8 Jun 2023 20:26:03 +0000 (23:26 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:09 +0000 (12:34 +0200)
It's always using the ssl_cert_username_field to get it, so make it
explicit.

src/lib-ssl-iostream/iostream-openssl.c
src/lib-ssl-iostream/iostream-ssl-private.h
src/lib-ssl-iostream/iostream-ssl.c
src/lib-ssl-iostream/iostream-ssl.h
src/login-common/sasl-server.c

index 8423094853010263154e141d076989493c2e3b90..78c2da093a4555f667f11e37a26c4d72578d34b9 100644 (file)
@@ -821,7 +821,7 @@ openssl_iostream_has_broken_client_cert(struct ssl_iostream *ssl_io)
 }
 
 static const char *
-openssl_iostream_get_peer_name(struct ssl_iostream *ssl_io)
+openssl_iostream_get_peer_username(struct ssl_iostream *ssl_io)
 {
        X509 *x509;
        char *name;
@@ -970,7 +970,7 @@ static const struct iostream_ssl_vfuncs ssl_vfuncs = {
        .has_valid_client_cert = openssl_iostream_has_valid_client_cert,
        .has_broken_client_cert = openssl_iostream_has_broken_client_cert,
        .cert_match_name = openssl_iostream_cert_match_name,
-       .get_peer_name = openssl_iostream_get_peer_name,
+       .get_peer_username = openssl_iostream_get_peer_username,
        .get_server_name = openssl_iostream_get_server_name,
        .get_compression = openssl_iostream_get_compression,
        .get_security_string = openssl_iostream_get_security_string,
index 97f13d4e51cef37fe80ba35003f36235f302be4e..73b39ff5ff71ca4fb3b584140df5c19dc9cba504 100644 (file)
@@ -42,7 +42,7 @@ struct iostream_ssl_vfuncs {
        bool (*has_broken_client_cert)(struct ssl_iostream *ssl_io);
        bool (*cert_match_name)(struct ssl_iostream *ssl_io, const char *name,
                                const char **reason_r);
-       const char *(*get_peer_name)(struct ssl_iostream *ssl_io);
+       const char *(*get_peer_username)(struct ssl_iostream *ssl_io);
        const char *(*get_server_name)(struct ssl_iostream *ssl_io);
        const char *(*get_compression)(struct ssl_iostream *ssl_io);
        const char *(*get_security_string)(struct ssl_iostream *ssl_io);
index 6a545d3f7f040621889134f378d9e645a3cd4e01..5b4148653f8813313e33b80a2be2afb9d2c1f5e4 100644 (file)
@@ -244,9 +244,9 @@ int ssl_iostream_check_cert_validity(struct ssl_iostream *ssl_io,
        return 0;
 }
 
-const char *ssl_iostream_get_peer_name(struct ssl_iostream *ssl_io)
+const char *ssl_iostream_get_peer_username(struct ssl_iostream *ssl_io)
 {
-       return ssl_vfuncs->get_peer_name(ssl_io);
+       return ssl_vfuncs->get_peer_username(ssl_io);
 }
 
 const char *ssl_iostream_get_server_name(struct ssl_iostream *ssl_io)
index cf0e0737de441aead3d9dbb803f7675a58047170..f5abe60d2c20cf361ebb88a95b7c61af91f7fed7 100644 (file)
@@ -122,9 +122,10 @@ int ssl_iostream_check_cert_validity(struct ssl_iostream *ssl_io,
    will always return FALSE before even checking the hostname. */
 bool ssl_iostream_cert_match_name(struct ssl_iostream *ssl_io, const char *name,
                                  const char **reason_r);
-/* Returns name of the peer if available, NULL if not. Usually used to retrieve
-   username from certificate. */
-const char *ssl_iostream_get_peer_name(struct ssl_iostream *ssl_io);
+/* Returns username from the received certificate of the peer (client) if
+   available, NULL if not. The username is based on cert_username_field
+   setting. */
+const char *ssl_iostream_get_peer_username(struct ssl_iostream *ssl_io);
 /* Returns used compression, if any. Returns NULL if not available. */
 const char *ssl_iostream_get_compression(struct ssl_iostream *ssl_io);
 /* Returns TLS extension server_name(0) requested by client, or NULL if not
index efad47c32bf9d857ddba19031178e84d574b979f..5b221eb26b6e7b1c36a53b24c3d7e5132eb8539f 100644 (file)
@@ -444,7 +444,7 @@ get_cert_username(struct client *client, const char **username_r,
        }
 
        /* get peer name */
-       const char *username = ssl_iostream_get_peer_name(client->ssl_iostream);
+       const char *username = ssl_iostream_get_peer_username(client->ssl_iostream);
 
        /* if we wanted peer name, but it was not there, fail */
        if (client->set->auth_ssl_username_from_cert &&