1 /*
2 * ----------------------------------------------------------------
3 * ircproxy - MatchPass Function
4 * ----------------------------------------------------------------
5 * Copyright (C) 1997-2009 Jonas Kvinge
6 *
7 * This file is part of ircproxy.
8 *
9 * ircproxy is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * ircproxy is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ircproxy. If not, see <http://www.gnu.org/licenses/>.
21 *
22 * Additional permission under GNU GPL version 3 section 7
23 *
24 * If you modify ircproxy, or any covered work, by linking or
25 * combining it with openssl (or a modified version of that library),
26 * containing parts covered by the terms of the OpenSSL License and the
27 * SSLeay License, the licensors of ircproxy grant you additional
28 * permission to convey the resulting work.
29 *
30 * $Id: matchpass.c 54 2009-03-18 18:23:29Z jonasio $
31 *
32 */
33
34 #define MATCHPASS_C
35
36 #define NEED_SYS_TYPES_H 1 /* Extra types */
37 #define NEED_SYS_PARAM_H 1 /* Some systems need this */
38 #define NEED_LIMITS_H 0 /* Kernel limits */
39 #define NEED_STDARG_H 1 /* va_list, etc */
40 #define NEED_ERRNO_H 1 /* errno */
41 #define NEED_CTYPE_H 0 /* isdigit(), etc */
42 #define NEED_NETINET_IN_H 0 /* in_addr, sockaddr_in, etc */
43 #define NEED_ARPA_INET_H 0 /* inet_ntoa(), inet_aton(), etc */
44 #define NEED_STDIO_H 1 /* Standard C UNIX functions */
45 #define NEED_STDLIB_H 1 /* malloc(), exit(), atoi(), etc */
46 #define NEED_TIME_H 1 /* time(), etc */
47 #define NEED_SYSCTL_H 0 /* sysctl(), etc */
48 #define NEED_SYS_STAT_H 0 /* chmod(), mkdir(), etc */
49 #define NEED_SYS_UIO_H 0 /* iovec, etc */
50 #define NEED_FCNTL_H 1 /* open(), creat(), fcntl(), etc */
51 #define NEED_SYS_IOCTL_H 0 /* ioctl(), etc */
52 #define NEED_SYS_FILIO_H 0 /* Solaris need this for ioctl(), etc */
53 #define NEED_UNISTD_H 1 /* Unix standard functions */
54 #define NEED_STRING_H 1 /* C string functions */
55 #define NEED_SIGNAL_H 0 /* Signal functions */
56 #define NEED_SYS_SOCKET_H 0 /* Socket functions */
57 #define NEED_NETDB_H 0 /* Network database functions */
58 #define NEED_ARPA_NAMESER_H 0 /* Nameserver definitions */
59 #define NEED_GETUSERPW_HEADERS 0 /* Functions to retrive system passwords */
60
61 #include "includes.h"
62 #include "nlcrypt.h"
63 #include "matchpass.h"
64 #include "conf.h"
65
66 /* VARIABLES - JONAS (31.07.2001) */
67
68 extern struct Conf_Struct ConfS;
69
70 /* MATCHPASS - JONAS (31.07.2001) */
71
matchpass(const char * const ConfPassPT,char * ClearPassPT)72 unsigned short int matchpass(const char *const ConfPassPT, char *ClearPassPT) {
73
74 char *CheckPassPT = ClearPassPT;
75
76 if (ConfS.CryptPass == TRUE) { CheckPassPT = nlcrypt(ClearPassPT, ConfPassPT); }
77
78 if (strcmp(CheckPassPT, ConfPassPT) == FALSE) { return(TRUE); }
79 return(FALSE);
80
81 }
82