1
1

options: Provide a way of disabling automatic config parsing

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Jakub Jelen 2018-10-30 16:19:19 +01:00 коммит произвёл Andreas Schneider
родитель 89a8a6fcf0
Коммит b7fefb0500
2 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -405,6 +405,7 @@ enum ssh_options_e {
SSH_OPTIONS_GLOBAL_KNOWNHOSTS, SSH_OPTIONS_GLOBAL_KNOWNHOSTS,
SSH_OPTIONS_NODELAY, SSH_OPTIONS_NODELAY,
SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES, SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES,
SSH_OPTIONS_PROCESS_CONFIG,
}; };
enum { enum {

Просмотреть файл

@ -421,6 +421,12 @@ int ssh_options_set_algo(ssh_session session,
* Set it to disable Nagle's Algorithm (TCP_NODELAY) on the * Set it to disable Nagle's Algorithm (TCP_NODELAY) on the
* session socket. (int, 0=false) * session socket. (int, 0=false)
* *
* - SSH_OPTIONS_PROCESS_CONFIG
* Set it to false to disable automatic processing of per-user
* and system-wide OpenSSH configuration files. LibSSH
* automatically uses these configuration files unless
* you provide it with this option or with different file (bool).
*
* @param value The value to set. This is a generic pointer and the * @param value The value to set. This is a generic pointer and the
* datatype which is used should be set according to the * datatype which is used should be set according to the
* type set. * type set.
@ -954,6 +960,15 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
session->opts.nodelay = (*x & 0xff) > 0 ? 1 : 0; session->opts.nodelay = (*x & 0xff) > 0 ? 1 : 0;
} }
break; break;
case SSH_OPTIONS_PROCESS_CONFIG:
if (value == NULL) {
ssh_set_error_invalid(session);
return -1;
} else {
bool *x = (bool *)value;
session->opts.config_processed = !(*x);
}
break;
default: default:
ssh_set_error(session, SSH_REQUEST_DENIED, "Unknown ssh option %d", type); ssh_set_error(session, SSH_REQUEST_DENIED, "Unknown ssh option %d", type);
return -1; return -1;