summaryrefslogtreecommitdiffstats
path: root/utils/gssd
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused argumentsgss-fixesSimo Sorce2014-01-173-7/+7
| | | | | | | | The name variable is always set to NULL now in all callers, so just sto passing it around needlessly. The uid_t variable is not used at all, so chuck it out too. Signed-off-by: Simo Sorce <simo@redhat.com>
* Improve first attempt at acquiring GSS credentialsSimo Sorce2014-01-171-22/+2
| | | | | | | | | | | | | | Since now rpc.gssd is swithing uid before attempting to acquire credentials, we do not need to pass in the special uid-as-a-string name to gssapi, because the process is already running under the user's credentials. By removing this code we can fix a class of false negatives where the user name does not match the actual ccache credentials and the ccache type used is not one of the only 2 supported explicitly by rpc.gssd by the fallback trolling done later. Signed-off-by: Simo Sorce <simo@redhat.com>
* gssd: don't let parent exit until child has a chance to scan directory onceJeff Layton2013-11-203-2/+9
| | | | | | | | | | | | | With some proposed kernel changes, it won't even attempt to upcall sometimes if it doesn't appear that gssd is running. This means that we have a theoretical race between gssd starting up at boot time and the init process attempting to mount kerberized filesystems. Fix this by switching gssd to use mydaemon() and having the child only release the parent after it has processed the directory once. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: consolidate mydaemon() and release_parent() implementationsJeff Layton2013-11-201-87/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | We currently have 2 cut-and-paste versions of this code. One for idmapd and one for svcgssd.[1] The two are basically equivalent but there are some small differences, mostly related to how errors in that function are logged. svcgssd uses printerr() with a priority of 1, which only prints errors if -v was specified. That doesn't seem to be quite right. Daemonizing errors are necessarily fatal and should be logged as such. The one for idmapd uses err(), which always prints to stderr even though we have the xlog facility set up. Since both have xlog configured at this point, log the errors using xlog_err() instead. The only other significant difference I see is that the idmapd version will open "/" if it's unable to open "/dev/null". I believe that however was a holdover from an earlier version of that function that did not error out when we were unable to open a file descriptor. Since the function does that now, I don't believe we need that fallback anymore. [1]: technically, we have a third in statd too, but it's different enough that I don't want to touch it here. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: don't let spurious signals interrupt the wait after forkingJeff Layton2013-11-201-1/+4
| | | | | | | | | | | | Because gssd uses dnotify under the hood, it's easily possible that the parent process can catch a signal while processing an upcall. If that happens, then we'll currently exit the wait for the child task to exit, and it'll end up as a zombie. Fix this by ensuring that we only wait for the child to actually exit. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Fix file descriptor leak of old pipe dirsWeston Andros Adamson2013-11-202-1/+6
| | | | | | | | | | | | | | | | | | gssd doesn't properly clean up internal state for old pipes and never closes the (since deleted) clnt_info directory. This leads to eventual fd exhaustion. To reproduce, run a lot of mount / umounts in a loop and watch the output of 'ls /proc/$PID/fdinfo | wc -l' (where PID is the pid of gssd) steadily grow until gssd eventually crashes with "Too many open files". This regression was introduced by 841e83c1, which was trying to fix a similar bug in the skip matching logic of update_old_clients. The problem with that patch is that pdir will never match dirname, because dirname is "<pname>/clntXXX". Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: always reply to rpc-pipe requests from kernel.NeilBrown2013-11-201-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes gssd will open a new rpc-pipe but never read requests from it or reply to them. This causes the kernel to wait forever for a reply. In particular, if a filesystem is mounted by IP, and the IP has no hostname recorded in /etc/hosts or DNS, then gssd will not listen to requests and the mount will hang indefinitely. The comment in process_clnt_dir() for the "fail_keep_client:" branch suggests that it is for the case where we couldn't open some subdirectories. However it is currently also taken if reverse DNS lookup fails (as well as some other lookup failures). Those failures should not be treated the same as failure-to-open directories. So this patch causes a failure from read_service_info() to *not* be reported by process_clnt_dir_files. This ensures that insert_clnt_poll() will be called and requests will be handled. In handle_gssd_upcall, the current error path (taken when the mech is not "krb5") does not reply to the upcall. This is wrong. A reply is always appropriate. The only replies which aren't treated as transient errors are EACCES and EKEYEXPIRED, so we return the former. If read_service_info() fails then ->servicename will be NULL which will cause process_krb5_upcall() (quite reasonably) to become confused. So in that case we don't even try to process the up-call but just reply with EACCES. As clp->servicename==NULL is no longer treated as fatal, it is not appropraite to use it to test if read_service_info() has been already called on a client. Instread test clp->prog. Finally, the error path of read_service_info() will close 'fd' if it isn't -1, so when we close it, we should set fd to -1. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: validate cred in gssd_acquire_user_credWeston Andros Adamson2013-10-281-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Call gss_inquire_cred after gssd_acquire_krb5_cred check for expired credentials. This fixes a recent regression (since 302de786930a2c533068f9d8909a) that causes the user's ticket cache to grow unbounded with expired service tickets when the user's credentials expire. To reproduce this issue: - mount kerberos nfs export - kinit for a short lifetime (ie "kinit -l 1m") - run a job that opens a file and writes for more than the lifetime - run klist a few times after expiry and see the list grow, ie: Ticket cache: DIR::/run/user/1749600001/krb5cc/tktYmpGlX Default principal: dros@APIKIA.FAKE Valid starting Expires Service principal 10/21/2013 15:39:38 10/21/2013 15:40:35 krbtgt/APIKIA.FAKE@APIKIA.FAKE 10/21/2013 15:39:40 10/21/2013 15:40:35 nfs/zero.apikia.fake@APIKIA.FAKE Signed-off-by: Weston Andros Adamson <dros@netapp.com> Reviewed-by: Simo Sorce <simo@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: do a more thorough change of identity after forkingJeff Layton2013-10-211-16/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The part of process_krb5_upcall that handles non-machine user creds first tries to query GSSAPI for credentials. If that fails, it then falls back to trawling through likely credcache locations to find them and then points $KRB5CCNAME at it before proceeding. There are a number of bugs in this code that this patch attempts to address. The code that queries GSSAPI for credentials does it as root which almost universally fails to do anything useful unless we happen to be looking for non-machine root creds. Because of this, gssd almost always falls back to having to search for credcaches "manually". The code that handles credential switching is in create_auth_rpc_client, so it's too late to be of any use here. Worse yet, for historical reasons the MIT krb5 authors used %{uid} in the default credcache locations which translates to the real uid. Thus switching the fsuid or even euid is insufficient. You must switch the real uid in order to be able to find the proper credcache in most cases. This patch moves the credential switching to occur much earlier in the process and has it do a much more thorough job of it. It first drops all supplimentary groups, then determines a gid to use and switches the gids and uids to the correct ones. If it can't determine the correct gid to use, it then tries to look up the one for "nobody" and uses that. Once the credentials are switched, the forked child now no longer tries to change them back. It does the downcall with the new credentials and just exits when it's done. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: have process_krb5_upcall fork before handling upcallJeff Layton2013-10-211-1/+23
| | | | | | | | | | | | | | | | | | | Most krb5 installations use credcache locations that contain %{uid}, which expands to the real UID of the current process. In order for GSSAPI to find those properly, we need to be able to switch the real UID of the process to the designated one. That however, opens the door to allowing gssd to be killed or reniced during the window where we've switched credentials. To combat this, change gssd to fork before trying to handle each upcall. The child will do the work to establish the context and the parent task will just wait for it to exit. It's still possible for the child to be killed or reniced, but that would only affect a single upcall instead of the entire daemon. Also, If the process is killed prematurely, then log an error to tip off the admin that there was a problem. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: remove gss_clnt_send_err and gss_destroy_credsJeff Layton2013-10-213-126/+1
| | | | | | | | | | | | | | | | | | | | As Bruce recently pointed out, gss_clnt_send_err basically does an unsolicited downcall into the kernel to try and destroy a valid GSS context. That has been broken however since this kernel commit: commit 3b68aaeaf54065e5c44583a1d33ffb7793953ba4 Author: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Thu Jun 7 10:14:15 2007 -0400 SUNRPC: Always match an upcall message in gss_pipe_downcall() Downcalls that don't match an in-progress upcall just get back an -ENOENT error and don't actually do anything. Remove these tools since they've been useless for the last 6 years. Reported-by: "J. Bruce Fields" <bfields@fieldses.org> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: don't use tgtname to find our keytabJ. Bruce Fields2013-09-241-6/+9
| | | | | | | | | | | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> The tgtname is of the form service@hostname. It's not a hostname, and attempting to look it up here just causes failure of any upcall with a "target=" field (currently, any upcall on behalf of an nfsv4.0 callback). I think the theory was that knowning that target= name might help pick the right keytab, but I don't really know if that's helpful. For now, just stop trying to do this. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: don't use tgtname to find our keytabJ. Bruce Fields2013-09-243-11/+5
| | | | | | | | | | | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> The tgtname is of the form service@hostname. It's not a hostname, and attempting to look it up here just causes failure of any upcall with a "target=" field (currently, any upcall on behalf of an nfsv4.0 callback). I think the theory was that knowning that target= name might help pick the right keytab, but I don't really know if that's helpful. For now, just stop trying to do this. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: fix strncmp bug causing client removalsJ. Bruce Fields2013-09-241-1/+1
| | | | | | | | | | | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> Both dirname and pdir are null-terminated strings, so there's no reason I can see for the strncmp. And this gives the wrong result when comparing the "nfsd" and "nfsd4_cb" directories! The results were callback clients being removed immediately after creation, when lack of a client with the corresponding name under "nfsd" lead gssd to believe it had disappeared from "nfsd4_cb". Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: suppress error message if rpc_pipefs dir disappears.NeilBrown2013-09-051-2/+3
| | | | | | | | | | | | | | | | | | | | It is possible for a race to cause a name to appear when an rpc_pipefs dir is scanned but to no longer be present when we try to open it. So if the error is ENOENT, don't complain. This is similar to commit 5ac9bcfd820f09af4d3f87f1f7346d896f70bc9a Author: David Jeffery <djeffery@redhat.com> Date: Wed Jan 16 15:21:55 2013 -0500 rpc.idmapd: Ignore open failures in dirscancb() which addressed a similar issue in idmapd. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: fixed typo in machine cred name.Doug Nazar2013-07-021-1/+1
| | | | | | | | | Commit 1c787f14 [gssd: scan for DIR: ccaches, too] changed the default prefix for the credential cache files. Update the check to ignore the machine credential file when running with -n (root ignores machine credentials). Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: don't give up on machine credential if hostname not available.NeilBrown2013-07-021-2/+6
| | | | | | | | | | | | krb5_util tries various different credential names in order to find the machine credential, not all of them use the full host name of the current host. So if getting the full host name fails, don't give up completely, still try the other options. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix handling of preferred realm command line option.Maximilian Wilhelm2013-07-011-2/+10
| | | | | | | | | | The current implementation ignores any preferred realm specified on the command line. Fix this behaviour and make sure the preferred realm is used as first realm when trying to acquire a keytab entry Signed-off-by: Maximilian Wilhelm <max@rfc2324.org> Signed-off-by: Frederik Moellers <frederik.moellers@upb.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: remove redundant array size.NeilBrown2013-07-011-1/+1
| | | | | | | | | | | | When initialising an array there is no need to specify the size as the size is taken from the initialiser. Having the size there means that any change to the initialiser needs to change the size to and so is error-prone. So just remove the size. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Fix recent fix to Avoid DNS reverse resolution in gssd.Signed-off-by: NeilBrown2013-05-282-13/+32
| | | | | | | | | | | | | | | | The final version for this fix that was committed inverted the test so makes no change in the important cases. The documentation didn't really help a naive user know when the new -D flag should be used. And the code (once fixed) avoided DNS resolution on non-qualified names too, which probably isn't a good idea. This patch fixes all three issues. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Remove unnecessary including of ctype.hSteve Dickson2013-05-071-1/+0
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Avoid DNS reverse resolution for server names (take 3)Simo Sorce2013-04-224-7/+41
| | | | | | | | | | | | | | A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. This means a DNS lookup should not be done on server names at are passed to GSSAPI. This patch changes the default behavior to no longer do those types of lookups This change default behavior could negatively impact some current environments, so the -D option is also being added that will re-enable the DNS reverse looks on server names, which are passed to GSSAPI. Signed-off-by: Simo Sorce <simo@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Allow GSSAPI to try to acquire credentials first.Simo Sorce2013-04-223-26/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GSSAPI can be given a uid number as a special name, and then gss_acquire_cred() can use the name to try to find credentials for the user. Give GSSAPI a chance to do it on its own, then fallback to the classic method of trolling through the file system to find a credential cache. This patch uses a little know feature of GSSAPI that permits to acquire crdentials specifying the user's UID. Normally GSSAPI will simply perform a getpwuid() call and use the user name to generate a principal name and then see if it can find a TGT for that principal in the local ccache. This feature is vital to allow the GSS-Proxy to be able to initiate crdentials on behalf of rpc.gssd using client keytabs stored in the filsystem. GSS-Proxy works through an interposer-type plugin (new feature in MIT 1.11) that allows to intercept all GSSAPI requestes and relay them to a system daemon via a socket. This daemon (GSS-Proxy) then can perform operations on behalf of other applications with additional logic. In the rpc.gssd case the GSS-Proxy daemon allows applications running as system users to properly access krb5 protected shares by creating a credential cache on the fly when necessary. This way all applications that need access to krb5 protected shares do not need to be taught how to initiate crdentials on their own, nor they need to be wrapped in additional init scripts like k5start or use wasteful cronjobs to keep credentials fresh. All is needed is to drop a keytab with the right keys in a special location on the system and gss-proxy will do the rest. Signed-off-by: Simo Sorce <simo@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Fix double free when exporting lucid contextSimo Sorce2013-04-107-12/+12
| | | | | | | | | | | | | When using GSSAPI's gss_krb5_export_lucid_context the context passed into the function is actually deleted during the export (to avoid reuse as the context contains state that depends on its usage). Change the code to pass in a pointer to the context so that it can be properly NULLed if we are using the GSSAPI context and following calls to gss_delete_sec_context will not cause double free errors and segfaults. Signed-off-by: Simo Sorce <simo@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Fix segfault when using -R optionSimo Sorce2013-04-021-1/+1
| | | | | | | | The getopt string did not add : after the R option resulting in a sefgault whenever -R was used as optarg is NULL and it is dereferenced. Signed-off-by: Simo Sorce <simo@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Switch to use standard GSSAPI by defaultSimo Sorce2013-04-022-6/+16
| | | | | | | | | Make libgssglue configurable still but disabled by default. There is no reason to use libgssglue anymore, and modern gssapi supports all needed features for nfs-utils. Signed-off-by: Simo Sorce <simo@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: gethostname(3) returns zero or -1, not an errnoChuck Lever2013-03-251-2/+2
| | | | | | | | | | According to "man gethostname," gssd is handling the return value of gethostname(3) incorrectly. It looks like other gethostname(3) call sites in nfs-utils are already correct. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Fix whitespace nitsChuck Lever2013-03-251-6/+6
| | | | | | Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Clean up gssd_setup_krb5_user_gss_ccache()Chuck Lever2013-03-251-8/+8
| | | | | | | | | | | | | | | | | | | | | | | Remove a contradictory portion of the block comment documenting gssd_find_existing_krb5_ccache(). This should have been removed by commit 289ad31e, which reversed the meaning of the function's return values. Note that, in user space, typically errno's are positive. But here we follow the kernel convention of using negative values to return error codes. Make the documenting comments explicit about the sign of an error return -- it will never be positive in the case of an error. And a nit: At the last return statement in gssd_setup_krb5_user_gss_ccache(), "err" always contains zero, as far as I can tell. Make it explicit (to human readers) that when execution reaches this point, gssd_setup_krb5_user_gss_ccache() is going to return "success." Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Update description of "-l" optionChuck Lever2013-03-252-22/+27
| | | | | | | | | | | | | | | Move most of the text in the description of the "-l" option up to the DESCRIPTION section, to match what was done for "-n" and "-k". The discussion is then less restricted by formatting, and we can take the space to introduce a few concepts before describing the behavior of rpc.gssd. Fix a few misspellings and grammar issues while here. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Clarify use of the term "machine credentials" in rpc.gssd(8)Chuck Lever2013-03-251-37/+105
| | | | | | | | | | | | | | | | | | | | | Our NFSv4 implementation uses machine credentials for operations that manage state on behalf of the whole client (for example, SETCLIENTID or RENEW). The rpc.gssd man page is missing a description of this usage, especially in the discussion of the "-n" option. The issue is that rpc.gssd's "-n" option requires root to acquire a user credential. In the absense of a system keytab (for instance, if the system is diskless) root's credential is not to be used as the machine credential that manages NFSv4 state. Group the discussion of machine credentials and UID 0 in one place to help clarify the discussion and simplify the description of several of these options. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Provide an introduction in gssd(8)Chuck Lever2013-03-251-14/+59
| | | | | | | | | | | | | | | It's good practice in user documentation to define terms before they are used. Add an INTRODUCTION section that defines important terms that are used in the DESCRIPTION and OPTIONS sections. The key concepts are GSS context, user credential, machine credential, and keytab. The RFCs I looked at capitalize both "gss" and "rpcsec_gss". For consistency I changed this throughout the man page. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: gssd.man is missing a description of the "-M" optionChuck Lever2013-03-251-10/+16
| | | | | | Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Use italics for option values and pathnamesChuck Lever2013-03-251-9/+21
| | | | | | | | | | Clean up: The usual convention for the values of command line options and for pathnames is for them to appear italicized, rather than emboldened or in double quotes. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd - expired credentials problemLukas Hejtmanek2013-03-251-0/+5
| | | | | | | | | I noticed that there is a problem with expired credentials if NFS client's time is even few seconds behind KDC's or NFS server's time. Client's kernel requests new GSS context but rpc.gssd is happy with existing krb cache as it valid according to local time. Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: don't krb5_free_context if krb5_init_context failsNeilBrown2013-03-251-7/+8
| | | | | | | | | Most places that call krb5_init_context() abort cleanly on failure. However these two then try to free the non-existent context, which doesn't end well. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: use correct test for success of getrlimit()NeilBrown2013-03-251-1/+1
| | | | | | | | | | | | | | | commit 7c5cb5e732a4b8704f8c79ec819c5d271e040339 gssd: base the size of the fd array on the RLIMIT_NOFILE limit. didn't actually work as claimed. It only uses the returned value if getrlimit() returns -1 -- which of course it only does when there was an error. So change the test to "== 0". Reported-by: Leonardo Chiquitto< lchiquitto@suse.com> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Call authgss_free_private_data() if library provides it.NeilBrown2013-02-131-1/+1
| | | | | | | | | | | | | | | | | | | librpcsecgss provides authgss_free_private_data() as a pair to authgss_get_private_data(). libtirpc does not - until recently. This ommision results in authgss_destroy_context() sending an incorrect RPCSEC_GSS_DESTROY request when gssd calls AUTH_DESTROY(). The call has been added to libtirpc, so this patch updates nfs-utils to check for the presense of the function in libtirpc and to set HAVE_AUTHGSS_FREE_PRIVATE_DATA if it is present. This is also set unconditionally if librpcsecgss is used. gssd is changed to test this value rather than HAVE_LIBTIRPC when chosing whether to call authgss_free_private_data(). Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: base the size of the fd array on the RLIMIT_NOFILE limit.NeilBrown2012-11-281-0/+5
| | | | | | | | | | | We have previously raised the size of the 'pollarray' once (32 -> 256) and I have had another request to make it bigger. Rather than changing the hard-coded value, make it depend on RLIMIT_NOFILE. This is an upper limit on the size of the array that can be passed to poll() anyway. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd_proc: remove pointless test against FD_ALLOC_BLOCK in process_pipedirNeilBrown2012-11-281-3/+2
| | | | | | | | I can see no possible point for this test against FD_ALLOC_BLOCK, so just remove the test. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd_proc: use pollsize, not FD_ALLOC_BLOCK, in get_poll_index()NeilBrown2012-11-281-2/+2
| | | | | | | | | | | | get_poll_index wants to walk the entire "pollarray", but uses the constant FD_ALLOC_BLOCK, rather than the variable pollsize (which has the same value). If we want to make the size of the array variable, it is best not to use the constant. As pollsize is 'unsigned long', 'i' should be too. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Handle the target name correctlyTrond Myklebust2012-11-283-14/+18
| | | | | | | | | | | | | | | | | | | The target name contains a hostname in the realm that we are authenticating to. Since we may be authenticating to a different realm than the default realm for the server, we should not assume that the target name and host name point to the same string. In fact, the kernel NFS client will always use its own hostname as the target name, since it is always authenticating to its own default realm. On the other hand, the NFS server's callback channel will pass the hostname of the NFS client that it is authenticating too (Section 3.4, RFC3530). This patch fixes the handling of the target name in process_krb5_upcall, and ensures that it gets passed to find_keytab_entry(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Remove insane sanity checks of the service nameTrond Myklebust2012-11-281-12/+1
| | | | | | | | | | | | | | | Either we trust the info file, or we don't. The current 'checks' only work for the combination 'nfs', '100003' and a version number between 2 and 4. The problem is that the callback channel also wants to use 'nfs' in combination with a different program number and version number. This patch throws the bogus checks out altogether and lets the kernel use whatever combination it wants.... Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* svcgssd: Encryption types not being parsed correctlySteve Dickson2012-11-191-0/+7
| | | | | | | | When svcgssd reads the supported encrytion types from the kernel, they are prefixed with a 'enctypes='. That prefix has to be ignored to correctly parse the rest of the types. Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.gssd: Squelch compiler errorChuck Lever2012-10-301-1/+1
| | | | | | | | | gssd_proc.c: In function handle_krb5_upcall: gssd_proc.c:1117:2: warning: ISO C forbids return with expression, in function returning void [-pedantic] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.gssd: Squelch compiler warningChuck Lever2012-10-301-5/+6
| | | | | | | | gssd_proc.c: At top level: gssd_proc.c:782:5: warning: no previous prototype for create_auth_rpc_client [-Wmissing-prototypes] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.gssd: Squelch compiler warningChuck Lever2012-10-301-1/+1
| | | | | | | | | gss_util.c: At top level: gss_util.c:98:36: warning: ISO C does not allow extra ; outside of a function [-pedantic] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* GSSD: Pass GSS_context lifetime to the kernel.Andy Adamson2012-10-181-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | From: Andy Adamson <andros@netapp.com> The kernel gss_cl_ctx stores the context lifetime in gc_expiry, set by gssd in do_downcall() called by process_krb5_upcall(). The lifetime value is currently not related at all to the Kerberos TGS lifetime. It is either set to the value of gssd -t <timeout>, or to a kernel default of 3600 seconds. Most of the time the gssd -t command line is not set, and a timeout value of zero was sent to the kernel triggering the use of the 3600 second kernel default timeout. In order for the kernel to properly know when to renew a context, or to stop buffering writes for a context about to expire, the gc_expiry value needs to reflect the credential lifetime used to create the context. Note that gss_inquire_cred returns the number of seconds for which the context remains valid in the lifetime_rec parameter. Send the actual TGS remaining lifetime to the kernel. It can still be overwritten by the gssd -t command line option, or set to the kernel default if the gss_inquire_cred call fails (which sets the lifetime_rec to zero). Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* utils: Return status 0 on clean exitsMantas Mikulenas2012-10-152-2/+2
| | | | | | Some init systems actually expect daemons to return 0 on success. Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Use /run/user/${UID} instead of /run/user/${USER}Nalin Dahyabhai2012-08-224-42/+35
| | | | | | | | | | Newer versions of systemd create a /run/user/${UID} directory instead of the /run/user/${USER} directory, so switch to scanning for that. To make the per-user directory bit a little less magical, change the default to incorporate a "%U", which gets dynamically expanded to the user's UID when needed. Signed-off-by: Steve Dickson <steved@redhat.com>