source: trunk/athena/bin/olc/clients/motif/x_hand_resp.c @ 1995

Revision 1995, 4.9 KB checked in by vanharen, 35 years ago (diff)
errors to stderr now directed to a routine that will popup an error dialog (not yet tested). also added RCS comment headers
Line 
1/*
2 * This file is part of the OLC On-Line Consulting System.
3 * It contains procedures for dealing with motd's.
4 *
5 *      Win Treese
6 *      Dan Morgan
7 *      Bill Saphir
8 *      MIT Project Athena
9 *
10 *      Ken Raeburn
11 *      MIT Information Systems
12 *
13 *      Tom Coppeto
14 *      Chris VanHaren
15 *      MIT Project Athena
16 *
17 *      Copyright (c) 1989 by the Massachusetts Institute of Technology
18 *
19 *      $Source: /afs/dev.mit.edu/source/repository/athena/bin/olc/clients/motif/x_hand_resp.c,v $
20 *      $Author: vanharen $
21 */
22
23
24#ifndef lint
25static char rcsid[]= "$Header: /afs/dev.mit.edu/source/repository/athena/bin/olc/clients/motif/x_hand_resp.c,v 1.2 1989-07-31 15:11:28 vanharen Exp $";
26#endif
27
28#include "xolc.h"
29
30int
31handle_response(response, req)
32     int response;
33     REQUEST *req;
34{
35  char message[256];
36#ifdef KERBEROS
37  char *kmessage = "\nYou will have been properly authenticated when you do not see this\nmessage the next time you run olc. If you were having trouble\nwith a program, try again.\n\nIf you continue to have difficulty, feel free to contact a user\nconsultant by phone. Schedules and phone numbers are posted in\nthe clusters.";
38#endif KERBEROS
39
40  switch(response)
41    {
42    case UNKNOWN_REQUEST:
43      popup_error("This function cannot be performed by the OLC server.\nWhat you want is down the hall to the left.");
44      return(NO_ACTION);
45
46    case SIGNED_OFF:
47      popup_error("You have signed off of OLC.");
48      return(SUCCESS);
49
50    case NOT_SIGNED_ON:
51      if(string_eq(req->target.username,req->requester.username))
52        popup_error("You are not signed on to OLC.");
53      else {
54        sprintf(message, "%s (%d) is not signed on to OLC.",
55                req->target.username,req->target.instance);
56        popup_error(message);
57      }
58      return(NO_ACTION);
59
60    case NO_QUESTION:
61      sprintf(message,"%s (%d) does not have a question.",
62              req->target.username, req->target.instance);
63      popup_error(message);
64      return(ERROR);
65
66    case HAS_QUESTION:
67      popup_error("You have a question.");
68      return(ERROR);
69
70    case NOT_CONNECTED:
71      if(string_eq(req->target.username,req->requester.username))
72        popup_error("You are not connected nor do you seem to have a question.\nPerhaps you should ask one.\n");
73      else {
74        sprintf(message,"%s (%d) is not connected nor is asking a question.\n",
75                req->target.username,req->target.instance);
76        popup_error(message);
77      }
78      return(NO_ACTION);
79
80    case PERMISSION_DENIED:
81      popup_error("You are not allowed to do that.");
82      return(NO_ACTION);
83
84    case TARGET_NOT_FOUND:
85      sprintf(message, "Target user %s (%d) unknown.\n",  req->target.username,
86              req->target.instance);
87      popup_error(message);
88      return(ERROR);
89
90    case REQUESTER_NOT_FOUND:
91      sprintf(message, "You [%s (%d)] are unknown.\n",
92              req->requester.username,
93              req->requester.instance);
94      popup_error(message);
95      return(ERROR);
96
97    case INSTANCE_NOT_FOUND:
98      popup_error("Incorrect instance specified.");
99      return(ERROR);
100
101    case ERROR:
102      popup_error("Error response from daemon.");
103      return(ERROR);
104
105    case USER_NOT_FOUND:
106      sprintf(message, "User, %s, not found.\n",req->target.username);
107      popup_error(message);
108      return(ERROR);
109
110#ifdef KERBEROS     /* these error codes are < 100 */
111    case MK_AP_TGTEXP:
112    case RD_AP_EXP:
113      fprintf(stderr, "(%s)\n",krb_err_txt[response]);
114      printf("Your Kerberos ticket has expired. ");
115      printf("To renew your Kerberos tickets,\n");
116      printf("type:    kinit\n");
117      if(OLC)
118        printf("%s\n",kmessage);
119      exit(ERROR);
120    case NO_TKT_FIL:
121      fprintf(stderr, "(%s)\n",krb_err_txt[response]);
122      printf("You do not have a Kerberos ticket file. To ");
123      printf("get one, \ntype:    kinit\n");
124      if(OLC)
125        printf("%s\n",kmessage);
126      exit(ERROR);
127    case TKT_FIL_ACC:
128      fprintf(stderr, "(%s)\n",krb_err_txt[response]);
129      printf("Cannot access your Kerberos ticket file.\n");
130      printf("Try:              setenv   KRBTKFILE  /tmp/random\n");
131      printf("                  kinit\n");
132      if(OLC)
133        printf("%s\n",kmessage);
134      exit(ERROR);
135    case RD_AP_TIME:
136      fprintf(stderr, "(%s)\n",krb_err_txt[response]);
137      printf("Kerberos authentication failed: workstation clock is");
138      printf("incorrect.\nPlease contact Athena operations and move to ");
139      printf("another worstation.\n");
140      if(OLC)
141        printf("%s\n",kmessage);
142      exit(ERROR);
143#endif KERBEROS
144
145    case SUCCESS:
146      return(SUCCESS);
147
148    default:
149      fprintf(stderr, "Unknown response %d (fascinating)\n", response);
150      return(ERROR);
151    }
152}
153
154popup_error(message)
155     char *message;
156{
157  Arg arg;
158
159  fprintf(stderr, message);
160  XtSetArg(arg, XmNmessageString, XmStringLtoRCreate(message, ""));
161  XtSetValues(w_error_dlg, &arg, 1);
162  XtManageChild(w_error_dlg);
163}
Note: See TracBrowser for help on using the repository browser.