From: Volker Lendecke Date: Sun, 19 Aug 2007 20:00:43 +0000 (+0000) Subject: r24549: Fix unix_convert to return the already converted part X-Git-Tag: initial-v3-2-unstable~346 X-Git-Url: http://git.samba.org/samba.git/?p=tprouty%2Fsamba.git;a=commitdiff_plain;h=d4f442ed9b145990af4db26859663954ddd70926 r24549: Fix unix_convert to return the already converted part This API will change anyway when moving away from pstrings. It took so long to fix, because that rename bug I just fixed gave make test failures that had nothing to do with this one. I have samba4 tests for both bugs, will check them in when the build farm has caught up --- diff --git a/source/smbd/filename.c b/source/smbd/filename.c index d5c22e81c3..73e3869f50 100644 --- a/source/smbd/filename.c +++ b/source/smbd/filename.c @@ -173,7 +173,7 @@ NTSTATUS unix_convert(connection_struct *conn, result =determine_path_error( &orig_path[2], allow_wcard_last_component); } - goto fail; + return result; } /* @@ -222,8 +222,8 @@ NTSTATUS unix_convert(connection_struct *conn, if ((dirpath == NULL) && (!(dirpath = SMB_STRDUP("")))) { DEBUG(0, ("strdup failed\n")); - result = NT_STATUS_NO_MEMORY; - goto fail; + SAFE_FREE(name); + return NT_STATUS_NO_MEMORY; } /* @@ -602,9 +602,15 @@ NTSTATUS unix_convert(connection_struct *conn, DEBUG(5,("conversion finished %s -> %s\n",orig_path, name)); done: - result = NT_STATUS_OK; pstrcpy(orig_path, name); + SAFE_FREE(name); + SAFE_FREE(dirpath); + return NT_STATUS_OK; fail: + DEBUG(10, ("dirpath = [%s] start = [%s]\n", dirpath, start)); + pstrcpy(orig_path, dirpath); + pstrcat(orig_path, "/"); + pstrcat(orig_path, start); SAFE_FREE(name); SAFE_FREE(dirpath); return result;