diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-01 00:40:10 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-01 00:40:10 +0200 |
commit | 22be109956d0fe66e09bf9b13d1d2a37f7678cba (patch) | |
tree | 9364d0036cad69880094367e6f9b632445cd0782 /libssh/misc.c | |
parent | 4bb790fb5de3d64097cae77955a96260d11ae3db (diff) | |
download | libssh-22be109956d0fe66e09bf9b13d1d2a37f7678cba.tar.gz libssh-22be109956d0fe66e09bf9b13d1d2a37f7678cba.tar.xz libssh-22be109956d0fe66e09bf9b13d1d2a37f7678cba.zip |
First implementation of known_hosts with port read
Diffstat (limited to 'libssh/misc.c')
-rw-r--r-- | libssh/misc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libssh/misc.c b/libssh/misc.c index 6ae391f..ff44fb5 100644 --- a/libssh/misc.c +++ b/libssh/misc.c @@ -140,6 +140,20 @@ char *ssh_lowercase(const char* str) { return new; } +char *ssh_hostport(const char *host, int port){ + char *dest; + size_t len; + if(host==NULL) + return NULL; + /* 3 for []:, 5 for 65536 and 1 for nul */ + len=strlen(host) + 3 + 5 + 1; + dest=malloc(len); + if(dest==NULL) + return NULL; + snprintf(dest,len,"[%s]:%d",host,port); + return dest; +} + char *ssh_get_user_home_dir(void) { char *szPath = NULL; struct passwd pwd; |