version 1.49, 2003/08/26 09:58:43 |
version 1.49.2.2, 2004/08/19 22:37:30 |
|
|
#include "buffer.h" |
#include "buffer.h" |
#include "bufaux.h" |
#include "bufaux.h" |
#include "uidswap.h" |
#include "uidswap.h" |
#include "tildexpand.h" |
|
#include "misc.h" |
#include "misc.h" |
#include "bufaux.h" |
#include "bufaux.h" |
#include "packet.h" |
#include "packet.h" |
|
|
return 1; |
return 1; |
} |
} |
|
|
Authctxt * |
|
authctxt_new(void) |
|
{ |
|
Authctxt *authctxt = xmalloc(sizeof(*authctxt)); |
|
memset(authctxt, 0, sizeof(*authctxt)); |
|
return authctxt; |
|
} |
|
|
|
void |
void |
auth_log(Authctxt *authctxt, int authenticated, char *method, char *info) |
auth_log(Authctxt *authctxt, int authenticated, char *method, char *info) |
{ |
{ |
|
|
/* Raise logging level */ |
/* Raise logging level */ |
if (authenticated == 1 || |
if (authenticated == 1 || |
!authctxt->valid || |
!authctxt->valid || |
authctxt->failures >= AUTH_FAIL_LOG || |
authctxt->failures >= options.max_authtries / 2 || |
strcmp(method, "password") == 0) |
strcmp(method, "password") == 0) |
authlog = logit; |
authlog = logit; |
|
|
|
|
authlog("%s %s for %s%.100s from %.200s port %d%s", |
authlog("%s %s for %s%.100s from %.200s port %d%s", |
authmsg, |
authmsg, |
method, |
method, |
authctxt->valid ? "" : "illegal user ", |
authctxt->valid ? "" : "invalid user ", |
authctxt->user, |
authctxt->user, |
get_remote_ipaddr(), |
get_remote_ipaddr(), |
get_remote_port(), |
get_remote_port(), |
|
|
|
|
pw = getpwnam(user); |
pw = getpwnam(user); |
if (pw == NULL) { |
if (pw == NULL) { |
logit("Illegal user %.100s from %.100s", |
logit("Invalid user %.100s from %.100s", |
user, get_remote_ipaddr()); |
user, get_remote_ipaddr()); |
return (NULL); |
return (NULL); |
} |
} |
|
|
memset(&fake, 0, sizeof(fake)); |
memset(&fake, 0, sizeof(fake)); |
fake.pw_name = "NOUSER"; |
fake.pw_name = "NOUSER"; |
fake.pw_passwd = |
fake.pw_passwd = |
"$2a$06$r3.juUaHZDlIbQaO2dS9FuYxL1W9M81R1Tc92PoSNmzvpEqLkLGrK"; |
"$2a$06$r3.juUaHZDlIbQaO2dS9FuYxL1W9M81R1Tc92PoSNmzvpEqLkLGrK"; |
fake.pw_gecos = "NOUSER"; |
fake.pw_gecos = "NOUSER"; |
fake.pw_uid = -1; |
fake.pw_uid = (uid_t)-1; |
fake.pw_gid = -1; |
fake.pw_gid = (gid_t)-1; |
fake.pw_class = ""; |
fake.pw_class = ""; |
fake.pw_dir = "/nonexist"; |
fake.pw_dir = "/nonexist"; |
fake.pw_shell = "/nonexist"; |
fake.pw_shell = "/nonexist"; |