]>
Commit | Line | Data |
---|---|---|
a3cf6921 | 1 | /* |
2 | * $Source$ | |
3 | * $Author$ | |
4 | * $Header$ | |
5 | * | |
6 | * Copyright (C) 1987 by the Massachusetts Institute of Technology | |
7 | * | |
8 | * $Log$ | |
f17535a4 | 9 | * Revision 1.3 1987-08-04 02:41:29 wesommer |
10 | * Clean up messages. | |
a3cf6921 | 11 | * |
f17535a4 | 12 | * Revision 1.2 87/06/21 16:42:12 wesommer |
13 | * Performance work, rearrangement of include files. | |
14 | * | |
c27b3454 | 15 | * Revision 1.1 87/06/02 20:07:18 wesommer |
16 | * Initial revision | |
17 | * | |
a3cf6921 | 18 | */ |
19 | ||
20 | #ifndef lint | |
21 | static char *rcsid_sms_shutdown_c = "$Header$"; | |
22 | #endif lint | |
23 | ||
24 | #include <strings.h> | |
25 | #include <sys/errno.h> | |
a3cf6921 | 26 | #include "sms_server.h" |
27 | ||
28 | extern char *takedown; | |
29 | extern char *whoami; | |
30 | ||
31 | sigshut() | |
32 | { | |
33 | takedown = "Shut down by signal."; | |
34 | } | |
35 | ||
36 | void | |
37 | do_shutdown(cl) | |
38 | client *cl; | |
39 | { | |
40 | static char buf[BUFSIZ]; | |
41 | ||
42 | if (cl->args->sms_argc != 1) { | |
43 | cl->reply.sms_status = EINVAL; | |
44 | return; | |
45 | } | |
46 | ||
47 | if (!cl->clname) { | |
f17535a4 | 48 | com_err(whoami, 0, "Unauthenticated shutdown request rejected", |
49 | cl->clname); | |
a3cf6921 | 50 | cl->reply.sms_status = EACCES; |
51 | return; | |
52 | } | |
53 | if (!strcmp(cl->clname, "wesommer@ATHENA.MIT.EDU") || | |
54 | !strcmp(cl->clname, "mike@ATHENA.MIT.EDU")) { | |
f17535a4 | 55 | com_err(whoami, 0, "Shut down by %s", cl->clname); |
a3cf6921 | 56 | (void) strcpy(buf, "Reason for shutdown: "); |
57 | (void) strcat(buf, cl->args->sms_argv[0]); | |
58 | takedown = buf; | |
59 | } else { | |
f17535a4 | 60 | com_err(whoami, 0, "Shutdown request by %s rejected", |
61 | cl->clname); | |
a3cf6921 | 62 | cl->reply.sms_status = EACCES; |
63 | } | |
64 | } | |
65 |