|
|
07bda6 |
diff -up nfs-utils-2.3.3/utils/gssd/err_util.c.orig nfs-utils-2.3.3/utils/gssd/err_util.c
|
|
|
07bda6 |
--- nfs-utils-2.3.3/utils/gssd/err_util.c.orig 2018-09-06 14:09:08.000000000 -0400
|
|
|
07bda6 |
+++ nfs-utils-2.3.3/utils/gssd/err_util.c 2021-07-19 12:29:21.366829573 -0400
|
|
|
07bda6 |
@@ -70,3 +70,17 @@ int get_verbosity(void)
|
|
|
07bda6 |
{
|
|
|
07bda6 |
return verbosity;
|
|
|
07bda6 |
}
|
|
|
07bda6 |
+
|
|
|
07bda6 |
+char *
|
|
|
07bda6 |
+sec2time(int value)
|
|
|
07bda6 |
+{
|
|
|
07bda6 |
+ static char buf[BUFSIZ];
|
|
|
07bda6 |
+ int hr, min, sec;
|
|
|
07bda6 |
+
|
|
|
07bda6 |
+ hr = (value / 3600);
|
|
|
07bda6 |
+ min = (value - (3600*hr))/60;
|
|
|
07bda6 |
+ sec = (value - (3600*hr) - (min*60));
|
|
|
07bda6 |
+ sprintf(buf, "%dh:%dm:%ds", hr, min, sec);
|
|
|
07bda6 |
+ return(buf);
|
|
|
07bda6 |
+}
|
|
|
07bda6 |
+
|
|
|
07bda6 |
diff -up nfs-utils-2.3.3/utils/gssd/err_util.h.orig nfs-utils-2.3.3/utils/gssd/err_util.h
|
|
|
07bda6 |
--- nfs-utils-2.3.3/utils/gssd/err_util.h.orig 2018-09-06 14:09:08.000000000 -0400
|
|
|
07bda6 |
+++ nfs-utils-2.3.3/utils/gssd/err_util.h 2021-07-19 12:29:21.367829599 -0400
|
|
|
07bda6 |
@@ -34,5 +34,6 @@
|
|
|
07bda6 |
void initerr(char *progname, int verbosity, int fg);
|
|
|
07bda6 |
void printerr(int priority, char *format, ...);
|
|
|
07bda6 |
int get_verbosity(void);
|
|
|
07bda6 |
+char * sec2time(int);
|
|
|
07bda6 |
|
|
|
07bda6 |
#endif /* _ERR_UTIL_H_ */
|
|
|
07bda6 |
diff -up nfs-utils-2.3.3/utils/gssd/gssd.c.orig nfs-utils-2.3.3/utils/gssd/gssd.c
|
|
|
07bda6 |
--- nfs-utils-2.3.3/utils/gssd/gssd.c.orig 2021-07-19 12:24:13.963644016 -0400
|
|
|
07bda6 |
+++ nfs-utils-2.3.3/utils/gssd/gssd.c 2021-07-19 12:29:21.368829626 -0400
|
|
|
07bda6 |
@@ -396,7 +396,7 @@ gssd_free_client(struct clnt_info *clp)
|
|
|
07bda6 |
if (refcnt > 0)
|
|
|
07bda6 |
return;
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(3, "freeing client %s\n", clp->relpath);
|
|
|
07bda6 |
+ printerr(4, "freeing client %s\n", clp->relpath);
|
|
|
07bda6 |
|
|
|
07bda6 |
if (clp->krb5_fd >= 0)
|
|
|
07bda6 |
close(clp->krb5_fd);
|
|
|
07bda6 |
@@ -417,7 +417,7 @@ gssd_free_client(struct clnt_info *clp)
|
|
|
07bda6 |
static void
|
|
|
07bda6 |
gssd_destroy_client(struct clnt_info *clp)
|
|
|
07bda6 |
{
|
|
|
07bda6 |
- printerr(3, "destroying client %s\n", clp->relpath);
|
|
|
07bda6 |
+ printerr(4, "destroying client %s\n", clp->relpath);
|
|
|
07bda6 |
|
|
|
07bda6 |
if (clp->krb5_ev) {
|
|
|
07bda6 |
event_del(clp->krb5_ev);
|
|
|
07bda6 |
@@ -494,7 +494,7 @@ scan_active_thread_list(void)
|
|
|
07bda6 |
* upcall_thread_info from the list and free it.
|
|
|
07bda6 |
*/
|
|
|
07bda6 |
if (tret == PTHREAD_CANCELED)
|
|
|
07bda6 |
- printerr(3, "watchdog: thread id 0x%lx cancelled successfully\n",
|
|
|
07bda6 |
+ printerr(2, "watchdog: thread id 0x%lx cancelled successfully\n",
|
|
|
07bda6 |
info->tid);
|
|
|
07bda6 |
saveprev = info->list.tqe_prev;
|
|
|
07bda6 |
TAILQ_REMOVE(&active_thread_list, info, list);
|
|
|
07bda6 |
@@ -783,7 +783,7 @@ gssd_scan(void)
|
|
|
07bda6 |
{
|
|
|
07bda6 |
struct dirent *d;
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(3, "doing a full rescan\n");
|
|
|
07bda6 |
+ printerr(4, "doing a full rescan\n");
|
|
|
07bda6 |
rewinddir(pipefs_dir);
|
|
|
07bda6 |
|
|
|
07bda6 |
while ((d = readdir(pipefs_dir))) {
|
|
|
07bda6 |
diff -up nfs-utils-2.3.3/utils/gssd/gssd_proc.c.orig nfs-utils-2.3.3/utils/gssd/gssd_proc.c
|
|
|
07bda6 |
--- nfs-utils-2.3.3/utils/gssd/gssd_proc.c.orig 2021-07-19 12:24:13.964644043 -0400
|
|
|
07bda6 |
+++ nfs-utils-2.3.3/utils/gssd/gssd_proc.c 2021-07-19 12:29:21.368829626 -0400
|
|
|
07bda6 |
@@ -166,8 +166,9 @@ do_downcall(int k5_fd, uid_t uid, struct
|
|
|
07bda6 |
unsigned int buf_size = 0;
|
|
|
07bda6 |
pthread_t tid = pthread_self();
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(2, "do_downcall(0x%x): lifetime_rec=%u acceptor=%.*s\n",
|
|
|
07bda6 |
- tid, lifetime_rec, acceptor->length, acceptor->value);
|
|
|
07bda6 |
+ if (get_verbosity() > 1)
|
|
|
07bda6 |
+ printerr(2, "do_downcall(0x%lx): lifetime_rec=%s acceptor=%.*s\n",
|
|
|
07bda6 |
+ tid, sec2time(lifetime_rec), acceptor->length, acceptor->value);
|
|
|
07bda6 |
buf_size = sizeof(uid) + sizeof(timeout) + sizeof(pd->pd_seq_win) +
|
|
|
07bda6 |
sizeof(pd->pd_ctx_hndl.length) + pd->pd_ctx_hndl.length +
|
|
|
07bda6 |
sizeof(context_token->length) + context_token->length +
|
|
|
07bda6 |
@@ -193,7 +194,7 @@ do_downcall(int k5_fd, uid_t uid, struct
|
|
|
07bda6 |
return;
|
|
|
07bda6 |
out_err:
|
|
|
07bda6 |
free(buf);
|
|
|
07bda6 |
- printerr(1, "do_downcall(0x%x): Failed to write downcall!\n", tid);
|
|
|
07bda6 |
+ printerr(1, "do_downcall(0x%lx): Failed to write downcall!\n", tid);
|
|
|
07bda6 |
return;
|
|
|
07bda6 |
}
|
|
|
07bda6 |
|
|
|
07bda6 |
@@ -204,8 +205,9 @@ do_error_downcall(int k5_fd, uid_t uid,
|
|
|
07bda6 |
char *p = buf, *end = buf + 1024;
|
|
|
07bda6 |
unsigned int timeout = 0;
|
|
|
07bda6 |
int zero = 0;
|
|
|
07bda6 |
+ pthread_t tid = pthread_self();
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(2, "doing error downcall\n");
|
|
|
07bda6 |
+ printerr(2, "do_error_downcall(0x%lx): uid %d err %d\n", tid, uid, err);
|
|
|
07bda6 |
|
|
|
07bda6 |
if (WRITE_BYTES(&p, end, uid)) goto out_err;
|
|
|
07bda6 |
if (WRITE_BYTES(&p, end, timeout)) goto out_err;
|
|
|
07bda6 |
@@ -328,6 +330,7 @@ create_auth_rpc_client(struct clnt_info
|
|
|
07bda6 |
struct timeval timeout;
|
|
|
07bda6 |
struct sockaddr *addr = (struct sockaddr *) &clp->addr;
|
|
|
07bda6 |
socklen_t salen;
|
|
|
07bda6 |
+ pthread_t tid = pthread_self();
|
|
|
07bda6 |
|
|
|
07bda6 |
sec.qop = GSS_C_QOP_DEFAULT;
|
|
|
07bda6 |
sec.svc = RPCSEC_GSS_SVC_NONE;
|
|
|
07bda6 |
@@ -361,8 +364,8 @@ create_auth_rpc_client(struct clnt_info
|
|
|
07bda6 |
|
|
|
07bda6 |
/* create an rpc connection to the nfs server */
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(2, "creating %s client for server %s\n", clp->protocol,
|
|
|
07bda6 |
- clp->servername);
|
|
|
07bda6 |
+ printerr(3, "create_auth_rpc_client(0x%lx): creating %s client for server %s\n",
|
|
|
07bda6 |
+ tid, clp->protocol, clp->servername);
|
|
|
07bda6 |
|
|
|
07bda6 |
protocol = IPPROTO_TCP;
|
|
|
07bda6 |
if ((strcmp(clp->protocol, "udp")) == 0)
|
|
|
07bda6 |
@@ -405,7 +408,8 @@ create_auth_rpc_client(struct clnt_info
|
|
|
07bda6 |
if (!tgtname)
|
|
|
07bda6 |
tgtname = clp->servicename;
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(2, "creating context with server %s\n", tgtname);
|
|
|
07bda6 |
+ printerr(3, "create_auth_rpc_client(0x%lx): creating context with server %s\n",
|
|
|
07bda6 |
+ tid, tgtname);
|
|
|
07bda6 |
auth = authgss_create_default(rpc_clnt, tgtname, &sec);
|
|
|
07bda6 |
if (!auth) {
|
|
|
07bda6 |
/* Our caller should print appropriate message */
|
|
|
07bda6 |
@@ -507,9 +511,10 @@ krb5_not_machine_creds(struct clnt_info
|
|
|
07bda6 |
gss_cred_id_t gss_cred;
|
|
|
07bda6 |
char **dname;
|
|
|
07bda6 |
int err, resp = -1;
|
|
|
07bda6 |
+ pthread_t tid = pthread_self();
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(2, "krb5_not_machine_creds: uid %d tgtname %s\n",
|
|
|
07bda6 |
- uid, tgtname);
|
|
|
07bda6 |
+ printerr(2, "krb5_not_machine_creds(0x%lx): uid %d tgtname %s\n",
|
|
|
07bda6 |
+ tid, uid, tgtname);
|
|
|
07bda6 |
|
|
|
07bda6 |
*chg_err = change_identity(uid);
|
|
|
07bda6 |
if (*chg_err) {
|
|
|
07bda6 |
@@ -555,9 +560,10 @@ krb5_use_machine_creds(struct clnt_info
|
|
|
07bda6 |
char **ccname;
|
|
|
07bda6 |
int nocache = 0;
|
|
|
07bda6 |
int success = 0;
|
|
|
07bda6 |
+ pthread_t tid = pthread_self();
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(2, "krb5_use_machine_creds: uid %d tgtname %s\n",
|
|
|
07bda6 |
- uid, tgtname);
|
|
|
07bda6 |
+ printerr(2, "krb5_use_machine_creds(0x%lx): uid %d tgtname %s\n",
|
|
|
07bda6 |
+ tid, uid, tgtname);
|
|
|
07bda6 |
|
|
|
07bda6 |
do {
|
|
|
07bda6 |
gssd_refresh_krb5_machine_credential(clp->servername,
|
|
|
07bda6 |
@@ -874,6 +880,7 @@ start_upcall_thread(void (*func)(struct
|
|
|
07bda6 |
pthread_t th;
|
|
|
07bda6 |
struct upcall_thread_info *tinfo;
|
|
|
07bda6 |
int ret;
|
|
|
07bda6 |
+ pthread_t tid = pthread_self();
|
|
|
07bda6 |
|
|
|
07bda6 |
tinfo = alloc_upcall_thread_info();
|
|
|
07bda6 |
if (!tinfo)
|
|
|
07bda6 |
@@ -896,6 +903,9 @@ start_upcall_thread(void (*func)(struct
|
|
|
07bda6 |
free(tinfo);
|
|
|
07bda6 |
return ret;
|
|
|
07bda6 |
}
|
|
|
07bda6 |
+ printerr(2, "start_upcall_thread(0x%lx): created thread id 0x%lx\n",
|
|
|
07bda6 |
+ tid, th);
|
|
|
07bda6 |
+
|
|
|
07bda6 |
tinfo->tid = th;
|
|
|
07bda6 |
pthread_mutex_lock(&active_thread_list_lock);
|
|
|
07bda6 |
clock_gettime(CLOCK_MONOTONIC, &tinfo->timeout);
|
|
|
07bda6 |
@@ -958,7 +968,7 @@ handle_gssd_upcall(struct clnt_info *clp
|
|
|
07bda6 |
}
|
|
|
07bda6 |
lbuf[lbuflen-1] = 0;
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(2, "\n%s(0x%x): '%s' (%s)\n", __func__, tid,
|
|
|
07bda6 |
+ printerr(2, "\n%s(0x%lx): '%s' (%s)\n", __func__, tid,
|
|
|
07bda6 |
lbuf, clp->relpath);
|
|
|
07bda6 |
|
|
|
07bda6 |
for (p = strtok(lbuf, " "); p; p = strtok(NULL, " ")) {
|
|
|
07bda6 |
diff -up nfs-utils-2.3.3/utils/gssd/krb5_util.c.orig nfs-utils-2.3.3/utils/gssd/krb5_util.c
|
|
|
07bda6 |
--- nfs-utils-2.3.3/utils/gssd/krb5_util.c.orig 2021-07-19 12:24:13.951643697 -0400
|
|
|
07bda6 |
+++ nfs-utils-2.3.3/utils/gssd/krb5_util.c 2021-07-19 12:36:27.746223992 -0400
|
|
|
07bda6 |
@@ -375,6 +375,7 @@ gssd_get_single_krb5_cred(krb5_context c
|
|
|
07bda6 |
char *cache_type;
|
|
|
07bda6 |
char *pname = NULL;
|
|
|
07bda6 |
char *k5err = NULL;
|
|
|
07bda6 |
+ pthread_t tid = pthread_self();
|
|
|
07bda6 |
|
|
|
07bda6 |
memset(&my_creds, 0, sizeof(my_creds));
|
|
|
07bda6 |
|
|
|
07bda6 |
@@ -385,8 +386,8 @@ gssd_get_single_krb5_cred(krb5_context c
|
|
|
07bda6 |
now += 300;
|
|
|
07bda6 |
pthread_mutex_lock(&ple_lock);
|
|
|
07bda6 |
if (ple->ccname && ple->endtime > now && !nocache) {
|
|
|
07bda6 |
- printerr(3, "INFO: Credentials in CC '%s' are good until %d\n",
|
|
|
07bda6 |
- ple->ccname, ple->endtime);
|
|
|
07bda6 |
+ printerr(3, "%s(0x%lx): Credentials in CC '%s' are good until %s",
|
|
|
07bda6 |
+ __func__, tid, ple->ccname, ctime((time_t *)&ple->endtime));
|
|
|
07bda6 |
code = 0;
|
|
|
07bda6 |
pthread_mutex_unlock(&ple_lock);
|
|
|
07bda6 |
goto out;
|
|
|
07bda6 |
@@ -486,7 +487,8 @@ gssd_get_single_krb5_cred(krb5_context c
|
|
|
07bda6 |
}
|
|
|
07bda6 |
|
|
|
07bda6 |
code = 0;
|
|
|
07bda6 |
- printerr(2, "%s: principal '%s' ccache:'%s'\n", __func__, pname, cc_name);
|
|
|
07bda6 |
+ printerr(2, "%s(0x%lx): principal '%s' ccache:'%s'\n",
|
|
|
07bda6 |
+ __func__, tid, pname, cc_name);
|
|
|
07bda6 |
out:
|
|
|
07bda6 |
#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
|
|
|
07bda6 |
if (init_opts)
|
|
|
07bda6 |
@@ -615,6 +617,7 @@ get_full_hostname(const char *inhost, ch
|
|
|
07bda6 |
struct addrinfo hints;
|
|
|
07bda6 |
int retval;
|
|
|
07bda6 |
char *c;
|
|
|
07bda6 |
+ pthread_t tid = pthread_self();
|
|
|
07bda6 |
|
|
|
07bda6 |
memset(&hints, 0, sizeof(hints));
|
|
|
07bda6 |
hints.ai_socktype = SOCK_STREAM;
|
|
|
07bda6 |
@@ -624,8 +627,8 @@ get_full_hostname(const char *inhost, ch
|
|
|
07bda6 |
/* Get full target hostname */
|
|
|
07bda6 |
retval = getaddrinfo(inhost, NULL, &hints, &addrs);
|
|
|
07bda6 |
if (retval) {
|
|
|
07bda6 |
- printerr(1, "%s while getting full hostname for '%s'\n",
|
|
|
07bda6 |
- gai_strerror(retval), inhost);
|
|
|
07bda6 |
+ printerr(1, "%s(0x%lx): getaddrinfo(%s) failed: %s\n",
|
|
|
07bda6 |
+ __func__, tid, inhost, gai_strerror(retval));
|
|
|
07bda6 |
goto out;
|
|
|
07bda6 |
}
|
|
|
07bda6 |
strncpy(outhost, addrs->ai_canonname, outhostlen);
|
|
|
07bda6 |
@@ -633,7 +636,10 @@ get_full_hostname(const char *inhost, ch
|
|
|
07bda6 |
for (c = outhost; *c != '\0'; c++)
|
|
|
07bda6 |
*c = tolower(*c);
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(3, "Full hostname for '%s' is '%s'\n", inhost, outhost);
|
|
|
07bda6 |
+ if (get_verbosity() && strcmp(inhost, outhost))
|
|
|
07bda6 |
+ printerr(1, "%s(0x%0lx): inhost '%s' different than outhost'%s'\n",
|
|
|
07bda6 |
+ inhost, outhost);
|
|
|
07bda6 |
+
|
|
|
07bda6 |
retval = 0;
|
|
|
07bda6 |
out:
|
|
|
07bda6 |
return retval;
|
|
|
07bda6 |
@@ -819,6 +825,7 @@ find_keytab_entry(krb5_context context,
|
|
|
07bda6 |
krb5_principal princ;
|
|
|
07bda6 |
const char *notsetstr = "not set";
|
|
|
07bda6 |
char *adhostoverride = NULL;
|
|
|
07bda6 |
+ pthread_t tid = pthread_self();
|
|
|
07bda6 |
|
|
|
07bda6 |
|
|
|
07bda6 |
/* Get full target hostname */
|
|
|
07bda6 |
@@ -972,7 +979,7 @@ find_keytab_entry(krb5_context context,
|
|
|
07bda6 |
tried_upper = 1;
|
|
|
07bda6 |
}
|
|
|
07bda6 |
} else {
|
|
|
07bda6 |
- printerr(2, "Success getting keytab entry for '%s'\n",spn);
|
|
|
07bda6 |
+ printerr(2, "find_keytab_entry(0x%lx): Success getting keytab entry for '%s'\n",tid, spn);
|
|
|
07bda6 |
retval = 0;
|
|
|
07bda6 |
goto out;
|
|
|
07bda6 |
}
|
|
|
07bda6 |
@@ -1113,9 +1120,6 @@ gssd_refresh_krb5_machine_credential_int
|
|
|
07bda6 |
char *k5err = NULL;
|
|
|
07bda6 |
const char *svcnames[] = { "$", "root", "nfs", "host", NULL };
|
|
|
07bda6 |
|
|
|
07bda6 |
- printerr(2, "%s: hostname=%s ple=%p service=%s srchost=%s\n",
|
|
|
07bda6 |
- __func__, hostname, ple, service, srchost);
|
|
|
07bda6 |
-
|
|
|
07bda6 |
/*
|
|
|
07bda6 |
* If a specific service name was specified, use it.
|
|
|
07bda6 |
* Otherwise, use the default list.
|
|
|
07bda6 |
@@ -1124,9 +1128,10 @@ gssd_refresh_krb5_machine_credential_int
|
|
|
07bda6 |
svcnames[0] = service;
|
|
|
07bda6 |
svcnames[1] = NULL;
|
|
|
07bda6 |
}
|
|
|
07bda6 |
- if (hostname == NULL && ple == NULL)
|
|
|
07bda6 |
+ if (hostname == NULL && ple == NULL) {
|
|
|
07bda6 |
+ printerr(0, "ERROR: %s: Invalid args\n", __func__);
|
|
|
07bda6 |
return EINVAL;
|
|
|
07bda6 |
-
|
|
|
07bda6 |
+ }
|
|
|
07bda6 |
code = krb5_init_context(&context);
|
|
|
07bda6 |
if (code) {
|
|
|
07bda6 |
k5err = gssd_k5_err_msg(NULL, code);
|