From ee442551e1531712226a3a3ba26afff466100bb5 Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Mon, 21 Jan 2008 07:57:32 +0000 Subject: passes gcc -Wall with no warnings other than des cryppt C_block sadness and getsid problem --- clients/zctl/zctl.c | 9 ++-- clients/zleave/zleave.c | 5 +- clients/znol/znol.c | 3 +- clients/zshutdown_notify/zshutdown_notify.c | 12 +++-- clients/zstat/zstat.c | 7 +-- clients/zwrite/zwrite.c | 16 +++--- server/bdump.c | 18 +++---- server/class.c | 7 ++- server/client.c | 7 ++- server/dispatch.c | 28 +++++------ server/kstuff.c | 55 ++++++++++----------- server/main.c | 8 --- server/realm.c | 33 ++++++------- server/server.c | 15 +++--- server/subscr.c | 35 +++++-------- server/timer.c | 1 - server/uloc.c | 12 ----- server/zserver.h | 77 +++++++++++++++++++---------- zhm/queue.c | 17 +++++-- zhm/timer.c | 1 - zhm/zhm.c | 12 +++-- zhm/zhm.h | 2 + zhm/zhm_client.c | 5 +- zhm/zhm_server.c | 2 +- zwgc/X_driver.c | 12 +++-- zwgc/X_fonts.c | 30 +++++------ zwgc/X_gram.c | 25 +++++----- zwgc/X_gram.h | 1 + zwgc/character_class.c | 2 +- zwgc/file.c | 6 ++- zwgc/formatter.c | 9 ++-- zwgc/lexer.c | 6 ++- zwgc/main.c | 8 ++- zwgc/port.c | 6 ++- zwgc/standard_ports.c | 12 +++-- zwgc/string_dictionary_aux.c | 2 +- zwgc/subscriptions.c | 7 +-- zwgc/substitute.c | 2 +- zwgc/text_operations.c | 8 +-- zwgc/tty_filter.c | 68 +++++++++++++++---------- zwgc/variables.c | 3 +- zwgc/xcut.c | 1 + zwgc/xmark.c | 2 +- zwgc/xrevstack.h | 2 +- zwgc/xselect.c | 7 +-- zwgc/xshow.c | 1 - zwgc/zephyr.c | 6 ++- zwgc/zephyr.h | 2 + 48 files changed, 332 insertions(+), 283 deletions(-) diff --git a/clients/zctl/zctl.c b/clients/zctl/zctl.c index de96d16..e48a651 100644 --- a/clients/zctl/zctl.c +++ b/clients/zctl/zctl.c @@ -17,7 +17,7 @@ #include #include #ifndef lint -static const char *rcsid_zctl_c = "$Id$"; +static const char rcsid_zctl_c[] = "$Id$"; #endif #define SUBSATONCE 7 @@ -52,6 +52,7 @@ void add_file(short, ZSubscription_t *, int); void del_file(short, ZSubscription_t *, int); void fix_macros(ZSubscription_t *, ZSubscription_t *, int); void fix_macros2(char *, char **); +int make_exist(char *); int main(int argc, @@ -538,8 +539,10 @@ add_file(short wgport, return; } fix_macros(subs,&sub2,1); - if (retval = (unsub ? ZUnsubscribeTo(&sub2,1,(u_short)wgport) : - ZSubscribeToSansDefaults(&sub2,1,(u_short)wgport))) + retval = (unsub + ? ZUnsubscribeTo(&sub2,1,(u_short)wgport) + : ZSubscribeToSansDefaults(&sub2,1,(u_short)wgport)); + if (retval) ss_perror(sci_idx,retval, unsub ? "while unsubscribing" : "while subscribing"); diff --git a/clients/zleave/zleave.c b/clients/zleave/zleave.c index 4483138..e7ce4b6 100644 --- a/clients/zleave/zleave.c +++ b/clients/zleave/zleave.c @@ -17,7 +17,7 @@ #include #ifndef lint -static char rcsid_zlocate_c[] = "$Id$"; +static const char rcsid_zlocate_c[] = "$Id$"; #endif /* lint */ /* @@ -254,7 +254,8 @@ doalarm(long nmins) daytime += gseconds; whenleave = ctime(&daytime); - if (fp = fopen(tempfile,"r")) { + fp = fopen(tempfile,"r"); + if (fp) { if (fscanf(fp, "%d", &oldpid) == 1) if (!kill(oldpid,9)) printf("Old zleave process killed.\n"); diff --git a/clients/znol/znol.c b/clients/znol/znol.c index cdb0349..33f5096 100644 --- a/clients/znol/znol.c +++ b/clients/znol/znol.c @@ -137,7 +137,8 @@ main(int argc, if (cleanname[0] == '#' || cleanname[0] == '\0' || cleanname[0] == '\n') continue; /* ignore comment and empty lines */ - if (comment_ptr = strchr(cleanname, '#')) + comment_ptr = strchr(cleanname, '#'); + if (comment_ptr) *comment_ptr = '\0'; /* Ignore from # onwards */ /* Get rid of old-style nol entries, just in case */ cp = cleanname + strlen(cleanname) - 1; diff --git a/clients/zshutdown_notify/zshutdown_notify.c b/clients/zshutdown_notify/zshutdown_notify.c index f2b4932..4e2eaa0 100644 --- a/clients/zshutdown_notify/zshutdown_notify.c +++ b/clients/zshutdown_notify/zshutdown_notify.c @@ -19,7 +19,7 @@ #include #ifndef lint -static const char *rcsid_zshutdown_notify_c = +static const char rcsid_zshutdown_notify_c[] = "$Id$"; #endif @@ -83,14 +83,16 @@ main(int argc, fprintf(stderr, "%s: can't figure out canonical hostname\n",argv[0]); exit(1); } - if (retval = krb_get_lrealm(rlm, 1)) { + retval = krb_get_lrealm(rlm, 1); + if (retval) { fprintf(stderr, "%s: can't get local realm: %s\n", argv[0], krb_get_err_text(retval)); exit(1); } - if (retval = krb_get_svc_in_tkt(SVC_NAME, hn2, rlm, - SERVER_SERVICE, SERVER_INSTANCE, 1, - KEYFILE)) { + retval = krb_get_svc_in_tkt(SVC_NAME, hn2, rlm, + SERVER_SERVICE, SERVER_INSTANCE, 1, + KEYFILE); + if (retval) { fprintf(stderr, "%s: can't get tickets: %s\n", argv[0], krb_get_err_text(retval)); exit(1); diff --git a/clients/zstat/zstat.c b/clients/zstat/zstat.c index 04951cc..2e0be61 100644 --- a/clients/zstat/zstat.c +++ b/clients/zstat/zstat.c @@ -15,6 +15,8 @@ #include #include +#include +#include #include "zserver.h" #if !defined(lint) && !defined(SABER) @@ -49,6 +51,8 @@ u_short srv_port; void usage(char *); void do_stat(char *); +int srv_stat(char *); +int hm_stat(char *, char *); RETSIGTYPE timeout(int ignored) @@ -145,9 +149,6 @@ hm_stat(char *host, time_t runtime; struct tm *tim; ZNotice_t notice; -#ifdef _POSIX_VERSION - struct sigaction sa; -#endif if ((inaddr.s_addr = inet_addr(host)) == (unsigned)(-1)) { if ((hp = gethostbyname(host)) == NULL) { diff --git a/clients/zwrite/zwrite.c b/clients/zwrite/zwrite.c index a7f1fc4..1774aaf 100644 --- a/clients/zwrite/zwrite.c +++ b/clients/zwrite/zwrite.c @@ -61,20 +61,23 @@ main(int argc, verbose = quiet = msgarg = nrecips = nocheck = filsys = nodot = 0; tabexpand = 1; - if (class = ZGetVariable("zwrite-class")) { + class = ZGetVariable("zwrite-class"); + if (class) { (void) strcpy(classbfr, class); class = classbfr; } else class = DEFAULT_CLASS; - if (inst = ZGetVariable("zwrite-inst")) { + inst = ZGetVariable("zwrite-inst"); + if (inst) { (void) strcpy(instbfr, inst); inst = instbfr; } else inst = DEFAULT_INSTANCE; - if (opcode = ZGetVariable("zwrite-opcode")) + opcode = ZGetVariable("zwrite-opcode"); + if (opcode) opcode = strcpy(opbfr, opcode); else opcode = DEFAULT_OPCODE; @@ -243,11 +246,12 @@ main(int argc, if (!nocheck && nrecips) send_off(¬ice, 0); - if (!msgarg && isatty(0)) + if (!msgarg && isatty(0)) { if (nodot) printf("Type your message now. End with the end-of-file character.\n"); else printf("Type your message now. End with control-D or a dot on a line by itself.\n"); + } message = NULL; msgsize = 0; @@ -314,7 +318,7 @@ main(int argc, message = realloc(message, (unsigned)(msgsize+1)); } else { /* Use read so you can send binary messages... */ - while (nchars = read(fileno(stdin), bfr, sizeof bfr)) { + while ((nchars = read(fileno(stdin), bfr, sizeof bfr))) { if (nchars == -1) { fprintf(stderr, "Read error from stdin! Can't continue!\n"); exit(1); @@ -343,7 +347,7 @@ send_off(ZNotice_t *notice, int real) { int i, success, retval; - char bfr[BUFSIZ], realm_recip[BUFSIZ], dest[3 * BUFSIZ], *cp; + char bfr[BUFSIZ], realm_recip[BUFSIZ], dest[3 * BUFSIZ]; ZNotice_t retnotice; success = 0; diff --git a/server/bdump.c b/server/bdump.c index da6d2de..a3a684f 100644 --- a/server/bdump.c +++ b/server/bdump.c @@ -83,7 +83,6 @@ return 0; static void close_bdump(void* arg); static Code_t bdump_send_loop(Server *server); -static Code_t bdump_ask_for(char *inst); static Code_t bdump_recv_loop(Server *server); static void bdump_get_v12(ZNotice_t *, int, struct sockaddr_in *, Server *); @@ -183,7 +182,7 @@ bdump_offer(struct sockaddr_in *who) return; } if (!bdump_sin.sin_port) { - int len = sizeof(bdump_sin); + unsigned int len = sizeof(bdump_sin); if (getsockname(bdump_socket, (struct sockaddr *) &bdump_sin, &len) < 0) { @@ -252,7 +251,7 @@ bdump_send(void) struct sockaddr_in from; Server *server; Code_t retval; - int fromlen = sizeof(from); + unsigned int fromlen = sizeof(from); int on = 1; #ifdef _POSIX_VERSION struct sigaction action; @@ -272,7 +271,6 @@ bdump_send(void) /* may be moved into kstuff.c */ krb5_principal principal; krb5_data k5data; - krb5_ap_rep_enc_part *rep; krb5_keytab kt; #endif #if !defined(HAVE_KRB4) && !defined(HAVE_KRB5) @@ -1010,10 +1008,6 @@ get_tgt(void) * at least INST_SZ bytes long. */ static char buf[INST_SZ + 1] = SERVER_INSTANCE; int retval = 0; - CREDENTIALS cred; -#ifndef NOENCRYPTION - Sched *s; -#endif /* have they expired ? */ if (ticket_time < NOW - tkt_lifetime(TKTLIFETIME) + (15L * 60L)) { @@ -1039,7 +1033,7 @@ get_tgt(void) #ifndef NOENCRYPTION retval = read_service_key(SERVER_SERVICE, SERVER_INSTANCE, ZGetRealm(), 0 /*kvno*/, - srvtab_file, serv_key); + srvtab_file, (char *)serv_key); if (retval != KSUCCESS) { syslog(LOG_ERR, "get_tgt: read_service_key: %s", krb_get_err_text(retval)); @@ -1138,7 +1132,7 @@ bdump_recv_loop(Server *server) Client *client = NULL; struct sockaddr_in who; #ifdef HAVE_KRB5 - char buf[512]; + unsigned char buf[512]; int blen; #endif #if defined(HAVE_KRB4) || defined(HAVE_KRB5) @@ -1268,7 +1262,7 @@ bdump_recv_loop(Server *server) serv_ksched.s, DES_DECRYPT); } } else if (*cp == 'Z') { /* Zcode! Long live the new flesh! */ - retval = ZReadZcode(cp, buf, sizeof(buf), &blen); + retval = ZReadZcode((unsigned char *)cp, buf, sizeof(buf), &blen); if (retval != ZERR_NONE) { syslog(LOG_ERR,"brl bad cblk read: %s (%s)", error_message(retval), cp); @@ -1329,7 +1323,7 @@ bdump_recv_loop(Server *server) error_message(retval)); return retval; } - } /* else + } /* else */ /* Other side tried to send us subs for a realm we didn't know about, and so we drop them silently */ diff --git a/server/class.c b/server/class.c index 740b065..0e84b1d 100644 --- a/server/class.c +++ b/server/class.c @@ -130,7 +130,7 @@ triplet_register(Client *client, /* Triplet not present in hash table, insert it. */ triplet = triplet_alloc(dest->classname, dest->inst, dest->recip); - LIST_INSERT(&triplet_bucket[hashval], triplet); + Triplet_insert(&triplet_bucket[hashval], triplet); return insert_client(triplet, client, realm); } @@ -156,7 +156,7 @@ triplet_deregister(Client *client, if (retval != ZERR_NONE) return retval; if (*triplet->clients == NULL && !triplet->acl) { - LIST_DELETE(triplet); + Triplet_delete(triplet); free_triplet(triplet); return ZSRV_EMPTYCLASS; } @@ -265,7 +265,7 @@ class_setup_restricted(char *class_name, if (!triplet) return ENOMEM; triplet->acl = acl; - LIST_INSERT(&triplet_bucket[hashval], triplet); + Triplet_insert(&triplet_bucket[hashval], triplet); return ZERR_NONE; } @@ -279,7 +279,6 @@ triplet_alloc(String *classname, String *recipient) { Triplet *triplet; - Client *clist; triplet = (Triplet *) malloc(sizeof(Triplet)); if (!triplet) diff --git a/server/client.c b/server/client.c index e56c9b9..90d83bc 100644 --- a/server/client.c +++ b/server/client.c @@ -65,7 +65,6 @@ client_register(ZNotice_t *notice, int wantdefaults) { Client *client; - Code_t retval; /* chain the client's host onto this server's host list */ @@ -98,8 +97,8 @@ client_register(ZNotice_t *notice, client->subs = NULL; client->realm = NULL; client->principal = make_string(notice->z_sender, 0); - LIST_INSERT(&client_bucket[INET_HASH(&client->addr.sin_addr, - notice->z_port)], client); + Client_insert(&client_bucket[INET_HASH(&client->addr.sin_addr, + notice->z_port)], client); } /* Add default subscriptions only if this is not resulting from a brain @@ -120,7 +119,7 @@ void client_deregister(Client *client, int flush) { - LIST_DELETE(client); + Client_delete(client); nack_release(client); subscr_cancel_client(client); free_string(client->principal); diff --git a/server/dispatch.c b/server/dispatch.c index 8cadcec..e7b4b67 100644 --- a/server/dispatch.c +++ b/server/dispatch.c @@ -199,7 +199,8 @@ handle_packet(void) if (new_notice.z_kind == SERVACK || new_notice.z_kind == SERVNAK) { authentic = ZAUTH_YES; } else { - if (realm = realm_which_realm(&input_sin)) { + realm = realm_which_realm(&input_sin); + if (realm) { authentic = ZCheckRealmAuthentication(&new_notice, &input_sin, realm->name); @@ -214,7 +215,8 @@ handle_packet(void) if (new_notice.z_kind == SERVACK || new_notice.z_kind == SERVNAK) { authentic = ZAUTH_YES; } else { - if (realm = realm_which_realm(&whoisit)) { + realm = realm_which_realm(&whoisit); + if (realm) { authentic = ZCheckRealmAuthentication(&new_notice, &whoisit, realm->name); @@ -518,7 +520,7 @@ nack_release(Client *client) next = nacked->next; if (nacked->client == client) { timer_reset(nacked->timer); - LIST_DELETE(nacked); + Unacked_delete(nacked); free(nacked->packet); free(nacked); } @@ -543,7 +545,7 @@ xmit_frag(ZNotice_t *notice, char *savebuf; Unacked *nacked; Code_t retval; - int hashval, sendfail = 0; + int sendfail = 0; retval = ZSendPacket(buf, len, 0); if (retval != ZERR_NONE) { @@ -579,7 +581,7 @@ xmit_frag(ZNotice_t *notice, nacked->packsz = len; nacked->uid = notice->z_uid; nacked->timer = timer_set_rel(rexmit_times[0], rexmit, nacked); - LIST_INSERT(&nacktab[NACKTAB_HASHVAL(sin, nacked->uid)], nacked); + Unacked_insert(&nacktab[NACKTAB_HASHVAL(sin, nacked->uid)], nacked); return(ZERR_NONE); } @@ -654,10 +656,10 @@ xmit(ZNotice_t *notice, * same thing with authentic Zephyrs. */ if (retval == ZERR_PKTLEN) { - ZNotice_t partnotice, newnotice; + ZNotice_t partnotice; char multi[64]; char *buffer, *ptr; - int buffer_len, hdrlen, offset, fragsize, ret_len, message_len; + int buffer_len, hdrlen, offset, fragsize, message_len; int origoffset, origlen; free(noticepack); @@ -790,7 +792,7 @@ xmit(ZNotice_t *notice, nacked->packsz = packlen; nacked->uid = notice->z_uid; nacked->timer = timer_set_rel(rexmit_times[0], rexmit, nacked); - LIST_INSERT(&nacktab[NACKTAB_HASHVAL(*dest, nacked->uid)], nacked); + Unacked_insert(&nacktab[NACKTAB_HASHVAL(*dest, nacked->uid)], nacked); } /* @@ -808,7 +810,7 @@ rexmit(void *arg) #if 1 syslog(LOG_DEBUG, "rexmit %s/%d #%d time %d", inet_ntoa(nacked->dest.addr.sin_addr), - ntohs(nacked->dest.addr.sin_port), nacked->rexmits + 1, NOW); + ntohs(nacked->dest.addr.sin_port), nacked->rexmits + 1, (int)NOW); #endif nacked->rexmits++; @@ -821,7 +823,7 @@ rexmit(void *arg) * nack list before calling client_deregister(), which * scans the nack list.) */ - LIST_DELETE(nacked); + Unacked_delete(nacked); if (nacked->client) { server_kill_clt(nacked->client); client_deregister(nacked->client, 1); @@ -873,7 +875,6 @@ clt_ack(ZNotice_t *notice, ZNotice_t acknotice; ZPacket_t ackpack; int packlen; - int notme = 0; char *sent_name; Code_t retval; @@ -982,7 +983,7 @@ nack_cancel(ZNotice_t *notice, nacked->client->last_ack = NOW; timer_reset(nacked->timer); free(nacked->packet); - LIST_DELETE(nacked); + Unacked_delete(nacked); free(nacked); return; } @@ -1008,9 +1009,7 @@ hostm_dispatch(ZNotice_t *notice, struct sockaddr_in *who, Server *server) { - Server *owner; char *opcode = notice->z_opcode; - Code_t retval; int i, add = 0, remove = 0; #if 0 @@ -1291,7 +1290,6 @@ void realm_shutdown(void) { int i, s, newserver; - struct sockaddr_in sin; for (i = 0; i < nservers; i++) { if (i != me_server_idx && otherservers[i].state == SERV_UP) diff --git a/server/kstuff.c b/server/kstuff.c index e81e905..28492ee 100644 --- a/server/kstuff.c +++ b/server/kstuff.c @@ -22,8 +22,9 @@ static const char rcsid_kstuff_c[] = "$Id$"; #ifdef HAVE_KRB4 -static ZChecksum_t compute_checksum __P((ZNotice_t *, C_Block)); -static ZChecksum_t compute_rlm_checksum __P((ZNotice_t *, C_Block)); +static ZChecksum_t compute_checksum(ZNotice_t *, C_Block); +static ZChecksum_t compute_rlm_checksum(ZNotice_t *, C_Block); +static Code_t ZCheckAuthentication4(ZNotice_t *notice, struct sockaddr_in *from); /* * GetKerberosData @@ -126,8 +127,7 @@ Code_t ReadKerberosData(int fd, int *size, char **data, int *proto) { char p[20]; int i; - unsigned char *dst; - Code_t retval; + char *dst; int len = 0; for (i=0; i<20; i++) { @@ -152,7 +152,7 @@ ReadKerberosData(int fd, int *size, char **data, int *proto) { else if ((len = atoi(p)) > 0) *proto = 4; - if (*proto < 4 | *proto > 5) { + if ((*proto < 4) | (*proto > 5)) { syslog(LOG_WARNING, "ReadKerberosData: error parsing authenticator length (\"%s\")", p); return KFAILURE; } @@ -188,8 +188,7 @@ Code_t GetKrb5Data(int fd, krb5_data *data) { char p[20]; int i; - unsigned char *dst; - Code_t retval; + char *dst; for (i=0; i<20; i++) { if (read(fd, &p[i], 1) != 1) { @@ -260,8 +259,9 @@ ZCheckRealmAuthentication(ZNotice_t *notice, krb5_data cksumbuf; int valid; char *cksum0_base, *cksum1_base, *cksum2_base; - char *svcinst, *x, *y; - char *asn1_data, *key_data; + char *x; + unsigned char *asn1_data; + unsigned char *key_data; int asn1_len, key_len, cksum0_len, cksum1_len, cksum2_len; #ifdef KRB5_AUTH_CON_GETAUTHENTICATOR_TAKES_DOUBLE_POINTER krb5_authenticator *authenticator; @@ -280,11 +280,11 @@ ZCheckRealmAuthentication(ZNotice_t *notice, return ZAUTH_FAILED; len = strlen(notice->z_ascii_authent)+1; - authbuf=malloc(len); + authbuf = malloc(len); /* Read in the authentication data. */ - if (ZReadZcode(notice->z_ascii_authent, - authbuf, + if (ZReadZcode((unsigned char *)notice->z_ascii_authent, + (unsigned char *)authbuf, len, &len) == ZERR_BADFIELD) { return ZAUTH_FAILED; } @@ -492,7 +492,7 @@ ZCheckRealmAuthentication(ZNotice_t *notice, return ZAUTH_FAILED; } /* HOLDING: authctx, authenticator, cksumbuf.data, asn1_data */ - result = ZReadZcode(notice->z_ascii_checksum, + result = ZReadZcode((unsigned char *)notice->z_ascii_checksum, asn1_data, asn1_len, &asn1_len); if (result != ZERR_NONE) { krb5_free_keyblock(Z_krb5_ctx, keyblock); @@ -526,7 +526,7 @@ ZCheckAuthentication(ZNotice_t *notice, struct sockaddr_in *from) { #ifdef HAVE_KRB5 - char *authbuf; + unsigned char *authbuf; krb5_principal princ; krb5_data packet; krb5_ticket *tkt; @@ -541,8 +541,8 @@ ZCheckAuthentication(ZNotice_t *notice, krb5_data cksumbuf; int valid; char *cksum0_base, *cksum1_base, *cksum2_base; - char *svcinst, *x, *y; - char *asn1_data, *key_data; + char *x; + unsigned char *asn1_data, *key_data; int asn1_len, key_len, cksum0_len, cksum1_len, cksum2_len; #ifdef KRB5_AUTH_CON_GETAUTHENTICATOR_TAKES_DOUBLE_POINTER krb5_authenticator *authenticator; @@ -566,17 +566,17 @@ ZCheckAuthentication(ZNotice_t *notice, #endif len = strlen(notice->z_ascii_authent)+1; - authbuf=malloc(len); + authbuf = malloc(len); /* Read in the authentication data. */ - if (ZReadZcode(notice->z_ascii_authent, + if (ZReadZcode((unsigned char *)notice->z_ascii_authent, authbuf, len, &len) == ZERR_BADFIELD) { return ZAUTH_FAILED; } packet.length = len; - packet.data = authbuf; + packet.data = (char *)authbuf; result = krb5_kt_resolve(Z_krb5_ctx, keytab_file, &keytabid); @@ -776,7 +776,7 @@ ZCheckAuthentication(ZNotice_t *notice, return ZAUTH_FAILED; } /* HOLDING: authctx, authenticator, cksumbuf.data, asn1_data */ - result = ZReadZcode(notice->z_ascii_checksum, + result = ZReadZcode((unsigned char *)notice->z_ascii_checksum, asn1_data, asn1_len, &asn1_len); if (result != ZERR_NONE) { krb5_free_keyblock(Z_krb5_ctx, keyblock); @@ -807,17 +807,16 @@ ZCheckAuthentication(ZNotice_t *notice, #undef KRB5AUTHENT -Code_t +static Code_t ZCheckAuthentication4(ZNotice_t *notice, struct sockaddr_in *from) { #ifdef HAVE_KRB4 int result; char srcprincipal[ANAME_SZ+INST_SZ+REALM_SZ+4]; - KTEXT_ST authent, ticket; + KTEXT_ST authent; AUTH_DAT dat; ZChecksum_t checksum; - C_Block session_key; char instance[INST_SZ+1]; if (!notice->z_auth) @@ -881,9 +880,9 @@ compute_checksum(ZNotice_t *notice, cstart = notice->z_default_format + strlen(notice->z_default_format) + 1; cend = cstart + strlen(cstart) + 1; - checksum = des_quad_cksum(hstart, NULL, cstart - hstart, 0, session_key); - checksum ^= des_quad_cksum(cend, NULL, hend - cend, 0, session_key); - checksum ^= des_quad_cksum(notice->z_message, NULL, notice->z_message_len, + checksum = des_quad_cksum((unsigned char *)hstart, NULL, cstart - hstart, 0, session_key); + checksum ^= des_quad_cksum((unsigned char *)cend, NULL, hend - cend, 0, session_key); + checksum ^= des_quad_cksum((unsigned char *)notice->z_message, NULL, notice->z_message_len, 0, session_key); return checksum; #endif @@ -896,11 +895,11 @@ static ZChecksum_t compute_rlm_checksum(ZNotice_t *notice, return 0; #else ZChecksum_t checksum; - char *cstart, *cend, *hstart = notice->z_packet, *hend = notice->z_message; + char *cstart, *cend, *hstart = notice->z_packet; cstart = notice->z_default_format + strlen(notice->z_default_format) + 1; cend = cstart + strlen(cstart) + 1; - checksum = des_quad_cksum(hstart, NULL, cstart - hstart, 0, session_key); + checksum = des_quad_cksum((unsigned char *)hstart, NULL, cstart - hstart, 0, session_key); return checksum; #endif } diff --git a/server/main.c b/server/main.c index 58dfccb..d39536e 100644 --- a/server/main.c +++ b/server/main.c @@ -60,7 +60,6 @@ static RETSIGTYPE bye(int); static RETSIGTYPE dbug_on(int); static RETSIGTYPE dbug_off(int); static RETSIGTYPE sig_dump_db(int); -static RETSIGTYPE sig_dump_strings(int); static RETSIGTYPE reset(int); static RETSIGTYPE reap(int); static void read_from_dump(char *dumpfile); @@ -395,7 +394,6 @@ main(int argc, static int initialize(void) { - int zero = 0; if (do_net_setup()) return(1); @@ -586,12 +584,6 @@ dbug_off(int sig) int fork_for_dump = 0; -static RETSIGTYPE -sig_dump_strings(int sig) -{ - dump_strings_flag = 1; -} - static void dump_strings(void) { char filename[128]; diff --git a/server/realm.c b/server/realm.c index 0dea795..714b008 100644 --- a/server/realm.c +++ b/server/realm.c @@ -78,7 +78,7 @@ realm_get_idx_by_addr(ZRealm *realm, struct sockaddr_in *who) { struct sockaddr_in *addr; - int a, b; + int b; /* loop through the realms */ for (addr = realm->addrs, b = 0; b < realm->count; b++, addr++) @@ -232,7 +232,8 @@ realm_send_realms(void) { int cnt, retval; for (cnt = 0; cnt < nrealms; cnt++) { - if (retval = (subscr_send_realm_subs(&otherrealms[cnt])) != ZERR_NONE) + retval = subscr_send_realm_subs(&otherrealms[cnt]); + if (retval != ZERR_NONE) return(retval); } return ZERR_NONE; @@ -330,8 +331,7 @@ rlm_nack_cancel(register ZNotice_t *notice, struct sockaddr_in *who) { register ZRealm *which = realm_which_realm(who); - register Unacked *nacked, *next; - ZPacket_t retval; + register Unacked *nacked; #if 1 zdbug((LOG_DEBUG, "rlm_nack_cancel: %s:%08X,%08X", @@ -355,7 +355,7 @@ rlm_nack_cancel(register ZNotice_t *notice, /* free the data */ free(nacked->packet); - LIST_DELETE(nacked); + Unacked_delete(nacked); free(nacked); return; } @@ -579,7 +579,6 @@ void realm_deathgram(Server *server) { ZRealm *realm; - char rlm_recipient[REALM_SZ + 1]; int jj = 0; /* Get it out once, and assume foreign servers will share */ @@ -641,7 +640,6 @@ realm_wakeup(void) { int jj, found = 0; ZRealm *realm; - char rlm_recipient[REALM_SZ + 1]; for (jj = 1; jj < nservers; jj++) { /* skip limbo server */ if (jj != me_server_idx && otherservers[jj].state == SERV_UP) @@ -712,7 +710,6 @@ realm_ulocate_dispatch(ZNotice_t *notice, ZRealm *realm) { register char *opcode = notice->z_opcode; - Code_t status; if (!auth) { syslog(LOG_WARNING, "unauth locate msg from %s (%s/%s/%s)", @@ -829,8 +826,6 @@ realm_new_server(struct sockaddr_in *sin, ZNotice_t *notice, ZRealm *realm) { - struct hostent *hp; - char suggested_server[MAXHOSTNAMELEN]; unsigned long addr; ZRealm *rlm; struct sockaddr_in sinaddr; @@ -858,6 +853,7 @@ realm_new_server(struct sockaddr_in *sin, } else { zdbug((LOG_DEBUG, "rlm_new_srv: not switching servers (%s)", inet_ntoa((realm->addrs[realm->idx]).sin_addr))); } + return 0; } static Code_t @@ -872,6 +868,8 @@ realm_set_server(struct sockaddr_in *sin, return ZSRV_NORLM; realm->idx = realm_get_idx_by_addr(realm, sin); zdbug((LOG_DEBUG, "rlm_pick_srv: switched servers (%s)", inet_ntoa((realm->addrs[realm->idx]).sin_addr))); + + return 0; } void @@ -965,7 +963,7 @@ realm_sendit(ZNotice_t *notice, /* set a timer to retransmit */ nacked->timer = timer_set_rel(rexmit_times[0], rlm_rexmit, nacked); /* chain in */ - LIST_INSERT(&rlm_nacklist, nacked); + Unacked_insert(&rlm_nacklist, nacked); return; } @@ -991,7 +989,6 @@ rlm_rexmit(void *arg) Unacked *nackpacket = (Unacked *) arg; Code_t retval; register ZRealm *realm; - int new_srv_idx; zdbug((LOG_DEBUG,"rlm_rexmit")); @@ -1007,7 +1004,7 @@ rlm_rexmit(void *arg) if (nackpacket->rexmits >= (NUM_REXMIT_TIMES * realm->count)) { /* give a server ack that the packet is lost/realm dead */ packet_ctl_nack(nackpacket); - LIST_DELETE(nackpacket); + Unacked_delete(nackpacket); zdbug((LOG_DEBUG, "rlm_rexmit: %s appears dead", realm->name)); realm->state = REALM_DEAD; @@ -1088,12 +1085,11 @@ realm_sendit_auth(ZNotice_t *notice, int ack_to_sender) { char *buffer, *ptr; - caddr_t pack; - int buffer_len, hdrlen, offset, fragsize, ret_len, message_len; + int buffer_len, hdrlen, offset, fragsize, message_len; int origoffset, origlen; Code_t retval; Unacked *nacked; - char buf[1024], multi[64]; + char multi[64]; ZNotice_t partnotice, newnotice; offset = 0; @@ -1237,7 +1233,7 @@ realm_sendit_auth(ZNotice_t *notice, nacked->timer = timer_set_rel(rexmit_times[0], rlm_rexmit, nacked); /* chain in */ - LIST_INSERT(&rlm_nacklist, nacked); + Unacked_insert(&rlm_nacklist, nacked); offset += fragsize; @@ -1286,7 +1282,7 @@ realm_sendit_auth(ZNotice_t *notice, /* set a timer to retransmit */ nacked->timer = timer_set_rel(rexmit_times[0], rlm_rexmit, nacked); /* chain in */ - LIST_INSERT(&rlm_nacklist, nacked); + Unacked_insert(&rlm_nacklist, nacked); } return 0; } @@ -1342,7 +1338,6 @@ ticket_retrieve(ZRealm *realm) int pid; krb5_ccache ccache; krb5_error_code result; - krb5_auth_context authctx; krb5_creds creds_in, *creds; get_tgt(); diff --git a/server/server.c b/server/server.c index 2132a8e..809c419 100644 --- a/server/server.c +++ b/server/server.c @@ -471,7 +471,7 @@ server_timo(void *arg) auth = 0; break; default: - syslog(LOG_ERR,"Bad server state, server 0x%x\n",which); + syslog(LOG_ERR,"Bad server state, server 0x%x\n", (int)which); abort(); } /* now he's either TARDY, STARTING, or DEAD @@ -880,9 +880,9 @@ send_stats(struct sockaddr_in *who) do it this way. */ vers = get_version(); - sprintf(buf, "%d pkts", npackets); + sprintf(buf, "%lu pkts", npackets); pkts = strsave(buf); - sprintf(buf, "%d seconds operational",NOW - uptime); + sprintf(buf, "%ld seconds operational",NOW - uptime); upt = strsave(buf); #ifdef OLD_COMPAT @@ -1317,7 +1317,6 @@ send_msg_list(struct sockaddr_in *who, char *pack; int packlen; Code_t retval; - Unacked *nacked; memset (¬ice, 0, sizeof(notice)); @@ -1438,7 +1437,7 @@ server_forw_reliable(Server *server, nacked->uid = notice->z_uid; nacked->timer = timer_set_rel(rexmit_times[0], srv_rexmit, nacked); hashval = SRV_NACKTAB_HASHVAL(nacked->dest.srv_idx, nacked->uid); - LIST_INSERT(&srv_nacktab[hashval], nacked); + Unacked_insert(&srv_nacktab[hashval], nacked); } /* @@ -1490,7 +1489,7 @@ srv_nack_cancel(ZNotice_t *notice, && ZCompareUID(&nacked->uid, ¬ice->z_uid)) { timer_reset(nacked->timer); free(nacked->packet); - LIST_DELETE(nacked); + Unacked_delete(nacked); free(nacked); return; } @@ -1520,7 +1519,7 @@ srv_rexmit(void *arg) #if 0 zdbug((LOG_DEBUG, "cancelling send to dead server")); #endif - LIST_DELETE(packet); + Unacked_delete(packet); free(packet->packet); srv_nack_release(&otherservers[packet->dest.srv_idx]); free(packet); @@ -1559,7 +1558,7 @@ srv_nack_release(Server *server) next = nacked->next; if (nacked->dest.srv_idx == server - otherservers) { timer_reset(nacked->timer); - LIST_DELETE(nacked); + Unacked_delete(nacked); free(nacked->packet); free(nacked); } diff --git a/server/subscr.c b/server/subscr.c index a1fa916..ab67f33 100644 --- a/server/subscr.c +++ b/server/subscr.c @@ -95,10 +95,8 @@ static char **subscr_marshal_subs(ZNotice_t *notice, int auth, static Destlist *subscr_copy_def_subs(char *person); static Code_t subscr_realm_sendit(Client *who, Destlist *subs, ZNotice_t *notice, ZRealm *realm); -static void subscr_unsub_realms(Destlist *newsubs); static void subscr_unsub_sendit(Client *who, Destlist *subs, ZRealm *realm); -static int cl_match (Destlist*, Client *); static int defaults_read = 0; /* set to 1 if the default subs are in memory */ @@ -205,7 +203,7 @@ add_subscriptions(Client *who, } } else { /* If realm, let the REALM_ADD_SUBSCRIBE do insertion */ - LIST_INSERT(&who->subs, subs); + Destlist_insert(&who->subs, subs); } } } @@ -328,7 +326,6 @@ subscr_cancel(struct sockaddr_in *sin, Destlist *cancel_subs, *subs, *cancel_next, *client_subs, *client_next; Code_t retval; int found = 0; - int relation; #if 0 zdbug((LOG_DEBUG,"subscr_cancel")); @@ -349,7 +346,7 @@ subscr_cancel(struct sockaddr_in *sin, for (client_subs = who->subs; client_subs; client_subs = client_next) { client_next = client_subs->next; if (ZDest_eq(&client_subs->dest, &subs->dest)) { - LIST_DELETE(client_subs); + Destlist_delete(client_subs); retval = triplet_deregister(who, &client_subs->dest, NULL); if (retval == ZSRV_EMPTYCLASS && client_subs->dest.recip->string[0] == '@') { @@ -387,7 +384,6 @@ subscr_realm_cancel(struct sockaddr_in *sin, ZNotice_t *notice, ZRealm *realm) { - Client *who; Destlist *cancel_subs, *subs, *client_subs, *next, *next2; Code_t retval; int found = 0; @@ -407,7 +403,7 @@ subscr_realm_cancel(struct sockaddr_in *sin, for (client_subs = realm->subs; client_subs; client_subs = next2) { next2 = client_subs->next; if (ZDest_eq(&client_subs->dest, &subs->dest)) { - LIST_DELETE(client_subs); + Destlist_delete(client_subs); retval = triplet_deregister(realm->client, &client_subs->dest, realm); free_subscription(client_subs); found = 1; @@ -829,7 +825,7 @@ subscr_send_subs(Client *client) Destlist *subs; #ifdef HAVE_KRB5 char buf[512]; - char *bufp; + unsigned char *bufp; #else #ifdef HAVE_KRB4 char buf[512]; @@ -1020,7 +1016,7 @@ extract_subscriptions(ZNotice_t *notice) sub->dest.recip = make_string("", 0); else sub->dest.recip = make_string(recip, 0); - LIST_INSERT(&subs, sub); + Destlist_insert(&subs, sub); } return subs; } @@ -1035,8 +1031,6 @@ void subscr_dump_subs(FILE *fp, Destlist *subs) { - char *p; - if (!subs) /* no subscriptions to dump */ return; @@ -1069,7 +1063,6 @@ subscr_realm_sendit(Client *who, ZNotice_t snotice; char *pack; int packlen; - int found = 0, i; char **text; Code_t retval; char addr[16]; /* xxx.xxx.xxx.xxx max */ @@ -1151,7 +1144,7 @@ subscr_add_raw(Client *client, ZRealm *realm, Destlist *newsubs) { - Destlist *subs, *subs2, *subs3, **head; + Destlist *subs, *subs2, **head; Code_t retval; #if 0 @@ -1193,12 +1186,12 @@ subscr_add_raw(Client *client, sub->dest.classname->string, sub->dest.inst->string, sub->dest.recip->string, remrealm->name)); #endif - LIST_INSERT(&remrealm->remsubs, sub); + Destlist_insert(&remrealm->remsubs, sub); } } } } - LIST_INSERT(head, subs); + Destlist_insert(head, subs); } return ZERR_NONE; } @@ -1231,7 +1224,6 @@ subscr_unsub_sendit(Client *who, char **list; char *pack; int packlen; - int found = 0; Destlist *subsp, *subsn; for (subsp = realm->remsubs; subsp; subsp = subsn) { @@ -1242,7 +1234,7 @@ subscr_unsub_sendit(Client *who, subsp->dest.classname->string, subsp->dest.inst->string, subsp->dest.recip->string, realm->name)); #endif - LIST_DELETE(subsp); + Destlist_delete(subsp); free_subscription(subsp); break; } @@ -1356,9 +1348,7 @@ subscr_send_realm_subs(ZRealm *realm) Code_t subscr_realm_subs(ZRealm *realm) { - int i = 0; Destlist *subs, *next; - char buf[512]; char *text[2 + NUM_FIELDS]; unsigned short num = 0; Code_t retval; @@ -1445,7 +1435,7 @@ subscr_check_foreign_subs(ZNotice_t *notice, ZRealm *realm, Destlist *newsubs) { - Destlist *subs, *subs2, *next; + Destlist *subs, *next; Acl *acl; char **text; int found = 0; @@ -1541,7 +1531,7 @@ subscr_check_foreign_subs(ZNotice_t *notice, return retval; } } - LIST_INSERT(&realm->subs, subs); + Destlist_insert(&realm->subs, subs); } /* don't send confirmation if we're not the initial server contacted */ if (!(server_which_server(who) || found == 0)) { @@ -1579,7 +1569,6 @@ Code_t subscr_foreign_user(ZNotice_t *notice, ZRealm *realm) { Destlist *newsubs, *temp; - Acl *acl; Code_t status; Client *client; ZNotice_t snotice; @@ -1595,7 +1584,7 @@ Code_t subscr_foreign_user(ZNotice_t *notice, newwho.sin_addr.s_addr = inet_addr(cp); if (newwho.sin_addr.s_addr == -1) { - syslog(LOG_ERR, "malformed addr from %s, notice->z_sender"); + syslog(LOG_ERR, "malformed addr from %s", notice->z_sender); return(ZERR_NONE); } diff --git a/server/timer.c b/server/timer.c index 11d61fe..fe4b064 100644 --- a/server/timer.c +++ b/server/timer.c @@ -210,7 +210,6 @@ timer_process(void) Timer *t; timer_proc func; void *arg; - int valid = 0; if (num_timers == 0 || heap[0]->abstime > NOW) return; diff --git a/server/uloc.c b/server/uloc.c index 8583553..5768376 100644 --- a/server/uloc.c +++ b/server/uloc.c @@ -102,8 +102,6 @@ static void login_sendit __P((ZNotice_t *notice, int auth, static char **ulogin_marshal_locs __P((ZNotice_t *notice, int *found, int auth)); -static int ul_equiv __P((Location *l1, Location *l2)); - static void free_loc __P((Location *loc)); static void ulogin_locate_forward __P((ZNotice_t *notice, struct sockaddr_in *who, ZRealm *realm)); @@ -666,16 +664,6 @@ ulogin_find_user(char *user) return &locations[i]; } -static int -ul_equiv(Location *l1, Location *l2) -{ - if (l1->machine != l2->machine) - return 0; - if (l1->tty != l2->tty) - return 0; - return 1; -} - /* * remove the user specified in notice from the internal table */ diff --git a/server/zserver.h b/server/zserver.h index 69c19cb..0dcd5e0 100644 --- a/server/zserver.h +++ b/server/zserver.h @@ -54,19 +54,6 @@ Code_t ZFormatAuthenticNotice(ZNotice_t*, char*, int, int*, C_Block); #define KRB_INT32 ZEPHYR_INT32 #endif -/* These macros are for insertion into and deletion from a singly-linked list - * with back pointers to the previous element's next pointer. In order to - * make these macros act like expressions, they use the comma operator for - * sequenced evaluations of assignment, and "a && b" for "evaluate assignment - * b if expression a is true". */ -#define LIST_INSERT(head, elem) \ - ((elem)->next = *(head), \ - (*head) && ((*(head))->prev_p = &(elem)->next), \ - (*head) = (elem), (elem)->prev_p = (head)) -#define LIST_DELETE(elem) \ - (*(elem)->prev_p = (elem)->next, \ - (elem)->next && ((elem)->next->prev_p = (elem)->prev_p)) - /* Current time as cached by main(); use instead of time(). */ #define NOW t_local.tv_sec @@ -217,7 +204,39 @@ struct _Statistic { }; /* Function declarations */ + +/* These macros instantiate inline functions that do the work of the formder + LIST_INSERT and LIST_DELETE functions, which unfortunately triggered gcc's + pedanticism. The comment before the *former* macros was: */ +/* These macros are for insertion into and deletion from a singly-linked list + * with back pointers to the previous element's next pointer. In order to + * make these macros act like expressions, they use the comma operator for + * sequenced evaluations of assignment, and "a && b" for "evaluate assignment + * b if expression a is true". */ + +#define MAKE_LIST_INSERT(type) inline static void type##_insert(type **head, type *elem) \ + {\ + (elem)->next = *(head); \ + if(*head) (*(head))->prev_p = &(elem)->next; \ + (*head) = (elem); \ + (elem)->prev_p = (head); \ + } +#define MAKE_LIST_DELETE(type) inline static void type##_delete(type *elem) \ + {\ + *(elem)->prev_p = (elem)->next; \ + if((elem)->next) (elem)->next->prev_p = (elem)->prev_p; \ + } + +MAKE_LIST_INSERT(Destlist); +MAKE_LIST_DELETE(Destlist); +MAKE_LIST_INSERT(Client); +MAKE_LIST_DELETE(Client); +MAKE_LIST_INSERT(Triplet); +MAKE_LIST_DELETE(Triplet); +MAKE_LIST_INSERT(Unacked); +MAKE_LIST_DELETE(Unacked); + /* found in bdump.c */ void bdump_get(ZNotice_t *notice, int auth, struct sockaddr_in *who, Server *server); @@ -277,23 +296,14 @@ void hostm_shutdown(void); /* found in kstuff.c */ #ifdef HAVE_KRB4 int GetKerberosData (int, struct in_addr, AUTH_DAT *, char *, char *); +Code_t ReadKerberosData(int, int *, char **, int *); Code_t SendKerberosData (int, KTEXT, char *, char *); +Code_t SendKrb5Data(int, krb5_data *); +Code_t GetKrb5Data(int, krb5_data *); void sweep_ticket_hash_table(void *); +Code_t ZCheckRealmAuthentication(ZNotice_t *, struct sockaddr_in *, char *); #endif - -/* found in kopt.c */ -#ifdef HAVE_KRB4 -#ifndef NOENCRYPTION -Sched *check_key_sched_cache(des_cblock key); -void add_to_key_sched_cache(des_cblock key, Sched *sched); -/*int krb_set_key(void *key, int cvt);*/ -/* int krb_rd_req(KTEXT authent, char *service, char *instance, - unsigned KRB_INT32 from_addr, AUTH_DAT *ad, char *fn); */ -int krb_find_ticket(KTEXT authent, KTEXT ticket); -int krb_get_lrealm(char *r, int n); -#endif -#endif - + /* found in server.c */ void server_timo(void *which); void server_dump_servers(FILE *fp); @@ -324,6 +334,9 @@ void subscr_sendlist(ZNotice_t *notice, int auth, void subscr_dump_subs(FILE *fp, Destlist *subs); void subscr_reset(void); Code_t subscr_def_subs(Client *who); +Code_t subscr_realm(ZRealm *, ZNotice_t *); +Code_t subscr_send_realm_subs(ZRealm *); +Code_t subscr_realm_cancel(struct sockaddr_in *, ZNotice_t *, ZRealm *); /* found in uloc.c */ void uloc_hflush(struct in_addr *addr); @@ -334,6 +347,8 @@ Code_t ulogin_dispatch(ZNotice_t *notice, int auth, Code_t ulocate_dispatch(ZNotice_t *notice, int auth, struct sockaddr_in *who, Server *server); Code_t uloc_send_locations(void); +void ulogin_relay_locate(ZNotice_t *, struct sockaddr_in *); +void ulogin_realm_locate(ZNotice_t *, struct sockaddr_in *, ZRealm *); /* found in realm.c */ int realm_sender_in_realm(char *realm, char *sender); @@ -350,10 +365,18 @@ Code_t realm_control_dispatch(ZNotice_t *, int, struct sockaddr_in *, Server *, ZRealm *); void realm_shutdown(void); void realm_deathgram(Server *); +Code_t realm_send_realms(void); +Code_t realm_dispatch(ZNotice_t *, int, struct sockaddr_in *, Server *); +void realm_wakeup(void); +void kill_realm_pids(void); +void realm_dump_realms(FILE *); /* found in version.c */ char *get_version(void); +/* found in access.c */ +int access_check(char *, Acl *, Access); + /* global identifiers */ /* found in main.c */ diff --git a/zhm/queue.c b/zhm/queue.c index 27e7ca2..b028f7c 100644 --- a/zhm/queue.c +++ b/zhm/queue.c @@ -14,7 +14,7 @@ #ifndef lint #ifndef SABER -static char rcsid_queue_c[] = "$Id$"; +static const char rcsid_queue_c[] = "$Id$"; #endif /* SABER */ #endif /* lint */ @@ -31,9 +31,10 @@ static Queue *hm_queue; static int retransmits_enabled = 0; static Queue *find_notice_in_queue(ZNotice_t *notice); -static Code_t dump_queue(void); static void queue_timeout(void *arg); +extern void new_server(char *); + int rexmit_times[] = { 2, 2, 4, 4, 8, -1 }; #ifdef DEBUG @@ -82,7 +83,13 @@ add_notice_to_queue(ZNotice_t *notice, free(entry->packet); } else { entry->reply = *repl; - LIST_INSERT(&hm_queue, entry); + /*LIST_INSERT(&hm_queue, entry);*/ + + (entry)->next = *(&hm_queue); + if (*&hm_queue) ((*(&hm_queue))->prev_p = &(entry)->next); + (*&hm_queue) = (entry); + (entry)->prev_p = (&hm_queue); + } entry->timer = (retransmits_enabled) ? timer_set_rel(rexmit_times[0], queue_timeout, entry) : NULL; @@ -107,7 +114,9 @@ remove_notice_from_queue(ZNotice_t *notice, if (entry->timer) timer_reset(entry->timer); free(entry->packet); - LIST_DELETE(entry); + /*LIST_DELETE(entry);*/ + *(entry)->prev_p = (entry)->next; + if((entry)->next) ((entry)->next->prev_p = (entry)->prev_p); #ifdef DEBUG dump_queue(); #endif /* DEBUG */ diff --git a/zhm/timer.c b/zhm/timer.c index 82c02aa..4fb764e 100644 --- a/zhm/timer.c +++ b/zhm/timer.c @@ -211,7 +211,6 @@ timer_process(void) Timer *t; timer_proc func; void *arg; - int valid = 0; if (num_timers == 0 || heap[0]->abstime > time(NULL)) return; diff --git a/zhm/zhm.c b/zhm/zhm.c index f6f3fc1..8e1303d 100644 --- a/zhm/zhm.c +++ b/zhm/zhm.c @@ -49,6 +49,11 @@ static void init_hm(void); static void detach(void); static void send_stats(ZNotice_t *, struct sockaddr_in *); static char *strsave(const char *); + +extern void send_flush_notice(char *); +extern void server_manager(ZNotice_t *); +extern void send_boot_notice(char *); +extern void find_next_server(char *); extern int optind; static RETSIGTYPE @@ -70,7 +75,7 @@ main(int argc, ZNotice_t notice; ZPacket_t packet; Code_t ret; - int opt, pak_len, i, j = 0, fd, count; + int opt, pak_len, fd, count; fd_set readers; struct timeval tv; @@ -465,8 +470,9 @@ detach(void) /* detach from terminal and fork. */ register int i, x = ZGetFD(); register long size; - - if (i = fork()) { + + i = fork(); + if (i) { if (i < 0) perror("fork"); exit(0); diff --git a/zhm/zhm.h b/zhm/zhm.h index 3d6f153..c930098 100644 --- a/zhm/zhm.h +++ b/zhm/zhm.h @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include #include "timer.h" diff --git a/zhm/zhm_client.c b/zhm/zhm_client.c index 03514c6..0c5b68e 100644 --- a/zhm/zhm_client.c +++ b/zhm/zhm_client.c @@ -14,13 +14,16 @@ #ifndef lint #ifndef SABER -static char rcsid_hm_client_c[] = "$Id$"; +static const char rcsid_hm_client_c[] = "$Id$"; #endif /* SABER */ #endif /* lint */ extern int no_server, nclt, deactivated, noflushflag; extern struct sockaddr_in cli_sin, serv_sin, from; +extern void send_flush_notice(char *); +extern void new_server(char *sugg_serv); + void transmission_tower(ZNotice_t *notice, char *packet, int pak_len) diff --git a/zhm/zhm_server.c b/zhm/zhm_server.c index 47b2d59..9d8157f 100644 --- a/zhm/zhm_server.c +++ b/zhm/zhm_server.c @@ -14,7 +14,7 @@ #ifndef lint #ifndef SABER -static char rcsid_hm_server_c[] = "$Id$"; +static const char rcsid_hm_server_c[] = "$Id$"; #endif /* SABER */ #endif /* lint */ diff --git a/zwgc/X_driver.c b/zwgc/X_driver.c index 2577966..e969eb7 100644 --- a/zwgc/X_driver.c +++ b/zwgc/X_driver.c @@ -38,6 +38,7 @@ static const char rcsid_X_driver_c[] = "$Id$"; #include "X_gram.h" #include "xselect.h" #include "unsigned_long_dictionary.h" +#include "zephyr.h" char *app_instance; @@ -294,7 +295,8 @@ open_display_and_load_resources(int *pargc, /* * Get XENVIRONMENT resources, if they exist, and merge */ - if (filename = getenv("XENVIRONMENT")) + filename = getenv("XENVIRONMENT"); + if (filename) { temp_db3 = XrmGetFileDatabase(filename); XrmMergeDatabases(temp_db3, &temp_db1); @@ -354,9 +356,11 @@ X_driver_init(char *drivername, /* * For now, set some useful variables using resources: */ - if (sync=get_bool_resource("synchronous", "Synchronous", 0)) - XSynchronize(dpy,sync); - if (temp = get_string_resource("geometry", "Geometry")) + sync = get_bool_resource("synchronous", "Synchronous", 0); + if (sync) + XSynchronize(dpy, sync); + temp = get_string_resource("geometry", "Geometry"); + if (temp) var_set_variable("default_X_geometry", temp); temp=strrchr(argv[0],'/'); diff --git a/zwgc/X_fonts.c b/zwgc/X_fonts.c index 95e21d5..0d8e2b7 100644 --- a/zwgc/X_fonts.c +++ b/zwgc/X_fonts.c @@ -231,9 +231,9 @@ complete_get_fontst(Display *dpy, char *family,*fontname; XFontStruct *fontst; - if (family=get_family(style,substyle)) - if (fontname=get_fontname(family,size,face)) - if (fontst=get_fontst(dpy,fontname)) + if ((family=get_family(style,substyle))) + if ((fontname=get_fontname(family,size,face))) + if ((fontst=get_fontst(dpy,fontname))) return(fontst); /* If any part fails, */ return(NULL); @@ -259,16 +259,16 @@ get_font(Display *dpy, if (size == SPECIAL_SIZE) { /* attempt to process @font explicitly */ - if (fontst=get_fontst(dpy,substyle)) + if ((fontst = get_fontst(dpy, substyle))) return(fontst); } else { - if (family=get_family(style,substyle)) { - if (fontname=get_fontname(family,size,face)) - if (fontst=get_fontst(dpy,fontname)) + if ((family = get_family(style, substyle))) { + if ((fontname = get_fontname(family, size,face))) + if ((fontst = get_fontst(dpy, fontname))) return(fontst); } else { - if (fontname=get_fontname(substyle,size,face)) - if (fontst=get_fontst(dpy,fontname)) + if ((fontname = get_fontname(substyle, size, face))) + if ((fontst = get_fontst(dpy, fontname))) return(fontst); } @@ -276,17 +276,17 @@ get_font(Display *dpy, of substyle being the fontfamily didn't happen, either. */ fontst=NULL; - if (!(fontst=complete_get_fontst(dpy,style,"text",size,face))) - if (!(fontst=complete_get_fontst(dpy,"default",substyle,size,face))) - if (!(fontst=complete_get_fontst(dpy,"default","text",size,face))) - if (fontname=get_fontname("default",size,face)) - fontst=get_fontst(dpy,fontname); + if (!(fontst = complete_get_fontst(dpy,style,"text",size,face))) + if (!(fontst = complete_get_fontst(dpy,"default",substyle,size,face))) + if (!(fontst = complete_get_fontst(dpy,"default","text",size,face))) + if ((fontname = get_fontname("default",size,face))) + fontst = get_fontst(dpy,fontname); if (fontst) return(fontst); } /* If all else fails, try fixed */ - if (fontst=get_fontst(dpy,"fixed")) return(fontst); + if ((fontst=get_fontst(dpy,"fixed"))) return(fontst); /* No fonts available. Die. */ diff --git a/zwgc/X_gram.c b/zwgc/X_gram.c index 96e8fb1..6ce4297 100644 --- a/zwgc/X_gram.c +++ b/zwgc/X_gram.c @@ -127,15 +127,18 @@ x_gram_init(Display *dpy) default_fgcolor = default_bgcolor; default_bgcolor = tc; } - if (temp = get_string_resource("foreground","Foreground")) - default_fgcolor = x_string_to_color(temp,default_fgcolor); - if (temp = get_string_resource("background","Background")) - default_bgcolor = x_string_to_color(temp,default_bgcolor); + temp = get_string_resource("foreground", "Foreground"); + if (temp) + default_fgcolor = x_string_to_color(temp, default_fgcolor); + temp = get_string_resource("background", "Background"); + if (temp) + default_bgcolor = x_string_to_color(temp, default_bgcolor); default_bordercolor = default_fgcolor; - if (temp = get_string_resource("borderColor","BorderColor")) - default_bordercolor = x_string_to_color(temp,default_bordercolor); + temp = get_string_resource("borderColor", "BorderColor"); + if (temp) + default_bordercolor = x_string_to_color(temp, default_bordercolor); - temp = get_string_resource("minTimeToLive","MinTimeToLive"); + temp = get_string_resource("minTimeToLive", "MinTimeToLive"); if (temp && atoi(temp)>=0) ttl = atoi(temp); @@ -302,15 +305,15 @@ x_gram_create(Display *dpy, xpos = WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xpos - xsize - 2*border_width; else if (xalign == 0) - xpos = (WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xsize - - 2*border_width)>>1 + xpos; + xpos = ((WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xsize + - 2*border_width)>>1) + xpos; if (yalign<0) ypos = HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ypos - ysize - 2*border_width; else if (yalign == 0) - ypos = (HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ysize - - 2*border_width)>>1 + ypos; + ypos = ((HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ysize + - 2*border_width)>>1) + ypos; /* * Create the window: diff --git a/zwgc/X_gram.h b/zwgc/X_gram.h index 5d3f5d0..ed1adf7 100644 --- a/zwgc/X_gram.h +++ b/zwgc/X_gram.h @@ -82,5 +82,6 @@ extern void x_gram_expose(Display *, Window, x_gram *, XExposeEvent *); extern void xshow(Display *, desctype *, int, int); extern void xcut(Display *, XEvent *, XContext); extern void x_get_input(Display *); +extern void xshowinit(void); #endif diff --git a/zwgc/character_class.c b/zwgc/character_class.c index a11aa86..2f3c433 100644 --- a/zwgc/character_class.c +++ b/zwgc/character_class.c @@ -37,7 +37,7 @@ string_to_character_class(string str) (void) memset(cache, 0, sizeof(cache)); for (i=0; icode=DT_STR; here->str=curstr; here->len=len; diff --git a/zwgc/lexer.c b/zwgc/lexer.c index 7e32086..e821eb9 100644 --- a/zwgc/lexer.c +++ b/zwgc/lexer.c @@ -470,7 +470,8 @@ handle_show(void) if (c!='\n') unput(c); - if (yylval.text = eat_til_endshow(start_line_no)) + yylval.text = eat_til_endshow(start_line_no); + if (yylval.text) return(SHOW); else return(ERROR); @@ -656,7 +657,8 @@ int yylex(void) * Handle constant strings: */ case '"': - if (yylval.text = eat_string(yylineno)) + yylval.text = eat_string(yylineno); + if (yylval.text) return(STRING); else return(ERROR); diff --git a/zwgc/main.c b/zwgc/main.c index 3568443..8584eca 100644 --- a/zwgc/main.c +++ b/zwgc/main.c @@ -114,6 +114,7 @@ fake_startup_packet(void) ZNotice_t notice; struct timezone tz; char msgbuf[BUFSIZ]; + extern void Z_gettimeofday(struct _ZTimeval *, struct timezone *); var_set_variable("version", zwgc_version_string); @@ -371,7 +372,8 @@ process_notice(ZNotice_t *notice, dprintf("Got a message\n"); - if (control_opcode = decode_notice(notice, hostname)) { + control_opcode = decode_notice(notice, hostname); + if (control_opcode) { #ifdef DEBUG printf("got control opcode <%s>.\n", control_opcode); #endif @@ -548,6 +550,7 @@ detach(void) * of finding the session leader; otherwise use the process group of * the parent process, which is a good guess. */ #if defined(HAVE_GETSID) + setpgid(0, getsid(0)); #elif defined(HAVE_GETPGID) setpgid(0, getpgid(getppid())); @@ -556,7 +559,8 @@ detach(void) #endif /* fork off and let parent exit... */ - if (i = fork()) { + i = fork(); + if (i) { if (i < 0) { perror("zwgc: cannot fork, aborting:"); exit(1); diff --git a/zwgc/port.c b/zwgc/port.c index 55d6274..3d73a69 100644 --- a/zwgc/port.c +++ b/zwgc/port.c @@ -105,7 +105,8 @@ port_close_input(port *p) if (!close_input_proc) return; - if (error = close_input_proc(p)) + error = close_input_proc(p); + if (error) var_set_variable("error", error); } @@ -123,7 +124,8 @@ port_close_output(port *p) if (!close_output_proc) return; - if (error = close_output_proc(p)) + error = close_output_proc(p); + if (error) var_set_variable("error", error); } diff --git a/zwgc/standard_ports.c b/zwgc/standard_ports.c index f679f4e..1c6d1ce 100644 --- a/zwgc/standard_ports.c +++ b/zwgc/standard_ports.c @@ -208,21 +208,25 @@ void init_standard_ports(int *pargc, current++; *pargc -= 2; if (!*current) usage(); - if (p = get_standard_port_info((string) *current)) + p = get_standard_port_info((string) *current); + if (p) p->port_setup_status = DISABLED; } else if (string_Eq((string) *current, "-default")) { current++; *pargc -= 2; if (!*current) usage(); default_port = (string) *current; - if (p = get_standard_port_info((string) *current)) + p = get_standard_port_info((string) *current); + if (p) p->port_setup_status = DEFAULT_OK; } else if (string_Eq((string) *current, "-ttymode")) { default_port = (string) "tty"; (*pargc)--; - if (p = get_standard_port_info(default_port)) { + p = get_standard_port_info(default_port); + if (p) { p->port_setup_status = DEFAULT_OK; - if (p = get_standard_port_info ((string) "X")) + p = get_standard_port_info ((string) "X"); + if (p) p->port_setup_status = DISABLED; } } else diff --git a/zwgc/string_dictionary_aux.c b/zwgc/string_dictionary_aux.c index daee49c..5dfd89d 100644 --- a/zwgc/string_dictionary_aux.c +++ b/zwgc/string_dictionary_aux.c @@ -12,7 +12,7 @@ */ #if (!defined(lint) && !defined(SABER)) -static char rcsid_string_dictionary_aux_c[] = "$Id$"; +static const char rcsid_string_dictionary_aux_c[] = "$Id$"; #endif /* diff --git a/zwgc/subscriptions.c b/zwgc/subscriptions.c index cfe932e..5123d5f 100644 --- a/zwgc/subscriptions.c +++ b/zwgc/subscriptions.c @@ -12,7 +12,7 @@ */ #if (!defined(lint) && !defined(SABER)) -static char rcsid_subscriptions_c[] = "$Id$"; +static const char rcsid_subscriptions_c[] = "$Id$"; #endif /****************************************************************************/ @@ -271,8 +271,9 @@ load_subscriptions_from_file(FILE *file) /* Parse line */ /* <<<>>> * The below does NOT work is the recipient field is "": - */ - if (temp = strchr(line, '#')) + */ + temp = strchr(line, '#'); + if (temp) *temp = '\0'; for (temp=line; *temp && *temp==' '; temp++) ; if (!*temp || *temp=='\n') diff --git a/zwgc/substitute.c b/zwgc/substitute.c index d50614c..26accc1 100644 --- a/zwgc/substitute.c +++ b/zwgc/substitute.c @@ -12,7 +12,7 @@ */ #if (!defined(lint) && !defined(SABER)) -static char rcsid_substitute_c[] = "$Id$"; +static const char rcsid_substitute_c[] = "$Id$"; #endif #include diff --git a/zwgc/text_operations.c b/zwgc/text_operations.c index 34f0d4c..16d9047 100644 --- a/zwgc/text_operations.c +++ b/zwgc/text_operations.c @@ -47,7 +47,7 @@ lbreak(string *text_ptr, string result, whats_left; char *p = *text_ptr; - while (*p && !set[*p]) p++; + while (*p && !set[(int)*p]) p++; result = string_CreateFromData(*text_ptr, p - *text_ptr); whats_left = string_Copy(p); @@ -64,7 +64,7 @@ lspan(string *text_ptr, string result, whats_left; char *p = *text_ptr; - while (*p && set[*p]) p++; + while (*p && set[(int)*p]) p++; result = string_CreateFromData(*text_ptr, p - *text_ptr); whats_left = string_Copy(p); @@ -100,7 +100,7 @@ rbreak(string *text_ptr, string text = *text_ptr; char *p = text + strlen(text); - while (text

