diff options
author | Colin Watson <cjwatson@debian.org> | 2007-06-12 16:16:35 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2007-06-12 16:16:35 +0000 |
commit | b7e40fa9da0b5491534a429dadb321eab5a77558 (patch) | |
tree | bed1da11e9f829925797aa093e379fc0b5868ecd /uidswap.c | |
parent | 4f84beedf1005e44ff33c854abd6b711ffc0adb7 (diff) | |
parent | 086ea76990b1e6287c24b6db74adffd4605eb3b0 (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 'uidswap.c')
-rw-r--r-- | uidswap.c | 52 |
1 files changed, 49 insertions, 3 deletions
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: uidswap.c,v 1.35 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -12,7 +13,15 @@ | |||
12 | */ | 13 | */ |
13 | 14 | ||
14 | #include "includes.h" | 15 | #include "includes.h" |
15 | RCSID("$OpenBSD: uidswap.c,v 1.24 2003/05/29 16:58:45 deraadt Exp $"); | 16 | |
17 | #include <sys/param.h> | ||
18 | #include <errno.h> | ||
19 | #include <pwd.h> | ||
20 | #include <string.h> | ||
21 | #include <unistd.h> | ||
22 | #include <stdarg.h> | ||
23 | |||
24 | #include <grp.h> | ||
16 | 25 | ||
17 | #include "log.h" | 26 | #include "log.h" |
18 | #include "uidswap.h" | 27 | #include "uidswap.h" |
@@ -77,7 +86,7 @@ temporarily_use_uid(struct passwd *pw) | |||
77 | fatal("getgroups: %.100s", strerror(errno)); | 86 | fatal("getgroups: %.100s", strerror(errno)); |
78 | if (saved_egroupslen > 0) { | 87 | if (saved_egroupslen > 0) { |
79 | saved_egroups = xrealloc(saved_egroups, | 88 | saved_egroups = xrealloc(saved_egroups, |
80 | saved_egroupslen * sizeof(gid_t)); | 89 | saved_egroupslen, sizeof(gid_t)); |
81 | if (getgroups(saved_egroupslen, saved_egroups) < 0) | 90 | if (getgroups(saved_egroupslen, saved_egroups) < 0) |
82 | fatal("getgroups: %.100s", strerror(errno)); | 91 | fatal("getgroups: %.100s", strerror(errno)); |
83 | } else { /* saved_egroupslen == 0 */ | 92 | } else { /* saved_egroupslen == 0 */ |
@@ -96,7 +105,7 @@ temporarily_use_uid(struct passwd *pw) | |||
96 | fatal("getgroups: %.100s", strerror(errno)); | 105 | fatal("getgroups: %.100s", strerror(errno)); |
97 | if (user_groupslen > 0) { | 106 | if (user_groupslen > 0) { |
98 | user_groups = xrealloc(user_groups, | 107 | user_groups = xrealloc(user_groups, |
99 | user_groupslen * sizeof(gid_t)); | 108 | user_groupslen, sizeof(gid_t)); |
100 | if (getgroups(user_groupslen, user_groups) < 0) | 109 | if (getgroups(user_groupslen, user_groups) < 0) |
101 | fatal("getgroups: %.100s", strerror(errno)); | 110 | fatal("getgroups: %.100s", strerror(errno)); |
102 | } else { /* user_groupslen == 0 */ | 111 | } else { /* user_groupslen == 0 */ |
@@ -123,6 +132,41 @@ temporarily_use_uid(struct passwd *pw) | |||
123 | strerror(errno)); | 132 | strerror(errno)); |
124 | } | 133 | } |
125 | 134 | ||
135 | void | ||
136 | permanently_drop_suid(uid_t uid) | ||
137 | { | ||
138 | uid_t old_uid = getuid(); | ||
139 | |||
140 | debug("permanently_drop_suid: %u", (u_int)uid); | ||
141 | #if defined(HAVE_SETRESUID) && !defined(BROKEN_SETRESUID) | ||
142 | if (setresuid(uid, uid, uid) < 0) | ||
143 | fatal("setresuid %u: %.100s", (u_int)uid, strerror(errno)); | ||
144 | #elif defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID) | ||
145 | if (setreuid(uid, uid) < 0) | ||
146 | fatal("setreuid %u: %.100s", (u_int)uid, strerror(errno)); | ||
147 | #else | ||
148 | # ifndef SETEUID_BREAKS_SETUID | ||
149 | if (seteuid(uid) < 0) | ||
150 | fatal("seteuid %u: %.100s", (u_int)uid, strerror(errno)); | ||
151 | # endif | ||
152 | if (setuid(uid) < 0) | ||
153 | fatal("setuid %u: %.100s", (u_int)uid, strerror(errno)); | ||
154 | #endif | ||
155 | |||
156 | #ifndef HAVE_CYGWIN | ||
157 | /* Try restoration of UID if changed (test clearing of saved uid) */ | ||
158 | if (old_uid != uid && | ||
159 | (setuid(old_uid) != -1 || seteuid(old_uid) != -1)) | ||
160 | fatal("%s: was able to restore old [e]uid", __func__); | ||
161 | #endif | ||
162 | |||
163 | /* Verify UID drop was successful */ | ||
164 | if (getuid() != uid || geteuid() != uid) { | ||
165 | fatal("%s: euid incorrect uid:%u euid:%u (should be %u)", | ||
166 | __func__, (u_int)getuid(), (u_int)geteuid(), (u_int)uid); | ||
167 | } | ||
168 | } | ||
169 | |||
126 | /* | 170 | /* |
127 | * Restores to the original (privileged) uid. | 171 | * Restores to the original (privileged) uid. |
128 | */ | 172 | */ |
@@ -169,6 +213,8 @@ permanently_set_uid(struct passwd *pw) | |||
169 | uid_t old_uid = getuid(); | 213 | uid_t old_uid = getuid(); |
170 | gid_t old_gid = getgid(); | 214 | gid_t old_gid = getgid(); |
171 | 215 | ||
216 | if (pw == NULL) | ||
217 | fatal("permanently_set_uid: no user given"); | ||
172 | if (temporarily_use_uid_effective) | 218 | if (temporarily_use_uid_effective) |
173 | fatal("permanently_set_uid: temporarily_use_uid effective"); | 219 | fatal("permanently_set_uid: temporarily_use_uid effective"); |
174 | debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid, | 220 | debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid, |