2000-12-13 15:54:29 +00:00
|
|
|
/*
|
|
|
|
|
$Source$
|
|
|
|
|
$Revision$
|
|
|
|
|
|
|
|
|
|
Copyright (C) 2000 by CyberSolutions GmbH, Germany.
|
|
|
|
|
|
2001-01-18 20:30:50 +00:00
|
|
|
This file is part of Petidomo.
|
2000-12-13 15:54:29 +00:00
|
|
|
|
2001-01-18 20:30:50 +00:00
|
|
|
Petidomo is free software; you can redistribute it and/or modify
|
2000-12-13 15:54:29 +00:00
|
|
|
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.
|
|
|
|
|
|
2001-01-18 20:30:50 +00:00
|
|
|
Petidomo is distributed in the hope that it will be useful, but
|
2000-12-13 15:54:29 +00:00
|
|
|
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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __PETIDOMO_H__
|
|
|
|
|
#define __PETIDOMO_H__ 1
|
|
|
|
|
|
|
|
|
|
/********** Useful defines and declarations **********/
|
|
|
|
|
|
|
|
|
|
#ifndef __HAVE_DEFINED_BOOL__
|
|
|
|
|
# define __HAVE_DEFINED_BOOL__ 1
|
|
|
|
|
typedef int bool;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef DEBUG_DMALLOC
|
|
|
|
|
# define xmalloc(size) malloc(size)
|
|
|
|
|
# define xstrdup(string) strdup(string)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#undef FALSE
|
|
|
|
|
#define FALSE 0
|
|
|
|
|
#undef TRUE
|
|
|
|
|
#define TRUE 1
|
|
|
|
|
|
|
|
|
|
/********** Includes all modules need **********/
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <syslog.h>
|
|
|
|
|
#ifdef DEBUG_DMALLOC
|
|
|
|
|
# include <dmalloc.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-01-15 17:06:48 +00:00
|
|
|
/********** main.c **********/
|
|
|
|
|
|
|
|
|
|
extern char g_is_approved;
|
2001-01-19 12:49:44 +00:00
|
|
|
extern const char* who_am_i;
|
2001-01-20 13:52:41 +00:00
|
|
|
extern char* masterconfig_path;
|
2001-01-15 17:06:48 +00:00
|
|
|
|
2000-12-13 15:54:29 +00:00
|
|
|
/********** config.c **********/
|
|
|
|
|
|
2001-01-08 20:36:19 +00:00
|
|
|
struct PD_Config
|
|
|
|
|
{
|
2000-12-13 15:54:29 +00:00
|
|
|
char * fqdn;
|
|
|
|
|
char * master_password;
|
|
|
|
|
char * mta;
|
|
|
|
|
char * mta_options;
|
2001-01-08 20:36:19 +00:00
|
|
|
char * list_dir;
|
2001-01-15 16:29:11 +00:00
|
|
|
char * ack_queue_dir;
|
2001-01-08 20:36:19 +00:00
|
|
|
char * help_file;
|
|
|
|
|
char * acl_file;
|
|
|
|
|
char * index_file;
|
|
|
|
|
};
|
|
|
|
|
|
2001-01-15 16:55:45 +00:00
|
|
|
enum list_type_t
|
2001-01-08 20:36:19 +00:00
|
|
|
{
|
2000-12-13 15:54:29 +00:00
|
|
|
LIST_OPEN,
|
|
|
|
|
LIST_CLOSED,
|
2001-01-15 16:55:45 +00:00
|
|
|
LIST_MODERATED,
|
|
|
|
|
LIST_ACKED,
|
|
|
|
|
LIST_ACKED_ONCE
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum subscription_type_t
|
|
|
|
|
{
|
|
|
|
|
SUBSCRIPTION_PUBLIC,
|
|
|
|
|
SUBSCRIPTION_ADMIN,
|
|
|
|
|
SUBSCRIPTION_ACKED
|
2001-01-08 20:36:19 +00:00
|
|
|
};
|
2000-12-13 15:54:29 +00:00
|
|
|
|
2001-01-08 20:36:19 +00:00
|
|
|
struct List_Config
|
|
|
|
|
{
|
2000-12-13 15:54:29 +00:00
|
|
|
unsigned int listtype;
|
2001-01-15 16:55:45 +00:00
|
|
|
unsigned int subtype;
|
2000-12-13 15:54:29 +00:00
|
|
|
int allowmembers;
|
|
|
|
|
char * fqdn;
|
|
|
|
|
char * admin_password;
|
|
|
|
|
char * posting_password;
|
|
|
|
|
char * postingfilter;
|
|
|
|
|
char * archivepath;
|
|
|
|
|
char * reply_to;
|
2001-01-08 20:36:19 +00:00
|
|
|
char * intro_file;
|
|
|
|
|
char * desc_file;
|
|
|
|
|
char * sig_file;
|
|
|
|
|
char * header_file;
|
|
|
|
|
char * acl_file;
|
|
|
|
|
char * list_dir;
|
|
|
|
|
char * address_file;
|
2001-01-11 14:17:53 +00:00
|
|
|
char * ack_file;
|
2001-01-08 20:36:19 +00:00
|
|
|
};
|
2000-12-13 15:54:29 +00:00
|
|
|
|
2001-01-20 13:52:41 +00:00
|
|
|
int InitPetidomo(const char*);
|
2001-01-08 15:55:07 +00:00
|
|
|
const struct PD_Config *getMasterConfig(void);
|
|
|
|
|
const struct List_Config *getListConfig(const char* listname);
|
2000-12-13 15:54:29 +00:00
|
|
|
|
|
|
|
|
/********** rfcparse.c **********/
|
|
|
|
|
|
2001-01-08 20:36:19 +00:00
|
|
|
struct Mail
|
|
|
|
|
{
|
2000-12-13 15:54:29 +00:00
|
|
|
char * Header;
|
|
|
|
|
char * Body;
|
|
|
|
|
char * Envelope;
|
|
|
|
|
char * From;
|
|
|
|
|
char * Subject;
|
|
|
|
|
char * Reply_To;
|
|
|
|
|
char * Message_Id;
|
|
|
|
|
char * Approve;
|
|
|
|
|
char * ListSignature;
|
2001-01-08 20:36:19 +00:00
|
|
|
};
|
2000-12-13 15:54:29 +00:00
|
|
|
|
|
|
|
|
void RemoveCarrigeReturns(char *buffer);
|
|
|
|
|
int isRFC822Address(const char *buffer);
|
|
|
|
|
int ParseAddressLine(char *buffer);
|
|
|
|
|
int ParseReplyToLine(char *buffer);
|
|
|
|
|
int ParseFromLine(char *buffer);
|
|
|
|
|
int ParseMessageIdLine(char *buffer);
|
|
|
|
|
int ParseApproveLine(char *buffer);
|
|
|
|
|
void CanonizeAddress(char **buffer, const char *fqdn);
|
|
|
|
|
int ParseMail(struct Mail **result, char *incoming_mail, const char *fqdn);
|
|
|
|
|
|
|
|
|
|
/********** io.c **********/
|
|
|
|
|
|
|
|
|
|
char *LoadFromDescriptor(int fd);
|
|
|
|
|
char *loadfile(const char *filename);
|
|
|
|
|
int savefile(const char *filename, const char *buffer);
|
|
|
|
|
|
|
|
|
|
/********** archive.c **********/
|
|
|
|
|
|
|
|
|
|
int ArchiveMail(const struct Mail *MailStruct, const char *listname);
|
|
|
|
|
|
|
|
|
|
/********** authen.c **********/
|
|
|
|
|
|
|
|
|
|
int FindBodyPassword(struct Mail *MailStruct);
|
|
|
|
|
int isValidAdminPassword(const char *password, const char *listname);
|
|
|
|
|
int isValidPostingPassword(const char *password, const char *listname);
|
|
|
|
|
|
|
|
|
|
/********** filter.c **********/
|
|
|
|
|
|
|
|
|
|
int MailFilter(struct Mail *MailStruct, const char *filter);
|
|
|
|
|
|
|
|
|
|
/********** acl.c **********/
|
|
|
|
|
|
|
|
|
|
int checkACL(struct Mail *, const char *, int *, char **);
|
2001-01-08 20:36:19 +00:00
|
|
|
enum
|
|
|
|
|
{
|
2000-12-13 15:54:29 +00:00
|
|
|
ACL_DROP,
|
|
|
|
|
ACL_PASS,
|
2001-01-16 10:49:08 +00:00
|
|
|
ACL_APPROVE,
|
2000-12-13 15:54:29 +00:00
|
|
|
ACL_REDIRECT,
|
|
|
|
|
ACL_FORWARD,
|
|
|
|
|
ACL_REJECT,
|
|
|
|
|
ACL_REJECTWITH,
|
|
|
|
|
ACL_FILTER,
|
|
|
|
|
ACL_NONE
|
2001-01-08 20:36:19 +00:00
|
|
|
};
|
2000-12-13 15:54:29 +00:00
|
|
|
|
|
|
|
|
/********** handleacl.c **********/
|
|
|
|
|
|
|
|
|
|
int handleACL(struct Mail *MailStruct, const char *listname, int operation, char *parameter);
|
|
|
|
|
|
|
|
|
|
/********** help.c **********/
|
|
|
|
|
|
|
|
|
|
int SendHelp(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist);
|
|
|
|
|
int Indecipherable(struct Mail *MailStruct, const char *defaultlist);
|
|
|
|
|
|
|
|
|
|
/********** index.c **********/
|
|
|
|
|
|
|
|
|
|
int GenIndex(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist);
|
|
|
|
|
|
|
|
|
|
/********** io.c **********/
|
|
|
|
|
|
|
|
|
|
char *LoadFromDescriptor(int fd);
|
|
|
|
|
char *loadfile(const char *filename);
|
|
|
|
|
int savefile(const char *filename, const char *buffer);
|
|
|
|
|
|
|
|
|
|
/********** listserv.c **********/
|
|
|
|
|
|
2001-01-15 17:06:48 +00:00
|
|
|
int listserv_main(char *incoming_mail, char *default_list);
|
2000-12-13 15:54:29 +00:00
|
|
|
|
2001-01-15 18:48:49 +00:00
|
|
|
/********** approve.c **********/
|
|
|
|
|
|
|
|
|
|
int approve_main(char *incoming_mail);
|
|
|
|
|
|
2000-12-13 15:54:29 +00:00
|
|
|
/********** mailer.c **********/
|
|
|
|
|
|
|
|
|
|
FILE *OpenMailer(const char *envelope, const char *recipients[]);
|
|
|
|
|
FILE *vOpenMailer(const char *envelope, ... );
|
|
|
|
|
int CloseMailer(FILE * fh);
|
|
|
|
|
int ListMail(const char *envelope, const char *listname, const struct Mail *MailStruct);
|
|
|
|
|
|
|
|
|
|
/********** members.c **********/
|
|
|
|
|
|
|
|
|
|
int SendSubscriberList(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist);
|
|
|
|
|
|
|
|
|
|
/********** password.c **********/
|
|
|
|
|
|
|
|
|
|
int setPassword(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist);
|
|
|
|
|
const char *getPassword(void );
|
|
|
|
|
|
|
|
|
|
/********** tool.c **********/
|
|
|
|
|
|
|
|
|
|
char *buildFuzzyMatchAddress(const char *);
|
|
|
|
|
int isValidListName(const char *);
|
|
|
|
|
bool isSubscribed(const char *, const char *, char **, char **, bool);
|
|
|
|
|
|
|
|
|
|
/********** unsubscribe.c **********/
|
|
|
|
|
|
|
|
|
|
int DeleteAddress(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist);
|
|
|
|
|
|
|
|
|
|
/********** hermes.c **********/
|
|
|
|
|
|
2001-01-15 17:06:48 +00:00
|
|
|
int hermes_main(char *incoming_mail, const char *listname);
|
2000-12-13 15:54:29 +00:00
|
|
|
|
|
|
|
|
/********** subscribe.c **********/
|
|
|
|
|
|
|
|
|
|
int AddAddress(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist);
|
|
|
|
|
|
|
|
|
|
/********** parsearray.c **********/
|
|
|
|
|
|
2001-01-08 20:36:19 +00:00
|
|
|
struct Parse
|
|
|
|
|
{
|
2000-12-13 15:54:29 +00:00
|
|
|
const char * keyword;
|
2000-12-16 13:11:54 +00:00
|
|
|
int (*handleCommand)(struct Mail *, const char *, const char *, const char *);
|
2001-01-08 20:36:19 +00:00
|
|
|
};
|
2000-12-13 15:54:29 +00:00
|
|
|
extern struct Parse ParseArray[];
|
|
|
|
|
|
2001-01-20 13:42:01 +00:00
|
|
|
/********** generate-cookie.c **********/
|
2001-01-11 14:11:33 +00:00
|
|
|
|
|
|
|
|
char* generate_cookie(const char*);
|
|
|
|
|
|
2001-01-20 13:42:01 +00:00
|
|
|
/********** queue-posting.c **********/
|
2001-01-15 16:29:11 +00:00
|
|
|
|
2001-01-15 16:58:58 +00:00
|
|
|
char* queue_posting(const struct Mail* mail, const char* listname);
|
2001-01-15 16:29:11 +00:00
|
|
|
|
2001-01-20 13:42:01 +00:00
|
|
|
/********** queue-command.c **********/
|
2001-01-15 16:29:11 +00:00
|
|
|
|
2001-01-15 16:58:58 +00:00
|
|
|
char* queue_command(const struct Mail* mail, const char* command);
|
2001-01-15 16:29:11 +00:00
|
|
|
|
2001-01-20 13:42:01 +00:00
|
|
|
/********** address-db.c **********/
|
2001-01-16 11:33:36 +00:00
|
|
|
|
|
|
|
|
int is_address_on_list(const char* file, const char* address);
|
|
|
|
|
int add_address(const char* file, const char* address);
|
|
|
|
|
|
2000-12-13 15:54:29 +00:00
|
|
|
#endif /* !defined(__PETIDOMO_H__) */
|