MCPcopy Create free account
hub / github.com/assaultcube/AC / reqauth

Function reqauth

source/src/master.cpp:471–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469}
470
471void reqauth(mclient &c, uint id, char *name)
472{
473 if(ENET_TIME_DIFFERENCE(servtime, c.lastauth) < AUTH_THROTTLE)
474 return;
475
476 c.lastauth = servtime;
477
478 purgeauths(c);
479
480 time_t t = time(NULL);
481 char *ct = ctime(&t);
482 if(ct)
483 {
484 char *newline = strchr(ct, '\n');
485 if(newline) *newline = '\0';
486 }
487 string ip;
488 if(enet_address_get_host_ip(&c.address, ip, sizeof(ip)) < 0) copystring(ip, "-");
489 conoutf("%s: attempting \"%s\" as %u from %s", ct ? ct : "-", name, id, ip);
490
491 userinfo *u = users.access(name);
492 if(!u)
493 {
494 outputf(c, "failauth %u\n", id);
495 return;
496 }
497
498 if(c.authreqs.length() >= AUTH_LIMIT)
499 {
500 outputf(c, "failauth %u\n", c.authreqs[0].id);
501// freechallenge(c.authreqs[0].answer);
502 c.authreqs.remove(0);
503 }
504
505 authreq &a = c.authreqs.add();
506 a.reqtime = servtime;
507 a.id = id;
508// uint seed[3] = { (uint)starttime, (uint)servtime, randomMT() };
509 static vector<char> buf;
510 buf.setsize(0);
511// a.answer = genchallenge(u->pubkey, seed, sizeof(seed), buf);
512
513 outputf(c, "chalauth %u %s\n", id, buf.getbuf());
514}
515
516void confauth(mclient &c, uint id, const char *val)
517{

Callers 1

checkclientinputFunction · 0.85

Calls 11

purgeauthsFunction · 0.85
copystringFunction · 0.85
outputfFunction · 0.85
accessMethod · 0.80
setsizeMethod · 0.80
conoutfFunction · 0.70
enet_address_get_host_ipFunction · 0.50
lengthMethod · 0.45
removeMethod · 0.45
addMethod · 0.45
getbufMethod · 0.45

Tested by

no test coverage detected