chiark / gitweb /
server always mentions algorithm in client greeting
authorRichard Kettlewell <rjk@greenend.org.uk>
Fri, 21 Dec 2007 13:40:22 +0000 (13:40 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Fri, 21 Dec 2007 13:40:22 +0000 (13:40 +0000)
doc/disorder_protocol.5.in
python/disorder.py.in
scripts/completion.bash
server/server.c

index 7fdb81922d1bb037de76012871a645ef4825b2be..8cbbde7a5960714fd99d4b0c77f9e76b7d3a1679 100644 (file)
@@ -344,9 +344,8 @@ When a connection is made the server sends a \fB231\fR response before any
 command is received.  This contains an algorithm name and a challenge encoded
 in hex.
 .PP
-Currently the algorithm name is omitted if it is \fBsha1\fR (but this will
-probably change in a future version).  The other options are \fBsha256\fR,
-\fBsha384\fR and \fBsha512\fR.  \fBSHA1\fR etc work as synonyms.
+The possible algorithms are (currently) \fBsha1\fR, \fBsha256\fR, \fBsha384\fR
+and \fBsha512\fR.  \fBSHA1\fR etc work as synonyms.
 .PP
 The \fBuser\fR response consists of the selected hash of the user's password
 concatenated with the challenge, encoded in hex.
index 4e9b8cd8bc931bcc21af07ae40c95a2b5d4cec69..b18c7243ed0181a21f12584ee5b58cf3a07bc75f 100644 (file)
@@ -375,7 +375,8 @@ class client:
           s.connect(self.who)
         self.w = s.makefile("wb")
         self.r = s.makefile("rb")
-        (res, challenge) = self._simple()
+        (res, challenge_and_algo) = self._simple()
+        (algo, challenge) = _split(challenge_and_algo)
         if cookie is None:
           if self.user is None:
             user = self.config['username']
@@ -385,6 +386,7 @@ class client:
             password = self.config['password']
           else:
             password = self.password
+          # TODO support algorithms other than SHA-1
           h = sha.sha()
           h.update(password)
           h.update(binascii.unhexlify(challenge))
index 41da55ab72e1105e6a3ecbb75aac433ca0c400a5..323936685ec63921cfb57dc131e8f17a6e31551f 100644 (file)
@@ -25,13 +25,13 @@ complete -r disobedience 2>/dev/null || true
 
 complete -o default \
          -A file \
-         -W "allfiles authorize become dirs disable disable-random
+         -W "allfiles authorize dirs disable disable-random
              enable enable-random files get get-volume length log move
              play playing prefs quack queue random-disable
              random-enable recent reconfigure remove rescan scratch
              search set set-volume shutdown stats unset version resolve
              part pause resume scratch-id get-global set-global unset-global
-             tags new rtp-address adduser users edituser deluser
+             tags new rtp-address adduser users edituser deluser userinfo
              -h --help -H --help-commands --version -V --config -c
              --length --debug -d" \
         disorder
index ef321510ee14a158262bae899fa42284c049f858..b2045131c0f8ea5357b8a6ca75e7ea7226b378ae 100644 (file)
@@ -1352,15 +1352,9 @@ static int listen_callback(ev_source *ev,
   c->l = l;
   c->rights = 0;
   gcry_randomize(c->nonce, sizeof c->nonce, GCRY_STRONG_RANDOM);
-  if(!strcmp(config->authorization_algorithm, "sha1")
-     || !strcmp(config->authorization_algorithm, "SHA1")) {
-    sink_printf(ev_writer_sink(c->w), "231 %s\n",
-               hex(c->nonce, sizeof c->nonce));
-  } else {
-    sink_printf(ev_writer_sink(c->w), "231 %s %s\n",
-               config->authorization_algorithm,
-               hex(c->nonce, sizeof c->nonce));
-  }
+  sink_printf(ev_writer_sink(c->w), "231 %s %s\n",
+             config->authorization_algorithm,
+             hex(c->nonce, sizeof c->nonce));
   return 0;
 }