[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: libssh patch
[Thread Prev] | [Thread Next]
- Subject: RE: libssh patch
- From: RUBEN GARCIA AZUARA <rubenga@xxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Tue, 06 Apr 2010 20:24:36 +0200
- To: "libssh@xxxxxxxxxx" <libssh@xxxxxxxxxx>
Hi, A Fix patch. Regards ________________________________________ De: Andreas Schneider [mail@xxxxxxxxxxxx] Enviado el: lunes, 05 de abril de 2010 18:33 Para: libssh@xxxxxxxxxx Asunto: Re: libssh patch On Monday 05 April 2010 08:02:57 you wrote: > Hello, Hi, > > I am trying delivering a new patch, but I had never used git. http://dev.libssh.org/wiki/HowToSendPatches http://book.git-scm.com/ has nice video tutorials. > The first patch include a fix bug to ignore case in HOST parameter. > > The second patch add new features: Supports StrictHostKeyChecking and > UserKnownHostsFile config parameters. > > Sorry if I make some mistakes, and, please, you tell me how could solve > them. Could you please attach them to the mail? Thanks, -- andreas
From 073167b767e1505469691ecdd5e9ece314d91316 Mon Sep 17 00:00:00 2001 From: Ruben Garcia Azuara <rubenga@xxxxxx> Date: Tue, 6 Apr 2010 19:39:41 +0200 Subject: [PATCH] Fix solaris compilation warning and ignore case at host parameter Ruben Garcia Azuara, a Telefonica I+D SAU worker, deliver a patch that contains: - Suppress compilation warning in solaris caused by a coma at the end of the last value. - Ignore case at host parameter in config file Signed-off-by: Ruben Garcia Azuara <rubenga@xxxxxx> --- include/libssh/libssh.h | 6 +++--- include/libssh/misc.h | 1 + libssh/config.c | 7 +++++-- libssh/keyfiles.c | 30 +----------------------------- libssh/misc.c | 19 +++++++++++++++++++ 5 files changed, 29 insertions(+), 34 deletions(-) diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index 462be33..1968d09 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -165,7 +165,7 @@ enum ssh_requests_e { SSH_REQUEST_CHANNEL_OPEN, SSH_REQUEST_CHANNEL, SSH_REQUEST_SERVICE, - SSH_REQUEST_GLOBAL, + SSH_REQUEST_GLOBAL }; enum ssh_channel_type_e { @@ -183,7 +183,7 @@ enum ssh_channel_requests_e { SSH_CHANNEL_REQUEST_SHELL, SSH_CHANNEL_REQUEST_ENV, SSH_CHANNEL_REQUEST_SUBSYSTEM, - SSH_CHANNEL_REQUEST_WINDOW_CHANGE, + SSH_CHANNEL_REQUEST_WINDOW_CHANGE }; enum ssh_publickey_state_e { @@ -204,7 +204,7 @@ enum ssh_server_known_e { SSH_SERVER_KNOWN_OK, SSH_SERVER_KNOWN_CHANGED, SSH_SERVER_FOUND_OTHER, - SSH_SERVER_FILE_NOT_FOUND, + SSH_SERVER_FILE_NOT_FOUND }; #ifndef MD5_DIGEST_LEN diff --git a/include/libssh/misc.h b/include/libssh/misc.h index ddd72fe..d9bfccb 100644 --- a/include/libssh/misc.h +++ b/include/libssh/misc.h @@ -50,6 +50,7 @@ struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list); int ssh_list_append(struct ssh_list *list, const void *data); int ssh_list_prepend(struct ssh_list *list, const void *data); void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator); +char *ssh_lowercase(const char* str); const void *_ssh_list_pop_head(struct ssh_list *list); diff --git a/libssh/config.c b/libssh/config.c index e3a00ca..7b4a40d 100644 --- a/libssh/config.c +++ b/libssh/config.c @@ -181,15 +181,18 @@ static int ssh_config_parse_line(ssh_session session, const char *line, opcode = ssh_config_get_opcode(keyword); switch (opcode) { - case SOC_HOST: + case SOC_HOST:{ *parsing = 0; + char* lowerhost = (session->host) ? ssh_lowercase(session->host) : NULL; for (p = ssh_config_get_str(&s, NULL); p && *p; p = ssh_config_get_str(&s, NULL)) { - if (match_hostname(session->host, p, strlen(p))) { + if (match_hostname(lowerhost, p, strlen(p))) { *parsing = 1; } } + SAFE_FREE(lowerhost); break; + } case SOC_HOSTNAME: p = ssh_config_get_str(&s, NULL); if (p && *parsing) { diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c index 663d508..e09de67 100644 --- a/libssh/keyfiles.c +++ b/libssh/keyfiles.c @@ -1233,34 +1233,6 @@ static int alldigits(const char *s) { /** * @internal * - * @brief Lowercase a string. - * - * @param[in] str The string to lowercase. - * - * @return The malloced lowered string or NULL on error. - */ -static char *lowercase(const char* str) { - char *new, *p; - - if (str == NULL) { - return NULL; - } - - new = strdup(str); - if (new == NULL) { - return NULL; - } - - for (p = new; *p; p++) { - *p = tolower(*p); - } - - return new; -} - -/** - * @internal - * * @brief Free a token array. */ static void tokens_free(char **tokens) { @@ -1627,7 +1599,7 @@ int ssh_is_server_known(ssh_session session) { return SSH_SERVER_ERROR; } - host = lowercase(session->host); + host = ssh_lowercase(session->host); if (host == NULL) { ssh_set_error(session, SSH_FATAL, "Not enough space!"); leave_function(); diff --git a/libssh/misc.c b/libssh/misc.c index 8ca3764..4489eb6 100644 --- a/libssh/misc.c +++ b/libssh/misc.c @@ -121,6 +121,25 @@ int gettimeofday(struct timeval *__p, void *__t) { #define NSS_BUFLEN_PASSWD 4096 #endif +char *ssh_lowercase(const char* str) { + char *new, *p; + + if (str == NULL) { + return NULL; + } + + new = strdup(str); + if (new == NULL) { + return NULL; + } + + for (p = new; *p; p++) { + *p = tolower(*p); + } + + return new; +} + char *ssh_get_user_home_dir(void) { char *szPath = NULL; struct passwd pwd; -- 1.6.3.3
Re: libssh patch | Aris Adamantiadis <aris@xxxxxxxxxxxx> |
libssh patch | Ruben Garcia Azuara <rubenga@xxxxxx> |
Re: libssh patch | Andreas Schneider <mail@xxxxxxxxxxxx> |