1: #include <stdio.h>
   2: #include <sys/types.h>
   3: #include <netns/ns.h>
   4: #include "Clearinghouse2_defs.h"
   5: #include <xnscourier/courier.h>
   6: #include <xnscourier/except.h>
   7: #include <xnscourier/CH.h>
   8: 
   9: main(argc, argv)
  10:     int argc;
  11:     char *argv[];
  12: {
  13:     ObjectName myname, name, hint;
  14:     struct xn_addr *destaddr, *getXNSaddr();
  15:     Authenticator agent;
  16:     CourierConnection *conn, *ch2conn;
  17:     int i;
  18:     ListPropertiesResults result;
  19:     char *pwd, *getXNSpass();
  20: 
  21:     if (argc < 2 || argc >4) {
  22:         fprintf(stderr,"Usage: %s name\n",argv[0]);
  23:         exit(1);
  24:     }
  25:     CH_NameDefault(&myname);
  26:     name = CH_StringToName(argv[1],&myname);
  27:     myname.object = pwd = "";
  28:     /* pwd = getXNSpass("Password:"); */
  29:     MakeSimpleCredsAndVerifier(&myname,pwd,
  30:             &agent.credentials, &agent.verifier);
  31:     if (argc > 2)
  32:         name.domain = argv[2];
  33:     if (argc > 3)
  34:         name.organization = argv[3];
  35:     if ((conn = CH_GetFirstCH()) == NULL) {
  36:         fprintf(stderr, "Can't open connection to local CH\n");
  37:         exit(1);
  38:     }
  39:     DURING
  40:         result = ListProperties(conn,NULL,name,agent);
  41:     HANDLER {
  42:         if (Exception.Code != WrongServer) {
  43:             fprintf(stderr,"Oops.  Error\n");
  44:             exit(1);
  45:         }
  46:         hint = CourierErrArgs(WrongServerArgs, hint);
  47:         ch2conn = CH_GetOtherCH(conn, hint);
  48:         CourierClose(conn);
  49:         if (ch2conn == NULL) {
  50:             fprintf(stderr,"Can't get to alternate CH\n");
  51:             exit(1);
  52:             }
  53:         conn = ch2conn;
  54:         DURING
  55:             result = ListProperties(conn,NULL,name,agent);
  56:         HANDLER {
  57:             fprintf(stderr,"Oops.  Error.\n");
  58:             exit(1);
  59:         } END_HANDLER;
  60:     } END_HANDLER;
  61:     CourierClose(conn);
  62:     printf("name: %s:%s:%s\n", result.distinguishedObject.object,
  63:             result.distinguishedObject.domain,
  64:             result.distinguishedObject.organization);
  65:     for (i = 0; i < result.properties.length; i++)
  66:         printf("\t%d:  %d\n",i,result.properties.sequence[i]>>16);
  67: }

Defined functions

main defined in line 9; never used
Last modified: 1986-03-13
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 863
Valid CSS Valid XHTML 1.0 Strict