Warning fixes from Christos Zoulas

- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
This commit is contained in:
Love Hornquist Astrand
2011-04-29 20:25:05 -07:00
parent 66c15e7caf
commit f5f9014c90
156 changed files with 1178 additions and 1078 deletions

View File

@@ -60,7 +60,7 @@ parse_ticket_flags(krb5_context context,
memset(&ff, 0, sizeof(ff));
ff.proxy = 1;
if (parse_flags("proxy", asn1_TicketFlags_units(), 0) == TicketFlags2int(ff))
if ((size_t)parse_flags("proxy", asn1_TicketFlags_units(), 0) == TicketFlags2int(ff))
ret_flags->i = flags;
else
ret_flags->i = bitswap32(flags);

View File

@@ -40,8 +40,8 @@ static int version_flag;
static int help_flag;
static struct getargs args[] = {
{ "version", 0, arg_flag, &version_flag },
{ "help", 0, arg_flag, &help_flag }
{ "version", 0, arg_flag, &version_flag, NULL, NULL },
{ "help", 0, arg_flag, &help_flag, NULL, NULL }
};
static void

View File

@@ -47,7 +47,7 @@ struct getargs args[] = {
{ "credential", 0, arg_string, rk_UNCONST(&credential),
"remove one credential", "principal" },
{ "cache", 'c', arg_string, rk_UNCONST(&cache), "cache to destroy", "cache" },
{ "all", 'A', arg_flag, &all_flag, "destroy all caches" },
{ "all", 'A', arg_flag, &all_flag, "destroy all caches", NULL },
#ifndef NO_AFS
{ "unlog", 0, arg_negative_flag, &unlog_flag,
"do not destroy tokens", NULL },

View File

@@ -436,6 +436,7 @@ ntlm_server_init(struct ntlm_server_init_options *opt,
krb5_data challenge, opaque;
struct ntlm_buf data;
char *s;
static char zero2[] = "\x00\x00";
memset(&type2, 0, sizeof(type2));
@@ -471,7 +472,7 @@ ntlm_server_init(struct ntlm_server_init_options *opt,
krb5_err(context, 1, ret, "krb5_ntlm_init_get_flags");
krb5_ntlm_init_get_targetname(context, ntlm, &type2.targetname);
type2.targetinfo.data = "\x00\x00";
type2.targetinfo.data = zero2;
type2.targetinfo.length = 2;
ret = heim_ntlm_encode_type2(&type2, &data);

View File

@@ -53,17 +53,17 @@ struct getargs args[] = {
{ "delegation-credential-cache",0,arg_string, &delegation_cred_str,
NP_("where to find the ticket use for delegation", ""), "cache"},
{ "canonicalize", 0, arg_flag, &canonicalize_flag,
NP_("canonicalize the principal", "") },
NP_("canonicalize the principal", ""), NULL },
{ "forwardable", 0, arg_flag, &forwardable_flag,
NP_("forwardable ticket requested", "")},
{ "transit-check", 0, arg_negative_flag, &transit_flag },
NP_("forwardable ticket requested", ""), NULL},
{ "transit-check", 0, arg_negative_flag, &transit_flag, NULL, NULL },
{ "enctype", 'e', arg_string, &etype_str,
NP_("encryption type to use", ""), "enctype"},
{ "impersonate", 0, arg_string, &impersonate_str,
NP_("client to impersonate", ""), "principal"},
{ "name-type", 0, arg_string, &nametype_str },
{ "version", 0, arg_flag, &version_flag },
{ "help", 0, arg_flag, &help_flag }
{ "name-type", 0, arg_string, &nametype_str, NULL, NULL },
{ "version", 0, arg_flag, &version_flag, NULL, NULL },
{ "help", 0, arg_flag, &help_flag, NULL, NULL }
};
static void

View File

@@ -44,7 +44,7 @@ static char *ccache_str = NULL;
static char *ticket_flags_str = NULL;
static TicketFlags ticket_flags;
static char *keytab_file = NULL;
static char *enc_type = "des-cbc-md5";
static const char *enc_type = "des-cbc-md5";
static int expiration_time = 3600;
static struct getarg_strings client_addresses;
static int version_flag = 0;
@@ -268,21 +268,21 @@ struct getargs args[] = {
{ "ccache", 0, arg_string, &ccache_str,
"name of kerberos 5 credential cache", "cache-name"},
{ "server", 's', arg_string, &server_principal_str,
"name of server principal" },
"name of server principal", NULL },
{ "client", 'c', arg_string, &client_principal_str,
"name of client principal" },
"name of client principal", NULL },
{ "keytab", 'k', arg_string, &keytab_file,
"name of keytab file" },
"name of keytab file", NULL },
{ "krb5", '5', arg_flag, &use_krb5,
"create a kerberos 5 ticket"},
"create a kerberos 5 ticket", NULL },
{ "expire-time", 'e', arg_integer, &expiration_time,
"lifetime of ticket in seconds" },
"lifetime of ticket in seconds", NULL },
{ "client-addresses", 'a', arg_strings, &client_addresses,
"addresses of client" },
"addresses of client", NULL },
{ "enc-type", 't', arg_string, &enc_type,
"encryption type" },
"encryption type", NULL },
{ "ticket-flags", 'f', arg_string, &ticket_flags_str,
"ticket flags for krb5 ticket" },
"ticket flags for krb5 ticket", NULL },
{ "version", 0, arg_flag, &version_flag, "Print version",
NULL },
{ "help", 0, arg_flag, &help_flag, NULL,
@@ -302,7 +302,7 @@ usage (int ret)
int
main (int argc, char **argv)
{
int optind = 0;
int optidx = 0;
krb5_error_code ret;
krb5_context context;
krb5_keytab kt;
@@ -313,23 +313,23 @@ main (int argc, char **argv)
if (ret)
errx(1, "krb5_init_context failed: %u", ret);
if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
&optind))
usage (1);
if (getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &optidx))
usage(1);
if (help_flag)
usage (0);
usage(0);
if (version_flag) {
print_version(NULL);
return 0;
}
setup_env (context, &kt);
setup_env(context, &kt);
if (use_krb5)
create_krb5_tickets (context, kt);
create_krb5_tickets(context, kt);
krb5_kt_close(context, kt);
krb5_kt_close (context, kt);
return 0;
}

