From db58f5141612ed8a3d3ae03cda03cb44cd22d6de Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 13 Aug 2003 02:31:22 +0000 Subject: More chkpth fixes from Samba4 tests. Jeremy. (This used to be commit a62cf6bf16e2f435f504e936c31992f5697a309a) --- source3/smbd/reply.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index dcb07ab509..4f3c12e984 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -401,8 +401,21 @@ int reply_chkpth(connection_struct *conn, char *inbuf,char *outbuf, int dum_size one at a time - if a component fails it expects ERRbadpath, not ERRbadfile. */ - if(errno == ENOENT) - return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND); + if(errno == ENOENT) { + /* + * Windows returns different error codes if + * the parent directory is valid but not the + * last component - it returns NT_STATUS_OBJECT_NAME_NOT_FOUND + * for that case and NT_STATUS_OBJECT_PATH_NOT_FOUND + * if the path is invalid. + */ + if (bad_path) { + return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND); + } else { + return ERROR_NT(NT_STATUS_OBJECT_NAME_NOT_FOUND); + } + } else if (errno == ENOTDIR) + return ERROR_NT(NT_STATUS_NOT_A_DIRECTORY); return(UNIXERROR(ERRDOS,ERRbadpath)); } -- cgit