Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5dd1bad7
Commit
5dd1bad7
authored
May 10, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Add fallback data for getprotobyname/number.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
855ec142
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
31 deletions
+97
-31
socket.c
dlls/ws2_32/socket.c
+97
-31
No files found.
dlls/ws2_32/socket.c
View file @
5dd1bad7
...
...
@@ -635,7 +635,7 @@ static FARPROC blocking_hook = (FARPROC)WSA_DefaultBlockingHook;
/* function prototypes */
static
struct
WS_hostent
*
WS_create_he
(
char
*
name
,
int
aliases
,
int
aliases_size
,
int
addresses
,
int
address_length
);
static
struct
WS_hostent
*
WS_dup_he
(
const
struct
hostent
*
p_he
);
static
struct
WS_protoent
*
WS_
dup_pe
(
const
struct
protoent
*
p_pe
);
static
struct
WS_protoent
*
WS_
create_pe
(
const
char
*
name
,
char
**
aliases
,
int
prot
);
static
struct
WS_servent
*
WS_dup_se
(
const
struct
servent
*
p_se
);
static
int
ws_protocol_info
(
SOCKET
s
,
int
unicode
,
WSAPROTOCOL_INFOW
*
buffer
,
int
*
size
);
...
...
@@ -6406,6 +6406,62 @@ struct WS_hostent* WINAPI WS_gethostbyname(const char* name)
}
static
const
struct
{
int
prot
;
const
char
*
names
[
3
];
}
protocols
[]
=
{
{
0
,
{
"ip"
,
"IP"
}},
{
1
,
{
"icmp"
,
"ICMP"
}},
{
2
,
{
"igmp"
,
"IGMP"
}},
{
3
,
{
"ggp"
,
"GGP"
}},
{
6
,
{
"tcp"
,
"TCP"
}},
{
8
,
{
"egp"
,
"EGP"
}},
{
9
,
{
"igp"
,
"IGP"
}},
{
12
,
{
"pup"
,
"PUP"
}},
{
17
,
{
"udp"
,
"UDP"
}},
{
20
,
{
"hmp"
,
"HMP"
}},
{
22
,
{
"xns-idp"
,
"XNS-IDP"
}},
{
27
,
{
"rdp"
,
"RDP"
}},
{
29
,
{
"iso-tp4"
,
"ISO-TP4"
}},
{
33
,
{
"dccp"
,
"DCCP"
}},
{
36
,
{
"xtp"
,
"XTP"
}},
{
37
,
{
"ddp"
,
"DDP"
}},
{
38
,
{
"idpr-cmtp"
,
"IDPR-CMTP"
}},
{
41
,
{
"ipv6"
,
"IPv6"
}},
{
43
,
{
"ipv6-route"
,
"IPv6-Route"
}},
{
44
,
{
"ipv6-frag"
,
"IPv6-Frag"
}},
{
45
,
{
"idrp"
,
"IDRP"
}},
{
46
,
{
"rsvp"
,
"RSVP"
}},
{
47
,
{
"gre"
,
"GRE"
}},
{
50
,
{
"esp"
,
"ESP"
}},
{
51
,
{
"ah"
,
"AH"
}},
{
57
,
{
"skip"
,
"SKIP"
}},
{
58
,
{
"ipv6-icmp"
,
"IPv6-ICMP"
}},
{
59
,
{
"ipv6-nonxt"
,
"IPv6-NoNxt"
}},
{
60
,
{
"ipv6-opts"
,
"IPv6-Opts"
}},
{
66
,
{
"rvd"
,
"RVD"
}},
{
73
,
{
"rspf"
,
"RSPF"
}},
{
81
,
{
"vmtp"
,
"VMTP"
}},
{
88
,
{
"eigrp"
,
"EIGRP"
}},
{
89
,
{
"ospf"
,
"OSPFIGP"
}},
{
93
,
{
"ax.25"
,
"AX.25"
}},
{
94
,
{
"ipip"
,
"IPIP"
}},
{
97
,
{
"etherip"
,
"ETHERIP"
}},
{
98
,
{
"encap"
,
"ENCAP"
}},
{
103
,
{
"pim"
,
"PIM"
}},
{
108
,
{
"ipcomp"
,
"IPCOMP"
}},
{
112
,
{
"vrrp"
,
"VRRP"
}},
{
115
,
{
"l2tp"
,
"L2TP"
}},
{
124
,
{
"isis"
,
"ISIS"
}},
{
132
,
{
"sctp"
,
"SCTP"
}},
{
133
,
{
"fc"
,
"FC"
}},
{
135
,
{
"mobility-header"
,
"Mobility-Header"
}},
{
136
,
{
"udplite"
,
"UDPLite"
}},
{
137
,
{
"mpls-in-ip"
,
"MPLS-in-IP"
}},
{
139
,
{
"hip"
,
"HIP"
}},
{
140
,
{
"shim6"
,
"Shim6"
}},
{
141
,
{
"wesp"
,
"WESP"
}},
{
142
,
{
"rohc"
,
"ROHC"
}},
};
/***********************************************************************
* getprotobyname (WS2_32.53)
*/
...
...
@@ -6416,16 +6472,25 @@ struct WS_protoent* WINAPI WS_getprotobyname(const char* name)
struct
protoent
*
proto
;
EnterCriticalSection
(
&
csWSgetXXXbyYYY
);
if
(
(
proto
=
getprotobyname
(
name
))
!=
NULL
)
retval
=
WS_create_pe
(
proto
->
p_name
,
proto
->
p_aliases
,
proto
->
p_proto
);
LeaveCriticalSection
(
&
csWSgetXXXbyYYY
);
#endif
if
(
!
retval
)
{
retval
=
WS_dup_pe
(
proto
);
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
protocols
)
/
sizeof
(
protocols
[
0
]);
i
++
)
{
if
(
strcasecmp
(
protocols
[
i
].
names
[
0
],
name
))
continue
;
retval
=
WS_create_pe
(
protocols
[
i
].
names
[
0
],
(
char
**
)
protocols
[
i
].
names
+
1
,
protocols
[
i
].
prot
);
break
;
}
}
else
{
MESSAGE
(
"protocol %s not found; You might want to add "
"this to /etc/protocols
\n
"
,
debugstr_a
(
name
)
);
if
(
!
retval
)
{
WARN
(
"protocol %s not found
\n
"
,
debugstr_a
(
name
)
);
SetLastError
(
WSANO_DATA
);
}
LeaveCriticalSection
(
&
csWSgetXXXbyYYY
);
#endif
TRACE
(
"%s ret %p
\n
"
,
debugstr_a
(
name
),
retval
);
return
retval
;
}
...
...
@@ -6441,16 +6506,25 @@ struct WS_protoent* WINAPI WS_getprotobynumber(int number)
struct
protoent
*
proto
;
EnterCriticalSection
(
&
csWSgetXXXbyYYY
);
if
(
(
proto
=
getprotobynumber
(
number
))
!=
NULL
)
retval
=
WS_create_pe
(
proto
->
p_name
,
proto
->
p_aliases
,
proto
->
p_proto
);
LeaveCriticalSection
(
&
csWSgetXXXbyYYY
);
#endif
if
(
!
retval
)
{
retval
=
WS_dup_pe
(
proto
);
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
protocols
)
/
sizeof
(
protocols
[
0
]);
i
++
)
{
if
(
protocols
[
i
].
prot
!=
number
)
continue
;
retval
=
WS_create_pe
(
protocols
[
i
].
names
[
0
],
(
char
**
)
protocols
[
i
].
names
+
1
,
protocols
[
i
].
prot
);
break
;
}
}
else
{
MESSAGE
(
"protocol number %d not found; You might want to add "
"this to /etc/protocols
\n
"
,
number
);
if
(
!
retval
)
{
WARN
(
"protocol %d not found
\n
"
,
number
);
SetLastError
(
WSANO_DATA
);
}
LeaveCriticalSection
(
&
csWSgetXXXbyYYY
);
#endif
TRACE
(
"%i ret %p
\n
"
,
number
,
retval
);
return
retval
;
}
...
...
@@ -7793,26 +7867,18 @@ static struct WS_hostent *WS_dup_he(const struct hostent* p_he)
/* ----- protoent */
static
struct
WS_protoent
*
WS_
dup_pe
(
const
struct
protoent
*
p_pe
)
static
struct
WS_protoent
*
WS_
create_pe
(
const
char
*
name
,
char
**
aliases
,
int
prot
)
{
char
*
p
;
struct
WS_protoent
*
p_to
;
struct
WS_protoent
*
ret
;
unsigned
int
size
=
sizeof
(
*
ret
)
+
strlen
(
name
)
+
sizeof
(
char
*
)
+
list_size
(
aliases
,
0
)
;
int
size
=
(
sizeof
(
*
p_pe
)
+
strlen
(
p_pe
->
p_name
)
+
1
+
list_size
(
p_pe
->
p_aliases
,
0
));
if
(
!
(
p_to
=
check_buffer_pe
(
size
)))
return
NULL
;
p_to
->
p_proto
=
p_pe
->
p_proto
;
p
=
(
char
*
)(
p_to
+
1
);
p_to
->
p_name
=
p
;
strcpy
(
p
,
p_pe
->
p_name
);
p
+=
strlen
(
p
)
+
1
;
p_to
->
p_aliases
=
(
char
**
)
p
;
list_dup
(
p_pe
->
p_aliases
,
p_to
->
p_aliases
,
0
);
return
p_to
;
if
(
!
(
ret
=
check_buffer_pe
(
size
)))
return
NULL
;
ret
->
p_proto
=
prot
;
ret
->
p_name
=
(
char
*
)(
ret
+
1
);
strcpy
(
ret
->
p_name
,
name
);
ret
->
p_aliases
=
(
char
**
)
ret
->
p_name
+
strlen
(
name
)
/
sizeof
(
char
*
)
+
1
;
list_dup
(
aliases
,
ret
->
p_aliases
,
0
);
return
ret
;
}
/* ----- servent */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment