Commit 6131c316 authored by jan.koester's avatar jan.koester
Browse files

test

parent facebb50
Loading
Loading
Loading
Loading
+13 −1
Changes for modules/shares/shares.cpp: 13 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -151,6 +151,12 @@ std::string shareFields(json_object *s, Fields &out) {
    return "";
}

bool hasShadow(const std::string &name) {
    struct spwd *sp = getspnam(name.c_str());
    endspent();
    return sp != nullptr;
}

json_object *info() {
    json_object *out = json_object_new_object();

@@ -201,7 +207,7 @@ json_object *info() {
        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);
        if (p.domain) p.domain = !hasShadow(p.name);
        json_object *u = json_object_new_object();
        json_object_object_add(u, "name", jstr(p.name));
        json_object_object_add(u, "uid", json_object_new_int64(p.uid));
@@ -301,9 +307,15 @@ json_object *smbPassword(json_object *a) {
    struct passwd *pw = getpwnam(name.c_str());
    bool root = pw && pw->pw_uid == 0;
#endif
    bool domain = pw && pw->pw_passwd && std::string(pw->pw_passwd) == "*";
    endpwent();
    if (!pw) return error(tr("no user %1", "kein Benutzer %1", {name}), 404);
    if (root) return error(tr("root can't log in over SMB", "root kann sich nicht über SMB anmelden"), 403);
    // a domain user (adconnect): the domain controller checks its SMB
    // logins; a local password would shadow the domain's
    if (domain && !hasShadow(name))
        return error(tr("%1 is a domain user: SMB logins go to the domain controller",
                        "%1 ist ein Domänenbenutzer: SMB-Anmeldungen prüft der Domänencontroller", {name}), 409);
    if (!password.empty() && password.size() < 8)
        return error(tr("the password needs at least %1 characters", "das Passwort braucht mindestens %1 Zeichen", {"8"}));
    if (lckpwdf() != 0)
+11 −4
Changes for www/modules/shares.js: 11 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -15,7 +15,11 @@
    'Created if it doesn\'t exist yet.': 'Wird angelegt, falls es noch nicht existiert.',
    'SMB (Windows, macOS, Linux)': 'SMB (Windows, macOS, Linux)', 'NFS (Linux, Unix)': 'NFS (Linux, Unix)',
    'Users and groups (SMB)': 'Benutzer und Gruppen (SMB)',
    'None ticked: every user with an SMB password.': 'Keiner angehakt: alle Benutzer mit SMB-Passwort.',
    'None ticked: every user with an SMB password, and domain users.': 'Keiner angehakt: alle Benutzer mit SMB-Passwort und alle Domänenbenutzer.',
    'via domain': 'über Domäne',
    'The domain controller checks the password; no local one needed.': 'Der Domänencontroller prüft das Passwort; kein lokales nötig.',
    'Domain users (Active Directory) log in with their domain password; they need no SMB password here.':
      'Domänenbenutzer (Active Directory) melden sich mit ihrem Domänenpasswort an und brauchen hier kein SMB-Passwort.',
    'Guests without login': 'Gäste ohne Anmeldung',
    'NFS clients (comma separated: address, network/prefix or *)':
      'NFS-Clients (durch Komma getrennt: Adresse, Netz/Präfix oder *)',
@@ -164,7 +168,7 @@
              onkeydown: ev => { if (ev.key === 'Enter') { ev.preventDefault(); addPrincipal(); } }}),
            h('button', {type: 'button', onclick: () => addPrincipal()}, t('Add'))),
          h('p', {class: 'hint'}, t('Users and groups of other sources (Active Directory) by name; groups with @.')),
          h('p', {class: 'hint'}, t('None ticked: every user with an SMB password.')),
          h('p', {class: 'hint'}, t('None ticked: every user with an SMB password, and domain users.')),
          h('label', {class: 'check'}, h('input', {type: 'checkbox', name: 'guest', checked: s.guest}),
            t('Guests without login')));
        const nfsBox = h('div', {},
@@ -485,11 +489,14 @@
    sections.push(h('section', {class: 'panel'},
      h('div', {class: 'toolbar'}, h('h2', {}, t('SMB access'))),
      h('p', {class: 'hint'}, t('SMB checks the password against an extra hash (NT hash) stored next to it. Setting the password here sets it for login and SMB together; it then stays in step with every password change. root never logs in over SMB.')),
      h('p', {class: 'hint'}, t('Domain users (Active Directory) log in with their domain password; they need no SMB password here.')),
      table([
        {title: t('User'), render: u => h('strong', {}, u.name)},
        {title: 'UID', render: u => u.uid, class: 'mono'},
        {title: t('SMB access'), render: u => h('span', {class: 'badge ' + (u.smbPassword ? 'ok' : '')}, u.smbPassword ? t('yes') : t('no'))},
        {title: '', class: 'actions', render: u => [
        {title: t('SMB access'), render: u => u.domain
          ? h('span', {class: 'badge ok', title: t('The domain controller checks the password; no local one needed.')}, t('via domain'))
          : h('span', {class: 'badge ' + (u.smbPassword ? 'ok' : '')}, u.smbPassword ? t('yes') : t('no'))},
        {title: '', class: 'actions', render: u => u.domain ? [] : [
          h('button', {class: 'small', onclick: () => setPassword(u)}, t('Set password')),
          u.smbPassword ? h('button', {class: 'small danger', onclick: () => removePassword(u)}, t('Remove')) : null,
        ]},