/* $ModDesc: Provides SSL support for clients */
/* $CompileFlags: `libgnutls-config --cflags` */
-/* $LinkerFlags: `libgnutls-config --libs` */
+/* $LinkerFlags: `libgnutls-config --libs` `perl ../gnutls_rpath.pl` */
enum issl_status { ISSL_NONE, ISSL_HANDSHAKING_READ, ISSL_HANDSHAKING_WRITE, ISSL_HANDSHAKEN, ISSL_CLOSING, ISSL_CLOSED };
gnutls_certificate_set_dh_params(x509_cred, dh_params);
}
- virtual void OnRehash(std::string param)
+ virtual void OnRehash(const std::string ¶m)
{
if(param != "ssl")
return;
}
}
- virtual void OnUnloadModule(Module* mod, std::string name)
+ virtual void OnUnloadModule(Module* mod, const std::string &name)
{
if(mod == this)
{
List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnUnloadModule] = List[I_OnRehash] = List[I_OnWhois] = List[I_OnGlobalConnect] = 1;
}
- virtual void OnRawSocketAccept(int fd, std::string ip, int localport)
+ virtual void OnRawSocketAccept(int fd, const std::string &ip, int localport)
{
issl_session* session = &sessions[fd];
// :kenny.chatspike.net 320 Om Epy|AFK :is a Secure Connection
virtual void OnWhois(userrec* source, userrec* dest)
{
- if(dest->GetExt("ssl"))
+ // Bugfix, only send this numeric for *our* SSL users
+ if(dest->GetExt("ssl") && isin(dest->port, listenports))
{
WriteServ(source->fd, "320 %s %s :is using a secure connection", source->nick, dest->nick);
}
}
- virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, std::string extname)
+ virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
{
// check if the linking module wants to know about OUR metadata
if(extname == "ssl")
}
}
- virtual void OnDecodeMetaData(int target_type, void* target, std::string extname, std::string extdata)
+ virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata)
{
// check if its our metadata key, and its associated with a user
if ((target_type == TYPE_USER) && (extname == "ssl"))
// This will do for setting the ssl flag...it could be done earlier if it's needed. But this seems neater.
userrec* extendme = Srv->FindDescriptor(session->fd);
- extendme->Extend("ssl", "ON");
+ if (extendme)
+ {
+ if (!extendme->GetExt("ssl"))
+ extendme->Extend("ssl", "ON");
+ }
// Change the seesion state
session->status = ISSL_HANDSHAKEN;