From: tytso Date: Fri, 7 Feb 1997 19:44:08 +0000 (+0000) Subject: Change #ifdef GDSS to #ifdef DO_GDSS, because GDSS was getting #undef'ed X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/7ce1db3366b00d100225ce31e8d34586705d6cb8 Change #ifdef GDSS to #ifdef DO_GDSS, because GDSS was getting #undef'ed in Imake.rules. Change the warehouse program to be only built when GDSS is available. --- diff --git a/gen/Imakefile b/gen/Imakefile index 7f3a359c..91bc13c9 100644 --- a/gen/Imakefile +++ b/gen/Imakefile @@ -9,7 +9,7 @@ # SRCDIR = $(SRCTOP)/gen -#ifdef GDSS +#ifdef DO_GDSS SRCS = util.c moddiff.c passwd.c hesiod.c \ nfs.c mailhub.c sis.c pobox.c \ hosts.c network.c warehouse.c @@ -22,20 +22,20 @@ CODE = util.c moddiff.pc passwd.pc hesiod.pc \ LIBS = -L/usr/athena/lib ../lib/libmoira.a -lcom_err -lzephyr \ ../server/libmrglue.a $(LIBGDSS) -lkrb -ldes -lhesiod ${SQL_LIB} DEFINES = $(GDSSINC) -#else /* GDSS */ +#else /* DO_GDSS */ SRCS = util.c moddiff.c passwd.c hesiod.c \ nfs.c mailhub.c pobox.c \ - hosts.c network.c warehouse.c + hosts.c network.c OBJS = util.o moddiff.o passwd.o hesiod.o \ nfs.o mailhub.o pobox.o \ - hosts.o network.o warehouse.o + hosts.o network.o CODE = util.c moddiff.pc passwd.pc hesiod.pc \ nfs.pc mailhub.pc pobox.pc \ - hosts.pc network.pc warehouse.pc + hosts.pc network.pc LIBS = -L/usr/athena/lib ../lib/libmoira.a -lcom_err -lzephyr \ ../server/libmrglue.a -lkrb -ldes -lhesiod ${SQL_LIB} DEFINES = -#endif /* GDSS */ +#endif /* DO_GDSS */ sqlrule() program(passwd.gen, passwd.o util.o moddiff.o,${MR_LIBDEP},${LIBS},${PROGDIR}) @@ -47,9 +47,11 @@ program(nfs.gen, nfs.o util.o moddiff.o,${MR_LIBDEP},${LIBS},${PROGDIR}) sqlfile(nfs) program(mailhub.gen, mailhub.o util.o moddiff.o,${MR_LIBDEP},${LIBS},${PROGDIR}) sqlfile(mailhub) -#ifdef GDSS +#ifdef DO_GDSS program(sis.gen, sis.o util.o moddiff.o,${MR_LIBDEP},${LIBS},${PROGDIR}) sqlfile(sis) +program(warehouse.gen, warehouse.o util.o moddiff.o,${MR_LIBDEP},${LIBS},${PROGDIR}) +sqlfile(warehouse) #endif program(pobox.gen, pobox.o util.o moddiff.o,${MR_LIBDEP},${LIBS},${PROGDIR}) sqlfile(pobox) @@ -57,6 +59,4 @@ program(hosts.gen, hosts.o util.o moddiff.o,${MR_LIBDEP},${LIBS},${PROGDIR}) sqlfile(hosts) program(network.gen, network.o util.o moddiff.o,${MR_LIBDEP},${LIBS},${PROGDIR}) sqlfile(network) -program(warehouse.gen, warehouse.o util.o moddiff.o,${MR_LIBDEP},${LIBS},${PROGDIR}) -sqlfile(warehouse) diff --git a/gen/warehouse.pc b/gen/warehouse.pc index 1ec74544..4403037f 100644 --- a/gen/warehouse.pc +++ b/gen/warehouse.pc @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -24,7 +25,7 @@ EXEC SQL INCLUDE sqlca; extern int errno; -char *whoami = "warehouse.gen"; +char *whoami = "sis.gen"; char *db = "moira/moira"; main(argc, argv) @@ -35,20 +36,15 @@ char **argv; char *outf = NULL, outft[64]; struct stat sb; int flag1; + SigInfo si; struct timeval now; EXEC SQL BEGIN DECLARE SECTION; - char login[9], signature[68], clearid[17], kname[257]; - EXEC SQL VAR signature IS STRING(68); - char last[17], first[17], middle[17], type[9]; - int sigdate, sigwho; - struct { char clearid[17]; - char login[12]; - char last[17]; - char middle[17]; - char first[17]; - char sigdate[12]; - char sigwho[60]; - char signature[69]; + char login[9], sig[257], id[17], kname[257]; + EXEC SQL VAR sig IS STRING(257); + int timestamp, sigwho; + struct { char login[12]; + char id[12]; + char sig[256]; } outrec; EXEC SQL END DECLARE SECTION; @@ -85,35 +81,27 @@ char **argv; EXEC SQL WHENEVER SQLERROR GOTO sqlerr; EXEC SQL DECLARE x CURSOR FOR - SELECT u.clearid, u.login, u.last, u.first, u.middle, u.type, - u.sigdate, u.sigwho, u.signature - FROM users u WHERE u.status = 1 or u.status=5 or u.status=6; + SELECT u.login, u.clearid, u.signature, u.sigdate, s.string, u.sigwho + FROM users u, strings s + WHERE u.status = 1 and u.sigwho = s.string_id; EXEC SQL OPEN x; while (1) { - EXEC SQL FETCH x INTO :clearid, :login, :last, :first, - :middle, :type, :sigdate, :sigwho, :signature; + EXEC SQL FETCH x INTO :login, :id, :sig, :timestamp, :kname, :sigwho; if (sqlca.sqlcode != 0) break; + if (id == 0) continue; if (!isdigit(id[1])) continue; strtrim(login); - strtrim(clearid); - strtrim(last); - strtrim(first); - strtrim(middle); - strtrim(type); + strtrim(id); + strtrim(kname); memset(&outrec, 0, sizeof(outrec)); strcpy(outrec.login, login); strcpy(outrec.id, id); - strcpy(outrec.last, last); - strcpy(outrec.first, first); - strcpy(outrec.middle, middle); - strcpy(outrec.type, type); if (sigwho) { - sprintf(outrec.sigdate, "%d", sigdate); - memcpy(outrec.signature, signature, sizeof(signature)); - EXEC SQL SELECT string from strings - WHERE string_id = :sigwho - INTO :kname; - strcpy(outrec.sigwho, kname); + si.timestamp = timestamp; + si.SigInfoVersion = 0; /* XXXXXX this isn't used */ + kname_parse(si.pname, si.pinst, si.prealm, kname); + si.rawsig = (unsigned char *)sig; + GDSS_Recompose(&si, outrec.sig); } write(out, &outrec, sizeof(outrec)); }