]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Use printerr to print svcgssd downcall debugging info
authorKevin Coffman <kwc@citi.umich.edu>
Fri, 12 Oct 2007 20:34:54 +0000 (16:34 -0400)
committerNeil Brown <neilb@suse.de>
Sun, 14 Oct 2007 23:50:55 +0000 (09:50 +1000)
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 <kwc@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
utils/gssd/cacheio.c
utils/gssd/svcgssd_proc.c

index e24ef56f7970dd17e5219e12d7ccc2d6f4cad8b0..f47f1fa9d9be936713dd556163f7dad09f881ab8 100644 (file)
@@ -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;
 }
 
index 52c3aaf05c03fa3f55d42b5401f15222f499e9a5..2dffa83b195f82526acddab3eb085314ac354442 100644 (file)
@@ -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);