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.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      public void decode_out(NdrBuffer ndrBuffer) throws NdrException {
50          int returnAuthenticator = ndrBuffer.dec_ndr_long();
51  
52          if (returnAuthenticator > 0) {
53              _returnAuthenticator.decode(ndrBuffer);
54          }
55  
56          ndrBuffer.dec_ndr_short();
57  
58          int validationInformation = ndrBuffer.dec_ndr_long();
59  
60          if (validationInformation > 0) {
61              ndrBuffer = ndrBuffer.deferred;
62              _validationInformation.decode(ndrBuffer);
63          }
64  
65          _authoritative = (byte)ndrBuffer.dec_ndr_small();
66          _status = ndrBuffer.dec_ndr_long();
67      }
68      public void encode_in(NdrBuffer ndrBuffer) {
69          ndrBuffer.enc_ndr_referent(_logonServer, 1);
70          ndrBuffer.enc_ndr_string(_logonServer);
71  
72          ndrBuffer.enc_ndr_referent(_computerName, 1);
73          ndrBuffer.enc_ndr_string(_computerName);
74  
75          ndrBuffer.enc_ndr_referent(_authenticator, 1);
76  
77          _authenticator.encode(ndrBuffer);
78  
79          ndrBuffer.enc_ndr_referent(_returnAuthenticator, 1);
80  
81          _returnAuthenticator.encode(ndrBuffer);
82  
83          ndrBuffer.enc_ndr_short(_logonLevel);
84          ndrBuffer.enc_ndr_short(_logonLevel);
85  
86          ndrBuffer.enc_ndr_referent(_logonInformation, 1);
87  
88          _logonInformation.encode(ndrBuffer);
89  
90          ndrBuffer.enc_ndr_short(_validationLevel);
91      }
92  
93      public NetlogonValidationSamInfo getNetlogonValidationSamInfo() {
94          return _validationInformation;
95      }
96  
97      public int getOpnum() {
98          return 2;
99      }
100 
101     public int getStatus() {
102         return _status;
103     }
104 
105     private NetlogonAuthenticator _authenticator;
106 
107     @SuppressWarnings("unused")
108     private byte _authoritative;
109 
110     private String _computerName;
111     private NetlogonNetworkInfo _logonInformation;
112     private short _logonLevel;
113     private String _logonServer;
114     private NetlogonAuthenticator _returnAuthenticator;
115     private int _status;
116     private NetlogonValidationSamInfo _validationInformation;
117     private short _validationLevel;
118 
119 }