saltcorn-samba 0.3.9 → 0.3.10
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.
- package/CHANGELOG.md +43 -0
- package/package.json +1 -1
- package/smb-client.js +29 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,49 @@ 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.3.10] – 2026-07-05
|
|
8
|
+
|
|
9
|
+
### Fixed – **DNS-Fehler: `getaddrinfo ENOTFOUND "host:445"`**
|
|
10
|
+
|
|
11
|
+
Nachdem 0.3.9 den Callback-Signatur-Bug behoben hatte und der Test-Button
|
|
12
|
+
endlich echt gegen den SMB-Server lief, kam bei der Verbindung ein neuer
|
|
13
|
+
Fehler zum Vorschein:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
getaddrinfo ENOTFOUND 192.168.110.10:445 (ENOTFOUND)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Ursache:** In `smb-client.js` wurde der UNC-Share-String so gebaut:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
const shareStr = `\\\\${server}${port ? ":" + port : ""}\\${share}`;
|
|
23
|
+
// => "\\\\192.168.110.10:445\\buero"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`@marsaud/smb2` interpretiert alles zwischen den führenden `\\` und dem
|
|
27
|
+
nächsten `\` als **Hostnamen** und reicht das direkt an
|
|
28
|
+
`net.connect()` / `dns.lookup()` weiter. Node versucht dann
|
|
29
|
+
`"192.168.110.10:445"` als Hostnamen aufzulösen — was natürlich
|
|
30
|
+
fehlschlägt.
|
|
31
|
+
|
|
32
|
+
**Fix:** Host und Port sauber trennen.
|
|
33
|
+
|
|
34
|
+
- Der `share`-UNC-Pfad enthält jetzt **nur den Host**:
|
|
35
|
+
`\\192.168.110.10\buero`
|
|
36
|
+
- Der Port wird über die separate `port`-Option an `SMB2` übergeben
|
|
37
|
+
(Default 445).
|
|
38
|
+
- Zusätzlich tolerant: falls jemand versehentlich `host:445` ins
|
|
39
|
+
Server-Feld einträgt, wird der Port dort herausgezogen.
|
|
40
|
+
- IPv6-Adressen in eckigen Klammern (`[::1]:445`) werden unterstützt.
|
|
41
|
+
|
|
42
|
+
### Notes
|
|
43
|
+
- Keine Konfig-Migration nötig. Wer bisher Host **ohne** Port eingetragen
|
|
44
|
+
hat, bekommt jetzt genau die gleiche Verbindung wie vorher — nur
|
|
45
|
+
funktionierend.
|
|
46
|
+
- Wer aus Verzweiflung `IP:445` ins Server-Feld getippt hatte: das wird
|
|
47
|
+
jetzt automatisch aufgesplittet. Sauberer ist trotzdem: Host im
|
|
48
|
+
Server-Feld, Port im Port-Feld.
|
|
49
|
+
|
|
7
50
|
## [0.3.9] – 2026-07-05
|
|
8
51
|
|
|
9
52
|
### Fixed – **Root-Cause-Fix: Falsche Callback-Signatur in allen Routen**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "saltcorn-samba",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "Saltcorn plugin: browse, upload, rename and delete files on a Samba/CIFS share. File-manager view, directory tree, inline PDF viewer, external-app open (smb://).",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/smb-client.js
CHANGED
|
@@ -116,13 +116,41 @@ function buildClient(config) {
|
|
|
116
116
|
if (!share) throw new Error("Samba: share missing");
|
|
117
117
|
if (/[\\/]/.test(share)) throw new Error("Samba: share must not contain slashes");
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
// Host und Port sauber trennen. Der Server-String darf NICHT im share-UNC-
|
|
120
|
+
// Pfad landen, sonst versucht Node's DNS "host:port" als Hostnamen aufzulösen
|
|
121
|
+
// (getaddrinfo ENOTFOUND "1.2.3.4:445"). @marsaud/smb2 nimmt den Port über
|
|
122
|
+
// die separate `port`-Option entgegen; der share-String enthält nur den Host.
|
|
123
|
+
//
|
|
124
|
+
// Zusätzlich tolerant sein, falls jemand versehentlich "host:445" ins
|
|
125
|
+
// Server-Feld getippt hat — dann Port dort rausziehen.
|
|
126
|
+
let hostOnly = String(server).trim();
|
|
127
|
+
let portFromServer;
|
|
128
|
+
// IPv6-Adressen in eckigen Klammern zulassen: [::1]:445
|
|
129
|
+
const v6 = hostOnly.match(/^\[([^\]]+)\](?::(\d+))?$/);
|
|
130
|
+
if (v6) {
|
|
131
|
+
hostOnly = v6[1];
|
|
132
|
+
if (v6[2]) portFromServer = Number(v6[2]);
|
|
133
|
+
} else {
|
|
134
|
+
// Nur splitten, wenn genau EIN Doppelpunkt — sonst IPv6 ohne Klammern
|
|
135
|
+
const colonCount = (hostOnly.match(/:/g) || []).length;
|
|
136
|
+
if (colonCount === 1) {
|
|
137
|
+
const [h, p] = hostOnly.split(":");
|
|
138
|
+
if (h && /^\d+$/.test(p)) {
|
|
139
|
+
hostOnly = h;
|
|
140
|
+
portFromServer = Number(p);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const effectivePort = Number(port) || portFromServer || 445;
|
|
146
|
+
const shareStr = `\\\\${hostOnly}\\${share}`;
|
|
120
147
|
const SMB2 = getSMB2();
|
|
121
148
|
const smb = new SMB2({
|
|
122
149
|
share: shareStr,
|
|
123
150
|
domain: domain || "WORKGROUP",
|
|
124
151
|
username: username || "guest",
|
|
125
152
|
password: password || "",
|
|
153
|
+
port: effectivePort,
|
|
126
154
|
autoCloseTimeout: 10000,
|
|
127
155
|
});
|
|
128
156
|
|