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

test

parent afd31a34
Loading
Loading
Loading
Loading
+2 −0
Changes for include/sharedd/api.h: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *               address/prefix or "*"
 *   squash      root|all|none: NFS uid mapping to the anonymous user
 *   async       yes|no: NFS async writes
 *   nt_acl      yes|no: SMB keeps the Windows security descriptors clients
 *               set (security.NTACL), default yes
 *   fsid        NFS filesystem id (0 or missing: derived from the path)
 * ListShares repeats these per share, each starting with its "name".
 *
+2 −0
Changes for src/config.cpp: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -568,6 +568,7 @@ Config loadConfig(const std::string &path) {
            sh.clients = readList(conf, p + "/nfs_clients");
            readString(conf, p + "/squash", sh.squash);
            readBool(conf, p + "/async", sh.async);
            readBool(conf, p + "/nt_acl", sh.ntAcl);
            long long fsid = 0;
            readInt(conf, p + "/fsid", fsid);
            sh.fsid = (uint32_t)fsid;
@@ -642,6 +643,7 @@ void saveConfig(const std::string &path, const Config &cfg) {
            setList(conf, p + "/nfs_clients", sh.clients);
            set(conf, p + "/squash", sh.squash);
            set(conf, p + "/async", yesNo(sh.async));
            set(conf, p + "/nt_acl", yesNo(sh.ntAcl));
            if (sh.fsid) set(conf, p + "/fsid", std::to_string(sh.fsid));
        }
        set(conf, r + "/iscsi/enabled", yesNo(s.iscsi));
+2 −0
Changes for src/config.h: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ struct Share {
    std::vector<std::string> clients;  // NFS: address, address/prefix or "*"
    std::string squash = "root";       // root|all|none
    bool async = false;
    bool ntAcl = true;                 // SMB: keep Windows security descriptors (security.NTACL), also
                                       // ACEs for SIDs without a local account
    uint32_t fsid = 0;                 // 0: derived from the path
};

+2 −0
Changes for src/main.cpp: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ void addShare(sysbus::Message &m, const Share &s) {
    for (auto &c : s.clients) m.add("client", c);
    m.add("squash", s.squash);
    m.add("async", yesNo(s.async));
    m.add("nt_acl", yesNo(s.ntAcl));
    m.add("fsid", (long long)shareFsid(s));
}

@@ -138,6 +139,7 @@ Share shareFrom(const sysbus::Message &m) {
        if (!c.empty()) s.clients.push_back(c);
    s.squash = m.get("squash", "root");
    s.async = yes(m.get("async", "no"));
    s.ntAcl = yes(m.get("nt_acl", "yes"));
    s.fsid = (uint32_t)std::strtoul(m.get("fsid", "0").c_str(), nullptr, 10);
    return s;
}
+5 −2
Changes for src/sharectl.cpp: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ void usage() {
        "  --guest | --no-guest  --user NAME|@GROUP (repeatable)  --no-users\n"
        "  --client ADDR[/PREFIX]|* (repeatable)  --no-clients  --squash root|all|none\n"
        "  --async | --sync  --fsid N  --name NEWNAME (edit: rename)\n"
        "  --nt-acl | --no-nt-acl  keep the Windows security descriptors (default)\n"
        "iSCSI options:\n"
        "  --lun PATH (repeatable, edit: replaces the LUNs)  --initiator IQN (repeatable)\n"
        "  --open (any initiator) | --closed  --read-only | --read-write  --comment TEXT\n"
@@ -133,8 +134,8 @@ void showShare(const Fields &s) {
    printf("  access:    %s\n", get(s, "read_only") == "yes" ? "read-only" : "read-write");
    if (get(s, "smb") == "yes") {
        auto users = all(s, "user");
        printf("  SMB:       %s%s\n", users.empty() ? "every user with an SMB password" : join(users).c_str(),
               get(s, "guest") == "yes" ? ", guests" : "");
        printf("  SMB:       %s%s%s\n", users.empty() ? "every user with an SMB password" : join(users).c_str(),
               get(s, "guest") == "yes" ? ", guests" : "", get(s, "nt_acl") == "no" ? ", no Windows ACLs" : "");
    }
    if (get(s, "nfs") == "yes")
        printf("  NFS:       %s (squash %s%s, fsid %s)\n", join(all(s, "client")).c_str(), get(s, "squash").c_str(),
@@ -169,6 +170,8 @@ bool applyOptions(Fields &share, int argc, char **argv, int i) {
        else if (o == "--no-guest") set("guest", "no");
        else if (o == "--async") set("async", "yes");
        else if (o == "--sync") set("async", "no");
        else if (o == "--nt-acl") set("nt_acl", "yes");
        else if (o == "--no-nt-acl") set("nt_acl", "no");
        else if (o == "--no-users") clear("user");
        else if (o == "--no-clients") clear("client");
        else if (o == "--comment" && (v = arg())) set("comment", v);
Loading