diff options
| author | 2022-08-11 14:20:18 +0100 | |
|---|---|---|
| committer | 2022-08-11 15:40:57 +0100 | |
| commit | f88fbaa2fe91c22f1c7280ecd96c2bcf92f73a4d (patch) | |
| tree | e35803070a6ca8e50ee2d07b2e6c0d71230d53f3 /src/users.cpp | |
| parent | Clean up the sockaddrs documentation comments. (diff) | |
Move aptosa/untosa into the sockaddrs union and add from/from_ip.
The struct will also now always be zero-initialized by default which
removes the footgun which has happened previously where the union has
been accessed before being initialized leading to it containing weird
values.
Diffstat (limited to 'src/users.cpp')
| -rw-r--r-- | src/users.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/users.cpp b/src/users.cpp index 37277643c..809fdb15a 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -96,8 +96,6 @@ User::User(const std::string& uid, Server* srv, Type type) , uniqueusername(false) , usertype(type) { - client_sa.sa.sa_family = AF_UNSPEC; - ServerInstance->Logs.Debug("USERS", "New UUID for user: %s", uuid.c_str()); if (srv->IsService()) @@ -114,6 +112,7 @@ User::User(const std::string& uid, Server* srv, Type type) LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* servaddr) : User(ServerInstance->UIDGen.GetUID(), ServerInstance->FakeClient->server, User::TYPE_LOCAL) , eh(this) + , server_sa(*servaddr) , quitting_sendq(false) , lastping(true) , exempt(false) @@ -124,7 +123,6 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so ident = uuid; eh.SetFd(myfd); memcpy(&client_sa, client, sizeof(irc::sockets::sockaddrs)); - memcpy(&server_sa, servaddr, sizeof(irc::sockets::sockaddrs)); ChangeRealHost(GetIPString(), true); } |