View File

@@ -96,31 +96,31 @@ static struct getargs args[] = {
* 9:
*/
{ "afslog", 0 , arg_flag, &do_afslog,
NP_("obtain afs tokens", "") },
NP_("obtain afs tokens", ""), NULL },
{ "cache", 'c', arg_string, &cred_cache,
NP_("credentials cache", ""), "cachename" },
{ "forwardable", 0, arg_negative_flag, &forwardable_flag,
NP_("get tickets not forwardable", "")},
NP_("get tickets not forwardable", ""), NULL },
{ NULL, 'f', arg_flag, &forwardable_flag,
NP_("get forwardable tickets", "")},
NP_("get forwardable tickets", ""), NULL },
{ "keytab", 't', arg_string, &keytab_str,
NP_("keytab to use", ""), "keytabname" },
{ "lifetime", 'l', arg_string, &lifetime,
NP_("lifetime of tickets", ""), "time"},
NP_("lifetime of tickets", ""), "time" },
{ "proxiable", 'p', arg_flag, &proxiable_flag,
NP_("get proxiable tickets", "") },
NP_("get proxiable tickets", ""), NULL },
{ "renew", 'R', arg_flag, &renew_flag,
NP_("renew TGT", "") },
NP_("renew TGT", ""), NULL },
{ "renewable", 0, arg_flag, &renewable_flag,
NP_("get renewable tickets", "") },
NP_("get renewable tickets", ""), NULL },
{ "renewable-life", 'r', arg_string, &renew_life,
NP_("renewable lifetime of tickets", ""), "time" },
@@ -132,40 +132,40 @@ static struct getargs args[] = {
NP_("when ticket gets valid", ""), "time" },
{ "use-keytab", 'k', arg_flag, &use_keytab,
NP_("get key from keytab", "") },
NP_("get key from keytab", ""), NULL },
{ "validate", 'v', arg_flag, &validate_flag,
NP_("validate TGT", "") },
NP_("validate TGT", ""), NULL },
{ "enctypes", 'e', arg_strings, &etype_str,
NP_("encryption types to use", ""), "enctypes" },
{ "fcache-version", 0, arg_integer, &fcache_version,
NP_("file cache version to create", "") },
NP_("file cache version to create", ""), NULL },
{ "addresses", 'A', arg_negative_flag, &addrs_flag,
NP_("request a ticket with no addresses", "") },
NP_("request a ticket with no addresses", ""), NULL },
{ "extra-addresses",'a', arg_strings, &extra_addresses,
NP_("include these extra addresses", ""), "addresses" },
{ "anonymous", 0, arg_flag, &anonymous_flag,
NP_("request an anonymous ticket", "") },
NP_("request an anonymous ticket", ""), NULL },
{ "request-pac", 0, arg_flag, &pac_flag,
NP_("request a Windows PAC", "") },
NP_("request a Windows PAC", ""), NULL },
{ "password-file", 0, arg_string, &password_file,
NP_("read the password from a file", "") },
NP_("read the password from a file", ""), NULL },
{ "canonicalize",0, arg_flag, &canonicalize_flag,
NP_("canonicalize client principal", "") },
NP_("canonicalize client principal", ""), NULL },
{ "enterprise",0, arg_flag, &enterprise_flag,
NP_("parse principal as a KRB5-NT-ENTERPRISE name", "") },
NP_("parse principal as a KRB5-NT-ENTERPRISE name", ""), NULL },
#ifdef PKINIT
{ "pk-enterprise", 0, arg_flag, &pk_enterprise_flag,
NP_("use enterprise name from certificate", "") },
NP_("use enterprise name from certificate", ""), NULL },
{ "pk-user", 'C', arg_string, &pk_user_id,
NP_("principal's public/private/certificate identifier", ""), "id" },
@@ -174,7 +174,7 @@ static struct getargs args[] = {
NP_("directory with CA certificates", ""), "directory" },
{ "pk-use-enckey", 0, arg_flag, &pk_use_enckey,
NP_("Use RSA encrypted reply (instead of DH)", "") },
NP_("Use RSA encrypted reply (instead of DH)", ""), NULL },
#endif
#ifndef NO_NTLM
{ "ntlm-domain", 0, arg_string, &ntlm_domain,
@@ -182,19 +182,19 @@ static struct getargs args[] = {
#endif
{ "change-default", 0, arg_negative_flag, &switch_cache_flags,
NP_("switch the default cache to the new credentials cache", "") },
NP_("switch the default cache to the new credentials cache", ""), NULL },
{ "ok-as-delegate", 0, arg_flag, &ok_as_delegate_flag,
NP_("honor ok-as-delegate on tickets", "") },
NP_("honor ok-as-delegate on tickets", ""), NULL },
{ "use-referrals", 0, arg_flag, &use_referrals_flag,
NP_("only use referrals, no dns canalisation", "") },
NP_("only use referrals, no dns canalisation", ""), NULL },
{ "windows", 0, arg_flag, &windows_flag,
NP_("get windows behavior", "") },
NP_("get windows behavior", ""), NULL },
{ "version", 0, arg_flag, &version_flag },
{ "help", 0, arg_flag, &help_flag }
{ "version", 0, arg_flag, &version_flag, NULL, NULL },
{ "help", 0, arg_flag, &help_flag, NULL, NULL }
};
static void
@@ -357,7 +357,7 @@ get_new_tickets(krb5_context context,
char passwd[256];
krb5_deltat start_time = 0;
krb5_deltat renew = 0;
char *renewstr = NULL;
const char *renewstr = NULL;
krb5_enctype *enctype = NULL;
krb5_ccache tempccache;
#ifndef NO_NTLM

View File

@@ -124,7 +124,7 @@ print_cred(krb5_context context, krb5_creds *cred, rtbl_t ct, int do_flags)
static void
print_cred_verbose(krb5_context context, krb5_creds *cred)
{
int j;
size_t j;
char *str;
krb5_error_code ret;
krb5_timestamp sec;

View File

@@ -35,11 +35,11 @@
#include "kcc-commands.h"
#ifdef HAVE_READLINE
char *readline(char *prompt);
char *readline(const char *prompt);
#else
static char *
readline(char *prompt)
readline(const char *prompt)
{
char buf[BUFSIZ];
printf ("%s", prompt);