$(TESTIP) \
$(TESTPORT) \
./$(DATATST)/feed*.tst
+ONEFEED=feed01.tst
#to test with an external server
extfeed : debug
-c ./conf/feeder.conf.dvl \
$(EXTIP) \
$(EXTPORT) \
- ./$(DATATST)/extfeed00.tst
-ONEFEED=feed00.tst
+ ./$(DATATST)/$(ONEFEED)
onefeed : debug
@ rm -fr ./data-queue/*
@ rm -fr $(TESTDIR)/var/spool/$(APPNAME)/queue/*
-c ./conf/feeder.conf.dvl \
$(TESTIP) \
$(TESTPORT) \
- ./$(DATATST)/feed.tst
+ ./$(DATATST)/$(ONEFEED)
# --track-fds=yes \
R:250 2.6.4 Address accepted
S:RCPT TO: <dom1user2@subdom1.example.com>
R:250 2.6.4 Address accepted
-S:RCPT TO: <dom1user3@subdom1.example.com>
-R:250 2.6.4 Address accepted
#-------------------------------------------------------------------------
#-sending data
C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
R:250 2.6.4 Address accepted
#-------------------------------------------------------------------------
#-sending data
-C:DATA
+C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
D:Subject: Very Simple email contents
D:From: Maitre Post <postmaster@example.com>
D:To: Maitre WEB <webmaster@example.com>
R:250 2.6.4 Address accepted
#-------------------------------------------------------------------------
#-sending data
-C:DATA
+C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
D:Subject: Second email contents
D:
D:SECOND FIRST Line
R:250 2.6.4 Address accepted
#-------------------------------------------------------------------------
#-sending data
-C:DATA
+C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
D:Subject: Third email contents
D:
D:THIRD FIRST Line
R:250 2.6.4 Address accepted
#-------------------------------------------------------------------------
#-sending data
-C:DATA
+C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
D:Subject: A email to not exitsing user
D:From: Trouble maker <subdom1.example.com
D:To: Not existing <dom1user3@subdom1.example.com>
REFTYP **ptr;
iter=0;
- (void) time(¤t );
+ (void) time(¤t);
tinfo=localtime(¤t);
(void) strftime(buffer,sizeof(buffer),"%s",tinfo);
ptr=domlist;
qfile=(FILE *)0;
action=false;
ext=EXTRANS;
- (void) snprintf(qname,sizeof(qname),"%s-%s-%04d",(*ptr)->domain,buffer,iter);
+ (void) snprintf(qname,sizeof(qname),"%08ld-%08d-%04d",current,getpid(),iter);
phase=0;
proceed=true;
while (proceed==true) {
(void) eml_renameqfile(qname,EXTOBE,ext);
break;
case 4 : //do we need to start sender
- if (action==true) {
+ if ((action==true)&&(foreground==false))
(void) eml_start_sender(qname);
- }
break;
default : //SAFE Guard
proceed=false;
}
filename=rou_freestr(filename);
return status;
+#undef OPEP
+}
+/*
+^L
+*/
+/********************************************************/
+/* */
+/* Procedure to increase or decrase the "count" */
+/* session id file. */
+/* return 0 or a positive count number. */
+/* return -1 if trouble. */
+/* */
+/********************************************************/
+PUBLIC int eml_countqfile(char *qfilename,int count)
+
+{
+#define OPEP "unieml.c:eml_countqfile,"
+
+int result;
+FILE *fcount;
+char *filename;
+int phase;
+_Bool proceed;
+
+result=-1;
+fcount=(FILE *)0;
+filename=rou_apppath(QDIR);
+phase=0;
+proceed=true;
+while (proceed==true) {
+ switch (phase) {
+ case 0 : //lets open the queue directory
+ if (qfilename==(char *)0) {
+ (void) rou_alert(0,"%s filename=<%s> missing (Bug?)",OPEP,qfilename);
+ phase=999; //Big trouble
+ }
+ break;
+ case 1 : //opening count file
+ char name[300];
+
+ (void) snprintf(name,sizeof(name),"%s.%s/%s",filename,qfilename,EXTCNT);
+ if ((fcount=fopen(name,"rw"))==(FILE *)0) {
+ (void) rou_alert(0,"%s unable to open count file <%s> (error=<%s>)",
+ OPEP,name,strerror(errno));
+ phase=999; //Big trouble
+ }
+ break;
+ case 2 : //locking access
+ int try;
+
+ try=100; //wait 1 sec total
+ while (try>0) {
+ if (flock(fileno(fcount),LOCK_EX|LOCK_NB)==0)
+ break; //We have the lock
+ else {
+ switch (errno) {
+ case (EWOULDBLOCK) :
+ try--;
+ if (try>0)
+ (void) usleep(10000); //Wait 10 millisec
+ else
+ (void) rou_alert(0,"%s unable to lock count file <%s> in time",
+ OPEP,name);
+ break;
+ default :
+ (void) rou_alert(0,"%s unable to lock count file <%s> (error=<%s>)",
+ OPEP,name,strerror(errno));
+ (void) fclose(fcount);
+ phase=999;// trouble trouble
+ try=0;
+ break;
+ }
+ }
+ }
+ break;
+ case 3 : //reading count
+ if (fscanf(fcount,"%d",&result)!=1) {
+ (void) rou_alert(0,"%s unable to read file <%s> contents (error=<%s>)",
+ OPEP,name,strerror(errno));
+ (void) fclose(fcount);
+ phase=999; //trouble trouble
+ }
+ break;
+ case 4 : //doing count
+ result+=count;
+ if (result<0)
+ result=-1;
+ (void) rewind(fcount);
+ if (fprintf(fcount,"%d\n",result)<0) {
+ (void) rou_alert(0,"%s unable to write file <%s> count value (error=<%s>)",
+ OPEP,name,strerror(errno));
+ }
+ (void) fclose(fcount);
+ break;
+ default : //SAFE Guard
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+filename=rou_freestr(filename);
+return result;
+
#undef OPEP
}
/*
//procedure to duplicate a specific qfile to another file
extern _Bool eml_dupqfile(char *qfilename,const char *dest);
+//procedure to increase or decrease the "count" file contents
+extern int eml_countqfile(char *qfilename,int count);
+
//procedure to check email address format
//of an email address
extern RCPTYP *eml_isemailok(char *email,char **report);