]>
Commit | Line | Data |
---|---|---|
1dd6d55d | 1 | /* Automatically generated by refactor.pl. |
2 | * | |
3 | * | |
4 | * CMDNAME: spewpass | |
5 | * CMDLEVEL: QCMD_OPER | |
6 | * CMDARGS: 1 | |
7 | * CMDDESC: Search for a password in the database. | |
8 | * CMDFUNC: csu_dospewpass | |
9 | * CMDPROTO: int csu_dospewpass(void *source, int cargc, char **cargv); | |
94e4d2f4 CP |
10 | * CMDHELP: Usage: spewpass <pattern> |
11 | * CMDHELP: Displays all users with a password that matches the specified pattern. | |
1dd6d55d | 12 | */ |
13 | ||
14 | #include "../chanserv.h" | |
15 | #include "../../lib/irc_string.h" | |
16 | #include <stdio.h> | |
17 | #include <string.h> | |
18 | ||
19 | int csu_dospewpass(void *source, int cargc, char **cargv) { | |
20 | nick *sender=source; | |
21 | reguser *rup=getreguserfromnick(sender); | |
22 | reguser *dbrup; | |
23 | int i; | |
24 | unsigned int count=0; | |
25 | ||
26 | if (!rup) | |
27 | return CMD_ERROR; | |
28 | ||
29 | if (cargc < 1) { | |
30 | chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "spewpass"); | |
31 | return CMD_ERROR; | |
32 | } | |
33 | ||
34 | chanservstdmessage(sender, QM_SPEWHEADER); | |
35 | for (i=0;i<REGUSERHASHSIZE;i++) { | |
36 | for (dbrup=regusernicktable[i]; dbrup; dbrup=dbrup->nextbyname) { | |
94e4d2f4 | 37 | if (!UHasHelperPriv(dbrup) && !match(cargv[0], dbrup->password)) { |
1dd6d55d | 38 | chanservsendmessage(sender, "%-15s %-10s %-30s %s", dbrup->username, UHasSuspension(dbrup)?"yes":"no", dbrup->email?dbrup->email->content:"none set", dbrup->lastuserhost?dbrup->lastuserhost->content:"none"); |
39 | count++; | |
40 | if (count >= 2000) { | |
41 | chanservstdmessage(sender, QM_TOOMANYRESULTS, 2000, "users"); | |
42 | return CMD_ERROR; | |
43 | } | |
44 | } | |
45 | } | |
46 | } | |
47 | chanservstdmessage(sender, QM_RESULTCOUNT, count, "user", (count==1)?"":"s"); | |
48 | ||
49 | return CMD_OK; | |
50 | } |