SUBDIR = \
lib \
app \
+ tools \
sql \
#--------------------------------------------------------------------
#include "uniprc.h"
#include "gesspf.h"
-#define CHKSPF "chkspf" //SPF field validator
+#define CHKSPF "chkspf" //application name
/*
\f
+++ /dev/null
-// vim: smarttab tabstop=8 shiftwidth=2 expandtab
-/********************************************************/
-/* */
-/* Main SMTP Daemon */
-/* */
-/********************************************************/
-#include <errno.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "subrou.h"
-#include "unipar.h"
-#include "uniprc.h"
-#include "unisig.h"
-
-/*
-\f
-*/
-/********************************************************/
-/* */
-/* Program main task */
-/* */
-/********************************************************/
-static void task(u_int iteration)
-
-{
-#define OPEP "maild.c:task"
-char *emlrec;
-char *argv[10];
-pid_t *pidlst;
-int phase;
-_Bool proceed;
-
-emlrec=rou_apppath("/usr/bin/emlrec");
-argv[0]=(char *)0;
-pidlst=(pid_t *)calloc(iteration,sizeof(pid_t));
-phase=0;
-proceed=true;
-while (proceed==true) {
- switch (phase) {
- case 0 : //looping forever email receiving processes
- for (int i=0;i<iteration;i++) {
- if (pidlst[i]!=(pid_t)0) {
- if (prc_checkprocess(pidlst[i])==true)
- continue;
- }
- switch (pidlst[i]=fork()) {
- case -1 : //trouble trouble?
- pidlst[i]=(pid_t)0;
- break;
- case 0 :
- (void) rou_alert(0,"Should execv \"%s\"",emlrec);
- if (execv(emlrec,argv)<0) {
- (void) rou_alert(0,"%s, Unable to exec command <%s> "
- "(error=<%s>, system trouble?)",
- OPEP,emlrec,strerror(errno));
- (void) sleep(2); //to avoid avalanche
- }
- (void) exit(1); //reached only if trouble
- break;
- default :
- break;
- }
- }
- (void) sleep(2); //next check in 5 second
- if (hangup==false) //lets try again
- phase--; //same phase
- (void) prc_nozombie();
- break;
- case 1 : //Terminating all remaining process
- if (pidlst!=(pid_t *)0) { //always
- u_int stillrun;
-
- stillrun=0;
- for (int i=0;i<iteration;i++) {
- if (pidlst[i]==(pid_t)0)
- continue;
- if (prc_checkprocess(pidlst[i])==true) {
- (void) kill(pidlst[i],SIGQUIT);
- stillrun++;
- }
- else
- pidlst[i]=(pid_t)0;
- }
- if (stillrun>0) {
- (void) prc_nozombie();
- (void) sleep(2);
- phase--; //let send signal again
- }
- }
- break;
- default : //SAFE Guard
- proceed=false;
- break;
- }
- phase++;
- }
-(void) free(pidlst);
-#undef OPEP
-}
-/*
-\f
-*/
-/********************************************************/
-/* */
-/* Main routine */
-/* Start multiple SMTP daemon and make */
-/* sure there always ready to answer to */
-/* SMTP request. */
-/* */
-/********************************************************/
-int main(int argc,char *argv[])
-
-{
-int status;
-ARGTYP *params;
-int phase;
-_Bool proceed;
-
-status=0;
-params=(ARGTYP *)0;
-phase=0;
-proceed=true;
-while (proceed==true) {
- switch (phase) {
- case 0 : //checking parameters
- if ((params=par_getparams(argc,argv,"d:fhr:v"))==(ARGTYP *)0) {
- phase=999; //no need to go further
- }
- break;
- case 1 : //Need to go in background mode?
- if (foreground==false)
- if (prc_divedivedive()!=(pid_t)0)
- proceed=false;//Dive mode
- break;
- case 2 : //initialising process
- (void) prc_preptitle(argc,argv,environ);
- (void) rou_modesubrou(true);
- (void) prc_modeuniprc(true);
- (void) sig_modeunisig(true);
- (void) sig_trapsignal(true,sig_alrm);
- break;
- case 3 : //doing main tash
- if (prc_locking(appname,true,5)==true) {
- (void) task(1);
- (void) prc_locking(appname,false,1);
- }
- break;
- case 4 : //doing main tash
- (void) prc_cleantitle();
- params=par_freeparams(params);
- (void) sig_trapsignal(false,sig_alrm);
- (void) sig_modeunisig(false);
- (void) prc_modeuniprc(false);
- (void) rou_modesubrou(false);
- break;
- default : //end of task
- proceed=false;
- break;
- }
- phase++;
- }
-(void) exit(status);
-}
//base64 char 0 coding
#define IOBNULL "\\0"
-//MD5 hashing result
-typedef unsigned char MD5TYP[17];
-
//Procedure to convert a plain ASCII B64 sequence
//to a plain ASCII sequence
extern char *cnv_getb64(char *b64);
break;
case 1 : //getting md5 context
if ((mdctx=EVP_MD_CTX_new())==(EVP_MD_CTX *)0) {
- (void) fprintf(stdout,"%s Unable to open MD5 context (System?)",OPEP);
+ (void) rou_alert(0,"%s Unable to open MD5 context (System?)",OPEP);
phase=999; //no need to go further
}
break;
switch (phase) {
case 0 : //do ve have good parameters
if ((key==(const void *)0)||(seq==(unsigned char *)0)) {
- (void) fprintf(stderr,"%s key or seq undefined (Bug?)",OPEP);
+ (void) rou_alert(0,"%s key or seq undefined (Bug?)",OPEP);
phase=999;
}
break;
case 1 : //computing sequence
d5=HMAC(EVP_md5(),key,strlen(key),seq,strlen((const char *)seq),d5,&reslen);
if (d5==(unsigned char *)0) {
- (void) fprintf(stderr,"%s No MD5 for key=<%s> and seq=<%s> (Bug?)",
- OPEP,(char *)key,seq);
+ (void) rou_alert(0,"%s No MD5 for key=<%s> and seq=<%s> (Bug?)",
+ OPEP,(char *)key,seq);
phase=999;
}
break;
#ifndef UNIDIG
#define UNIDIG
+//MD5 hashing result
+typedef unsigned char MD5TYP[17];
+
//procedure to convert a string to a 128 Bit sequence
//as a string
extern MD5TYP *dig_hashmd5(unsigned char *seq);
--- /dev/null
+#--------------------------------------------------------------------
+#Executable generation area
+#--------------------------------------------------------------------
+debug :
+ @ $(MAKE) OPTIME="-g" DEBUG="-DDEBUG" exe
+ @ echo "application compiled in '$@' mode now ready"
+
+prod :
+ @ $(MAKE) OPTIME="-g -O2" exe
+ @ echo "application compiled in '$@' mode now ready"
+
+exe :
+ $(MAKE) $(EXE)
+
+
+clean :
+ - rm -fr *.o $(EXE)
+ - rm -fr ../bin/*
+
+#--------------------------------------------------------------------
+#Equivalences
+#--------------------------------------------------------------------
+EXE= \
+ digmd5 \
+
+SRC= \
+ digmd5.c
+
+#--------------------------------------------------------------------
+#definitions
+#--------------------------------------------------------------------
+CC = gcc
+LD = gcc -g
+CFLAGS = -I ../lib -Wall $(OPTIME)
+LIBMAIL = ../lib/libmail.a
+
+LIBS = $(LIBMAIL) \
+ -luuid \
+ -lcrypto \
+ -lcrypt \
+ -lssl \
+
+#--------------------------------------------------------------------
+#Dependances
+#--------------------------------------------------------------------
+digmd5 : toremake digmd5.o
+ @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS)
+
+digmd5.o: digmd5.c \
+ ../lib/unidig.h \
+ ../lib/unipar.h \
+ ../lib/uniprc.h \
+ ../lib/subrou.h
+
+toremake: Makefile
+ touch toremake
+ - rm -f $(EXE) *.o
+
+#--------------------------------------------------------------------
--- /dev/null
+// vim: smarttab tabstop=8 shiftwidth=2 expandtab
+/********************************************************/
+/* */
+/* Validation program to check DIGEST-MD5 Exchange */
+/* */
+/* Usage: */
+/* digmd5 secret_pass base64_string */
+/* */
+/********************************************************/
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "subrou.h"
+#include "unidig.h"
+#include "unipar.h"
+#include "uniprc.h"
+
+#define DIGMD5 "digmd5" //application name
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* */
+/********************************************************/
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Main routine */
+/* Read the challenge response in base 64 */
+/* and check if the challange response is */
+/* OK. */
+/* */
+/********************************************************/
+int main(int argc,char *argv[])
+
+{
+int status;
+int phase;
+ARGTYP *params;
+_Bool proceed;
+
+status=0;
+params=(ARGTYP *)0;
+phase=0;
+proceed=true;
+while (proceed==true) {
+ switch (phase) {
+ case 0 : //checking parameters
+ if ((params=par_getparams(argc,argv,"d:hr:v"))==(ARGTYP *)0)
+ phase=999; //no need to go further
+ break;
+ case 1 : //check if we have file to scan
+ if (params->argc!=2) {
+ (void) fprintf(stderr,"Unable to proceed with test\n");
+ (void) fprintf(stderr,"\tthe test pattern number should be 2\n");
+ status=-1;
+ phase=999;
+ }
+ break;
+ case 2 :
+ (void) rou_modesubrou(true);
+ (void) rou_setappname(DIGMD5);
+ (void) prc_preptitle(argc,argv,environ);
+ foreground=true;
+ break;
+ case 3 : //doing main task
+ break;
+ default : //end of task
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+(void) exit(status);
+}