This should actually fix rmichela#10
This commit is contained in:
		
							parent
							
								
									1b4c7c2304
								
							
						
					
					
						commit
						0afba39d57
					
				
							
								
								
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							| @ -6,7 +6,7 @@ | ||||
| 
 | ||||
|     <groupId>com.ryanmichela</groupId> | ||||
|     <artifactId>sshd</artifactId> | ||||
|     <version>1.3.6</version> | ||||
|     <version>1.3.6.1</version> | ||||
|     <url>https://github.com/Justasic/Bukkit-SSHD/</url> | ||||
| 
 | ||||
|     <properties> | ||||
|  | ||||
| @ -67,8 +67,7 @@ public class ConsoleLogFormatter extends Formatter { | ||||
|         return result; | ||||
| 	} | ||||
| 
 | ||||
|   public | ||||
| 	String format(LogRecord logrecord) | ||||
|   	public String format(LogRecord logrecord) | ||||
| 	{ | ||||
| 		try | ||||
| 		{ | ||||
|  | ||||
| @ -138,7 +138,7 @@ public class ConsoleShellFactory implements ShellFactory { | ||||
| 						this.ConsoleReader.clearScreen(); | ||||
| 						continue; | ||||
| 					} | ||||
| 					// Hide the mkpasswd command input. | ||||
| 					// Hide the mkpasswd command input from other users. | ||||
| 					Boolean mkpasswd = command.split(" ")[0].equals("mkpasswd"); | ||||
| 
 | ||||
| 					Bukkit.getScheduler().runTask( | ||||
| @ -153,17 +153,12 @@ public class ConsoleShellFactory implements ShellFactory { | ||||
| 							else | ||||
| 							{ | ||||
| 								if (!mkpasswd) | ||||
| 								{ | ||||
| 									SshdPlugin.instance.getLogger().info("<" + this.Username + "> <" + (mkpasswd ? "True": "False") + "> " + command); | ||||
| 									SshdPlugin.instance.getLogger().info("<" + this.Username + "> " + command); | ||||
| 									 | ||||
| 								} | ||||
| 								Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); | ||||
| 							} | ||||
| 						}); | ||||
| 				} | ||||
| 				// This should help stop one of the bugs where bytes are waiting to be written | ||||
| 				// but the client fucked off already so the plugin throws an exception. | ||||
| 				((Logger)LogManager.getRootLogger()).removeAppender(this.streamHandlerAppender); | ||||
| 			} | ||||
| 			catch (IOException e) | ||||
| 			{ | ||||
|  | ||||
| @ -1,49 +1,59 @@ | ||||
| package com.ryanmichela.sshd; | ||||
| 
 | ||||
| import org.apache.sshd.common.SshException; | ||||
| import org.apache.sshd.common.channel.exception.SshChannelClosedException; | ||||
| 
 | ||||
| import java.io.IOException; | ||||
| import java.io.OutputStream; | ||||
| import java.math.BigInteger; | ||||
| 
 | ||||
| /** | ||||
|  * Copyright 2013 Ryan Michela | ||||
|  */ | ||||
| public class FlushyOutputStream extends OutputStream { | ||||
| public class FlushyOutputStream extends OutputStream  | ||||
| { | ||||
| 
 | ||||
| 	private OutputStream base; | ||||
| 	private boolean isClosed = false; | ||||
| 
 | ||||
| 	public FlushyOutputStream(OutputStream base) { | ||||
| 	public FlushyOutputStream(OutputStream base)  | ||||
| 	{ | ||||
| 		this.base = base; | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void write(int b) throws IOException { | ||||
| 		if (isClosed) return; | ||||
| 		base.write(b); | ||||
| 		base.flush(); | ||||
| 	public void write(int b) throws IOException  | ||||
| 	{ | ||||
| 		this.write(BigInteger.valueOf(b).toByteArray()); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void write(byte[] b) throws IOException { | ||||
| 		if (isClosed) return; | ||||
| 		base.write(b); | ||||
| 		base.flush(); | ||||
| 	public void write(byte[] b) throws IOException  | ||||
| 	{ | ||||
| 		this.write(b, 0, b.length); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void write(byte[] b, int off, int len) throws IOException { | ||||
| 		if (isClosed) return; | ||||
| 		try { | ||||
| 	public void write(byte[] b, int off, int len) throws IOException  | ||||
| 	{ | ||||
| 		if (isClosed) | ||||
| 			return; | ||||
| 
 | ||||
| 		try  | ||||
| 		{ | ||||
| 			base.write(b, off, len); | ||||
| 			base.flush(); | ||||
| 		} catch (SshException e) { | ||||
| 			if (!e.getMessage().contains("channel already closed")) throw e; | ||||
| 		} | ||||
| 		catch (SshChannelClosedException e) | ||||
| 		{ | ||||
| 			// ignored. | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void close() { | ||||
| 	public void close() throws IOException | ||||
| 	{ | ||||
| 		isClosed = true; | ||||
| 		base.close(); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -39,7 +39,6 @@ class MkpasswdCommand implements CommandExecutor | ||||
|                     // Dumb but whatever. Some people are really dense. | ||||
| 					if (algoritm.equalsIgnoreCase("PLAIN")) | ||||
| 					{ | ||||
| 						sender.sendMessage("Your hash: " + password); | ||||
| 						// I mean c'mon... | ||||
| 						sender.sendMessage("Bro really? it's literally your unencrypted password..."); | ||||
| 					} | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Justin Crawford
						Justin Crawford