File mm/mm.c

  $Revision: 2.32 $

mm - MIME Parser module. Functions to parse a mail message part, find if it is MIME-encapsulated, dispatch the part to the appropriate drivers (also included) and return tree nodes with all MIME information.
Status: COMPLETE, NOT REVUED, TESTED
Design and implementation by: daniele@ripe.net

Included Files


Preprocessor definitions

#define REGEXP "^From "

Global Variable Lock

pthread_mutex_t Lock
Included from /home/shane/release/RIP/include/ca_defs.h
Visible in:  aa/aa.c
   ac/ac_persistence.c
   ac/access_control.c
   au/AU_util.c
   ca/ca_configFns.c
   ca/ca_initFn.c
   ca/ca_sanityCheck.c
   ca/ca_sourceLoader.c
   ca/ca_values.c
   co/constants.c
   df/defs.c
   er/er.c
   er/er_arrays.c
   er/er_macro.c
   er/er_paths.c
   er/er_print.c
   ip/ip.c
   ma/bitmask.c
   mm/mm.c
Used in: ca_get_adminIntElement()ca/ca_configFns.c
  ca_get_adminStrElement()ca/ca_configFns.c
  ca_get_boolean()ca/ca_configFns.c
  ca_get_dirlist()ca/ca_configFns.c
  ca_get_int()ca/ca_configFns.c
  ca_get_string()ca/ca_configFns.c
  ca_set_boolean()ca/ca_configFns.c
  ca_srchandle2Intelement()ca/ca_configFns.c
  ca_srchandle2Strelement()ca/ca_configFns.c

Global Variable debug

long debug
Visible in:  mm/mm.c
Used in: MM_extract_mime()mm/mm.c
  MM_get_msg_headers()mm/mm.c
  MM_store()mm/mm.c
  parse_message_rfc822()mm/mm.c
  parse_multipart_alternative()mm/mm.c
  parse_multipart_signed()mm/mm.c
  parse_text_plain()mm/mm.c

Global Variable supported_MIME_types

char* supported_MIME_types[50]
Visible in:  mm/mm.c
Used in: dispatch_to_driver()mm/mm.c
  is_supported_MIMEtype()mm/mm.c

Global Variable pass

long pass
Visible in:  mm/mm.c
Used in: MM_extract_mime()mm/mm.c
  parse_message_rfc822()mm/mm.c
  parse_multipart_alternative()mm/mm.c

External Variables

EP_outputPrefix
extern char EP_outputPrefix[1024]
Defined in: ep/mail_parser.c

EP_keyRing
extern char EP_keyRing[1024]

EP_TreeHeight
extern int EP_TreeHeight
Defined in: ep/mail_parser.c

EP_Node_ID
extern int EP_Node_ID
Defined in: ep/mail_parser.c


Global Function MM_extract_mime()

int MM_extract_mime ( const char* sourcefile, char* pfx, EP_mail_node* mailnode, long custom_debug )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: ER_dbg_va()er/er.c
  ER_inf_va()er/er.c
  ER_perror()er/er.c
  dispatch_to_driver()mm/mm.c
  status()mm/mm.c
  auth_link(), fprintf(), mail_close_full(), mail_fetch_structure(), mail_link(), mail_open(), sprintf()
Called by: EP_MIMEParse()ep/mail_parser.c
  EP_ParseMail()ep/mail_parser.c
  parse_message_rfc822()mm/mm.c
  parse_multipart_alternative()mm/mm.c
References Variables: debugmm/mm.c
  passmm/mm.c
  auth_log, auth_md5, auth_pla, dummydriver, imapdriver, mboxdriver, mbxdriver, mhdriver, mmdfdriver, mtxdriver, mxdriver, newsdriver, nntpdriver, philedriver, pop3driver, tenexdriver, unixdriver

Global Function MM_get_msg_headers()

int MM_get_msg_headers ( const char* mail_file, EP_Mail_Descr* mail_descr, long mesgno, long custom_debug )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: ER_dbg_va()er/er.c
  ER_inf_va()er/er.c
  ER_perror()er/er.c
  get_mail_hdr_field()mm/mm.c
  status()mm/mm.c
  UT_malloc_real(), auth_link(), fprintf(), mail_close_full(), mail_fetch_structure(), mail_free_stringlist(), mail_link(), mail_newstringlist(), mail_open(), sprintf(), strlen()
Called by: InitializeMailDescr()ep/mail_parser.c
References Variables: debugmm/mm.c
  auth_log, auth_md5, auth_pla, body_types, dummydriver, imapdriver, mboxdriver, mbxdriver, mhdriver, mmdfdriver, mtxdriver, mxdriver, newsdriver, nntpdriver, philedriver, pop3driver, tenexdriver, unixdriver

