git: 9front

Download patch

ref: 8154eb18d0bf134641049bddae675b48e8b6f293
parent: 56ccb89c5fda084c130ffe4b4f28de957f4419ad
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Tue Apr 23 18:38:03 EDT 2013

ftpd: implement "OPTS UTF-8 ON", fix uninitialized printing uninitialized memory in HELP command

--- a/sys/src/cmd/ip/ftpd.c
+++ b/sys/src/cmd/ip/ftpd.c
@@ -49,6 +49,7 @@
 int	modecmd(char*);
 int	namelistcmd(char*);
 int	nopcmd(char*);
+int	optscmd(char*);
 int	passcmd(char*);
 int	pasvcmd(char*);
 int	portcmd(char*);
@@ -96,6 +97,7 @@
 	{ "mode",	modecmd,	0, },
 	{ "nlst",	namelistcmd,	1, },
 	{ "noop",	nopcmd,		0, },
+	{ "opts",	optscmd,	0, },
 	{ "pass",	passcmd,	0, },
 	{ "pasv",	pasvcmd,	1, },
 	{ "pwd",	pwdcmd,		0, },
@@ -478,7 +480,21 @@
 	return bytes;
 }
 
+int
+optscmd(char *arg)
+{
+	char *p;
 
+	if(p = strchr(arg, ' '))
+		*p = 0;
+	if(cistrcmp(arg, "UTF-8") == 0){
+		reply("200 Command okay");
+		return 0;
+	}
+	reply("502 %s option not implemented", arg);
+	return 0;
+}
+
 /*
  *  just reply OK
  */
@@ -1593,6 +1609,7 @@
 
 	USED(arg);
 	reply("214- the following commands are implemented:");
+	buf[0] = 0;
 	p = buf;
 	e = buf+sizeof buf;
 	for(i = 0; cmdtab[i].name; i++){
--