Loading modules/shares/shares.cpp +11 −5 Changes for modules/shares/shares.cpp: 11 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -191,16 +191,22 @@ json_object *info() { // who can be given access, and who has an SMB password json_object *users = json_object_new_array(); setpwent(); std::vector<std::pair<std::string, uid_t>> people; struct Person { std::string name; uid_t uid; bool domain; }; std::vector<Person> people; while (struct passwd *pw = getpwent()) if (pw->pw_uid >= FirstUid) people.emplace_back(pw->pw_name, pw->pw_uid); // root: never SMB if (pw->pw_uid >= FirstUid) // root: never SMB people.push_back({pw->pw_name, pw->pw_uid, pw->pw_passwd && std::string(pw->pw_passwd) == "*"}); endpwent(); for (auto &p : people) { unsigned char h[16]; // a user of another source (adconnect): no shadow entry and "*"; // sharedd passes its NTLM logins to the domain controller if (p.domain) p.domain = !domainUser(p.name); json_object *u = json_object_new_object(); json_object_object_add(u, "name", jstr(p.first)); json_object_object_add(u, "uid", json_object_new_int64(p.second)); json_object_object_add(u, "smbPassword", json_object_new_boolean(shadow_get_nthash(p.first.c_str(), h) == 1)); json_object_object_add(u, "name", jstr(p.name)); json_object_object_add(u, "uid", json_object_new_int64(p.uid)); json_object_object_add(u, "domain", json_object_new_boolean(p.domain)); json_object_object_add(u, "smbPassword", json_object_new_boolean(!p.domain && shadow_get_nthash(p.name.c_str(), h) == 1)); memset(h, 0, sizeof(h)); json_object_array_add(users, u); } Loading Loading
modules/shares/shares.cpp +11 −5 Changes for modules/shares/shares.cpp: 11 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -191,16 +191,22 @@ json_object *info() { // who can be given access, and who has an SMB password json_object *users = json_object_new_array(); setpwent(); std::vector<std::pair<std::string, uid_t>> people; struct Person { std::string name; uid_t uid; bool domain; }; std::vector<Person> people; while (struct passwd *pw = getpwent()) if (pw->pw_uid >= FirstUid) people.emplace_back(pw->pw_name, pw->pw_uid); // root: never SMB if (pw->pw_uid >= FirstUid) // root: never SMB people.push_back({pw->pw_name, pw->pw_uid, pw->pw_passwd && std::string(pw->pw_passwd) == "*"}); endpwent(); for (auto &p : people) { unsigned char h[16]; // a user of another source (adconnect): no shadow entry and "*"; // sharedd passes its NTLM logins to the domain controller if (p.domain) p.domain = !domainUser(p.name); json_object *u = json_object_new_object(); json_object_object_add(u, "name", jstr(p.first)); json_object_object_add(u, "uid", json_object_new_int64(p.second)); json_object_object_add(u, "smbPassword", json_object_new_boolean(shadow_get_nthash(p.first.c_str(), h) == 1)); json_object_object_add(u, "name", jstr(p.name)); json_object_object_add(u, "uid", json_object_new_int64(p.uid)); json_object_object_add(u, "domain", json_object_new_boolean(p.domain)); json_object_object_add(u, "smbPassword", json_object_new_boolean(!p.domain && shadow_get_nthash(p.name.c_str(), h) == 1)); memset(h, 0, sizeof(h)); json_object_array_add(users, u); } Loading