@@ -2037,8 +2037,7 @@ InitializeLDAPConnection(Port *port, LDAP **ldap)
2037
2037
{
2038
2038
#ifndef WIN32
2039
2039
ereport (LOG ,
2040
- (errmsg ("could not initialize LDAP: error code %d" ,
2041
- errno )));
2040
+ (errmsg ("could not initialize LDAP: %m" )));
2042
2041
#else
2043
2042
ereport (LOG ,
2044
2043
(errmsg ("could not initialize LDAP: error code %d" ,
@@ -2051,7 +2050,7 @@ InitializeLDAPConnection(Port *port, LDAP **ldap)
2051
2050
{
2052
2051
ldap_unbind (* ldap );
2053
2052
ereport (LOG ,
2054
- (errmsg ("could not set LDAP protocol version:error code %d " ,r )));
2053
+ (errmsg ("could not set LDAP protocol version:%s " ,ldap_err2string ( r ) )));
2055
2054
return STATUS_ERROR ;
2056
2055
}
2057
2056
@@ -2104,7 +2103,7 @@ InitializeLDAPConnection(Port *port, LDAP **ldap)
2104
2103
{
2105
2104
ldap_unbind (* ldap );
2106
2105
ereport (LOG ,
2107
- (errmsg ("could not start LDAP TLS session:error code %d " ,r )));
2106
+ (errmsg ("could not start LDAP TLS session:%s " ,ldap_err2string ( r ) )));
2108
2107
return STATUS_ERROR ;
2109
2108
}
2110
2109
}
@@ -2193,8 +2192,8 @@ CheckLDAPAuth(Port *port)
2193
2192
if (r != LDAP_SUCCESS )
2194
2193
{
2195
2194
ereport (LOG ,
2196
- (errmsg ("could not perform initial LDAP bind for ldapbinddn \"%s\" on server \"%s\":error code %d " ,
2197
- port -> hba -> ldapbinddn ,port -> hba -> ldapserver ,r )));
2195
+ (errmsg ("could not perform initial LDAP bind for ldapbinddn \"%s\" on server \"%s\":%s " ,
2196
+ port -> hba -> ldapbinddn ,port -> hba -> ldapserver ,ldap_err2string ( r ) )));
2198
2197
return STATUS_ERROR ;
2199
2198
}
2200
2199
@@ -2218,8 +2217,8 @@ CheckLDAPAuth(Port *port)
2218
2217
if (r != LDAP_SUCCESS )
2219
2218
{
2220
2219
ereport (LOG ,
2221
- (errmsg ("could not search LDAP for filter \"%s\" on server \"%s\":error code %d " ,
2222
- filter ,port -> hba -> ldapserver ,r )));
2220
+ (errmsg ("could not search LDAP for filter \"%s\" on server \"%s\":%s " ,
2221
+ filter ,port -> hba -> ldapserver ,ldap_err2string ( r ) )));
2223
2222
pfree (filter );
2224
2223
return STATUS_ERROR ;
2225
2224
}
@@ -2306,8 +2305,8 @@ CheckLDAPAuth(Port *port)
2306
2305
if (r != LDAP_SUCCESS )
2307
2306
{
2308
2307
ereport (LOG ,
2309
- (errmsg ("LDAP login failed for user \"%s\" on server \"%s\":error code %d " ,
2310
- fulluser ,port -> hba -> ldapserver ,r )));
2308
+ (errmsg ("LDAP login failed for user \"%s\" on server \"%s\":%s " ,
2309
+ fulluser ,port -> hba -> ldapserver ,ldap_err2string ( r ) )));
2311
2310
pfree (fulluser );
2312
2311
return STATUS_ERROR ;
2313
2312
}