1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

Cope with 2292bis-01 getaddrinfo (no NI_WITHSCOPEID, always attach

scope identifier).

MFC after:	3 weeks
This commit is contained in:
Hajimu UMEMOTO 2002-07-02 11:11:17 +00:00
parent f8fa093e82
commit b0f06def52
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99255
2 changed files with 13 additions and 14 deletions

View File

@ -984,6 +984,7 @@ ftp_file_op(FTP_t ftp, char *operation, char *file, FILE **fp, char *mode, off_t
char *a;
char hname[INET6_ADDRSTRLEN];
sin.sin6.sin6_scope_id = 0;
if (getnameinfo((struct sockaddr *)&sin, sin.sin6.sin6_len,
hname, sizeof(hname),
NULL, 0, NI_NUMERICHOST) != 0) {

View File

@ -103,11 +103,6 @@ static const char rcsid[] =
static char version[] = "Version 6.00LS";
#undef main
/* wrapper for KAME-special getnameinfo() */
#ifndef NI_WITHSCOPEID
#define NI_WITHSCOPEID 0
#endif
extern off_t restart_point;
extern char cbuf[];
@ -1321,7 +1316,7 @@ pass(char *passwd)
getnameinfo((struct sockaddr *)&his_addr, his_addr.su_len,
remote_ip, sizeof(remote_ip) - 1, NULL, 0,
NI_NUMERICHOST|NI_WITHSCOPEID);
NI_NUMERICHOST);
remote_ip[sizeof(remote_ip) - 1] = 0;
if (!auth_hostok(lc, remotehost, remote_ip)) {
syslog(LOG_INFO|LOG_AUTH,
@ -1751,7 +1746,7 @@ dataconn(char *name, off_t size, char *mode)
getnameinfo((struct sockaddr *)&data_source,
data_source.su_len, hostbuf, sizeof(hostbuf) - 1,
portbuf, sizeof(portbuf),
NI_NUMERICHOST|NI_NUMERICSERV|NI_WITHSCOPEID);
NI_NUMERICHOST|NI_NUMERICSERV);
reply(425, "Can't create data socket (%s,%s): %s.",
hostbuf, portbuf, strerror(errno));
return (NULL);
@ -2028,15 +2023,14 @@ statcmd(void)
{
union sockunion *su;
u_char *a, *p;
char hname[INET6_ADDRSTRLEN];
char hname[NI_MAXHOST];
int ispassive;
lreply(211, "%s FTP server status:", hostname, version);
printf(" %s\r\n", version);
printf(" Connected to %s", remotehost);
if (!getnameinfo((struct sockaddr *)&his_addr, his_addr.su_len,
hname, sizeof(hname) - 1, NULL, 0,
NI_NUMERICHOST|NI_WITHSCOPEID)) {
hname, sizeof(hname) - 1, NULL, 0, NI_NUMERICHOST)) {
if (strcmp(hname, remotehost) != 0)
printf(" (%s)", hname);
}
@ -2134,12 +2128,17 @@ epsvonly:;
break;
}
if (af) {
if (!getnameinfo((struct sockaddr *)su, su->su_len,
union sockunion tmp;
tmp = *su;
if (tmp.su_family == AF_INET6)
tmp.su_sin6.sin6_scope_id = 0;
if (!getnameinfo((struct sockaddr *)&tmp, tmp.su_len,
hname, sizeof(hname) - 1, NULL, 0,
NI_NUMERICHOST)) {
printf(" %s |%d|%s|%d|\r\n",
ispassive ? "EPSV" : "EPRT",
af, hname, htons(su->su_port));
af, hname, htons(tmp.su_port));
}
}
}
@ -2348,8 +2347,7 @@ dolog(struct sockaddr *who)
error = getnameinfo(who, who->sa_len,
who_name, sizeof(who_name) - 1,
NULL, 0,
NI_NUMERICHOST|NI_WITHSCOPEID);
NULL, 0, NI_NUMERICHOST);
syslog(LOG_INFO, "connection from %s (%s)", remotehost,
error == 0 ? who_name : "");
}