1
14
15 package com.liferay.portal.security.ntlm.msrpc;
16
17 import jcifs.dcerpc.ndr.NdrBuffer;
18 import jcifs.dcerpc.ndr.NdrException;
19 import jcifs.dcerpc.ndr.NdrObject;
20 import jcifs.dcerpc.rpc;
21
22
27 public class NetlogonValidationSamInfo extends NdrObject {
28
29 public NetlogonValidationSamInfo() {
30 _effectiveName = new rpc.unicode_string();
31 _fullName = new rpc.unicode_string();
32 _logonScript = new rpc.unicode_string();
33 _profilePath = new rpc.unicode_string();
34 _homeDirectory = new rpc.unicode_string();
35 _homeDirectoryDrive = new rpc.unicode_string();
36 _logonServer = new rpc.unicode_string();
37 _logonDomainName = new rpc.unicode_string();
38 _userSessionKey = new byte[16];
39 _logonDomain = new rpc.sid_t();
40 }
41
42 public void decode(NdrBuffer ndrBuffer) throws NdrException {
43 _logonTime = ndrBuffer.dec_ndr_hyper();
44 _logoffTime = ndrBuffer.dec_ndr_hyper();
45 _kickoffTime = ndrBuffer.dec_ndr_hyper();
46 _passwordLastSet = ndrBuffer.dec_ndr_hyper();
47 _passwordCanChange = ndrBuffer.dec_ndr_hyper();
48 _passwordMustChange = ndrBuffer.dec_ndr_hyper();
49
50 _effectiveName.length = (short)ndrBuffer.dec_ndr_short();
51 _effectiveName.maximum_length = (short)ndrBuffer.dec_ndr_short();
52
53 int effectiveNamePtr = ndrBuffer.dec_ndr_long();
54
55 _fullName.length = (short)ndrBuffer.dec_ndr_short();
56 _fullName.maximum_length = (short)ndrBuffer.dec_ndr_short();
57
58 int fullNamePtr = ndrBuffer.dec_ndr_long();
59
60 _logonScript.length = (short)ndrBuffer.dec_ndr_short();
61 _logonScript.maximum_length = (short)ndrBuffer.dec_ndr_short();
62
63 int logonScriptPtr = ndrBuffer.dec_ndr_long();
64
65 _profilePath.length = (short)ndrBuffer.dec_ndr_short();
66 _profilePath.maximum_length = (short)ndrBuffer.dec_ndr_short();
67
68 int profilePathPtr = ndrBuffer.dec_ndr_long();
69
70 _homeDirectory.length = (short)ndrBuffer.dec_ndr_short();
71 _homeDirectory.maximum_length = (short)ndrBuffer.dec_ndr_short();
72
73 int homeDirectoryPtr = ndrBuffer.dec_ndr_long();
74
75 _homeDirectoryDrive.length = (short)ndrBuffer.dec_ndr_short();
76 _homeDirectoryDrive.maximum_length = (short)ndrBuffer.dec_ndr_short();
77
78 int homeDirectoryDrivePtr = ndrBuffer.dec_ndr_long();
79
80 _logonCount = (short)ndrBuffer.dec_ndr_short();
81 _badPasswordCount = (short)ndrBuffer.dec_ndr_short();
82
83 _userId = ndrBuffer.dec_ndr_long();
84 _primaryGroupId = ndrBuffer.dec_ndr_long();
85
86 _groupCount = ndrBuffer.dec_ndr_long();
87
88 int groupIdsPtr = ndrBuffer.dec_ndr_long();
89
90 _userFlags = ndrBuffer.dec_ndr_long();
91
92 int userSessionKeyI = ndrBuffer.index;
93
94 ndrBuffer.advance(16);
95
96 _logonServer.length = (short)ndrBuffer.dec_ndr_short();
97 _logonServer.maximum_length = (short)ndrBuffer.dec_ndr_short();
98
99 int logonServerPtr = ndrBuffer.dec_ndr_long();
100
101 _logonDomainName.length = (short)ndrBuffer.dec_ndr_short();
102 _logonDomainName.maximum_length = (short)ndrBuffer.dec_ndr_short();
103
104 int logonDomainNamePtr = ndrBuffer.dec_ndr_long();
105
106 int logonDomainPtr = ndrBuffer.dec_ndr_long();
107
108 ndrBuffer.advance(40);
109
110 if (effectiveNamePtr > 0) {
111 decodeUnicodeString(ndrBuffer, _effectiveName);
112 }
113
114 if (fullNamePtr > 0) {
115 decodeUnicodeString(ndrBuffer, _fullName);
116 }
117
118 if (logonScriptPtr > 0) {
119 decodeUnicodeString(ndrBuffer, _logonScript);
120 }
121
122 if (profilePathPtr > 0) {
123 decodeUnicodeString(ndrBuffer, _profilePath);
124 }
125
126 if (homeDirectoryPtr > 0) {
127 decodeUnicodeString(ndrBuffer, _homeDirectory);
128 }
129
130 if (homeDirectoryDrivePtr > 0) {
131 decodeUnicodeString(ndrBuffer, _homeDirectoryDrive);
132 }
133
134 if (groupIdsPtr > 0) {
135 _groupIds = new GroupMembership[_groupCount];
136
137 ndrBuffer = ndrBuffer.deferred;
138
139 int groupIdsS = ndrBuffer.dec_ndr_long();
140 int groupIdsI = ndrBuffer.index;
141
142 ndrBuffer.advance(8 * groupIdsS);
143
144 ndrBuffer = ndrBuffer.derive(groupIdsI);
145
146 for (int i = 0; i < groupIdsS; i++) {
147 if (_groupIds[i] == null) {
148 _groupIds[i] = new GroupMembership();
149 }
150
151 _groupIds[i].decode(ndrBuffer);
152 }
153 }
154
155 ndrBuffer = ndrBuffer.derive(userSessionKeyI);
156
157 for (int i = 0; i < 16; i++) {
158 _userSessionKey[i] = (byte) ndrBuffer.dec_ndr_small();
159 }
160
161 if (logonServerPtr > 0) {
162 decodeUnicodeString(ndrBuffer, _logonServer);
163 }
164
165 if (logonDomainNamePtr > 0) {
166 decodeUnicodeString(ndrBuffer, _logonDomainName);
167 }
168
169 if (logonDomainPtr > 0) {
170 ndrBuffer = ndrBuffer.deferred;
171
172 _logonDomain.decode(ndrBuffer);
173 }
174 }
175
176 public void encode(NdrBuffer ndrBuffer) {
177 }
178
179 public rpc.unicode_string getEffectiveName() {
180 return _effectiveName;
181 }
182
183 protected void decodeUnicodeString(
184 NdrBuffer ndrBuffer, rpc.unicode_string string) {
185
186 ndrBuffer = ndrBuffer.deferred;
187
188 int bufferS = ndrBuffer.dec_ndr_long();
189
190 ndrBuffer.dec_ndr_long();
191
192 int bufferL = ndrBuffer.dec_ndr_long();
193 int bufferI = ndrBuffer.index;
194
195 ndrBuffer.advance(2 * bufferL);
196
197 if (string.buffer == null) {
198 string.buffer = new short[bufferS];
199 }
200
201 ndrBuffer = ndrBuffer.derive(bufferI);
202
203 for (int i = 0; i < bufferL; i++) {
204 string.buffer[i] = (short)ndrBuffer.dec_ndr_short();
205 }
206 }
207
208 @SuppressWarnings("unused")
209 private short _badPasswordCount;
210
211 private rpc.unicode_string _effectiveName;
212 private rpc.unicode_string _fullName;
213 private int _groupCount;
214 private GroupMembership[] _groupIds;
215 private rpc.unicode_string _homeDirectory;
216 private rpc.unicode_string _homeDirectoryDrive;
217
218 @SuppressWarnings("unused")
219 private long _kickoffTime;
220
221 @SuppressWarnings("unused")
222 private long _logoffTime;
223
224 @SuppressWarnings("unused")
225 private short _logonCount;
226
227 private rpc.sid_t _logonDomain;
228 private rpc.unicode_string _logonDomainName;
229 private rpc.unicode_string _logonScript;
230 private rpc.unicode_string _logonServer;
231
232 @SuppressWarnings("unused")
233 private long _logonTime;
234
235 @SuppressWarnings("unused")
236 private long _passwordCanChange;
237
238 @SuppressWarnings("unused")
239 private long _passwordLastSet;
240
241 @SuppressWarnings("unused")
242 private long _passwordMustChange;
243
244 @SuppressWarnings("unused")
245 private int _primaryGroupId;
246
247 private rpc.unicode_string _profilePath;
248
249 @SuppressWarnings("unused")
250 private int _userFlags;
251
252 @SuppressWarnings("unused")
253 private int _userId;
254
255 private byte[] _userSessionKey;
256
257 }