utility/SSHSessionUtil.cpp
bool userAuthorize(CSSHSession &session)
    {
        int authorizationMethod;
        if (session.userAuthorizationNone() == SSH_AUTH_SUCCESS)
        {
            return (true);
        }
        authorizationMethod = session.userAuthorizationList();
        if (authorizationMethod & SSH_AUTH_METHOD_NONE)
        {
            if (session.userAuthorizationNone() == SSH_AUTH_SUCCESS)
            {
                return (true);
            }
        }
        if (authorizationMethod & SSH_AUTH_METHOD_PUBLICKEY)
        {
            if (session.userAuthorizationWithPublicKeyAuto() == SSH_AUTH_SUCCESS)
            {
                return (true);
            }
        }
        if (authorizationMethod & SSH_AUTH_METHOD_INTERACTIVE)
        {
            if (session.userAuthorizationWithKeyboardInteractive() == SSH_AUTH_SUCCESS)
            {
                return (true);
            }
        }
        if (authorizationMethod & SSH_AUTH_METHOD_PASSWORD)
        {
            if (session.userAuthorizationWithPassword() == SSH_AUTH_SUCCESS)
            {
                return (true);
            }
        }
        return (false);
    }
//
// Authorize a user(client) with SSH server. It gets a list of methods supported
// by the server and tries each one until it passes (returning true).If none are
// successful then return false. As a fall back alway try password last.
//
Authorize a user(client) with SSH server. It gets a list of methods supported
by the server and tries each one until it passes (returning true).If none are
successful then return false. As a fall back alway try password last.
Authorize a user ( client ) with SSH server . It gets a list of methods supported by the server and tries each one until it passes ( returning true ) . If none are successful then return false . As a fall back alway try password last .
bool userAuthorize(CSSHSession &session)
    {
        int authorizationMethod;
        if (session.userAuthorizationNone() == SSH_AUTH_SUCCESS)
        {
            return (true);
        }
        authorizationMethod = session.userAuthorizationList();
        if (authorizationMethod & SSH_AUTH_METHOD_NONE)
        {
            if (session.userAuthorizationNone() == SSH_AUTH_SUCCESS)
            {
                return (true);
            }
        }
        if (authorizationMethod & SSH_AUTH_METHOD_PUBLICKEY)
        {
            if (session.userAuthorizationWithPublicKeyAuto() == SSH_AUTH_SUCCESS)
            {
                return (true);
            }
        }
        if (authorizationMethod & SSH_AUTH_METHOD_INTERACTIVE)
        {
            if (session.userAuthorizationWithKeyboardInteractive() == SSH_AUTH_SUCCESS)
            {
                return (true);
            }
        }
        if (authorizationMethod & SSH_AUTH_METHOD_PASSWORD)
        {
            if (session.userAuthorizationWithPassword() == SSH_AUTH_SUCCESS)
            {
                return (true);
            }
        }
        return (false);
    }
bool userAuthorize ( CSSHSession & session ) { int authorizationMethod ; if ( session . userAuthorizationNone ( ) == SSH_AUTH_SUCCESS ) { return ( true ) ; } authorizationMethod = session . userAuthorizationList ( ) ; if ( authorizationMethod & SSH_AUTH_METHOD_NONE ) { if ( session . userAuthorizationNone ( ) == SSH_AUTH_SUCCESS ) { return ( true ) ; } } if ( authorizationMethod & SSH_AUTH_METHOD_PUBLICKEY ) { if ( session . userAuthorizationWithPublicKeyAuto ( ) == SSH_AUTH_SUCCESS ) { return ( true ) ; } } if ( authorizationMethod & SSH_AUTH_METHOD_INTERACTIVE ) { if ( session . userAuthorizationWithKeyboardInteractive ( ) == SSH_AUTH_SUCCESS ) { return ( true ) ; } } if ( authorizationMethod & SSH_AUTH_METHOD_PASSWORD ) { if ( session . userAuthorizationWithPassword ( ) == SSH_AUTH_SUCCESS ) { return ( true ) ; } } return ( false ) ; }
Authorize a user(client) with SSH server.
Authorize a user ( client ) with SSH server .