From c1fbb10ac6f6122547983b5f2cc40de484aec3b0 Mon Sep 17 00:00:00 2001 From: danw Date: Thu, 6 Aug 1998 18:13:42 +0000 Subject: [PATCH] add utility program to generate magic words for a given ID --- reg_svr/Makefile.in | 15 ++++++++++----- reg_svr/genwords.c | 46 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 reg_svr/genwords.c diff --git a/reg_svr/Makefile.in b/reg_svr/Makefile.in index e6bc799e..df86050b 100644 --- a/reg_svr/Makefile.in +++ b/reg_svr/Makefile.in @@ -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 index 00000000..e9f9705f --- /dev/null +++ b/reg_svr/genwords.c @@ -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 + * . + * + */ + +#include +#include +#include "reg_svr.h" + +#include +#include + +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); +} -- 2.45.2