diff options
author | kvik <kvik@a-b.xyz> | 2020-08-01 15:27:28 +0200 |
---|---|---|
committer | kvik <kvik@a-b.xyz> | 2020-08-01 15:27:28 +0200 |
commit | e5894dcceaedeaf7d4f5537dd306170b1b6d4814 (patch) | |
tree | 1cc00acf23373f15f69218ba1ccbb372a9cb3899 /sys/src/cmd/ndb | |
parent | 88a468f205af2bfdaa015a5bc33424ae0d56de08 (diff) |
pre-lib9p servers: fix incorrect Tversion handling
version(5) says:
If the server does not understand the client's version
string, it should respond with an Rversion message (not
Rerror) with the version string the 7 characters
``unknown''.
Pre-lib9p file servers -- all except cwfs(4) -- do return Rerror.
lib9p(2) follows the above spec, although ignoring the next part
concerning comparison after period-stripping. It assumes an
Fcall.version starting with "9P" is correctly formed and returns
the only supported version of the protocol, which seems alright.
This patch brings pre-lib9p servers in accordance with the spec.
Diffstat (limited to 'sys/src/cmd/ndb')
-rw-r--r-- | sys/src/cmd/ndb/cs.c | 10 | ||||
-rw-r--r-- | sys/src/cmd/ndb/dns.c | 10 |
2 files changed, 8 insertions, 12 deletions
diff --git a/sys/src/cmd/ndb/cs.c b/sys/src/cmd/ndb/cs.c index bb85080d4..0396c5706 100644 --- a/sys/src/cmd/ndb/cs.c +++ b/sys/src/cmd/ndb/cs.c @@ -510,12 +510,10 @@ rversion(Job *job) job->reply.msize = IOHDRSZ + Maxfdata; else job->reply.msize = job->request.msize; - if(strncmp(job->request.version, "9P2000", 6) != 0) - sendmsg(job, "unknown 9P version"); - else{ - job->reply.version = "9P2000"; - sendmsg(job, nil); - } + job->reply.version = "9P2000"; + if(strncmp(job->request.version, "9P", 2) != 0) + job->reply.version = "unknown"; + sendmsg(job, nil); } void diff --git a/sys/src/cmd/ndb/dns.c b/sys/src/cmd/ndb/dns.c index 692246d04..2510f3619 100644 --- a/sys/src/cmd/ndb/dns.c +++ b/sys/src/cmd/ndb/dns.c @@ -485,12 +485,10 @@ rversion(Job *job) job->reply.msize = IOHDRSZ + Maxfdata; else job->reply.msize = job->request.msize; - if(strncmp(job->request.version, "9P2000", 6) != 0) - sendmsg(job, "unknown 9P version"); - else{ - job->reply.version = "9P2000"; - sendmsg(job, 0); - } + job->reply.version = "9P2000"; + if(strncmp(job->request.version, "9P", 2) != 0) + job->reply.version = "unknown"; + sendmsg(job, nil); } void |