From 97a711343b226b2e0e377e38ea08e0d38b3b7887 Mon Sep 17 00:00:00 2001 From: Keith Vetter Date: Fri, 26 May 1995 01:01:34 +0000 Subject: [PATCH] First pass to make the new kadm stuff compile cleanly on the PC. No test for correctness yet. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5880 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kadm/ChangeLog | 11 +++++++++++ src/lib/kadm/Makefile.in | 22 +++++++++++++--------- src/lib/kadm/adm_conn.c | 4 +++- src/lib/kadm/adm_kt_enc.c | 8 ++++---- src/lib/kadm/adm_kw_dec.c | 4 ++-- src/lib/kadm/adm_kw_enc.c | 8 ++++---- src/lib/kadm/adm_rw.c | 12 ++++++------ 7 files changed, 43 insertions(+), 26 deletions(-) diff --git a/src/lib/kadm/ChangeLog b/src/lib/kadm/ChangeLog index f41ee3fe5..441a77ed8 100644 --- a/src/lib/kadm/ChangeLog +++ b/src/lib/kadm/ChangeLog @@ -1,3 +1,14 @@ +Thu May 25 17:49:06 1995 Keith Vetter (keithv@fusion.com) + + First pass to make the code compile cleanly on the PC. + * Makefile.in: made to work on the PC. + * adm_conn.c: used atoi instead of sscanf since it can't be + used in a windows DLL. Why not? Ask Microsoft. + * adm_kt_e.c, adm_kw_e.c, adm_rw.c: made the explicit the + cast to a char when pulling out bytes from an int. + * adm_kw_d.c: size_t != off_t on the PC. Fixed the equation. + * adm_rw.c: two parameters were declared as int but prototyped + as krb5_int32. Tue May 16 13:58:30 EDT 1995 Paul Park (pjpark@mit.edu) * configure.in - Check for srand48, srand and srandom along with diff --git a/src/lib/kadm/Makefile.in b/src/lib/kadm/Makefile.in index a3e23c62d..b86bd691b 100644 --- a/src/lib/kadm/Makefile.in +++ b/src/lib/kadm/Makefile.in @@ -1,14 +1,16 @@ CFLAGS = $(CCOPTS) $(DEFS) LDFLAGS = -g -all:: $(OBJS) +##DOSBUILDTOP = ..\.. +##DOSLIBNAME=kadm.lib +##DOS!include $(BUILDTOP)\config\windows.in -OBJS= adm_conn.o \ - adm_kw_dec.o \ - adm_kw_enc.o \ - adm_kt_dec.o \ - adm_kt_enc.o \ - adm_rw.o +OBJS= adm_conn.$(OBJEXT) \ + adm_kw_dec.$(OBJEXT) \ + adm_kw_enc.$(OBJEXT) \ + adm_kt_dec.$(OBJEXT) \ + adm_kt_enc.$(OBJEXT) \ + adm_rw.$(OBJEXT) SRCS= $(srcdir)/adm_conn.c \ $(srcdir)/adm_kw_dec.c \ @@ -17,7 +19,9 @@ SRCS= $(srcdir)/adm_conn.c \ $(srcdir)/adm_kt_enc.c \ $(srcdir)/adm_rw.c -libkadm.a: ${OBJS} +all:: $(OBJS) + +libkadm.a: $(OBJS) $(RM) $@ $(ARADD) $@ $(OBJS) $(RANLIB) $@ @@ -30,7 +34,7 @@ install:: libkadm.a $(RANLIB) $(DESTDIR)$(KRB5_LIBDIR)/libkadm.a clean:: - $(RM) libkadm.a + $(RM) libkadm.$(LIBEXT) # # t_dbentry diff --git a/src/lib/kadm/adm_conn.c b/src/lib/kadm/adm_conn.c index 15651af57..c3979a03d 100644 --- a/src/lib/kadm/adm_conn.c +++ b/src/lib/kadm/adm_conn.c @@ -288,7 +288,9 @@ kadm_contact_server(kcontext, realmp, sockp, local, remote) if (cport) { *cport = '\0'; cport++; - if (sscanf(cport, "%d", &pport) != 1) { + + pport = atoi (cport); + if (pport == 0) { kret = KRB5_CONFIG_BADFORMAT; goto cleanup; } diff --git a/src/lib/kadm/adm_kt_enc.c b/src/lib/kadm/adm_kt_enc.c index 187071934..c63012361 100644 --- a/src/lib/kadm/adm_kt_enc.c +++ b/src/lib/kadm/adm_kt_enc.c @@ -72,13 +72,13 @@ krb5_adm_ktent_to_proto(kcontext, ktentp, ncompp, complistp) (char *) malloc(sizeof(krb5_ui_4))) { clist[KRB5_ADM_KT_TIMESTAMP].length = sizeof(krb5_ui_4); clist[KRB5_ADM_KT_TIMESTAMP].data[0] = - (ktentp->timestamp >> 24) & 0xff; + (char) ((ktentp->timestamp >> 24) & 0xff); clist[KRB5_ADM_KT_TIMESTAMP].data[1] = - (ktentp->timestamp >> 16) & 0xff; + (char) ((ktentp->timestamp >> 16) & 0xff); clist[KRB5_ADM_KT_TIMESTAMP].data[2] = - (ktentp->timestamp >> 8) & 0xff; + (char) ((ktentp->timestamp >> 8) & 0xff); clist[KRB5_ADM_KT_TIMESTAMP].data[3] = - ktentp->timestamp & 0xff; + (char) (ktentp->timestamp & 0xff); nents++; } else { diff --git a/src/lib/kadm/adm_kw_dec.c b/src/lib/kadm/adm_kw_dec.c index d66f61516..0fd53829b 100644 --- a/src/lib/kadm/adm_kw_dec.c +++ b/src/lib/kadm/adm_kw_dec.c @@ -106,7 +106,7 @@ decode_kw_string(dataentp, keyword, stringp) kret = ENOENT; if ((valueoff = keyword_value(dataentp, keyword, 1)) >= 0) { kret = ENOMEM; - len2copy = dataentp->length - valueoff; + len2copy = (size_t) ((off_t) dataentp->length - valueoff); *stringp = (char *) malloc(len2copy+1); if (*stringp) { strncpy(*stringp, &dataentp->data[valueoff], len2copy); @@ -134,7 +134,7 @@ decode_kw_integer(dataentp, keyword, uintp) kret = ENOENT; if ((voff = keyword_value(dataentp, keyword, 1)) >= 0) { kret = EINVAL; - len2copy = dataentp->length - voff; + len2copy = (size_t) ((off_t) dataentp->length - voff); if (len2copy == sizeof(krb5_ui_4)) { *uintp = (((krb5_int32) ((unsigned char) dataentp->data[voff]) << 24) + diff --git a/src/lib/kadm/adm_kw_enc.c b/src/lib/kadm/adm_kw_enc.c index 9e26f12a6..7a6304a87 100644 --- a/src/lib/kadm/adm_kw_enc.c +++ b/src/lib/kadm/adm_kw_enc.c @@ -99,10 +99,10 @@ format_kw_integer(datap, kwordp, val) if (datap->data) { datap->length = strlen(fbuffer); strcpy(datap->data, fbuffer); - datap->data[datap->length] = (val >> 24) & 0xff; - datap->data[datap->length+1] = (val >> 16) & 0xff; - datap->data[datap->length+2] = (val >> 8) & 0xff; - datap->data[datap->length+3] = val & 0xff; + datap->data[datap->length] = (char) ((val >> 24) & 0xff); + datap->data[datap->length+1] = (char) ((val >> 16) & 0xff); + datap->data[datap->length+2] = (char) ((val >> 8) & 0xff); + datap->data[datap->length+3] = (char) (val & 0xff); datap->length += sizeof(krb5_ui_4); retval = 0; } diff --git a/src/lib/kadm/adm_rw.c b/src/lib/kadm/adm_rw.c index ca35be55f..fc2db1741 100644 --- a/src/lib/kadm/adm_rw.c +++ b/src/lib/kadm/adm_rw.c @@ -53,10 +53,10 @@ kadm_copyout_int32(outint, cp) krb5_int32 outint; char *cp; { - cp[0] = (outint >> 24) & 0xff; - cp[1] = (outint >> 16) & 0xff; - cp[2] = (outint >> 8) & 0xff; - cp[3] = outint & 0xff; + cp[0] = (char) ((outint >> 24) & 0xff); + cp[1] = (char) ((outint >> 16) & 0xff); + cp[2] = (char) ((outint >> 8) & 0xff); + cp[3] = (char) (outint & 0xff); } /* @@ -95,7 +95,7 @@ krb5_send_adm_cmd(kcontext, sock, ctx, nargs, arglist) krb5_context kcontext; /* Context handle (In ) */ krb5_pointer sock; /* Socket to write to (In ) */ krb5_auth_context *ctx; /* Auth context (In ) */ - int nargs; /* Number of arguments (In ) */ + krb5_int32 nargs; /* Number of arguments (In ) */ krb5_data *arglist; /* Components to write (In ) */ { int writebufsize; @@ -189,7 +189,7 @@ krb5_send_adm_reply(kcontext, sock, ctx, cmd_stat, ncomps, complist) krb5_pointer sock; /* Socket to write to (In ) */ krb5_auth_context *ctx; /* Auth context (In ) */ krb5_int32 cmd_stat; /* Command status (In ) */ - int ncomps; /* Number of arguments (In ) */ + krb5_int32 ncomps; /* Number of arguments (In ) */ krb5_data *complist; /* Components to write (In ) */ { int writebufsize; -- 2.26.2