HomeFreeBSD

ctld: Convert struct auth_group to a C++ class

Description

ctld: Convert struct auth_group to a C++ class

Make data members private and convert functions for adding and
checking user and initiator authentication into class methods.

Use std::string to store the label for an auth_group and add a label()
method to retrieve a const C string version for logging.

Replace AG_TYPE_* macros with a scoped enum.

Replace the TAILQ of auth_group objects in struct conf with an
unordered_map<> of named auth_group objects. Anonymous auth_group
objects for targets are no longer stored in a global data structure.

Since a target can have a pointer to either named or anonymous
objects, use a shared_ptr<> to store references to auth_group objects.
Use the shared_ptr<>'s reference count to determine if a named
auth_group is unused in conf_verify() instead of walking all the
linked lists to check for references.

While here, avoid making a second copy of socket address for a client
and instead just store a pointer in ctld_connection.

Sponsored by: Chelsio Communications
Pull Request: https://github.com/freebsd/freebsd-src/pull/1794

Details

Provenance
jhbAuthored on Aug 4 2025, 7:38 PM
Parents
rGe1849d9a8db4: ctld: Use a bool to track if a target uses a private auth_group
Branches
Unknown
Tags
Unknown