[LCP]Cryptlib ssh problem
Joe Stuart
jstuart at edenpr.k12.mn.us
Fri Feb 27 00:48:02 UTC 2004
I'm trying to send a command to a ssh server using cryptlib. I assume
this is possible here is the code I am using.
#include <cryptlib.h>
#include <stdio.h>
int main()
{
char *serverName = "myserver.domain.org";
char *username = "mytest";
char password[12];
char *data = "cp file1 file2";
char *rdata;
int bytesCopied;
int byteSize;
int bytesIn;
CRYPT_SESSION cryptSession;
cryptInit();
/* Create the session */
cryptCreateSession( &cryptSession, CRYPT_UNUSED,
CRYPT_SESSION_SSH );
/* Add the server name, user name, and password */
cryptSetAttributeString( cryptSession,
CRYPT_SESSINFO_SERVER_NAME,
serverName, 20 );
cryptSetAttributeString( cryptSession,
CRYPT_SESSINFO_USERNAME,
username, 12 );
printf("Enter Password\n");
scanf("%s",password);
cryptSetAttributeString( cryptSession,
CRYPT_SESSINFO_PASSWORD,
password, 12 );
/* Activate the session */
cryptSetAttribute( cryptSession, CRYPT_SESSINFO_ACTIVE, 1 );
cryptPushData(cryptSession, data, 30 , &bytesCopied);
cryptFlushData(cryptSession);
cryptPopData(cryptSession, rdata, 30, &bytesIn);
cryptDestroySession(cryptSession);
cryptEnd();
}
I can login to the remote server fine but no data is being sent. I'd
appreciate it if someone could tell me what I'm doing wrong.
Thanks
More information about the linuxCprogramming
mailing list