Global Function MM_store()

 *
 * MM_store(). Stores a file (or stdin) in another file,
 * "escaping" the lines starting with "From " by adding
 * a ">" sign. This is necessary because we need to deal
 * with files that are "unix mailboxes".
 *
 * This function puts a limit to the line size that a mail
 * message may have; officially, there is no limit to this size,
 * but we prefer to add this limit to avoid buffer overflow.
 * The line size limit is MAXBUFSIZE, defined in mm.h .
 *
int MM_store ( char* source_file, char* destination_file, long custom_debug, int networkupdate )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: ER_dbg_va()er/er.c
  ER_inf_va()er/er.c
  ER_perror()er/er.c
  do_regex_test()mm/mm.c
  ctime(), fdwrap_fclose(), fgets(), fopen(), fprintf(), fputs(), strcmp(), strlen(), time()
Called by: EP_MIMEParse()ep/mail_parser.c
  EP_ParseMail()ep/mail_parser.c
References Variables: debugmm/mm.c

Global Function dispatch_to_driver()

void dispatch_to_driver ( MAILSTREAM* stream, struct mail_bodystruct* body, char* pfx, EP_mail_node* mailnode )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: ER_dbg_va()er/er.c
  is_supported_MIMEtype()mm/mm.c
  parse_message_rfc822()mm/mm.c
  parse_multipart_alternative()mm/mm.c
  parse_multipart_signed()mm/mm.c
  parse_text_plain()mm/mm.c
  strcmp()
Called by: MM_extract_mime()mm/mm.c
References Variables: supported_MIME_typesmm/mm.c

Global Function do_regex_test()

int do_regex_test ( const char* pattern, char* string )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: UT_free_real(), UT_malloc_real(), regcomp(), regexec(), regfree()
Called by: EP_MIMEParse()ep/mail_parser.c
  MM_store()mm/mm.c

Global Function get_header_line()

char* get_header_line ( MAILSTREAM* stream, long mesgno, struct string_list* cur, const char* hdr_title )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: UT_malloc_real(), cpystr(), mail_fetch_header(), sprintf(), strlen()
Called by: get_mail_hdr_field()mm/mm.c

Global Function get_mail_hdr_field()

Mail_Header_Field* get_mail_hdr_field ( MAILSTREAM* stream, long mesgno, struct string_list* cur, const char* hdr_title )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: get_header_line()mm/mm.c
  UT_free_real(), UT_malloc_real(), sprintf(), strlen()
Called by: MM_get_msg_headers()mm/mm.c

Global Function is_supported_MIMEtype()

t_MM_type is_supported_MIMEtype ( struct mail_bodystruct* body )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: UT_free_real(), UT_malloc_real(), sprintf(), strcmp(), strlen()
Called by: dispatch_to_driver()mm/mm.c
References Variables: supported_MIME_typesmm/mm.c
  body_types

Global Function mm_critical()

void mm_critical ( MAILSTREAM* stream )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function mm_diskerror()

long mm_diskerror ( MAILSTREAM* stream, long errcode, long serious )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h
Calls: abort()

Global Function mm_dlog()

void mm_dlog ( char* string )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h
Calls: puts()

Global Function mm_exists()

void mm_exists ( MAILSTREAM* stream, unsigned long number )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function mm_expunged()

void mm_expunged ( MAILSTREAM* stream, unsigned long number )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function mm_fatal()

void mm_fatal ( char* string )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h
Calls: ER_perror()er/er.c
  fprintf()

Global Function mm_flags()

void mm_flags ( MAILSTREAM* stream, unsigned long number )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function mm_list()

void mm_list ( MAILSTREAM* stream, int delimiter, char* mailbox, long attributes )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function mm_log()

void mm_log ( char* string, long errflg )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h
Calls: ER_dbg_va()er/er.c
  ER_perror()er/er.c

Global Function mm_login()

void mm_login ( NETMBX* mb, char* user, char* pwd, long trial )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function mm_lsub()

void mm_lsub ( MAILSTREAM* stream, int delimiter, char* mailbox, long attributes )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function mm_nocritical()

void mm_nocritical ( MAILSTREAM* stream )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function mm_notify()

void mm_notify ( MAILSTREAM* stream, char* string, long errflg )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function mm_searched()

void mm_searched ( MAILSTREAM* stream, unsigned long number )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function mm_status()

void mm_status ( MAILSTREAM* stream, char* mailbox, MAILSTATUS* status )
Prototyped in: /home/dbase/src/orange/imap-2001a/c-client/mail.h

Global Function parse_message_rfc822()

