From b5cad2c2a75ee614ec765d8bfb5b1ad9df984f57 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 9 Jan 2007 08:56:24 +0000 Subject: r20627: orig_name is not needed anymore, and slightly simplify logic by doing early returns. Volker (This used to be commit 614651c6a72742173de5fa8723403880acc37c09) --- source3/smbd/reply.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index dfea8bcc0f..d50a6e5224 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1977,7 +1977,6 @@ NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, { pstring directory; pstring mask; - pstring orig_name; char *p; int count=0; NTSTATUS error = NT_STATUS_OK; @@ -1994,11 +1993,6 @@ NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, : NT_STATUS_OBJECT_PATH_NOT_FOUND; } - /* - * Feel my pain, this code needs rewriting *very* badly! -- vl - */ - pstrcpy(orig_name, name); - p = strrchr_m(name,'/'); if (!p) { pstrcpy(directory,"."); @@ -2030,7 +2024,7 @@ NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, if (SMB_VFS_UNLINK(conn,directory) == 0) { count++; - notify_fname(conn, orig_name, -1, + notify_fname(conn, directory, -1, NOTIFY_ACTION_REMOVED); } @@ -2041,8 +2035,13 @@ NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, if (strequal(mask,"????????.???")) pstrcpy(mask,"*"); - if (check_name(directory,conn)) - dir_hnd = OpenDir(conn, directory, mask, dirtype); + if (!check_name(directory,conn)) { + return NT_STATUS_OBJECT_PATH_NOT_FOUND; + } + + if (!(dir_hnd = OpenDir(conn, directory, mask, dirtype))) { + return NT_STATUS_NO_SUCH_FILE; + } /* XXXX the CIFS spec says that if bit0 of the flags2 field is set then the pattern matches against the long name, otherwise the short name -- cgit