1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.security.ntlm.msrpc;
16  
17  import jcifs.dcerpc.UnicodeString;
18  import jcifs.dcerpc.ndr.NdrBuffer;
19  import jcifs.dcerpc.ndr.NdrObject;
20  import jcifs.dcerpc.rpc;
21  
22  /**
23   * <a href="NetlogonIdentityInfo.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Marcellus Tavares
26   */
27  public class NetlogonIdentityInfo extends NdrObject {
28  
29      public NetlogonIdentityInfo(
30          String logonDomainName, int parameterControl, int reservedLow,
31          int reservedHigh, String userName, String workstation) {
32  
33          _logonDomainName = new UnicodeString(logonDomainName, false);
34          _parameterControl= parameterControl;
35          _reservedLow = reservedLow;
36          _reservedHigh = reservedHigh;
37          _userName = new UnicodeString(userName, false);
38          _workstation = new UnicodeString(workstation, false);
39      }
40  
41      public void decode(NdrBuffer ndrBuffer) {
42      }
43  
44      public void encode(NdrBuffer ndrBuffer) {
45          ndrBuffer.enc_ndr_short(_logonDomainName.length);
46          ndrBuffer.enc_ndr_short(_logonDomainName.maximum_length);
47          ndrBuffer.enc_ndr_referent(_logonDomainName.buffer, 1);
48          ndrBuffer.enc_ndr_long(_parameterControl);
49          ndrBuffer.enc_ndr_long(_reservedLow);
50          ndrBuffer.enc_ndr_long(_reservedHigh);
51          ndrBuffer.enc_ndr_short(_userName.length);
52          ndrBuffer.enc_ndr_short(_userName.maximum_length);
53          ndrBuffer.enc_ndr_referent(_userName.buffer, 1);
54          ndrBuffer.enc_ndr_short(_workstation.length);
55          ndrBuffer.enc_ndr_short(_workstation.maximum_length);
56          ndrBuffer.enc_ndr_referent(_workstation.buffer, 1);
57      }
58  
59      public void encodeLogonDomainName(NdrBuffer ndrBuffer) {
60          encodeUnicodeString(ndrBuffer, _logonDomainName);
61      }
62  
63      public void encodeUserName(NdrBuffer ndrBuffer) {
64          encodeUnicodeString(ndrBuffer, _userName);
65      }
66  
67      public void encodeWorkStationName(NdrBuffer ndrBuffer) {
68          encodeUnicodeString(ndrBuffer, _workstation);
69      }
70  
71      protected void encodeUnicodeString(
72          NdrBuffer ndrBuffer, rpc.unicode_string string ) {
73  
74          ndrBuffer = ndrBuffer.deferred;
75  
76          int stringBufferl = string.length / 2;
77          int stringBuffers = string.maximum_length / 2;
78  
79          ndrBuffer.enc_ndr_long(stringBuffers);
80          ndrBuffer.enc_ndr_long(0);
81          ndrBuffer.enc_ndr_long(stringBufferl);
82  
83          int stringBufferIndex = ndrBuffer.index;
84  
85          ndrBuffer.advance(2 * stringBufferl);
86  
87          ndrBuffer = ndrBuffer.derive(stringBufferIndex);
88  
89          for (int _i = 0; _i < stringBufferl; _i++) {
90              ndrBuffer.enc_ndr_short(string.buffer[_i]);
91          }
92      }
93  
94      private rpc.unicode_string _logonDomainName;
95      private int _parameterControl;
96      private int _reservedHigh;
97      private int _reservedLow;
98      private rpc.unicode_string _userName;
99      private rpc.unicode_string _workstation;
100 
101 }