void parse_message_rfc822 ( MAILSTREAM* stream, struct mail_bodystruct* body, char* pfx, EP_mail_node* mailnode )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: ER_dbg_va()er/er.c
  MM_extract_mime()mm/mm.c
  write_file()mm/mm.c
  UT_free_real(), UT_malloc_real(), ctime(), mail_fetch_text(), remove(), sprintf(), strlen(), time()
Called by: dispatch_to_driver()mm/mm.c
References Variables: EP_outputPrefixep/mail_parser.c
  debugmm/mm.c
  passmm/mm.c

Global Function parse_multipart_alternative()

void parse_multipart_alternative ( MAILSTREAM* stream, struct mail_bodystruct* body, char* pfx, EP_mail_node* mailnode )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: EP_InitializeNode()ep/mail_parser.c
  ER_dbg_va()er/er.c
  MM_extract_mime()mm/mm.c
  write_file()mm/mm.c
  UT_free_real(), UT_malloc_real(), ctime(), g_snprintf(), mail_fetch_mime(), remove(), sprintf(), strlen(), time()
Called by: dispatch_to_driver()mm/mm.c
References Variables: EP_Node_IDep/mail_parser.c
  EP_TreeHeightep/mail_parser.c
  EP_outputPrefixep/mail_parser.c
  debugmm/mm.c
  passmm/mm.c

Global Function parse_multipart_signed()

void parse_multipart_signed ( MAILSTREAM* stream, struct mail_bodystruct* body, char* pfx, EP_mail_node* mailnode )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: EP_InitializeNode()ep/mail_parser.c
  EP_MIMEParse()ep/mail_parser.c
  ER_dbg_va()er/er.c
  write_file()mm/mm.c
  PA_VerifySignature(), UT_free_real(), UT_malloc_real(), mail_fetch_mime(), remove(), snprintf(), sprintf(), strcpy(), strlen()
Called by: dispatch_to_driver()mm/mm.c
References Variables: EP_Node_IDep/mail_parser.c
  EP_TreeHeightep/mail_parser.c
  EP_outputPrefixep/mail_parser.c
  debugmm/mm.c

Global Function parse_text_plain()

void parse_text_plain ( MAILSTREAM* stream, struct mail_bodystruct* body, char* pfx, EP_mail_node* mailnode )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: ER_dbg_va()er/er.c
  write_file()mm/mm.c
  PA_ParseMessage(), UT_free_real(), UT_malloc_real(), mail_fetch_text(), sprintf(), strlen()
Called by: dispatch_to_driver()mm/mm.c
References Variables: EP_outputPrefixep/mail_parser.c
  debugmm/mm.c

Global Function put_in_file()

void put_in_file ( char* fileprefix, char* extension, char* text, size_t text_size )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: write_file()mm/mm.c
  sprintf()

Global Function read_file()

void read_file ( const char* filename )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: ER_perror()er/er.c
  fdwrap_fclose(), fopen(), fprintf(), getc(), putc()

Global Function status()

void status ( MAILSTREAM* stream )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: ER_dbg_va()er/er.c
  rfc822_date()
Called by: MM_extract_mime()mm/mm.c
  MM_get_msg_headers()mm/mm.c

Global Function write_file()

void write_file ( char* filename, char* text, size_t text_size )
Prototyped in: /home/shane/release/RIP/include/mm.h
Calls: ER_perror()er/er.c
  fdwrap_fclose(), fopen(), fprintf()
Called by: parse_message_rfc822()mm/mm.c
  parse_multipart_alternative()mm/mm.c
  parse_multipart_signed()mm/mm.c
  parse_text_plain()mm/mm.c
  put_in_file()mm/mm.c

Local Function asctime_r()

static char* asctime_r ( const struct tm* __tm, char* __buf )
Included from: /usr/include/time.h
Calls: __posix_asctime_r()

Local Function ctime_r()

static char* ctime_r ( const time_t* __time, char* __buf )
Included from: /usr/include/time.h
Calls: __posix_ctime_r()

Local Function getlogin_r()

static int getlogin_r ( char* __name, int __len )
Included from: /usr/include/unistd.h
Calls: __posix_getlogin_r()

Local Function readdir_r()

static int readdir_r ( DIR* __dp, struct dirent* __ent, struct dirent** __res )
Included from: /usr/include/dirent.h
Calls: __posix_readdir_r()

Local Function sigwait()

static int sigwait ( const sigset_t* __setp, int* __signo )
Included from: /usr/include/signal.h
Calls: __posix_sigwait()

Local Function ttyname_r()

static int ttyname_r ( int __fildes, char* __buf, size_t __size )
Included from: /usr/include/unistd.h
Calls: __posix_ttyname_r()