]> git.sur5r.net Git - openldap/blobdiff - libraries/liblutil/authpasswd.c
Update SASL code to reuse context through life of session.
[openldap] / libraries / liblutil / authpasswd.c
index fafd56549ca15158d55ff5f535ef6a6cf9b81d4c..e179f32dbcd661ac233ad78ce62c7043123abae2 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
@@ -609,7 +609,7 @@ static int chk_kerberos(
                }
 
                {
-                       char host[MAXHOSTNAMELEN];
+                       char host[MAXHOSTNAMELEN+1];
 
                        if( gethostname( host, MAXHOSTNAMELEN ) != 0 ) {
                                krb5_free_principal( context, client );
@@ -617,6 +617,8 @@ static int chk_kerberos(
                                return 1;
                        }
 
+                       host[MAXHOSTNAMELEN] = '\0';
+
                        ret = krb5_sname_to_principal( context,
                                host, "ldap", KRB5_NT_SRV_HST, &server );
                }
@@ -823,7 +825,7 @@ static struct berval *hash_sha1(
        const struct berval  *passwd )
 {
        lutil_SHA1_CTX  SHA1context;
-       unsigned char   SHA1digest[20];
+       unsigned char   SHA1digest[LUTIL_SHA1_BYTES];
        struct berval digest;
        digest.bv_val = SHA1digest;
        digest.bv_len = sizeof(SHA1digest);
@@ -841,7 +843,7 @@ static struct berval *hash_smd5(
        const struct berval  *passwd )
 {
        lutil_MD5_CTX   MD5context;
-       unsigned char   MD5digest[16];
+       unsigned char   MD5digest[LUTIL_MD5_BYTES];
        unsigned char   saltdata[4];
        struct berval digest;
        struct berval salt;
@@ -870,7 +872,7 @@ static struct berval *hash_md5(
        const struct berval  *passwd )
 {
        lutil_MD5_CTX   MD5context;
-       unsigned char   MD5digest[16];
+       unsigned char   MD5digest[LUTIL_MD5_BYTES];
 
        struct berval digest;
 
@@ -926,4 +928,4 @@ static struct berval *hash_crypt(
        return pw_string( scheme, &hash );
 }
 #endif
-#endif
\ No newline at end of file
+#endif