RT RT/krbdev.mit.edu: Ticket #5777 keytab iteration + search don't mix Signed in as guest.
[Logout]

[Home] [Search] [Configuration]

[Display] [History] [Basics] [Dates] [People] [Links] [Jumbo]

 
 

 The Basics  
Id
5777
Status
resolved
Worked
0 min
Priority
0/0
Queue
krb5
 

 Keyword Selections  
Component
  • krb5-libs
Version_reported
  • 1.6.3
Version_Fixed
  • 1.6.4
Target_Version
  • 1.6.4
Tags
  • pullup
 

 Relationships  
Depends on:
Depended on by:
Parents:
Children:

Refers to:
Referred to by:
  • 5811: (Nobody) memory keytab doesn't handle iterator + add/remove [new]
 
 Dates  
Created: Wed Sep 26 14:48:42 2007
Starts: Not set
Started: Tue Oct 9 00:04:04 2007
Last Contact: Wed Nov 28 19:53:41 2007
Due: Not set
Updated: Fri Jun 6 18:31:01 2008 by guest
 

 People  
Owner
 raeburn
Requestors
 raeburn@mit.edu
Cc
 
AdminCc
 
 

 More about Ken Raeburn  
Comments about this user:
No comment entered about this user
This user's 25 highest priority tickets:
 

History   Display mode: [Brief headers] [Full headers]
      Wed Sep 26 14:48:42 2007  raeburn - Ticket created    
     
Subject: keytab iteration + search don't mix

The iteration interface in the kt_file code assumes that the file handle is kept
open, and an
advisory lock is kept on the file.  The get_entry interface opens and closes the
file, with an
advisory lock for the duration of the call.  If a get_next call is made after
get_entry, it will
attempt to use a bogus file handle.

It should be possible to use get_entry while an iterator is active (in the same
thread or
different threads), without losing the advisory lock.  It should also be possible to
use two
iterators at once.

To make things more fun, both of those interfaces open the file read-only; the add
and
remove calls open it for write access.  So, calling add or remove while an iterator
is active
means getting write access while we've already got a read-access handle on it.  And
remember, under POSIX, closing any handle on the file means releasing any advisory
locks we
have on the file (not just via that handle).  So the obvious workaround of using
multiple
keytab objects referring to the same file will likely cause incorrect handling of the
advisory
locks because of this.

Possibly add/remove should be disallowed while an iterator is active, because of the
conflicting locking requirements?  Or, the iterator could be invalidated.

On the other hand, do we need to maintain the read lock while between reading
entries, or is
it sufficient to use lock-read-unlock sequences?  (The add action works by appending;
remove works by overwriting with a dummy value, all zeros aside from the length
indicator.
So I think mixing iterators and add/remove should be safe.)


Download (untitled) 1.5k
      Fri Sep 28 12:52:12 2007  raeburn - Correspondence added    
     
[raeburn - Wed Sep 26 14:48:42 2007]:

>   (The add action
> works by appending;
> remove works by overwriting with a dummy value, all zeros aside from
> the length indicator.
> So I think mixing iterators and add/remove should be safe.)

Maybe not quite so safe...  In the current implementation, if one process is using an
iterator,
and another is adding and deleting entries, the iterating process will see a list of
entries that
matches the file content the whole time the iterator is active.  If we allow
additions and
removals in between iterator calls, the iteration output may not match what the
actual file
content was at any point in time.

So, if we want to preserve that property, additions and removals can't happen while
an
iterator is active.  In different threads, we can block the add/remove call, or make
it return an
error.  In the single-threaded case, we would have to always return an error for
add/remove
calls.


Download (untitled) 941b
      Tue Oct  9 00:04:04 2007  raeburn - Status changed from new to resolved    
      Tue Oct  9 00:04:05 2007  raeburn - Correspondence added    
     
From: raeburn@mit.edu
Subject: SVN Commit

counter.  In get_entry, if the file was already open, rewind it to
just after the version number, and don't close it when done.  Don't
allow add or remove calls if any iterator is active.

t_keytab.c: Test mixing two iterators with get_entry calls.

Commit By: raeburn



Revision: 20109
Changed Files:
U   trunk/src/lib/krb5/keytab/kt_file.c
U   trunk/src/lib/krb5/keytab/t_keytab.c


Download (untitled) 384b
      Wed Oct 10 14:27:42 2007  raeburn - Correspondence added    
     
From: raeburn@mit.edu
Subject: SVN Commit

Add enhanced error messages to new error return cases, explaining the
(fairly generic) errors codes.

Commit By: raeburn



Revision: 20111
Changed Files:
U   trunk/src/lib/krb5/keytab/kt_file.c


Download (untitled) 195b
      Wed Oct 10 14:43:42 2007  raeburn - Component krb5-libs added    
      Wed Oct 10 14:43:43 2007  raeburn - Version_reported 1.6.3 added    
      Wed Oct 10 14:43:43 2007  raeburn - Target_Version 1.6.4 added    
      Wed Oct 10 14:43:43 2007  raeburn - Tags pullup added    
      Wed Nov 28 19:53:25 2007  tlyu - Correspondence added    
     
From: tlyu@mit.edu
Subject: SVN Commit


pull up r20109 from trunk

 r20109@cathode-dark-space:  raeburn | 2007-10-09 00:03:59 -0400
 ticket: 5777

 kt_file.c: Support multiple iterators active simultaneously, using a
 counter.  In get_entry, if the file was already open, rewind it to
 just after the version number, and don't close it when done.  Don't
 allow add or remove calls if any iterator is active.

 t_keytab.c: Test mixing two iterators with get_entry calls.



Commit By: tlyu



Revision: 20170
Changed Files:
_U  branches/krb5-1-6/
U   branches/krb5-1-6/src/lib/krb5/keytab/kt_file.c


Download (untitled) 562b
      Wed Nov 28 19:53:37 2007  tlyu - Version_Fixed 1.6.4 added    
      Wed Nov 28 19:53:38 2007  tlyu - Correspondence added    
     
From: tlyu@mit.edu
Subject: SVN Commit


pull up r20111 from trunk

 r20111@cathode-dark-space:  raeburn | 2007-10-10 14:27:37 -0400
 ticket: 5777

 Add enhanced error messages to new error return cases, explaining the
 (fairly generic) errors codes.



Commit By: tlyu



Revision: 20171
Changed Files:
_U  branches/krb5-1-6/
U   branches/krb5-1-6/src/lib/krb5/keytab/kt_file.c


Download (untitled) 341b