1
1

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>
Этот коммит содержится в:
Ruben Garcia Azuara 2010-04-06 19:39:41 +02:00 коммит произвёл Andreas Schneider
родитель b2b7bc3b77
Коммит 14eb593af3
5 изменённых файлов: 27 добавлений и 33 удалений

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

@ -165,7 +165,7 @@ enum ssh_requests_e {
SSH_REQUEST_CHANNEL_OPEN, SSH_REQUEST_CHANNEL_OPEN,
SSH_REQUEST_CHANNEL, SSH_REQUEST_CHANNEL,
SSH_REQUEST_SERVICE, SSH_REQUEST_SERVICE,
SSH_REQUEST_GLOBAL, SSH_REQUEST_GLOBAL
}; };
enum ssh_channel_type_e { enum ssh_channel_type_e {
@ -183,7 +183,7 @@ enum ssh_channel_requests_e {
SSH_CHANNEL_REQUEST_SHELL, SSH_CHANNEL_REQUEST_SHELL,
SSH_CHANNEL_REQUEST_ENV, SSH_CHANNEL_REQUEST_ENV,
SSH_CHANNEL_REQUEST_SUBSYSTEM, SSH_CHANNEL_REQUEST_SUBSYSTEM,
SSH_CHANNEL_REQUEST_WINDOW_CHANGE, SSH_CHANNEL_REQUEST_WINDOW_CHANGE
}; };
enum ssh_publickey_state_e { enum ssh_publickey_state_e {
@ -204,7 +204,7 @@ enum ssh_server_known_e {
SSH_SERVER_KNOWN_OK, SSH_SERVER_KNOWN_OK,
SSH_SERVER_KNOWN_CHANGED, SSH_SERVER_KNOWN_CHANGED,
SSH_SERVER_FOUND_OTHER, SSH_SERVER_FOUND_OTHER,
SSH_SERVER_FILE_NOT_FOUND, SSH_SERVER_FILE_NOT_FOUND
}; };
#ifndef MD5_DIGEST_LEN #ifndef MD5_DIGEST_LEN

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

@ -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_append(struct ssh_list *list, const void *data);
int ssh_list_prepend(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); 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); const void *_ssh_list_pop_head(struct ssh_list *list);

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

@ -183,12 +183,14 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
switch (opcode) { switch (opcode) {
case SOC_HOST: case SOC_HOST:
*parsing = 0; *parsing = 0;
char* lowerhost = (session->host) ? ssh_lowercase(session->host) : NULL;
for (p = ssh_config_get_str(&s, NULL); p && *p; for (p = ssh_config_get_str(&s, NULL); p && *p;
p = ssh_config_get_str(&s, NULL)) { p = ssh_config_get_str(&s, NULL)) {
if (match_hostname(session->host, p, strlen(p))) { if (match_hostname(lowerhost, p, strlen(p))) {
*parsing = 1; *parsing = 1;
} }
} }
SAFE_FREE(lowerhost);
break; break;
case SOC_HOSTNAME: case SOC_HOSTNAME:
p = ssh_config_get_str(&s, NULL); p = ssh_config_get_str(&s, NULL);

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

@ -1230,34 +1230,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 * @internal
* *
@ -1627,7 +1599,7 @@ int ssh_is_server_known(ssh_session session) {
return SSH_SERVER_ERROR; return SSH_SERVER_ERROR;
} }
host = lowercase(session->host); host = ssh_lowercase(session->host);
if (host == NULL) { if (host == NULL) {
ssh_set_error(session, SSH_FATAL, "Not enough space!"); ssh_set_error(session, SSH_FATAL, "Not enough space!");
leave_function(); leave_function();

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

@ -121,6 +121,25 @@ int gettimeofday(struct timeval *__p, void *__t) {
#define NSS_BUFLEN_PASSWD 4096 #define NSS_BUFLEN_PASSWD 4096
#endif #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 *ssh_get_user_home_dir(void) {
char *szPath = NULL; char *szPath = NULL;
struct passwd pwd; struct passwd pwd;