mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 02:38:09 +09:00
Move ssh_hostport to a location which is global accessible.
Signed-off-by: Andreas Schneider <mail@cynapses.org>
This commit is contained in:
committed by
Andreas Schneider
parent
df5a94d445
commit
af155db080
@@ -118,20 +118,6 @@ int gettimeofday(struct timeval *__p, void *__t) {
|
|||||||
#define NSS_BUFLEN_PASSWD 4096
|
#define NSS_BUFLEN_PASSWD 4096
|
||||||
#endif
|
#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 *ssh_get_user_home_dir(void) {
|
||||||
char *szPath = NULL;
|
char *szPath = NULL;
|
||||||
struct passwd pwd;
|
struct passwd pwd;
|
||||||
@@ -159,6 +145,20 @@ int ssh_file_readaccess_ok(const char *file) {
|
|||||||
}
|
}
|
||||||
#endif
|
#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;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t ntohll(uint64_t a) {
|
uint64_t ntohll(uint64_t a) {
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
return a;
|
return a;
|
||||||
|
|||||||
Reference in New Issue
Block a user