From 11501cd4e2b7e8dc9368eb57c6690e94e3bbd21d Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Tue, 6 Nov 2018 07:50:37 +0000
Subject: [PATCH] Fix bug introduced in rev 1.478 which prevented aliased
 directories from being CWD'd (chdir'd) into. I resisted the temptation to
 convert ftpalias.cfg to a different (sane) format (e.g. .ini) at this time,
 but that really should be done. Oh, and I noticed that aliases don't work
 with "DIR" wildcards, so that's a bug that needs fixing too.

---
 src/sbbs3/ftpsrvr.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/sbbs3/ftpsrvr.c b/src/sbbs3/ftpsrvr.c
index 1d3a83b3b3..90f1a4535c 100644
--- a/src/sbbs3/ftpsrvr.c
+++ b/src/sbbs3/ftpsrvr.c
@@ -2296,11 +2296,6 @@ static BOOL ftpalias(char* fullalias, char* filename, user_t* user, client_t* cl
 			*(p-1) = 0;
 	}
 
-	if(filename==NULL /* directory */ && *fname /* filename specified */) {
-		fclose(fp);
-		return(FALSE);
-	}
-
 	while(!feof(fp)) {
 		if(!fgets(line,sizeof(line),fp))
 			break;
@@ -2324,6 +2319,9 @@ static BOOL ftpalias(char* fullalias, char* filename, user_t* user, client_t* cl
 		FIND_WHITESPACE(tp);
 		if(*tp) *tp=0;
 
+		if(filename == NULL /* CWD? */ && *lastchar(p) != '/')
+			return FALSE;
+
 		if(!strnicmp(p,BBS_VIRTUAL_PATH,strlen(BBS_VIRTUAL_PATH))) {
 			if((dir=getdir(p+strlen(BBS_VIRTUAL_PATH),user,client))<0)	{
 				lprintf(LOG_WARNING,"0000 <%s> !Invalid virtual path: %s",user->alias, p);
-- 
GitLab