]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix argument type errors on Windows
authorGreg Hudson <ghudson@mit.edu>
Mon, 26 Apr 2021 18:46:31 +0000 (14:46 -0400)
committerGreg Hudson <ghudson@mit.edu>
Mon, 12 Jul 2021 15:58:16 +0000 (11:58 -0400)
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.19.2

src/clients/kpasswd/kpasswd.c
src/config/win-pre.in
src/lib/krb5/rcache/rc_dfl.c
src/util/support/dir_filenames.c

index 8dbe611c4fa34eb1fffeb3999f17b7ed5f6629e9..bf2a5bd4a13ef667a020ff09e3d65833a456ec6e 100644 (file)
@@ -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);
index a3fb46ed40effb195dea02d25da607f275168fcf..0e696e29988d5cbe5d72614df6cac94f6b2ed687 100644 (file)
@@ -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" )
index 1a826763b78e37fb0fd8989ea8191e528c791737..9c5182adfcbf751a4c5e0ecd9291cda29dd69c0c 100644 (file)
@@ -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)",
index 9312b02389b130861bbe263fc933c6efd97611b2..efcdc7f61de3db014e2b156ee07df2c2583feef3 100644 (file)
@@ -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;