~ubuntu-branches/ubuntu/hardy/nfs-utils/hardy-updates

« back to all changes in this revision

Viewing changes to utils/gssd/svcgssd_proc.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2007-11-14 04:52:46 UTC
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20071114045246-37yxn6na36segpuh
Tags: upstream-1.1.1
ImportĀ upstreamĀ versionĀ 1.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
#include <fcntl.h>
46
46
#include <errno.h>
47
47
#include <nfsidmap.h>
 
48
#include <nfslib.h>
48
49
 
49
50
#include "svcgssd.h"
50
51
#include "gss_util.h"
51
52
#include "err_util.h"
52
53
#include "context.h"
53
 
#include "cacheio.h"
54
54
 
55
55
extern char * mech2file(gss_OID mech);
56
56
#define SVCGSSD_CONTEXT_CHANNEL "/proc/net/rpc/auth.rpcsec.context/channel"
90
90
        qword_printint(f, cred->cr_uid);
91
91
        qword_printint(f, cred->cr_gid);
92
92
        qword_printint(f, cred->cr_ngroups);
93
 
        for (i=0; i < cred->cr_ngroups; i++)
 
93
        printerr(2, "mech: %s, hndl len: %d, ctx len %d, timeout: %d, "
 
94
                 "uid: %d, gid: %d, num aux grps: %d:\n",
 
95
                 fname, out_handle->length, context_token->length, 0x7fffffff,
 
96
                 cred->cr_uid, cred->cr_gid, cred->cr_ngroups);
 
97
        for (i=0; i < cred->cr_ngroups; i++) {
94
98
                qword_printint(f, cred->cr_groups[i]);
 
99
                printerr(2, "  (%4d) %d\n", i+1, cred->cr_groups[i]);
 
100
        }
95
101
        qword_print(f, fname);
96
102
        qword_printhex(f, context_token->value, context_token->length);
97
103
        err = qword_eol(f);
250
256
        return res;
251
257
}
252
258
 
 
259
#ifdef DEBUG
253
260
void
254
 
print_hexl(int pri, unsigned char *cp, int length)
 
261
print_hexl(const char *description, unsigned char *cp, int length)
255
262
{
256
263
        int i, j, jm;
257
264
        unsigned char c;
258
265
 
259
 
        printerr(pri, "length %d\n",length);
260
 
        printerr(pri, "\n");
 
266
        printf("%s (length %d)\n", description, length);
261
267
 
262
268
        for (i = 0; i < length; i += 0x10) {
263
 
                printerr(pri, "  %04x: ", (u_int)i);
 
269
                printf("  %04x: ", (u_int)i);
264
270
                jm = length - i;
265
271
                jm = jm > 16 ? 16 : jm;
266
272
 
267
273
                for (j = 0; j < jm; j++) {
268
274
                        if ((j % 2) == 1)
269
 
                                printerr(pri,"%02x ", (u_int)cp[i+j]);
 
275
                                printf("%02x ", (u_int)cp[i+j]);
270
276
                        else
271
 
                                printerr(pri,"%02x", (u_int)cp[i+j]);
 
277
                                printf("%02x", (u_int)cp[i+j]);
272
278
                }
273
279
                for (; j < 16; j++) {
274
280
                        if ((j % 2) == 1)
275
 
                                printerr(pri,"   ");
 
281
                                printf("   ");
276
282
                        else
277
 
                                printerr(pri,"  ");
 
283
                                printf("  ");
278
284
                }
279
 
                printerr(pri," ");
 
285
                printf(" ");
280
286
 
281
287
                for (j = 0; j < jm; j++) {
282
288
                        c = cp[i+j];
283
289
                        c = isprint(c) ? c : '.';
284
 
                        printerr(pri,"%c", c);
 
290
                        printf("%c", c);
285
291
                }
286
 
                printerr(pri,"\n");
 
292
                printf("\n");
287
293
        }
288
294
}
 
295
#endif
289
296
 
290
297
void
291
298
handle_nullreq(FILE *f) {
326
333
 
327
334
        in_handle.length = (size_t) qword_get(&cp, in_handle.value,
328
335
                                              sizeof(in_handle_buf));
329
 
        printerr(2, "in_handle: \n");
330
 
        print_hexl(2, in_handle.value, in_handle.length);
 
336
#ifdef DEBUG
 
337
        print_hexl("in_handle", in_handle.value, in_handle.length);
 
338
#endif
331
339
 
332
340
        in_tok.length = (size_t) qword_get(&cp, in_tok.value,
333
341
                                           sizeof(in_tok_buf));
334
 
        printerr(2, "in_tok: \n");
335
 
        print_hexl(2, in_tok.value, in_tok.length);
 
342
#ifdef DEBUG
 
343
        print_hexl("in_tok", in_tok.value, in_tok.length);
 
344
#endif
336
345
 
337
346
        if (in_tok.length < 0) {
338
347
                printerr(0, "WARNING: handle_nullreq: "