connect: route legacy DOS scans through alias mangling

Use the shared DOS alias generator in legacy directory scan paths.
This keeps search, listing and attribute handling consistent for DOS
clients using older NCP calls.
This commit is contained in:
Mario Fetka
2026-05-20 16:42:25 +02:00
parent 14112a4565
commit 17eca4a6ac

View File

@@ -604,19 +604,22 @@ static int func_search_entry(NW_PATH *nwpath, int attrib,
if (dirbuff->d_ino) {
uint8 *name=(uint8*)(dirbuff->d_name);
uint8 dname[256];
uint8 dosalias[14];
xstrcpy(dname, name);
unix2doscharset(dname);
*kpath = '\0';
build_dos_83_alias(soptions, (uint8*)xkpath, name,
dirbuff->d_ino, dosalias, sizeof(dosalias));
okflag = (name[0] != '.' &&
( (!strcmp((char*)dname, (char*)entry))
|| fn_dos_match(dname, entry, soptions)));
( (!strcmp((char*)dosalias, (char*)entry))
|| fn_dos_match(dosalias, entry, soptions)));
if (okflag) {
*kpath = '\0';
strmaxcpy(kpath, (char*)name, sizeof(xkpath) - (int)(kpath-xkpath) -1 );
if (!s_stat(xkpath, &(fs->statb), NULL)) {
okflag = ( ( ( (fs->statb.st_mode & S_IFMT) == S_IFDIR) && (attrib & 0x10))
|| ( ( (fs->statb.st_mode & S_IFMT) != S_IFDIR) && !(attrib & 0x10)));
if (okflag){
xstrcpy(nwpath->fn, (char*)dname);
xstrcpy(nwpath->fn, (char*)dosalias);
XDPRINTF((5,0,"FOUND=:%s: attrib=0x%x", nwpath->fn, fs->statb.st_mode));
result = (*fs_func)(nwpath, fs);
if (result < 0) break;
@@ -685,13 +688,16 @@ static int get_dir_entry(NW_PATH *nwpath,
if (dirbuff->d_ino) {
uint8 *name=(uint8*)(dirbuff->d_name);
uint8 dname[256];
uint8 dosalias[14];
xstrcpy(dname, name);
unix2doscharset(dname);
*kpath = '\0';
build_dos_83_alias(soptions, (uint8*)xkpath, name,
dirbuff->d_ino, dosalias, sizeof(dosalias));
okflag = ((name[0] != '.' &&
( (!strcmp((char*)dname, (char*)entry))
|| fn_dos_match(dname, entry, soptions)))) ? 0 : -0xff;
( (!strcmp((char*)dosalias, (char*)entry))
|| fn_dos_match(dosalias, entry, soptions)))) ? 0 : -0xff;
if (!okflag) {
*kpath = '\0';
strmaxcpy(kpath, (char*)name, sizeof(xkpath) - (int)(kpath-xkpath) -1);
if (!s_stat(xkpath, statb, NULL)) {
okflag = (( ( ( (statb->st_mode & S_IFMT) == S_IFDIR) && (attrib & 0x10))
@@ -704,7 +710,7 @@ static int get_dir_entry(NW_PATH *nwpath,
if (soptions & VOL_OPTION_IS_PIPE) {
statb->st_size = 0x70000000|(statb->st_mtime&0xfffffff);
}
xstrcpy(nwpath->fn, (char*)dname);
xstrcpy(nwpath->fn, (char*)dosalias);
XDPRINTF((5,0,"FOUND=:%s: attrib=0x%x", nwpath->fn, statb->st_mode));
break; /* ready */
} else
@@ -788,11 +794,14 @@ static int get_dh_entry(DIR_HANDLE *dh,
if (dirbuff->d_ino) {
uint8 *name=(uint8*)(dirbuff->d_name);
uint8 dname[256];
uint8 dosalias[14];
xstrcpy(dname, name);
unix2doscharset(dname);
build_dos_83_alias(dh->vol_options, (uint8*)dh->unixname, name,
dirbuff->d_ino, dosalias, sizeof(dosalias));
okflag = (name[0] != '.' &&
( (!strcmp((char*)dname, (char*)entry))
|| fn_dos_match(dname, entry, dh->vol_options)));
( (!strcmp((char*)dosalias, (char*)entry))
|| fn_dos_match(dosalias, entry, dh->vol_options)));
if (okflag) {
strmaxcpy(dh->kpath, (char*)name,
@@ -812,7 +821,7 @@ static int get_dh_entry(DIR_HANDLE *dh,
if (okflag){
if (unixname)
strmaxcpy(unixname, dh->unixname, size_unixname-1);
strmaxcpy((char*)search, (char*)dname, size_search-1);
strmaxcpy((char*)search, (char*)dosalias, size_search-1);
break; /* ready */
}
} else okflag = 0;