|
|
1.1 root 1: #include "BasicAuthentication_support.c"
2: #include <ctype.h>
3:
4: static Cardinal
5: hashpass(hpw)
6: char *hpw;
7: {
8: unsigned long hash;
9: register char c;
10:
11: hash = 0;
12: while ((c = *hpw++) != '\0') {
13: hash = (hash<<16) + (isupper(c) ? tolower(c) : c);
14: hash %= 65357;
15: }
16: return((Cardinal) hash);
17: }
18:
19:
20: /*
21: * Given an XNS name and password, return the appropriate
22: * credentials and verifier associated with that name.
23: * Per Authentication Protocol, XSIS ....
24: */
25: MakeSimpleCredentialsAndVerifier(name, pwd, credentials, verifier)
26: Clearinghouse_Name *name; /* the XNS user, in 3 fields */
27: char *pwd; /* password, a UNIX string */
28: Credentials *credentials;
29: Verifier *verifier;
30: {
31: Cardinal length;
32: Unspecified *data, *buf, *seq;
33:
34: credentials->type = simple;
35: length = sizeof_Clearinghouse_Name(name);
36: data = Allocate(length);
37: (void) externalize_Clearinghouse_Name(name,data);
38: seq = credentials->value.sequence = Allocate(length);
39: credentials->value.length = length;
40: buf = data;
41: for ( ; length > 0; length--, seq++)
42: buf += internalize_Unspecified(seq, buf);
43: free(data);
44:
45: verifier->length = 1;
46: verifier->sequence = Allocate(sizeof_Unspecified(0));
47: verifier->sequence[0] = (Unspecified) hashpass(pwd);
48: }
49:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.