aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/krb/sendauth.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/krb5/krb/sendauth.c')
-rw-r--r--src/lib/krb5/krb/sendauth.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/lib/krb5/krb/sendauth.c b/src/lib/krb5/krb/sendauth.c
index f7e6777411aa..149e25dd7362 100644
--- a/src/lib/krb5/krb/sendauth.c
+++ b/src/lib/krb5/krb/sendauth.c
@@ -131,22 +131,21 @@ krb5_sendauth(krb5_context context, krb5_auth_context *auth_context,
This isn't strong cryptographically; the point here is
not to guarantee randomness, but to make it less likely
that multiple sessions could pick the same subkey. */
- char rnd_data[1024];
+ struct sockaddr_storage rnd_data;
GETPEERNAME_ARG3_TYPE len2;
- krb5_data d;
- d.length = sizeof (rnd_data);
- d.data = rnd_data;
- len2 = sizeof (rnd_data);
- if (getpeername (*(int*)fd, (GETPEERNAME_ARG2_TYPE *) rnd_data,
- &len2) == 0) {
+ krb5_data d = make_data(&rnd_data, sizeof(rnd_data));
+
+ len2 = sizeof(rnd_data);
+ if (getpeername(*(int *)fd, ss2sa(&rnd_data), &len2) == 0) {
d.length = len2;
- (void) krb5_c_random_add_entropy (context, KRB5_C_RANDSOURCE_EXTERNAL_PROTOCOL, &d);
+ (void)krb5_c_random_add_entropy(
+ context, KRB5_C_RANDSOURCE_EXTERNAL_PROTOCOL, &d);
}
- len2 = sizeof (rnd_data);
- if (getsockname (*(int*)fd, (GETSOCKNAME_ARG2_TYPE *) rnd_data,
- &len2) == 0) {
+ len2 = sizeof(rnd_data);
+ if (getsockname(*(int *)fd, ss2sa(&rnd_data), &len2) == 0) {
d.length = len2;
- (void) krb5_c_random_add_entropy (context, KRB5_C_RANDSOURCE_EXTERNAL_PROTOCOL, &d);
+ (void)krb5_c_random_add_entropy(
+ context, KRB5_C_RANDSOURCE_EXTERNAL_PROTOCOL, &d);
}
}