From: Ezra Peisach Date: Tue, 26 Sep 2000 17:18:23 +0000 (+0000) Subject: * an_to_ln.c: Unsigned vs signed int fixes X-Git-Tag: krb5-1.3-alpha1~1879 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f4ae1b4362bc2b1bcf190e6ae1fc78d465d608fc;p=krb5.git * an_to_ln.c: Unsigned vs signed int fixes * t_std_conf.c: Declare local functions static, do not shadow sin() with local variable. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12680 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index afbfa4827..31cf7e25e 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,10 @@ +2000-09-26 Ezra Peisach + + * an_to_ln.c: Unsigned vs signed int fixes. + + * t_std_conf.c: Declare local functions static, do not shadow + sin() with local variable. + 2000-08-31 Jeffrey Altman * locate_kdc.c: krb5_locate_srv_dns() diff --git a/src/lib/krb5/os/an_to_ln.c b/src/lib/krb5/os/an_to_ln.c index 02e68fb04..c5e97fbe7 100644 --- a/src/lib/krb5/os/an_to_ln.c +++ b/src/lib/krb5/os/an_to_ln.c @@ -98,7 +98,7 @@ db_an_to_ln(context, dbname, aname, lnsize, lname) krb5_context context; char *dbname; krb5_const_principal aname; - const int lnsize; + const unsigned int lnsize; char *lname; { #if (!defined(_MSDOS) && !defined(_WIN32) && !defined(macintosh)) @@ -467,7 +467,7 @@ rule_an_to_ln(context, rule, aname, lnsize, lname) krb5_context context; char * rule; krb5_const_principal aname; - const int lnsize; + const unsigned int lnsize; char * lname; { krb5_error_code kret; @@ -515,7 +515,7 @@ rule_an_to_ln(context, rule, aname, lnsize, lname) ) { strncpy(cout, datap->data, - datap->length); + (unsigned) datap->length); cout += datap->length; *cout = '\0'; current++; @@ -597,12 +597,12 @@ static krb5_error_code default_an_to_ln(context, aname, lnsize, lname) krb5_context context; krb5_const_principal aname; - const int lnsize; + const unsigned int lnsize; char *lname; { krb5_error_code retval; char *def_realm; - int realm_length; + unsigned int realm_length; realm_length = krb5_princ_realm(context, aname)->length; @@ -654,10 +654,10 @@ default_an_to_ln(context, aname, lnsize, lname) */ krb5_error_code -krb5_aname_to_localname(context, aname, lnsize, lname) +krb5_aname_to_localname(context, aname, lnsize_in, lname) krb5_context context; krb5_const_principal aname; - const int lnsize; + const int lnsize_in; char *lname; { krb5_error_code kret; @@ -669,6 +669,12 @@ krb5_aname_to_localname(context, aname, lnsize, lname) int i, nvalid; char *cp; char *typep, *argp; + unsigned int lnsize; + + if (lnsize_in < 0) + return KRB5_CONFIG_NOTENUFSPACE; + + lnsize = lnsize_in; /* Unsigned */ /* * First get the default realm. diff --git a/src/lib/krb5/os/t_std_conf.c b/src/lib/krb5/os/t_std_conf.c index 3f49708c2..ab5058c0d 100644 --- a/src/lib/krb5/os/t_std_conf.c +++ b/src/lib/krb5/os/t_std_conf.c @@ -16,7 +16,7 @@ #include "os-proto.h" -void test_get_default_realm(ctx) +static void test_get_default_realm(ctx) krb5_context ctx; { char *realm; @@ -31,7 +31,7 @@ void test_get_default_realm(ctx) free(realm); } -void test_set_default_realm(ctx, realm) +static void test_set_default_realm(ctx, realm) krb5_context ctx; char *realm; { @@ -45,7 +45,7 @@ void test_set_default_realm(ctx, realm) printf("krb5_set_default_realm(%s)\n", realm); } -void test_get_default_ccname(ctx) +static void test_get_default_ccname(ctx) krb5_context ctx; { const char *ccname; @@ -57,7 +57,7 @@ void test_get_default_ccname(ctx) printf("krb5_cc_default_name() returned NULL\n"); } -void test_set_default_ccname(ctx, ccname) +static void test_set_default_ccname(ctx, ccname) krb5_context ctx; char *ccname; { @@ -71,7 +71,7 @@ void test_set_default_ccname(ctx, ccname) printf("krb5_set_default_ccname(%s)\n", ccname); } -void test_get_krbhst(ctx, realm) +static void test_get_krbhst(ctx, realm) krb5_context ctx; char *realm; { @@ -103,12 +103,12 @@ void test_get_krbhst(ctx, realm) printf("\n"); } -void test_locate_kdc(ctx, realm) +static void test_locate_kdc(ctx, realm) krb5_context ctx; char *realm; { struct sockaddr *addrs; - struct sockaddr_in *sin; + struct sockaddr_in *s_sin; int i, naddrs; int get_masters=0; krb5_data rlm; @@ -124,15 +124,15 @@ void test_locate_kdc(ctx, realm) } printf("krb_get_krbhst(%s) returned:", realm); for (i=0; i < naddrs; i++) { - sin = (struct sockaddr_in *) &addrs[i]; - printf(" %s/%d", inet_ntoa(sin->sin_addr), - ntohs(sin->sin_port)); + s_sin = (struct sockaddr_in *) &addrs[i]; + printf(" %s/%d", inet_ntoa(s_sin->sin_addr), + ntohs(s_sin->sin_port)); } free(addrs); printf("\n"); } -void test_get_host_realm(ctx, host) +static void test_get_host_realm(ctx, host) krb5_context ctx; char *host; { @@ -162,7 +162,7 @@ void test_get_host_realm(ctx, host) printf("\n"); } -void test_get_realm_domain(ctx, realm) +static void test_get_realm_domain(ctx, realm) krb5_context ctx; char *realm; { @@ -178,7 +178,7 @@ void test_get_realm_domain(ctx, realm) free(domain); } -void usage(progname) +static void usage(progname) char *progname; { fprintf(stderr, "%s: Usage: %s [-dc] [-k realm] [-r host] [-C ccname] [-D realm]\n",