summaryrefslogtreecommitdiff
path: root/other/openssh-2.1.1p4/login.c
diff options
context:
space:
mode:
Diffstat (limited to 'other/openssh-2.1.1p4/login.c')
-rw-r--r--other/openssh-2.1.1p4/login.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/other/openssh-2.1.1p4/login.c b/other/openssh-2.1.1p4/login.c
deleted file mode 100644
index c507218..0000000
--- a/other/openssh-2.1.1p4/login.c
+++ /dev/null
@@ -1,69 +0,0 @@
1/*
2 *
3 * login.c
4 *
5 * Author: Tatu Ylonen <ylo@cs.hut.fi>
6 *
7 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8 * All rights reserved
9 *
10 * Created: Fri Mar 24 14:51:08 1995 ylo
11 *
12 * This file performs some of the things login(1) normally does. We cannot
13 * easily use something like login -p -h host -f user, because there are
14 * several different logins around, and it is hard to determined what kind of
15 * login the current system has. Also, we want to be able to execute commands
16 * on a tty.
17 *
18 */
19
20#include "includes.h"
21RCSID("$OpenBSD: login.c,v 1.14 2000/06/20 01:39:42 markus Exp $");
22
23#include "loginrec.h"
24
25/*
26 * Returns the time when the user last logged in. Returns 0 if the
27 * information is not available. This must be called before record_login.
28 * The host the user logged in from will be returned in buf.
29 */
30
31unsigned long
32get_last_login_time(uid_t uid, const char *logname,
33 char *buf, unsigned int bufsize)
34{
35 struct logininfo li;
36
37 login_get_lastlog(&li, uid);
38 strlcpy(buf, li.hostname, bufsize);
39 return li.tv_sec;
40}
41
42/*
43 * Records that the user has logged in. I these parts of operating systems
44 * were more standardized.
45 */
46
47void
48record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid,
49 const char *host, struct sockaddr * addr)
50{
51 struct logininfo *li;
52
53 li = login_alloc_entry(pid, user, host, ttyname);
54 login_set_addr(li, addr, sizeof(struct sockaddr));
55 login_login(li);
56 login_free_entry(li);
57}
58
59/* Records that the user has logged out. */
60
61void
62record_logout(pid_t pid, const char *ttyname)
63{
64 struct logininfo *li;
65
66 li = login_alloc_entry(pid, NULL, NULL, ttyname);
67 login_logout(li);
68 login_free_entry(li);
69}