From: Ezra Peisach Date: Fri, 1 Jun 2001 18:43:25 +0000 (+0000) Subject: * g_krbrlm.c: Remove unused static variable krb_conf X-Git-Tag: krb5-1.3-alpha1~1498 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ac31fbb3e0bf91b21cb15c4123b7e4c87a6cb9bf;p=krb5.git * g_krbrlm.c: Remove unused static variable krb_conf * g_svc_in_tkt.c (krb_svc_init, krb_svc_init_preauth): Declare as returning int. * gethostname.c: Include unistd.h for gethostname() prototype. * getst.c: Include unistd.h for read() prototype. * in_tkt.c (in_tkt): Cast arguments to debugging printf to int from uid_t to match format statement. * kname_parse.c: Declare k_isname() and k_isinst() as returning int. Cleanup assigments in conditionals. * kuserok.c (kuserok): Cleanup assignment in conditional. * log.c (krb_set_logfile): Declare function as void. * klog.c (kset_logfile): Likewise. * pkt_clen.c (pkt_clen): Declare as returning int. * kntoln.c (krb_kntoln): Likewise. * fgetst.c (fgetst): Likewise. * rd_req.c: Declare local variable only if KRB_CRYPT_DEBUG defined. * recvauth.c: Include stdlib.h and unistd.h for read() and atoi() prototypes. * send_to_kdc.c: Include unistd.h for close() prototype. * sendauth.c (krb_sendauth): Clean up assignment in conditional. * tkt_string.c (tkt_string): Likewise git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13256 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb4/ChangeLog b/src/lib/krb4/ChangeLog index 862df0ce9..3360c8691 100644 --- a/src/lib/krb4/ChangeLog +++ b/src/lib/krb4/ChangeLog @@ -1,3 +1,40 @@ +2001-06-01 Ezra Peisach + + * g_krbrlm.c: Remove unused static variable krb_conf. + + * g_svc_in_tkt.c (krb_svc_init, krb_svc_init_preauth): Declare as + returning int. + + * gethostname.c: Include unistd.h for gethostname() prototype. + + * getst.c: Include unistd.h for read() prototype. + + * in_tkt.c (in_tkt): Cast arguments to debugging printf to int + from uid_t to match format statement. + + * kname_parse.c: Declare k_isname() and k_isinst() as returning + int. Cleanup assigments in conditionals. + + * kuserok.c (kuserok): Cleanup assignment in conditional. + + * log.c (krb_set_logfile): Declare function as void. + * klog.c (kset_logfile): Likewise. + + * pkt_clen.c (pkt_clen): Declare as returning int. + * kntoln.c (krb_kntoln): Likewise. + * fgetst.c (fgetst): Likewise. + + * rd_req.c: Declare local variable only if KRB_CRYPT_DEBUG defined. + + * recvauth.c: Include stdlib.h and unistd.h for read() and atoi() + prototypes. + + * send_to_kdc.c: Include unistd.h for close() prototype. + + * sendauth.c (krb_sendauth): Clean up assignment in conditional. + + * tkt_string.c (tkt_string): Likewise + 2001-04-13 Ken Raeburn * Makefile.in (EHDRDIR): Install into kerberosIV subdirectory. diff --git a/src/lib/krb4/fgetst.c b/src/lib/krb4/fgetst.c index b5d8aa5cb..7cca51631 100644 --- a/src/lib/krb4/fgetst.c +++ b/src/lib/krb4/fgetst.c @@ -19,12 +19,13 @@ * returns the number of characters read, including the null terminator. */ +int fgetst(f, s, n) FILE *f; register char *s; int n; { - register count = n; + register int count = n; int ch; /* NOT char; otherwise you don't see EOF */ while ((ch = getc(f)) != EOF && ch && --count) { diff --git a/src/lib/krb4/g_krbrlm.c b/src/lib/krb4/g_krbrlm.c index c75023176..3c381aace 100644 --- a/src/lib/krb4/g_krbrlm.c +++ b/src/lib/krb4/g_krbrlm.c @@ -28,9 +28,6 @@ * krb_get_krbhst(). This will also look in KRB_FB_CONF is * ATHENA_CONF_FALLBACK is defined. */ -static char *krb_conf = KRB_CONF; - - KRB5_DLLIMP int KRB5_CALLCONV krb_get_lrealm(r,n) char *r; diff --git a/src/lib/krb4/g_svc_in_tkt.c b/src/lib/krb4/g_svc_in_tkt.c index 0a8f499c9..afee27ab9 100644 --- a/src/lib/krb4/g_svc_in_tkt.c +++ b/src/lib/krb4/g_svc_in_tkt.c @@ -83,6 +83,7 @@ static int stub_key(user,instance,realm,passwd,key) return 0; } +int krb_get_svc_in_tkt_preauth(user, instance, realm, service, sinstance, life, srvtab) char *user, *instance, *realm, *service, *sinstance; int life; @@ -105,6 +106,7 @@ krb_get_svc_in_tkt_preauth(user, instance, realm, service, sinstance, life, srvt /* DEC's dss-kerberos adds krb_svc_init; simple enough */ +int krb_svc_init(user,instance,realm,lifetime,srvtab_file,tkt_file) char *user; char *instance; @@ -121,6 +123,7 @@ krb_svc_init(user,instance,realm,lifetime,srvtab_file,tkt_file) } +int krb_svc_init_preauth(user,instance,realm,lifetime,srvtab_file,tkt_file) char *user; char *instance; diff --git a/src/lib/krb4/g_tkt_svc.c b/src/lib/krb4/g_tkt_svc.c index cbe74a2f2..5460c5943 100644 --- a/src/lib/krb4/g_tkt_svc.c +++ b/src/lib/krb4/g_tkt_svc.c @@ -27,7 +27,7 @@ ParseFullName(name, instance, realm, fname) if (err) return err; if (!*name) return KNAME_FMT; /* null names are not OK */ if (!*realm) { - if (err = krb_get_lrealm (realm, 1)) + if ((err = krb_get_lrealm (realm, 1))) return err; if (!*realm) return KNAME_FMT; /* FIXME -- should give better error */ } diff --git a/src/lib/krb4/gethostname.c b/src/lib/krb4/gethostname.c index cac202e3f..6360a353d 100644 --- a/src/lib/krb4/gethostname.c +++ b/src/lib/krb4/gethostname.c @@ -10,6 +10,9 @@ #include "mit-copyright.h" #define DEFINE_SOCKADDR #include "krb.h" +#ifdef HAVE_UNISTD_H +#include +#endif #ifndef GETHOSTNAME #define GETHOSTNAME gethostname /* A rather simple default */ @@ -22,6 +25,7 @@ * interface is identical to BSD gethostname(2).) */ +int k_gethostname(name, namelen) char *name; int namelen; diff --git a/src/lib/krb4/getst.c b/src/lib/krb4/getst.c index 53c5e27bf..763f89f7e 100644 --- a/src/lib/krb4/getst.c +++ b/src/lib/krb4/getst.c @@ -9,6 +9,9 @@ #include "mit-copyright.h" #include "krb.h" +#ifdef HAVE_UNISTD_H +#include +#endif /* * getst() takes a file descriptor, a string and a count. It reads @@ -20,6 +23,7 @@ * the null terminator. */ +int getst(fd, s, n) int fd; register char *s; diff --git a/src/lib/krb4/in_tkt.c b/src/lib/krb4/in_tkt.c index 3fc6c558e..3b53ebe85 100644 --- a/src/lib/krb4/in_tkt.c +++ b/src/lib/krb4/in_tkt.c @@ -156,7 +156,7 @@ in_tkt(pname,pinst) return(KFAILURE); } else if (krb_debug) - printf("swapped UID's %d and %d\n",metoo,me); + printf("swapped UID's %d and %d\n",(int) metoo, (int) me); } /* Set umask to ensure that we have write access on the created ticket file. */ @@ -171,7 +171,7 @@ in_tkt(pname,pinst) return(KFAILURE); } else if (krb_debug) - printf("swapped UID's %d and %d\n",me,metoo); + printf("swapped UID's %d and %d\n", (int) me, (int) metoo); } if (tktfile < 0) { if (krb_debug) diff --git a/src/lib/krb4/klog.c b/src/lib/krb4/klog.c index def5a59cc..5805a94d2 100644 --- a/src/lib/krb4/klog.c +++ b/src/lib/krb4/klog.c @@ -22,7 +22,6 @@ #include static char *log_name = KRBLOG; -static int is_open; static char logtxt[1000]; /* @@ -102,9 +101,9 @@ char * klog(type,format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0) * the logfile defaults to KRBLOG, defined in "krb.h". */ +void kset_logfile(filename) char *filename; { log_name = filename; - is_open = 0; } diff --git a/src/lib/krb4/kname_parse.c b/src/lib/krb4/kname_parse.c index a8bfbe45d..2c310c687 100644 --- a/src/lib/krb4/kname_parse.c +++ b/src/lib/krb4/kname_parse.c @@ -93,7 +93,7 @@ kname_parse(np, ip, rp, fullname) return KNAME_FMT; (void) strcpy(buf, fullname); - while (c = *rnext++) { + while ((c = *rnext++)) { if (backslash) { *wnext++ = c; backslash = 0; @@ -174,6 +174,7 @@ kname_parse(np, ip, rp, fullname) * Kerberos name; returns 0 if it's not. */ +int k_isname(s) char *s; { @@ -184,7 +185,7 @@ k_isname(s) return 0; if (strlen(s) > ANAME_SZ - 1) return 0; - while(c = *s++) { + while((c = *s++)) { if (backslash) { backslash = 0; continue; @@ -212,6 +213,7 @@ k_isname(s) * We now allow periods in instance names -- they are unambiguous. */ +int k_isinst(s) char *s; { @@ -220,7 +222,7 @@ k_isinst(s) if (strlen(s) > INST_SZ - 1) return 0; - while(c = *s++) { + while((c = *s++)) { if (backslash) { backslash = 0; continue; @@ -242,6 +244,7 @@ k_isinst(s) * Kerberos realm; returns 0 if it's not. */ +int k_isrealm(s) char *s; { @@ -252,7 +255,7 @@ k_isrealm(s) return 0; if (strlen(s) > REALM_SZ - 1) return 0; - while(c = *s++) { + while((c = *s++)) { if (backslash) { backslash = 0; continue; diff --git a/src/lib/krb4/kntoln.c b/src/lib/krb4/kntoln.c index f86599cce..ca48381b9 100644 --- a/src/lib/krb4/kntoln.c +++ b/src/lib/krb4/kntoln.c @@ -42,6 +42,7 @@ * things will happen. */ #define MAX_USERNAME 10 +int krb_kntoln(ad,lname) AUTH_DAT *ad; char *lname; diff --git a/src/lib/krb4/kuserok.c b/src/lib/krb4/kuserok.c index 20587cb5b..40a3bd86d 100644 --- a/src/lib/krb4/kuserok.c +++ b/src/lib/krb4/kuserok.c @@ -211,7 +211,7 @@ kuserok(kdata, luser) linebuf[BUFSIZ-1] = '\0'; newline = NULL; /* nuke the newline if it exists */ - if (newline = strchr(linebuf, '\n')) + if ((newline = strchr(linebuf, '\n'))) *newline = '\0'; /* Default the fields (default realm is filled in later) */ diff --git a/src/lib/krb4/log.c b/src/lib/krb4/log.c index 573481362..07e67288d 100644 --- a/src/lib/krb4/log.c +++ b/src/lib/krb4/log.c @@ -28,7 +28,9 @@ #include static char *log_name = KRBLOG; +#if 0 static is_open; +#endif /* * This file contains three logging routines: set_logfile() @@ -84,11 +86,14 @@ void krb_log(format,a1,a2,a3,a4,a5,a6,a7,a8,a9,a0) * the logfile defaults to KRBLOG, defined in "krb.h". */ +void krb_set_logfile(filename) char *filename; { log_name = filename; +#if 0 is_open = 0; +#endif } #if 0 diff --git a/src/lib/krb4/pkt_clen.c b/src/lib/krb4/pkt_clen.c index 14e6962ab..52763a4dd 100644 --- a/src/lib/krb4/pkt_clen.c +++ b/src/lib/krb4/pkt_clen.c @@ -24,6 +24,7 @@ int swap_bytes=0; * ciphertext length out of the packet. */ +int pkt_clen(pkt) KTEXT pkt; { diff --git a/src/lib/krb4/rd_req.c b/src/lib/krb4/rd_req.c index abcf7da43..89be3b5fe 100644 --- a/src/lib/krb4/rd_req.c +++ b/src/lib/krb4/rd_req.c @@ -191,7 +191,9 @@ krb_rd_req(authent, service, instance, from_addr, ad, fn) register unsigned char *ptr; /* For stepping through */ unsigned KRB4_32 t_local; /* Local time on our side of the protocol */ KRB4_32 delta_t; /* Time in authenticator minus local time */ +#ifdef KRB_CRYPT_DEBUG KRB4_32 tkt_age; /* Age of ticket */ +#endif int le; /* is little endian? */ int mutual; /* Mutual authentication requested? */ int t; /* msg type */ @@ -432,8 +434,8 @@ krb_rd_req(authent, service, instance, from_addr, ad, fn) /* Now check for expiration of ticket */ ret = RD_AP_NYV; - tkt_age = t_local - ad->time_sec; #ifdef KRB_CRYPT_DEBUG + tkt_age = t_local - ad->time_sec; if (krb_ap_req_debug) log("Time: %d Issue Date: %d Diff: %d Life %x", time_secs, ad->time_sec, tkt_age, ad->life); diff --git a/src/lib/krb4/recvauth.c b/src/lib/krb4/recvauth.c index 9230b32c0..d78d00eaf 100644 --- a/src/lib/krb4/recvauth.c +++ b/src/lib/krb4/recvauth.c @@ -14,6 +14,12 @@ #include #include #include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif #define KRB_SENDAUTH_VERS "AUTHV0.1" /* MUST be KRB_SENDAUTH_VLEN diff --git a/src/lib/krb4/send_to_kdc.c b/src/lib/krb4/send_to_kdc.c index c7a1f97d2..8e6a19fad 100644 --- a/src/lib/krb4/send_to_kdc.c +++ b/src/lib/krb4/send_to_kdc.c @@ -18,6 +18,9 @@ #ifdef HAVE_SYS_SELECT_H #include #endif +#ifdef HAVE_UNISTD_H +#include +#endif #define S_AD_SZ sizeof(struct sockaddr_in) @@ -67,6 +70,7 @@ static char *prog = "send_to_kdc"; * after several retries */ +int send_to_kdc(pkt,rpkt,realm) KTEXT pkt; KTEXT rpkt; @@ -87,7 +91,6 @@ send_to_kdc(pkt,rpkt,realm) char *scol; int krb_udp_port = 0; int krbsec_udp_port = 0; - int default_port; /* * If "realm" is non-null, use that, otherwise get the @@ -112,7 +115,8 @@ send_to_kdc(pkt,rpkt,realm) /* The first time, decide what port to use for the KDC. */ if (cached_krb_udp_port == 0) { register struct servent FAR *sp; - if (sp = getservbyname("kerberos","udp")) + sp = getservbyname("kerberos","udp"); + if (sp) cached_krb_udp_port = sp->s_port; else cached_krb_udp_port = htons(KERBEROS_PORT); /* kerberos/udp */ @@ -123,7 +127,8 @@ send_to_kdc(pkt,rpkt,realm) if (cached_krbsec_udp_port == 0 && cached_krb_udp_port != htons(KERBEROS_PORT)) { register struct servent FAR *sp; - if (sp = getservbyname("kerberos-sec","udp")) + sp = getservbyname("kerberos-sec","udp"); + if (sp) cached_krbsec_udp_port = sp->s_port; else cached_krbsec_udp_port = htons(KERBEROS_PORT); /* kerberos/udp */ @@ -166,7 +171,6 @@ send_to_kdc(pkt,rpkt,realm) /* End of kludge (FIXME) for FTP Software WinSock stack. */ no_host = 1; - default_port = 0; /* get an initial allocation */ n_hosts = 0; for (i = 1; krb_get_krbhst(krbhst, lrealm, i) == KSUCCESS; ++i) { @@ -192,7 +196,6 @@ send_to_kdc(pkt,rpkt,realm) } else { krb_udp_port = cached_krb_udp_port; krbsec_udp_port = cached_krbsec_udp_port; - default_port = 1; } farkedhost = gethostbyname(krbhst); #ifdef DEBUG diff --git a/src/lib/krb4/sendauth.c b/src/lib/krb4/sendauth.c index 76c470c20..a4777cff2 100644 --- a/src/lib/krb4/sendauth.c +++ b/src/lib/krb4/sendauth.c @@ -233,7 +233,8 @@ krb_sendauth(options, fd, ticket, service, inst, realm, checksum, if (options & KOPT_DO_MUTUAL) { /* get credentials so we have service session key for decryption below */ - if (cc = krb_get_cred(service, srv_inst, realm, cred)) + cc = krb_get_cred(service, srv_inst, realm, cred); + if (cc) return(cc); /* Get the reply out of the socket. */ diff --git a/src/lib/krb4/tkt_string.c b/src/lib/krb4/tkt_string.c index db1230b90..d6c8c3825 100644 --- a/src/lib/krb4/tkt_string.c +++ b/src/lib/krb4/tkt_string.c @@ -48,14 +48,15 @@ char *tkt_string() uid_t getuid(); if (!*krb_ticket_string) { - if (env = getenv("KRBTKFILE")) { + env = getenv("KRBTKFILE"); + if (env) { (void) strncpy(krb_ticket_string, env, sizeof(krb_ticket_string)-1); krb_ticket_string[sizeof(krb_ticket_string)-1] = '\0'; } else { /* 32 bits of signed integer will always fit in 11 characters (including the sign), so no need to worry about overflow */ - (void) sprintf(krb_ticket_string, "%s%d",TKT_ROOT,getuid()); + (void) sprintf(krb_ticket_string, "%s%d",TKT_ROOT,(int) getuid()); } } return krb_ticket_string;