summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-closefrom.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 /openbsd-compat/bsd-closefrom.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 'openbsd-compat/bsd-closefrom.c')
-rw-r--r--openbsd-compat/bsd-closefrom.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/openbsd-compat/bsd-closefrom.c b/openbsd-compat/bsd-closefrom.c
index 5b7b94ae4..9380b33a7 100644
--- a/openbsd-compat/bsd-closefrom.c
+++ b/openbsd-compat/bsd-closefrom.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2004 Todd C. Miller <Todd.Miller@courtesan.com> 2 * Copyright (c) 2004-2005 Todd C. Miller <Todd.Miller@courtesan.com>
3 * 3 *
4 * Permission to use, copy, modify, and distribute this software for any 4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above 5 * purpose with or without fee is hereby granted, provided that the above
@@ -22,9 +22,14 @@
22#include <sys/param.h> 22#include <sys/param.h>
23#include <unistd.h> 23#include <unistd.h>
24#include <stdio.h> 24#include <stdio.h>
25#ifdef HAVE_FCNTL_H
26# include <fcntl.h>
27#endif
25#include <limits.h> 28#include <limits.h>
26#include <stdlib.h> 29#include <stdlib.h>
27#include <stddef.h> 30#include <stddef.h>
31#include <string.h>
32#include <unistd.h>
28#ifdef HAVE_DIRENT_H 33#ifdef HAVE_DIRENT_H
29# include <dirent.h> 34# include <dirent.h>
30# define NAMLEN(dirent) strlen((dirent)->d_name) 35# define NAMLEN(dirent) strlen((dirent)->d_name)
@@ -46,15 +51,20 @@
46# define OPEN_MAX 256 51# define OPEN_MAX 256
47#endif 52#endif
48 53
49RCSID("$Id: bsd-closefrom.c,v 1.2 2005/11/10 08:29:13 dtucker Exp $"); 54#if 0
50 55__unused static const char rcsid[] = "$Sudo: closefrom.c,v 1.11 2006/08/17 15:26:54 millert Exp $";
51#ifndef lint
52static const char sudorcsid[] = "$Sudo: closefrom.c,v 1.6 2004/06/01 20:51:56 millert Exp $";
53#endif /* lint */ 56#endif /* lint */
54 57
55/* 58/*
56 * Close all file descriptors greater than or equal to lowfd. 59 * Close all file descriptors greater than or equal to lowfd.
57 */ 60 */
61#ifdef HAVE_FCNTL_CLOSEM
62void
63closefrom(int lowfd)
64{
65 (void) fcntl(lowfd, F_CLOSEM, 0);
66}
67#else
58void 68void
59closefrom(int lowfd) 69closefrom(int lowfd)
60{ 70{
@@ -67,7 +77,7 @@ closefrom(int lowfd)
67 77
68 /* Check for a /proc/$$/fd directory. */ 78 /* Check for a /proc/$$/fd directory. */
69 len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid()); 79 len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
70 if (len >= 0 && (u_int)len <= sizeof(fdpath) && (dirp = opendir(fdpath))) { 80 if (len > 0 && (size_t)len <= sizeof(fdpath) && (dirp = opendir(fdpath))) {
71 while ((dent = readdir(dirp)) != NULL) { 81 while ((dent = readdir(dirp)) != NULL) {
72 fd = strtol(dent->d_name, &endp, 10); 82 fd = strtol(dent->d_name, &endp, 10);
73 if (dent->d_name != endp && *endp == '\0' && 83 if (dent->d_name != endp && *endp == '\0' &&
@@ -95,6 +105,5 @@ closefrom(int lowfd)
95 (void) close((int) fd); 105 (void) close((int) fd);
96 } 106 }
97} 107}
98 108#endif /* !HAVE_FCNTL_CLOSEM */
99#endif /* HAVE_CLOSEFROM */ 109#endif /* HAVE_CLOSEFROM */
100