no_optimization_out:
+ /*
+ * We must still return an *pp_dirpath
+ * initialized to ".", and a *pp_start
+ * pointing at smb_fname->base_name.
+ */
+
+ TALLOC_FREE(parent_fname.base_name);
+
+ *pp_dirpath = talloc_strdup(ctx, ".");
+ if (*pp_dirpath == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ /*
+ * Safe to use discard_const_p
+ * here as by convention smb_fname->base_name
+ * is allocated off ctx.
+ */
+ *pp_start = discard_const_p(char, smb_fname->base_name);
return NT_STATUS_OK;
}
goto err;
}
/* dirpath must exist. */
- dirpath = talloc_strdup(ctx,"");
+ dirpath = talloc_strdup(ctx,".");
if (dirpath == NULL) {
status = NT_STATUS_NO_MEMORY;
goto err;
* building the directories with talloc_asprintf and free it.
*/
- if ((dirpath == NULL) && (!(dirpath = talloc_strdup(ctx,"")))) {
+ if ((dirpath == NULL) && (!(dirpath = talloc_strdup(ctx,".")))) {
DEBUG(0, ("talloc_strdup failed\n"));
status = NT_STATUS_NO_MEMORY;
goto err;
size_t start_ofs =
start - smb_fname->base_name;
- if (*dirpath != '\0') {
+ if (!ISDOT(dirpath)) {
tmp = talloc_asprintf(
smb_fname, "%s/%s",
dirpath, unmangled);
size_t start_ofs =
start - smb_fname->base_name;
- if (*dirpath != '\0') {
+ if (!ISDOT(dirpath)) {
tmp = talloc_asprintf(smb_fname,
"%s/%s/%s", dirpath,
found_name, end+1);
size_t start_ofs =
start - smb_fname->base_name;
- if (*dirpath != '\0') {
+ if (!ISDOT(dirpath)) {
tmp = talloc_asprintf(smb_fname,
"%s/%s", dirpath,
found_name);
* Add to the dirpath that we have resolved so far.
*/
- if (*dirpath != '\0') {
+ if (!ISDOT(dirpath)) {
char *tmp = talloc_asprintf(ctx,
"%s/%s", dirpath, start);
if (!tmp) {
return NT_STATUS_OK;
fail:
DEBUG(10, ("dirpath = [%s] start = [%s]\n", dirpath, start));
- if (dirpath && *dirpath != '\0') {
+ if (dirpath && !ISDOT(dirpath)) {
smb_fname->base_name = talloc_asprintf(smb_fname, "%s/%s",
dirpath, start);
} else {