From 99d5835b1362f2e3e9c52f2dbad0eaf17955dd2a Mon Sep 17 00:00:00 2001 From: Keith Vetter Date: Sat, 3 Jun 1995 01:36:16 +0000 Subject: [PATCH] PC bug fixes mostly 16 vs 32 which prototyping fixed git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5936 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kadm/ChangeLog | 7 +++++++ src/lib/kadm/adm_conn.c | 37 +++++++++++++++++++++++++++++++++---- src/lib/kadm/adm_rw.c | 21 +++++++++++++++------ 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/src/lib/kadm/ChangeLog b/src/lib/kadm/ChangeLog index 2498de3e9..20ec998e2 100644 --- a/src/lib/kadm/ChangeLog +++ b/src/lib/kadm/ChangeLog @@ -1,3 +1,10 @@ +Fri Jun 2 17:56:03 1995 Keith Vetter (keithv@fusion.com) + + * adm_conn.c: used SOCKET_ERRNO instead of errno and + added prototypes for the local functions. + * adm_rw.c: added prototypes for the local functions so that + ints get promoted to longs correctly on the PC. + Wed May 31 08:10:13 1995 Ezra Peisach * Makefile.in (DB_OBJS): Change DBOBJS to DB_OBJS to match rest of diff --git a/src/lib/kadm/adm_conn.c b/src/lib/kadm/adm_conn.c index 9acdf0ee2..058ca5051 100644 --- a/src/lib/kadm/adm_conn.c +++ b/src/lib/kadm/adm_conn.c @@ -38,6 +38,33 @@ * Strings */ static char *kadm_cache_name_fmt = "FILE:/tmp/tkt_kpw_%d"; + +/* + * Prototypes for local functions + */ +static krb5_error_code kadm_get_ccache + PROTOTYPE((krb5_context, + char *, + krb5_ccache *, + krb5_principal *)); +static krb5_error_code kadm_get_creds + PROTOTYPE((krb5_context, + krb5_ccache , + krb5_principal, + krb5_creds *, + char *, + char *)); +static krb5_error_code kadm_contact_server + PROTOTYPE((krb5_context, + krb5_data *, + int *, + krb5_address **, + krb5_address **)); +static krb5_error_code kadm_get_auth + PROTOTYPE((krb5_context, + krb5_auth_context * *, + krb5_address *, + krb5_address *)); /* * kadm_get_ccache() - Initialze a credentials cache. @@ -323,7 +350,7 @@ kadm_contact_server(kcontext, realmp, sockp, local, remote) /* Open a tcp socket */ *sockp = socket(PF_INET, SOCK_STREAM, 0); if (*sockp < 0) { - kret = errno; + kret = SOCKET_ERRNO; goto cleanup; } else kret = 0; @@ -333,6 +360,7 @@ kadm_contact_server(kcontext, realmp, sockp, local, remote) (struct sockaddr *) &in_remote, sizeof(in_remote)) < 0) { /* Failed, go to next address */ + kret = SOCKET_ERRNO; close(*sockp); *sockp = -1; continue; @@ -344,7 +372,7 @@ kadm_contact_server(kcontext, realmp, sockp, local, remote) (struct sockaddr *) &in_local, &addr_len) < 0) { /* Couldn't get our local address? */ - kret = errno; + kret = SOCKET_ERRNO; goto cleanup; } else { @@ -403,7 +431,7 @@ kadm_contact_server(kcontext, realmp, sockp, local, remote) /* Open a tcp socket */ *sockp = socket(PF_INET, SOCK_STREAM, 0); if (*sockp < 0) { - kret = errno; + kret = SOCKET_ERRNO; goto cleanup; } else kret = 0; @@ -411,6 +439,7 @@ kadm_contact_server(kcontext, realmp, sockp, local, remote) if (connect(*sockp, (struct sockaddr *) &in_remote, sizeof(in_remote)) < 0) { + kret = SOCKET_ERRNO; close(*sockp); *sockp = -1; continue; @@ -421,7 +450,7 @@ kadm_contact_server(kcontext, realmp, sockp, local, remote) if (getsockname(*sockp, (struct sockaddr *) &in_local, &addr_len) < 0) { - kret = errno; + kret = SOCKET_ERRNO; goto cleanup; } else { diff --git a/src/lib/kadm/adm_rw.c b/src/lib/kadm/adm_rw.c index 32d5f7aee..dda6e7d61 100644 --- a/src/lib/kadm/adm_rw.c +++ b/src/lib/kadm/adm_rw.c @@ -29,6 +29,12 @@ #include "k5-int.h" #include "adm_proto.h" +/* + * Local prototypes (needed or else the PC will pass fail). + */ +static void kadm_copyin_int32 PROTOTYPE((char *, krb5_int32 *)); +static void kadm_copyout_int32 PROTOTYPE((krb5_int32, char *)); + /* * Routines to [de]serialize integers. * @@ -290,7 +296,8 @@ krb5_read_adm_cmd(kcontext, sock, ctx, nargs, arglist) krb5_error_code ret; krb5_data msg_data; krb5_replay_data replay_data; - krb5_int32 ac_flags; + krb5_int32 ac_flags; + krb5_int32 len32; /* * First check that our auth context has the right flags in it. @@ -341,8 +348,9 @@ krb5_read_adm_cmd(kcontext, sock, ctx, nargs, arglist) /* First get the length of the reply component */ if (curr + sizeof(krb5_int32) - msg_data.data <= msg_data.length) { - kadm_copyin_int32(curr, - &xarglist[i].length); + + kadm_copyin_int32(curr, &len32); + xarglist[i].length = (int) len32; curr += sizeof(krb5_int32); /* Then get the memory for the actual data */ @@ -417,7 +425,8 @@ krb5_read_adm_reply(kcontext, sock, ctx, cmd_stat, ncomps, complist) krb5_error_code ret; krb5_data msg_data; krb5_replay_data replay_data; - krb5_int32 ac_flags; + krb5_int32 ac_flags; + krb5_int32 len32; /* * First check that our auth context has the right flags in it. @@ -470,8 +479,8 @@ krb5_read_adm_reply(kcontext, sock, ctx, cmd_stat, ncomps, complist) /* First get the length of the reply component */ if (curr + sizeof(krb5_int32) - msg_data.data <= msg_data.length) { - kadm_copyin_int32(curr, - &xcomplist[i].length); + kadm_copyin_int32(curr, &len32); + xcomplist[i].length = (int) len32; curr += sizeof(krb5_int32); /* Then get the memory for the actual data */ -- 2.26.2