1: #include <stdio.h>
2: #include <sys/types.h>
3: #include <netns/ns.h>
4: #include <netns/sp.h>
5: #include "Clearinghouse_defs.h"
6: #include <xnscourier/except.h>
7:
8: main(argc, argv)
9: int argc;
10: char *argv[];
11: {
12: LookupObjectResults result;
13: struct ns_addr *destaddr;
14: CourierConnection *conn;
15: extern struct ns_addr *getXNSaddr();
16: ObjectNamePattern name;
17: ObjectName myname;
18: char *mypwd;
19: extern char *getpass();
20: Authenticator agent;
21:
22: if (argc == 1)
23: /* default to Dandelion 2-272, 2-852-151-014 */
24: destaddr = getXNSaddr("8E0#00.00.AA.00.7D.E7");
25: else if (argc != 2 || (destaddr = getXNSaddr(argv[1]))==NULL) {
26: fprintf(stderr,"Usage: %s machine\n",argv[0]);
27: exit(1);
28: }
29: if ((conn = CourierOpen(destaddr)) == NULL) {
30: fprintf(stderr,"Can't open connection to %s\n",argv[1]);
31: exit(1);
32: }
33: myname.organization = name.organization = "Berkeley.EECS";
34: myname.domain = name.domain = "Evans";
35: name.object = "bill";
36: myname.object = "sklower";
37: mypwd = getpass("Password:");
38: MakeSimpleCredentialsAndVerifier(&myname, mypwd,
39: &agent.credentials,
40: &agent.verifier );
41:
42: DURING
43: result = LookupObject(conn,NULL,name,agent);
44: HANDLER {
45: switch (Exception.Code) {
46: case CallError:
47: fprintf(stderr,"Call error, %d\n",
48: CourierErrArgs(CallErrorArgs,problem));
49: break;
50: case ArgumentError:
51: fprintf(stderr,"Argument error (5d,%d)\n",
52: CourierErrArgs(ArgumentErrorArgs,problem),
53: CourierErrArgs(ArgumentErrorArgs,which) );
54: break;
55: case AuthenticationError:
56: fprintf(stderr,"Authentication error, %d\n",
57: CourierErrArgs(AuthenticationErrorArgs,problem)
58: );
59: break;
60: case WrongServer:
61: fprintf(stderr,"Wrong server. Try %s:%s:%s\n",
62: CourierErrArgs(WrongServerArgs,hint.object),
63: CourierErrArgs(WrongServerArgs,hint.domain),
64: CourierErrArgs(WrongServerArgs,hint.organization)
65: );
66: break;
67: default:
68: fprintf(stderr,"Some random error, code %d\n",
69: Exception.Code);
70: break;
71: }
72: exit(1);
73: } END_HANDLER;
74:
75: printf("returned %s:%s:%s\n",
76: result.distinguishedObject.object,
77: result.distinguishedObject.domain,
78: result.distinguishedObject.organization );
79: }
Defined functions
main
defined in line
8;
never used