зеркало из https://github.com/Azure/sonic-openssh.git
- markus@cvs.openbsd.org 2001/06/03 14:55:39
[channels.c channels.h session.c] use fatal_register_cleanup instead of atexit, sync with x11 authdir handling
This commit is contained in:
Родитель
c4b7225b8d
Коммит
838394ca26
|
@ -20,6 +20,10 @@
|
|||
- markus@cvs.openbsd.org 2001/05/31 13:08:04
|
||||
[sshd_config]
|
||||
group options and add some more comments
|
||||
- markus@cvs.openbsd.org 2001/06/03 14:55:39
|
||||
[channels.c channels.h session.c]
|
||||
use fatal_register_cleanup instead of atexit, sync with x11 authdir
|
||||
handling
|
||||
|
||||
20010606
|
||||
- OpenBSD CVS Sync
|
||||
|
@ -5531,4 +5535,4 @@
|
|||
- Wrote replacements for strlcpy and mkdtemp
|
||||
- Released 1.0pre1
|
||||
|
||||
$Id: ChangeLog,v 1.1253 2001/06/09 01:09:51 mouring Exp $
|
||||
$Id: ChangeLog,v 1.1254 2001/06/09 01:11:59 mouring Exp $
|
||||
|
|
20
channels.c
20
channels.c
|
@ -40,7 +40,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: channels.c,v 1.121 2001/05/31 10:30:14 markus Exp $");
|
||||
RCSID("$OpenBSD: channels.c,v 1.122 2001/06/03 14:55:38 markus Exp $");
|
||||
|
||||
#include "ssh.h"
|
||||
#include "ssh1.h"
|
||||
|
@ -2777,10 +2777,13 @@ auth_get_socket_name()
|
|||
/* removes the agent forwarding socket */
|
||||
|
||||
void
|
||||
cleanup_socket(void)
|
||||
auth_sock_cleanup_proc(void *ignored)
|
||||
{
|
||||
unlink(auth_sock_name);
|
||||
rmdir(auth_sock_dir);
|
||||
if (auth_sock_name) {
|
||||
unlink(auth_sock_name);
|
||||
rmdir(auth_sock_dir);
|
||||
auth_sock_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2822,11 +2825,9 @@ auth_input_request_forwarding(struct passwd * pw)
|
|||
snprintf(auth_sock_name, MAXPATHLEN, "%s/agent.%d",
|
||||
auth_sock_dir, (int) getpid());
|
||||
|
||||
if (atexit(cleanup_socket) < 0) {
|
||||
int saved = errno;
|
||||
cleanup_socket();
|
||||
packet_disconnect("socket: %.100s", strerror(saved));
|
||||
}
|
||||
/* delete agent socket on fatal() */
|
||||
fatal_add_cleanup(auth_sock_cleanup_proc, NULL);
|
||||
|
||||
/* Create the socket. */
|
||||
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (sock < 0)
|
||||
|
@ -2855,6 +2856,7 @@ auth_input_request_forwarding(struct passwd * pw)
|
|||
0, xstrdup("auth socket"), 1);
|
||||
if (nc == NULL) {
|
||||
error("auth_input_request_forwarding: channel_new failed");
|
||||
auth_sock_cleanup_proc(NULL);
|
||||
close(sock);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* RCSID("$OpenBSD: channels.h,v 1.35 2001/05/31 10:30:15 markus Exp $"); */
|
||||
/* RCSID("$OpenBSD: channels.h,v 1.36 2001/06/03 14:55:39 markus Exp $"); */
|
||||
|
||||
#ifndef CHANNEL_H
|
||||
#define CHANNEL_H
|
||||
|
@ -223,6 +223,7 @@ void deny_input_open(int type, int plen, void *ctxt);
|
|||
|
||||
void auth_request_forwarding(void);
|
||||
char *auth_get_socket_name(void);
|
||||
void auth_sock_cleanup_proc(void *ignored);
|
||||
int auth_input_request_forwarding(struct passwd * pw);
|
||||
void auth_input_open_request(int type, int plen, void *ctxt);
|
||||
|
||||
|
|
14
session.c
14
session.c
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: session.c,v 1.78 2001/05/31 10:30:16 markus Exp $");
|
||||
RCSID("$OpenBSD: session.c,v 1.79 2001/06/03 14:55:39 markus Exp $");
|
||||
|
||||
#include "ssh.h"
|
||||
#include "ssh1.h"
|
||||
|
@ -132,6 +132,7 @@ void do_pre_login(Session *s);
|
|||
void do_child(Session *s, const char *command);
|
||||
void do_motd(void);
|
||||
int check_quietlogin(Session *s, const char *command);
|
||||
void xauthfile_cleanup_proc(void *ignore);
|
||||
|
||||
void do_authenticated1(Authctxt *authctxt);
|
||||
void do_authenticated2(Authctxt *authctxt);
|
||||
|
@ -196,6 +197,12 @@ do_authenticated(Authctxt *authctxt)
|
|||
do_authenticated2(authctxt);
|
||||
else
|
||||
do_authenticated1(authctxt);
|
||||
|
||||
/* remote user's local Xauthority file and agent socket */
|
||||
if (xauthfile)
|
||||
xauthfile_cleanup_proc(NULL);
|
||||
if (auth_get_socket_name())
|
||||
auth_sock_cleanup_proc(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -446,9 +453,6 @@ do_authenticated1(Authctxt *authctxt)
|
|||
|
||||
if (command != NULL)
|
||||
xfree(command);
|
||||
/* Cleanup user's local Xauthority file. */
|
||||
if (xauthfile)
|
||||
xauthfile_cleanup_proc(NULL);
|
||||
return;
|
||||
|
||||
default:
|
||||
|
@ -2105,6 +2109,4 @@ do_authenticated2(Authctxt *authctxt)
|
|||
{
|
||||
|
||||
server_loop2();
|
||||
if (xauthfile)
|
||||
xauthfile_cleanup_proc(NULL);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче