| Bug #24121 | Incorrect test for SSL_VERIFY_SERVER_CERT | ||
|---|---|---|---|
| Submitted: | 9 Nov 2006 0:33 | Modified: | 24 Apr 2007 17:51 |
| Reporter: | [ name withheld ] | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.27 | OS: | Any |
| Assigned to: | Magnus Blåudd | CPU Architecture: | Any |
| Tags: | qc | ||
[25 Jan 2007 23:32]
MySQL Verification Team
Thank you for the bug report.
[27 Mar 2007 17:26]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/23052 ChangeSet@1.2415, 2007-03-27 19:26:01+02:00, msvensson@pilot.blaudden +2 -0 Bug#24121 Incorrect test for SSL_VERIFY_SERVER_CERT - Interpret the pointer passed to 'mysql_options' for MYSQL_OPT_SSL_VERIFY_SERVER_CERT as a my_bool - In 5.1 the mysql_options signature will be chanegd to take a 'void*' in order to further emphasize the need for a pointer to correct type
[27 Mar 2007 19:04]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/23065 ChangeSet@1.2511, 2007-03-27 21:04:05+02:00, msvensson@pilot.blaudden +2 -0 Bug #24121 Incorrect test for SSL_VERIFY_SERVER_CERT - Change 'mysql_options' third argment "arg" to "const void*"
[6 Apr 2007 17:22]
Bugs System
Pushed into 5.0.40
[6 Apr 2007 17:24]
Bugs System
Pushed into 5.1.18-beta
[11 Apr 2007 12:57]
Magnus Blåudd
BUG#27227 marked as duplicate of this one.
[24 Apr 2007 17:51]
Paul DuBois
Noted in 5.0.40, 5.1.18 changelogs. The test for the MYSQL_OPT_SSL_VERIFY_SERVER_CERT option for mysql_options() was performed incorrectly. Also changed as a result of this bugfix: The arg option for the mysql_options() C API function was changed from char * to void *.

Description: sql-common/client.c incorrectly supposes the argument for MYSQL_OPT_SSL_VERIFY_SERVER_CERT is of type uint, when in fact it is my_bool. Depending on how the compiler packs storage, this leads to incorrectly deciding the option should be enabled when the caller really wants it to be disabled. Or, if you think this code is correct, the variable opt_ssl_verify_server_cert in sslopt-vars.h needs to be changed. How to repeat: Try to run regression tests on FC5. Suggested fix: diff -Naur mysql-5.0.27.orig/sql-common/client.c mysql-5.0.27/sql-common/client.c --- mysql-5.0.27.orig/sql-common/client.c 2006-10-20 20:22:26.000000000 -0400 +++ mysql-5.0.27/sql-common/client.c 2006-11-08 19:20:49.000000000 -0500 @@ -2949,7 +2949,7 @@ mysql->reconnect= *(my_bool *) arg; break; case MYSQL_OPT_SSL_VERIFY_SERVER_CERT: - if (!arg || test(*(uint*) arg)) + if (!arg || test(*(my_bool*) arg)) mysql->options.client_flag|= CLIENT_SSL_VERIFY_SERVER_CERT; else mysql->options.client_flag&= ~CLIENT_SSL_VERIFY_SERVER_CERT;