1 /*$Id: checktag.c,v 1.4 1999/10/12 23:38:36 lindberg Exp $*/
2 /*$Name: ezmlm-idx-040 $*/
10 #include "subscribe.h"
12 static stralloc key
= {0};
13 static stralloc line
= {0};
14 static stralloc quoted
= {0};
15 static char strnum
[FMT_ULONG
];
16 static char newcookie
[COOKIE
];
18 char *checktag (dir
,num
,listno
,action
,seed
,hash
)
19 /* reads dir/sql. If not present, checks that the hash of seed matches */
20 /* hash and returns success (NULL). If not match returns "". If error, */
21 /* returns error string */
23 char *dir
; /* the db base dir */
24 unsigned long num
; /* message number */
25 unsigned long listno
; /* bottom of range => slave */
27 char *seed
; /* cookie base */
28 char *hash
; /* cookie */
31 if (!seed
) return (char *) 0; /* no data - accept */
33 strnum
[fmt_ulong(strnum
,num
)] = '\0'; /* message nr ->string*/
35 switch(slurp("key",&key
,32)) {
39 return ERR_NOEXIST_KEY
;
42 cookie(newcookie
,key
.s
,key
.len
,strnum
,seed
,action
);
43 if (byte_diff(hash
,COOKIE
,newcookie
)) return "";
44 else return (char *) 0;