]> andersk Git - moira.git/blame - update/smskey.c
Fixes to build with `gcc' instead of `gcc -traditional' on suns. (Needed
[moira.git] / update / smskey.c
CommitLineData
546bc43b 1/* $Header$ */
2
3/* (c) Copyright 1988 by the Massachusetts Institute of Technology. */
4/* For copying and distribution information, please see the file */
5/* <mit-copyright.h>. */
6
7
8#include <mit-copyright.h>
7effed7d 9#include <stdio.h>
10#include <sys/file.h>
11#include <des.h>
12int debug=0; /* goddamn des library breakage */
13char string[] = "sms\0\0Athena\0\1";
14char srvtab[] = "/etc/srvtab";
15char insecure[] =
16 "\7\7\7This program MUST be run on the console, for security reasons.\n";
17
18main(argc,argv)
19 int argc;
20 char **argv;
21{
22 int fd;
23 C_Block key;
24 char *tty, *ttyname();
25 tty = ttyname(0);
26 if (!tty || strcmp(tty, "/dev/console")) {
27 fprintf(stderr, insecure);
28 exit(1);
29 }
30 fd = open(srvtab, O_WRONLY|O_APPEND, 0);
31 if (!fd) {
32 perror(srvtab);
33 exit(1);
34 }
35 if (sizeof(string)-1 != 13) {
36 fprintf(stderr, "string size bad\n");
37 exit(1);
38 }
39 des_read_password(key, "Enter SMS update password: ", 0);
40 write(fd, string, sizeof(string)-1);
41 write(fd, key, sizeof(C_Block));
42 if (fsync(fd))
43 perror(srvtab);
44 close(fd);
45 printf("\nKey written.\n");
46}
This page took 0.074875 seconds and 5 git commands to generate.