]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socket.cpp
Allow configuring whether SETNAME sends snotices and is oper-only.
[user/henk/code/inspircd.git] / src / socket.cpp
index 1d110323567a589ca39d3a55c89a2c1884363540..b33664f84ee84c70734f2dbc7a4b20993da4292f 100644 (file)
@@ -39,7 +39,7 @@ bool InspIRCd::BindPort(ConfigTag* tag, const irc::sockets::sockaddrs& sa, std::
                        return true;
                }
        }
-       
+
        ListenSocket* ll = new ListenSocket(tag, sa);
        if (ll->GetFd() < 0)
        {
@@ -93,6 +93,7 @@ int InspIRCd::BindPorts(FailedPortList& failed_ports)
                        continue;
                }
 
+#ifndef _WIN32
                // Are we creating a UNIX listener?
                const std::string path = tag->getString("path");
                if (!path.empty())
@@ -109,13 +110,14 @@ int InspIRCd::BindPorts(FailedPortList& failed_ports)
                        // Create the bindspec manually (aptosa doesn't work with AF_UNIX yet).
                        memset(&bindspec, 0, sizeof(bindspec));
                        bindspec.un.sun_family = AF_UNIX;
-                       stpncpy(bindspec.un.sun_path, path.c_str(), sizeof(bindspec.un.sun_path) - 1);
+                       memcpy(&bindspec.un.sun_path, path.c_str(), sizeof(bindspec.un.sun_path));
 
                        if (!BindPort(tag, bindspec, old_ports))
                                failed_ports.push_back(std::make_pair(bindspec, errno));
                        else
                                bound++;
                }
+#endif
        }
 
        std::vector<ListenSocket*>::iterator n = ports.begin();
@@ -352,7 +354,7 @@ irc::sockets::cidr_mask::cidr_mask(const std::string& mask)
        }
        else
        {
-               int range = ConvToInt(mask.substr(bits_chars + 1));
+               unsigned char range = ConvToNum<unsigned char>(mask.substr(bits_chars + 1));
                irc::sockets::aptosa(mask.substr(0, bits_chars), 0, sa);
                sa2cidr(*this, sa, range);
        }
@@ -375,6 +377,7 @@ std::string irc::sockets::cidr_mask::str() const
                case AF_INET6:
                        base = (unsigned char*)&sa.in6.sin6_addr;
                        len = 16;
+                       break;
 
                case AF_UNIX:
                        return sa.un.sun_path;
@@ -386,7 +389,7 @@ std::string irc::sockets::cidr_mask::str() const
        }
 
        memcpy(base, bits, len);
-       return sa.addr() + "/" + ConvToStr(length);
+       return sa.addr() + "/" + ConvToStr((int)length);
 }
 
 bool irc::sockets::cidr_mask::operator==(const cidr_mask& other) const