]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/authcmds/ticketauth.c
1 /* Automatically generated by refactor.pl.
5 * CMDLEVEL: QCMD_SECURE | QCMD_NOTAUTHED | QCMD_HIDDEN
7 * CMDDESC: Authenticates you on the bot using a ticket.
8 * CMDFUNC: csa_doticketauth
9 * CMDPROTO: int csa_doticketauth(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: ticketauth <ticket>
11 * CMDHELP: This is an internal QuakeNet function, there's no point in
12 * CMDHELP: asking for details on how it works cos' you'll not get any!
15 #include "../chanserv.h"
19 int csa_completeauth(nick
*sender
, reguser
*rup
, char *authtype
);
21 int csa_doticketauth(void *source
, int cargc
, char **cargv
) {
24 nick
*sender
=(nick
*)source
;
28 time_t logintimestamp
, expiry
;
29 char buf
[512], *digest
, *junk
;
32 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "ticketauth");
36 if (!(aup
=getactiveuserfromnick(sender
)))
42 logintimestamp
= atoi(cargv
[1]);
43 expiry
= atoi(cargv
[2]);
47 if(t
< logintimestamp
) {
48 chanservstdmessage(sender
, QM_TICKETNOTYETVALID
);
52 chanservstdmessage(sender
, QM_TICKETEXPIRED
);
56 snprintf(buf
, sizeof(buf
), "%ld %jd %jd %s", uid
, (intmax_t)logintimestamp
, (intmax_t)expiry
, junk
);
58 ret
= csc_verifyqticket(buf
, digest
);
60 chanservstdmessage(sender
, QM_CONFIGURATIONERROR
);
63 chanservstdmessage(sender
, QM_INVALIDHMAC
);
67 if(!(rup
=findreguserbyID(uid
))) {
68 chanservstdmessage(sender
, QM_UNKNOWNUSER
, "??");
72 if(rup
->lastpasschange
>= logintimestamp
) {
73 chanservstdmessage(sender
, QM_PASSEMAILCHANGED
);
77 return csa_completeauth(sender
, rup
, "TICKETAUTH");