+ /* changed from == REG_ALL to catch clients sending STARTTLS
+ * after NICK and USER but before OnUserConnect completes and
+ * give a proper error message (see bug #645) - dz
+ */
+ if (user->registered != REG_NONE)
+ {
+ ServerInstance->Users->QuitUser(user, "STARTTLS is not permitted after client registration has started");
+ }
+ else
+ {
+ if (!user->GetIOHook())
+ {
+ user->WriteNumeric(670, "%s :STARTTLS successful, go ahead with TLS handshake", user->nick.c_str());
+ user->AddIOHook(Caller);
+ Caller->OnRawSocketAccept(user->GetFd(), user->GetIPString(), user->GetPort());
+ }
+ else
+ user->WriteNumeric(691, "%s :STARTTLS failure", user->nick.c_str());
+ }