Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DelPort doesnt check if there is only 1 active port remaining #1806

Open
DoctorD90 opened this issue Aug 20, 2021 · 2 comments
Open

DelPort doesnt check if there is only 1 active port remaining #1806

DoctorD90 opened this issue Aug 20, 2021 · 2 comments

Comments

@DoctorD90
Copy link

Via IRC messages is possible to completely remove all listening ports.

In the code, here, should be there an other "IF", checking if the number of listeners is = 1; in that case it should give back error, telling to add first another port before to remove the last available port.

znc/src/ClientCommand.cpp

Lines 1718 to 1723 in 9cd3605

if (pListener) {
CZNC::Get().DelListener(pListener);
PutStatus(t_s("Deleted Port"));
} else {
PutStatus(t_s("Unable to find a matching port"));
}

@csprr
Copy link
Contributor

csprr commented Aug 20, 2021

The if should be to check if it's the current active port, because that one should never be able to be deleted (which is already the case in webadmin iirc)

@DarthGandalf
Copy link
Member

This is mostly by design. It should be possible to e.g. switch SSL on on the port without adding a new port with different number: delport, then addport. Of course, there's a potential to disconnect after delport, which would make ZNC not accessible anymore.

Webadmin does have this check, because all HTTP connections are independent (we always use Connection: close header, and even without it, we can't rely on browser to not close the connection between requests), so deleting the port from there would result in a weird error instead of the "success page"

csprr added a commit to csprr/znc that referenced this issue Aug 20, 2021
Possible fix (if wanted) for issue znc#1806 
In "danger" of locking yourself out by removing your active port, this should not be possible (same as to HTTP) in my opinion.
csprr added a commit to csprr/znc that referenced this issue Aug 20, 2021
Possible fix (if wanted) for issue znc#1806
In "danger" of locking yourself out by removing your active port, this should not be possible (same as to HTTP) in my opinion.
This will allow the modification of an active port instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants