Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
We turn on a few extra warnings and fix the fallout that occurs when building with --enable-developer. Note that we get different warnings on different machines and so this will be a work in progress. So far, we have built on NetBSD/amd64 5.99.64 (which uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3). Notably, we fixed 1. a lot of missing structure initialisers, 2. unchecked return values for functions that glibc marks as __attribute__((warn-unused-result)), 3. made minor modifications to slc and asn1_compile which can generate code which generates warnings, and 4. a few stragglers here and there. We turned off the extended warnings for many programs in appl/ as they are nearing the end of their useful lifetime, e.g. rsh, rcp, popper, ftp and telnet. Interestingly, glibc's strncmp() macro needed to be worked around whereas the function calls did not. We have not yet tried this on 32 bit platforms, so there will be a few more warnings when we do.
This commit is contained in:
appl
afsutil
ftp
gssmask
kf
kx
login
otp
popper
push
rcp
rsh
su
telnet
test
base
cf
kadmin
kcm
kdc
kpasswd
kuser
lib
asn1
com_err
gssapi
hdb
hx509
ipc
kadm5
kafs
krb5
addr_families.cconfig_file.ccrypto-null.cderived-key-test.cinit_creds_pw.ckcm.ckeytab_any.ckeytab_file.ckeytab_keyfile.ckeytab_memory.cn-fold-test.cpkinit.creplay.csalt-aes.csalt-arcfour.csalt-des.csalt-des3.cscache.cstring-to-key-test.ctest_cc.cverify_krb5_conf.c
otp
roken
sl
wind
29
kadmin/get.c
29
kadmin/get.c
@@ -66,7 +66,7 @@ static struct field_name {
|
||||
{ "aliases", KADM5_TL_DATA, KRB5_TL_ALIASES, 0, "Aliases", "Aliases", 0 },
|
||||
{ "hist-kvno-diff-clnt", KADM5_TL_DATA, KRB5_TL_HIST_KVNO_DIFF_CLNT, 0, "Clnt hist keys", "Historic keys allowed for client", 0 },
|
||||
{ "hist-kvno-diff-svc", KADM5_TL_DATA, KRB5_TL_HIST_KVNO_DIFF_SVC, 0, "Svc hist keys", "Historic keys allowed for service", 0 },
|
||||
{ NULL }
|
||||
{ NULL, 0, 0, 0, NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
struct field_info {
|
||||
@@ -125,12 +125,17 @@ format_keytype(krb5_key_data *k, krb5_salt *def_salt, char *buf, size_t buf_len)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
char *s;
|
||||
int aret;
|
||||
|
||||
buf[0] = '\0';
|
||||
ret = krb5_enctype_to_string (context,
|
||||
k->key_data_type[0],
|
||||
&s);
|
||||
if (ret)
|
||||
asprintf (&s, "unknown(%d)", k->key_data_type[0]);
|
||||
if (ret) {
|
||||
aret = asprintf (&s, "unknown(%d)", k->key_data_type[0]);
|
||||
if (aret == -1)
|
||||
return; /* Nothing to do here, we have no way to pass the err */
|
||||
}
|
||||
strlcpy(buf, s, buf_len);
|
||||
free(s);
|
||||
|
||||
@@ -140,21 +145,29 @@ format_keytype(krb5_key_data *k, krb5_salt *def_salt, char *buf, size_t buf_len)
|
||||
k->key_data_type[0],
|
||||
k->key_data_type[1],
|
||||
&s);
|
||||
if (ret)
|
||||
asprintf (&s, "unknown(%d)", k->key_data_type[1]);
|
||||
if (ret) {
|
||||
aret = asprintf (&s, "unknown(%d)", k->key_data_type[1]);
|
||||
if (aret == -1)
|
||||
return; /* Again, nothing else to do... */
|
||||
}
|
||||
strlcat(buf, s, buf_len);
|
||||
free(s);
|
||||
|
||||
aret = 0;
|
||||
if (cmp_salt(def_salt, k) == 0)
|
||||
s = strdup("");
|
||||
else if(k->key_data_length[1] == 0)
|
||||
s = strdup("()");
|
||||
else
|
||||
asprintf (&s, "(%.*s)", k->key_data_length[1],
|
||||
(char *)k->key_data_contents[1]);
|
||||
aret = asprintf (&s, "(%.*s)", k->key_data_length[1],
|
||||
(char *)k->key_data_contents[1]);
|
||||
if (aret == -1 || s == NULL)
|
||||
return; /* Again, nothing else we can do... */
|
||||
strlcat(buf, s, buf_len);
|
||||
free(s);
|
||||
asprintf (&s, "[%d]", k->key_data_kvno);
|
||||
aret = asprintf (&s, "[%d]", k->key_data_kvno);
|
||||
if (aret == -1)
|
||||
return;
|
||||
strlcat(buf, ")", buf_len);
|
||||
|
||||
strlcat(buf, s, buf_len);
|
||||
|
Reference in New Issue
Block a user