forked from heimdal/MKShim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
leash.c
141 lines (118 loc) · 3.36 KB
/
leash.c
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include "heim.h"
#include<mit-leashwin.h>
#include<mit-leasherr.h>
DWORD
Leash_get_default_lifetime(void)
{
krb5_error_code code;
krb5_context context = 0;
krb5_deltat lifetime = 10 * 60 * 60;
code = krb5_init_context(&context);
if (code == 0) {
lifetime = krb5_config_get_time_default(context, NULL, lifetime,
"libdefaults", "ticket_lifetime", NULL);
krb5_free_context(context);
}
return lifetime / 60; /* Return value should be in
* minutes */
}
DWORD
Leash_get_default_renew_till(void)
{
krb5_error_code code;
krb5_context context = 0;
krb5_deltat renew_lifetime = 7 * 24 * 60 * 60;
code = krb5_init_context(&context);
if (code == 0) {
renew_lifetime = krb5_config_get_time_default(context, NULL, renew_lifetime,
"libdefaults", "renew_lifetime",
NULL);
krb5_free_context(context);
}
return renew_lifetime / 60;
}
DWORD
Leash_get_default_forwardable(void)
{
krb5_error_code code;
krb5_context context = 0;
krb5_boolean forwardable = TRUE;
code = krb5_init_context(&context);
if (code == 0) {
forwardable = krb5_config_get_bool_default(context, NULL, forwardable,
"libdefaults", "forwardable",
NULL);
krb5_free_context(context);
}
return forwardable;
}
DWORD
Leash_get_default_renewable(void)
{
krb5_error_code code;
krb5_context context = 0;
krb5_boolean renewable = TRUE;
code = krb5_init_context(&context);
if (code == 0) {
renewable = krb5_config_get_bool_default(context, NULL, renewable,
"libdefaults", "renewable",
NULL);
krb5_free_context(context);
}
return renewable;
}
DWORD
Leash_get_default_noaddresses(void)
{
krb5_error_code code;
krb5_context context = 0;
krb5_boolean noaddresses = TRUE;
code = krb5_init_context(&context);
if (code == 0) {
noaddresses = krb5_config_get_bool_default(context, NULL, noaddresses,
"libdefaults", "noaddresses",
NULL);
krb5_free_context(context);
}
return noaddresses;
}
DWORD
Leash_get_default_proxiable(void)
{
krb5_error_code code;
krb5_context context = 0;
krb5_boolean proxiable = FALSE;
code = krb5_init_context(&context);
if (code == 0) {
proxiable = krb5_config_get_bool_default(context, NULL, proxiable,
"libdefaults", "proxiable",
NULL);
krb5_free_context(context);
}
return proxiable;
}
DWORD
Leash_get_default_publicip(void)
{
return 0;
}
DWORD
Leash_get_default_life_min(void)
{
return 5;
}
DWORD
Leash_get_default_life_max(void)
{
return 1440;
}
DWORD
Leash_get_default_renew_min(void)
{
return 600;
}
DWORD
Leash_get_default_renew_max(void)
{
return 60 * 24 * 30;
}