summaryrefslogtreecommitdiffstats
path: root/libssh/misc.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-05-07 12:55:33 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-05-07 12:55:33 +0200
commite9d6b15926214706bdc46ea1eccfab812956df1e (patch)
tree7d4a45cf94698990d88a6c4b7d499b7ee8ba6a38 /libssh/misc.c
parent6885d32c05d517b32c949e17318878b1e143a83d (diff)
First implementation of known_hosts with port read
Conflicts: include/libssh/misc.h libssh/keyfiles.c libssh/misc.c
Diffstat (limited to 'libssh/misc.c')
-rw-r--r--libssh/misc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libssh/misc.c b/libssh/misc.c
index 22fb1a65..7e936e15 100644
--- a/libssh/misc.c
+++ b/libssh/misc.c
@@ -118,6 +118,20 @@ int gettimeofday(struct timeval *__p, void *__t) {
#define NSS_BUFLEN_PASSWD 4096
#endif
+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;