summaryrefslogtreecommitdiffstats
path: root/private/newsam/server/global.c
blob: e7d07a437a14a01795091afff0e9cdc35e20643d (plain) (blame)
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/*++

Copyright (c) 1990  Microsoft Corporation

Module Name:

    global.c

Abstract:

    This file contains global variables for the SAM server program.

    Note: There are also some global variables in the files generated
          by the RPC midl compiler.  These variables start with the
          prefix "samr_".

Author:

    Jim Kelly    (JimK)  4-July-1991

Environment:

    User Mode - Win32

Revision History:


--*/

///////////////////////////////////////////////////////////////////////////////
//                                                                           //
// Includes                                                                  //
//                                                                           //
///////////////////////////////////////////////////////////////////////////////

#include <samsrvp.h>



///////////////////////////////////////////////////////////////////////////////
//                                                                           //
// Global variables                                                          //
//                                                                           //
///////////////////////////////////////////////////////////////////////////////



#if SAMP_DIAGNOSTICS
//
// SAM Global Controls - see flags in samsrvp.h
//

ULONG SampGlobalFlag = 0;
#endif //SAMP_DIAGNOSTICS


//
// Internal data structure and Registry database synchronization lock
//
// The SampTransactionWithinDomain field is used to track whether a
// lock held for exclusive WRITE access is for a transaction within
// a single domain.  If so, then SampTransactionDomainIndex contains
// the index into SampDefinedDomains of the domain being modified.
//

RTL_RESOURCE SampLock;
BOOLEAN SampTransactionWithinDomain;
ULONG SampTransactionDomainIndex;


//
// The type of product this SAM server is running in
//

NT_PRODUCT_TYPE SampProductType;



//
// Used to indicate whether the SAM service is currently processing
// normal client calls.  If not, then trusted client calls will still
// be processed, but non-trusted client calls will be rejected.
//

SAMP_SERVICE_STATE SampServiceState;


//
// This boolean is set to TRUE if the LSA auditing policy indicates
// account auditing is enabled.  Otherwise, this will be FALSE.
//
// This enables SAM to skip all auditing processing unless auditing
// is currently enabled.
//

BOOLEAN SampAccountAuditingEnabled;



//
// This is a handle to the root of the SAM backstore information in the
// registry.   This is the level at which the RXACT information is
// established.  This key can not be closed if there are any SERVER object
// context blocks active.
// ("SAM")
//

HANDLE SampKey;


//
// This is the pointer to the RXactContext structure that will be created
// when RXact is initialized.  It must be passed into each RXact call.
//

PRTL_RXACT_CONTEXT SampRXactContext;


//
// Keep a list of server and domain contexts
//

LIST_ENTRY SampContextListHead;

//
// This array contains information about each domain known to this
// SAM server.  Reference and Modification of this array is protected
// by the SampLock.
//

ULONG SampDefinedDomainsCount;
PSAMP_DEFINED_DOMAINS SampDefinedDomains;





//
// Object type-independent information for each of the various
// SAM defined objects.
// This information is READ-ONLY once initialized.

SAMP_OBJECT_INFORMATION SampObjectInformation[ SampUnknownObjectType ];




//
// Count of the number of active opens
//

ULONG SampActiveContextCount;



//
//  Address of DLL routine to do password filtering.
//

//PSAM_PF_PASSWORD_FILTER    SampPasswordFilterDllRoutine;



//
// Unicode strings containing well known registry key names.
// These are read-only values once initialized.
//

UNICODE_STRING SampNameDomains;
UNICODE_STRING SampNameDomainGroups;
UNICODE_STRING SampNameDomainAliases;
UNICODE_STRING SampNameDomainAliasesMembers;
UNICODE_STRING SampNameDomainUsers;
UNICODE_STRING SampNameDomainAliasesNames;
UNICODE_STRING SampNameDomainGroupsNames;
UNICODE_STRING SampNameDomainUsersNames;
UNICODE_STRING SampCombinedAttributeName;
UNICODE_STRING SampFixedAttributeName;
UNICODE_STRING SampVariableAttributeName;



//
// A plethora of other useful characters or strings
//

UNICODE_STRING SampBackSlash;           // "/"
UNICODE_STRING SampNullString;          // Null string
UNICODE_STRING SampSamSubsystem;        // "Security Account Manager"
UNICODE_STRING SampServerObjectName;    // Name of root SamServer object


//
// Useful times
//

LARGE_INTEGER SampImmediatelyDeltaTime;
LARGE_INTEGER SampNeverDeltaTime;
LARGE_INTEGER SampHasNeverTime;
LARGE_INTEGER SampWillNeverTime;


//
// Useful encryption constants
//

LM_OWF_PASSWORD SampNullLmOwfPassword;
NT_OWF_PASSWORD SampNullNtOwfPassword;


//
// Useful Sids
//

PSID SampWorldSid;
PSID SampAnonymousSid;
PSID SampAdministratorUserSid;
PSID SampAdministratorsAliasSid;


//
//  Variables for the thread that flushes changes to the registry.
//
//  LastUnflushedChange - if there are no changes to be flushed, this
//      has a value of "Never".  If there are changes to be flushed,
//      this is the time of the last change that was made.  The flush
//      thread will flush if a SampFlushThreadMinWaitSeconds has passed
//      since the last change.
//
//  FlushThreadCreated - set TRUE as soon as the flush thread is created,
//      and FALSE when the thread exits.  A new thread will be created
//      when this is FALSE, unless FlushImmediately is TRUE.
//
//  FlushImmediately - an important event has occurred, so we want to
//      flush the changes immediately rather than waiting for the flush
//      thread to do it.  LastUnflushedChange should be set to "Never"
//      so the flush thread knows it doesn't have to flush.
//

LARGE_INTEGER LastUnflushedChange;
BOOLEAN FlushThreadCreated;
BOOLEAN FlushImmediately;

//
// These should probably be #defines, but we want to play with them.
//
//  SampFlushThreadMinWaitSeconds - The unit of time that the flush thread
//      waits.  If one of these has passed since the last unflushed change,
//      the changes will be flushed.
//
//  SampFlushThreadMaxWaitSeconds - If this amount of time has passed since
//      the flush thread was created or last flushed, the thread will force
//      a flush even if the database is still being changed.
//
//  SampFlushThreadExitDelaySeconds - How long the flush thread waits
//      around after a flush to see if any more changes occur.  If they
//      do, it starts waiting again; but if they don't, it will exit
//      to keep down thread overhead.
//

LONG   SampFlushThreadMinWaitSeconds;
LONG   SampFlushThreadMaxWaitSeconds;
LONG   SampFlushThreadExitDelaySeconds;

//
// Special SIDs
//

PSID SampBuiltinDomainSid = NULL;
PSID SampAccountDomainSid = NULL;

//
// Null token handle.  This is used when clients connect via unauthenticated
// RPC instead of authenticated RPC or named pipes.  Since they can't be
// authenticated, we impersonate this pre-built Null sesssion token.
//

HANDLE SampNullSessionToken;

//
// Flag indicating whether Netware server installed.
//

BOOLEAN SampNetwareServerInstalled = FALSE;

//
// Flag indicating whether to start listening on TCP/IP
//

BOOLEAN SampIpServerInstalled = FALSE;

//
// Flag indicating whether to start listening on apple talk
//

BOOLEAN SampAppletalkServerInstalled = FALSE;

//
// Flag indicating whether to start listening on Vines
//

BOOLEAN SampVinesServerInstalled = FALSE;