saltcorn-samba 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/index.js +30 -7
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,36 @@ All notable changes to `saltcorn-samba` are documented here.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.4.9] – 2026-07-05
8
+
9
+ ### Fixed – **`0xC0000033` beim Auflisten des Basispfads (smb3-client-vs-Samba-4.23-Bug jetzt auch für Basispfade abgefangen)**
10
+
11
+ Auch in 0.4.8 lief der Verbindungstest mit gesetztem Basispfad in
12
+ `QUERY_DIRECTORY failed: 0xC0000033` (`OBJECT_NAME_INVALID`). Ohne
13
+ Basispfad war die Verbindung korrekt und zeigte den gelben Hinweis.
14
+
15
+ **Ursache:** `smb3-client` sendet `QUERY_DIRECTORY` mit hart kodiertem
16
+ `FileInformationClass = 37` (`FileIdBothDirectoryInformation`). Samba
17
+ 4.23 lehnt das für bestimmte Verzeichnisse ab — auch dann, wenn der
18
+ Ordner existiert, geöffnet und `stat`-bar ist. Genau derselbe Bug, der
19
+ bisher nur beim Auflisten des Share-Roots als ‚Root nicht auflistbar'
20
+ aufgefangen wurde, kann auch den konfigurierten Basispfad selbst
21
+ treffen.
22
+
23
+ **Fix:** Der Fallback greift jetzt auch für Basispfade. Wenn
24
+ `client.readdir("")` mit `0xC0000033` scheitert, versucht die Test-Route
25
+ zusätzlich `client.stat("")` auf denselben Pfad:
26
+
27
+ - **stat OK** → Verbindung + Basispfad bestätigt, gelber Hinweis mit
28
+ Erklärung des bekannten Bugs und Workaround-Vorschlägen.
29
+ - **stat schlägt auch fehl** → normaler Fehlerpfad (Basispfad-
30
+ Diagnose mit Schreibvarianten-Probes) läuft weiter wie bisher.
31
+
32
+ Damit lassen sich Basispfade eintragen, auf die `readdir` per
33
+ `FileIdBothDirectoryInformation` scheitert — der Download und die
34
+ Unterordner-Ansicht funktionieren über die normalen SMB-Calls
35
+ trotzdem.
36
+
7
37
  ## [0.4.8] – 2026-07-05
8
38
 
9
39
  ### Fixed – **Basispfad wurde beim Verbindungstest doppelt vorangestellt (die eigentliche Ursache)**
package/index.js CHANGED
@@ -872,18 +872,30 @@ code{background:#f4f4f4;padding:2px 6px;border-radius:3px;word-break:break-all}<
872
872
  // subdirectory to test).
873
873
  const effectivePath = testCfg.share + (baseForDisplay ? "/" + baseForDisplay : "");
874
874
  const isRootProbe = !baseForDisplay;
875
- const isRootEnumBug = /0xC0000033|OBJECT_NAME_INVALID|Share-Root/i.test(msg);
876
- if (isRootProbe && isRootEnumBug) {
877
- // Share-root enumeration is a known smb3-client-vs-Samba
878
- // limitation. Fall back to stat("") which proves the whole
879
- // handshake works even if we can't list the root.
875
+ // smb3-client hardcodes FileInformationClass=37
876
+ // (FileIdBothDirectoryInformation) in QUERY_DIRECTORY. Some
877
+ // Samba 4.23+ configurations reject that with 0xC0000033
878
+ // (OBJECT_NAME_INVALID) for specific directories even though
879
+ // the same directory can be opened, stat'd and traversed. In
880
+ // that case we fall back to a plain stat: if the folder exists
881
+ // (stat succeeds) we can prove the connection works, but flag
882
+ // that enumeration is broken so the caller shows the yellow
883
+ // hint instead of a red error.
884
+ const isEnumBug = /0xC0000033|OBJECT_NAME_INVALID|QUERY_DIRECTORY failed/i.test(msg);
885
+ if (isEnumBug) {
880
886
  try {
881
887
  await client.stat("");
882
888
  const marker = [];
883
- marker._rootNotEnumerable = true;
889
+ if (isRootProbe) {
890
+ marker._rootNotEnumerable = true;
891
+ } else {
892
+ marker._basePathNotEnumerable = true;
893
+ marker._basePathForDisplay = baseForDisplay;
894
+ }
884
895
  return marker;
885
896
  } catch (statErr) {
886
- throw err;
897
+ // stat also failed — fall through to normal error handling
898
+ // (missing-basepath diagnostics or generic rethrow).
887
899
  }
888
900
  }
889
901
  // NAME_NOT_FOUND / PATH_NOT_FOUND on a configured base_path.
@@ -990,6 +1002,7 @@ code{background:#f4f4f4;padding:2px 6px;border-radius:3px;word-break:break-all}<
990
1002
  });
991
1003
  const took = Date.now() - started;
992
1004
  const rootNotEnum = Array.isArray(listing) && listing._rootNotEnumerable === true;
1005
+ const baseNotEnum = Array.isArray(listing) && listing._basePathNotEnumerable === true;
993
1006
  return res.json({
994
1007
  ok: true,
995
1008
  server: testCfg.server,
@@ -1011,6 +1024,16 @@ code{background:#f4f4f4;padding:2px 6px;border-radius:3px;word-break:break-all}<
1011
1024
  "Verhalten mit smb3-client). Bitte setzen Sie einen Basispfad " +
1012
1025
  "in der Plugin-Config (z.\u202fB. einen Unterordner der " +
1013
1026
  "Freigabe) — dann funktioniert der File-Manager vollständig."
1027
+ : baseNotEnum
1028
+ ? "Verbindung + Anmeldung erfolgreich, Basispfad \u201e" +
1029
+ (listing._basePathForDisplay || testCfg.base_path || "") +
1030
+ "\u201c wurde vom Server best\u00e4tigt (stat OK). Das direkte " +
1031
+ "Auflisten dieses Ordners lehnt Samba 4.23 mit smb3-client " +
1032
+ "aktuell ab (bekannter Bug: FileInformationClass=37 hart " +
1033
+ "kodiert, siehe README). Ordner-Unterb\u00e4ume, Datei-Downloads " +
1034
+ "und PDF-Ansicht funktionieren \u2014 nur die Wurzel des " +
1035
+ "Basispfads kann nicht direkt aufgelistet werden. Workaround: " +
1036
+ "tieferen Basispfad setzen oder Unterordner ansprechen."
1014
1037
  : undefined,
1015
1038
  });
1016
1039
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saltcorn-samba",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "Saltcorn plugin: browse, upload, rename and delete files on a Samba/CIFS share via SMB 3.1.1 (AES-CMAC signing, optional encryption). File-manager view, directory tree, inline PDF viewer, external-app open (smb://).",
5
5
  "main": "index.js",
6
6
  "scripts": {