anchor.diff:  								(known-hosts-writefile known-hosts (hosts-db ssh))
   								t)))))))
   
  -(defmethod authentication ((ssh ssh-connection) (auth auth-data))
  +(defmethod authentication :around ((ssh ssh-connection) (auth auth-data))
   	(if (auth-passed ssh)
   			t
   			(if (ssh-verify-session ssh)
   					(setf (auth-passed ssh)
  -								(repeat-and-wait-until-complete ((socket ssh))
  -									(authentication auth (session ssh)))))))
  +								(call-next-method)))))
  +
  +(defmethod authentication ((ssh ssh-connection) (auth auth-password))
  +	(repeat-and-wait-until-complete ((socket (session ssh)))
  +		(user-auth-password (session  ssh)
  +												(login    auth)
  +												(password auth))))
  +
  +(defclass auth-agent (auth-data) ())
  +
  +(defmethod authentication ((ssh ssh-connection) (auth auth-agent))
  +	(let ((agent (agent-init (session ssh)))
  +				(username (login auth)))
  +		(unwind-protect
  +				 (if (and agent
  +									(eq (agent-connect agent)
  +											:ERROR-NONE))
  +						 (let ((next-identity (agent-identities-iterator agent)))
  +							 (when next-identity
  +								 (with-foreign-string (fs-username username)
  +									 (loop for identity = (funcall next-identity)
  +											while identity do
  +												(if (eq
  +														 (repeat-and-wait-until-complete ((socket ssh))
  +															 (--agent-userauth agent fs-username identity))
  +														 :ERROR-NONE)
  +														(return t))))))
  +						 (throw-last-error (session ssh)))
  +			(when agent 
  +				(agent-free agent)))))
   
   (defvar *ssh-channel-buffer-size* 64)
   
  
positive.code: 										(co-end (if nl-pos nl-pos (input-size stream))))
  							 ;; Save substring or whole vector if any
  							 (when (> (input-size stream) 0)
  								 (push (babel:octets-to-string (input-buffer stream) 
  																							 :start (input-pos stream)
  																							 :end   co-end)
  											 output))
  							 
  							 (if nl-pos
  									 ;; If newline found - save position and return concatenated string
  									 (prog1
  											 (apply #'concatenate
  															(cons 'string
  																		(reverse output)))
  										 (setf (input-pos stream) (+ 1 co-end))
  										 (setf output '()))
  									 
  
negative.code: 														fs-username username-length
  														fs-password password-length
  														callback))))
  
  (defctype +channel+ :pointer)
  (defcfun ("libssh2_channel_open_ex" --channel-open-ex) +channel+
  	(session +session+) (channel-type :string) (channel-type-length :unsigned-int)
  