[33531] in Kerberos

home help back first fref pref prev next nref lref last post

Win32 bug in krb5_rc_io_destroy

daemon@ATHENA.MIT.EDU (checker)
Fri Jul 1 08:04:20 2011

From: checker <checker@d6.com>
Date: Thu, 30 Jun 2011 23:31:40 -0700 (PDT)
Message-ID: <77063e02-8764-405f-a613-95955d8bc582@q14g2000prh.googlegroups.com>
Mime-Version: 1.0
X-Complaints-To: groups-abuse@google.com
Complaints-To: groups-abuse@google.com
To: kerberos@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: kerberos-bounces@mit.edu


Hi, the unlink(d->fn) at the top of krb5_rc_io_destroy fails on Win32
because the file was opened without FILE_SHARE_DELETE (since it's
opened through _open there's actually no way to set that flag without
marking it a temporary file), so I patched it to close the file
first.  I assume this is a bug?  I also assume no one noticed this
since most of the code calls krb5_rc_close rather than
krb5_rc_destroy?  I found it while getting sim_client.c to work with
my build.

Should I file a bug, or is this enough (the bug list says to post here
first)?

Thanks,
Chris

=== modified file 'src/lib/krb5/rcache/rc_io.c'
--- src/lib/krb5/rcache/rc_io.c	2011-04-09 08:50:00 +0000
+++ src/lib/krb5/rcache/rc_io.c	2011-07-01 06:18:12 +0000
@@ -481,6 +481,13 @@
 krb5_error_code
 krb5_rc_io_destroy(krb5_context context, krb5_rc_iostuff *d)
 {
+#if defined(_WIN32)
+    // the file isn't opened with FILE_SHARE_DELETE so we need to
close it first
+    if(close(d->fd) == -1) {
+        return KRB5_RC_IO_UNKNOWN;
+    }
+    d->fd = -1;
+#endif
     if (unlink(d->fn) == -1)
         switch(errno)
         {



________________________________________________
Kerberos mailing list           Kerberos@mit.edu
https://mailman.mit.edu/mailman/listinfo/kerberos

home help back first fref pref prev next nref lref last post