001
014
015 package com.liferay.portal.security.ntlm.msrpc;
016
017 import jcifs.dcerpc.ndr.NdrBuffer;
018 import jcifs.dcerpc.ndr.NdrException;
019 import jcifs.dcerpc.ndr.NdrObject;
020 import jcifs.dcerpc.rpc;
021
022
025 public class NetlogonValidationSamInfo extends NdrObject {
026
027 public NetlogonValidationSamInfo() {
028 _effectiveName = new rpc.unicode_string();
029 _fullName = new rpc.unicode_string();
030 _logonScript = new rpc.unicode_string();
031 _profilePath = new rpc.unicode_string();
032 _homeDirectory = new rpc.unicode_string();
033 _homeDirectoryDrive = new rpc.unicode_string();
034 _logonServer = new rpc.unicode_string();
035 _logonDomainName = new rpc.unicode_string();
036 _userSessionKey = new byte[16];
037 _logonDomain = new rpc.sid_t();
038 }
039
040 @Override
041 public void decode(NdrBuffer ndrBuffer) throws NdrException {
042 _logonTime = ndrBuffer.dec_ndr_hyper();
043 _logoffTime = ndrBuffer.dec_ndr_hyper();
044 _kickoffTime = ndrBuffer.dec_ndr_hyper();
045 _passwordLastSet = ndrBuffer.dec_ndr_hyper();
046 _passwordCanChange = ndrBuffer.dec_ndr_hyper();
047 _passwordMustChange = ndrBuffer.dec_ndr_hyper();
048
049 _effectiveName.length = (short)ndrBuffer.dec_ndr_short();
050 _effectiveName.maximum_length = (short)ndrBuffer.dec_ndr_short();
051
052 int effectiveNamePtr = ndrBuffer.dec_ndr_long();
053
054 _fullName.length = (short)ndrBuffer.dec_ndr_short();
055 _fullName.maximum_length = (short)ndrBuffer.dec_ndr_short();
056
057 int fullNamePtr = ndrBuffer.dec_ndr_long();
058
059 _logonScript.length = (short)ndrBuffer.dec_ndr_short();
060 _logonScript.maximum_length = (short)ndrBuffer.dec_ndr_short();
061
062 int logonScriptPtr = ndrBuffer.dec_ndr_long();
063
064 _profilePath.length = (short)ndrBuffer.dec_ndr_short();
065 _profilePath.maximum_length = (short)ndrBuffer.dec_ndr_short();
066
067 int profilePathPtr = ndrBuffer.dec_ndr_long();
068
069 _homeDirectory.length = (short)ndrBuffer.dec_ndr_short();
070 _homeDirectory.maximum_length = (short)ndrBuffer.dec_ndr_short();
071
072 int homeDirectoryPtr = ndrBuffer.dec_ndr_long();
073
074 _homeDirectoryDrive.length = (short)ndrBuffer.dec_ndr_short();
075 _homeDirectoryDrive.maximum_length = (short)ndrBuffer.dec_ndr_short();
076
077 int homeDirectoryDrivePtr = ndrBuffer.dec_ndr_long();
078
079 _logonCount = (short)ndrBuffer.dec_ndr_short();
080 _badPasswordCount = (short)ndrBuffer.dec_ndr_short();
081
082 _userId = ndrBuffer.dec_ndr_long();
083 _primaryGroupId = ndrBuffer.dec_ndr_long();
084
085 _groupCount = ndrBuffer.dec_ndr_long();
086
087 int groupIdsPtr = ndrBuffer.dec_ndr_long();
088
089 _userFlags = ndrBuffer.dec_ndr_long();
090
091 int userSessionKeyI = ndrBuffer.index;
092
093 ndrBuffer.advance(16);
094
095 _logonServer.length = (short)ndrBuffer.dec_ndr_short();
096 _logonServer.maximum_length = (short)ndrBuffer.dec_ndr_short();
097
098 int logonServerPtr = ndrBuffer.dec_ndr_long();
099
100 _logonDomainName.length = (short)ndrBuffer.dec_ndr_short();
101 _logonDomainName.maximum_length = (short)ndrBuffer.dec_ndr_short();
102
103 int logonDomainNamePtr = ndrBuffer.dec_ndr_long();
104
105 int logonDomainPtr = ndrBuffer.dec_ndr_long();
106
107 ndrBuffer.advance(40);
108
109 if (effectiveNamePtr > 0) {
110 decodeUnicodeString(ndrBuffer, _effectiveName);
111 }
112
113 if (fullNamePtr > 0) {
114 decodeUnicodeString(ndrBuffer, _fullName);
115 }
116
117 if (logonScriptPtr > 0) {
118 decodeUnicodeString(ndrBuffer, _logonScript);
119 }
120
121 if (profilePathPtr > 0) {
122 decodeUnicodeString(ndrBuffer, _profilePath);
123 }
124
125 if (homeDirectoryPtr > 0) {
126 decodeUnicodeString(ndrBuffer, _homeDirectory);
127 }
128
129 if (homeDirectoryDrivePtr > 0) {
130 decodeUnicodeString(ndrBuffer, _homeDirectoryDrive);
131 }
132
133 if (groupIdsPtr > 0) {
134 _groupIds = new GroupMembership[_groupCount];
135
136 ndrBuffer = ndrBuffer.deferred;
137
138 int groupIdsS = ndrBuffer.dec_ndr_long();
139 int groupIdsI = ndrBuffer.index;
140
141 ndrBuffer.advance(8 * groupIdsS);
142
143 ndrBuffer = ndrBuffer.derive(groupIdsI);
144
145 for (int i = 0; i < groupIdsS; i++) {
146 if (_groupIds[i] == null) {
147 _groupIds[i] = new GroupMembership();
148 }
149
150 _groupIds[i].decode(ndrBuffer);
151 }
152 }
153
154 ndrBuffer = ndrBuffer.derive(userSessionKeyI);
155
156 for (int i = 0; i < 16; i++) {
157 _userSessionKey[i] = (byte)ndrBuffer.dec_ndr_small();
158 }
159
160 if (logonServerPtr > 0) {
161 decodeUnicodeString(ndrBuffer, _logonServer);
162 }
163
164 if (logonDomainNamePtr > 0) {
165 decodeUnicodeString(ndrBuffer, _logonDomainName);
166 }
167
168 if (logonDomainPtr > 0) {
169 ndrBuffer = ndrBuffer.deferred;
170
171 _logonDomain.decode(ndrBuffer);
172 }
173 }
174
175 @Override
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 }