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.DcerpcMessage;
18  import jcifs.dcerpc.ndr.NdrBuffer;
19  import jcifs.dcerpc.ndr.NdrException;
20  
21  /**
22   * <a href="NetrLogonSamLogon.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Marcellus Tavares
25   */
26  public class NetrLogonSamLogon extends DcerpcMessage {
27  
28      public NetrLogonSamLogon(
29          String logonServer, String computerName,
30          NetlogonAuthenticator netlogonAuthenticator,
31          NetlogonAuthenticator returnNetlogonAuthenticator, int logonLevel,
32          NetlogonNetworkInfo netlogonNetworkInfo, int validationLevel,
33          NetlogonValidationSamInfo netlogonValidationSamInfo,
34          int authoritative) {
35  
36          _logonServer = logonServer;
37          _computerName = computerName;
38          _authenticator = netlogonAuthenticator;
39          _returnAuthenticator = returnNetlogonAuthenticator;
40          _logonLevel = (short)logonLevel;
41          _logonInformation = netlogonNetworkInfo;
42          _validationLevel = (short)validationLevel;
43          _validationInformation = netlogonValidationSamInfo;
44          _authoritative = (byte)authoritative;
45  
46          ptype = 0;
47          flags = DCERPC_FIRST_FRAG | DCERPC_LAST_FRAG;
48      }
49  
50      public void decode_out(NdrBuffer ndrBuffer) throws NdrException {
51          int returnAuthenticator = ndrBuffer.dec_ndr_long();
52  
53          if (returnAuthenticator > 0) {
54              _returnAuthenticator.decode(ndrBuffer);
55          }
56  
57          ndrBuffer.dec_ndr_short();
58  
59          int validationInformation = ndrBuffer.dec_ndr_long();
60  
61          if (validationInformation > 0) {
62              ndrBuffer = ndrBuffer.deferred;
63              _validationInformation.decode(ndrBuffer);
64          }
65  
66          _authoritative = (byte)ndrBuffer.dec_ndr_small();
67          _status = ndrBuffer.dec_ndr_long();
68      }
69  
70      public void encode_in(NdrBuffer ndrBuffer) {
71          ndrBuffer.enc_ndr_referent(_logonServer, 1);
72          ndrBuffer.enc_ndr_string(_logonServer);
73  
74          ndrBuffer.enc_ndr_referent(_computerName, 1);
75          ndrBuffer.enc_ndr_string(_computerName);
76  
77          ndrBuffer.enc_ndr_referent(_authenticator, 1);
78  
79          _authenticator.encode(ndrBuffer);
80  
81          ndrBuffer.enc_ndr_referent(_returnAuthenticator, 1);
82  
83          _returnAuthenticator.encode(ndrBuffer);
84  
85          ndrBuffer.enc_ndr_short(_logonLevel);
86          ndrBuffer.enc_ndr_short(_logonLevel);
87  
88          ndrBuffer.enc_ndr_referent(_logonInformation, 1);
89  
90          _logonInformation.encode(ndrBuffer);
91  
92          ndrBuffer.enc_ndr_short(_validationLevel);
93      }
94  
95      public NetlogonValidationSamInfo getNetlogonValidationSamInfo() {
96          return _validationInformation;
97      }
98  
99      public int getOpnum() {
100         return 2;
101     }
102 
103     public int getStatus() {
104         return _status;
105     }
106 
107     private NetlogonAuthenticator _authenticator;
108 
109     @SuppressWarnings("unused")
110     private byte _authoritative;
111 
112     private String _computerName;
113     private NetlogonNetworkInfo _logonInformation;
114     private short _logonLevel;
115     private String _logonServer;
116     private NetlogonAuthenticator _returnAuthenticator;
117     private int _status;
118     private NetlogonValidationSamInfo _validationInformation;
119     private short _validationLevel;
120 
121 }