-#if defined(KERBEROS) && !defined(openbsd)
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+#include "portable.h"
+
+#if defined(LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND) && !defined(openbsd)
/*
- * $Source: /repo/OpenLDAP/pkg/ldap/clients/ud/string_to_key.c,v $
- * $Author: kurt $
- *
* Copyright 1985, 1986, 1987, 1988, 1989 by the Massachusetts Institute
* of Technology.
*
* spm 8/85 MIT project athena
*/
-#ifndef lint
-static char rcsid_string_to_key_c[] =
-"$Id: string_to_key.c,v 1.1.3.1 1998/08/08 22:43:17 kurt Exp $";
-#endif
-
-#include <mit-copyright.h>
#include <stdio.h>
-#include <des.h>
-/* #include "des_internal.h" */
-#if 1
-#include <krb.h>
-#endif
+#include <ac/krb.h>
+#if defined( DEBUG ) && defined( HAVE_DES_DEBUG )
+#define USE_DES_DEBUG
extern int des_debug;
-extern int des_debug_print();
+#endif
+
extern void des_fixup_key_parity();
-#ifndef AFSKERBEROS
+#ifndef HAVE_AFS_KERBEROS
#define WORLDPEACEINOURTIME
#endif
#if defined(WORLDPEACEINOURTIME) /* Use original, not ifs version */
+#ifndef HAVE_KERBEROS_V
/*
* convert an arbitrary length string to a DES key
*/
-int
-des_string_to_key(str,key)
- char *str;
- register des_cblock *key;
+void
+des_string_to_key( char *str, register des_cblock *key )
{
register char *in_str;
register unsigned temp,i;
/* init key array for bits */
memset(k_char, 0, sizeof(k_char));
-#ifdef DEBUG
+#ifdef USE_DES_DEBUG
if (des_debug)
fprintf(stdout,
"\n\ninput str length = %d string = %s\nstring = 0x ",
for (i = 1; i <= length; i++) {
/* get next input key byte */
temp = (unsigned int) *str++;
-#ifdef DEBUG
+#ifdef USE_DES_DEBUG
if (des_debug)
fprintf(stdout,"%02x ",temp & 0xff);
#endif
/* now fix up key parity again */
des_fixup_key_parity(key);
+#ifdef USE_DES_DEBUG
if (des_debug)
fprintf(stdout,
- "\nResulting string_to_key = 0x%x 0x%x\n",
+ "\nResulting string_to_key = 0x%lx 0x%lx\n",
*((unsigned long *) key),
*((unsigned long *) key+1));
+#endif
}
+#endif /* HAVE_KERBEROS_V */
#else /* Use ifs version */
#if 0
encryption key. It is compatible with the original Andrew authentication
service password database. */
-static void Andrew_StringToKey (str, cell, key)
- char *str;
- char *cell; /* cell for password */
- des_cblock *key;
+static void
+Andrew_StringToKey(
+ char *str,
+ char *cell, /* cell for password */
+ des_cblock *key
+)
{ char password[8+1]; /* crypt is limited to 8 chars anyway */
int i;
int passlen;
des_fixup_key_parity (key);
}
-static void StringToKey (str, cell, key)
- char *str;
- char *cell; /* cell for password */
- des_cblock *key;
+static void
+StringToKey(
+ char *str,
+ char *cell, /* cell for password */
+ des_cblock *key
+)
{ des_key_schedule schedule;
char temp_key[8];
char ivec[8];
des_fixup_key_parity (key);
}
-/* static */ void
-ka_StringToKey (str, cell, key)
- char *str;
- char *cell; /* cell for password */
- des_cblock *key;
+void
+ka_StringToKey (
+ char *str,
+ char *cell, /* cell for password */
+ des_cblock *key
+)
{ char realm[REALM_SZ];
#if NOWAYOUTTODAY
long code;
- /* code = ka_CellToRealm (cell, realm, 0/*local*/); */
+#if 0
+ code = ka_CellToRealm (cell, realm, 0/*local*/);
+#endif
if (code) strcpy (realm, "");
else lcstring (realm, realm, sizeof(realm)); /* for backward compatibility */
#else
* convert an arbitrary length string to a DES key
*/
int
-des_string_to_key(str,key)
- char *str;
- register des_cblock *key;
+des_string_to_key( char *str, register des_cblock *key )
{
/* NB: i should probably call routine to get local cell here */
ka_StringToKey(str, "umich.edu", key);