<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18533">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_crypto: Don't load non-regular files in keys directory<br><br>ASTERISK-30046<br><br>Change-Id: Ie77e0648f8b0b1c2159fb24662d1989cfd4cc36d<br>---<br>A doc/UPGRADE-staging/res_crypto-regular-file-keys.txt<br>M res/res_crypto.c<br>2 files changed, 24 insertions(+), 1 deletion(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/doc/UPGRADE-staging/res_crypto-regular-file-keys.txt b/doc/UPGRADE-staging/res_crypto-regular-file-keys.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..a2d8d81</span><br><span>--- /dev/null</span><br><span>+++ b/doc/UPGRADE-staging/res_crypto-regular-file-keys.txt</span><br><span>@@ -0,0 +1,5 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: res_crypto</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+In addition to only paying attention to files ending with .key or .pub</span><br><span style="color: hsl(120, 100%, 40%);">+in the keys directory, we now also ignore any files which aren't regular</span><br><span style="color: hsl(120, 100%, 40%);">+files.</span><br><span>diff --git a/res/res_crypto.c b/res/res_crypto.c</span><br><span>index a11182b..71cc979 100644</span><br><span>--- a/res/res_crypto.c</span><br><span>+++ b/res/res_crypto.c</span><br><span>@@ -270,7 +270,7 @@</span><br><span>                    ast_log(LOG_NOTICE, "Key '%s' is not expected size.\n", key->name);</span><br><span>             }</span><br><span>    } else if (key->infd != -2) {</span><br><span style="color: hsl(0, 100%, 40%);">-                ast_log(LOG_WARNING, "Key load %s '%s' failed\n",key->ktype == AST_KEY_PUBLIC ? "PUBLIC" : "PRIVATE", key->name);</span><br><span style="color: hsl(120, 100%, 40%);">+         ast_log(LOG_WARNING, "Key load %s '%s' failed\n", key->ktype == AST_KEY_PUBLIC ? "PUBLIC" : "PRIVATE", key->name);</span><br><span>               if (ofd > -1) {</span><br><span>                   ERR_print_errors_fp(stderr);</span><br><span>                 } else {</span><br><span>@@ -507,6 +507,13 @@</span><br><span>      /* Load new keys */</span><br><span>  if ((dir = opendir(ast_config_AST_KEY_DIR))) {</span><br><span>               while ((ent = readdir(dir))) {</span><br><span style="color: hsl(120, 100%, 40%);">+                        if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")) {</span><br><span style="color: hsl(120, 100%, 40%);">+                              continue;</span><br><span style="color: hsl(120, 100%, 40%);">+                     }</span><br><span style="color: hsl(120, 100%, 40%);">+                     if (ent->d_type != DT_REG) {</span><br><span style="color: hsl(120, 100%, 40%);">+                               ast_log(LOG_WARNING, "Non-regular file '%s' in keys directory\n", ent->d_name);</span><br><span style="color: hsl(120, 100%, 40%);">+                          continue;</span><br><span style="color: hsl(120, 100%, 40%);">+                     }</span><br><span>                    try_load_key(ast_config_AST_KEY_DIR, ent->d_name, ifd, ofd, &note);</span><br><span>           }</span><br><span>            closedir(dir);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18533">change 18533</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18533"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ie77e0648f8b0b1c2159fb24662d1989cfd4cc36d </div>
<div style="display:none"> Gerrit-Change-Number: 18533 </div>
<div style="display:none"> Gerrit-PatchSet: 18 </div>
<div style="display:none"> Gerrit-Owner: Philip Prindeville <philipp@redfish-solutions.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <default.enum@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>