head 1.4; access; symbols PETIDOMO_4_0b6:1.4 PETIDOMO_4_0b5:1.4 PETIDOMO_4_0b4:1.4 PETIDOMO_4_0b3:1.4 BEFORETHL:1.4 petidomo-2-2:1.1.1.1 petidomo:1.1.1; locks; strict; comment @ * @; 1.4 date 2001.01.18.20.30.50; author rse; state Exp; branches; next 1.3; 1.3 date 2000.12.15.15.48.00; author simons; state Exp; branches; next 1.2; 1.2 date 2000.12.13.15.35.14; author simons; state Exp; branches; next 1.1; 1.1 date 2000.12.13.13.19.22; author simons; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2000.12.13.13.19.22; author simons; state Exp; branches; next ; desc @@ 1.4 log @As we agreed today, Petidomo is now open because licensed under GPL and always will be licensed under GPL, so use "Petidomo" as the program name everywhere and consistently. @ text @/* $Source: /e/ossp/cvs/ossp-pkg/petidomo/authen.c,v $ $Revision: 1.3 $ Copyright (C) 2000 by CyberSolutions GmbH, Germany. This file is part of Petidomo. Petidomo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. Petidomo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #include #include #include "libtext/text.h" #include "petidomo.h" int FindBodyPassword(struct Mail * MailStruct) { char * currLine; currLine = MailStruct->Body; while(isspace((int)*currLine)) currLine++; if (!strncasecmp(currLine, "Approve", 7) || !strncasecmp(currLine, "Approved", 8) || !strncasecmp(currLine, "Passwd", 6) || !strncasecmp(currLine, "Password", 8)) { MailStruct->Body = text_find_next_line(currLine); (text_find_next_line(currLine))[-1] = '\0'; while(!isspace((int)*currLine)) currLine++; if (ParseApproveLine(currLine) != 0) { syslog(LOG_ERR, "Failed to parse the approve statement in the mail body."); return -1; } MailStruct->Approve = currLine; } return 0; } bool isValidAdminPassword(const char * password, const char * listname) { const struct PD_Config * MasterConfig; const struct List_Config * ListConfig; if (password == NULL) return FALSE; MasterConfig = getMasterConfig(); if (!strcasecmp(MasterConfig->master_password, password)) return TRUE; if (listname != NULL) { ListConfig = getListConfig(listname); if (ListConfig->admin_password == NULL) return FALSE; if (!strcasecmp(ListConfig->admin_password, password)) return TRUE; } return FALSE; } bool isValidPostingPassword(const char * password, const char * listname) { const struct List_Config * ListConfig; if (password == NULL) return FALSE; if (isValidAdminPassword(password, listname) == TRUE) return TRUE; if (listname != NULL) { ListConfig = getListConfig(listname); if (ListConfig->posting_password == NULL) return FALSE; if (!strcasecmp(ListConfig->posting_password, password)) return TRUE; } return FALSE; } @ 1.3 log @ - Removed all debugging code. Now that Petidomo will be "rewritten" in C++, I need a new paradigm for debugging anyway and the old solution of mine was to messy for my taste anyway. - Petidomo no longer cares under what name it has been started. The different modes of operation will now be distinguished by a mandatory command line parameter. @ text @d2 2 a3 2 $Source: /d1/e/petidomo/cvs/petidomo/source/authen.c,v $ $Revision: 1.2 $ d7 1 a7 1 This file is part of OpenPetidomo. d9 1 a9 1 OpenPetidomo is free software; you can redistribute it and/or modify d14 1 a14 1 OpenPetidomo is distributed in the hope that it will be useful, but @ 1.2 log @ - Added correct GNU GPL copyright statements to the files. - Removed unnecessary include statements. @ text @d2 2 a3 2 $Source$ $Revision$ a45 1 debug((DEBUG_HERMES, 3, "Found password \"%s\" in mail body.", currLine)); a70 3 debug((DEBUG_AUTHEN, 5, "Comparing provided password '%s' to correct one '%s'.", ListConfig->admin_password, password)); d79 1 a79 1 { d83 1 a83 1 return FALSE; d86 1 a86 1 return TRUE; d88 2 a89 1 if (listname != NULL) { d93 1 a93 1 return FALSE; d95 1 a95 5 debug((DEBUG_AUTHEN, 5, "provided password '%s' to correct one '%s'.", ListConfig->posting_password, password)); if (!strcasecmp(ListConfig->posting_password, password)) { debug((DEBUG_AUTHEN, 2, "Provided password is correct!")); a97 3 else { debug((DEBUG_AUTHEN, 2, "Provided password is incorrect!")); } d99 1 a100 3 return FALSE; } @ 1.1 log @Initial revision @ text @d2 17 a18 7 * $Source: /usr/local/libdata/cvs/simons/petidomo/src/petidomo/authen.c,v $ * $Revision: 1.7 $ * $Date: 1998/08/14 22:54:39 $ * * Copyright (C) 1996 by CyberSolutions GmbH. * All rights reserved. */ d23 2 a24 2 #include #include @ 1.1.1.1 log @Imported Petidomo 2.2 as found on www.petidomo.com. @ text @@