summaryrefslogtreecommitdiff
path: root/ssh-rand-helper.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2007-06-12 16:16:35 +0000
committerColin Watson <cjwatson@debian.org>2007-06-12 16:16:35 +0000
commitb7e40fa9da0b5491534a429dadb321eab5a77558 (patch)
treebed1da11e9f829925797aa093e379fc0b5868ecd /ssh-rand-helper.c
parent4f84beedf1005e44ff33c854abd6b711ffc0adb7 (diff)
parent086ea76990b1e6287c24b6db74adffd4605eb3b0 (diff)
* New upstream release (closes: #395507, #397961, #420035). Important
changes not previously backported to 4.3p2: - 4.4/4.4p1 (http://www.openssh.org/txt/release-4.4): + On portable OpenSSH, fix a GSSAPI authentication abort that could be used to determine the validity of usernames on some platforms. + Implemented conditional configuration in sshd_config(5) using the "Match" directive. This allows some configuration options to be selectively overridden if specific criteria (based on user, group, hostname and/or address) are met. So far a useful subset of post-authentication options are supported and more are expected to be added in future releases. + Add support for Diffie-Hellman group exchange key agreement with a final hash of SHA256. + Added a "ForceCommand" directive to sshd_config(5). Similar to the command="..." option accepted in ~/.ssh/authorized_keys, this forces the execution of the specified command regardless of what the user requested. This is very useful in conjunction with the new "Match" option. + Add a "PermitOpen" directive to sshd_config(5). This mirrors the permitopen="..." authorized_keys option, allowing fine-grained control over the port-forwardings that a user is allowed to establish. + Add optional logging of transactions to sftp-server(8). + ssh(1) will now record port numbers for hosts stored in ~/.ssh/known_hosts when a non-standard port has been requested (closes: #50612). + Add an "ExitOnForwardFailure" option to cause ssh(1) to exit (with a non-zero exit code) when requested port forwardings could not be established. + Extend sshd_config(5) "SubSystem" declarations to allow the specification of command-line arguments. + Replacement of all integer overflow susceptible invocations of malloc(3) and realloc(3) with overflow-checking equivalents. + Many manpage fixes and improvements. + Add optional support for OpenSSL hardware accelerators (engines), enabled using the --with-ssl-engine configure option. + Tokens in configuration files may be double-quoted in order to contain spaces (closes: #319639). + Move a debug() call out of a SIGCHLD handler, fixing a hang when the session exits very quickly (closes: #307890). + Fix some incorrect buffer allocation calculations (closes: #410599). + ssh-add doesn't ask for a passphrase if key file permissions are too liberal (closes: #103677). + Likewise, ssh doesn't ask either (closes: #99675). - 4.6/4.6p1 (http://www.openssh.org/txt/release-4.6): + sshd now allows the enabling and disabling of authentication methods on a per user, group, host and network basis via the Match directive in sshd_config. + Fixed an inconsistent check for a terminal when displaying scp progress meter (closes: #257524). + Fix "hang on exit" when background processes are running at the time of exit on a ttyful/login session (closes: #88337). * Update to current GSSAPI patch from http://www.sxw.org.uk/computing/patches/openssh-4.6p1-gsskex-20070312.patch; install ChangeLog.gssapi.
Diffstat (limited to 'ssh-rand-helper.c')
-rw-r--r--ssh-rand-helper.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/ssh-rand-helper.c b/ssh-rand-helper.c
index 87e52cf75..8520c3a62 100644
--- a/ssh-rand-helper.c
+++ b/ssh-rand-helper.c
@@ -24,6 +24,29 @@
24 24
25#include "includes.h" 25#include "includes.h"
26 26
27#include <sys/types.h>
28#include <sys/resource.h>
29#include <sys/stat.h>
30#include <sys/wait.h>
31#include <sys/socket.h>
32
33#include <stdarg.h>
34#include <stddef.h>
35
36#include <netinet/in.h>
37#include <arpa/inet.h>
38
39#ifdef HAVE_SYS_UN_H
40# include <sys/un.h>
41#endif
42
43#include <errno.h>
44#include <fcntl.h>
45#include <pwd.h>
46#include <signal.h>
47#include <time.h>
48#include <unistd.h>
49
27#include <openssl/rand.h> 50#include <openssl/rand.h>
28#include <openssl/sha.h> 51#include <openssl/sha.h>
29#include <openssl/crypto.h> 52#include <openssl/crypto.h>
@@ -39,8 +62,6 @@
39#include "pathnames.h" 62#include "pathnames.h"
40#include "log.h" 63#include "log.h"
41 64
42RCSID("$Id: ssh-rand-helper.c,v 1.26 2005/07/17 07:26:44 djm Exp $");
43
44/* Number of bytes we write out */ 65/* Number of bytes we write out */
45#define OUTPUT_SEED_SIZE 48 66#define OUTPUT_SEED_SIZE 48
46 67
@@ -564,7 +585,8 @@ prng_write_seedfile(void)
564 /* Try to ensure that the parent directory is there */ 585 /* Try to ensure that the parent directory is there */
565 snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir, 586 snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir,
566 _PATH_SSH_USER_DIR); 587 _PATH_SSH_USER_DIR);
567 mkdir(filename, 0700); 588 if (mkdir(filename, 0700) < 0 && errno != EEXIST)
589 fatal("mkdir %.200s: %s", filename, strerror(errno));
568 590
569 snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir, 591 snprintf(filename, sizeof(filename), "%.512s/%s", pw->pw_dir,
570 SSH_PRNG_SEED_FILE); 592 SSH_PRNG_SEED_FILE);
@@ -665,8 +687,7 @@ prng_read_commands(char *cmdfilename)
665 } 687 }
666 688
667 num_cmds = 64; 689 num_cmds = 64;
668 entcmd = xmalloc(num_cmds * sizeof(entropy_cmd_t)); 690 entcmd = xcalloc(num_cmds, sizeof(entropy_cmd_t));
669 memset(entcmd, '\0', num_cmds * sizeof(entropy_cmd_t));
670 691
671 /* Read in file */ 692 /* Read in file */
672 cur_cmd = linenum = 0; 693 cur_cmd = linenum = 0;
@@ -759,7 +780,7 @@ prng_read_commands(char *cmdfilename)
759 */ 780 */
760 if (cur_cmd == num_cmds) { 781 if (cur_cmd == num_cmds) {
761 num_cmds *= 2; 782 num_cmds *= 2;
762 entcmd = xrealloc(entcmd, num_cmds * 783 entcmd = xrealloc(entcmd, num_cmds,
763 sizeof(entropy_cmd_t)); 784 sizeof(entropy_cmd_t));
764 } 785 }
765 } 786 }
@@ -768,12 +789,13 @@ prng_read_commands(char *cmdfilename)
768 memset(&entcmd[cur_cmd], '\0', sizeof(entropy_cmd_t)); 789 memset(&entcmd[cur_cmd], '\0', sizeof(entropy_cmd_t));
769 790
770 /* trim to size */ 791 /* trim to size */
771 entropy_cmds = xrealloc(entcmd, (cur_cmd + 1) * 792 entropy_cmds = xrealloc(entcmd, (cur_cmd + 1),
772 sizeof(entropy_cmd_t)); 793 sizeof(entropy_cmd_t));
773 794
774 debug("Loaded %d entropy commands from %.100s", cur_cmd, 795 debug("Loaded %d entropy commands from %.100s", cur_cmd,
775 cmdfilename); 796 cmdfilename);
776 797
798 fclose(f);
777 return cur_cmd < MIN_ENTROPY_SOURCES ? -1 : 0; 799 return cur_cmd < MIN_ENTROPY_SOURCES ? -1 : 0;
778} 800}
779 801