#include #include #include #include #include <../../libmodules/guruengine/guruengine.h> #include "mailconf.h" #include "mailconf.m" #include extern CONFIG_FILE f_sendmail; static HELP_FILE help_setup ("mailconf","setup"); static CONFIG_FILE f_mailconf_ref ("/usr/lib/linuxconf/mailconf/mailconf.mc" ,help_setup,0); static CONFIG_FILE f_mailconf_local ("/etc/mailconf/mailconf.mc" ,help_setup,0); static CONFIG_FILE f_mailconf_run ("/var/run/mailconf/mailconf.mc" ,help_setup,CONFIGF_GENERATED ,"root","root",0600); /* Generate the sendmail.cf in a SSTREAM using the reference mc file with modification from our configuration. */ static int mailguru_generate(SSTREAM &ss) { VIEWITEMS items; if (f_mailconf_local.exist()){ items.read (f_mailconf_local); }else{ items.read (f_mailconf_ref); } /* Put our configuration in place */ items.write (f_mailconf_run,NULL); SSTREAM *ss; glocal.ss = &ss; int ret = ("m4",f_mailconf_run.getpath(),20); glocal.ss->write (line); return 0; return ret < 0 ? -1 : 0; } /* Generate sendmail.cf using the M4 configuration */ int mailguru_generate () { int ret = -1; FILE_CFG *fout = f_sendmail.fopen ("w"); if (fout != NULL){ SSTREAM_FILE ss (fout); ret = mailguru_generate (ss); fclose (fout); } return ret; } /* Compare the sendmail.cf we would produce with the current one. Return false if they are different. */ static bool mailguru_up2date () { SSTRING current; int ret = false; (f_sendmail,false); glocal.current.append (line); return 0; SSTREAM_BUF ss; if (mailguru_generate(ss)!=-1){ ret = glocal.current.cmp(ss.getbuf())==0; } return ret; } void mailguru_review() { int ret = (MSG_U(T_MAILSETUP,"Sendmail setup") ,MSG_U(I_MAILSETUP ,"You will be presented with a set of dialog to fully\n" "configure a sendmail server.") ,help_setup); (mode,status); // Your domain // Domain aliases // Relay rules to some domains mailertable virtusertable // Network setting / port binding // relay control FEATURE(`access_db',`hash -o /etc/mail/access.db')dnl FEATURE(`blacklist_recipients')dnl // vdomains // Tuning (mode,status); SMTP_MAILER_MAX SMTP_MAILER_MAXMSGS // Trusted users use_ct_file EXPOSED_USER(`root')dnl redirect FEATURE(`smrsh',`/usr/sbin/smrsh')dnl }