[Asterisk-code-review] crypto: Don't load non-regular files in keys directory (asterisk[master])

Philip Prindeville asteriskteam at digium.com
Fri May 6 11:34:17 CDT 2022


Philip Prindeville has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18533 )


Change subject: crypto: Don't load non-regular files in keys directory
......................................................................

crypto: Don't load non-regular files in keys directory

ASTERISK-30046

Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
Change-Id: Ie77e0648f8b0b1c2159fb24662d1989cfd4cc36d
---
M res/res_crypto.c
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/33/18533/1

diff --git a/res/res_crypto.c b/res/res_crypto.c
index 462a71a..5645458 100644
--- a/res/res_crypto.c
+++ b/res/res_crypto.c
@@ -272,7 +272,7 @@
 			ast_log(LOG_NOTICE, "Key '%s' is not expected size.\n", key->name);
 		}
 	} else if (key->infd != -2) {
-		ast_log(LOG_WARNING, "Key load %s '%s' failed\n",key->ktype == AST_KEY_PUBLIC ? "PUBLIC" : "PRIVATE", key->name);
+		ast_log(LOG_WARNING, "Key load %s '%s' failed\n", key->ktype == AST_KEY_PUBLIC ? "PUBLIC" : "PRIVATE", key->name);
 		if (ofd > -1) {
 			ERR_print_errors_fp(stderr);
 		} else {
@@ -515,6 +515,8 @@
 	/* Load new keys */
 	if ((dir = opendir(ast_config_AST_KEY_DIR))) {
 		while ((ent = readdir(dir))) {
+			if (ent->d_type != DT_REG)
+				continue;
 			try_load_key(ast_config_AST_KEY_DIR, ent->d_name, ifd, ofd, &note);
 		}
 		closedir(dir);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18533
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ie77e0648f8b0b1c2159fb24662d1989cfd4cc36d
Gerrit-Change-Number: 18533
Gerrit-PatchSet: 1
Gerrit-Owner: Philip Prindeville <philipp at redfish-solutions.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220506/61d02e61/attachment.html>


More information about the asterisk-code-review mailing list