X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Fliblutil%2Fauthpasswd.c;h=e179f32dbcd661ac233ad78ce62c7043123abae2;hb=5fc22599e2e875c9620b63fbf465273fba3c378f;hp=fafd56549ca15158d55ff5f535ef6a6cf9b81d4c;hpb=802ee714e40372d4adcd394739959d2f362cf689;p=openldap diff --git a/libraries/liblutil/authpasswd.c b/libraries/liblutil/authpasswd.c index fafd56549c..e179f32dbc 100644 --- a/libraries/liblutil/authpasswd.c +++ b/libraries/liblutil/authpasswd.c @@ -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