Page MenuHomeFreeBSD

D57455.diff
No OneTemporary

D57455.diff

diff --git a/sys/kgssapi/gss_impl.c.sav b/sys/kgssapi/gss_impl.c
--- a/sys/kgssapi/gss_impl.c.sav
+++ b/sys/kgssapi/gss_impl.c
@@ -52,6 +52,7 @@
struct mtx kgss_gssd_lock;
CLIENT *kgss_gssd_handle;
+CLIENT *kgss_gssd_cl;
static int
kgss_load(void)
@@ -79,7 +80,7 @@
clnt_control(cl, CLSET_WAITCHAN, "gssd");
mtx_lock(&kgss_gssd_lock);
- kgss_gssd_handle = cl;
+ kgss_gssd_cl = cl;
mtx_unlock(&kgss_gssd_lock);
return (0);
@@ -90,7 +91,7 @@
kgss_unload(void)
{
- clnt_destroy(kgss_gssd_handle);
+ clnt_destroy(kgss_gssd_cl);
}
#endif
@@ -237,9 +238,41 @@
kgss_gssd_client(void)
{
CLIENT *cl;
+ struct rpc_callextra ext;
+ enum clnt_stat stat;
+ struct timeval nulltimo = {.tv_sec = 0, .tv_usec = 200000}, savtimo;
+ static time_t nextrpc = 0;
mtx_lock(&kgss_gssd_lock);
cl = kgss_gssd_handle;
+ if (cl == NULL) {
+ cl = kgss_gssd_cl;
+ mtx_unlock(&kgss_gssd_lock);
+ if (cl == NULL)
+ return (cl);
+ if (time_uptime < nextrpc)
+ return (NULL);
+ /*
+ * Do a Null RPC with a short timeout. If the RPC succeeds,
+ * the gssd daemon is running. If the Null RPC fails, don't
+ * again for 5sec.
+ */
+ CLNT_CONTROL(cl, CLGET_TIMEOUT, &savtimo);
+ CLNT_CONTROL(cl, CLSET_TIMEOUT, &nulltimo);
+ memset(&ext, 0, sizeof(ext));
+ ext.rc_auth = authnone_create();
+ stat = clnt_call_private(cl, &ext, NULLPROC,
+ (xdrproc_t)xdr_void, NULL, (xdrproc_t)xdr_void, NULL,
+ nulltimo); /* nulltimo is ignored by clnt_nl_call(). */
+ AUTH_DESTROY(ext.rc_auth);
+ if (stat != RPC_SUCCESS) {
+ nextrpc = time_uptime + 5;
+ return (NULL);
+ }
+ CLNT_CONTROL(cl, CLSET_TIMEOUT, &savtimo);
+ mtx_lock(&kgss_gssd_lock);
+ kgss_gssd_handle = cl;
+ }
if (cl != NULL)
CLNT_ACQUIRE(cl);
mtx_unlock(&kgss_gssd_lock);

File Metadata

Mime Type
text/plain
Expires
Thu, Jun 11, 9:24 PM (5 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33764807
Default Alt Text
D57455.diff (1 KB)

Event Timeline