| 2747 | } |
| 2748 | |
| 2749 | void changeclientrole(int client, int role, char *pwd, bool force) |
| 2750 | { |
| 2751 | pwddetail pd; |
| 2752 | bool success = false; |
| 2753 | if(!isdedicated || !valid_client(client)) return; |
| 2754 | pd.line = -1; |
| 2755 | if(role == clients[client]->role) return; |
| 2756 | if(role == CR_ADMIN && pwd && pwd[0] && passwords.check(clients[client]->name, pwd, clients[client]->salt, &pd) && !pd.denyadmin) |
| 2757 | { |
| 2758 | mlog(ACLOG_INFO,"[%s] player %s used admin password in line %d", clients[client]->hostname, clients[client]->name[0] ? clients[client]->name : "[unnamed]", pd.line); |
| 2759 | success = true; |
| 2760 | } |
| 2761 | if(clients[client]->checkvitadate(VS_ADMIN)) |
| 2762 | { |
| 2763 | mlog(ACLOG_INFO,"[%s] player %s claimed admin through valid vita claim (pubkey: %s)", clients[client]->hostname, clients[client]->name[0] ? clients[client]->name : "[unnamed]", clients[client]->pubkeyhex); |
| 2764 | success = true; |
| 2765 | } |
| 2766 | if(force || role == CR_DEFAULT || success) |
| 2767 | { |
| 2768 | if(role > CR_DEFAULT) |
| 2769 | { |
| 2770 | loopv(clients) clients[i]->role = CR_DEFAULT; |
| 2771 | } |
| 2772 | clients[client]->role = role; |
| 2773 | sendserveropinfo(-1); |
| 2774 | mlog(ACLOG_INFO,"[%s] set role of player %s to %s", clients[client]->hostname, clients[client]->name[0] ? clients[client]->name : "[unnamed]", role == CR_ADMIN ? "admin" : "normal player"); // flowtron : connecting players haven't got a name yet (connectadmin) |
| 2775 | if(role > CR_DEFAULT) sendiplist(client); |
| 2776 | } |
| 2777 | else if(pwd && pwd[0]) disconnect_client(client, DISC_SOPLOGINFAIL); // avoid brute-force |
| 2778 | if(curvote) curvote->evaluate(); |
| 2779 | } |
| 2780 | |
| 2781 | void senddisconnectedscores(int cn) |
| 2782 | { |
no test coverage detected