• David Howells's avatar
    [PATCH] Keys: Replace duplicate non-updateable keys rather than failing · 1d9b7d97
    David Howells authored
    Cause an attempt to add a duplicate non-updateable key (such as a keyring) to
    a keyring to discard the extant copy in favour of the new one rather than
    failing with EEXIST:
    
    	# do the test in an empty session
    	keyctl session
    	# create a new keyring called "a" and attach to session
    	keyctl newring a @s
    	# create another new keyring called "a" and attach to session,
    	# displacing the keyring added by the second command:
    	keyctl newring a @s
    
    Without this patch, the third command will fail.
    
    For updateable keys (such as those of "user" type), the update method will
    still be called rather than a new key being created.
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    1d9b7d97
key.c 23.8 KB