From 98a7b0ee390f2563b658c50d6dc72e77d2ba68b1 Mon Sep 17 00:00:00 2001 From: danw Date: Fri, 5 Sep 1997 19:14:43 +0000 Subject: [PATCH] Fixes to build with `gcc' instead of `gcc -traditional' on suns. (Needed on 2.5.1 because of ANSIfied headers in /usr/include) --- clients/moira/utils.c | 4 ++-- gdb/gdb_conn.c | 2 +- gen/moddiff.pc | 10 +++++----- gen/warehouse.pc | 2 +- incremental/afs.c | 2 +- lib/Imakefile | 4 ++++ reg_svr/reg_svr.c | 15 ++++++++++----- reg_svr/requests.c | 10 ++++++---- regtape/Imakefile | 4 ++++ regtape/employee.pc | 8 +------- regtape/rafnu.c | 9 +++++---- server/mr_scall.c | 1 + server/mr_server.h | 3 ++- server/mr_util.c | 8 ++++---- update/auth_002.c | 2 +- update/client.c | 2 +- util/imake.includes/Imake.rules | 2 +- util/imake.includes/config.Imakefile | 8 ++++++-- 18 files changed, 56 insertions(+), 40 deletions(-) diff --git a/clients/moira/utils.c b/clients/moira/utils.c index f3a9c6f0..b658cbb2 100644 --- a/clients/moira/utils.c +++ b/clients/moira/utils.c @@ -642,10 +642,10 @@ char *str; char *atot(itime) char *itime; { - int time; + time_t time; char *ct, *ctime(); - time = atoi(itime); + time = (time_t)atoi(itime); ct = ctime(&time); ct[24] = 0; return(&ct[4]); diff --git a/gdb/gdb_conn.c b/gdb/gdb_conn.c index 8befa4b9..ba5b5c7a 100644 --- a/gdb/gdb_conn.c +++ b/gdb/gdb_conn.c @@ -275,7 +275,7 @@ char *id; { int peer; /* socket for talking to peer */ - int on = 1; /* flag for ioctl */ + char on = 1; /* flag for ioctl */ struct sockaddr_in target; /* build the peer address */ /* here */ struct hostent *peer_host; /* host where peer is */ diff --git a/gen/moddiff.pc b/gen/moddiff.pc index f96122a4..aa3ba0b7 100644 --- a/gen/moddiff.pc +++ b/gen/moddiff.pc @@ -133,7 +133,7 @@ time_t *UTime; /** Return the # of days in the Year **/ /*****************************************/ -static int NumdaysY(Year) +int NumdaysY(Year) int Year; { return (365 + Leapyear(Year)); @@ -144,7 +144,7 @@ int Year; /** Return the # of days in the Month **/ /*****************************************/ -static int NumdaysM(Month, Year) +int NumdaysM(Month, Year) int Month, Year; { if ((Month > 2) && (Leapyear (Year))) @@ -158,7 +158,7 @@ int Month, Year; /** Return 1 if a leapyear, else 0 **/ /*****************************************/ -static int Leapyear (Year) +int Leapyear (Year) int Year; { if ((Year % 4) && (!(Year % 100) || (Year % 1000))) @@ -173,7 +173,7 @@ int Year; /** Return 0 if success, 1 if failure **/ /************************************************/ -static int ParseDateString (DS, Day, Month, Year, Hour, Minute, Sec) +int ParseDateString (DS, Day, Month, Year, Hour, Minute, Sec) char *DS; int *Day, *Month, *Year, *Hour, *Minute, *Sec; { @@ -246,7 +246,7 @@ int *Day, *Month, *Year, *Hour, *Minute, *Sec; /** Return the Month number of a Month number or string **/ /***********************************************************/ -static int MonthNo (M) +int MonthNo (M) char *M; { int Count; diff --git a/gen/warehouse.pc b/gen/warehouse.pc index b408cf75..fca49858 100644 --- a/gen/warehouse.pc +++ b/gen/warehouse.pc @@ -40,7 +40,7 @@ char **argv; { int out = 1 /* stdout */; char *outf = NULL, outft[64]; - char *control_fn[80], cmd[256]; + char control_fn[80], cmd[256]; FILE *f; struct stat sb; int flag1; diff --git a/incremental/afs.c b/incremental/afs.c index 1dee3b86..05cf9bee 100644 --- a/incremental/afs.c +++ b/incremental/afs.c @@ -587,7 +587,7 @@ edit_group(op, group, type, member) /* Check whether the member being added is an active user */ code = moira_connect(); if (!code) code = mr_query("get_user_by_login", 1, &member, - check_user, &ustate); + check_user, (char *)&ustate); if (code) { critical_alert("incremental", "Error contacting Moira server to lookup user %s: %s", diff --git a/lib/Imakefile b/lib/Imakefile index a14df558..db3ee265 100644 --- a/lib/Imakefile +++ b/lib/Imakefile @@ -25,6 +25,9 @@ CODE=$(SRCS) Imakefile mr_et.et krb_et.et ureg_err.et gdss_et.et mr_private.h #ifdef NEED_STRCASECMP DEFINES= -DNEED_STRCASECMP #endif +#ifdef USE_CRYPT_H +DEFINES= -DUSE_CRYPT_H +#endif all:: mr_et.h krb_et.h ureg_err.h gdss_et.h @@ -42,3 +45,4 @@ install:: -mkdir ${DESTDIR}${INCLDIR} for i in mr_et.h; do \ ${INSTALLFILE} $$i ${DESTDIR}${INCLDIR}/$$i; done + diff --git a/reg_svr/reg_svr.c b/reg_svr/reg_svr.c index e4d3d782..67a3b167 100644 --- a/reg_svr/reg_svr.c +++ b/reg_svr/reg_svr.c @@ -32,6 +32,7 @@ static char *rcsid_reg_svr_c = "$Header$"; #include #include #include +#include #include "moira.h" #include "moira_site.h" #include "reg_svr.h" @@ -394,7 +395,7 @@ int verify_user(message,retval) /* If the information sent over in the packet did not point to a valid user, the mit_id field in the formatted packet structure will be empty. */ - if (message->db.mit_id[0] == NULL) + if (message->db.mit_id[0] == '\0') status = UREG_USER_NOT_FOUND; /* If the user was found but the registration has already started, use this as the status */ @@ -846,7 +847,7 @@ char *retval; q_argv[0] = message->db.uid; status = mr_query("get_user_account_by_uid", 1, q_argv, - getuserinfo, q_argv); + getuserinfo, (char *)q_argv); if (status != SUCCESS) { com_err(whoami, status, " while getting user info"); return(status); @@ -929,7 +930,8 @@ char *retval; com_err(whoami, 0, "checking status of secure password for %s", message->first); argv[0] = message->first; - status = mr_query("get_user_account_by_login", 1, argv, getuserinfo, argv); + status = mr_query("get_user_account_by_login", 1, argv, getuserinfo, + (char *)argv); if (status != SUCCESS) { com_err(whoami, status, " while getting user info"); return(status); @@ -957,6 +959,7 @@ char *retval; struct timeval now; static int inited = 0; static char *host; + extern char *krb_get_phost(char *); if (!inited) { inited++; @@ -967,7 +970,8 @@ char *retval; com_err(whoami, 0, "setting secure passwd for %s", message->first); argv[0] = message->first; - status = mr_query("get_user_account_by_login", 1, argv, getuserinfo, argv); + status = mr_query("get_user_account_by_login", 1, argv, getuserinfo, + (char *)argv); if (status != SUCCESS) { com_err(whoami, status, " while getting user info"); return(status); @@ -1058,7 +1062,8 @@ char *retval; argv[1] = buf; gettimeofday(&now, NULL); sprintf(buf, "%d", now.tv_sec); - status = mr_query("update_user_security_status", 2, argv, getuserinfo, argv); + status = mr_query("update_user_security_status", 2, argv, getuserinfo, + (char *)argv); if (status != SUCCESS) { com_err(whoami, status, " while updating user status"); return(status); diff --git a/reg_svr/requests.c b/reg_svr/requests.c index e535804e..5e81ba3f 100644 --- a/reg_svr/requests.c +++ b/reg_svr/requests.c @@ -94,7 +94,7 @@ void req_initialize() sin.sin_addr.s_addr = INADDR_ANY; /* Bind a name to the socket */ - if (bind(s, &sin, sizeof(sin)) < 0) + if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { com_err(whoami,errno," bind"); exit(1); @@ -122,7 +122,7 @@ int handle_retransmitted() #endif status = TRUE; (void) sendto(s, requests[i].out_pkt, requests[i].out_pktlen, - 0, &sin, addrlen); + 0, (struct sockaddr *)&sin, addrlen); break; } } @@ -143,7 +143,8 @@ void respond(status,text) if (format_pkt(CUR_REQ.out_pkt, &(CUR_REQ.out_pktlen), CUR_REQ.seqno, status, text)) com_err(whoami,0,"Client error message was truncated."); - (void) sendto(s, CUR_REQ.out_pkt, CUR_REQ.out_pktlen, 0, &sin, addrlen); + (void) sendto(s, CUR_REQ.out_pkt, CUR_REQ.out_pktlen, 0, + (struct sockaddr *)&sin, addrlen); cur_request_index = NEXT_INDEX(cur_request_index); } @@ -161,7 +162,8 @@ void get_request(message) com_err(whoami, 0, "*** Ready for next request ***"); addrlen = sizeof(sin); /* Receive a packet */ - if ((pktlen = recvfrom(s,packet,sizeof(packet),0,&sin,&addrlen)) < 0) + if ((pktlen = recvfrom(s,packet,sizeof(packet),0, + (struct sockaddr *)&sin,&addrlen)) < 0) { com_err(whoami, errno, " recvfrom"); /* Don't worry if error is interrupted system call. */ diff --git a/regtape/Imakefile b/regtape/Imakefile index de90c36f..1bbdb5e0 100644 --- a/regtape/Imakefile +++ b/regtape/Imakefile @@ -10,7 +10,11 @@ SRCS= students.c employee.c sign.c verify.c vote.c rafnu.c CODE= students.pc employee.pc sign.pc verify.pc vote.pc rafnu.c SRCDIR = $(SRCTOP)/regtape +#ifdef USE_CRYPT_H +DEFINES = $(GDSSINC) -DUSE_CRYPT_H +#else DEFINES = $(GDSSINC) +#endif sqlrule() program(students, students.o rafnu.o,,$(CLIBS) $(SQL_LIB), $(PROGDIR)) diff --git a/regtape/employee.pc b/regtape/employee.pc index c9a10ded..ab181ad0 100644 --- a/regtape/employee.pc +++ b/regtape/employee.pc @@ -64,7 +64,6 @@ struct entry { char *address; char *phone; char *phone2; - char *email; }; @@ -159,7 +158,7 @@ struct entry *get_next_entry(in) FILE *in; { static struct entry e; - static char buf[BUFSIZ], mid[16], eid[16], email[256]; + static char buf[BUFSIZ], mid[16], eid[16]; static char name[LEN_NAME+1], sname[LEN_NAME+1], id[LEN_ID+1]; static char office[LEN_OFFICE+1], phone[LEN_PHONE+1], phone2[LEN_PHONE2+1]; static char dept[LEN_DEPT+1], title[LEN_TITLE+1], username[LEN_USERNAME+1]; @@ -228,11 +227,6 @@ FILE *in; if (substr(e.title, "PROF") || substr(e.title, "LECTURE")) e.class = "FACULTY"; - strcpy(email, strtrim(username)); - if (host[0] == '@') - strncat(email, strtrim(host)); - e.email = email; - return(&e); } diff --git a/regtape/rafnu.c b/regtape/rafnu.c index 5edbbbdc..be5b7fe3 100644 --- a/regtape/rafnu.c +++ b/regtape/rafnu.c @@ -32,6 +32,11 @@ static char *rcsid_rafnu_c = "$Header$"; #include #include +#ifdef USE_CRYPT_H +#include +#else +#include +#endif #define LAST_LEN 15 #define FIRST_LEN 15 @@ -69,10 +74,6 @@ ReadAndFixNextUser(s, querc, querv) int ends_iv = 0; /* 1 if name ends in "IV" */ char salt[2]; register char *p; - char *strcat(); - char *strcpy(); - char *strncpy(); - char *crypt(); for (;;) { /* ... well, at least until we get a good * input line */ diff --git a/server/mr_scall.c b/server/mr_scall.c index 3d54eba8..9a72909c 100644 --- a/server/mr_scall.c +++ b/server/mr_scall.c @@ -19,6 +19,7 @@ static char *rcsid_sms_scall_c = "$Header$"; #include #include #include +#include #include #include #include diff --git a/server/mr_server.h b/server/mr_server.h index 1505719a..ca999313 100644 --- a/server/mr_server.h +++ b/server/mr_server.h @@ -16,6 +16,7 @@ #include #include #include +#include typedef struct returned_tuples { struct returned_tuples *next; @@ -188,6 +189,6 @@ void do_shutdown(client *cl); /* prototypes from mr_util.c */ char *requote(char *buf, char *cp, int len); void log_args(char *tag, int version, int argc, char **argv); -void mr_com_err(char *whoami, int code, char *fmt, caddr_t pvar); +void mr_com_err(const char *whoami, long code, const char *fmt, va_list pvar); int mr_trim_args(int argc, char **argv); char **mr_copy_args(char **argv, int argc); diff --git a/server/mr_util.c b/server/mr_util.c index af7e266f..75d9ccdb 100644 --- a/server/mr_util.c +++ b/server/mr_util.c @@ -70,10 +70,10 @@ void log_args(tag, version, argc, argv) } void mr_com_err(whoami, code, fmt, pvar) - char *whoami; - int code; - char *fmt; - caddr_t pvar; + const char *whoami; + long code; + const char *fmt; + va_list pvar; { extern client *cur_client; diff --git a/update/auth_002.c b/update/auth_002.c index 1d817ab5..182e77a5 100644 --- a/update/auth_002.c +++ b/update/auth_002.c @@ -129,7 +129,7 @@ auth_002(str) code = connection_errno(conn); goto auth_failed; } - des_key_sched(&ad.session, &sched); + des_key_sched(ad.session, sched); des_ecb_encrypt(STRING_DATA(data), nonce2, sched, 0); if (memcmp(nonce, nonce2, sizeof(nonce))) goto auth_failed; diff --git a/update/client.c b/update/client.c index 3033d265..0ab20644 100644 --- a/update/client.c +++ b/update/client.c @@ -255,7 +255,7 @@ char *host_name; if (code) { return(connection_errno(conn)); } - des_key_sched(&session, &sched); + des_key_sched(session, sched); des_ecb_encrypt(STRING_DATA(data), enonce, sched, 1); STRING_DATA(data) = enonce; code = send_object(conn, (char *)&data, STRING_T); diff --git a/util/imake.includes/Imake.rules b/util/imake.includes/Imake.rules index 1f15b6d3..12349401 100644 --- a/util/imake.includes/Imake.rules +++ b/util/imake.includes/Imake.rules @@ -176,7 +176,7 @@ ORADEFS= DEFINE=HESIOD DEFINE=ZEPHYR DEFINE=GDSS DEFINE=ATHENA #define sqlrule() @@\ .SUFFIXES: .pc @@\ .pc.c: @@\ - /usr/oracle/bin/proc INAME=$*.pc INCLUDE=$(BUILDTOP)/include INCLUDE=$(BUILDTOP)/lib INCLUDE=$(INCLDIR) $(ORADEFS) + /usr/oracle/bin/proc INAME=$*.pc INCLUDE=$(BUILDTOP)/include INCLUDE=$(BUILDTOP)/lib INCLUDE=$(INCLDIR) $(ORADEFS) $(ORAINCLUDES) #define sqlfile(file) @@\ concat(file,.c): concat(file,.pc) @@\ clean:: @@\ diff --git a/util/imake.includes/config.Imakefile b/util/imake.includes/config.Imakefile index ce0a695c..7cc9dafc 100644 --- a/util/imake.includes/config.Imakefile +++ b/util/imake.includes/config.Imakefile @@ -17,7 +17,7 @@ OSDEFS= -DPOSIX #endif #ifdef sgi -OSDEFS= -DPOSIX -DUSE_CRYPT_H -DSYSV +OSDEFS= -DPOSIX -DSYSV #endif #if defined(SOLARIS) @@ -209,10 +209,14 @@ MOTIFINC= /mit/motif/include MOTIFLIB= /mit/motif/`machtype`lib #endif -/* where crypt is, if not libc */ +/* where crypt is, if not libc and unistd.h */ #ifdef __NetBSD__ CRYPT= -lcrypt #endif +#if defined(sgi) || defined(SOLARIS) +#define USE_CRYPT_H +#endif + /* * The name of a command which builds an object library. -- 2.45.2