REG_OBJS= kerberos.o protocol.o reg_svr.o words.o
START_OBJS= startreg.o
-GEN_OBJS= genkey.o
+GENKEY_OBJS= genkey.o
+GENWORDS_OBJS= genwords.o words.o
CFILES= reg_svr.c
-TARGET= reg_svr startreg genkey
+TARGET= reg_svr startreg genkey genwords
.SUFFIXES: .pc
all: $(TARGET)
clean:
- rm -f $(REG_OBJS) $(START_OBJS) $(CFILES) $(TARGET)
+ rm -f $(REG_OBJS) $(START_OBJS) $(GENKEY_OBJS) $(GENWORDS_OBJS) \
+ $(CFILES) $(TARGET)
depend: $(CFILES)
startreg: $(START_OBJS)
$(CC) -o $@ $(LDFLAGS) $(START_OBJS) $(LIBS)
-genkey: $(GEN_OBJS)
- $(CC) -o $@ $(LDFLAGS) $(GEN_OBJS) $(LIBS)
+genkey: $(GENKEY_OBJS)
+ $(CC) -o $@ $(LDFLAGS) $(GENKEY_OBJS) $(LIBS)
+
+genwords: $(GENWORDS_OBJS)
+ $(CC) -o $@ $(LDFLAGS) $(GENWORDS_OBJS) $(LIBS)
--- /dev/null
+/* $Id$
+ *
+ * Utility program to generate magic words for a given ID
+ *
+ * Copyright (C) 1998 by the Massachusetts Institute of Technology
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
+ *
+ */
+
+#include <mit-copyright.h>
+#include <moira.h>
+#include "reg_svr.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+RCSID("$Header$");
+
+int main(int argc, char **argv)
+{
+ char *words[6];
+
+ if (argc != 2)
+ {
+ fprintf(stderr, "Usage: genwords id\n");
+ exit(1);
+ }
+
+ if (!read_hmac_key())
+ {
+ fprintf(stderr, "Couldn't read hmac key\n");
+ exit(1);
+ }
+
+ getwordlist(argv[1], words);
+ printf("%s %s %s %s %s %s\n", words[0], words[1], words[2],
+ words[3], words[4], words[5]);
+}
+
+/* used by words.c */
+void *xmalloc(size_t size)
+{
+ /* we won't run out of memory here */
+ return malloc(size);
+}