Blame pam_ssh_agent_auth-0.9.2-seteuid.patch
|
Jan F |
bb5eb0 |
diff -up pam_ssh_agent_auth-0.9.2/iterate_ssh_agent_keys.c.seteuid pam_ssh_agent_auth-0.9.2/iterate_ssh_agent_keys.c
|
|
Jan F |
bb5eb0 |
--- pam_ssh_agent_auth-0.9.2/iterate_ssh_agent_keys.c.seteuid 2010-09-08 08:54:29.000000000 +0200
|
|
Jan F |
bb5eb0 |
+++ pam_ssh_agent_auth-0.9.2/iterate_ssh_agent_keys.c 2010-11-22 08:38:05.000000000 +0100
|
|
Jan F |
bb5eb0 |
@@ -131,13 +131,18 @@ ssh_get_authentication_socket_for_uid(ui
|
|
Jan F |
bb5eb0 |
}
|
|
Jan F |
bb5eb0 |
|
|
Jan F |
bb5eb0 |
errno = 0;
|
|
Jan F |
bb5eb0 |
- seteuid(uid); /* To ensure a race condition is not used to circumvent the stat
|
|
Jan F |
bb5eb0 |
- above, we will temporarily drop UID to the caller */
|
|
Jan F |
bb5eb0 |
+ /* To ensure a race condition is not used to circumvent the stat
|
|
Jan F |
bb5eb0 |
+ above, we will temporarily drop UID to the caller */
|
|
Jan F |
bb5eb0 |
+ if (seteuid(uid) == -1) {
|
|
Jan F |
bb5eb0 |
+ close(sock);
|
|
Jan F |
bb5eb0 |
+ error("seteuid(%lu) failed", (unsigned long) uid);
|
|
Jan F |
bb5eb0 |
+ return -1;
|
|
Jan F |
bb5eb0 |
+ }
|
|
Jan F |
bb5eb0 |
if (connect(sock, (struct sockaddr *)&sunaddr, sizeof sunaddr) < 0) {
|
|
Jan F |
bb5eb0 |
close(sock);
|
|
Jan F |
bb5eb0 |
- if(errno == EACCES)
|
|
Jan F |
bb5eb0 |
- fatal("MAJOR SECURITY WARNING: uid %lu made a deliberate and malicious attempt to open an agent socket owned by another user", (unsigned long) uid);
|
|
Jan F |
bb5eb0 |
- return -1;
|
|
Jan F |
bb5eb0 |
+ sock = -1;
|
|
Jan F |
bb5eb0 |
+ if(errno == EACCES)
|
|
Jan F |
bb5eb0 |
+ fatal("MAJOR SECURITY WARNING: uid %lu made a deliberate and malicious attempt to open an agent socket owned by another user", (unsigned long) uid);
|
|
Jan F |
bb5eb0 |
}
|
|
Jan F |
bb5eb0 |
|
|
Jan F |
bb5eb0 |
seteuid(0); /* we now continue the regularly scheduled programming */
|