+Sat Nov 30 19:07:52 EET 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Load only files with .pub suffix in PublicKeyDir. Affected
+ file silcd/serverconfig.c.
+
Sat Nov 30 14:29:34 CET 2002 Johnny Mnemonic <johnny@themnemonic.org>
* Extended the SILC_SERVER_LOG_ERROR macro to all available logging
/* errors are not considered fatal */
while ((get_file = readdir(dp))) {
int dirname_len = strlen(dirname);
- char buf[1023];
+ char buf[1024];
const char *filename = get_file->d_name;
struct stat check_file;
- if (!strcmp(filename, ".") || !strcmp(filename, ".."))
+ /* Ignore "." and "..", and take files only with ".pub" suffix. */
+ if (!strcmp(filename, ".") || !strcmp(filename, "..") ||
+ !strstr(filename, ".pub"))
continue;
- snprintf(buf, sizeof(buf) - 2, "%s%s%s", dirname,
+ memset(buf, 0, sizeof(buf));
+ snprintf(buf, sizeof(buf) - 1, "%s%s%s", dirname,
(dirname[dirname_len - 1] == '/' ? "" : "/"), filename);
- buf[sizeof(buf) - 1] = 0;
if (stat(buf, &check_file) < 0) {
SILC_SERVER_LOG_ERROR(("Error stating file %s: %s", buf,
strerror(errno)));
- }
- else if (S_ISREG(check_file.st_mode)) {
+ } else if (S_ISREG(check_file.st_mode)) {
my_parse_authdata(SILC_AUTH_PUBLIC_KEY, buf, auth_data, NULL);
total++;
}