2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
22 #include <stdio.h> /* sprintf */
24 #include <afs/kautils.h>
26 #include <afs/cm_config.h>
28 #include <afs/krb_prot.h>
33 int krb_add_host(struct sockaddr_in *server_list_p);
34 static void krb_set_port(long port);
37 ka_AddHostProc(void *rockp, struct sockaddr_in *addrp, char *namep)
39 return krb_add_host(addrp);
42 static char bogusReason[100];
45 ka_MapKerberosError(int code)
49 return "password was incorrect";
50 case KERB_ERR_PRINCIPAL_UNKNOWN:
51 return "user doesn't exist";
52 case KERB_ERR_SERVICE_EXP:
53 return "server and client clocks are badly skewed";
55 return "Authentication Server was unavailable";
57 return "server and client clocks are badly skewed";
59 sprintf(bogusReason, "unknown authentication error %d", code);
64 static int krb_get_in_tkt_ext(char *user, char *instance, char *realm,
65 char *service, char *sinstance, int life,
66 struct ktc_encryptionKey *key1,
67 struct ktc_encryptionKey *key2, char **ticketpp,
69 struct ktc_encryptionKey *outKeyp, long *kvnop,
70 long *expp, char **reasonp);
74 ka_UserAuthenticateGeneral(afs_int32 flags, char *name, char *instance,
75 char *realm, char *password, Date lifetime,
76 afs_int32 * password_expiresP, afs_int32 spare,
79 return ka_UserAuthenticateGeneral2(flags, name, instance, realm, password,
80 NULL, lifetime, password_expiresP,
85 ka_UserAuthenticateGeneral2(afs_int32 flags, char *name, char *instance,
86 char *realm, char *password, char *smbname,
87 Date lifetime, afs_int32 * password_expiresP,
88 afs_int32 spare, char **reasonP)
91 struct ktc_encryptionKey key1, key2;
94 struct ktc_encryptionKey sessionKey;
102 struct ktc_principal server;
103 struct ktc_principal client;
104 struct ktc_token token;
106 if (instance == NULL)
109 lifetime = MAXKTCTICKETLIFETIME;
111 code = cm_SearchCellRegistry(1, realm, fullRealm, NULL, ka_AddHostProc, NULL);
112 if (code && code != CM_ERROR_FORCE_DNS_LOOKUP)
113 code = cm_SearchCellFile(realm, fullRealm, ka_AddHostProc, NULL);
118 cm_SearchCellByDNS(realm, fullRealm, &ttl, ka_AddHostProc, NULL);
122 *reasonP = "specified realm is unknown";
126 strcpy(upperRealm, fullRealm);
129 /* encrypt password, both ways */
130 ka_StringToKey(password, upperRealm, &key1);
131 des_string_to_key(password, &key2);
133 /* set port number */
134 sp = getservbyname("kerberos", "udp");
136 krb_set_port(ntohs(sp->s_port));
140 krb_get_in_tkt_ext(name, instance, upperRealm, "afs", "", lifetime,
141 &key1, &key2, &ticket, &ticketLen, &sessionKey,
142 &kvno, &expirationTime, reasonP);
144 if (code && *reasonP == NULL)
145 *reasonP = ka_MapKerberosError(code);
150 strcpy(server.name, "afs");
151 strcpy(server.instance, "");
152 strcpy(server.cell, fullRealm);
154 /* Would like to use Vice ID's; using raw names for now. */
155 strcpy(client.name, name);
156 strcpy(client.instance, instance);
157 strcpy(client.cell, upperRealm);
159 strcpy(client.smbname, smbname);
161 token.startTime = 0; /* XXX */
162 token.endTime = expirationTime;
163 token.sessionKey = sessionKey;
164 token.kvno = (short)kvno;
165 token.ticketLen = ticketLen;
166 memcpy(token.ticket, ticket, ticketLen);
169 ktc_SetToken(&server, &token, &client,
170 (flags & KA_USERAUTH_AUTHENT_LOGON) ? AFS_SETTOK_LOGON :
173 if (code == KTC_NOCM || code == KTC_NOCMRPC)
174 *reasonP = "AFS service may not have started";
175 else if (code == KTC_RPC)
176 *reasonP = "RPC failure in AFS gateway";
177 else if (code == KTC_NOCELL)
178 *reasonP = "unknown cell";
180 *reasonP = "unknown error";
189 * This code is descended from kerberos files krb_get_in_tkt.c and
190 * send_to_kdc.c, and one.c.
194 * definition of variable set to 1.
195 * used in krb_conf.h to determine host byte order.
197 static int krbONE = 1;
199 #define HOST_BYTE_ORDER (* (char *) &krbONE)
204 * Copyright 1986, 1987, 1988 by the Massachusetts Institute
207 * For copying and distribution information, please see the file
217 #include <sys/types.h>
218 #include <winsock2.h>
220 static int swap_bytes;
223 * The kaserver defines these error codes *privately*. So we redefine them
224 * here, with a slight name change to show that they really are kaserver
227 #define KERB_KA_ERR_BAD_MSG_TYPE 99
228 #define KERB_KA_ERR_BAD_LIFETIME 98
229 #define KERB_KA_ERR_NONNULL_REALM 97
230 #define KERB_KA_ERR_PKT_LENGTH 96
231 #define KERB_KA_ERR_TEXT_LENGTH 95
234 swap_u_int32(afs_uint32 * u)
236 *u = *u >> 24 | (*u & 0x00ff0000) >> 8 | (*u & 0x0000ff00) << 8 | *u <<
241 swap_u_int16(afs_uint16 * u)
243 *u = *u >> 8 | *u << 8;
246 int pkt_clen(KTEXT pkt);
247 KTEXT pkt_cipher(KTEXT packet);
250 * The following routine has been hacked to make it work for two different
251 * possible string-to-key algorithms. This is a minimal displacement
256 * krb_get_in_tkt() gets a ticket for a given principal to use a given
257 * service and stores the returned ticket and session key for future
260 * The "user", "instance", and "realm" arguments give the identity of
261 * the client who will use the ticket. The "service" and "sinstance"
262 * arguments give the identity of the server that the client wishes
263 * to use. (The realm of the server is the same as the Kerberos server
264 * to whom the request is sent.) The "life" argument indicates the
265 * desired lifetime of the ticket; the "key_proc" argument is a pointer
266 * to the routine used for getting the client's private key to decrypt
267 * the reply from Kerberos. The "decrypt_proc" argument is a pointer
268 * to the routine used to decrypt the reply from Kerberos; and "arg"
269 * is an argument to be passed on to the "key_proc" routine.
271 * If all goes well, krb_get_in_tkt() returns INTK_OK, otherwise it
272 * returns an error code: If an AUTH_MSG_ERR_REPLY packet is returned
273 * by Kerberos, then the error code it contains is returned. Other
274 * error codes returned by this routine include INTK_PROT to indicate
275 * wrong protocol version, INTK_BADPW to indicate bad password (if
276 * decrypted ticket didn't make sense), INTK_ERR if the ticket was for
277 * the wrong server or the ticket store couldn't be initialized.
279 * The format of the message sent to Kerberos is as follows:
281 * Size Variable Field
282 * ---- -------- -----
284 * 1 byte KRB_PROT_VERSION protocol version number
285 * 1 byte AUTH_MSG_KDC_REQUEST | message type
286 * HOST_BYTE_ORDER local byte order in lsb
287 * string user client's name
288 * string instance client's instance
289 * string realm client's realm
290 * 4 bytes tlocal.tv_sec timestamp in seconds
291 * 1 byte life desired lifetime
292 * string service service's name
293 * string sinstance service's instance
297 * Check_response is a support routine for krb_get_in_tkt.
299 * Check the response with the supplied key. If the key is apparently
300 * wrong, return INTK_BADPW, otherwise zero.
303 check_response(KTEXT rpkt, KTEXT cip, char *service, char *instance,
304 char *realm, struct ktc_encryptionKey *key)
308 char s_service[SNAME_SZ];
309 char s_instance[INST_SZ];
310 char s_realm[REALM_SZ];
316 /* copy information from return packet into "cip" */
317 cip->length = pkt_clen(rpkt);
318 memcpy((char *)(cip->dat), (char *)pkt_cipher(rpkt), cip->length);
321 key_sched((char *)key, key_s);
322 pcbc_encrypt((C_Block *) cip->dat, (C_Block *) cip->dat,
323 (long)cip->length, key_s, (des_cblock *) key, 0);
325 /* Skip session key */
326 ptr = (char *)cip->dat + 8;
328 /* Check and extract server's name */
329 if ((strlen(ptr) + (ptr - (char *)cip->dat)) > cip->length) {
333 (void)strncpy(s_service, ptr, sizeof(s_service) - 1);
334 s_service[sizeof(s_service) - 1] = '\0';
335 ptr += strlen(s_service) + 1;
337 /* Check and extract server's instance */
338 if ((strlen(ptr) + (ptr - (char *)cip->dat)) > cip->length) {
342 (void)strncpy(s_instance, ptr, sizeof(s_instance) - 1);
343 s_instance[sizeof(s_instance) - 1] = '\0';
344 ptr += strlen(s_instance) + 1;
346 /* Check and extract server's realm */
347 if ((strlen(ptr) + (ptr - (char *)cip->dat)) > cip->length) {
351 (void)strncpy(s_realm, ptr, sizeof(s_realm));
352 s_realm[sizeof(s_realm) - 1] = '\0';
353 ptr += strlen(s_realm) + 1;
355 /* Ignore ticket lifetime, server key version */
358 /* Extract and check ticket length */
359 ticket_len = (unsigned char)*ptr++;
362 || ((ticket_len + (ptr - (char *)cip->dat)) > (int)cip->length)) {
366 /* Check returned server name, instance, and realm fields */
368 * 7/23/98 - Deleting realm check. This allows cell name to differ
372 if (strcmp(s_service, service) || strcmp(s_instance, instance)
373 || strcmp(s_realm, realm)) {
375 if (strcmp(s_service, service) || strcmp(s_instance, instance)) {
377 /* not what we asked for: assume decryption failed */
385 * The old kaserver (pre 3.4) returned zero error codes sometimes, leaving
386 * the kaserver error code in a string in the text of the error message.
387 * The new one does the same, but returns KDC_GEN_ERR rather than zero.
388 * We try to extract the actual error code.
390 static char bogus_kaerror[100];
392 kaserver_map_error_code(int code, char *etext, char **reasonP)
394 if (code == 0 || code == KDC_GEN_ERR) {
396 if (sscanf(etext, "code =%u: ", &mapcode) == 1) {
398 strcpy(bogus_kaerror, etext);
399 *reasonP = bogus_kaerror;
411 krb_get_in_tkt_ext(user, instance, realm, service, sinstance, life, key1,
412 key2, ticketpp, ticketLenp, outKeyp, kvnop, expp, reasonp)
419 struct ktc_encryptionKey *key1, *key2;
422 struct ktc_encryptionKey *outKeyp;
428 KTEXT pkt = &pkt_st; /* Packet to KDC */
430 KTEXT rpkt = &rpkt_st; /* Returned packet */
432 KTEXT cip = &cip_st; /* Returned Ciphertext */
434 KTEXT tkt = &tkt_st; /* Current ticket */
435 C_Block ses; /* Session key for tkt */
436 int kvno; /* Kvno for session key */
437 unsigned char *v = pkt->dat; /* Prot vers no */
438 unsigned char *t = (pkt->dat + 1); /* Prot msg type */
440 char s_name[SNAME_SZ];
441 char s_instance[INST_SZ];
449 unsigned long t_local;
451 afs_uint32 rep_err_code;
455 /* BUILD REQUEST PACKET */
457 /* Set up the fixed part of the packet */
458 *v = (unsigned char)KRB_PROT_VERSION;
459 *t = (unsigned char)AUTH_MSG_KDC_REQUEST;
460 *t |= HOST_BYTE_ORDER;
462 /* Now for the variable info */
463 (void)strcpy((char *)(pkt->dat + 2), user); /* aname */
464 pkt->length = 3 + strlen(user);
465 (void)strcpy((char *)(pkt->dat + pkt->length), instance); /* instance */
466 pkt->length += 1 + strlen(instance);
467 (void)strcpy((char *)(pkt->dat + pkt->length), realm); /* realm */
468 pkt->length += 1 + strlen(realm);
471 (void)gettimeofday(&t_local, NULL);
473 t_local = time((void *)0);
476 memcpy((char *)(pkt->dat + pkt->length), (char *)&(t_local), 4);
480 kerberos_life = DEFAULT_TKT_LIFE;
482 kerberos_life = time_to_life(0, life);
483 if (kerberos_life == 0) {
484 kerberos_life = DEFAULT_TKT_LIFE;
488 *(pkt->dat + (pkt->length)++) = kerberos_life;
489 (void)strcpy((char *)(pkt->dat + pkt->length), service);
490 pkt->length += 1 + strlen(service);
491 (void)strcpy((char *)(pkt->dat + pkt->length), sinstance);
493 pkt->length += 1 + strlen(sinstance);
497 /* SEND THE REQUEST AND RECEIVE THE RETURN PACKET */
499 if (kerror = send_to_kdc(pkt, rpkt)) {
503 /* check packet version of the returned packet */
504 if (pkt_version(rpkt) != KRB_PROT_VERSION)
507 /* Check byte order */
508 msg_byte_order = pkt_msg_type(rpkt) & 1;
510 if (msg_byte_order != HOST_BYTE_ORDER) {
514 switch (pkt_msg_type(rpkt) & ~1) {
515 case AUTH_MSG_KDC_REPLY:
517 case AUTH_MSG_ERR_REPLY:
518 memcpy((char *)&rep_err_code, pkt_err_code(rpkt), 4);
520 swap_u_int32(&rep_err_code);
521 /* kaservers return bogus error codes in different ways, so map it
522 * from the error text if this is the case */
523 return kaserver_map_error_code(rep_err_code, pkt_err_text(rpkt),
530 /* get the principal's expiration date */
531 memcpy((char *)&exp_date, pkt_x_date(rpkt), sizeof(exp_date));
533 swap_u_int32(&exp_date);
535 /* Extract length. This will be re-extracted in check_response, below */
536 cip->length = pkt_clen(rpkt);
538 /* Length of zero seems to correspond to no principal (with kaserver) */
539 if (cip->length == 0) {
540 return (KERB_ERR_PRINCIPAL_UNKNOWN);
543 if ((cip->length < 0) || (cip->length > sizeof(cip->dat))) {
544 return (INTK_ERR); /* no appropriate error code
545 * currently defined for INTK_ */
549 * Check the response against both possible keys, and use the one
552 if (check_response(rpkt, cip, service, sinstance, realm, key1)
553 && check_response(rpkt, cip, service, sinstance, realm, key2)) {
558 * EXTRACT INFORMATION FROM RETURN PACKET
560 * Some of the fields, below are already checked for integrity by
563 ptr = (char *)cip->dat;
565 /* extract session key */
566 memcpy((char *)ses, ptr, 8);
569 /* extract server's name */
570 (void)strncpy(s_name, ptr, sizeof(s_name) - 1);
571 s_name[sizeof(s_name) - 1] = '\0';
572 ptr += strlen(s_name) + 1;
574 /* extract server's instance */
575 (void)strncpy(s_instance, ptr, sizeof(s_instance) - 1);
576 s_instance[sizeof(s_instance) - 1] = '\0';
577 ptr += strlen(s_instance) + 1;
579 /* extract server's realm */
580 (void)strncpy(rlm, ptr, sizeof(rlm));
581 rlm[sizeof(rlm) - 1] = '\0';
582 ptr += strlen(rlm) + 1;
584 /* extract ticket lifetime, server key version, ticket length */
585 /* be sure to avoid sign extension on lifetime! */
586 lifetime = (unsigned char)ptr[0];
587 kvno = (unsigned char)ptr[1];
588 tkt->length = (unsigned char)ptr[2];
591 /* extract ticket itself */
592 memcpy((char *)(tkt->dat), ptr, tkt->length);
595 /* check KDC time stamp */
596 memcpy((char *)&kdc_time, ptr, 4); /* Time (coarse) */
598 swap_u_int32(&kdc_time);
602 t_local = time((void *)0);
603 if (abs((int)(t_local - kdc_time)) > CLOCK_SKEW) {
604 return (RD_AP_TIME); /* XXX should probably be better
608 /* copy out results; if *ticketpp is non-null, the caller has already
609 * allocated the buffer for us.
611 memcpy(outKeyp, ses, sizeof(struct ktc_encryptionKey));
612 if (*ticketpp == NULL) {
613 *ticketpp = malloc(tkt->length);
614 } else if (tkt->length > (unsigned long)*ticketLenp)
616 *ticketLenp = tkt->length;
617 memcpy(*ticketpp, tkt->dat, tkt->length);
620 *expp = life_to_time(kdc_time, (char)lifetime);
622 return (INTK_OK); /* this is zero */
627 * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
629 * For copying and distribution information, please see the file
633 #define S_AD_SZ sizeof(struct sockaddr_in)
635 static int krb_debug;
637 /* CLIENT_KRB_TIMEOUT indicates the time to wait before
638 * retrying a server. It's defined in "krb.h".
640 static struct timeval timeout = { CLIENT_KRB_TIMEOUT, 0 };
641 static char *prog = "dm";
645 * This file contains two routines, send_to_kdc() and send_recv().
646 * send_recv() is a static routine used by send_to_kdc().
650 * send_to_kdc() sends a message to the Kerberos authentication
651 * server(s) in the given realm and returns the reply message.
652 * The "pkt" argument points to the message to be sent to Kerberos;
653 * the "rpkt" argument will be filled in with Kerberos' reply.
654 * The "realm" argument indicates the realm of the Kerberos server(s)
655 * to transact with. If the realm is null, the local realm is used.
657 * If more than one Kerberos server is known for a given realm,
658 * different servers will be queried until one of them replies.
659 * Several attempts (retries) are made for each server before
660 * giving up entirely.
662 * If an answer was received from a Kerberos host, KSUCCESS is
663 * returned. The following errors can be returned:
665 * SKDC_CANT - can't get local realm
666 * - can't find "kerberos" in /etc/services database
667 * - can't open socket
668 * - can't bind socket
670 * - couldn't find any Kerberos host
672 * SKDC_RETRY - couldn't get an answer from any Kerberos server,
673 * after several retries
676 typedef struct krb_server {
677 struct krb_server *nextp;
678 struct sockaddr_in addr;
681 static long krb_udp_port = KRB_PORT; /* In host byte order */
682 static krb_server_t *krb_hosts_p = NULL;
683 static int krb_nhosts = 0;
686 krb_set_port(long port)
692 krb_add_host(struct sockaddr_in *server_list_p)
694 krb_server_t *krb_host_p;
696 krb_host_p = malloc(sizeof(krb_server_t));
698 /* add host to list */
699 krb_host_p->nextp = krb_hosts_p;
700 krb_hosts_p = krb_host_p;
703 /* copy in the data */
704 memcpy(&krb_host_p->addr, server_list_p, sizeof(struct sockaddr_in));
710 send_to_kdc(pkt, rpkt)
718 struct sockaddr_in to;
719 int timeAvail, timePerIter, numIters;
721 memset((char *)&to, 0, sizeof(to));
722 if ((f = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
724 fprintf(stderr, "%s: Can't open socket\n", prog);
727 /* from now on, exit through rtn label for cleanup */
729 /* compute # of retries */
730 /* The SMB client seems to time out after 60 seconds. */
732 /* Leave ourselves some margin for fooling around
734 * /* How long does one iteration take? */
735 timePerIter = krb_nhosts * CLIENT_KRB_TIMEOUT;
736 /* How many iters? */
737 numIters = timeAvail / timePerIter;
738 /* No more than max */
739 if (numIters > CLIENT_KRB_RETRY)
740 numIters = CLIENT_KRB_RETRY;
745 /* retry each host in sequence */
746 for (retry = 0; retry < numIters; ++retry) {
747 for (tsp = krb_hosts_p; tsp; tsp = tsp->nextp) {
749 to.sin_family = AF_INET;
750 to.sin_port = htons(((unsigned short)krb_udp_port));
751 if (send_recv(pkt, rpkt, f, &to)) {
761 (void)closesocket(f);
767 * try to send out and receive message.
768 * return 1 on success, 0 on failure
772 send_recv(pkt, rpkt, f, _to)
776 struct sockaddr_in *_to;
779 struct sockaddr_in from;
785 if (_to->sin_family == AF_INET)
786 printf("Sending message to %s...", inet_ntoa(_to->sin_addr));
788 printf("Sending message...");
789 (void)fflush(stdout);
792 sendto(f, (char *)(pkt->dat), pkt->length, 0, (struct sockaddr *)_to,
793 S_AD_SZ)) != (int)pkt->length) {
795 printf("sent only %d/%d\n", numsent, pkt->length);
799 printf("Sent\nWaiting for reply...");
800 (void)fflush(stdout);
805 /* select - either recv is ready, or timeout */
806 /* see if timeout or error or wrong descriptor */
807 if (select(f + 1, &readfds, (fd_set *) 0, (fd_set *) 0, &timeout) < 1
808 || !FD_ISSET(f, &readfds)) {
810 fprintf(stderr, "select failed: readfds=%p", readfds);
815 sin_size = sizeof(from);
817 recvfrom(f, (char *)(rpkt->dat), sizeof(rpkt->dat), 0,
818 (struct sockaddr *)&from, &sin_size))
825 printf("received packet from %s\n", inet_ntoa(from.sin_addr));
833 * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
836 * For copying and distribution information, please see the file
841 * This routine takes a reply packet from the Kerberos ticket-granting
842 * service and returns a pointer to the beginning of the ciphertext in it.
844 * See "krb_prot.h" for packet format.
848 pkt_cipher(KTEXT packet)
851 pkt_a_realm(packet) + 6 + strlen((char *)pkt_a_realm(packet));
852 /* Skip a few more fields */
853 ptr += 3 + 4; /* add 4 for exp_date */
855 /* And return the pointer */
856 return ((KTEXT) ptr);
861 * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
864 * For copying and distribution information, please see the file
869 * Given a pointer to an AUTH_MSG_KDC_REPLY packet, return the length of
870 * its ciphertext portion. The external variable "swap_bytes" is assumed
871 * to have been set to indicate whether or not the packet is in local
872 * byte order. pkt_clen() takes this into account when reading the
873 * ciphertext length out of the packet.
881 /* Start of ticket list */
883 pkt_a_realm(pkt) + 10 + strlen((char *)pkt_a_realm(pkt));
885 /* Finally the length */
886 memcpy((char *)&temp, (char *)(++ptr), 2); /* alignment */
892 printf("Clen is %d\n", temp);
898 /* This defines the Andrew string_to_key function. It accepts a password
899 string as input and converts its via a one-way encryption algorithm to a DES
900 encryption key. It is compatible with the original Andrew authentication
901 service password database. */
904 Andrew_StringToKey(str, cell, key)
906 char *cell; /* cell for password */
907 struct ktc_encryptionKey *key;
909 char password[8 + 1]; /* crypt's limit is 8 chars anyway */
913 memset(key, 0, sizeof(struct ktc_encryptionKey));
915 strncpy(password, cell, 8);
916 passlen = strlen(str);
920 for (i = 0; i < passlen; i++)
921 password[i] ^= str[i];
923 for (i = 0; i < 8; i++)
924 if (password[i] == '\0')
927 /* crypt only considers the first 8 characters of password but for some
928 * reason returns eleven characters of result (plus the two salt chars). */
929 strncpy((char *)key, (char *)crypt(password, "p1") + 2,
930 sizeof(struct ktc_encryptionKey));
932 /* parity is inserted into the LSB so leftshift each byte up one bit. This
933 * allows ascii characters with a zero MSB to retain as much significance
936 char *keybytes = (char *)key;
939 for (i = 0; i < 8; i++) {
940 temp = (unsigned int)keybytes[i];
941 keybytes[i] = (unsigned char)(temp << 1);
944 des_fixup_key_parity((unsigned char *)key);
949 StringToKey(str, cell, key)
951 char *cell; /* cell for password */
952 struct ktc_encryptionKey *key;
954 des_key_schedule schedule;
957 char password[BUFSIZ];
960 strncpy(password, str, sizeof(password));
961 if ((passlen = strlen(password)) < sizeof(password) - 1)
962 strncat(password, cell, sizeof(password) - passlen);
963 if ((passlen = strlen(password)) > sizeof(password))
964 passlen = sizeof(password);
966 memcpy(ivec, "kerberos", 8);
967 memcpy(temp_key, "kerberos", 8);
968 des_fixup_key_parity(temp_key);
969 des_key_sched(temp_key, schedule);
970 des_cbc_cksum(password, ivec, passlen, schedule, ivec);
972 memcpy(temp_key, ivec, 8);
973 des_fixup_key_parity(temp_key);
974 des_key_sched(temp_key, schedule);
975 des_cbc_cksum(password, (char *)key, passlen, schedule, ivec);
977 des_fixup_key_parity((char *)key);