1 /*$Id: tagmsg.c,v 1.3 1999/10/12 23:38:36 lindberg Exp $*/
2 /*$Name: ezmlm-idx-040 $*/
10 #include "subscribe.h"
13 static stralloc line
= {0};
14 static stralloc key
= {0};
15 static char hash
[COOKIE
];
16 static char strnum
[FMT_ULONG
]; /* message number as sz */
18 static void die_nomem(fatal
)
21 strerr_die2x(100,fatal
,ERR_NOMEM
);
24 void tagmsg(dir
,msgnum
,seed
,action
,hashout
,bodysize
,chunk
,fatal
)
25 /* This routine creates a cookie from num,seed and the */
26 /* list key and returns that cookie in hashout. The use of sender/num and */
27 /* first char of action is used to make cookie differ between messages, */
28 /* the key is the secret list key. */
30 char *dir
; /* db base dir */
31 unsigned long msgnum
; /* number of this message */
32 char *seed
; /* seed. NULL ok, but less entropy */
33 char *action
; /* to make it certain the cookie differs from*/
34 /* one used for a digest */
35 char *hashout
; /* calculated hash goes here */
36 unsigned long bodysize
;
42 strnum
[fmt_ulong(strnum
,msgnum
)] = '\0'; /* message nr ->string*/
44 switch(slurp("key",&key
,32)) {
46 strerr_die3sys(111,fatal
,ERR_READ
,"key: ");
48 strerr_die3x(100,fatal
,"key",ERR_NOEXIST
);
50 cookie(hash
,key
.s
,key
.len
,strnum
,seed
,action
);
51 for (i
= 0; i
< COOKIE
; i
++)