]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/authcmds/challenge.c
3 * CMDLEVEL: QCMD_SECURE | QCMD_NOTAUTHED
5 * CMDDESC: Returns a challenge for use in challengeauth.
6 * CMDFUNC: csa_dochallenge
7 * CMDPROTO: int csa_dochallenge(void *source, int cargc, char **cargv);
8 * CMDHELP: Usage: challenge
9 * CMDHELP: Supplies you with a challenge and a list of algorithms accepted
10 * CMDHELP: for challenge response authentication, see CHALLENGEAUTH help
11 * CMDHELP: for more details.
14 #include "../chanserv.h"
15 #include "../authlib.h"
16 #include "../../lib/irc_string.h"
21 int csa_dochallenge(void *source
, int cargc
, char **cargv
) {
26 if (!(aup
=getactiveuserfromnick(sender
)))
30 if(t
> aup
->entropyttl
) {
31 cs_getrandbytes(aup
->entropy
,ENTROPYLEN
);
32 aup
->entropyttl
=t
+ 30;
35 chanservsendmessage(sender
,"CHALLENGE %s %s",cs_calcchallenge(aup
->entropy
),cs_cralgorithmlist());
36 cs_log(sender
,"CHALLENGE");