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