[go: up one dir, main page]

Menu

[ca27df]: / defs.h  Maximize  Restore  History

Download this file

66 lines (54 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// This file is part of the loginx project
//
// Copyright (c) 2013 by Mike Sharov <msharov@users.sourceforge.net>
// This file is free software, distributed under the ISC license.
#pragma once
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <sys/stat.h>
#include <syslog.h>
#include <errno.h>
#include <paths.h>
enum { MAX_PW_LEN = 64 };
struct account {
uid_t uid;
gid_t gid;
unsigned ltime;
char* name;
char* dir;
char* shell;
};
typedef const struct account* const* acclist_t;
extern gid_t _ttygroup;
extern const char* _termname;
extern char _ttypath [16];
//----------------------------------------------------------------------
// loginx.c
void* xmalloc (size_t n);
void xfree (void* p);
#define xfreenull(pp) do { xfree(pp); pp = NULL; } while(0)
void ExitWithError (const char* fn) __attribute__((noreturn));
void ExitWithMessage (const char* msg) __attribute__((noreturn));
// pam.c
void PamOpen (void);
void PamClose (void);
bool PamLogin (const struct account* acct, const char* password);
void PamLogout (void);
const char* PamGetenv (const char* name);
// uacct.c
acclist_t ReadAccounts (void);
unsigned NAccounts (void);
void ReadLastlog (void);
void WriteLastlog (const struct account* acct);
void WriteUtmp (const struct account* acct, pid_t pid, short uttype);
// ui.c
unsigned LoginBox (acclist_t al, char* password);
void ClearScreen (void);
// usess.c
void RunSession (const struct account* acct);