Loading modules/users/sources.cpp +27 −0 Changes for modules/users/sources.cpp: 27 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -57,6 +57,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <sysbus/client.h> #include <webctl/module.h> #if __has_include(<sys/uid_r.h>) #include <sys/uid_r.h> // systempp: GUID ids for the domain's accounts #define WEBCTL_UID_R 1 #endif #if __has_include(<userdb.h>) #include <userdb.h> #endif Loading @@ -82,6 +87,18 @@ const char *Adconnectd = "/usr/sbin/adconnectd"; const char *AdUnit = "adconnect"; const char *AdModule = "adconnect"; // the kernel has the *_r calls: GUID users can run bool kernelHasUidR() { #ifdef WEBCTL_UID_R static int have = -1; uid_r_t id; if (have < 0) have = getuid_r(&id) == 0; return have; #else return false; #endif } // the libc's limits (systempp's userdb.cpp) const size_t MaxSources = 16; const size_t MaxOptions = 32; Loading Loading @@ -868,6 +885,16 @@ json_object *adconnectJoin(json_object *args) { std::string err; AdSettings ad; if (!readAd(ad, err)) return error(err, 500); // ids: a domain joined again keeps its own (else every account's // owner changes); a new one gets the objectGUID as its id when the // kernel runs GUID users (FenrirOS uid_r), else id_base + RID if (const AdDomain *was = ad.find(domain)) { for (const char *k : {"id_mapping", "id_base", "id_range"}) if (json_object *v = json_object_object_get(was->config, k)) json_object_object_add(config, k, json_object_get(v)); } else if (kernelHasUidR()) { json_object_object_add(config, "id_mapping", jstr("guid")); } json_object *domains = savedDomains(ad, domain); // a domain joined again replaces its entry json_object *entry = json_object_new_object(); json_object_object_add(entry, "config", config); Loading Loading
modules/users/sources.cpp +27 −0 Changes for modules/users/sources.cpp: 27 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -57,6 +57,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <sysbus/client.h> #include <webctl/module.h> #if __has_include(<sys/uid_r.h>) #include <sys/uid_r.h> // systempp: GUID ids for the domain's accounts #define WEBCTL_UID_R 1 #endif #if __has_include(<userdb.h>) #include <userdb.h> #endif Loading @@ -82,6 +87,18 @@ const char *Adconnectd = "/usr/sbin/adconnectd"; const char *AdUnit = "adconnect"; const char *AdModule = "adconnect"; // the kernel has the *_r calls: GUID users can run bool kernelHasUidR() { #ifdef WEBCTL_UID_R static int have = -1; uid_r_t id; if (have < 0) have = getuid_r(&id) == 0; return have; #else return false; #endif } // the libc's limits (systempp's userdb.cpp) const size_t MaxSources = 16; const size_t MaxOptions = 32; Loading Loading @@ -868,6 +885,16 @@ json_object *adconnectJoin(json_object *args) { std::string err; AdSettings ad; if (!readAd(ad, err)) return error(err, 500); // ids: a domain joined again keeps its own (else every account's // owner changes); a new one gets the objectGUID as its id when the // kernel runs GUID users (FenrirOS uid_r), else id_base + RID if (const AdDomain *was = ad.find(domain)) { for (const char *k : {"id_mapping", "id_base", "id_range"}) if (json_object *v = json_object_object_get(was->config, k)) json_object_object_add(config, k, json_object_get(v)); } else if (kernelHasUidR()) { json_object_object_add(config, "id_mapping", jstr("guid")); } json_object *domains = savedDomains(ad, domain); // a domain joined again replaces its entry json_object *entry = json_object_new_object(); json_object_object_add(entry, "config", config); Loading