$OpenBSD: patch-c2s_authreg_mysql_c,v 1.1 2019/05/09 03:48:56 jca Exp $

Index: c2s/authreg_mysql.c
--- c2s/authreg_mysql.c.orig
+++ c2s/authreg_mysql.c
@@ -388,6 +388,7 @@ int ar_mysql_init(authreg_t ar) {
     int strlentur; /* string length of table, user, and realm strings */
     MYSQL *conn;
     mysqlcontext_t mysqlcontext;
+    my_bool reconnect;
 
     /* configure the database context with field names and SQL statements */
     mysqlcontext = (mysqlcontext_t) malloc( sizeof( struct mysqlcontext_st ) );
@@ -527,7 +528,8 @@ int ar_mysql_init(authreg_t ar) {
     }
 
     /* Set reconnect flag to 1 (set to 0 by default from mysql 5 on) */
-    conn->reconnect = 1;
+    reconnect = 1;
+    mysql_options(conn, MYSQL_OPT_RECONNECT, &reconnect);
 
     ar->user_exists = _ar_mysql_user_exists;
     ar->get_password = _ar_mysql_get_password;
