From: Ken Raeburn Date: Tue, 3 Jun 2008 00:13:25 +0000 (+0000) Subject: Fix various minor format-string issues X-Git-Tag: krb5-1.7-alpha1~665 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6fe8f27be1d27d9bd6c5fc87c912e4265807a281;p=krb5.git Fix various minor format-string issues git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20356 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/gssftp/ftp/ftp.c b/src/appl/gssftp/ftp/ftp.c index 02fb4baeb..227ca5efc 100644 --- a/src/appl/gssftp/ftp/ftp.c +++ b/src/appl/gssftp/ftp/ftp.c @@ -475,9 +475,9 @@ static int secure_command(char* cmd) "GSSAPI didn't encrypt message"); } else { if (debug) - fprintf(stderr, "sealed (%s) %d bytes\n", + fprintf(stderr, "sealed (%s) %lu bytes\n", clevel==PROT_P?"ENC":"MIC", - out_buf.length); + (unsigned long) out_buf.length); length=out_buf.length; memcpy(out, out_buf.value, out_buf.length); gss_release_buffer(&min_stat, &out_buf); diff --git a/src/kadmin/dbutil/dump.c b/src/kadmin/dbutil/dump.c index 5c627d30c..44675a6b2 100644 --- a/src/kadmin/dbutil/dump.c +++ b/src/kadmin/dbutil/dump.c @@ -1,7 +1,7 @@ /* * kadmin/dbutil/dump.c * - * Copyright 1990,1991,2001,2006 by the Massachusetts Institute of Technology. + * Copyright 1990,1991,2001,2006,2008 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -597,8 +597,9 @@ dump_k5beta_iterator(ptr, entry) * First put out strings representing the length of the variable * length data in this record, then the name and the primary key type. */ - fprintf(arg->ofile, "%d\t%d\t%d\t%d\t%d\t%d\t%s\t%d\t", strlen(name), - strlen(mod_name), + fprintf(arg->ofile, "%lu\t%lu\t%d\t%d\t%d\t%d\t%s\t%d\t", + (unsigned long) strlen(name), + (unsigned long) strlen(mod_name), (krb5_int32) pkey->key_data_length[0], (krb5_int32) akey->key_data_length[0], (krb5_int32) pkey->key_data_length[1], @@ -748,9 +749,9 @@ dump_k5beta6_iterator_ext(ptr, entry, kadm) if (counter + skip == entry->n_tl_data) { /* Pound out header */ - fprintf(arg->ofile, "%d\t%d\t%d\t%d\t%d\t%s\t", + fprintf(arg->ofile, "%d\t%lu\t%d\t%d\t%d\t%s\t", (int) entry->len, - strlen(name), + (unsigned long) strlen(name), counter, (int) entry->n_key_data, (int) entry->e_length, diff --git a/src/kadmin/server/kadm_rpc_svc.c b/src/kadmin/server/kadm_rpc_svc.c index cd1f0d2f1..733602052 100644 --- a/src/kadmin/server/kadm_rpc_svc.c +++ b/src/kadmin/server/kadm_rpc_svc.c @@ -301,7 +301,7 @@ check_rpcsec_auth(struct svc_req *rqstp) fail_princ: if (!success) { krb5_klog_syslog(LOG_ERR, "bad service principal %.*s%s", - slen, gss_str.value, sdots); + (int) slen, (char *) gss_str.value, sdots); } gss_release_buffer(&min_stat, &gss_str); krb5_free_principal(kctx, princ); diff --git a/src/kadmin/server/ovsec_kadmd.c b/src/kadmin/server/ovsec_kadmd.c index e5e4e307f..659ebfba3 100644 --- a/src/kadmin/server/ovsec_kadmd.c +++ b/src/kadmin/server/ovsec_kadmd.c @@ -337,7 +337,7 @@ int main(int argc, char *argv[]) if ((params.mask & REQUIRED_PARAMS) != REQUIRED_PARAMS) { krb5_klog_syslog(LOG_ERR, "%s: Missing required configuration values " - "while initializing, aborting", whoami, + "(%lx) while initializing, aborting", whoami, (params.mask & REQUIRED_PARAMS) ^ REQUIRED_PARAMS); fprintf(stderr, "%s: Missing required configuration values " "(%lx) while initializing, aborting\n", whoami, @@ -406,7 +406,7 @@ int main(int argc, char *argv[]) if (setsockopt(schpw, SOL_SOCKET, SO_REUSEADDR, (char *) &allowed, sizeof(allowed)) < 0) { const char *e_txt = krb5_get_error_message (context, ret); - krb5_klog_syslog(LOG_ERR, "main", + krb5_klog_syslog(LOG_ERR, "cannot set SO_REUSEADDR on simple chpw socket: %s", e_txt); fprintf(stderr, @@ -1029,13 +1029,13 @@ void log_badverf(gss_name_t client_name, gss_name_t server_name, if (procname != NULL) krb5_klog_syslog(LOG_NOTICE, "WARNING! Forged/garbled request: %s, " "claimed client = %.*s%s, server = %.*s%s, addr = %s", - procname, clen, client.value, cdots, - slen, server.value, sdots, a); + procname, (int) clen, (char *) client.value, cdots, + (int) slen, (char *) server.value, sdots, a); else krb5_klog_syslog(LOG_NOTICE, "WARNING! Forged/garbled request: %d, " "claimed client = %.*s%s, server = %.*s%s, addr = %s", - proc, clen, client.value, cdots, - slen, server.value, sdots, a); + proc, (int) clen, (char *) client.value, cdots, + (int) slen, (char *) server.value, sdots, a); (void) gss_release_buffer(&minor, &client); (void) gss_release_buffer(&minor, &server); @@ -1125,12 +1125,14 @@ void log_badauth_display_status_1(char *m, OM_uint32 code, int type, log_badauth_display_status_1(m, minor_stat, GSS_C_MECH_CODE, 1); } else - krb5_klog_syslog(LOG_ERR, "GSS-API authentication error %s: " - "recursive failure!", msg); + krb5_klog_syslog(LOG_ERR, "GSS-API authentication error %.*s: " + "recursive failure!", (int) msg.length, + (char *) msg.value); return; } - krb5_klog_syslog(LOG_NOTICE, "%s %s", m, (char *)msg.value); + krb5_klog_syslog(LOG_NOTICE, "%s %.*s", m, (int)msg.length, + (char *)msg.value); (void) gss_release_buffer(&minor_stat, &msg); if (!msg_ctx) diff --git a/src/kadmin/server/schpw.c b/src/kadmin/server/schpw.c index 3d1d47955..9e1113a59 100644 --- a/src/kadmin/server/schpw.c +++ b/src/kadmin/server/schpw.c @@ -264,7 +264,7 @@ process_chpw_request(context, server_handle, realm, s, keytab, sockin, trunc_name(&clen, &cdots); krb5_klog_syslog(LOG_NOTICE, "chpw request from %s for %.*s%s: %s", inet_ntoa(((struct sockaddr_in *)&remote_addr)->sin_addr), - clen, clientstr, cdots, + (int) clen, clientstr, cdots, ret ? krb5_get_error_message (context, ret) : "success"); krb5_free_unparsed_name(context, clientstr); diff --git a/src/kadmin/testing/util/tcl_kadm5.c b/src/kadmin/testing/util/tcl_kadm5.c index 21c641848..ebd3037a3 100644 --- a/src/kadmin/testing/util/tcl_kadm5.c +++ b/src/kadmin/testing/util/tcl_kadm5.c @@ -418,7 +418,7 @@ static Tcl_DString *unparse_err(kadm5_ret_t code) case ENOENT: code_string = "ENOENT"; break; default: - fprintf(stderr, "**** CODE %d (%s) ***\n", code, + fprintf(stderr, "**** CODE %ld (%s) ***\n", (long) code, error_message (code)); code_string = "UNKNOWN"; break; @@ -956,8 +956,8 @@ static int parse_tl_data(Tcl_Interp *interp, const char *list, tl->tl_data_length = tmp; if (tl->tl_data_length != strlen(argv1[2])) { sprintf(interp->result, "specified length %d does not " - "match length %d of string \"%s\"", tmp, - strlen(argv1[2]), argv1[2]); + "match length %lu of string \"%s\"", tmp, + (unsigned long) strlen(argv1[2]), argv1[2]); retcode = TCL_ERROR; goto finished; } diff --git a/src/kadmin/testing/util/tcl_ovsec_kadm.c b/src/kadmin/testing/util/tcl_ovsec_kadm.c index cf732fc4a..a64c5603f 100644 --- a/src/kadmin/testing/util/tcl_ovsec_kadm.c +++ b/src/kadmin/testing/util/tcl_ovsec_kadm.c @@ -378,7 +378,7 @@ static Tcl_DString *unparse_err(ovsec_kadm_ret_t code) case EINVAL: code_string = "EINVAL"; break; case ENOENT: code_string = "ENOENT"; break; default: - fprintf(stderr, "**** CODE %d (%s) ***\n", code, + fprintf(stderr, "**** CODE %ld (%s) ***\n", (long) code, error_message (code)); code_string = "UNKNOWN"; break;