Commit 83964285 authored by jan.koester's avatar jan.koester
Browse files

uuid_r default

parent 07a27146
Loading
Loading
Loading
Loading
+1 −1
Changes for src/daemon.cpp: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ std::string joinedDomains(Server &s) {
        if (!clean(nb) || !clean(computer) || nb.find('\t') != std::string::npos ||
            computer.find('\t') != std::string::npos)
            continue;
        out += "J\t" + nb + "\t" + computer + "\n";
        out += "J\t" + nb + "\t" + computer + "\t" + dp->cfg.domain + "\n";
    }
    return out + End;
}
+7 −3
Changes for src/directory.cpp: 7 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -312,12 +312,16 @@ std::string Directory::groupFilter(const std::string &extra) const {
bool Directory::validName(const std::string &n) const {
    if (!clean(n) || (_cfg.lowercase && n != lower(n))) return false;
    size_t at = n.rfind('@');
    if (!_cfg.qualified) return at == std::string::npos;
    return at != std::string::npos && at > 0 && lower(n.substr(at + 1)) == _cfg.domain;
    /* user@domain names the account unambiguously even without
     * qualified_names (sharedd: an NTLM login that named its domain) */
    if (at != std::string::npos)
        return at > 0 && lower(n.substr(at + 1)) == _cfg.domain;
    return !_cfg.qualified;
}

std::string Directory::account(const std::string &n) const {
    return _cfg.qualified ? n.substr(0, n.rfind('@')) : n;
    size_t at = n.rfind('@');
    return at == std::string::npos ? n : n.substr(0, at);
}

std::string Directory::name(const ldap::Entry &e) const {
+1 −1
Changes for src/protocol.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * JOINED (sharedd: the names ksmbd must use as a domain member) answers a
 * line per joined domain, then END:
 *
 *   J <NetBIOS domain> <computer name>
 *   J <NetBIOS domain> <computer name> <DNS domain>
 *
 * SIDOF u|g <id> and IDOF <SID> (sharedd, for ksmbd's security
 * descriptors) translate between a user's (u) or group's (g) id and its
+5 −1
Changes for test/test.cpp: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -453,6 +453,9 @@ void testRid(fake::Server &srv) {
    CHECK_EQ(ask(d, Cmd::PwNam, "foreign"), std::string(End), "rid: SID of another domain");
    CHECK_EQ(ask(d, Cmd::PwNam, "nobody"), std::string(End), "rid: unknown user");
    CHECK_EQ(ask(d, Cmd::PwNam, "x*"), std::string(End), "rid: no wildcards through the name");
    CHECK_EQ(ask(d, Cmd::PwNam, "jan@example.com"), jan + End, "rid: user@our domain without qualified names");
    CHECK_EQ(ask(d, Cmd::PwNam, "jan@other.org"), std::string(End), "rid: user@another domain isn't ours");
    CHECK(d.owns("jan@example.com") && !d.owns("jan@other.org") && d.owns("jan"), "rid: owns() with and without @");
    CHECK_EQ(ask(d, Cmd::PwUid, "201104"), jan + End, "rid: PWUID");
    CHECK_EQ(ask(d, Cmd::PwUid, "199999"), std::string(End), "rid: uid below id_base");
    CHECK_EQ(ask(d, Cmd::PwUid, "2200000"), std::string(End), "rid: uid past the range");
@@ -1245,7 +1248,8 @@ void testDaemonDomains(const std::string &dir) {
              "multi: jan is example.com's (plain names)");
        CHECK(m.getpwnam(m.ctx, "jan@corp.org", &pw, buf, sizeof buf) == 0 && !strcmp(pw.pw_name, "jan@corp.org") &&
              pw.pw_uid.legacy == 2201104 && pw.pw_gid.legacy == 2200513, "multi: jan@corp.org, in corp.org's id range");
        CHECK(m.getpwnam(m.ctx, "jan@example.com", &pw, buf, sizeof buf) == ENOENT, "multi: example.com takes no qualified names");
        CHECK(m.getpwnam(m.ctx, "jan@example.com", &pw, buf, sizeof buf) == 0 && !strcmp(pw.pw_name, "jan") &&
              pw.pw_uid.legacy == 201104, "multi: jan@example.com is example.com's jan (its plain name)");
        uid_r_t uid = uid_r_legacy(2201105);
        CHECK(m.getpwuid(m.ctx, &uid, &pw, buf, sizeof buf) == 0 && !strcmp(pw.pw_name, "bob@corp.org"), "multi: by id, the right domain");
        CHECK(m.getgrnam(m.ctx, "linux@corp.org", &gr, buf, sizeof buf) == 0 && gr.gr_gid.legacy == 2202001 &&