Re: [PATCH obexd 2/4] Add basic support for action commands on ftp driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Zitat von Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx>:
+static char *ftp_build_filename(struct ftp_session *ftp, const char *destname)
+{
+	char *filename;
+
+	/* DestName can either be relative or absolute (FTP style) */
+	if (g_path_is_absolute(destname))
+		filename = g_build_filename(destname, NULL);
+	else
+		filename = g_build_filename(ftp->folder, destname, NULL);
+
+	/* Check if destination is inside root path */
+	if (g_str_has_prefix(filename, ftp->folder))
+		return filename;
+
+	g_free(filename);
+
+	return NULL;
+}

Except that this interprets the destination header in a wrong way:
Absolute destination means that it is based on the path that you export to the _client_ as root, not the local filesystem root.

You should also catch stuff like the UNC path stuff and drive letter prefixes. No need to support all the sick stuff :-/

HS


--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux