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.
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']
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))
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
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;
}