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