-
Notifications
You must be signed in to change notification settings - Fork 261
Description
While creating PR #741, I noticed that the use of cups_rresvport() will cause ports from 731-512 to be used instead of just 721-731. Since cups_rresvport() starts with the value of lport passed in and decrements lport to 512, if all ports from 731-721 are unavailable, cups_rresvport() will start binding to ports between 720-512.
One possible fix would be to add a parameter to cups_rresvport() to provide a lower bound for port reservation. This would make it incompatible with the glibc function that it was intended to replace, but I don't know if that's important now.
Another possible fix would be to change lpd_queue() to check the value of lport returned by cups_rresvport() and, if *lport < 721 && reserve == RESERVE_RFC117, close the fd and re-set lport to 731.
I'm happy to file a PR if this is something that should be addressed.