+#else +#ifdef HAVE_TERM_H +#include +#endif #endif #include "new_memory.h" @@ -138,59 +142,65 @@ tty_filter_init(char *drivername, tmp = tgetstr("pc", &p); PC = (tmp) ? *tmp : 0; - if (tmp = tgetstr("md",&p)) { /* bold ? */ + tmp = tgetstr("md", &p); + if (tmp) { /* bold ? */ EXPAND("B.bold"); tmp = tgetstr("me",&p); EXPAND("E.bold"); } - if (tmp = tgetstr("mr",&p)) { /* reverse video? */ + tmp = tgetstr("mr", &p); + if (tmp) { /* reverse video? */ EXPAND("B.rw"); - tmp = tgetstr("me",&p); + tmp = tgetstr("me", &p); EXPAND("E.rw"); } - if (tmp = tgetstr("bl",&p)) { /* Bell ? */ + tmp = tgetstr("bl", &p); + if (tmp) { /* Bell ? */ EXPAND("B.bell"); TD_SET("E.bell", NULL); } - if (tmp = tgetstr("mb",&p)) { /* Blink ? */ + tmp = tgetstr("mb", &p); + if (tmp) { /* Blink ? */ EXPAND("B.blink"); - tmp = tgetstr("me",&p); + tmp = tgetstr("me", &p); EXPAND("E.blink"); } - if (tmp = tgetstr("us",&p)) { /* Underline ? */ + tmp = tgetstr("us", &p); + if (tmp) { /* Underline ? */ EXPAND("B.u"); - tmp = tgetstr("ue",&p); + tmp = tgetstr("ue", &p); EXPAND("E.u"); } - if (tmp = tgetstr("so",&p)) { /* Standout ? */ + tmp = tgetstr("so", &p); + if (tmp) { /* Standout ? */ EXPAND("B.so"); - tmp = tgetstr("se",&p); + tmp = tgetstr("se", &p); EXPAND("E.so"); } } /* Step 2: alias others to the nearest substitute */ /* Bold = so, else rv, else ul */ - if (NULL == string_dictionary_Lookup(termcap_dict,"B.bold")) { - if(b = string_dictionary_Lookup(termcap_dict,"B.so")) { - TD_SET("B.bold",b->value); + if (NULL == string_dictionary_Lookup(termcap_dict, "B.bold")) { + if((b = string_dictionary_Lookup(termcap_dict, "B.so"))) { + TD_SET("B.bold", b->value); TD_SET("E.bold", - string_dictionary_Lookup(termcap_dict,"E.so")->value); - } else if (b = string_dictionary_Lookup(termcap_dict,"B.rv")) { - TD_SET("B.bold",b->value); + string_dictionary_Lookup(termcap_dict, "E.so")->value); + } else if ((b = string_dictionary_Lookup(termcap_dict, "B.rv"))) { + TD_SET("B.bold", b->value); TD_SET("E.bold", - string_dictionary_Lookup(termcap_dict,"E.rv")->value); - } else if (b = string_dictionary_Lookup(termcap_dict,"B.u")) { - TD_SET("B.bold",b->value); + string_dictionary_Lookup(termcap_dict, "E.rv")->value); + } else if ((b = string_dictionary_Lookup(termcap_dict,"B.u"))) { + TD_SET("B.bold", b->value); TD_SET("E.bold", - string_dictionary_Lookup(termcap_dict,"E.u")->value); + string_dictionary_Lookup(termcap_dict, "E.u")->value); } } /* Bell = ^G */ - if (NULL == string_dictionary_Lookup(termcap_dict,"B.bell")) { - TD_SET("B.bell","\007"); - TD_SET("E.bell",NULL); + if (NULL == string_dictionary_Lookup(termcap_dict, "B.bell")) { + TD_SET("B.bell", "\007"); + TD_SET("E.bell", NULL); } /* Underline -> nothing */ @@ -486,10 +496,12 @@ tty_filter(string text, item = string_Copy(""); if (info->bold_p && use_fonts) { - if (temp = string_dictionary_Fetch(termcap_dict, "B.bold")) + temp = string_dictionary_Fetch(termcap_dict, "B.bold"); + if (temp) item = string_Concat2(item, temp); } else if (info->italic_p && use_fonts) { - if (temp = string_dictionary_Fetch(termcap_dict, "B.u")) + temp = string_dictionary_Fetch(termcap_dict, "B.u"); + if (temp) item = string_Concat2(item, temp); } temp = string_CreateFromData(info->str, info->len); @@ -497,10 +509,12 @@ tty_filter(string text, free(temp); if (info->bold_p && use_fonts) { - if (temp = string_dictionary_Fetch(termcap_dict, "E.bold")) + temp = string_dictionary_Fetch(termcap_dict, "E.bold"); + if (temp) item = string_Concat2(item, temp); } else if (info->italic_p && use_fonts) { - if (temp = string_dictionary_Fetch(termcap_dict, "E.u")) + temp = string_dictionary_Fetch(termcap_dict, "E.u"); + if (temp) item = string_Concat2(item, temp); } diff --git a/zwgc/variables.c b/zwgc/variables.c index a444b44..3368c1f 100644 --- a/zwgc/variables.c +++ b/zwgc/variables.c @@ -113,7 +113,8 @@ var_get_variable(string name) static string last_get_field_call_result = NULL; if (is_number_variable(name)) { - if (result = string_dictionary_Fetch(number_variable_dict, name)) + result = string_dictionary_Fetch(number_variable_dict, name); + if (result) return(result); /* diff --git a/zwgc/xcut.c b/zwgc/xcut.c index b6019a9..4fad2a7 100644 --- a/zwgc/xcut.c +++ b/zwgc/xcut.c @@ -37,6 +37,7 @@ static const char rcsid_xcut_c[] = "$Id$"; #include "xmark.h" #include "error.h" #include "xrevstack.h" +#include "X_driver.h" /* * diff --git a/zwgc/xmark.c b/zwgc/xmark.c index 7285834..6a6a7a0 100644 --- a/zwgc/xmark.c +++ b/zwgc/xmark.c @@ -12,7 +12,7 @@ */ #if (!defined(lint) && !defined(SABER)) -static char rcsid_xmark_c[] = "$Id$"; +static const char rcsid_xmark_c[] = "$Id$"; #endif #include diff --git a/zwgc/xrevstack.h b/zwgc/xrevstack.h index 0976821..20d1fe9 100644 --- a/zwgc/xrevstack.h +++ b/zwgc/xrevstack.h @@ -15,7 +15,7 @@ #define _XREVSTACK_H_ #if (!defined(lint) && !defined(SABER)) -static char rcsid_xrevstack_h[] = "$Id$"; +static const char rcsid_xrevstack_h[] = "$Id$"; #endif #include diff --git a/zwgc/xselect.c b/zwgc/xselect.c index 2579dc4..2192182 100644 --- a/zwgc/xselect.c +++ b/zwgc/xselect.c @@ -118,7 +118,8 @@ xselSetProperties(Display *dpy, } else if (target==XA_STRING) { char *selected; - if (selected = getSelectedText()) { + selected = getSelectedText(); + if (selected) { ChangeProp(XA_STRING,8,selected,string_Length(selected)); } else { /* This should only happen if the pasting client is out of @@ -179,8 +180,8 @@ xselProcessSelection(Display *dpy, #endif if ((ownership_start == CurrentTime) || - ((selreq->time != CurrentTime) && - (selreq->time < ownership_start) || + (((selreq->time != CurrentTime) && + (selreq->time < ownership_start)) || ((ownership_end != CurrentTime) && (ownership_end > ownership_start) && (selreq->time > ownership_end)))) diff --git a/zwgc/xshow.c b/zwgc/xshow.c index 68c64eb..6667013 100644 --- a/zwgc/xshow.c +++ b/zwgc/xshow.c @@ -38,7 +38,6 @@ static const char rcsid_xshow_c[] = "$Id$"; #define max(a,b) ((a)>(b)?(a):(b)) XContext desc_context; -static pointer_dictionary colorname_dict = NULL; extern int internal_border_width; extern unsigned long default_bgcolor; diff --git a/zwgc/zephyr.c b/zwgc/zephyr.c index e1497d4..f672d84 100644 --- a/zwgc/zephyr.c +++ b/zwgc/zephyr.c @@ -64,7 +64,8 @@ get_zwgc_port_number_filename(void) static char buffer[40]; char *temp; - if (temp = getenv("WGFILE")) + temp = getenv("WGFILE"); + if (temp) return(temp); else { sprintf(buffer, "/tmp/wg.%d", getuid()); @@ -170,7 +171,8 @@ void zephyr_init(void (*notice_handler)(ZNotice_t *)) * not one of the allowed ones, print an error and treat it as * EXPOSE_NONE. */ - if (temp = ZGetVariable("exposure")) { + temp = ZGetVariable("exposure"); + if (temp) { if (!(exposure = ZParseExposureLevel(temp))) { ERROR2("invalid exposure level %s, using exposure level none instead.\n", temp); exposure = EXPOSE_NONE; diff --git a/zwgc/zephyr.h b/zwgc/zephyr.h index e821bfd..1e714a3 100644 --- a/zwgc/zephyr.h +++ b/zwgc/zephyr.h @@ -17,6 +17,8 @@ #ifndef zephyr_MODULE #define zephyr_MODULE +#include + extern void zephyr_init(void(*)(ZNotice_t *)); extern void finalize_zephyr(void); extern void write_wgfile(void); -- cgit v1.2.3