int adouble_path(TALLOC_CTX *ctx,
		 const struct smb_filename *smb_fname_in,
		 struct smb_filename **pp_smb_fname_out)
{
	char *parent;
	const char *base;
	struct smb_filename *smb_fname = cp_smb_filename(ctx,
						smb_fname_in);

	if (smb_fname == NULL) {
		return -1;
	}

	/* We need streamname to be NULL */
	TALLOC_FREE(smb_fname->stream_name);

	/* And we're replacing base_name. */
	TALLOC_FREE(smb_fname->base_name);

	SET_STAT_INVALID(smb_fname->st);

	if (!parent_dirname(smb_fname, smb_fname_in->base_name,
				&parent, &base)) {
		TALLOC_FREE(smb_fname);
		return -1;
	}

	if (ISDOT(parent)) {
		smb_fname->base_name = talloc_asprintf(smb_fname,
					"._%s", base);
	} else {
		smb_fname->base_name = talloc_asprintf(smb_fname,
					"%s/._%s", parent, base);
	}
	if (smb_fname->base_name == NULL) {
		TALLOC_FREE(smb_fname);
		return -1;
	}

	*pp_smb_fname_out = smb_fname;

	return 0;
}
int adouble_path(TALLOC_CTX *ctx,
		 const struct smb_filename *smb_fname_in,
		 struct smb_filename **pp_smb_fname_out)
{
	char *parent;
	const char *base;
	struct smb_filename *smb_fname = cp_smb_filename(ctx,
						smb_fname_in);

	if (smb_fname == NULL) {
		return -1;
	}

	 
	TALLOC_FREE(smb_fname->stream_name);

	 
	TALLOC_FREE(smb_fname->base_name);

	SET_STAT_INVALID(smb_fname->st);

	if (!parent_dirname(smb_fname, smb_fname_in->base_name,
				&parent, &base)) {
		TALLOC_FREE(smb_fname);
		return -1;
	}

	if (ISDOT(parent)) {
		smb_fname->base_name = talloc_asprintf(smb_fname,
					"._%s", base);
	} else {
		smb_fname->base_name = talloc_asprintf(smb_fname,
					"%s/._%s", parent, base);
	}
	if (smb_fname->base_name == NULL) {
		TALLOC_FREE(smb_fname);
		return -1;
	}

	*pp_smb_fname_out = smb_fname;

	return 0;
}