done
@ ln -nsf rcvrpsql bin/receiver
@ ln -nsf sndrpsql bin/sender
+ @ ln -nsf srtrpsql bin/sorter
feeder \
sndrpsql \
sndrmsql \
- sorter \
+ srtrpsql \
+ srtrmsql \
SRC= \
chkspf.c \
../lib/libmar.a \
-lmysqlclient
+srtrpsql: toremake sorter.o
+ @ $(LD) $(LDFLAGS) \
+ -o ../bin/$@ sorter.o \
+ $(LIBS) \
+ ../lib/libpos.a \
+ -lpq
+
+srtrmsql: toremake sorter.o
+ @ $(LD) $(LDFLAGS) \
+ -o ../bin/$@ sorter.o \
+ $(LIBS) \
+ ../lib/libmar.a \
+ -lmysqlclient
+
+
feeder : toremake feeder.o
@ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS)
sender : toremake sender.o
@ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS)
-sorter : toremake sorter.o
- @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS)
-
chkspf.o: chkspf.c \
../lib/unidns.h \
../lib/subafn.h \
case 5 : //updating transfile
(void) eml_dump_list_tra(qfile,tra);
(void) eml_update_tradb(tra);
- tra=(TRATYP **)rou_freelist((void **)tra,(genfree_t)eml_freetra);
+ tra=eml_freeall_tra(tra);
break;
case 6 : //closing file
qfile=eml_closeqfile(qfile);
(void) eml_doneqfile(trans);
break;
}
- trans=(TRATYP **)rou_freelist((void **)trans,(genfree_t)eml_freetra);
+ trans=eml_freeall_tra(trans);
break;
default : //SAFE Guard
proceed=false;
geseml.o: \
subrou.h \
unidns.h unieml.h unipar.h unitls.h \
+ devsql.h \
geseml.h geseml.h
gestcp.o: \
#undef OPEP
}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to update database information about */
+/* emails echange current and last status. */
+/* */
+/********************************************************/
+PUBLIC _Bool sql_mngact(SQLPTR *sqlptr,SQLENUM action,ACTTYP *act)
+
+{
+_Bool isok;
+
+isok=false;
+if (act!=(ACTTYP *)0) {
+ (void) rou_alert(0,"JMPDBG ses=<%s>d rcpt=<%s>",act->sessid,act->rcptto);
+ if (act->resp!=(char **)0) {
+ char **resp;
+ int num;
+
+ resp=act->resp;
+ num=0;
+ while (*resp!=(char *)0) {
+ num++;
+ (void) rou_alert(0,"\tRESP[%0d]=<%s>",num,*resp);
+ resp++;
+ }
+ }
+ }
+return isok;
+}
//procedure to manage information on email exchange session
extern _Bool sql_mngses(SQLPTR *sqlptr,SQLENUM action,SESTYP **ses);
+//procedure to manage action stats on email exhange status
+extern _Bool sql_mngact(SQLPTR *sqlptr,SQLENUM action,ACTTYP *act);
+
#endif
#include "unieml.h"
#include "unipar.h"
#include "unitls.h"
+#include "devsql.h"
#include "geseml.h"
//dovecot local storage directory
*/
/********************************************************/
/* */
+/* Procedure to free memory used by a TRATYP record*/
+/* */
+/********************************************************/
+static TRATYP *eml_freetra(TRATYP *tra)
+
+{
+if (tra!=(TRATYP *)0) {
+ (void) eml_freetra_resp(tra);
+ tra->rcptto=rou_freestr(tra->rcptto);
+ tra->mailfrom=rou_freestr(tra->mailfrom);
+ tra->sessid=rou_freestr(tra->sessid);
+ (void) free(tra);
+ tra=(TRATYP *)0;
+ }
+return tra;
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
/* Procedure to display/debug TRATYP record content*/
/* */
/********************************************************/
*/
/********************************************************/
/* */
-/* Procedure to free memory used by a TRATYP record*/
-/* */
-/********************************************************/
-PUBLIC TRATYP *eml_freetra(TRATYP *tra)
-
-{
-if (tra!=(TRATYP *)0) {
- (void) eml_freetra_resp(tra);
- tra->rcptto=rou_freestr(tra->rcptto);
- tra->mailfrom=rou_freestr(tra->mailfrom);
- tra->sessid=rou_freestr(tra->sessid);
- (void) free(tra);
- tra=(TRATYP *)0;
- }
-return tra;
-}
-/*
-\f
-*/
-/********************************************************/
-/* */
-/* Procedure to duplcate an resp list within a tra */
+/* Procedure to duplicate an resp list within a tra*/
/* record. */
/* */
/********************************************************/
*/
/********************************************************/
/* */
+/* Procedure to free memory used by a tra list */
+/* */
+/********************************************************/
+PUBLIC TRATYP **eml_freeall_tra(TRATYP **tra)
+
+{
+(void) eml_update_tradb(tra);
+tra=(TRATYP **)rou_freelist((void **)tra,(genfree_t)eml_freetra);
+return tra;
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
/* Procedure to scan the a qfile and build a */
/* list of email transport directive. */
/* */
{
int num;
+SQLPTR *sqlptr;
num=0;
+sqlptr=(SQLPTR *)0;
if (tra!=(TRATYP **)0) {
while (*tra!=(TRATYP *)0) {
- (void) rou_alert(0,"JMPDBG ses=<%s>d rcpt=<%s>",(*tra)->sessid,(*tra)->rcptto);
+ ACTTYP action;
+
+ action.sessid=(*tra)->sessid;
+ action.rcptto=(*tra)->rcptto;
+ action.resp=(*tra)->resp;
+ (void) sql_mngact(sqlptr,sql_delete,&action);
+ num++;
tra++;
}
}
//procedure to fee memory used to duplicate a resp list to tra resp
extern void eml_duptra_resp(TRATYP *tra,char **resp);
-//procedure to fee memory used by a TRATYP structure
-extern TRATYP *eml_freetra(TRATYP *tra);
-
//procedure to duplicate a TRATYP structure
extern TRATYP *eml_duptra(TRATYP *tra);
+//procedure to fee memory used by a TRATYP structure
+extern TRATYP **eml_freeall_tra(TRATYP **tra);
+
//procedure to open a specific qfile
extern TRATYP **eml_scanqfile(TRATYP **list,FILE *qfile);
ptr++;
}
(void) eml_dump_list_tra(qfile,tralist);
- tralist=(TRATYP **)rou_freelist((void **)tralist,(genfree_t)eml_freetra);
+ tralist=eml_freeall_tra(tralist);
}
return status;
#undef OPEP
u_long taille; //Email size
}SESTYP;
+//Tructure about email action status (managing email)
+typedef struct {
+ char *sessid; //session id
+ char *rcptto; //email recipient
+ char **resp; //Multiline status
+ }ACTTYP;
+
//procedure to free space used by an USRTYP
extern USRTYP *sql_freeusr(USRTYP *usr);
%attr(0640,%{name},dovecot) %config(noreplace) %{dovedir}/passfile
%{_sbindir}/chkspf
%{_sbindir}/feeder
-%attr(0755,%{name},mail) %{_sbindir}/sorter
%attr(0754,root,root) %{_libdir}/%{name}/shell/*.sh
%attr(0754,root,root) %{_libdir}/%{name}/support/addconfig.sh
%attr(0754,root,root) %{_libdir}/%{name}/support/crdb.sh
%defattr(-,root,root,-)
%attr(0755,%{name},mail) %{_sbindir}/rcvrpsql
%attr(0755,%{name},mail) %{_sbindir}/sndrpsql
+%attr(0755,%{name},mail) %{_sbindir}/srtrpsql
%post postgresql
if [ "$1" = 1 ]; then
%{__ln_s} -nf \
./sndrpsql \
%{_sbindir}/sender
+%{__ln_s} -nf \
+ ./srtrpsql \
+ %{_sbindir}/sorter
%postun postgresql
if [ "$1" = 0 ]; then
- rm -f %{_sbindir}/%{name}
+ rm -f %{_sbindir}/receiver
+ rm -f %{_sbindir}/sender
+ rm -f %{_sbindir}/sorter
fi
#=============================================================================
%defattr(-,root,root,-)
%attr(0755,%{name},mail) %{_sbindir}/rcvrmsql
%attr(0755,%{name},mail) %{_sbindir}/sndrmsql
+%attr(0755,%{name},mail) %{_sbindir}/srtrmsql
%post mysql
if [ "$1" = 1 ]; then
%{__ln_s} -nf \
./sndrmsql \
%{_sbindir}/sender
+%{__ln_s} -nf \
+ ./srtrmsql \
+ %{_sbindir}/sorter
%postun mysql
if [ "$1" = 0 ]; then
rm -f %{_sbindir}/receiver
rm -f %{_sbindir}/sender
+ rm -f %{_sbindir}/sorter
fi
#=============================================================================
DESTDIR="%{buildroot}" \
install
+#removing default link generated by make
%{__rm} -fr \
+ %{buildroot}%{_sbindir}/receiver\
%{buildroot}%{_sbindir}/sender \
- %{buildroot}%{_sbindir}/receiver
+ %{buildroot}%{_sbindir}/sorter \
#=============================================================================
%changelog