]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: db_ldap_set_options() - Move variables local to their usage
authorMarco Bettini <marco.bettini@open-xchange.com>
Wed, 24 Jul 2024 15:50:47 +0000 (15:50 +0000)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:13 +0000 (12:34 +0200)
Specifically, int value could cause an unused warning/error
if LDAP_OPT_DEBUG_LEVEL is not defined

src/auth/db-ldap.c

index 61b1fc96f582672a3e857eafc75b4ef77bb711f8..3990c111eb7e0d8e58388ca863e3dbb71d054806 100644 (file)
@@ -994,9 +994,6 @@ static void db_ldap_set_tls_options(struct ldap_connection *conn)
 
 static void db_ldap_set_options(struct ldap_connection *conn)
 {
-       unsigned int ldap_version;
-       int value;
-
 #ifdef LDAP_OPT_NETWORK_TIMEOUT
        struct timeval tv;
        int ret;
@@ -1010,14 +1007,15 @@ static void db_ldap_set_options(struct ldap_connection *conn)
        db_ldap_set_opt(conn->ld, LDAP_OPT_DEREF, &conn->set.ldap_deref,
                        "deref", conn->set.deref);
 #ifdef LDAP_OPT_DEBUG_LEVEL
-       if (str_to_int(conn->set.debug_level, &value) >= 0 && value != 0) {
-               db_ldap_set_opt(NULL, LDAP_OPT_DEBUG_LEVEL, &value,
+       int debug_level;
+       if (str_to_int(conn->set.debug_level, &debug_level) >= 0 && debug_level != 0) {
+               db_ldap_set_opt(NULL, LDAP_OPT_DEBUG_LEVEL, &debug_level,
                                "debug_level", conn->set.debug_level);
                event_set_forced_debug(conn->event, TRUE);
        }
 #endif
 
-       ldap_version = conn->set.ldap_version;
+       unsigned int ldap_version = conn->set.ldap_version;
        db_ldap_set_opt(conn->ld, LDAP_OPT_PROTOCOL_VERSION, &ldap_version,
                        "protocol_version", dec2str(ldap_version));
        db_ldap_set_tls_options(conn);