Evaluation version and SSH

Ask questions about any Catalyst products before purchasing a license.

Moderator: Catalyst

Evaluation version and SSH

Postby Brian Marsden » Mon Sep 07, 2009 1:14 am

I am evaluating Socket Tools Secure Library Edition. Using a normal Telnet connection I have succeeded in connecting to our server, and received the usual login screen. This is fine. However when I tell it to use a secure connection, I just get back this when I attempt to connect: "SSH-2.0-3.2.0 SSH Secure Shell OpenVMS V5.5". I had assumed that any negotiation would be carried out automatically. Am I missing something, or is SSH not fully functional in the evaluation version? Many thanks.

I'm not interested in developing a fully functional program at present, just in verifying that I can connect successfully using SSH. BTW I am using Borland CBuilder 6.

Brian
Brian Marsden
New Member
 
Posts: 9
Joined: Thu Sep 03, 2009 3:28 am
Location: Stockport, UK

Re: Evaluation version and SSH

Postby Technical Support » Mon Sep 07, 2009 9:18 am

Are you trying to use the Telnet API to establish the SSH connection? If so, that won't work because it only understands that particular protocol. For an SSH connection, you need to use the SSH client API. It's similar to Telnet in terms of how it works overall, but it is a different library. The documentation for the API is available on our website here. If you continue to have problems with it, please post the code for the call that you're making to the SshConnect function.
Technical Support
Knowledge Base | FAQs | Online Help
Technical Support
Catalyst
 
Posts: 2288
Joined: Mon Dec 27, 2004 3:38 am
Location: California

Re: Evaluation version and SSH

Postby Brian Marsden » Tue Sep 08, 2009 7:35 am

Hi Mike

For some reason I had version 5. The help file for that version did not contain any documentation for the Secure Shell Protocol, nor was there a CSTSHAV5.DLL present.

I have now replaced it with version 6, and done as you suggested, but I now have another problem with the connect. The VMS machine I wish to connect to doesn't have a password set for any of the logins we use. If I send NULL or "" as the password parameter, all I get is "The specified password is invalid". I also attempted to tell it that no password was required using CreateSecurityCredentials. This call returned success but it still refused to connect, with the same error message. This is the code I wrote. All I want to do is establish a connection, and verify that the characters for the initial screen are received on the connection:

(Calling exe- Borland CBuilder 6)
Code: Select all
#define __CALL_TYPE __declspec(dllimport) WINAPI

extern int __CALL_TYPE SshRead(char *szBuffer, UINT uiSize);
extern void __CALL_TYPE SshDisconnect();
extern int __CALL_TYPE SshConn(char *szHost, char *szUsername, char *szPassword);
...
    // Can't call it SshConnect as this results in a linker error
    if (SshConn(szHost, szUsername, szPassword))
    {
        do
        {
            uiSize = SshRead(szBuffer, 256);
            if (uiSize > 0)
            {
                szBuffer[uiSize] = 0;
                sprintf(szMessage, "(%d) %s", uiSize, szBuffer);
                MessageBox(NULL, szMessage, "Data Read", MB_OK);
            }
        } while (uiSize > 0);
        SshDisconnect();
    }
    else
    {
        MessageBox(NULL, "Failed to connect", "Error", MB_ICONERROR);
    }

(called DLL - Borland CBuilder 6)

#define __CALL_TYPE __declspec(dllexport) WINAPI

extern "C" {
int __CALL_TYPE SshConn(char *szHost, char *szUsername, char *szPassword);
int __CALL_TYPE SshRead(char *szBuffer, UINT uiSize);
void __CALL_TYPE SshDisconnect();
}
...
int __CALL_TYPE SshConn(char *szHost, char *szUsername, char *szPassword)
{
    BOOL bResult;
    BOOL bPasswordRequired = TRUE;
    if (!strcmp(szPassword, ""))
    {
        // No password required
        BOOL bResult;
        bResult = m_sshClient.CreateSecurityCredentials((const char *)NULL, (const char *)NULL);
        if (!bResult)
        {
            MessageBox(NULL, "CreateSecurityCredentials failed", "Error", MB_ICONWARNING);
            return bResult;
        }
        bPasswordRequired = FALSE;
    }
    if (bPasswordRequired)
    {
        bResult = m_sshClient.Connect(
             szHost,
          0,
             szUsername,
             szPassword);
    }
    else
    {
        bResult = m_sshClient.Connect(
             szHost,
          0,
             szUsername,
             (char *) NULL);
    }

   if (!bResult)
   {
      m_sshClient.ShowError();
   }
    else
    {
        MessageBox(NULL, "Connected", "Info", MB_OK);
        m_bConnected = TRUE;
    }
    return bResult;
}

Brian
Brian Marsden
New Member
 
Posts: 9
Joined: Thu Sep 03, 2009 3:28 am
Location: Stockport, UK

Re: Evaluation version and SSH

Postby Technical Support » Tue Sep 08, 2009 8:43 am

The SSH API requires that you specify a password for authentication; I just checked the source, and if the parameter coming in is NULL or zero length, it'll immediately return ST_ERROR_INVALID_PASSWORD without even attempting to make the connection. It sounds like the VMS system may be setup with some authentication scheme that isn't supported. If that system is really wide open, without passwords on accounts, that's an incredibly bad idea of course. In any case, one of the requirements for our SSH component is that the server must support password authentication, and there must be a password associated with the account being authenticated.
Technical Support
Knowledge Base | FAQs | Online Help
Technical Support
Catalyst
 
Posts: 2288
Joined: Mon Dec 27, 2004 3:38 am
Location: California

Re: Evaluation version and SSH

Postby Brian Marsden » Tue Sep 08, 2009 9:04 am

Thanks Mike.

Time to go home over here, but I now have an account with a password and it connects successfully, which is very encouraging, but when I ask it to read up to 256 bytes it crashes with "too many stack overflows". It seems to lose the byte cound and replace it with garbage.

I'll get back you you tomorrow with more details.

Brian
Brian Marsden
New Member
 
Posts: 9
Joined: Thu Sep 03, 2009 3:28 am
Location: Stockport, UK

Re: Evaluation version and SSH

Postby Technical Support » Tue Sep 08, 2009 9:49 am

That sounds like you're either calling a function that's recursing indefinitely, or there's some bad pointers being passed around. I'd suggest taking a look at the SSH examples for C++. They're written for Visual C++, but it shouldn't be difficult to move the console examples to Borland's compiler.
Technical Support
Knowledge Base | FAQs | Online Help
Technical Support
Catalyst
 
Posts: 2288
Joined: Mon Dec 27, 2004 3:38 am
Location: California

Re: Evaluation version and SSH

Postby Brian Marsden » Wed Sep 09, 2009 2:11 am

Thanks for your help Mike. It turned out that there was a conflict between the name I was giving my read function and a function internal to SocketTools. As a result it was geting into an endless recursive loop. I've now resolved this and my demo has succeeded.

Brian
Brian Marsden
New Member
 
Posts: 9
Joined: Thu Sep 03, 2009 3:28 am
Location: Stockport, UK


Return to Pre-Purchase Questions

Who is online

Users browsing this forum: No registered users and 2 guests

cron