From: spook Date: Mon, 24 Aug 1987 07:56:25 +0000 (+0000) Subject: Initial revision X-Git-Tag: BETA5-24-88~88 X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/7effed7de1db59f65fbedd83fd3e1e9292c245eb Initial revision --- diff --git a/update/smskey.c b/update/smskey.c new file mode 100644 index 00000000..f79b998d --- /dev/null +++ b/update/smskey.c @@ -0,0 +1,38 @@ +#include +#include +#include +int debug=0; /* goddamn des library breakage */ +char string[] = "sms\0\0Athena\0\1"; +char srvtab[] = "/etc/srvtab"; +char insecure[] = + "\7\7\7This program MUST be run on the console, for security reasons.\n"; + +main(argc,argv) + int argc; + char **argv; +{ + int fd; + C_Block key; + char *tty, *ttyname(); + tty = ttyname(0); + if (!tty || strcmp(tty, "/dev/console")) { + fprintf(stderr, insecure); + exit(1); + } + fd = open(srvtab, O_WRONLY|O_APPEND, 0); + if (!fd) { + perror(srvtab); + exit(1); + } + if (sizeof(string)-1 != 13) { + fprintf(stderr, "string size bad\n"); + exit(1); + } + des_read_password(key, "Enter SMS update password: ", 0); + write(fd, string, sizeof(string)-1); + write(fd, key, sizeof(C_Block)); + if (fsync(fd)) + perror(srvtab); + close(fd); + printf("\nKey written.\n"); +}