Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
db70cd28
Commit
db70cd28
authored
24 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
adjusted the IPv6 stuff to compile and build on Linux as well
parent
f6e2bfd4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/ftp.c
+9
-5
9 additions, 5 deletions
lib/ftp.c
lib/strequal.c
+26
-0
26 additions, 0 deletions
lib/strequal.c
with
35 additions
and
5 deletions
lib/ftp.c
+
9
−
5
View file @
db70cd28
...
...
@@ -711,6 +711,7 @@ CURLcode _ftp(struct connectdata *conn)
int
sslen
;
char
hbuf
[
NI_MAXHOST
];
char
*
localaddr
;
struct
sockaddr
*
sa
=
(
struct
sockaddr
*
)
&
ss
;
#ifdef NI_WITHSCOPEID
const
int
niflags
=
NI_NUMERICHOST
|
NI_NUMERICSERV
|
NI_WITHSCOPEID
;
#else
...
...
@@ -737,7 +738,10 @@ CURLcode _ftp(struct connectdata *conn)
return
CURLE_FTP_PORT_FAILED
;
memset
(
&
hints
,
0
,
sizeof
(
hints
));
hints
.
ai_family
=
ss
.
ss_family
;
hints
.
ai_family
=
sa
->
sa_family
;
/*hints.ai_family = ss.ss_family;
this way can be used if sockaddr_storage is properly defined, as glibc
2.1.X doesn't do*/
hints
.
ai_socktype
=
SOCK_STREAM
;
hints
.
ai_flags
=
AI_PASSIVE
;
if
(
getaddrinfo
(
hbuf
,
"0"
,
&
hints
,
&
res
))
...
...
@@ -770,7 +774,7 @@ CURLcode _ftp(struct connectdata *conn)
}
sslen
=
sizeof
(
ss
);
if
(
getsockname
(
portsock
,
(
struct
sockaddr
*
)
&
s
s
,
&
sslen
)
<
0
)
{
if
(
getsockname
(
portsock
,
s
a
,
&
sslen
)
<
0
)
{
failf
(
data
,
strerror
(
errno
));
freeaddrinfo
(
res
);
return
CURLE_FTP_PORT_FAILED
;
...
...
@@ -779,7 +783,7 @@ CURLcode _ftp(struct connectdata *conn)
for
(
modep
=
mode
;
modep
&&
*
modep
;
modep
++
)
{
int
lprtaf
,
eprtaf
;
switch
(
s
s
.
ss
_family
)
{
switch
(
s
a
->
sa
_family
)
{
case
AF_INET
:
ap
=
(
char
*
)
&
((
struct
sockaddr_in
*
)
&
ss
)
->
sin_addr
;
alen
=
sizeof
(((
struct
sockaddr_in
*
)
&
ss
)
->
sin_addr
);
...
...
@@ -809,7 +813,7 @@ CURLcode _ftp(struct connectdata *conn)
portmsgbuf
,
sizeof
(
portmsgbuf
),
tmp
,
sizeof
(
tmp
),
niflags
))
continue
;
/* do not transmit IPv6 scope identifier to the wire */
if
(
s
s
.
ss
_family
==
AF_INET6
)
{
if
(
s
a
->
sa
_family
==
AF_INET6
)
{
char
*
q
=
strchr
(
portmsgbuf
,
'%'
);
if
(
q
)
*
q
=
'\0'
;
...
...
@@ -821,7 +825,7 @@ CURLcode _ftp(struct connectdata *conn)
if
(
strcmp
(
*
modep
,
"LPRT"
)
==
0
&&
lprtaf
<
0
)
continue
;
if
(
strcmp
(
*
modep
,
"PORT"
)
==
0
&&
s
s
.
ss
_family
!=
AF_INET
)
if
(
strcmp
(
*
modep
,
"PORT"
)
==
0
&&
s
a
->
sa
_family
!=
AF_INET
)
continue
;
portmsgbuf
[
0
]
=
'\0'
;
...
...
This diff is collapsed.
Click to expand it.
lib/strequal.c
+
26
−
0
View file @
db70cd28
...
...
@@ -66,3 +66,29 @@ int Curl_strnequal(const char *first, const char *second, size_t max)
#endif
}
#ifndef HAVE_STRLCAT
/*
* The strlcat() function appends the NUL-terminated string src to the end
* of dst. It will append at most size - strlen(dst) - 1 bytes, NUL-termi-
* nating the result.
*
* The strlcpy() and strlcat() functions return the total length of the
* string they tried to create. For strlcpy() that means the length of src.
* For strlcat() that means the initial length of dst plus the length of
* src. While this may seem somewhat confusing it was done to make trunca-
* tion detection simple.
*/
size_t
strlcat
(
char
*
dst
,
const
char
*
src
,
size_t
size
)
{
size_t
len
=
strlen
(
dst
);
size_t
orglen
=
len
;
int
index
=
0
;
while
(
src
[
index
]
&&
(
len
<
(
size
-
1
))
)
{
dst
[
len
++
]
=
src
[
index
++
];
}
dst
[
len
]
=
0
;
return
orglen
+
strlen
(
src
);
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment