Back to index

courier  0.68.2
Classes | Defines | Functions | Variables
rw.h File Reference
#include "courier.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rw_info_rewrite
struct  rw_transport

Defines

#define DO_REWRITE_HEADER(l)

Functions

int rw_install_start ()
int rw_install (const char *name, struct rw_list *(*rw_install)(const struct rw_install_info *), const char *(*rw_init)())
int rw_install_init ()
struct rfc822trw_rewrite_tokenize (const char *)
int rw_syntaxchk (struct rfc822token *)
void rw_err_func (int, const char *, struct rw_info *)
void rw_rewrite_print (struct rw_info *)
void rw_rewrite_chksyn_print (struct rw_info *)
void rw_rewrite_chksyn_at_ok_print (struct rw_info *)
void rw_searchdel (struct rw_info *, void(*)(struct rw_info *, struct rw_transport *, const struct rfc822token *, const struct rfc822token *))
struct rw_transportrw_search_transport (const char *)
void rw_rewrite_module (struct rw_transport *, struct rw_info *, void(*)(struct rw_info *))
char * rw_rewrite_header (struct rw_transport *, const char *, int, struct rfc822token *, char **)
char * rw_rewrite_header_func (void(*rwfunc)(struct rw_info *, void(*)(struct rw_info *), void *), const char *, int, struct rfc822token *, char **, void *)
void rw_local_defaulthost (struct rw_info *, void(*)(struct rw_info *))
int rw_rewrite_msg (int, int(*)(const char *, unsigned, void *), void(*)(struct rw_info *, void(*)(struct rw_info *), void *), void *)
int rw_rewrite_msg_7bit (int, struct rfc2045 *, int(*)(const char *, unsigned, void *), void(*)(struct rw_info *, void(*)(struct rw_info *), void *), void *)

Variables

struct rw_transportrw_transport_first
struct rw_transportrw_transport_last

Class Documentation

struct rw_info_rewrite

Definition at line 31 of file rw.h.

Class Members
char * buf
char * errmsg

Define Documentation

#define DO_REWRITE_HEADER (   l)
Value:
(strnicmp((l),"to:", 3) == 0 || strnicmp((l), "cc:", 3) == 0 || \
        strnicmp((l), "from:", 5) == 0 || \
        strnicmp((l), "reply-to:", 9) == 0)

Definition at line 105 of file rw.h.


Function Documentation

void rw_err_func ( int  ,
const char *  ,
struct rw_info *   
)

Definition at line 10 of file comrwerrfunc.c.

