This commit is contained in:
empathetic-alligator 2014-12-16 19:43:36 -05:00
commit 96828c25ac
3 changed files with 6 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
host_key host_key
host_key.pub host_key.pub
ssh-chat ssh-chat
*.log

View File

@ -95,7 +95,7 @@ func (c *Client) ColoredName() string {
// SysMsg sends a message in continuous format over the message channel // SysMsg sends a message in continuous format over the message channel
func (c *Client) SysMsg(msg string, args ...interface{}) { func (c *Client) SysMsg(msg string, args ...interface{}) {
c.Msg <- ContinuousFormat(systemMessageFormat, "-> "+fmt.Sprintf(msg, args...)) c.Send(ContinuousFormat(systemMessageFormat, "-> "+fmt.Sprintf(msg, args...)))
} }
// Write writes the given message // Write writes the given message
@ -256,7 +256,7 @@ func (c *Client) handleShell(channel ssh.Channel) {
c.SysMsg("Missing $NAME from: /nick $NAME") c.SysMsg("Missing $NAME from: /nick $NAME")
} }
case "/whois": case "/whois":
if len(parts) == 2 { if len(parts) >= 2 {
client := c.Server.Who(parts[1]) client := c.Server.Who(parts[1])
if client != nil { if client != nil {
version := reStripText.ReplaceAllString(string(client.Conn.ClientVersion()), "") version := reStripText.ReplaceAllString(string(client.Conn.ClientVersion()), "")

View File

@ -80,6 +80,9 @@ func NewServer(privateKey []byte) (*Server, error) {
perm := &ssh.Permissions{Extensions: map[string]string{"fingerprint": fingerprint}} perm := &ssh.Permissions{Extensions: map[string]string{"fingerprint": fingerprint}}
return perm, nil return perm, nil
}, },
KeyboardInteractiveCallback: func(conn ssh.ConnMetadata, challenge ssh.KeyboardInteractiveChallenge) (*ssh.Permissions, error) {
return nil, nil
},
} }
config.AddHostKey(signer) config.AddHostKey(signer)