<p>Philip Prindeville has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19116">View Change</a></p><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, 25 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/16/19116/1</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..d0225a8</span><br><span>--- /dev/null</span><br><span>+++ b/doc/UPGRADE-staging/res_crypto-regular-file-keys.txt</span><br><span>@@ -0,0 +1,6 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: res_crypto</span><br><span style="color: hsl(120, 100%, 40%);">+Master-Only: True</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, ¬e);</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/+/19116">change 19116</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/+/19116"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 19 </div>
<div style="display:none"> Gerrit-Change-Id: Ie77e0648f8b0b1c2159fb24662d1989cfd4cc36d </div>
<div style="display:none"> Gerrit-Change-Number: 19116 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Philip Prindeville <philipp@redfish-solutions.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>