mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 03:49:20 +03:00
Fix compilation with latest libssh trunk.
This commit is contained in:
parent
b54e952efe
commit
1cb6ae6fca
1 changed files with 14 additions and 4 deletions
|
@ -142,7 +142,8 @@ static int _sftp_connect(const char *uri) {
|
||||||
char *host = NULL;
|
char *host = NULL;
|
||||||
unsigned int port = 0;
|
unsigned int port = 0;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
unsigned char hash[MD5_DIGEST_LEN];
|
unsigned char *hash = NULL;
|
||||||
|
int hlen;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
int auth = SSH_AUTH_ERROR;
|
int auth = SSH_AUTH_ERROR;
|
||||||
int state = SSH_SERVER_ERROR;
|
int state = SSH_SERVER_ERROR;
|
||||||
|
@ -213,7 +214,15 @@ static int _sftp_connect(const char *uri) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_get_pubkey_hash(ssh_session, hash);
|
hlen = ssh_get_pubkey_hash(ssh_session, &hash);
|
||||||
|
if (hlen < 0) {
|
||||||
|
fprintf(stderr, "csync_sftp - error connecting to the server: %s\n",
|
||||||
|
ssh_get_error(ssh_session));
|
||||||
|
ssh_disconnect(ssh_session);
|
||||||
|
ssh_session = NULL;
|
||||||
|
ssh_finalize();
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* check the server public key hash */
|
/* check the server public key hash */
|
||||||
state = ssh_is_server_known(ssh_session);
|
state = ssh_is_server_known(ssh_session);
|
||||||
|
@ -222,7 +231,7 @@ static int _sftp_connect(const char *uri) {
|
||||||
break;
|
break;
|
||||||
case SSH_SERVER_KNOWN_CHANGED:
|
case SSH_SERVER_KNOWN_CHANGED:
|
||||||
fprintf(stderr, "csync_sftp - host key for server changed : server's one is now:\n");
|
fprintf(stderr, "csync_sftp - host key for server changed : server's one is now:\n");
|
||||||
ssh_print_hexa("csync_sftp - public key hash", hash, MD5_DIGEST_LEN);
|
ssh_print_hexa("csync_sftp - public key hash", hash, hlen);
|
||||||
fprintf(stderr,"csync_sftp - for security reason, connection will be stopped\n");
|
fprintf(stderr,"csync_sftp - for security reason, connection will be stopped\n");
|
||||||
ssh_disconnect(ssh_session);
|
ssh_disconnect(ssh_session);
|
||||||
ssh_session = NULL;
|
ssh_session = NULL;
|
||||||
|
@ -250,7 +259,7 @@ static int _sftp_connect(const char *uri) {
|
||||||
char *prompt;
|
char *prompt;
|
||||||
char buf[4] = {0};
|
char buf[4] = {0};
|
||||||
|
|
||||||
hexa = ssh_get_hexa(hash, MD5_DIGEST_LEN);
|
hexa = ssh_get_hexa(hash, hlen);
|
||||||
if (hexa == NULL) {
|
if (hexa == NULL) {
|
||||||
ssh_disconnect(ssh_session);
|
ssh_disconnect(ssh_session);
|
||||||
ssh_session = NULL;
|
ssh_session = NULL;
|
||||||
|
@ -389,6 +398,7 @@ out:
|
||||||
SAFE_FREE(passwd);
|
SAFE_FREE(passwd);
|
||||||
SAFE_FREE(host);
|
SAFE_FREE(host);
|
||||||
SAFE_FREE(path);
|
SAFE_FREE(path);
|
||||||
|
SAFE_FREE(hash);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue