#include "subcnv.h"
#include "unidig.h"
+/*
+ * \f
+*/
+/********************************************************/
+/* */
+/* Procedure to free all memroy used by a response */
+/* type structure. */
+/* */
+/********************************************************/
+PUBLIC RSPTYP *dig_freeresp(RSPTYP *resp)
+
+{
+if (resp!=(RSPTYP *)0) {
+ resp->response=rou_freestr(resp->response);
+ resp->qpop=rou_freestr(resp->qpop);
+ resp->nc=rou_freestr(resp->nc);
+ resp->cnonce=rou_freestr(resp->cnonce);
+ resp->nonce=rou_freestr(resp->nonce);
+ resp->realm=rou_freestr(resp->realm);
+ resp->username=rou_freestr(resp->username);
+ (void) free(resp);
+ resp=(RSPTYP *)0;
+ }
+return resp;
+}
/*
* \f
*/
#ifndef UNIDIG
#define UNIDIG
+typedef struct { //DIGEST-MD5 challange response structure
+ char *username; //username requesting authentication
+ char *realm; //Challenge realm
+ char *nonce; //server nonce
+ char *cnonce; //client nonce
+ char *nc; //nonce count
+ char *qpop; //protection quality (authentication)
+ char *response; //Challenge md5 response
+ }RSPTYP;
+
//MD5 hashing result
typedef unsigned char MD5TYP[17];
+//procedure to free the response structure
+extern RSPTYP *dig_freeresp(RSPTYP *resp);
+
//procedure to convert a string to a 128 Bit sequence
//as a string
extern MD5TYP *dig_hashmd5(unsigned char *seq);
tstmd5 : digmd5
@ ./digmd5 xxx $(BASE64)
-dbgmd5 : debug
+VALKIND = "definite,possible,indirect"
+valmd5 : digmd5
+ @ valgrind \
+ --leak-check=full \
+ --show-leak-kinds=$(VALKIND) \
+ ./digmd5 xxx $(BASE64)
+
+dbgmd5 : digmd5
@ gdb \
--args \
./digmd5 xxx $(BASE64)
#include <string.h>
#include <unistd.h>
+#include "subcnv.h"
#include "subrou.h"
#include "unidig.h"
#include "unipar.h"
#define OPEP "digmd5.c:chkresponse,"
int status;
+char *cleartext;
int phase;
_Bool proceed;
status=-1;
+cleartext=cnv_getb64(argv[1]);
phase=0;
-proceed=true;
+proceed=(cleartext!=(char *)0);
while (proceed==true) {
switch (phase) {
case 0 : //
- (void) rou_alert(0,"%s argv[1]=<%s>",OPEP,argv[1]);
+ (void) rou_alert(0,"%s cleartext=<%s>",OPEP,cleartext);
break;
default : //SAFE Guard
proceed=false;
}
phase++;
}
+cleartext=rou_freestr(cleartext);
return status;
+
#undef OPEP
}
/*
case 3 : //doing main task
(void) chkresponse(params->argc,params->argv);
break;
+ case 4 : //main task completed
+ (void) prc_cleantitle();
+ params=par_freeparams(params);
+ (void) rou_modesubrou(false);
+ break;
default : //end of task
proceed=false;
break;