]> andersk Git - moira.git/commitdiff
add utility program to generate magic words for a given ID
authordanw <danw>
Thu, 6 Aug 1998 18:13:42 +0000 (18:13 +0000)
committerdanw <danw>
Thu, 6 Aug 1998 18:13:42 +0000 (18:13 +0000)
reg_svr/Makefile.in
reg_svr/genwords.c [new file with mode: 0644]

index e6bc799e2bc273a3d61ec7f3a0b537cacf583bca..df86050b60b37da55657dbd446459971d80eb060 100644 (file)
@@ -27,11 +27,12 @@ mrbindir=@mrbindir@
 
 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
 
@@ -44,7 +45,8 @@ TARGET=               reg_svr startreg genkey
 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)
 
@@ -58,5 +60,8 @@ reg_svr: $(REG_OBJS)
 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)
diff --git a/reg_svr/genwords.c b/reg_svr/genwords.c
new file mode 100644 (file)
index 0000000..e9f9705
--- /dev/null
@@ -0,0 +1,46 @@
+/* $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);
+}
This page took 0.038834 seconds and 5 git commands to generate.