From: Ezra Peisach Date: Fri, 15 Nov 2002 20:21:18 +0000 (+0000) Subject: * enc-proto.h, enc_des.c, encrypt.c: Unsigned/signed cleanups X-Git-Tag: krb5-1.3-alpha1~264 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a2dc9d551dc35ad2f38e8ae01ced7b467df304c6;p=krb5.git * enc-proto.h, enc_des.c, encrypt.c: Unsigned/signed cleanups * forward.c: Include unistd.h if present on machine. * misc-proto.h misc.c (auth_encrypt_user): Declare argument as const. * auth.c: Cast argument auth_encrypt_user. auth_gen_printsub() and auth_printsub() take unsigned int as buffer length. * auth.h, auth-proto.h, kerberos.c, kerberos5.c, spx.c: auth_gen_printsub(), auth_printsub(), kerberos4_printsub(), kerberos5_printsub(), spx_printsub() take unsigned int as length argument. * configure.in: Check for unistd.h git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15010 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/telnet/libtelnet/ChangeLog b/src/appl/telnet/libtelnet/ChangeLog index 663eda02d..add745afd 100644 --- a/src/appl/telnet/libtelnet/ChangeLog +++ b/src/appl/telnet/libtelnet/ChangeLog @@ -1,3 +1,22 @@ +2002-11-15 Ezra Peisach + + * enc-proto.h, enc_des.c, encrypt.c: Unsigned/signed cleanups. + + * forward.c: Include unistd.h if present on machine. + + * misc-proto.h misc.c (auth_encrypt_user): Declare argument as + const. + + * auth.c: Cast argument auth_encrypt_user. auth_gen_printsub() and + auth_printsub() take unsigned int as buffer length. + + * auth.h, auth-proto.h, kerberos.c, kerberos5.c, spx.c: + auth_gen_printsub(), auth_printsub(), kerberos4_printsub(), + kerberos5_printsub(), spx_printsub() take unsigned int as length + argument. + + * configure.in: Check for unistd.h + 2002-08-29 Ken Raeburn * Makefile.in: Revert $(S)=>/ change, for Windows support. diff --git a/src/appl/telnet/libtelnet/auth-proto.h b/src/appl/telnet/libtelnet/auth-proto.h index 17a6b7869..68cae7efc 100644 --- a/src/appl/telnet/libtelnet/auth-proto.h +++ b/src/appl/telnet/libtelnet/auth-proto.h @@ -70,7 +70,7 @@ void auth_finished (Authenticator *, int); int auth_wait (char *); int auth_must_encrypt (void); void auth_disable_name (char *); -void auth_gen_printsub (unsigned char *, int, unsigned char *, int); +void auth_gen_printsub (unsigned char *, int, unsigned char *, unsigned int); int getauthmask (char *, int *); @@ -82,7 +82,7 @@ int auth_status (void); void auth_name (unsigned char *, int); int auth_sendname (unsigned char *, int); void auth_debug (int); -void auth_printsub (unsigned char *, int, unsigned char *, int); +void auth_printsub (unsigned char *, int, unsigned char *, unsigned int); #ifdef KRB4 @@ -91,7 +91,7 @@ int kerberos4_send (Authenticator *); void kerberos4_is (Authenticator *, unsigned char *, int); void kerberos4_reply (Authenticator *, unsigned char *, int); int kerberos4_status (Authenticator *, char *, int); -void kerberos4_printsub (unsigned char *, int, unsigned char *, int); +void kerberos4_printsub (unsigned char *, int, unsigned char *, unsigned int); #endif #ifdef KRB5 @@ -100,7 +100,7 @@ int kerberos5_send (Authenticator *); void kerberos5_is (Authenticator *, unsigned char *, int); void kerberos5_reply (Authenticator *, unsigned char *, int); int kerberos5_status (Authenticator *, char *, int); -void kerberos5_printsub (unsigned char *, int, unsigned char *, int); +void kerberos5_printsub (unsigned char *, int, unsigned char *, unsigned int); void kerberos5_cleanup (void); #endif #endif diff --git a/src/appl/telnet/libtelnet/auth.c b/src/appl/telnet/libtelnet/auth.c index 0b709913f..9c1b0b0fc 100644 --- a/src/appl/telnet/libtelnet/auth.c +++ b/src/appl/telnet/libtelnet/auth.c @@ -518,7 +518,7 @@ auth_name(data, cnt) savename[cnt] = '\0'; /* Null terminate */ if (auth_debug_mode) printf(">>>%s: Got NAME [%s]\r\n", Name, savename); - auth_encrypt_user(savename); + auth_encrypt_user((const char *)savename); } int @@ -613,7 +613,8 @@ auth_debug(mode) void auth_printsub(data, cnt, buf, buflen) unsigned char *data, *buf; - int cnt, buflen; + int cnt; + unsigned int buflen; { Authenticator *ap; @@ -626,7 +627,8 @@ auth_printsub(data, cnt, buf, buflen) void auth_gen_printsub(data, cnt, buf, buflen) unsigned char *data, *buf; - int cnt, buflen; + int cnt; + unsigned int buflen; { register unsigned char *cp; unsigned char tbuf[16]; diff --git a/src/appl/telnet/libtelnet/auth.h b/src/appl/telnet/libtelnet/auth.h index 450c7ab7e..f9f31d8e7 100644 --- a/src/appl/telnet/libtelnet/auth.h +++ b/src/appl/telnet/libtelnet/auth.h @@ -73,7 +73,7 @@ typedef struct XauthP { void (*is) (struct XauthP *, unsigned char *, int); void (*reply) (struct XauthP *, unsigned char *, int); int (*status) (struct XauthP *, char *, int); - void (*printsub) (unsigned char *, int, unsigned char *, int); + void (*printsub) (unsigned char *, int, unsigned char *, unsigned int); } Authenticator; #include "auth-proto.h" diff --git a/src/appl/telnet/libtelnet/configure.in b/src/appl/telnet/libtelnet/configure.in index 207aa72f4..8f2434eaa 100644 --- a/src/appl/telnet/libtelnet/configure.in +++ b/src/appl/telnet/libtelnet/configure.in @@ -5,7 +5,7 @@ AC_PROG_ARCHIVE_ADD AC_PROG_RANLIB AC_REPLACE_FUNCS([strcasecmp strdup setsid strerror strftime getopt herror parsetos]) AC_CHECK_FUNCS(setenv unsetenv getenv gettosbyname cgetent) -AC_CHECK_HEADERS(stdlib.h string.h) +AC_CHECK_HEADERS(stdlib.h string.h unistd.h) if test $ac_cv_func_setenv = no || test $ac_cv_func_unsetenv = no \ || test $ac_cv_func_getenv = no; then SETENVSRC=setenv.c diff --git a/src/appl/telnet/libtelnet/enc-proto.h b/src/appl/telnet/libtelnet/enc-proto.h index 4361e4a40..eed7db66b 100644 --- a/src/appl/telnet/libtelnet/enc-proto.h +++ b/src/appl/telnet/libtelnet/enc-proto.h @@ -90,7 +90,7 @@ int EncryptStopOutput (void); int EncryptStatus (void); int EncryptVerbose (int); void encrypt_send_support (void); -void encrypt_send_keyid (int, unsigned char *, int, int); +void encrypt_send_keyid (int, unsigned char *, unsigned int, int); int net_write (unsigned char *, int); void encrypt_gen_printsub (unsigned char *, int, unsigned char *, int); void encrypt_printsub (unsigned char *, int, unsigned char *, int); diff --git a/src/appl/telnet/libtelnet/enc_des.c b/src/appl/telnet/libtelnet/enc_des.c index 7d1346856..c399d22c7 100644 --- a/src/appl/telnet/libtelnet/enc_des.c +++ b/src/appl/telnet/libtelnet/enc_des.c @@ -584,7 +584,7 @@ cfb64_printsub(data, cnt, buf, buflen) unsigned char *data, *buf; int cnt, buflen; { - fb64_printsub(data, cnt, buf, buflen, "CFB64"); + fb64_printsub(data, cnt, buf, buflen, (unsigned char *) "CFB64"); } void @@ -592,7 +592,7 @@ ofb64_printsub(data, cnt, buf, buflen) unsigned char *data, *buf; int cnt, buflen; { - fb64_printsub(data, cnt, buf, buflen, "OFB64"); + fb64_printsub(data, cnt, buf, buflen, (unsigned char *) "OFB64"); } void diff --git a/src/appl/telnet/libtelnet/encrypt.c b/src/appl/telnet/libtelnet/encrypt.c index d4cc1a4e7..e99f346c4 100644 --- a/src/appl/telnet/libtelnet/encrypt.c +++ b/src/appl/telnet/libtelnet/encrypt.c @@ -730,26 +730,26 @@ encrypt_request_start(data, cnt) static unsigned char str_keyid[(MAXKEYLEN*2)+5] = { IAC, SB, TELOPT_ENCRYPT }; -static void encrypt_keyid (struct key_info *kp, unsigned char *, int); +static void encrypt_keyid (struct key_info *kp, unsigned char *, unsigned int); void encrypt_enc_keyid(keyid, len) unsigned char *keyid; int len; { - encrypt_keyid(&ki[1], keyid, len); + encrypt_keyid(&ki[1], keyid, (unsigned) len); } void encrypt_dec_keyid(keyid, len) unsigned char *keyid; int len; { - encrypt_keyid(&ki[0], keyid, len); + encrypt_keyid(&ki[0], keyid, (unsigned) len); } static void encrypt_keyid(kp, keyid, len) struct key_info *kp; unsigned char *keyid; - int len; + unsigned int len; { Encryptions *ep; int dir = kp->dir; @@ -769,7 +769,8 @@ static void encrypt_keyid(kp, keyid, len) if (ep->keyid) (void)(*ep->keyid)(dir, kp->keyid, &kp->keylen); - } else if ((len != kp->keylen) || (memcmp(keyid, kp->keyid, len) != 0)) { + } else if ((len != kp->keylen) || + (memcmp(keyid, kp->keyid, len) != 0)) { /* * Length or contents are different */ @@ -785,14 +786,14 @@ static void encrypt_keyid(kp, keyid, len) return; } - encrypt_send_keyid(dir, kp->keyid, kp->keylen, 0); + encrypt_send_keyid(dir, kp->keyid, (unsigned) kp->keylen, 0); } void encrypt_send_keyid(dir, keyid, keylen, saveit) int dir; unsigned char *keyid; - int keylen; + unsigned int keylen; int saveit; { unsigned char *strp; diff --git a/src/appl/telnet/libtelnet/forward.c b/src/appl/telnet/libtelnet/forward.c index 01c341c07..09d558906 100644 --- a/src/appl/telnet/libtelnet/forward.c +++ b/src/appl/telnet/libtelnet/forward.c @@ -26,6 +26,9 @@ #if defined(KERBEROS) || defined(KRB5) #include #include +#ifdef HAVE_UNISTD_H +#include +#endif #include "krb5.h" #include diff --git a/src/appl/telnet/libtelnet/kerberos.c b/src/appl/telnet/libtelnet/kerberos.c index 2f92ed1dd..3a722064a 100644 --- a/src/appl/telnet/libtelnet/kerberos.c +++ b/src/appl/telnet/libtelnet/kerberos.c @@ -200,7 +200,7 @@ kerberos4_init(ap, server) } char dst_realm_buf[REALM_SZ], *dest_realm = NULL; -int dst_realm_sz = REALM_SZ; +unsigned int dst_realm_sz = REALM_SZ; int kerberos4_send(ap) @@ -627,7 +627,8 @@ kerberos4_status(ap, kname, level) void kerberos4_printsub(data, cnt, buf, buflen) unsigned char *data, *buf; - int cnt, buflen; + int cnt; + unsigned int buflen; { char lbuf[32]; register int i; diff --git a/src/appl/telnet/libtelnet/kerberos5.c b/src/appl/telnet/libtelnet/kerberos5.c index 486ef7f52..3a1c8f24e 100644 --- a/src/appl/telnet/libtelnet/kerberos5.c +++ b/src/appl/telnet/libtelnet/kerberos5.c @@ -361,7 +361,8 @@ kerberos5_send(ap) return(0); } - if (!auth_sendname(UserNameRequested, strlen(UserNameRequested))) { + if (!auth_sendname((unsigned char *) UserNameRequested, + (int) strlen(UserNameRequested))) { if (auth_debug_mode) printf("telnet: Not enough room for user name\r\n"); return(0); @@ -744,7 +745,8 @@ kerberos5_status(ap, name, level) void kerberos5_printsub(data, cnt, buf, buflen) unsigned char *data, *buf; - int cnt, buflen; + int cnt; + unsigned int buflen; { char lbuf[32]; register int i; diff --git a/src/appl/telnet/libtelnet/misc-proto.h b/src/appl/telnet/libtelnet/misc-proto.h index 519f6a134..66e9dd7bf 100644 --- a/src/appl/telnet/libtelnet/misc-proto.h +++ b/src/appl/telnet/libtelnet/misc-proto.h @@ -60,7 +60,7 @@ #define __MISC_PROTO__ void auth_encrypt_init (char *, char *, char *, int); -void auth_encrypt_user (char *); +void auth_encrypt_user (const char *); void auth_encrypt_connect (int); void printd (const unsigned char *, int); diff --git a/src/appl/telnet/libtelnet/misc.c b/src/appl/telnet/libtelnet/misc.c index 0dd22c27f..86e14cb1b 100644 --- a/src/appl/telnet/libtelnet/misc.c +++ b/src/appl/telnet/libtelnet/misc.c @@ -67,7 +67,7 @@ auth_encrypt_init(local, remote, name, server) void auth_encrypt_user(name) - char *name; + const char *name; { extern char *strdup(); diff --git a/src/appl/telnet/libtelnet/setenv.c b/src/appl/telnet/libtelnet/setenv.c index 3f55822fd..941b816ca 100644 --- a/src/appl/telnet/libtelnet/setenv.c +++ b/src/appl/telnet/libtelnet/setenv.c @@ -61,6 +61,7 @@ setenv(name, value, rewrite) extern char **environ; static int alloced; /* if allocated space before */ register char *c; + const char *c2; int l_value, offset; if (*value == '=') /* no `=' in value */ @@ -95,9 +96,9 @@ setenv(name, value, rewrite) environ[cnt + 1] = NULL; offset = cnt; } - for (c = (char *)name; *c && *c != '='; ++c); /* no `=' in name */ + for (c2 = name; *c2 && *c2 != '='; ++c2); /* no `=' in name */ if (!(environ[offset] = /* name + `=' + value */ - malloc((size_t)((int)(c - name) + l_value + 2)))) + malloc((size_t)((int)(c2 - name) + l_value + 2)))) return (-1); for (c = environ[offset]; (*c = *name++) && *c != '='; ++c); for (*c++ = '='; (*c++ = *value++);); @@ -153,7 +154,7 @@ __findenv(name, offset) int *offset; { extern char **environ; - register int len; + register unsigned int len; register const char *np; register char **p, *c; diff --git a/src/appl/telnet/libtelnet/spx.c b/src/appl/telnet/libtelnet/spx.c index 7285d0dd3..b3e0e9dfc 100644 --- a/src/appl/telnet/libtelnet/spx.c +++ b/src/appl/telnet/libtelnet/spx.c @@ -531,7 +531,8 @@ spx_status(ap, name, level) void spx_printsub(data, cnt, buf, buflen) unsigned char *data, *buf; - int cnt, buflen; + int cnt; + unsigned int buflen; { char lbuf[32]; register int i;