From: Marco Bettini Date: Wed, 24 Jul 2024 15:50:47 +0000 (+0000) Subject: auth: db_ldap_set_options() - Move variables local to their usage X-Git-Tag: 2.4.1~785 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df7878945e34e3003fc90de2448f1f02b8c96ffe;p=thirdparty%2Fdovecot%2Fcore.git auth: db_ldap_set_options() - Move variables local to their usage Specifically, int value could cause an unused warning/error if LDAP_OPT_DEBUG_LEVEL is not defined --- diff --git a/src/auth/db-ldap.c b/src/auth/db-ldap.c index 61b1fc96f5..3990c111eb 100644 --- a/src/auth/db-ldap.c +++ b/src/auth/db-ldap.c @@ -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);