From: Kevin Coffman Date: Fri, 12 Oct 2007 20:34:54 +0000 (-0400) Subject: Use printerr to print svcgssd downcall debugging info X-Git-Tag: nfs-utils-1-1-1~7 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=44f7f2f92038572663acf22b4fd8dc34640c8c81;p=nfs-utils.git Use printerr to print svcgssd downcall debugging info Rather than depending on modified qword_* functions to print svcgssd debugging information, use printerr in the downcall function. And while we're at it, label things so we know what we're looking at! Signed-off-by: Kevin Coffman Signed-off-by: Neil Brown --- diff --git a/utils/gssd/cacheio.c b/utils/gssd/cacheio.c index e24ef56..f47f1fa 100644 --- a/utils/gssd/cacheio.c +++ b/utils/gssd/cacheio.c @@ -153,17 +153,12 @@ void qword_addeol(char **bpp, int *lp) } static char qword_buf[8192]; -static char tmp_buf[8192]; void qword_print(FILE *f, char *str) { char *bp = qword_buf; int len = sizeof(qword_buf); qword_add(&bp, &len, str); fwrite(qword_buf, bp-qword_buf, 1, f); - /* XXX: */ - memcpy(tmp_buf, qword_buf, bp-qword_buf); - tmp_buf[bp-qword_buf] = '\0'; - printerr(2, "%s", tmp_buf); } void qword_printhex(FILE *f, char *str, int slen) @@ -172,16 +167,11 @@ void qword_printhex(FILE *f, char *str, int slen) int len = sizeof(qword_buf); qword_addhex(&bp, &len, str, slen); fwrite(qword_buf, bp-qword_buf, 1, f); - /* XXX: */ - memcpy(tmp_buf, qword_buf, bp-qword_buf); - tmp_buf[bp-qword_buf] = '\0'; - printerr(2, "%s", tmp_buf); } void qword_printint(FILE *f, int num) { fprintf(f, "%d ", num); - printerr(2, "%d ", num); } int qword_eol(FILE *f) @@ -189,7 +179,6 @@ int qword_eol(FILE *f) int err; fprintf(f,"\n"); err = fflush(f); - printerr(2, "\n"); return err; } diff --git a/utils/gssd/svcgssd_proc.c b/utils/gssd/svcgssd_proc.c index 52c3aaf..2dffa83 100644 --- a/utils/gssd/svcgssd_proc.c +++ b/utils/gssd/svcgssd_proc.c @@ -90,8 +90,14 @@ do_svc_downcall(gss_buffer_desc *out_handle, struct svc_cred *cred, qword_printint(f, cred->cr_uid); qword_printint(f, cred->cr_gid); qword_printint(f, cred->cr_ngroups); - for (i=0; i < cred->cr_ngroups; i++) + printerr(2, "mech: %s, hndl len: %d, ctx len %d, timeout: %d, " + "uid: %d, gid: %d, num aux grps: %d:\n", + fname, out_handle->length, context_token->length, 0x7fffffff, + cred->cr_uid, cred->cr_gid, cred->cr_ngroups); + for (i=0; i < cred->cr_ngroups; i++) { qword_printint(f, cred->cr_groups[i]); + printerr(2, " (%4d) %d\n", i+1, cred->cr_groups[i]); + } qword_print(f, fname); qword_printhex(f, context_token->value, context_token->length); err = qword_eol(f);