diff --git a/DRIVER-RELEASE.md b/DRIVER-RELEASE.md index 7c3c74e..0d6b9cd 100644 --- a/DRIVER-RELEASE.md +++ b/DRIVER-RELEASE.md @@ -1,13 +1,13 @@ -# MARS VME 0.8.1: Installation und Treiberfreigaben +# MARS VME 0.8.2: Installation und Treiberfreigaben ## Fertiges Linux-Paket -`releases/deb/mars-vme_0.8.1-1_amd64.deb` ist ein nativer Build fuer +`releases/deb/mars-vme_0.8.2-1_amd64.deb` ist ein nativer Build fuer **Ubuntu 26.04 amd64**, nicht pauschal fuer alte Debian-/Ubuntu-Versionen. Die ELF-Abhaengigkeiten werden beim Paketbau aus der Build-Umgebung ermittelt. ``` -sudo apt install ./releases/deb/mars-vme_0.8.1-1_amd64.deb +sudo apt install ./releases/deb/mars-vme_0.8.2-1_amd64.deb ``` Danach `http://SERVER:8787` im vertrauenswuerdigen LAN oeffnen, mit admin/admin @@ -66,3 +66,5 @@ Chromium-Test mit simulierter API: Auswahl zweier Betriebssysteme, Aktivierung, Downloadfilter und MAP-Anzeige bestanden. Windows-Installation, Paketinstallation auf einem zweiten Linux-Rechner und realer IPX-/NetWare-Netzwerkbetrieb sind noch nicht abgenommen. + +LFN-Konfiguration und optionaler DOS-Export: siehe [LONG-NAMES.md](LONG-NAMES.md). diff --git a/LONG-NAMES.md b/LONG-NAMES.md new file mode 100644 index 0000000..4baa767 --- /dev/null +++ b/LONG-NAMES.md @@ -0,0 +1,55 @@ +# Lange Dateinamen und alte DOS-PCs + +## Windows/OS2/geeignete NetWare-Clients + +Im Webfrontend unter **Volumes & Verzeichnisse → Lange Dateinamen** den +Entwurf aktivieren, Vorschau pruefen, speichern und den Dateiserver neu starten. +Die Funktion ergaenzt `O` (OS/2-Namensraum) und `i` (gemischte Schreibweise), +entfernt das widersprechende `k` und behaelt Trustee-Flags sowie Dateirechte. +Abschnitt 6 wird bei Bedarf auf Version 3.12 gesetzt; vorhandene Burst-Flags +bleiben erhalten. Neue DEB-Installationen erhalten `SYS ... iO` und `6 2`. +Vorhandene Serverkonfigurationen werden bei Paketupdates nicht ueberschrieben. + +Alte Microsoft-Windows-95-NetWare-Clients koennen zusaetzlich SupportLFN=2 +benoetigen (Upstream doc/FAQS, NWREDIR). Das ist eine Einstellung am Client, +keine Serverfunktion. Namensraum-Unterstuetzung ist im Server einkompiliert, +aber noch nicht mit realen Windows-/DOS-Clients abgenommen. Moderne Unicode- +und beliebig lange Pfadsemantik wird von diesem Legacy-Server nicht garantiert. + +## Unveraenderte DOS-PCs + +COMMAND.COM und gewoehnliche DOS-Programme verwenden weiterhin 8.3-Namen. +NETX/VLM und ein DOSLFN-TSR werden durch eine Serveroption nicht automatisch +LFN-faehig. DOSLFN darf nicht als garantierte NetWare-Netzwerkloesung gelten. +Echte lange Namen brauchen einen passenden Redirector UND LFN-faehige Software. + +Der mitgelieferte Export ist fuer diese PCs ein konkreter Ausweichweg: + +``` +mars-dos-export /pfad/zum/freizugebenden-datenbestand /srv/dos-snapshot-001 +``` + +Im Quellenbaum stattdessen `./dos-compat-export.py QUELLE NEUES_ZIEL`. +Das Ziel muss neu und ausserhalb der Quelle sein. Der Export veraendert die +Originale nicht; Links und Spezialdateien werden abgelehnt. Alle Dateinamen +werden DOS-kompatibel, Namenskollisionen und reservierte DOS-Geraetenamen +werden vermieden. In jedem Verzeichnis ordnet LFNAMES.TXT die Kurznamen den +Originalnamen zu, lesbar mit `TYPE LFNAMES.TXT` (CP850, sonst Escape-Darstellung). +Zu tiefe Pfade werden abgelehnt; dann einen kleineren Teilbaum exportieren. +Ein abgebrochener Export darf nicht als fertiges Volume freigegeben werden. + +Das neue Verzeichnis als SEPARATES schreibgeschuetztes Volume DOSDATA mit +Option `ir` eintragen. Vorhandene Quell-ACLs/Trustees werden NICHT kopiert: +gezielt nur einen fuer diese DOS-Benutzer freigegebenen Datenbestand exportieren +und die NetWare-Rechte dieses neuen Volumes passend vergeben. + +``` +MAP ROOT T:=DOSDATA: +T: +TYPE LFNAMES.TXT +``` + +Die Kopie ist statisch und schreibgeschuetzt. Aktualisierungen erfordern einen +neuen Export und einen kontrollierten Wechsel der Volume-Zuordnung. Es gibt +keine Ruecksynchronisation und keine Zusage, dass jedes alte DOS-Programm +lange Namen selbst anzeigen oder bearbeiten kann. diff --git a/README.md b/README.md index 74392c0..bc33c69 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +> **0.8.2:** Lange Dateinamen im Webfrontend aktivieren; neuer DOS-8.3-Export mit Namenskatalog. Siehe [LONG-NAMES.md](LONG-NAMES.md). Neues DEB unter `releases/deb/`. + > **Aktueller Paketstand 0.8.1:** [DEB, ZIPs und Freigabe im Webfrontend](DRIVER-RELEASE.md). Binaerdateien unter `releases/`; Windows-Laufzeittests stehen aus. Aeltere Preview-Hinweise unten beschreiben den vorherigen Stand. > **0.8 Legacy Preview:** siehe [LEGACY-BUILD.md](LEGACY-BUILD.md). Kein vollständig installierbares Windows-Release. diff --git a/dos-compat-export.py b/dos-compat-export.py new file mode 100755 index 0000000..cf099c9 --- /dev/null +++ b/dos-compat-export.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +"""Explicit read-only DOS snapshot; does not modify source or synthesize NCP aliases.""" +import argparse,pathlib,os,hashlib,re,shutil +p=argparse.ArgumentParser(description=__doc__) +p.add_argument('source',type=pathlib.Path);p.add_argument('destination',type=pathlib.Path) +a=p.parse_args();src=a.source.resolve(strict=True);dst=a.destination.resolve() +if not src.is_dir() or dst.exists() or dst.is_relative_to(src):p.error('Destination must be new and outside the source tree') +# Refuse links/special files rather than leaking files outside the chosen tree. +for root,dirs,files in os.walk(src): + for name in dirs+files: + f=pathlib.Path(root)/name + if f.is_symlink() or not (f.is_dir() or f.is_file()):p.error('Unsupported link or special file: '+str(f)) +def export(source,target): + target.mkdir();used={'LFNAMES.TXT'};rows=['DOS name -> original name (CP850; escaped unsupported characters)'] + for f in sorted(source.iterdir(),key=lambda x:x.name): + upper=f.name.upper() + if re.fullmatch(r'[A-Z0-9_]{1,8}(\.[A-Z0-9_]{1,3})?',upper) and upper not in used and not re.fullmatch(r'(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\..*)?',upper):alias=upper + else: + ext=re.sub('[^A-Z0-9]','',f.suffix.upper())[0:3] if f.is_file() else '' + for salt in range(100000): + stem='F'+hashlib.sha256((f.name+'\0'+str(salt)).encode()).hexdigest()[:7].upper() + alias=stem+('.'+ext if ext else '') + if alias not in used:break + else:raise RuntimeError('Alias space exhausted') + if len(str((target/alias).relative_to(dst)))>63:raise RuntimeError('DOS path exceeds 63 characters; choose a shallower source subtree') + used.add(alias);rows.append(alias+' -> '+f.name.replace('\r',r'\r').replace('\n',r'\n')) + if f.is_dir():export(f,target/alias) + else:shutil.copyfile(f,target/alias);(target/alias).chmod(0o444) + (target/'LFNAMES.TXT').write_bytes(('\r\n'.join(rows)+'\r\n').encode('cp850','backslashreplace')) + (target/'LFNAMES.TXT').chmod(0o444);target.chmod(0o555) +export(src,dst) +print('Read-only DOS snapshot: '+str(dst)) +print('Configure a SEPARATE read-only NetWare volume and its trustee rights. Source ACLs are not copied.') diff --git a/install.sh b/install.sh index 3a38177..a82d886 100755 --- a/install.sh +++ b/install.sh @@ -33,6 +33,7 @@ install -D -m 0755 build/mars_vme "$prefix/sbin/mars_vme" install -d -m 0700 /var/lib/mars-vme /var/lib/mars-vme/bindery-backups /var/lib/mars-vme/script-backups install -d -m 0755 "$prefix/share/mars-vme/www" for f in index.html app.js style.css login.html login.js; do install -m 0644 "websetup/$f" "$prefix/share/mars-vme/www/$f"; done +install -D -m 0755 dos-compat-export.py "$prefix/sbin/mars-dos-export" install -D -m 0755 install-driver-packages.py "$prefix/libexec/mars-install-drivers" if [[ -f releases/windows/manifest.json ]]; then install -d -m 0755 "$prefix/share/mars-vme/driver-packages" diff --git a/native/core.c b/native/core.c index 7eecdf8..7589ccf 100644 --- a/native/core.c +++ b/native/core.c @@ -16,7 +16,7 @@ #include #include #include -const char *managed[]={"1","2","3","4","5","12","13","17","21","45","200",NULL}; +const char *managed[]={"1","2","3","4","5","6","12","13","17","21","45","200",NULL}; char config_path[PATH_MAX],auth_path[PATH_MAX],backup_dir[PATH_MAX]; json_object *get(json_object *o,const char*k){json_object *v=NULL;return o&&json_object_object_get_ex(o,k,&v)?v:NULL;} const char *js(json_object *o,const char*k){json_object *v=get(o,k);if(!v||!json_object_is_type(v,json_type_string))return NULL;const char *s=json_object_get_string(v);return strlen(s)==(size_t)json_object_get_string_len(v)?s:NULL;} @@ -33,7 +33,7 @@ static int group_idx(const char *s){for(int i=0;managed[i];i++)if(!strcmp(s,mana /* Parse one line, without normalizing untouched bytes. */ static int line_group(const char *s,size_t n,const char **body,size_t *bn){const char *e=s+n;while(s8)return -1;char k[9];memcpy(k,a,s-a);k[s-a]=0;while(ss&&(e[-1]=='\r'||e[-1]=='\n'))e--;*body=s;*bn=e-s;return group_idx(k);} json_object *groups(const char *s){json_object *o=json_object_new_object();for(int i=0;managed[i];i++)json_object_object_add(o,managed[i],json_object_new_array());while(*s){const char *e=strchr(s,'\n');size_t n=e?(size_t)(e-s+1):strlen(s),bn=0;const char*b=NULL;int i=line_group(s,n,&b,&bn);if(i>=0)json_object_array_add(get(o,managed[i]),json_object_new_string_len(b,(int)bn));s+=n;}return o;} -char *merge(const char*s,json_object*changes){if(!changes||!json_object_is_type(changes,json_type_object))return NULL;json_object*old=groups(s);int changed[11]={0},ix[11]={0};json_object_object_foreach(changes,key,v){int i=group_idx(key);if(i<0||!json_object_is_type(v,json_type_array))goto bad;for(size_t j=0;j=0&&changed[i]){json_object*a=get(changes,managed[i]);if((size_t)ix[i]MAX_CONF){free(out);out=NULL;}json_object_put(old);return out; @@ -47,6 +47,8 @@ static char *netprop(const char*n,const char*k){char p[PATH_MAX];snprintf(p,size json_object *devices(void){json_object*a=json_object_new_array();struct if_nameindex *ifs=if_nameindex();if(!ifs)return a;for(struct if_nameindex*p=ifs;p->if_index;p++){char *t=netprop(p->if_name,"type");char w[PATH_MAX],phy[PATH_MAX];snprintf(w,sizeof w,"/sys/class/net/%s/wireless",p->if_name);snprintf(phy,sizeof phy,"/sys/class/net/%s/phy80211",p->if_name);if(t&&!strcmp(t,"1")&&strcmp(p->if_name,"marsipx0")&&access(w,F_OK)&&access(phy,F_OK)){json_object*o=json_object_new_object();char*m=netprop(p->if_name,"address"),*s=netprop(p->if_name,"operstate");addstr(o,"name",p->if_name);addstr(o,"mac",m);addstr(o,"state",s);free(m);free(s);json_object_array_add(a,o);}free(t);}if_freenameindex(ifs);return a;} static int dev_exists(json_object*d,const char*s){for(size_t i=0;i1)msg(err,"Abschnitt 6: nur eine Serverversion erlaubt."); + if(count(g,"6")==1){n=tokens(at(g,"6",0),©,a,12);if(n<1||n>2||(strcmp(a[0],"0")&&strcmp(a[0],"1")&&strcmp(a[0],"2")))msg(err,"Abschnitt 6: Serverversion 0, 1 oder 2 erforderlich.");free(copy);} if(count(g,"2")!=1)msg(err,"Abschnitt 2: genau ein Servername erforderlich.");else{n=tokens(at(g,"2",0),©,a,12);if(n!=1||strlen(a[0])>47||strspn(a[0],"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-")!=strlen(a[0]))msg(err,"Abschnitt 2: Servername ungültig.");free(copy);} if(count(g,"3")!=1)msg(err,"Abschnitt 3: genau ein internes IPX-Netz erforderlich.");else{n=tokens(at(g,"3",0),©,a,12);if(n<1||n>2||!number(a[0],0xfffffffe,&x))msg(err,"Abschnitt 3: interne Netznummer ungültig.");else{nets[nn++]=x;if(n==2&&!number(a[1],0xffffffffffffULL,&x))msg(err,"Abschnitt 3: Node ungültig.");}free(copy);} size_t nc=count(g,"4");if(!nc||nc>31)msg(err,"Abschnitt 4: 1–31 externe IPX-Netze erforderlich.");for(size_t i=0;i4){msg(err,"Abschnitt 4: Netz, Interface, Frame und optional Ticks.");free(copy);continue;}if(!number(a[0],0xfffffffe,&x))msg(err,"Abschnitt 4: Netznummer ungültig.");else{for(size_t j=0;j\n\nPackage: mars-vme\nArchitecture: any\nDescription: MARS VME\n') elfs=[p for p in stage.rglob('*') if p.is_file() and p.read_bytes()[:4]==b'\x7fELF'] deps=run('dpkg-shlibdeps','-O',*[str(p) for p in elfs],cwd=tmp).strip().split('shlibs:Depends=',1)[1] - (deb/'control').write_text(f'Package: mars-vme\nVersion: 0.8.1-1\nArchitecture: {arch}\nMaintainer: MARS VME \nDepends: {deps}, python3, jq, iproute2, nftables, libpcap0.8t64\nSection: net\nPriority: optional\nDescription: MARS VME server with web administration and Windows driver packages\n Host-native Ubuntu 26.04 build. Windows drivers are experimental.\n') + (deb/'control').write_text(f'Package: mars-vme\nVersion: 0.8.2-1\nArchitecture: {arch}\nMaintainer: MARS VME \nDepends: {deps}, python3, jq, iproute2, nftables, libpcap0.8t64\nSection: net\nPriority: optional\nDescription: MARS VME server with web administration and Windows driver packages\n Host-native Ubuntu 26.04 build. Windows drivers are experimental.\n') (deb/'postinst').write_text('''#!/bin/sh set -e if [ "$1" = configure ]; then @@ -34,7 +35,7 @@ if [ "$1" = configure ]; then install -d -m 0700 /var/lib/mars-vme if [ ! -f /usr/local/etc/mars_nwe/nwserv.conf ]; then umask 077 - printf '2 MARS\\n3 0x12345678 1\\n1 SYS /var/mars_nwe/SYS\\n5 0\\n200 0\\n' > /usr/local/etc/mars_nwe/nwserv.conf + printf '2 MARS\\n3 0x12345678 1\\n1 SYS /var/mars_nwe/SYS iO\\n6 2\\n5 0\\n200 0\\n' > /usr/local/etc/mars_nwe/nwserv.conf fi if [ -d /run/systemd/system ]; then systemctl daemon-reload @@ -54,7 +55,7 @@ fi ''') (deb/'conffiles').write_text(''.join('/'+str(f.relative_to(stage))+'\n' for f in (stage/'usr/local/etc').rglob('*') if f.is_file())) for name in ('postinst','prerm'):(deb/name).chmod(0o755) - for name in ('COPYING','LEGACY-BUILD.md','WINDOWS.md','DRIVER-RELEASE.md'):copy(name,'usr/share/doc/mars-vme/'+name) - package=out/f'mars-vme_0.8.1-1_{arch}.deb';run('dpkg-deb','--root-owner-group','--build',str(stage),str(package)) - (out/'SHA256SUMS').write_text(hashlib.sha256(package.read_bytes()).hexdigest()+' '+package.name+'\n') + for name in ('COPYING','LEGACY-BUILD.md','WINDOWS.md','DRIVER-RELEASE.md','LONG-NAMES.md'):copy(name,'usr/share/doc/mars-vme/'+name) + package=out/f'mars-vme_0.8.2-1_{arch}.deb';run('dpkg-deb','--root-owner-group','--build',str(stage),str(package)) + (out/'SHA256SUMS').write_text(''.join(hashlib.sha256(f.read_bytes()).hexdigest()+' '+f.name+'\n' for f in sorted(out.glob('*.deb')))) print(package) diff --git a/releases/BUILD-LFN.json b/releases/BUILD-LFN.json new file mode 100644 index 0000000..d39213d --- /dev/null +++ b/releases/BUILD-LFN.json @@ -0,0 +1,23 @@ +{ + "version": "0.8.2-1", + "source_sha256": { + "native/core.c": "dd048922531a921b87ef2c79d5047f3c8670290e13a1c3736706e8b81720ced2", + "websetup/app.js": "209acb50db97f34aee9a506704f00fdcb9715899950616479c775baea5ba2a71", + "websetup/index.html": "3985fa75fe434915c9429936193b1712936e8a7cf23990f4079fa279cb5229df", + "dos-compat-export.py": "9f7b981080830f97021ef266a5f64ae9b4f612eaf2bc99e01a841c4c2b119fa3", + "LONG-NAMES.md": "f8dc419bfbde56bca8b61e4c5750e0f3c25ff7759ac7814618f0121a219d01f9", + "packaging/build-deb.py": "aa7f02c2beb5deb677dd909978c481b13e961a1aaae11d3b4c1fce4393150c03" + }, + "deb_sha256": "1caabb60251dd78a6ae6731330031923c29ac4425c141374279331a58f8bd923", + "tested": [ + "native configuration merge", + "Chromium LFN controls preserving permissions", + "DOS export collisions and reserved names", + "HTTP authentication and downloads", + "DEB extraction" + ], + "not_tested": [ + "real DOS or Windows NetWare client", + "native long filenames in legacy DOS programs" + ] +} diff --git a/releases/README.md b/releases/README.md index 95a3cbd..77eab76 100644 --- a/releases/README.md +++ b/releases/README.md @@ -1,6 +1,6 @@ # Fertige Pakete -- [Linux DEB – Ubuntu 26.04 amd64](deb/mars-vme_0.8.1-1_amd64.deb) +- [Linux DEB – Ubuntu 26.04 amd64](deb/mars-vme_0.8.2-1_amd64.deb) - [Windows 95](windows/WIN95.zip) - [Windows 98](windows/WIN98.zip) - [Windows ME](windows/WINME.zip) @@ -11,3 +11,5 @@ [Installation und Web-Freigaben](../DRIVER-RELEASE.md). SHA256SUMS liegen in den jeweiligen Unterordnern. Windows-Treiber sind gebaute, noch nicht unter Windows abgenommene Kandidaten. + +[Lange Dateinamen und DOS-Kompatibilitaet](../LONG-NAMES.md). diff --git a/releases/deb/SHA256SUMS b/releases/deb/SHA256SUMS index 4876edb..8dd80e3 100644 --- a/releases/deb/SHA256SUMS +++ b/releases/deb/SHA256SUMS @@ -1 +1,2 @@ 4cfb0f64673b409e1c5371267d4bd28e5678bc89e4473202020c3eb6b27aa390 mars-vme_0.8.1-1_amd64.deb +1caabb60251dd78a6ae6731330031923c29ac4425c141374279331a58f8bd923 mars-vme_0.8.2-1_amd64.deb diff --git a/releases/deb/mars-vme_0.8.2-1_amd64.deb b/releases/deb/mars-vme_0.8.2-1_amd64.deb new file mode 100644 index 0000000..a2208ff Binary files /dev/null and b/releases/deb/mars-vme_0.8.2-1_amd64.deb differ diff --git a/tests/test_dos_export.py b/tests/test_dos_export.py new file mode 100644 index 0000000..85a0d3b --- /dev/null +++ b/tests/test_dos_export.py @@ -0,0 +1,23 @@ +from pathlib import Path +import tempfile,subprocess,os,re +root=Path(__file__).resolve().parents[1] +with tempfile.TemporaryDirectory() as d: + base=Path(d);src=base/'src';src.mkdir() + for name in ['Langer Dateiname mit Umlaut ä.txt','readme.txt','README.TXT','CON','LFNAMES.TXT']:(src/name).write_text(name) + (src/'Langer Unterordner').mkdir();(src/'Langer Unterordner'/'Bericht November 2026.pdf').write_bytes(b'pdf') + dst=base/'dos';subprocess.run(['python3',str(root/'dos-compat-export.py'),str(src),str(dst)],check=True) + originals={f.read_bytes() for f in src.rglob('*') if f.is_file()} + copied={f.read_bytes() for f in dst.rglob('*') if f.is_file() and f.name!='LFNAMES.TXT'} + assert originals==copied + for folder in [dst,*[p for p in dst.rglob('*') if p.is_dir()]]: + names=[p.name for p in folder.iterdir()];assert len(names)==len(set(names)) + assert all(re.fullmatch(r'[A-Z0-9_]{1,8}(\.[A-Z0-9_]{1,3})?',n) for n in names) + assert 'CON' not in names + assert (folder/'LFNAMES.TXT').exists() + assert 'Langer Dateiname mit Umlaut ä.txt' in (dst/'LFNAMES.TXT').read_bytes().decode('cp850') + # source links must fail rather than exporting data outside the selected tree + (src/'link').symlink_to('/etc/passwd') + assert subprocess.run(['python3',str(root/'dos-compat-export.py'),str(src),str(base/'bad')],capture_output=True).returncode!=0 + for f in dst.rglob('*'):f.chmod(0o755 if f.is_dir() else 0o644) + dst.chmod(0o755) + print('PASS: DOS aliases, collisions, reserved names, bytes, CP850 catalog, link rejection') diff --git a/tests/test_driver_ui.cjs b/tests/test_driver_ui.cjs index 5a57164..373808e 100644 --- a/tests/test_driver_ui.cjs +++ b/tests/test_driver_ui.cjs @@ -15,6 +15,14 @@ const fs=require('fs'),path=require('path'),assert=require('assert'); else {const file=path.join(__dirname,'../websetup',u==='/'?'index.html':u.slice(1));return route.fulfill({body:fs.readFileSync(file),contentType:u.endsWith('.js')?'text/javascript':u.endsWith('.css')?'text/css':'text/html'});} return route.fulfill({json:body});}); await page.goto('http://127.0.0.1:18889/'); + await page.waitForFunction(()=>document.querySelector('#configPath').textContent==='/test'); + await page.evaluate(()=>show(2)); + await page.locator('#g1').fill('SYS /srv/sys kt 711 600 # keep rights'); + await page.locator('#g6').fill('0 0x1'); + await page.locator('#enableLFN').click(); + assert.equal(await page.locator('#g1').inputValue(),'SYS /srv/sys tiO 711 600 # keep rights'); + assert.equal(await page.locator('#g6').inputValue(),'2 0x1'); + await page.evaluate(()=>{mark(false);show(0)}); await page.locator('#gatewayOpen').click();await page.locator('#gwWinClients').click(); await page.waitForFunction(()=>document.querySelector('#driverStatus').textContent.includes('Noch keine')); assert.equal(await page.locator('a[href^="/drivers/"]:visible').count(),0); diff --git a/tests/test_native.c b/tests/test_native.c index dad7e37..78f7bf5 100644 --- a/tests/test_native.c +++ b/tests/test_native.c @@ -10,6 +10,7 @@ int main(void){char tmp[]="/tmp/mars-native-test-XXXXXX";assert(mkdtemp(tmp));snprintf(config_path,sizeof config_path,"%s/nwserv.conf",tmp);snprintf(auth_path,sizeof auth_path,"%s/.mars-web-auth.json",tmp);snprintf(backup_dir,sizeof backup_dir,"%s/.mars-web-backups",tmp); const char*orig="# preserve\r\n2 OLD\r\n99 keep exactly\r\n12 SUPERVISOR root SecretPass\r\n200 0\r\n";assert(!atomic_write(config_path,orig,strlen(orig),0600));json_object*g=groups(orig);assert(!strcmp(json_object_get_string(json_object_array_get_idx(get(g,"2"),0)),"OLD"));char*unchanged=merge(orig,g);assert(unchanged&&!strcmp(unchanged,orig));free(unchanged);json_object_put(g); g=json_tokener_parse("{\"2\":[\"NEW\"],\"13\":[\"TEST nobody TestPass123\"]}");char*next=merge(orig,g);assert(next&&strstr(next,"2 NEW\r\n")&&strstr(next,"99 keep exactly\r\n")&&strstr(next,"13 TEST nobody TestPass123\r\n"));json_object_put(g);g=json_tokener_parse("{\"2\":[\"BAD\\n4 invalid\"]}");assert(!merge(orig,g));json_object_put(g);puts("PASS merge, CRLF, unknown lines, injection rejection"); + g=json_tokener_parse("{\"6\":[\"2 0x1\"]}");char *lfn=merge("6 0 0x1\n99 keep\n",g);assert(lfn&&strstr(lfn,"6 2 0x1\n")&&strstr(lfn,"99 keep\n"));free(lfn);json_object_put(g);puts("PASS managed LFN server version merge"); char h[65],name[64];sha(orig,h);assert(!save_conf(orig,h,next,name));assert(*name);char*b=backup_read(name);assert(b&&!strcmp(b,orig));free(b);g=backups();assert(json_object_array_length(g)==1);json_object_put(g);assert(save_conf(orig,h,"stale",name)==-2);assert(!backup_read("../../etc/shadow"));char*cur=read_file(config_path,MAX_CONF,1);assert(cur&&!strcmp(cur,next));free(cur);free(next);puts("PASS backup, revision conflict, private file, traversal rejection"); assert(!auth_init());assert(auth_default());assert(auth_verify("admin"));assert(!auth_verify("wrong"));assert(auth_set("short",0));assert(!auth_set("ChangedPassword123",0));assert(!auth_default());assert(auth_verify("ChangedPassword123"));assert(!auth_verify("admin"));assert(!auth_init());assert(auth_verify("ChangedPassword123"));puts("PASS PBKDF2, default, persistent password, wrong password"); g=validate("2 SERVER\n3 0x1 1\n4 0x1 no-such-device 802.3 1\n5 1\n200 1\n1 SYS /\n12 SUPERVISOR not-a-real-user\n");assert(json_object_array_length(get(g,"errors"))>=5);json_object_put(g);g=devices();if(json_object_array_length(g)){const char*dev=js(json_object_array_get_idx(g,0),"name");char*conf=NULL;assert(asprintf(&conf,"2 SERVER\n3 0x1 1\n4 0x2 %s 802.3 1\n5 0\n200 0\n1 SYS /tmp\n12 SUPERVISOR root SecretPass\n",dev)>0);json_object*v=validate(conf);assert(json_object_array_length(get(v,"errors"))==0);json_object_put(v);free(conf);}json_object_put(g);puts("PASS validation invalid configuration and detected Ethernet interface"); diff --git a/websetup/app.js b/websetup/app.js index 5149b23..0924fec 100644 --- a/websetup/app.js +++ b/websetup/app.js @@ -1,5 +1,5 @@ 'use strict'; -const $=id=>document.getElementById(id), groups=['1','2','3','4','5','12','13','17','21','45','200']; +const $=id=>document.getElementById(id), groups=['1','2','3','4','5','6','12','13','17','21','45','200']; let scriptDoc=null, scriptOriginal='', scriptScope='system', scriptName=''; let state=null, mode='guided', checked=null, dirty=false, busy=false, page=0, rawBase='', backupName=null; function notice(text,kind='ok'){const el=$('notice');el.replaceChildren();if(text){const p=document.createElement('div');p.className='message '+kind;p.textContent=text;el.append(p);}if($('viewDialog').open)$('sheetNotice').textContent=text;} @@ -11,7 +11,7 @@ async function api(path,body){const options={cache:'no-store',credentials:'same- async function task(fn){if(busy)return;busy=true;updateControls();try{await fn();}catch(e){notice(e.message,'error');}finally{busy=false;updateControls();}} function row(parent,values){const tr=document.createElement('tr');values.forEach(v=>{const td=document.createElement('td');td.textContent=v;tr.append(td);});parent.append(tr);} function option(parent,value,label){const o=document.createElement('option');o.value=value;o.textContent=label;parent.append(o);} -function apply(s){state=s;$('defaultWarning').hidden=!s.defaultPassword;mode='guided';rawBase='';backupName=null;for(const k of groups)$('g'+k).value=s.groups[k].join('\n');$('raw').value='';$('rawArea').hidden=true;$('superPassword').value='';$('unixUser').value='';$('configPath').textContent=s.path;$('configStatus').textContent=s.validation.errors.length?'Einrichtung nötig':'Grundprüfung OK';$('deviceCount').textContent=s.devices.length;$('devices').replaceChildren();$('newDevice').replaceChildren();for(const d of s.devices){row($('devices'),[d.name,d.mac,d.state]);option($('newDevice'),d.name,d.name+' · '+d.state);}if(!s.devices.length)row($('devices'),['Kein geeignetes Interface','–','–']);$('backups').replaceChildren();for(const b of s.backups)option($('backups'),b,b);$('restore').disabled=!s.backups.length;$('serviceHint').textContent=s.services?'Aktionen werden erst nach einer Bestätigung ausgeführt.':'Dienststeuerung deaktiviert (Standardkennwort oder --no-services).';mark(false);} +function apply(s){state=s;$('defaultWarning').hidden=!s.defaultPassword;mode='guided';rawBase='';backupName=null;for(const k of groups)$('g'+k).value=(s.groups[k]||[]).join('\n');$('raw').value='';$('rawArea').hidden=true;$('superPassword').value='';$('unixUser').value='';$('configPath').textContent=s.path;$('configStatus').textContent=s.validation.errors.length?'Einrichtung nötig':'Grundprüfung OK';$('deviceCount').textContent=s.devices.length;$('devices').replaceChildren();$('newDevice').replaceChildren();for(const d of s.devices){row($('devices'),[d.name,d.mac,d.state]);option($('newDevice'),d.name,d.name+' · '+d.state);}if(!s.devices.length)row($('devices'),['Kein geeignetes Interface','–','–']);$('backups').replaceChildren();for(const b of s.backups)option($('backups'),b,b);$('restore').disabled=!s.backups.length;$('serviceHint').textContent=s.services?'Aktionen werden erst nach einer Bestätigung ausgeführt.':'Dienststeuerung deaktiviert (Standardkennwort oder --no-services).';mark(false);} async function status(){const s=await api('/api/status');const a=s['mars-nwe-pcap.service']||'Nicht verfügbar';const b=s['mars-pcapd.service']||'Nicht verfügbar';$('statusText').textContent='MARS NWE\n'+a+'\n\nPCAP\n'+b;$('serverStatus').textContent=a.match(/^ActiveState=(.*)$/m)?.[1]||'Nicht verfügbar';$('brokerStatus').textContent='PCAP: '+(b.match(/^ActiveState=(.*)$/m)?.[1]||'unbekannt');} function rawPayload(){const value=$('raw').value;const normalized=rawBase.replace(/\r\n|\r/g,'\n');if(value===normalized){if(backupName)return {revision:state.revision,mode:'backup',name:backupName};return {revision:state.revision,mode:'raw',text:rawBase};}const text=rawBase.includes('\r\n')&&!rawBase.replace(/\r\n/g,'').includes('\n')?value.replace(/\n/g,'\r\n'):value;return {revision:state.revision,mode:'raw',text};} function payload(){if(mode==='raw')return rawPayload();return {revision:state.revision,mode,groups:Object.fromEntries(groups.map(k=>[k,$('g'+k).value.split('\n').filter(x=>x.trim())]))};} @@ -155,3 +155,17 @@ async function driverState(){const d=await api('/api/drivers');document.querySel $('gwWinClients').onclick=()=>{ $('winClientDialog').showModal();driverState().catch(e=>$('driverStatus').textContent=e.message);}; $('activateDrivers').onclick=async()=>{const b=$('activateDrivers');b.disabled=true;try{const platforms=Array.from(document.querySelectorAll('[name=driverOS]:checked'),el=>el.value);if(!platforms.length)throw Error('Mindestens ein Betriebssystem wählen.');await api('/api/drivers/activate',{confirm:true,platforms});await driverState();}catch(e){$('driverStatus').textContent=e.message;}finally{b.disabled=false;}}; $('winClientClose').onclick=()=> $('winClientDialog').close(); + +$('enableLFN').onclick=()=>guided(()=>{ + const lines=$('g1').value.split('\n').filter(x=>x.trim()).map(line=>{ + const hash=line.indexOf('#'),comment=hash>=0?line.slice(hash):''; + const fields=(hash>=0?line.slice(0,hash):line).trim().split(/\s+/); + if(fields.length<2)throw Error('Volume-Eintrag unvollständig.'); + let flags=(fields[2]||'').replace(/[-k]/g,''); + if(!flags.includes('i'))flags+='i';if(!flags.includes('O'))flags+='O';fields[2]=flags; + return fields.join(' ')+(comment?' '+comment:''); + }); + $('g1').value=lines.join('\n'); + const version=$('g6').value.trim().split(/\s+/);if(!['1','2'].includes(version[0]))version[0]='2'; + $('g6').value=version.join(' ');mark();notice('LFN-Entwurf vorbereitet. Vorschau prüfen, speichern und Dateiserver neu starten. DOS-Programme benötigen weiterhin 8.3-Namen.'); +}); diff --git a/websetup/index.html b/websetup/index.html index 27d55bd..14c3a63 100644 --- a/websetup/index.html +++ b/websetup/index.html @@ -7,7 +7,7 @@
Einrichtungsreihenfolge & Sicherheit

Einrichtungsreihenfolge

  1. Ein separates Retro-LAN und eine Ethernet-Schnittstelle vorbereiten.
  2. Servername, interne Netznummer und mindestens einen externen Frame konfigurieren.
  3. SYS-Volume und gegebenenfalls weitere Datenvolumes einrichten.
  4. SUPERVISOR-Zuordnung und Initialpasswort prüfen.
  5. Änderungen validieren, Vorschau kontrollieren und speichern.
  6. Server starten, SAP-Erkennung und Dateioperationen am Client testen.
Historische NetWare-Dienste sind nicht für ungeschützte Netze geeignet. Diese Oberfläche hat Administratorrechte. Nur in einem vertrauenswürdigen Administrationsnetz freigeben, niemals im Internet.
- +