summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2005-02-02 17:10:11 +1100
committerDarren Tucker <dtucker@zip.com.au>2005-02-02 17:10:11 +1100
commit42d9dc75ed2eefa6eeffc892f02eb164c1860603 (patch)
treec10968f34ae3610ac1630718b2b2c967d5a448aa
parentad7646a59ab05ed9d6c156ba952725f44c02de7d (diff)
- (dtucker) [auth.c loginrec.h openbsd-compat/{bsd-cray,port-aix}.{c,h}]
Make record_failed_login() call provide hostname rather than having the implementations having to do lookups themselves. Only affects AIX and UNICOS (the latter only uses the "user" parameter anyway). ok djm@
-rw-r--r--ChangeLog6
-rw-r--r--auth.c7
-rw-r--r--loginrec.h4
-rw-r--r--openbsd-compat/bsd-cray.c4
-rw-r--r--openbsd-compat/bsd-cray.h6
-rw-r--r--openbsd-compat/port-aix.c7
-rw-r--r--openbsd-compat/port-aix.h3
7 files changed, 20 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index eb897ec41..82758ca10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
120050202 120050202
2 - (dtucker) [configure.ac openbsd-compat/realpath.c] Sync up with realpath 2 - (dtucker) [configure.ac openbsd-compat/realpath.c] Sync up with realpath
3 rev 1.11 from OpenBSD and make it use fchdir if available. ok djm@ 3 rev 1.11 from OpenBSD and make it use fchdir if available. ok djm@
4 - (dtucker) [auth.c loginrec.h openbsd-compat/{bsd-cray,port-aix}.{c,h}]
5 Make record_failed_login() call provide hostname rather than having the
6 implementations having to do lookups themselves. Only affects AIX and
7 UNICOS (the latter only uses the "user" parameter anyway). ok djm@
4 8
520050201 920050201
6 - (dtucker) [log.c] Bug #973: force log_init() to open syslog, since on some 10 - (dtucker) [log.c] Bug #973: force log_init() to open syslog, since on some
@@ -2055,4 +2059,4 @@
2055 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 2059 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
2056 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 2060 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
2057 2061
2058$Id: ChangeLog,v 1.3629 2005/02/01 23:43:59 dtucker Exp $ 2062$Id: ChangeLog,v 1.3630 2005/02/02 06:10:11 dtucker Exp $
diff --git a/auth.c b/auth.c
index 4698e3990..dfc1be374 100644
--- a/auth.c
+++ b/auth.c
@@ -50,6 +50,7 @@ RCSID("$OpenBSD: auth.c,v 1.57 2005/01/22 08:17:59 dtucker Exp $");
50#include "misc.h" 50#include "misc.h"
51#include "bufaux.h" 51#include "bufaux.h"
52#include "packet.h" 52#include "packet.h"
53#include "loginrec.h"
53 54
54/* import */ 55/* import */
55extern ServerOptions options; 56extern ServerOptions options;
@@ -244,7 +245,8 @@ auth_log(Authctxt *authctxt, int authenticated, char *method, char *info)
244 245
245#ifdef CUSTOM_FAILED_LOGIN 246#ifdef CUSTOM_FAILED_LOGIN
246 if (authenticated == 0 && strcmp(method, "password") == 0) 247 if (authenticated == 0 && strcmp(method, "password") == 0)
247 record_failed_login(authctxt->user, "ssh"); 248 record_failed_login(authctxt->user,
249 get_canonical_hostname(options.use_dns), "ssh");
248#endif 250#endif
249} 251}
250 252
@@ -468,7 +470,8 @@ getpwnamallow(const char *user)
468 logit("Invalid user %.100s from %.100s", 470 logit("Invalid user %.100s from %.100s",
469 user, get_remote_ipaddr()); 471 user, get_remote_ipaddr());
470#ifdef CUSTOM_FAILED_LOGIN 472#ifdef CUSTOM_FAILED_LOGIN
471 record_failed_login(user, "ssh"); 473 record_failed_login(user,
474 get_canonical_hostname(options.use_dns), "ssh");
472#endif 475#endif
473 return (NULL); 476 return (NULL);
474 } 477 }
diff --git a/loginrec.h b/loginrec.h
index 6b7233256..d1a12a853 100644
--- a/loginrec.h
+++ b/loginrec.h
@@ -35,7 +35,7 @@
35#include <netinet/in.h> 35#include <netinet/in.h>
36#include <sys/socket.h> 36#include <sys/socket.h>
37 37
38/* RCSID("$Id: loginrec.h,v 1.8 2005/01/20 11:07:30 dtucker Exp $"); */ 38/* RCSID("$Id: loginrec.h,v 1.9 2005/02/02 06:10:11 dtucker Exp $"); */
39 39
40/** 40/**
41 ** you should use the login_* calls to work around platform dependencies 41 ** you should use the login_* calls to work around platform dependencies
@@ -132,4 +132,6 @@ char *line_fullname(char *dst, const char *src, int dstsize);
132char *line_stripname(char *dst, const char *src, int dstsize); 132char *line_stripname(char *dst, const char *src, int dstsize);
133char *line_abbrevname(char *dst, const char *src, int dstsize); 133char *line_abbrevname(char *dst, const char *src, int dstsize);
134 134
135void record_failed_login(const char *, const char *, const char *);
136
135#endif /* _HAVE_LOGINREC_H_ */ 137#endif /* _HAVE_LOGINREC_H_ */
diff --git a/openbsd-compat/bsd-cray.c b/openbsd-compat/bsd-cray.c
index f630366be..d1f1c059c 100644
--- a/openbsd-compat/bsd-cray.c
+++ b/openbsd-compat/bsd-cray.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: bsd-cray.c,v 1.13 2004/01/30 03:34:22 dtucker Exp $ 2 * $Id: bsd-cray.c,v 1.14 2005/02/02 06:10:11 dtucker Exp $
3 * 3 *
4 * bsd-cray.c 4 * bsd-cray.c
5 * 5 *
@@ -171,7 +171,7 @@ cray_access_denied(char *username)
171 * record_failed_login: generic "login failed" interface function 171 * record_failed_login: generic "login failed" interface function
172 */ 172 */
173void 173void
174record_failed_login(const char *user, const char *ttyname) 174record_failed_login(const char *user, const char *hostname, const char *ttyname)
175{ 175{
176 cray_login_failure((char *)user, IA_UDBERR); 176 cray_login_failure((char *)user, IA_UDBERR);
177} 177}
diff --git a/openbsd-compat/bsd-cray.h b/openbsd-compat/bsd-cray.h
index de6ba1a8d..774eceb5a 100644
--- a/openbsd-compat/bsd-cray.h
+++ b/openbsd-compat/bsd-cray.h
@@ -1,4 +1,4 @@
1/* $Id: bsd-cray.h,v 1.11 2004/01/30 03:34:22 dtucker Exp $ */ 1/* $Id: bsd-cray.h,v 1.12 2005/02/02 06:10:11 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2002, Cray Inc. (Wendy Palm <wendyp@cray.com>) 4 * Copyright (c) 2002, Cray Inc. (Wendy Palm <wendyp@cray.com>)
@@ -42,10 +42,10 @@ void cray_init_job(struct passwd *);
42void cray_job_termination_handler(int); 42void cray_job_termination_handler(int);
43void cray_login_failure(char *, int ); 43void cray_login_failure(char *, int );
44int cray_access_denied(char *); 44int cray_access_denied(char *);
45#define CUSTOM_FAILED_LOGIN 1
46void record_failed_login(const char *, const char *);
47extern char cray_tmpdir[]; 45extern char cray_tmpdir[];
48 46
47#define CUSTOM_FAILED_LOGIN 1
48
49#ifndef IA_SSHD 49#ifndef IA_SSHD
50# define IA_SSHD IA_LOGIN 50# define IA_SSHD IA_LOGIN
51#endif 51#endif
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c
index e7eb179ec..79d180211 100644
--- a/openbsd-compat/port-aix.c
+++ b/openbsd-compat/port-aix.c
@@ -28,8 +28,6 @@
28#include "auth.h" 28#include "auth.h"
29#include "ssh.h" 29#include "ssh.h"
30#include "log.h" 30#include "log.h"
31#include "servconf.h"
32#include "canohost.h"
33#include "xmalloc.h" 31#include "xmalloc.h"
34#include "buffer.h" 32#include "buffer.h"
35 33
@@ -38,7 +36,6 @@
38#include <uinfo.h> 36#include <uinfo.h>
39#include "port-aix.h" 37#include "port-aix.h"
40 38
41extern ServerOptions options;
42extern Buffer loginmsg; 39extern Buffer loginmsg;
43 40
44# ifdef HAVE_SETAUTHDB 41# ifdef HAVE_SETAUTHDB
@@ -280,10 +277,8 @@ sys_auth_record_login(const char *user, const char *host, const char *ttynm)
280 * record_failed_login: generic "login failed" interface function 277 * record_failed_login: generic "login failed" interface function
281 */ 278 */
282void 279void
283record_failed_login(const char *user, const char *ttyname) 280record_failed_login(const char *user, const char *hostname, const char *ttyname)
284{ 281{
285 char *hostname = (char *)get_canonical_hostname(options.use_dns);
286
287 if (geteuid() != 0) 282 if (geteuid() != 0)
288 return; 283 return;
289 284
diff --git a/openbsd-compat/port-aix.h b/openbsd-compat/port-aix.h
index 29e9751ce..751139004 100644
--- a/openbsd-compat/port-aix.h
+++ b/openbsd-compat/port-aix.h
@@ -1,4 +1,4 @@
1/* $Id: port-aix.h,v 1.21 2004/08/14 14:09:12 dtucker Exp $ */ 1/* $Id: port-aix.h,v 1.22 2005/02/02 06:10:11 dtucker Exp $ */
2 2
3/* 3/*
4 * 4 *
@@ -68,7 +68,6 @@ int sys_auth_allowed_user(struct passwd *);
68# define CUSTOM_SYS_AUTH_RECORD_LOGIN 1 68# define CUSTOM_SYS_AUTH_RECORD_LOGIN 1
69int sys_auth_record_login(const char *, const char *, const char *); 69int sys_auth_record_login(const char *, const char *, const char *);
70# define CUSTOM_FAILED_LOGIN 1 70# define CUSTOM_FAILED_LOGIN 1
71void record_failed_login(const char *, const char *);
72#endif 71#endif
73 72
74void aix_setauthdb(const char *); 73void aix_setauthdb(const char *);