aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorRuben Garcia Azuara <rubenga@tid.es>2010-04-06 19:39:41 +0200
committerAndreas Schneider <mail@cynapses.org>2010-04-07 11:29:47 +0200
commit14eb593af3c41ea439f01d34aaae497d8420f316 (patch)
tree67d295bd9d704d7e66a95fad447011f9b67431ab /libssh
parentb2b7bc3b772e013a1c258dfc8d326d2f15e569a3 (diff)
downloadlibssh-14eb593af3c41ea439f01d34aaae497d8420f316.tar.gz
libssh-14eb593af3c41ea439f01d34aaae497d8420f316.tar.xz
libssh-14eb593af3c41ea439f01d34aaae497d8420f316.zip
Fixed solaris compilation warning and ignore case at host parameter.
- Suppress compilation warning in solaris caused by a comma at the end of the last value. - Ignore case at host parameter in config file Signed-off-by: Ruben Garcia Azuara <rubenga@tid.es> Signed-off-by: Andreas Schneider <mail@cynapses.org>
Diffstat (limited to 'libssh')
-rw-r--r--libssh/config.c4
-rw-r--r--libssh/keyfiles.c30
-rw-r--r--libssh/misc.c19
3 files changed, 23 insertions, 30 deletions
diff --git a/libssh/config.c b/libssh/config.c
index e3a00ca6..beb21fc5 100644
--- a/libssh/config.c
+++ b/libssh/config.c
@@ -183,12 +183,14 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
switch (opcode) {
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);
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index 663d508f..e09de675 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 8ca37646..4489eb69 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;