Added option to set log_verbosity in the server.
Этот коммит содержится в:
родитель
2523ed0779
Коммит
7b7280e728
@ -107,6 +107,7 @@ struct ssh_bind_struct {
|
||||
char *bindaddr;
|
||||
socket_t bindfd;
|
||||
unsigned int bindport;
|
||||
unsigned int log_verbosity;
|
||||
|
||||
int blocking;
|
||||
int toaccept;
|
||||
|
@ -43,7 +43,9 @@ enum ssh_bind_options_e {
|
||||
SSH_BIND_OPTIONS_HOSTKEY,
|
||||
SSH_BIND_OPTIONS_DSAKEY,
|
||||
SSH_BIND_OPTIONS_RSAKEY,
|
||||
SSH_BIND_OPTIONS_BANNER
|
||||
SSH_BIND_OPTIONS_BANNER,
|
||||
SSH_BIND_OPTIONS_LOG_VERBOSITY,
|
||||
SSH_BIND_OPTIONS_LOG_VERBOSITY_STR
|
||||
};
|
||||
|
||||
//typedef struct ssh_bind_struct SSH_BIND;
|
||||
|
@ -677,6 +677,33 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type,
|
||||
sshbind->bindport = i & 0xffff;
|
||||
}
|
||||
break;
|
||||
case SSH_BIND_OPTIONS_LOG_VERBOSITY:
|
||||
if (value == NULL) {
|
||||
ssh_set_error_invalid(sshbind, __FUNCTION__);
|
||||
return -1;
|
||||
} else {
|
||||
int *x = (int *) value;
|
||||
sshbind->log_verbosity = *x & 0xffff;
|
||||
}
|
||||
break;
|
||||
case SSH_BIND_OPTIONS_LOG_VERBOSITY_STR:
|
||||
if (value == NULL) {
|
||||
sshbind->log_verbosity = 0;
|
||||
} else {
|
||||
q = strdup(value);
|
||||
if (q == NULL) {
|
||||
ssh_set_error_oom(sshbind);
|
||||
return -1;
|
||||
}
|
||||
i = strtol(q, &p, 10);
|
||||
if (q == p) {
|
||||
SAFE_FREE(q);
|
||||
}
|
||||
SAFE_FREE(q);
|
||||
|
||||
sshbind->log_verbosity = i & 0xffff;
|
||||
}
|
||||
break;
|
||||
case SSH_BIND_OPTIONS_DSAKEY:
|
||||
if (value == NULL) {
|
||||
ssh_set_error_invalid(sshbind, __FUNCTION__);
|
||||
|
@ -131,6 +131,8 @@ ssh_bind ssh_bind_new(void) {
|
||||
ZERO_STRUCTP(ptr);
|
||||
ptr->bindfd = -1;
|
||||
ptr->bindport= 22;
|
||||
ptr->log_verbosity = 0;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -229,10 +231,6 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
|
||||
session->server = 1;
|
||||
session->version = 2;
|
||||
|
||||
/* TODO: is wanted methods enough? */
|
||||
#if 0
|
||||
session->options = ssh_options_copy(sshbind->options);
|
||||
#endif
|
||||
/* copy options */
|
||||
for (i = 0; i < 10; ++i) {
|
||||
if (sshbind->wanted_methods[i]) {
|
||||
@ -255,9 +253,9 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
|
||||
return SSH_ERROR;
|
||||
}
|
||||
}
|
||||
/* TODO FIXME this doesn't work
|
||||
session->log_verbosity = session->options->log_verbosity;
|
||||
*/
|
||||
|
||||
session->log_verbosity = sshbind->log_verbosity;
|
||||
|
||||
ssh_socket_free(session->socket);
|
||||
session->socket = ssh_socket_new(session);
|
||||
if (session->socket == NULL) {
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user