ezmlmx 0.68
ezmlmx
Loading...
Searching...
No Matches
checktag.c
Go to the documentation of this file.
1#include "stralloc.h"
2#include "scan.h"
3#include "fmt.h"
4#include "cookie.h"
5#include "makehash.h"
6#include "readclose.h"
7#include "byte.h"
8#include "errtxt.h"
9#include "subscribe.h"
10
11#define WHO "checktag"
12
22
23static stralloc key = {0};
24static char strnum[FMT_ULONG];
25static char newcookie[COOKIE];
26
27const char *checktag(const char *dir, /* the db base dir */
28 unsigned long num, /* message number */
29 unsigned long listno, /* bottom of range => slave */
30 const char *action,
31 const char *seed, /* cookie base */
32 const char *hash) /* cookie */
33{
34 if (!seed) return (char *) 0; /* no data - accept */
35
36 strnum[fmt_ulong(strnum,num)] = '\0'; /* message nr ->string*/
37
38 switch (openreadclose("key",&key,32)) {
39 case -1: return ERR_READ_KEY;
40 case 0: return ERR_NOEXIST_KEY;
41 }
42
43 cookie(newcookie,key.s,key.len,strnum,seed,action);
44 if (byte_diff(hash,COOKIE,newcookie)) return "";
45 else return (char *) 0;
46}
#define COOKIE
Definition cookie.h:4
Error messages. If you translate these, I would urge you to keep the English version as well....
#define ERR_NOEXIST_KEY
Definition errtxt.h:41
#define ERR_READ_KEY
Definition errtxt.h:19
stralloc listno
Definition ezmlm-get.c:78
stralloc seed
Definition ezmlm-get.c:74
stralloc num
char * dir
void cookie(char *hash, const char *key, unsigned int keylen, const char *date, const char *addr, const char *action)
Definition cookie.c:14
const char * checktag(const char *dir, unsigned long num, unsigned long listno, const char *action, const char *seed, const char *hash)
Definition checktag.c:27
stralloc action
Definition ezmlm-store.c:84