Changeset b38124b904a4200406f84ce8bb362ff0b79b7426

Show
Ignore:
Timestamp:
03/29/10 15:58:25 (4 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1269878305 +0000
git-parent:

[709df7f0b76d59662c7491bfdb0144208e43f3f7]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1269878305 +0000
Message:

this should implement sslmode=require, refs #267

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/mysql.c

    ra1d2509 rb38124b  
    238238  const char *port_s=NULL; 
    239239  const char *socket=NULL; 
     240  const char *sslmode=NULL; 
    240241  u_int32_t port; 
     242  unsigned long client_flag = CLIENT_IGNORE_SIGPIPE; 
    241243  unsigned int timeout; 
    242244 
     
    266268      noit_hash_retrieve(&dsn_h, "dbname", strlen("dbname"), (void**)&dbname); 
    267269      noit_hash_retrieve(&dsn_h, "port", strlen("port"), (void**)&port_s); 
     270      if(noit_hash_retrieve(&dsn_h, "sslmode", strlen("sslmode"), (void**)&sslmode) && 
     271         !strcmp(sslmode, "require")) 
     272        client_flag |= CLIENT_SSL; 
    268273      port = port_s ? strtol(port_s, NULL, 10) : 3306; 
    269274      noit_hash_retrieve(&dsn_h, "socket", strlen("socket"), (void**)&socket); 
     
    274279      mysql_options(ci->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&timeout); 
    275280      if(!mysql_real_connect(ci->conn, host, user, password, 
    276                              dbname, port, socket, CLIENT_IGNORE_SIGPIPE)) { 
     281                             dbname, port, socket, client_flag)) { 
    277282        noitL(noit_stderr, "error during mysql_real_connect: %s\n", 
    278283          mysql_error(ci->conn));