-- | Authenticate a session with a pair username / password.
authenticateWithPassword :: Session -- ^ Session to use
                         -> String  -- ^ Username
                         -> String  -- ^ Password
                         -> SimpleSSH Session
authenticateWithPassword session username password = liftIOEither $ do
  usernameC <- newCString username
  passwordC <- newCString password

  res <- liftEitherC (return . Session) $ authenticatePasswordC session usernameC passwordC

  free usernameC
  free passwordC

  return res

-- ^ Authenticate with a public key for a given username.
--
-- Leave the passphrase empty if not needed.
authenticateWithPassword :: Session -- ^ Session to use
                         -> String  -- ^ Username
                         -> String  -- ^ Password
                         -> SimpleSSH Session
authenticateWithPassword session username password = liftIOEither $ do
  usernameC <- newCString username
  passwordC <- newCString password

  res <- liftEitherC (return . Session) $ authenticatePasswordC session usernameC passwordC

  free usernameC
  free passwordC

  return res

-- ^ Authenticate with a public key for a given username.
--
-- Leave the passphrase empty if not needed.
authenticateWithPassword session username password = liftIOEither $ do
  usernameC <- newCString username
  passwordC <- newCString password

  res <- liftEitherC (return . Session) $ authenticatePasswordC session usernameC passwordC

  free usernameC
  free passwordC

  return res

-- ^ Authenticate with a public key for a given username.
--
-- Leave the passphrase empty if not needed.