| NetlogonAuthenticator.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.portal.security.ntlm.msrpc;
16
17 import jcifs.dcerpc.ndr.NdrBuffer;
18 import jcifs.dcerpc.ndr.NdrObject;
19
20 /**
21 * <a href="NetlogonAuthenticator.java.html"><b><i>View Source</i></b></a>
22 *
23 * @author Marcellus Tavares
24 */
25 public class NetlogonAuthenticator extends NdrObject {
26
27 public NetlogonAuthenticator() {
28 _credential = new byte[8];
29 }
30
31 public NetlogonAuthenticator(byte[] credential, int timestamp) {
32 _credential = credential;
33 _timestamp = timestamp;
34 }
35
36 public void decode(NdrBuffer ndrBuffer) {
37 ndrBuffer.align(4);
38
39 int index = ndrBuffer.index;
40
41 ndrBuffer.advance(8);
42
43 _timestamp = ndrBuffer.dec_ndr_long();
44
45 ndrBuffer = ndrBuffer.derive(index);
46
47 for (int i = 0; i < 8; i++) {
48 _credential[i] = (byte) ndrBuffer.dec_ndr_small();
49 }
50 }
51 public void encode(NdrBuffer ndrBuffer) {
52 ndrBuffer.align(4);
53
54 int index = ndrBuffer.index;
55
56 ndrBuffer.advance(8);
57
58 ndrBuffer.enc_ndr_long(_timestamp);
59
60 ndrBuffer = ndrBuffer.derive(index);
61
62 for (int i = 0; i < 8; i++) {
63 ndrBuffer.enc_ndr_small(_credential[i]);
64 }
65 }
66
67 private byte[] _credential;
68 private int _timestamp;
69
70 }