dos mangle
Some checks are pending
Source release / source-package (push) Waiting to run

This commit is contained in:
Mario Fetka
2026-05-20 15:25:52 +02:00
parent 0696545dad
commit 9112bedf9f
5 changed files with 16 additions and 17 deletions

View File

@@ -257,6 +257,7 @@ extern time_t nw_2_un_time(uint8 *d, uint8 *t);
extern void un_time_2_nw(time_t time, uint8 *d, int high_low);
extern void mangle_dos_name(NW_VOL *vol, uint8 *unixname, uint8 *pp, int len);
extern int nw_add_trustee(int dir_handle, uint8 *data, int len,
uint32 id, int trustee, int extended);

View File

@@ -10,7 +10,6 @@ extern int build_dos_83_alias(int options, uint8 *parent_unix,
uint8 *real_name, ino_t inode,
uint8 *alias, int alias_len);
extern void mangle_dos_name(NW_VOL *vol, uint8 *unixname, uint8 *pp, int len);
extern int fn_dos_match(uint8 *s, uint8 *p, int soptions);
#endif
#endif

View File

@@ -60,6 +60,12 @@ static int act_umode_file=0;
#include "namspace.h"
#include "connect.h"
/* connect.h may already be include-guarded through another header before
* NW_VOL is visible, so keep this local forward declaration before the
* first call in build_dir_name().
*/
void mangle_dos_name(NW_VOL *vol, uint8 *unixname, uint8 *pp, int len);
typedef struct {
dev_t dev; /* unix dev */
@@ -1052,7 +1058,7 @@ static int build_dir_name(NW_PATH *nwpath, /* gets complete path */
dos2unixcharset(pp);
pp += offset;
pathlen -= offset;
mangle_dos_name(v, unixname, pp);
mangle_dos_name(v, unixname, pp, sizeof(unixname) - (int)(pp - unixname));
unix2doscharset(pp);
XDPRINTF((5, 0, "Mangled DOS/unixname=%s", unixname));
memcpy(ppp, pp, pathlen);
@@ -2679,13 +2685,7 @@ static int get_match(uint8 *unixname, uint8 *p)
return(0);
}
void mangle_dos_name(NW_VOL *vol, uint8 *unixname, uint8 *pp)
{
struct stat stb;
if (!s_stat(unixname, &stb, NULL)) /* path is ok I hope */
return;
get_match(unixname, pp-1);
}
/* DOS name mangling is provided by namedos.c. */
int nw_add_trustee(int dir_handle, uint8 *data, int len,

View File

@@ -224,7 +224,8 @@ void mangle_dos_name(NW_VOL *vol, uint8 *unixname, uint8 *pp, int len)
uint8 *parent_slash;
DIR *d;
if (!vol || !unixname || !pp || !*pp || len <= 1) return;
if (!vol || !unixname || !pp || !*pp) return;
if (len <= 1) return;
slash=(uint8*)strchr((char*)pp, '/');
memset(rest, 0, sizeof(rest));
@@ -255,8 +256,7 @@ void mangle_dos_name(NW_VOL *vol, uint8 *unixname, uint8 *pp, int len)
if (*rest) {
uint8 *next=(uint8*)strchr((char*)pp, '/');
if (next && *(next+1))
mangle_dos_name(vol, unixname, next+1,
len - (int)((next+1)-pp));
mangle_dos_name(vol, unixname, next+1, len - (int)((next+1) - pp));
}
return;
}
@@ -294,7 +294,7 @@ static inline int get_n_p(uint8 **p)
return(pc);
}
int fn_dos_match(uint8 *s, uint8 *p, int soptions)
static int ns_fn_dos_match(uint8 *s, uint8 *p, int soptions)
/* OS/2 name matching routine */
{
int pc, sc;
@@ -329,7 +329,7 @@ int fn_dos_match(uint8 *s, uint8 *p, int soptions)
int np;
if (!*p) return(1); /* last star */
while (*s) {
if (fn_dos_match(s, p, soptions) == 1) return(1);
if (ns_fn_dos_match(s, p, soptions) == 1) return(1);
else if (*s=='.') {
pp=p;
if (!get_n_p(&p) || !get_n_p(&p))
@@ -342,7 +342,7 @@ int fn_dos_match(uint8 *s, uint8 *p, int soptions)
np=get_n_p(&p);
p=pp;
if (np == '.' || np == 1000)
return(fn_dos_match(s, p, soptions));
return(ns_fn_dos_match(s, p, soptions));
}
return(0);

View File

@@ -655,8 +655,7 @@ leave_build_nwpath:
else
up_fn(pp);
mangle_dos_name(v, unixname, pp,
sizeof(unixname)-v->unixnamlen-npbeg);
mangle_dos_name(v, unixname, pp, sizeof(unixname)-v->unixnamlen-npbeg);
if (nplen > 0) {
unix2doscharset(pp);