#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/wait.h>
+#include <sys/socket.h>
+#include <stddef.h>
+
+#include <netinet/in.h>
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
+#include <errno.h>
+#include <fcntl.h>
+#include <pwd.h>
#include <signal.h>
+#include <time.h>
+#include <unistd.h>
#include <openssl/rand.h>
#include <openssl/sha.h>
/* Try to ensure that the parent directory is there */
snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir,
_PATH_SSH_USER_DIR);
- mkdir(filename, 0700);
+ if (mkdir(filename, 0700) < 0 && errno != EEXIST)
+ fatal("mkdir %.200s: %s", filename, strerror(errno));
snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir,
SSH_PRNG_SEED_FILE);
}
num_cmds = 64;
- entcmd = xmalloc(num_cmds * sizeof(entropy_cmd_t));
- memset(entcmd, '\0', num_cmds * sizeof(entropy_cmd_t));
+ entcmd = xcalloc(num_cmds, sizeof(entropy_cmd_t));
/* Read in file */
cur_cmd = linenum = 0;
debug("Loaded %d entropy commands from %.100s", cur_cmd,
cmdfilename);
+ fclose(f);
return cur_cmd < MIN_ENTROPY_SOURCES ? -1 : 0;
}