aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2021-04-26 14:46:31 -0400
committerGreg Hudson <ghudson@mit.edu>2021-07-12 11:58:31 -0400
commitaed3e2deaa8b53efbc777394a52d1f25cdf1a649 (patch)
tree64bf7fcfa1abdb6c1c3277f77f2aafecdfd46742
parent8da1e0afb15cfc6f721677a84d00eeb4b51470bd (diff)
downloadkrb5-aed3e2deaa8b53efbc777394a52d1f25cdf1a649.zip
krb5-aed3e2deaa8b53efbc777394a52d1f25cdf1a649.tar.gz
krb5-aed3e2deaa8b53efbc777394a52d1f25cdf1a649.tar.bz2
Fix argument type errors on Windows
Fix three Windows-specific argument type errors, including a crash bug in the default replay cache type. Change the compiler flags to treat several argument type warnings as errors. The replay cache bug was reported by Thomas Wagner. (cherry picked from commit 65b21aee6ab5e7d0851302b98647261c15c71c96) ticket: 9005 version_fixed: 1.18.4
-rw-r--r--src/clients/kpasswd/kpasswd.c3
-rw-r--r--src/config/win-pre.in6
-rw-r--r--src/lib/krb5/rcache/rc_dfl.c2
-rw-r--r--src/util/support/dir_filenames.c2
4 files changed, 9 insertions, 4 deletions
diff --git a/src/clients/kpasswd/kpasswd.c b/src/clients/kpasswd/kpasswd.c
index 8dbe611..bf2a5bd 100644
--- a/src/clients/kpasswd/kpasswd.c
+++ b/src/clients/kpasswd/kpasswd.c
@@ -37,7 +37,8 @@ get_name_from_passwd_file(char *program_name, krb5_context context,
}
#else /* HAVE_PWD_H */
static void
-get_name_from_passwd_file(krb5_context context, krb5_principal *me)
+get_name_from_passwd_file(char *program_name, krb5_context context,
+ krb5_principal *me)
{
fprintf(stderr, _("Unable to identify user\n"));
exit(1);
diff --git a/src/config/win-pre.in b/src/config/win-pre.in
index a3fb46e..0e696e2 100644
--- a/src/config/win-pre.in
+++ b/src/config/win-pre.in
@@ -118,7 +118,11 @@ CC=cl
PDB_OPTS=-Fd$(OUTPRE)\ -FD
CPPFLAGS=-I$(top_srcdir)\include -I$(top_srcdir)\include\krb5 $(DNSFLAGS) -DWIN32_LEAN_AND_MEAN -DKRB5_DEPRECATED=1 -DKRB5_PRIVATE -D_CRT_SECURE_NO_DEPRECATE $(KFWFLAGS) $(TIME_T_FLAGS)
-CCOPTS=-nologo /EHsc /W3 $(PDB_OPTS) $(DLL_FILE_DEF)
+# Treat the following warnings as errors:
+# 4020: too many actual parameters
+# 4024: different types for formal and actual parameter
+# 4047: different levels of indirection
+CCOPTS=-nologo /EHsc /W3 /we4020 /we4024 /we4047 $(PDB_OPTS) $(DLL_FILE_DEF)
LOPTS=-nologo -incremental:no -manifest
!if ("$(BITS)" == "64" )
diff --git a/src/lib/krb5/rcache/rc_dfl.c b/src/lib/krb5/rcache/rc_dfl.c
index 1a82676..9c5182a 100644
--- a/src/lib/krb5/rcache/rc_dfl.c
+++ b/src/lib/krb5/rcache/rc_dfl.c
@@ -67,7 +67,7 @@ open_file(krb5_context context, int *fd_out)
return ret;
}
- *fd_out = open(O_CREAT | O_RDWR | O_BINARY, 0600);
+ *fd_out = open(fname, O_CREAT | O_RDWR | O_BINARY, 0600);
ret = (*fd_out < 0) ? errno : 0;
if (ret) {
k5_setmsg(context, ret, "%s (filename: %s)",
diff --git a/src/util/support/dir_filenames.c b/src/util/support/dir_filenames.c
index 9312b02..efcdc7f 100644
--- a/src/util/support/dir_filenames.c
+++ b/src/util/support/dir_filenames.c
@@ -87,7 +87,7 @@ k5_dir_filenames(const char *dirname, char ***fnames_out)
return ENOENT;
do {
- if (add_filename(&fnames, &n_fnames, &ffd.cFileName) != 0) {
+ if (add_filename(&fnames, &n_fnames, ffd.cFileName) != 0) {
k5_free_filenames(fnames);
FindClose(handle);
return ENOMEM;