Home | History | Annotate | Download | only in packets
      1 /*
      2  * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
      3  * Please refer to the LICENSE.txt for licensing details.
      4  */
      5 package ch.ethz.ssh2.packets;
      6 
      7 import java.io.IOException;
      8 
      9 /**
     10  * PacketUserauthBanner.
     11  *
     12  * @author Christian Plattner
     13  * @version 2.50, 03/15/10
     14  */
     15 public class PacketUserauthFailure
     16 {
     17 	byte[] payload;
     18 
     19 	String[] authThatCanContinue;
     20 	boolean partialSuccess;
     21 
     22 	public PacketUserauthFailure(String[] authThatCanContinue, boolean partialSuccess)
     23 	{
     24 		this.authThatCanContinue = authThatCanContinue;
     25 		this.partialSuccess = partialSuccess;
     26 	}
     27 
     28 	public PacketUserauthFailure(byte payload[], int off, int len) throws IOException
     29 	{
     30 		this.payload = new byte[len];
     31 		System.arraycopy(payload, off, this.payload, 0, len);
     32 
     33 		TypesReader tr = new TypesReader(payload, off, len);
     34 
     35 		int packet_type = tr.readByte();
     36 
     37 		if (packet_type != Packets.SSH_MSG_USERAUTH_FAILURE)
     38 			throw new IOException("This is not a SSH_MSG_USERAUTH_FAILURE! (" + packet_type + ")");
     39 
     40 		authThatCanContinue = tr.readNameList();
     41 		partialSuccess = tr.readBoolean();
     42 
     43 		if (tr.remain() != 0)
     44 			throw new IOException("Padding in SSH_MSG_USERAUTH_FAILURE packet!");
     45 	}
     46 
     47 	public String[] getAuthThatCanContinue()
     48 	{
     49 		return authThatCanContinue;
     50 	}
     51 
     52 	public boolean isPartialSuccess()
     53 	{
     54 		return partialSuccess;
     55 	}
     56 }
     57