You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
typo in the fp commit, cert_fp unused
also rename fp->f to avoid shadowing a variable
This commit is contained in:
@@ -218,26 +218,22 @@ static my_bool ma_pvio_tls_compare_fp(MARIADB_TLS *ctls,
|
||||
|
||||
my_bool ma_pvio_tls_check_fp(MARIADB_TLS *ctls, const char *fp, const char *fp_list)
|
||||
{
|
||||
unsigned int cert_fp_len= 64;
|
||||
char *cert_fp= NULL;
|
||||
my_bool rc=1;
|
||||
MYSQL *mysql= ctls->pvio->mysql;
|
||||
|
||||
cert_fp= (char *)malloc(cert_fp_len);
|
||||
|
||||
if (fp)
|
||||
{
|
||||
rc = ma_pvio_tls_compare_fp(ctls, fp, (uint)strlen(fp));
|
||||
}
|
||||
else if (fp_list)
|
||||
{
|
||||
MA_FILE *fp;
|
||||
MA_FILE *f;
|
||||
char buff[255];
|
||||
|
||||
if (!(fp = ma_open(fp_list, "r", mysql)))
|
||||
if (!(f = ma_open(fp_list, "r", mysql)))
|
||||
goto end;
|
||||
|
||||
while (ma_gets(buff, sizeof(buff)-1, fp))
|
||||
while (ma_gets(buff, sizeof(buff)-1, f))
|
||||
{
|
||||
/* remove trailing new line character */
|
||||
char *pos= strchr(buff, '\r');
|
||||
@@ -246,22 +242,20 @@ my_bool ma_pvio_tls_check_fp(MARIADB_TLS *ctls, const char *fp, const char *fp_l
|
||||
if (pos)
|
||||
*pos= '\0';
|
||||
|
||||
if (!ma_pvio_tls_compare_fp(ctls, cert_fp, cert_fp_len))
|
||||
if (!ma_pvio_tls_compare_fp(ctls, buff, (uint)strlen(buff)))
|
||||
{
|
||||
/* finger print is valid: close file and exit */
|
||||
ma_close(fp);
|
||||
ma_close(f);
|
||||
rc= 0;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
/* No finger print matched - close file and return error */
|
||||
ma_close(fp);
|
||||
ma_close(f);
|
||||
}
|
||||
|
||||
end:
|
||||
if (cert_fp)
|
||||
free(cert_fp);
|
||||
if (rc)
|
||||
{
|
||||
my_set_error(mysql, CR_SSL_CONNECTION_ERROR, SQLSTATE_UNKNOWN,
|
||||
|
Reference in New Issue
Block a user