r24549: Fix unix_convert to return the already converted part
authorVolker Lendecke <vlendec@samba.org>
Sun, 19 Aug 2007 20:00:43 +0000 (20:00 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:29:56 +0000 (12:29 -0500)
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

source/smbd/filename.c

index d5c22e81c368454b4b9a6a17f34ae419eee279ec..73e3869f50b7b079696282a2b85e98296a4c609d 100644 (file)
@@ -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;