mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-11-29 08:04:16 +01:00
Fix privileged port logic
This commit is contained in:
parent
0665777a85
commit
9c1735e33f
@ -3,7 +3,7 @@
|
|||||||
// - RFC 3659 (https://tools.ietf.org/html/rfc3659)
|
// - RFC 3659 (https://tools.ietf.org/html/rfc3659)
|
||||||
// - suggested implementation details from https://cr.yp.to/ftp/filesystem.html
|
// - suggested implementation details from https://cr.yp.to/ftp/filesystem.html
|
||||||
//
|
//
|
||||||
// Copyright (C) 2020 Michael Theall
|
// Copyright (C) 2021 Michael Theall
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -283,15 +283,22 @@ bool FtpConfig::setPort (std::string const &port_)
|
|||||||
|
|
||||||
bool FtpConfig::setPort (std::uint16_t const port_)
|
bool FtpConfig::setPort (std::uint16_t const port_)
|
||||||
{
|
{
|
||||||
if (port_ < 1024
|
#ifdef __SWITCH__
|
||||||
#if !defined(NDS) && !defined(_3DS)
|
// Switch is not allowed < 1024, except 0
|
||||||
&& port_ != 0
|
if (port_ < 1024 && port_ != 0)
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#elif defined(NDS) || defined(_3DS)
|
||||||
|
// 3DS is allowed < 1024, but not 0
|
||||||
|
// NDS is allowed < 1024, but 0 crashes the app
|
||||||
|
if (port_ == 0)
|
||||||
|
{
|
||||||
|
errno = EPERM;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
m_port = port_;
|
m_port = port_;
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user