mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 08:59:37 -05:00
prevent port values to go below 1024 in the backend
This commit is contained in:
parent
30c4dfe218
commit
f70cbbe065
@ -901,6 +901,12 @@ bool p3Peers::setLocalAddress(const RsPeerId &id, const std::string &addr_str,
|
|||||||
std::cerr << "p3Peers::setLocalAddress() " << id << std::endl;
|
std::cerr << "p3Peers::setLocalAddress() " << id << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(port < 1024)
|
||||||
|
{
|
||||||
|
std::cerr << "(EE) attempt to use a port that is reserved to the system: " << port << std::endl;
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
struct sockaddr_in *addrv4p = (struct sockaddr_in *) &addr;
|
struct sockaddr_in *addrv4p = (struct sockaddr_in *) &addr;
|
||||||
addrv4p->sin_family = AF_INET;
|
addrv4p->sin_family = AF_INET;
|
||||||
@ -926,6 +932,12 @@ bool p3Peers::setExtAddress(const RsPeerId &id, const std::string &addr_str, ui
|
|||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
std::cerr << "p3Peers::setExtAddress() " << id << std::endl;
|
std::cerr << "p3Peers::setExtAddress() " << id << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
if(port < 1024)
|
||||||
|
{
|
||||||
|
std::cerr << "(EE) attempt to use a port that is reserved to the system: " << port << std::endl;
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// NOTE THIS IS IPV4 FOR NOW.
|
// NOTE THIS IS IPV4 FOR NOW.
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
|
Loading…
Reference in New Issue
Block a user