unrealircd- supernets unrealircd source & configuration |
git clone git://git.acid.vegas/unrealircd.git |
Log | Files | Refs | Archive | README | LICENSE |
pass.c (2074B)
1 /* 2 * IRC - Internet Relay Chat, src/modules/pass.c 3 * (C) 2004 The UnrealIRCd Team 4 * 5 * See file AUTHORS in IRC package for additional names of 6 * the programmers. 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 1, or (at your option) 11 * any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 */ 22 23 #include "unrealircd.h" 24 25 CMD_FUNC(cmd_pass); 26 27 #define MSG_PASS "PASS" 28 29 ModuleHeader MOD_HEADER 30 = { 31 "pass", 32 "5.0", 33 "command /pass", 34 "UnrealIRCd Team", 35 "unrealircd-6", 36 }; 37 38 MOD_INIT() 39 { 40 CommandAdd(modinfo->handle, MSG_PASS, cmd_pass, 1, CMD_UNREGISTERED|CMD_USER|CMD_SERVER); 41 42 MARK_AS_OFFICIAL_MODULE(modinfo); 43 return MOD_SUCCESS; 44 } 45 46 MOD_LOAD() 47 { 48 return MOD_SUCCESS; 49 } 50 51 MOD_UNLOAD() 52 { 53 return MOD_SUCCESS; 54 } 55 56 /*************************************************************************** 57 * cmd_pass() - Added Sat, 4 March 1989 58 ***************************************************************************/ 59 /* 60 ** cmd_pass 61 ** parv[1] = password 62 */ 63 CMD_FUNC(cmd_pass) 64 { 65 const char *password = parc > 1 ? parv[1] : NULL; 66 67 if (!MyConnect(client) || (!IsUnknown(client) && !IsHandshake(client))) 68 { 69 sendnumeric(client, ERR_ALREADYREGISTRED); 70 return; 71 } 72 73 if (BadPtr(password)) 74 { 75 sendnumeric(client, ERR_NEEDMOREPARAMS, "PASS"); 76 return; 77 } 78 79 /* Store the password */ 80 safe_strldup(client->local->passwd, password, PASSWDLEN+1); 81 82 /* note: the original non-truncated password is supplied as 2nd parameter. */ 83 RunHookReturn(HOOKTYPE_LOCAL_PASS, !=0, client, password); 84 }