mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-02 22:26:35 +03:00
ssh_ping: Ignore system-wide configuration
Ignore the system-wide configuration when simply trying to reach the host. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
6bd2b93f43
commit
3aea2ad53f
@ -16,6 +16,7 @@ clients must be made or how a client should react.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <libssh/libssh.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@ -24,6 +25,8 @@ int main(int argc, char **argv)
|
||||
ssh_session session = NULL;
|
||||
int rc = 1;
|
||||
|
||||
bool process_config = false;
|
||||
|
||||
if (argc < 1 || argv[1] == NULL) {
|
||||
fprintf(stderr, "Error: Need an argument (hostname)\n");
|
||||
goto out;
|
||||
@ -45,6 +48,12 @@ int main(int argc, char **argv)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Ignore system-wide configurations when simply trying to reach host */
|
||||
rc = ssh_options_set(session, SSH_OPTIONS_PROCESS_CONFIG, &process_config);
|
||||
if (rc < 0) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = ssh_connect(session);
|
||||
if (rc != SSH_OK) {
|
||||
fprintf(stderr, "Connection failed : %s\n", ssh_get_error(session));
|
||||
|
Reference in New Issue
Block a user