{
       ((struct rw_info_rewrite *)rwi->udata)->errmsg
                     =makeerrmsgtext(n, txt);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rw_install ( const char *  name,
struct rw_list *(*)(const struct rw_install_info *)  rw_install,
const char *(*)()  rw_init 
)

Definition at line 57 of file comrwinstall.c.

{
struct rw_transport *t;
struct rw_install_info install_info={RW_VERLO, RW_VERHI, COURIER_COPYRIGHT};

       if (rw_init_verbose_flag)
       {
              clog_msg_start_info();
              clog_msg_str("Installing ");
              clog_msg_str(name);
              clog_msg_send();
       }

       install_info.courier_home=courierdir();
       t=(struct rw_transport *)courier_malloc(sizeof(struct rw_transport));
       t->name=(char *)courier_malloc(strlen(name)+1);
       t->udata=0;
       if ((t->rw_ptr= (*rw_install)(&install_info)) == 0)
       {
              if (t->name)  free((void *)t->name);
              if (t)        free((void *)t);
              clog_msg_start_err();
              clog_msg_str("rw_install() failed, check for messages from the module.");
              clog_msg_send();
              return (-1);
       }
       strcpy(t->name, name);
       t->init=rw_init;
       if (rw_transport_last)      rw_transport_last->next=t;
       else   rw_transport_first=t;
       rw_transport_last=t;
       t->next=0;
       if (rw_init_verbose_flag)
       {
              clog_msg_start_info();
              clog_msg_str("Installed: ");
              clog_msg_str(t->rw_ptr->module_id);
              clog_msg_send();
       }
       return (0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rw_install_init ( )

Definition at line 101 of file comrwinstall.c.

{
struct rw_transport *t;
const char *err;

       for (t=rw_transport_first; t; t=t->next)
       {
              if (rw_init_verbose_flag)
              {
                     clog_msg_start_info();
                     clog_msg_str("Initializing ");
                     clog_msg_str(t->name);
                     clog_msg_send();
              }
              if ((err=(*t->init)()) != 0)
              {
                     clog_msg_start_err();
                     clog_msg_str(err);
                     clog_msg_send();
                     return (-1);
              }
       }
       return (0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 37 of file comrwinstall.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void rw_local_defaulthost ( struct rw_info *  ,
void(*)(struct rw_info *)   
)

Definition at line 11 of file rwdefaulthost.c.

{
struct rfc822token *q, **ptr;
struct rfc822token at, name;

       if (p->ptr && p->ptr->token == 0 && p->ptr->len == 0)
              p->ptr=p->ptr->next;

       if (p->ptr == 0)            /* Address is <> */
       {
              (*func)(p);
              return;
       }

       /*
       ** Do not append the default domain to a UUCP address.
       */

       for (q=p->ptr; q; q=q->next)
              if (q->token == '!')
              {
                     (*func)(p);
                     return;
              }

       for (q=*(ptr=&p->ptr); q; q= *(ptr= &q->next))
              if (q->token == '@')
              {
                     (*func)(p);
                     return;
              }

       *ptr= &at;

       at.next= &name;
       at.token= '@';
       at.ptr=0;
       at.len=0;

       name.next=0;
       name.token=0;
       name.ptr=config_defaultdomain();
       name.len=strlen(name.ptr);
       (*func)(p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rw_rewrite_chksyn_at_ok_print ( struct rw_info *  )

Definition at line 135 of file lcrewrite.c.

{
       struct rfc822token *t=info->ptr;

       if (t && t->token == '@')
              t=t->next;

       do_rw_rewrite_chksyn_print(info, t);
}

Here is the call graph for this function:

void rw_rewrite_chksyn_print ( struct rw_info *  )

Definition at line 130 of file lcrewrite.c.

Here is the call graph for this function:

char* rw_rewrite_header ( struct rw_transport ,
const char *  ,
int  ,
struct rfc822token ,
char **   
)

Definition at line 132 of file comrwheader.c.

{
       return (rw_rewrite_header_common(rw, 0,
              header, mode, sender, errmsgptr, 0));
}

Here is the call graph for this function:

char* rw_rewrite_header_func ( void(*)(struct rw_info *, void(*)(struct rw_info *), void *)  rwfunc,
const char *  ,
int  ,
struct rfc822token ,
char **  ,
void *   
)

Definition at line 140 of file comrwheader.c.

{
       return (rw_rewrite_header_common(0, rwfunc,
              header, mode, sender, errmsgptr, funcarg));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rw_rewrite_module ( struct rw_transport ,
struct rw_info *  ,
void(*)(struct rw_info *)   
)

Definition at line 33 of file lcrewrite.c.

{
       if (!module || !module->rw_ptr)
              (*rwi->err_func)(450, "Internal failure.", rwi);
       else if (module->rw_ptr->rewrite_del)
              (*module->rw_ptr->rewrite)(rwi, func);
       else
              (*rwi->err_func)(550, "Invalid address.", rwi);
}

Here is the caller graph for this function:

int rw_rewrite_msg ( int  ,
int(*)(const char *, unsigned, void *)  ,
void(*)(struct rw_info *, void(*)(struct rw_info *), void *)  ,
void *   
)
int rw_rewrite_msg_7bit ( int  ,
struct rfc2045 ,
int(*)(const char *, unsigned, void *)  ,
void(*)(struct rw_info *, void(*)(struct rw_info *), void *)  ,
void *   
)
void rw_rewrite_print ( struct rw_info *  )

Definition at line 101 of file lcrewrite.c.

{
char   *p=rfc822_gettok(info->ptr);

       if (!p)              clog_msg_errno();

       ( (struct rw_info_rewrite *)info->udata)->buf=p;
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct rfc822t* rw_rewrite_tokenize ( const char *  ) [read]

Definition at line 20 of file lcrewrite.c.

{
struct rfc822t *tokens=rfc822t_alloc_new(address, NULL, NULL);
int    i;

       if (!tokens)  clog_msg_errno();
       for (i=1; i<tokens->ntokens; i++)
              tokens->tokens[i-1].next=tokens->tokens+i;
       return (tokens);
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct rw_transport* rw_search_transport ( const char *  ) [read]

Definition at line 13 of file rwsearch.c.

{
struct rw_transport *p;

       for (p=rw_transport_first; p; p=p->next)
              if (strcmp(p->name, module) == 0)
                     return (p);
       return (0);
}

Here is the caller graph for this function:

void rw_searchdel ( struct rw_info *  ,
void(*)(struct rw_info *, struct rw_transport *, const struct rfc822token *, const struct rfc822token *)   
)

Definition at line 63 of file comrwsearchdel.c.

{
struct rw_searchdel_info rwsdi;

       rwsdi.cur_transport=rw_transport_first;
       rwsdi.save_udata=i->udata;
       rwsdi.save_err_func=i->err_func;
       i->udata= (void *)&rwsdi;
       i->err_func=del_err_func;
       rwsdi.del_func=func;
       do_next_rw(i, &rwsdi);
       i->udata=rwsdi.save_udata;
       i->err_func=rwsdi.save_err_func;
}

Here is the call graph for this function:

int rw_syntaxchk ( struct rfc822token )

Definition at line 44 of file lcrewrite.c.

{
int    cnt;

       /*
       ** The following tokens:  ! @ % : . may NOT:
       **
       ** a) appear next to each other, and b) appear at the beginning or
       ** the end of the address.
       **
       */
       if (!t)       return (0);   /* <> envelope sender ok */

       cnt=1;

       while (t)
       {
              switch (t->token)    {
              case '<':
              case '>':
              case ';':
              case '(':
              case ')':
                     return (-1);  /* These cannot appear anywhere */
              case '!':
              case '@':
              case '%':
              case ':':
              case '.':
                     if (++cnt > 1)       return (-1);
                     break;
              case 0:
              case '"':
                     {
                            int i;

                            for (i=0; i<t->len; i++)
                            {
                                   unsigned char c=t->ptr[i];

                                   if (isspace((int)c) || c < ' ')
                                          return (-1);
                            }
                     }
              default:
                     cnt=0;
                     break;
              }
              t=t->next;
       }
       if (cnt)      return (-1);
       return (0);
}

Here is the caller graph for this function:


Variable Documentation