<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][14208] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=14208">14208</a></dd>
<dt>Author</dt> <dd>mikej</dd>
<dt>Date</dt> <dd>2009-07-12 22:08:23 -0500 (Sun, 12 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>mod_xml_curl mod_xml_cdr: fix ssl verify peer option and add cookie options (<a href="http://jira.freeswitch.org/browse/MDXMLINT-51">MDXMLINT-51</a>/<a href="http://jira.freeswitch.org/browse/MDXMLINT-52">MDXMLINT-52</a>)</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodxml_intmod_xml_cdrmod_xml_cdrc">freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c</a></li>
<li><a href="#freeswitchtrunksrcmodxml_intmod_xml_curlmod_xml_curlc">freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodxml_intmod_xml_cdrmod_xml_cdrc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (14207 => 14208)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c        2009-07-13 02:48:08 UTC (rev 14207)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c        2009-07-13 03:08:23 UTC (rev 14208)
</span><span class="lines">@@ -45,7 +45,13 @@
</span><span class="cx">         uint32_t delay;
</span><span class="cx">         uint32_t retries;
</span><span class="cx">         uint32_t shutdown;
</span><del>-        uint32_t ignore_cacert_check;
</del><ins>+        uint32_t enable_cacert_check;
+        char *ssl_cert_file;
+        char *ssl_key_file;
+        char *ssl_key_password;
+        char *ssl_version;
+        char *ssl_cacert_file;
+        uint32_t enable_ssl_verifyhost;
</ins><span class="cx">         int encode;
</span><span class="cx">         int log_b;
</span><span class="cx">         int prefix_a;
</span><span class="lines">@@ -178,10 +184,30 @@
</span><span class="cx">                         slist = curl_slist_append(slist, &quot;Expect:&quot;);
</span><span class="cx">                         curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
</span><span class="cx">                 }
</span><del>-
-                if (globals.ignore_cacert_check) {
-                        curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
</del><ins>+                
+                if (globals.ssl_cert_file) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSLCERT, globals.ssl_cert_file);
</ins><span class="cx">                 }
</span><ins>+                
+                if (globals.ssl_key_file) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSLKEY, globals.ssl_key_file);
+                }
+                
+                if (globals.ssl_key_password) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSLKEYPASSWD, globals.ssl_key_password);
+                }
+                
+                if (globals.ssl_version) {
+                        if (!strcasecmp(globals.ssl_version, &quot;SSLv3&quot;)) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
+                        } else if (!strcasecmp(globals.ssl_version, &quot;TLSv1&quot;)) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
+                        }
+                }
+                
+                if (globals.ssl_cacert_file) {
+                        curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file);
+                }
</ins><span class="cx"> 
</span><span class="cx">                 /* these were used for testing, optionally they may be enabled if someone desires
</span><span class="cx">                    curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
</span><span class="lines">@@ -199,6 +225,14 @@
</span><span class="cx">                                 curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
</span><span class="cx">                                 curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
</span><span class="cx">                         }
</span><ins>+                        
+                        if (globals.enable_cacert_check) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, TRUE);
+                        }
+                        
+                        if (globals.enable_ssl_verifyhost) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
+                        }
</ins><span class="cx"> 
</span><span class="cx">                         curl_easy_perform(curl_handle);
</span><span class="cx">                         curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &amp;httpRes);
</span><span class="lines">@@ -353,10 +387,22 @@
</span><span class="cx">                                                 globals.err_log_dir = switch_mprintf(&quot;%s%s%s&quot;, SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><del>-                        } else if (!strcasecmp(var, &quot;ignore-cacert-check&quot;) &amp;&amp; switch_true(val)) {
-                                globals.ignore_cacert_check = 1;
</del><ins>+                        } else if (!strcasecmp(var, &quot;enable-cacert-check&quot;) &amp;&amp; switch_true(val)) {
+                                globals.enable_cacert_check = 1;
+                        } else if (!strcasecmp(var, &quot;ssl-cert-path&quot;)) {
+                                globals.ssl_cert_file = val;
+                        } else if (!strcasecmp(var, &quot;ssl-key-path&quot;)) {
+                                globals.ssl_key_file = val;
+                        } else if (!strcasecmp(var, &quot;ssl-key-password&quot;)) {
+                                globals.ssl_key_password = val;
+                        } else if (!strcasecmp(var, &quot;ssl-version&quot;)) {
+                                globals.ssl_version = val;
+                        } else if (!strcasecmp(var, &quot;ssl-cacert-file&quot;)) {
+                                globals.ssl_cacert_file = val;
+                        } else if (!strcasecmp(var, &quot;enable-ssl-verifyhost&quot;) &amp;&amp; switch_true(val)) {
+                                globals.enable_ssl_verifyhost = 1;
</ins><span class="cx">                         }
</span><del>-
</del><ins>+                
</ins><span class="cx">                         if (switch_strlen_zero(globals.err_log_dir)) {
</span><span class="cx">                                 if (!switch_strlen_zero(globals.log_dir)) {
</span><span class="cx">                                         globals.err_log_dir = switch_core_strdup(globals.pool, globals.log_dir);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodxml_intmod_xml_curlmod_xml_curlc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c (14207 => 14208)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c        2009-07-13 02:48:08 UTC (rev 14207)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c        2009-07-13 03:08:23 UTC (rev 14208)
</span><span class="lines">@@ -45,7 +45,14 @@
</span><span class="cx">         char *cred;
</span><span class="cx">         int disable100continue;
</span><span class="cx">         int use_get_style;
</span><del>-        uint32_t ignore_cacert_check;
</del><ins>+        uint32_t enable_cacert_check;
+        char *ssl_cert_file;
+        char *ssl_key_file;
+        char *ssl_key_password;
+        char *ssl_version;
+        char *ssl_cacert_file;
+        uint32_t enable_ssl_verifyhost;
+        char *cookie_file;
</ins><span class="cx">         switch_hash_t *vars_map;
</span><span class="cx">         int use_dynamic_url;
</span><span class="cx"> };
</span><span class="lines">@@ -226,9 +233,42 @@
</span><span class="cx">                         curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if (binding-&gt;ignore_cacert_check) {
-                        curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
</del><ins>+                if (binding-&gt;enable_cacert_check) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, TRUE);
</ins><span class="cx">                 }
</span><ins>+        
+                if (binding-&gt;ssl_cert_file) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSLCERT, binding-&gt;ssl_cert_file);
+                }
+                
+                if (binding-&gt;ssl_key_file) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSLKEY, binding-&gt;ssl_key_file);
+                }
+                
+                if (binding-&gt;ssl_key_password) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSLKEYPASSWD, binding-&gt;ssl_key_password);
+                }
+                
+                if (binding-&gt;ssl_version) {
+                        if (!strcasecmp(binding-&gt;ssl_version, &quot;SSLv3&quot;)) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
+                        } else if (!strcasecmp(binding-&gt;ssl_version, &quot;TLSv1&quot;)) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
+                        }
+                }
+                
+                if (binding-&gt;ssl_cacert_file) {
+                        curl_easy_setopt(curl_handle, CURLOPT_CAINFO, binding-&gt;ssl_cacert_file);
+                }
+                
+                if (binding-&gt;enable_ssl_verifyhost) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
+                }
+        
+                if (binding-&gt;cookie_file) {
+                        curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, binding-&gt;cookie_file);
+                        curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, binding-&gt;cookie_file);
+                }
</ins><span class="cx"> 
</span><span class="cx">                 curl_easy_perform(curl_handle);
</span><span class="cx">                 curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &amp;httpRes);
</span><span class="lines">@@ -299,7 +339,14 @@
</span><span class="cx">                 char *method = NULL;
</span><span class="cx">                 int disable100continue = 0;
</span><span class="cx">                 int use_dynamic_url = 0;
</span><del>-                uint32_t ignore_cacert_check = 0;
</del><ins>+                uint32_t enable_cacert_check = 0;
+                char *ssl_cert_file = NULL;
+                char *ssl_key_file = NULL;
+                char *ssl_key_password = NULL;
+                char *ssl_version = NULL;
+                char *ssl_cacert_file = NULL;
+                uint32_t enable_ssl_verifyhost = 0;
+                char *cookie_file = NULL;
</ins><span class="cx">                 hash_node_t* hash_node;
</span><span class="cx">                 need_vars_map = 0;
</span><span class="cx">                 vars_map = NULL;
</span><span class="lines">@@ -318,8 +365,22 @@
</span><span class="cx">                                 disable100continue = 1;
</span><span class="cx">                         } else if (!strcasecmp(var, &quot;method&quot;)) {
</span><span class="cx">                                 method = val;
</span><del>-                        } else if (!strcasecmp(var, &quot;ignore-cacert-check&quot;) &amp;&amp; switch_true(val)) {
-                                ignore_cacert_check = 1;
</del><ins>+                        } else if (!strcasecmp(var, &quot;enable-cacert-check&quot;) &amp;&amp; switch_true(val)) {
+                                enable_cacert_check = 1;
+                        } else if (!strcasecmp(var, &quot;ssl-cert-path&quot;)) {
+                                ssl_cert_file = val;
+                        } else if (!strcasecmp(var, &quot;ssl-key-path&quot;)) {
+                                ssl_key_file = val;
+                        } else if (!strcasecmp(var, &quot;ssl-key-password&quot;)) {
+                                ssl_key_password = val;
+                        } else if (!strcasecmp(var, &quot;ssl-version&quot;)) {
+                                ssl_version = val;
+                        } else if (!strcasecmp(var, &quot;ssl-cacert-file&quot;)) {
+                                ssl_cacert_file = val;
+                        } else if (!strcasecmp(var, &quot;enable-ssl-verifyhost&quot;) &amp;&amp; switch_true(val)) {
+                                enable_ssl_verifyhost = 1;
+                        } else if (!strcasecmp(var, &quot;cookie-file&quot;)) {
+                                cookie_file = val;
</ins><span class="cx">                         } else if (!strcasecmp(var, &quot;use-dynamic-url&quot;) &amp;&amp; switch_true(val)) {
</span><span class="cx">                                 use_dynamic_url = 1;
</span><span class="cx">                         } else if (!strcasecmp(var, &quot;enable-post-var&quot;)) {
</span><span class="lines">@@ -372,7 +433,33 @@
</span><span class="cx">                 binding-&gt;disable100continue = disable100continue;
</span><span class="cx">                 binding-&gt;use_get_style = method != NULL &amp;&amp; strcasecmp(method,&quot;post&quot;) != 0;
</span><span class="cx">                 binding-&gt;use_dynamic_url = use_dynamic_url;
</span><del>-                binding-&gt;ignore_cacert_check = ignore_cacert_check;
</del><ins>+                binding-&gt;enable_cacert_check = enable_cacert_check;
+                
+                if (ssl_cert_file) {
+                        binding-&gt;ssl_cert_file = strdup(ssl_cert_file);
+                }
+                
+                if (ssl_key_file) {
+                        binding-&gt;ssl_key_file = strdup(ssl_key_file);
+                }
+                
+                if (ssl_key_password) {
+                        binding-&gt;ssl_key_password = strdup(ssl_key_password);
+                }
+                
+                if (ssl_version) {
+                        binding-&gt;ssl_version = strdup(ssl_version);
+                }
+                
+                if (ssl_cacert_file) {
+                        binding-&gt;ssl_cacert_file = strdup(ssl_cacert_file);
+                }
+                
+                binding-&gt;enable_ssl_verifyhost = enable_ssl_verifyhost;
+                
+                if (cookie_file) {
+                        binding-&gt;cookie_file = strdup(cookie_file);
+                }
</ins><span class="cx"> 
</span><span class="cx">                 binding-&gt;vars_map = vars_map;
</span><span class="cx">                 
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>