I wrote a patch around it, it works, BUT someone NEEDS BADLY to look at a better 
solution, this just checks if the port we are trying to open as a TCP server, is 
not below 1024. If so, just tell that we cant open that port ;)
File atached, just have a l00k at it :)

Arjen



Mikael Vidstedt wrote:
> If TCPPortsLow and TCPPortsHigh in licq.conf are set to privileged ports
> (eg. 110 and 120 respectively) and running as a non-privileged user,
> there will be a segmentation fault at startup. This is because
> CICQDaemon::StartTCPServer tries to bind to one port at a time, failing
> each time (Permission denied). Unfortunately, the INetSocket::StartServer
> sets its m_nDescriptor, so the test (s->Descriptor() != -1) later in
> CICQDaemon::StartTCPServer is not sufficient.
> 
> It has further implications too (leading to a great big segfault). What
> to do about it (if anything at all) is left for somebody more into
> (l)icq to figure out :)
> 
> /Mikael
> 
diff -r -c licq/src/socket.cpp licq2/src/socket.cpp
*** licq/src/socket.cpp Sun Mar 17 06:47:55 2002
--- licq2/src/socket.cpp        Mon Apr  1 13:14:02 2002
***************
*** 435,440 ****
--- 435,449 ----
  //-----INetSocket::StartServer--------------------------------------------------
  bool INetSocket::StartServer(unsigned int _nPort)
  {
+   // The following is a FILTHY hack around the fact that we are not allowed to
+   // open a port below 1024. We get a segfault if we try so...
+   
+   if (_nPort <= 1024) 
+   {
+     m_nErrorType = SOCK_ERROR_errno;
+     return (false);
+   }
+       
    m_nDescriptor = socket(AF_INET, m_nSockType, 0);
    if (m_nDescriptor == -1)
    {

Reply via email to