1: /*
   2:  * Server for PasswordLookup.
   3:  */
   4: #include "PasswordLookup_support.c"
   5: #include <except.h>
   6: 
   7: extern CourierConnection *_serverConnection;
   8: 
   9: extern LookupUidResults LookupUid();
  10: 
  11: server_LookupUid(_buf)
  12:     register Unspecified *_buf;
  13: {
  14:     register Unspecified *_bp = _buf;
  15:     register LongCardinal _n;
  16:     Cardinal uid;
  17:     LookupUidResults _Results;
  18: 
  19:     _bp += internalize_Cardinal(&uid, _bp);
  20:     _Results = LookupUid(_serverConnection, 0, uid);
  21:     _n = sizeof_LookupUidResults(&_Results);
  22:     _bp = Allocate(_n);
  23:     externalize_LookupUidResults(&_Results, _bp);
  24:     SendReturnMessage(_n, _bp);
  25:     Deallocate(_bp);
  26: }
  27: 
  28: extern LookupUserResults LookupUser();
  29: 
  30: server_LookupUser(_buf)
  31:     register Unspecified *_buf;
  32: {
  33:     register Unspecified *_bp = _buf;
  34:     register LongCardinal _n;
  35:     String user;
  36:     LookupUserResults _Results;
  37: 
  38:     _bp += internalize_String(&user, _bp);
  39:     _Results = LookupUser(_serverConnection, 0, user);
  40:     _n = sizeof_LookupUserResults(&_Results);
  41:     _bp = Allocate(_n);
  42:     externalize_LookupUserResults(&_Results, _bp);
  43:     SendReturnMessage(_n, _bp);
  44:     Deallocate(_bp);
  45: }
  46: 
  47: Server()
  48: {
  49:     Cardinal _procedure;
  50:     register Unspecified *_buf;
  51:     Cardinal _n;
  52: 
  53:     for (;;) {
  54:         if (LookAheadCallMessage(PasswordLookup_NUMBER, PasswordLookup_VERSION))
  55:             break;
  56:         _buf = ReceiveCallMessage(&_procedure);
  57:         DURING switch (_procedure) {
  58:         case 1:
  59:             server_LookupUser(_buf);
  60:             break;
  61:         case 0:
  62:             server_LookupUid(_buf);
  63:             break;
  64:         default:
  65:             NoSuchProcedureValue("PasswordLookup", _procedure);
  66:             break;
  67:         } HANDLER {
  68:             Deallocate(_buf);
  69:             switch (&Exception.Code) {
  70:             case OtherError:
  71:             _n = sizeof_T_cn754_2((T_cn754_2 *)Exception.Message);
  72:             _buf = Allocate(_n);
  73:             (void) externalize_T_cn754_2((T_cn754_2*)Exception.Message, _buf);
  74:             SendAbortMessage(Exception.Code-ERROR_OFFSET, _n, _buf);
  75:             break;
  76:             case NoSuchUser:
  77:             _buf = Allocate(0);
  78:             SendAbortMessage(Exception.Code-ERROR_OFFSET, 0, _buf);
  79:             break;
  80:             default:
  81:             _buf = Allocate(0);
  82:             SendRejectMessage(unspecifiedError, 0, _buf);
  83:             break;
  84:             }
  85:         } END_HANDLER;
  86:         Deallocate(_buf);
  87:     }
  88: }

Defined functions

Server defined in line 47; never used
server_LookupUid defined in line 11; used 1 times
  • in line 62
server_LookupUser defined in line 30; used 1 times
  • in line 59
Last modified: 1986-03-13
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 593
Valid CSS Valid XHTML 1.0 Strict