1: #include <stdio.h>
   2: #include <sys/types.h>
   3: #include <netns/ns.h>
   4: #include "Clearinghouse2_defs.h"
   5: #include <xnscourier/except.h>
   6: 
   7: extern GetData();
   8: 
   9: main(argc, argv)
  10:     int argc;
  11:     char *argv[];
  12: {
  13:     ListAliasesOfResults result;
  14:     struct ns_addr *destaddr;
  15:     CourierConnection *conn;
  16:     extern struct ns_addr *getXNSaddr();
  17:     ObjectNamePattern name;
  18:     ObjectName myname;
  19:     extern char *getpass();
  20:     Authenticator agent;
  21: 
  22:     if (argc != 2) {
  23:         fprintf(stderr,"Usage: %s alias\n",argv[0]);
  24:         exit(1);
  25:     }
  26:         /* default to CornellS1 2-273, 2-852-151-014 */
  27:     destaddr = getXNSaddr("8E0#00.00.AA.00.7D.E7");
  28:     if ((conn = CourierOpen(destaddr)) == NULL) {
  29:         fprintf(stderr,"Can't open connection to %s\n",argv[1]);
  30:         exit(1);
  31:     }
  32:     name.organization = "Berkeley.EECS";
  33:     name.domain = "Evans";
  34:     name.object = argv[1];
  35:     /* use a null credentials&verifier */
  36:     myname.organization = myname.domain = myname.object = "";
  37:     MakeSimpleCredentialsAndVerifier(&myname, "",
  38:         &agent.credentials, &agent.verifier );
  39:     printf("Aliases:\n");
  40: 
  41:     DURING
  42:         result = ListAliasesOf(conn, GetData, name,
  43:             BulkData_immediateSink, 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:             switch (CourierErrArgs(ArgumentErrorArgs,problem)) {
  52:             case illegalOrganizationName:
  53:             case illegalDomainName:
  54:             case illegalObjectName:
  55:                 fprintf(stderr,
  56:                     "%s:%s:%s has bad format\n",
  57:                     name.object, name.domain,
  58:                     name.organization);
  59:                 break;
  60:             case noSuchOrganization:
  61:                 fprintf(stderr,
  62:                     "%s does not exist\n",
  63:                     name.organization);
  64:                 break;
  65:             case noSuchDomain:
  66:                 fprintf(stderr,
  67:                     "%s:%s does not exist\n",
  68:                     name.domain,
  69:                     name.organization);
  70:                 break;
  71:             case noSuchObject:
  72:                 fprintf(stderr,"No such object as %s:%s:%s\n",
  73:                     name.object, name.domain,
  74:                     name.organization);
  75:                 break;
  76:             default:
  77:                 fprintf(stderr,"Argument error (%d,%d)\n",
  78:                     CourierErrArgs(ArgumentErrorArgs,problem),
  79:                     CourierErrArgs(ArgumentErrorArgs,which) );
  80:                 break;
  81:             }
  82:             break;
  83:         case AuthenticationError:
  84:             fprintf(stderr,"Authentication error, %d\n",
  85:                 CourierErrArgs(AuthenticationErrorArgs,problem)
  86:                 );
  87:             break;
  88:         case WrongServer:
  89:             fprintf(stderr,"Wrong server.  Try %s:%s:%s\n",
  90:                 CourierErrArgs(WrongServerArgs,hint.object),
  91:                 CourierErrArgs(WrongServerArgs,hint.domain),
  92:                 CourierErrArgs(WrongServerArgs,hint.organization)
  93:                 );
  94:             break;
  95:         case PropertyError:
  96:             fprintf(stderr,"Property error %d in %s:%s:%s\n",
  97:                 CourierErrArgs(PropertyErrorArgs,problem),
  98:                 CourierErrArgs(PropertyErrorArgs,distinguishedObject.object),
  99:                 CourierErrArgs(PropertyErrorArgs,distinguishedObject.domain),
 100:                 CourierErrArgs(PropertyErrorArgs,distinguishedObject.organization)
 101:                 );
 102:             break;
 103:         default:
 104:             fprintf(stderr,"Some random error, code %d\n",
 105:                 Exception.Code);
 106:             break;
 107:         }
 108:     exit(1);
 109:     } END_HANDLER;
 110: 
 111:     printf("Distinguished name:\n\t%s:%s:%s\n",
 112:         result.distinguishedObject.object,
 113:         result.distinguishedObject.domain,
 114:         result.distinguishedObject.organization );
 115: }

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: 1141
Valid CSS Valid XHTML 1.0 Strict