summaryrefslogtreecommitdiffstats
path: root/utils/nfsidmap/nfsidmap.c
Commit message (Collapse)AuthorAgeFilesLines
* nfsidmap: Clean up other exit status casesChuck Lever2015-09-161-15/+14
| | | | | | | Make it unambiguous where 0 or 1 represent an exit status. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Fix error handling in name_lookup()Chuck Lever2015-09-161-10/+11
| | | | | | | | | | | | | | | | | As near as I can tell, the exit status of nfsidmap is supposed to be zero (success) or one (failure). The return value of name_lookup() becomes the exit status, so it should return only zero or one. The libnfsidmap calls return a signed integer, either 0 or negative errno values. These have to be translated to an exit status. libkeyutils calls return a signed long, either 0 or -1. These also have to be translated to an exit status. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Fix error handling in id_lookup()Chuck Lever2015-09-161-19/+22
| | | | | | | | | | | | | | | | | As near as I can tell, the exit status of nfsidmap is supposed to be zero (success) or one (failure). The return value of id_lookup() becomes the exit status, so it should return only zero or one. The libnfsidmap calls return a signed integer, either 0 or negative errno values. These have to be translated to an exit status. libkeyutils calls return a signed long, either 0 or -1. These also have to be translated to an exit status. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: List cached ID mapping resultsChuck Lever2015-09-161-3/+83
| | | | | | | User space can see the keys, but not their contents. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Use find_key_by_type_and_desc() if availableChuck Lever2015-09-161-44/+61
| | | | | | | | | | | Recent versions of libkeyutils have find_key_by_type_and_desc() which replaces the open-coded keyring search in keyring_clear(). I don't quite understand what's going on in key_invalidate(), so I didn't touch it. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Display the effective NFSv4 domain nameChuck Lever2015-09-161-3/+23
| | | | | | | | | Sorry for the extensive man page changes. I added the description for the new "-d" option, then realized there was no explanation about what an "NFSv4 domain name" is. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: make sure give arguments are validSteve Dickson2015-05-041-1/+4
| | | | | | | Detect when a given argument is invalid. Log the error and exit gracefully Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Correct a failure to set key timeout valuesBenjamin Coddington2014-11-041-0/+3
| | | | | | | | | The caller must be a possesor of the key to set the attributes, so link the destination keyring to the current thread's keyring before instantiation so that after instantiation the timeout can be set. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: set the correct DEFAULT_KEYRING stringBenjamin Coddington2014-11-041-1/+1
| | | | | Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: keyctl_invalidate kernel compatibilityBenjamin Coddington2014-11-041-4/+17
| | | | | | | | | | Change the keyctl_invalidate call to use the syscall interface directly so that when building with libkeyutils missing keyctl_invalidate the build succeeds. Attempt to use _invalidate and fall back to _revoke if the current kernel is missing _invalidate. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Include libgen.h for basenameNatanael Copa2014-09-151-0/+1
| | | | | | | | | | According POSIX basename(3) should have an #include <libgen.h> There are a different GNU implementation too, that can be used with _GNU_SOURCE, but the POSIX version is good enough and more portable. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Keys need to be invalidated instead of revokedSteve Dickson2014-03-251-6/+6
| | | | | | | | With some recent kernel changes to the key ring for a key to be removed they need to be invalidated instead of revoked. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: fix error reporting for nfs4_* family of functionsMateusz Guzik2014-03-111-5/+6
| | | | | | | | | | Errors were logged with xlog_err function relying on errno, but these functions don't set it. Fix the problem by introducing xlog_errno which set errno Signed-off-by: Mateusz Guzik <mguzik@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Default domain not being set.Steve Dickson2012-07-051-13/+7
| | | | | | | | nfsidmap is not calling the nfs4_init_name_mapping() function which initializes the default domain from either the DNS domain or the Domain variable in /etc/idmap.conf Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Allow verbosity level to be set in the config fileSteve Dickson2012-05-291-1/+19
| | | | | | | | To make it easier to enable ID mapping debugging, nfsidmap should read /etc/idmap.conf to see if the verbosity level is set, similar to what rpc.idmapd does Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Purge the keyring when its full.Steve Dickson2012-01-161-3/+21
| | | | | | | | | | | | | | When a key can not be added to a keyring because the keyring is full or there is no memory for the playload, keyctl_instantiate() will fail and set the errno to -EDQUOT, -ENFILE or -ENOMEM When this happens, purge the keyring to free things up and then try to re-add the key. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Stack variable not being initialized.Steve Dickson2011-12-131-3/+3
| | | | | | | | The 'clearing' variable was not being initialized to zero which was cause the default key ring to always be cleared. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Allow a particular key to be revoked.Steve Dickson2011-12-051-4/+84
| | | | | | | | | | | | | | Introducing three new command line arguments that allow particular keys to be revoke -u will remove a uid key -g will revoke a gid key -r will revoke both the uid and gid keys A user name has also needs to be supply with these new flags. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Allow keys to be cleared from the keyringSteve Dickson2011-12-051-4/+62
| | | | | | | Added the '-c' command line argument that will clear all the keys from the keyring. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Added -v and -t flagsSteve Dickson2011-11-141-14/+34
| | | | | | | | | | | To aid in debugging, the -v flag can now be specified, multiple time, on the command line to enable verbose logging in both the nfsidmap command and libnfsidmap library routines. Also converted the timeout argument to use a -t flag. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: Added Error LoggingSteve Dickson2011-11-141-4/+30
| | | | | | | Since this binary is being called by the kernel, errors need to be logged to the syslog for help in debugging problems. Signed-off-by: Steve Dickson <steved@redhat.com>
* Add the new nfsidmap programBryan Schumaker2010-11-221-0/+118
This patch adds the nfsidmap program to nfs-utils. This program is called by the nfs idmapper through request-keys to map between uid / user name and gid / group name. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>