From ef309854e7deb203ec2c14019fc36fd74d0721b2 Mon Sep 17 00:00:00 2001 From: kcr Date: Thu, 18 Dec 2008 04:49:51 +0000 Subject: [PATCH] r4281@bucket (orig r271): kcr | 2008-01-21 14:50:52 -0500 collapse state of a bunch of #if 0 and #if 1 debugging output git-svn-id: svn://svn.1ts.org/debian/trunk@343 cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f --- zephyr/server/access.c | 4 -- zephyr/server/acl_files.c | 25 +---------- zephyr/server/bdump.c | 59 ++++++++----------------- zephyr/server/class.c | 4 -- zephyr/server/dispatch.c | 71 ------------------------------ zephyr/server/main.c | 10 +---- zephyr/server/realm.c | 28 +----------- zephyr/server/server.c | 91 ++------------------------------------- zephyr/server/subscr.c | 90 -------------------------------------- 9 files changed, 24 insertions(+), 358 deletions(-) diff --git a/zephyr/server/access.c b/zephyr/server/access.c index 58854c8..cbe6416 100644 --- a/zephyr/server/access.c +++ b/zephyr/server/access.c @@ -95,10 +95,6 @@ access_check(char *sender, * If we can't load it (because it probably doesn't exist), * we deny access. */ -#if 0 - zdbug ((LOG_DEBUG, "checking %s for %s", buf, sender)); -#endif - retval = acl_load(buf); if (retval < 0) { syslog(LOG_DEBUG, "Error in acl_load of %s for %s", buf, sender); diff --git a/zephyr/server/acl_files.c b/zephyr/server/acl_files.c index 291f8e3..1484a8d 100644 --- a/zephyr/server/acl_files.c +++ b/zephyr/server/acl_files.c @@ -317,9 +317,6 @@ add_hash(struct hashtbl *h, char **old; int i; -#if 0 - fprintf (stderr, "adding %s to acl hash %08X\n", el, h); -#endif /* Make space if it isn't there already */ if (h->entries + 1 > (h->size >> 1)) { old = h->tbl; @@ -350,23 +347,11 @@ check_hash(struct hashtbl *h, { unsigned hv; -#if 0 - fprintf (stderr, "looking for %s in acl %08X\n", el, h); -#endif for (hv = hashval(el) % h->size; h->tbl[hv]; hv = (hv + 1) % h->size) { -#if 0 - fprintf (stderr, "\tstrcmp (%s,...)\n", h->tbl[hv]); -#endif if (!strcmp(h->tbl[hv], el)) { -#if 0 - fprintf (stderr, "success!\n"); -#endif return 1; } } -#if 0 - fprintf (stderr, "failure\n"); -#endif return 0; } @@ -421,13 +406,8 @@ int acl_load(char *name) */ if (acl_cache[i].acl == (struct hashtbl *) 0) { /* Gotta reload */ -#if 0 - fprintf (stderr, "attempting to load %s\n", name); -#endif if ((f = fopen(name, "r")) == NULL) { -#if 0 - perror (name); -#endif + syslog(LOG_ERR, "Error loading acl file %s: %m", name); return -1; } if (acl_cache[i].acl) destroy_hash(acl_cache[i].acl); @@ -470,9 +450,6 @@ acl_exact_match(char *acl, { int idx; -#if 0 - fprintf (stderr, "checking for %s in %s\n", principal, acl); -#endif return((idx = acl_load(acl)) >= 0 && check_hash(acl_cache[idx].acl, principal)); } diff --git a/zephyr/server/bdump.c b/zephyr/server/bdump.c index a88f371..eca728e 100644 --- a/zephyr/server/bdump.c +++ b/zephyr/server/bdump.c @@ -150,9 +150,9 @@ bdump_offer(struct sockaddr_in *who) #ifndef HAVE_KRB4 int bdump_port = IPPORT_RESERVED - 1; #endif /* !HAVE_KRB4 */ -#if 1 + zdbug((LOG_DEBUG, "bdump_offer")); -#endif + #if defined(HAVE_KRB4) || defined(HAVE_KRB5) /* * when using kerberos server-server authentication, we can @@ -231,11 +231,9 @@ bdump_offer(struct sockaddr_in *who) send_list(ACKED, srv_addr.sin_port, ZEPHYR_ADMIN_CLASS, bdump_version, ADMIN_BDUMP, myname, "", lyst, 2); -#if 1 zdbug((LOG_DEBUG,"bdump_offer: address is %s/%d\n", inet_ntoa(bdump_sin.sin_addr), ntohs(bdump_sin.sin_port))); -#endif return; } @@ -275,9 +273,8 @@ bdump_send(void) unsigned short fromport; #endif /* HAVE_KRB4 */ -#if 1 zdbug((LOG_DEBUG, "bdump_send")); -#endif + /* accept the connection, and send the brain dump */ live_socket = accept(bdump_socket, (struct sockaddr *) &from, &fromlen); if (live_socket < 0) { @@ -310,10 +307,9 @@ bdump_send(void) syslog(LOG_ERR, "bdump_send: unknown server?"); server = limbo_server; } -#if 1 + zdbug((LOG_DEBUG, "bdump_send: connection from %s/%d", inet_ntoa(from.sin_addr), ntohs(from.sin_port))); -#endif bdumping = 1; server->dumping = 1; @@ -505,18 +501,16 @@ bdump_send(void) cleanup(server); return; } -#if 1 + zdbug((LOG_DEBUG, "bdump_send: finished")); -#endif + if (server != limbo_server) { /* set this guy to be up, and schedule a hello */ server->state = SERV_UP; timer_reset(server->timer); server->timer = timer_set_rel(0L, server_timo, server); } -#if 0 - zdbug((LOG_DEBUG,"cleanup sbd")); -#endif + shutdown_file_pointers(); #ifdef _POSIX_VERSION @@ -624,9 +618,8 @@ bdump_get_v12 (ZNotice_t *notice, if (setsockopt(live_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0) syslog(LOG_WARNING, "bdump_get: setsockopt (SO_KEEPALIVE): %m"); -#if 1 + zdbug((LOG_DEBUG, "bdump_get: connected")); -#endif /* Now begin the brain dump. */ #if defined(HAVE_KRB4) || defined(HAVE_KRB5) @@ -795,17 +788,17 @@ bdump_get_v12 (ZNotice_t *notice, cleanup(server); return; } -#if 1 + zdbug((LOG_DEBUG, "bdump_get: gbd finished")); -#endif + /* set this guy to be up, and schedule a hello */ server->state = SERV_UP; timer_reset(server->timer); server->timer = timer_set_rel(0L, server_timo, server); -#if 1 + zdbug((LOG_DEBUG,"cleanup gbd")); -#endif + shutdown_file_pointers(); #ifdef _POSIX_VERSION action.sa_handler = SIG_DFL; @@ -831,12 +824,11 @@ bdump_get(ZNotice_t *notice, proc = NULL; -#if 1 if (zdebug) { syslog(LOG_DEBUG, "bdump_get: bdump v%s avail %s", notice->z_class_inst, inet_ntoa(who->sin_addr)); } -#endif + if (strcmp (notice->z_class_inst, "1.2") == 0) proc = bdump_get_v12; @@ -977,9 +969,8 @@ cleanup(Server *server) struct sigaction action; #endif -#if 1 zdbug((LOG_DEBUG, "bdump cleanup")); -#endif + if (server != limbo_server) { server->state = SERV_DEAD; timer_reset(server->timer); @@ -1010,10 +1001,10 @@ get_tgt(void) /* have they expired ? */ if (ticket_time < NOW - tkt_lifetime(TKTLIFETIME) + (15L * 60L)) { /* +15 for leeway */ -#if 0 + zdbug((LOG_DEBUG,"get new tickets: %d %d %d", ticket_time, NOW, NOW - tkt_lifetime(TKTLIFETIME) + 15L)); -#endif + dest_tkt(); retval = krb_get_svc_in_tkt(SERVER_SERVICE, buf, ZGetRealm(), @@ -1103,13 +1094,10 @@ close_bdump(void *arg) close(bdump_socket); nfds = srv_socket + 1; bdump_socket = -1; -#if 1 + zdbug((LOG_DEBUG, "bdump not used")); -#endif } else { -#if 1 zdbug((LOG_DEBUG, "bdump not open")); -#endif } return; } @@ -1139,9 +1127,7 @@ bdump_recv_loop(Server *server) #endif /* HAVE_KRB4 */ ZRealm *realm = NULL; -#if 1 zdbug((LOG_DEBUG, "bdump recv loop")); -#endif /* do the inverse of bdump_send_loop, registering stuff on the fly */ while (1) { @@ -1335,9 +1321,7 @@ bdump_send_loop(Server *server) { Code_t retval; -#if 1 zdbug((LOG_DEBUG, "bdump send loop")); -#endif retval = uloc_send_locations(); if (retval != ZERR_NONE) @@ -1360,9 +1344,8 @@ send_done(void) { Code_t retval; -#if 1 zdbug((LOG_DEBUG, "send_done")); -#endif + retval = send_normal_tcp(SERVACK, bdump_sin.sin_port, ZEPHYR_ADMIN_CLASS, "", ADMIN_DONE, myname, "", NULL, 0); return retval; @@ -1554,18 +1537,12 @@ extract_sin(ZNotice_t *notice, struct sockaddr_in *target) buf = cp; if (!notice->z_message_len || *buf == '\0') { -#if 0 - zdbug((LOG_DEBUG,"no addr")); -#endif return ZSRV_PKSHORT; } target->sin_addr.s_addr = inet_addr(cp); cp += (strlen(cp) + 1); /* past the null */ if ((cp >= notice->z_message + notice->z_message_len) || (*cp == '\0')) { -#if 0 - zdbug((LOG_DEBUG, "no port")); -#endif return(ZSRV_PKSHORT); } target->sin_port = htons((u_short) atoi(cp)); diff --git a/zephyr/server/class.c b/zephyr/server/class.c index 047b3e6..0a974e4 100644 --- a/zephyr/server/class.c +++ b/zephyr/server/class.c @@ -145,10 +145,6 @@ triplet_deregister(Client *client, int retval; unsigned long hashval; -#if 0 - zdbug((LOG_DEBUG, "class_dereg: %s %s", dest->classname->string, - dest->inst->string)); -#endif hashval = DEST_HASHVAL(*dest); for (triplet = triplet_bucket[hashval]; triplet; triplet = triplet->next) { if (ZDest_eq(&triplet->dest, dest)) { diff --git a/zephyr/server/dispatch.c b/zephyr/server/dispatch.c index cb52923..f765ac8 100644 --- a/zephyr/server/dispatch.c +++ b/zephyr/server/dispatch.c @@ -150,9 +150,7 @@ handle_packet(void) if (otherservers[me_server_idx].queue) { /* something here for me; take care of it */ -#if 1 zdbug((LOG_DEBUG, "internal queue process")); -#endif pending = server_dequeue(me_server); @@ -268,16 +266,6 @@ dispatch(ZNotice_t *notice, inet_ntoa(who->sin_addr)); return; } -#if 0 - if (zdebug) { - syslog(LOG_DEBUG, - "disp:%s '%s' '%s' '%s' notice to '%s' from '%s' %s/%d/%d", - ZNoticeKinds[(int) notice->z_kind], notice->z_class, - notice->z_class_inst, notice->z_opcode, notice->z_recipient, - notice->z_sender, inet_ntoa(who->sin_addr), - ntohs(who->sin_port), ntohs(notice->z_port)); - } -#endif if (notice->z_kind == CLIENTACK) { nack_cancel(notice, who); @@ -602,10 +590,6 @@ xmit(ZNotice_t *notice, int packlen, sendfail = 0; Code_t retval; -#if 0 - zdbug((LOG_DEBUG,"xmit")); -#endif - noticepack = (char *) malloc(sizeof(ZPacket_t)); if (!noticepack) { syslog(LOG_ERR, "xmit malloc"); @@ -754,10 +738,6 @@ xmit(ZNotice_t *notice, return; /* DON'T put on nack list */ } } -#if 0 - zdbug((LOG_DEBUG," to %s/%d", inet_ntoa(dest->sin_addr), - ntohs(dest->sin_port))); -#endif retval = ZSetDestAddr(dest); if (retval != ZERR_NONE) { syslog(LOG_WARNING, "xmit set addr: %s", error_message(retval)); @@ -807,11 +787,9 @@ rexmit(void *arg) Unacked *nacked = (Unacked *) arg; int retval; -#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, (int)NOW); -#endif nacked->rexmits++; if (rexmit_times[nacked->rexmits] == -1) { @@ -839,10 +817,6 @@ rexmit(void *arg) } /* retransmit the packet */ -#if 0 - zdbug((LOG_DEBUG," to %s/%d", inet_ntoa(nacked->dest.addr.sin_addr), - ntohs(nacked->dest.addr.sin_port))); -#endif retval = ZSetDestAddr(&nacked->dest.addr); if (retval != ZERR_NONE) { syslog(LOG_WARNING, "rexmit set addr: %s", error_message(retval)); @@ -879,9 +853,7 @@ clt_ack(ZNotice_t *notice, Code_t retval; if (bdumping) { /* don't ack while dumping */ -#if 1 zdbug((LOG_DEBUG,"bdumping, no ack")); -#endif return; } @@ -911,12 +883,6 @@ clt_ack(ZNotice_t *notice, abort (); } -#if 0 - zdbug((LOG_DEBUG,"clt_ack type %s for %d to %s/%d", sent_name, - ntohs(notice->z_port), inet_ntoa(who->sin_addr), - ntohs(who->sin_port))); -#endif - acknotice.z_multinotice = ""; /* leave room for the trailing null */ @@ -969,11 +935,6 @@ nack_cancel(ZNotice_t *notice, int hashval; /* search the not-yet-acked table for this packet, and flush it. */ -#if 0 - zdbug((LOG_DEBUG, "nack_cancel: %s:%08X,%08X", - inet_ntoa(notice->z_uid.zuid_addr), - notice->z_uid.tv.tv_sec, notice->z_uid.tv.tv_usec)); -#endif hashval = NACKTAB_HASHVAL(*who, notice->z_uid); for (nacked = nacktab[hashval]; nacked; nacked = nacked->next) { if (nacked->dest.addr.sin_addr.s_addr == who->sin_addr.s_addr @@ -989,11 +950,9 @@ nack_cancel(ZNotice_t *notice, } } -#if 1 zdbug((LOG_DEBUG,"nack_cancel: nack not found %s:%08X,%08X", inet_ntoa (notice->z_uid.zuid_addr), notice->z_uid.tv.tv_sec, notice->z_uid.tv.tv_usec)); -#endif } /* for compatibility when sending subscription information to old clients */ @@ -1012,17 +971,10 @@ hostm_dispatch(ZNotice_t *notice, char *opcode = notice->z_opcode; int i, add = 0, remove = 0; -#if 0 - zdbug((LOG_DEBUG,"hm_disp")); -#endif - if (notice->z_kind == HMACK) { /* Ignore. */ ; } else if (notice->z_kind != HMCTL) { -#if 0 - zdbug((LOG_DEBUG, "bogus HM packet")); -#endif clt_ack(notice, who, AUTH_FAILED); } else if (strcmp(opcode, HM_FLUSH) == 0) { client_flush_host(&who->sin_addr); @@ -1134,9 +1086,6 @@ control_dispatch(ZNotice_t *notice, subscr_sendlist(notice, auth, who); return ZERR_NONE; } else if (!auth) { -#if 0 - zdbug((LOG_DEBUG,"unauth ctrl_disp")); -#endif if (server == me_server) clt_ack(notice, who, AUTH_FAILED); return ZERR_NONE; @@ -1202,19 +1151,6 @@ control_dispatch(ZNotice_t *notice, clt_ack(notice, who, AUTH_FAILED); return ZERR_NONE; } -#if 0 - if (zdebug) { - if (server == me_server) { - syslog(LOG_DEBUG, "subscription cancel for %s/%d\n", - inet_ntoa(who->sin_addr), ntohs(who->sin_port)); - } else { - syslog(LOG_DEBUG, - "subscription cancel for %s/%d from %s\n", - inet_ntoa(who->sin_addr), ntohs(who->sin_port), - server->addr_str); - } - } -#endif subscr_cancel(who, notice); } else { nack(notice, who); @@ -1224,9 +1160,6 @@ control_dispatch(ZNotice_t *notice, /* canceling subscriptions implies I can punt info about this client */ client = client_find(&who->sin_addr, notice->z_port); if (client == NULL) { -#if 0 - zdbug((LOG_DEBUG,"can_sub not found client")); -#endif if (server == me_server) nack(notice, who); return ZERR_NONE; @@ -1238,10 +1171,6 @@ control_dispatch(ZNotice_t *notice, return ZERR_NONE; } /* don't flush locations here, let him do it explicitly */ -#if 0 - zdbug((LOG_DEBUG, "cancelsub clt_dereg %s/%d", - inet_ntoa(who->sin_addr), ntohs(who->sin_port))); -#endif client_deregister(client, 0); } else { syslog(LOG_WARNING, "unknown ctl opcode %s", opcode); diff --git a/zephyr/server/main.c b/zephyr/server/main.c index 30bb0f9..9396a2b 100644 --- a/zephyr/server/main.c +++ b/zephyr/server/main.c @@ -244,10 +244,8 @@ main(int argc, if (zalone) syslog(LOG_DEBUG, "standalone operation"); #endif -#if 0 if (zdebug) syslog(LOG_DEBUG, "debugging on"); -#endif /* set up sockets & my_addr and myname, find other servers and set up server table, initialize queues @@ -656,9 +654,7 @@ dump_db(void) static RETSIGTYPE reset(int sig) { -#if 1 zdbug((LOG_DEBUG,"reset()")); -#endif doreset = 1; } @@ -673,9 +669,8 @@ reap(int sig) #else union wait waitb; #endif -#if 1 + zdbug((LOG_DEBUG,"reap()")); -#endif #ifdef _POSIX_VERSION while ((pid = waitpid(-1, &waitb, WNOHANG)) == 0) { i++; if (i > 10) break; } @@ -713,9 +708,6 @@ do_reset(void) #else int omask; #endif -#if 0 - zdbug((LOG_DEBUG,"do_reset()")); -#endif #ifdef _POSIX_VERSION sigemptyset(&mask); sigaddset(&mask, SIGHUP); diff --git a/zephyr/server/realm.c b/zephyr/server/realm.c index 714b008..f6ff219 100644 --- a/zephyr/server/realm.c +++ b/zephyr/server/realm.c @@ -333,11 +333,10 @@ rlm_nack_cancel(register ZNotice_t *notice, register ZRealm *which = realm_which_realm(who); register Unacked *nacked; -#if 1 zdbug((LOG_DEBUG, "rlm_nack_cancel: %s:%08X,%08X", inet_ntoa(notice->z_uid.zuid_addr), notice->z_uid.tv.tv_sec, notice->z_uid.tv.tv_usec)); -#endif + if (!which) { syslog(LOG_ERR, "non-realm ack?"); return; @@ -361,11 +360,6 @@ rlm_nack_cancel(register ZNotice_t *notice, } } } -#if 0 - zdbug((LOG_DEBUG,"nack_cancel: nack not found %s:%08X,%08X", - inet_ntoa (notice->z_uid.zuid_addr), - notice->z_uid.tv.tv_sec, notice->z_uid.tv.tv_usec)); -#endif return; } @@ -716,10 +710,6 @@ realm_ulocate_dispatch(ZNotice_t *notice, inet_ntoa(who->sin_addr), notice->z_class, notice->z_class_inst, notice->z_opcode); /* XXX */ -#if 0 - syslog(LOG_WARNING, "unauth locate msg from %s", - inet_ntoa(who->sin_addr)); -#endif clt_ack(notice, who, AUTH_FAILED); return(ZERR_NONE); } @@ -755,10 +745,6 @@ realm_control_dispatch(ZNotice_t *notice, inet_ntoa(who->sin_addr), notice->z_class, notice->z_class_inst, notice->z_opcode); /* XXX */ -#if 0 - syslog(LOG_WARNING, "unauth ctl msg from %s", - inet_ntoa(who->sin_addr)); -#endif if (server == me_server) clt_ack(notice, who, AUTH_FAILED); return(ZERR_NONE); @@ -976,11 +962,9 @@ packet_ctl_nack(Unacked *nackpacket) ZParseNotice(nackpacket->packet, nackpacket->packsz, ¬ice); if (nackpacket->ack_addr.sin_addr.s_addr != 0) nack(¬ice, &nackpacket->ack_addr); -#if 1 else syslog(LOG_WARNING, "would have acked nobody (%s/%s/%s)", notice.z_class, notice.z_class_inst, notice.z_opcode); /* XXX */ -#endif } static void @@ -1148,11 +1132,6 @@ realm_sendit_auth(ZNotice_t *notice, return ZERR_BADFIELD; } -#if 0 - zdbug((LOG_DEBUG,"rlm_send_auth: orig: %d-%d/%d", origoffset, - notice->z_message_len, origlen)); -#endif - fragsize = Z_MAXPKTLEN-hdrlen-Z_FRAGFUDGE; while (offset < notice->z_message_len || !notice->z_message_len) { @@ -1172,11 +1151,6 @@ realm_sendit_auth(ZNotice_t *notice, partnotice.z_message = notice->z_message+offset; partnotice.z_message_len = message_len; -#if 0 - zdbug((LOG_DEBUG,"rlm_send_auth: new: %d-%d/%d", - origoffset+offset, message_len, origlen)); -#endif - buffer = (char *) malloc(sizeof(ZPacket_t)); if (!buffer) { syslog(LOG_ERR, "realm_sendit_auth malloc"); diff --git a/zephyr/server/server.c b/zephyr/server/server.c index 924d2ca..bebd3f8 100644 --- a/zephyr/server/server.c +++ b/zephyr/server/server.c @@ -177,9 +177,6 @@ server_init(void) otherservers[i].timer = NULL; otherservers[i].queue = NULL; otherservers[i].dumping = 0; -#if 0 - zdbug((LOG_DEBUG,"found myself")); -#endif } } @@ -239,9 +236,6 @@ server_reset(void) int *ok_list_new, *ok_list_old; int num_ok, new_num; -#if 0 - zdbug((LOG_DEBUG, "server_reset")); -#endif #ifdef DEBUG if (zalone) { syslog(LOG_INFO, "server_reset while alone, punt"); @@ -397,18 +391,11 @@ server_reset(void) if (i != me_server_idx && !otherservers[i].timer) { otherservers[i].timer = timer_set_rel(0L, server_timo, &otherservers[i]); -#if 0 - zdbug((LOG_DEBUG, "reset timer for %s", - otherservers[i].addr_str)); -#endif } } free(ok_list_old); free(ok_list_new); -#if 0 - zdbug((LOG_DEBUG, "server_reset: %d servers now", nservers)); -#endif } /* note: these must match the order given in zserver.h */ @@ -442,9 +429,6 @@ server_timo(void *arg) Server *which = (Server *) arg; int auth = 0; -#if 0 - zdbug((LOG_DEBUG,"srv_timo: %s", which->addr_str)); -#endif /* change state and reset if appropriate */ switch(which->state) { case SERV_DEAD: /* leave him dead */ @@ -476,10 +460,6 @@ server_timo(void *arg) } /* now he's either TARDY, STARTING, or DEAD We send a "hello," which increments the counter */ -#if 0 - zdbug((LOG_DEBUG, "srv %s is %s", which->addr_str, - srv_states[which->state])); -#endif server_hello(which, auth); /* reschedule the timer */ which->timer = timer_set_rel(which->timeout, server_timo, which); @@ -500,9 +480,6 @@ server_dispatch(ZNotice_t *notice, Code_t status; String *notice_class; -#if 0 - zdbug((LOG_DEBUG, "server_dispatch")); -#endif if (notice->z_kind == SERVACK) { srv_nack_cancel(notice, who); @@ -568,17 +545,12 @@ server_register(notice, auth, who) long timerval; if (who->sin_port != srv_addr.sin_port) { -#if 0 - zdbug((LOG_DEBUG, "srv_wrong port %d", ntohs(who->sin_port))); -#endif return 1; } /* Not yet... talk to ken about authenticators */ #ifdef notdef if (!auth) { -#if 0 zdbug((LOG_DEBUG, "srv_unauth")); -#endif return 1; } #endif /* notdef */ @@ -609,10 +581,6 @@ server_register(notice, auth, who) otherservers[nservers].dumping = 0; nservers++; -#if 0 - zdbug((LOG_DEBUG, "srv %s is %s", otherservers[nservers].addr_str, - srv_states[otherservers[nservers].state])); -#endif return 0; } @@ -637,10 +605,6 @@ server_kill_clt(Client *client) sprintf(buf, "%d", ntohs(client->addr.sin_port)); lyst[1] = buf; -#if 0 - zdbug((LOG_DEBUG, "server kill clt %s/%s", lyst[0], lyst[1])); -#endif - pnotice = ¬ice; memset (¬ice, 0, sizeof(notice)); @@ -687,9 +651,6 @@ kill_clt(ZNotice_t *notice, struct sockaddr_in who; Client *client; -#if 0 - zdbug((LOG_DEBUG, "kill_clt")); -#endif if (extract_addr(notice, &who) != ZERR_NONE) return ZERR_NONE; /* XXX */ client = client_find(&who.sin_addr, notice->z_port); @@ -699,12 +660,11 @@ kill_clt(ZNotice_t *notice, server->addr_str); return ZERR_NONE; /* XXX */ } -#if 1 - if (zdebug || 1) { + + if (zdebug) { syslog(LOG_DEBUG, "kill_clt clt_dereg %s/%d from %s", inet_ntoa(who.sin_addr), ntohs(who.sin_port), server->addr_str); } -#endif /* remove the locations, too */ client_deregister(client, 1); @@ -734,10 +694,6 @@ extract_addr(ZNotice_t *notice, } who->sin_port = notice->z_port = htons((u_short) atoi(cp)); who->sin_family = AF_INET; -#if 0 - zdbug((LOG_DEBUG,"ext %s/%d", inet_ntoa(who->sin_addr), - ntohs(who->sin_port))); -#endif return ZERR_NONE; } @@ -748,10 +704,6 @@ extract_addr(ZNotice_t *notice, static void server_flush(Server *which) { -#if 0 - if (zdebug) - syslog(LOG_DEBUG, "server_flush %s", which->addr_str); -#endif srv_nack_release(which); } @@ -782,29 +734,18 @@ admin_dispatch(ZNotice_t *notice, char *opcode = notice->z_opcode; Code_t status = ZERR_NONE; -#if 0 - zdbug((LOG_DEBUG, "ADMIN received")); -#endif - if (strcmp(opcode, ADMIN_HELLO) == 0) { hello_respond(who, ADJUST, auth); } else if (strcmp(opcode, ADMIN_IMHERE) == 0) { srv_responded(who); } else if (strcmp(opcode, ADMIN_SHUTDOWN) == 0) { -#if 0 - zdbug((LOG_DEBUG, "server shutdown")); -#endif if (server) { srv_nack_release(server); server->state = SERV_DEAD; server->timeout = timo_dead; /* don't worry about the timer, it will be set appropriately on the next send */ -#if 0 - zdbug((LOG_DEBUG, "srv %s is %s", server->addr_str, - srv_states[server->state])); -#endif - } + } } else if (strcmp(opcode, ADMIN_BDUMP) == 0) { /* Ignore a brain dump request if this is a brain dump packet * or a packet being processed concurrently during a brain @@ -1129,10 +1070,6 @@ hello_respond(struct sockaddr_in *who, { Server *which; -#if 0 - zdbug((LOG_DEBUG, "hello from %s", inet_ntoa(who->sin_addr))); -#endif - send_msg(who, ADMIN_IMHERE, auth); if (adj != ADJUST) return; @@ -1188,10 +1125,6 @@ srv_responded(struct sockaddr_in *who) { Server *which = server_which_server(who); -#if 0 - zdbug((LOG_DEBUG, "srv_responded %s", inet_ntoa(who->sin_addr))); -#endif - if (!which) { syslog(LOG_ERR, "hello input from non-server?!"); return; @@ -1224,10 +1157,6 @@ srv_responded(struct sockaddr_in *who) which->timer = timer_set_rel(which->timeout, server_timo, which); break; } -#if 0 - zdbug((LOG_DEBUG, "srv %s is %s", which->addr_str, - srv_states[which->state])); -#endif } /* @@ -1365,9 +1294,6 @@ server_forward(ZNotice_t *notice, int packlen; Code_t retval; -#if 0 - zdbug((LOG_DEBUG, "srv_forw")); -#endif /* don't send to limbo */ for (i = 1; i < nservers; i++) { if (i == me_server_idx) /* don't xmit to myself */ @@ -1494,9 +1420,6 @@ srv_nack_cancel(ZNotice_t *notice, return; } } -#if 0 - zdbug((LOG_DEBUG, "srv_nack not found")); -#endif } /* @@ -1510,15 +1433,7 @@ srv_rexmit(void *arg) Code_t retval; /* retransmit the packet */ -#if 0 - zdbug((LOG_DEBUG,"srv_rexmit to %s/%d", - otherservers[packet->dest.srv_idx].addr_str, - ntohs(otherservers[packet->dest.srv_idx].addr.sin_port))); -#endif if (otherservers[packet->dest.srv_idx].state == SERV_DEAD) { -#if 0 - zdbug((LOG_DEBUG, "cancelling send to dead server")); -#endif Unacked_delete(packet); free(packet->packet); srv_nack_release(&otherservers[packet->dest.srv_idx]); diff --git a/zephyr/server/subscr.c b/zephyr/server/subscr.c index 65aba3e..e71cc83 100644 --- a/zephyr/server/subscr.c +++ b/zephyr/server/subscr.c @@ -143,10 +143,6 @@ add_subscriptions(Client *who, /* Loop over the new subscriptions. */ for (; subs; subs = next) { next = subs->next; -#if 0 - zdbug ((LOG_DEBUG, "subscr: %s/%s/%s", subs->dest.classname->string, - subs->dest.inst->string, subs->dest.recip->string)); -#endif /* check the recipient for a realm which isn't ours */ realm = NULL; if (subs->dest.recip->string[0] == '@' && @@ -226,9 +222,6 @@ subscr_def_subs(Client *who) void subscr_reset(void) { -#if 0 - zdbug((LOG_DEBUG, "subscr_reset()")); -#endif free(default_notice.z_message); default_notice.z_message = NULL; defaults_read = 0; @@ -243,9 +236,6 @@ subscr_copy_def_subs(char *person) Destlist *subs, *sub; if (!defaults_read) { -#if 0 - zdbug((LOG_DEBUG, "reading default subscription file")); -#endif fd = open(subs_file, O_RDONLY, 0666); if (fd < 0) { syslog(LOG_ERR, "can't open %s:%m", subs_file); @@ -325,9 +315,6 @@ subscr_cancel(struct sockaddr_in *sin, Code_t retval; int found = 0; -#if 0 - zdbug((LOG_DEBUG,"subscr_cancel")); -#endif who = client_find(&sin->sin_addr, notice->z_port); if (!who) return ZSRV_NOCLT; @@ -365,14 +352,8 @@ subscr_cancel(struct sockaddr_in *sin, free_subscriptions(cancel_subs); if (found) { -#if 0 - zdbug((LOG_DEBUG, "found & removed")); -#endif return ZERR_NONE; } else { -#if 0 - zdbug((LOG_DEBUG, "not found")); -#endif return ZSRV_NOSUB; } } @@ -413,14 +394,8 @@ subscr_realm_cancel(struct sockaddr_in *sin, free_subscriptions(cancel_subs); if (found) { -#if 0 - zdbug((LOG_DEBUG, "found & removed")); -#endif return ZERR_NONE; } else { -#if 0 - zdbug((LOG_DEBUG, "not found")); -#endif return ZSRV_NOSUB; } } @@ -436,18 +411,11 @@ subscr_cancel_client(Client *client) Code_t retval; ZRealm *realm; -#if 0 - zdbug((LOG_DEBUG,"subscr_cancel_client %s", - inet_ntoa(client->addr.sin_addr))); -#endif if (!client->subs) return; for (subs = client->subs; subs; subs = next) { next = subs->next; -#if 0 - zdbug((LOG_DEBUG,"sub_can %s", subs->dest.classname->string)); -#endif retval = triplet_deregister(client, &subs->dest, NULL); if (retval == ZSRV_EMPTYCLASS && subs->dest.recip->string[0] == '@') { @@ -533,9 +501,6 @@ subscr_marshal_subs(ZNotice_t *notice, int i; int defsubs = 0; -#if 0 - zdbug((LOG_DEBUG, "subscr_marshal")); -#endif *found = 0; /* Note that the following code is an incredible crock! */ @@ -565,9 +530,6 @@ subscr_marshal_subs(ZNotice_t *notice, if (client) subs = client->subs; } else if (strcmp(notice->z_opcode, CLIENT_GIMMEDEFS) == 0) { -#if 0 - zdbug((LOG_DEBUG, "gimmedefs")); -#endif /* subscr_copy_def_subs allocates new pointer rings, so it must be freed when finished. the string areas pointed to are static, however.*/ @@ -670,9 +632,6 @@ new_old_compat_subscr_sendlist(notice, auth, who) /* send 5 at a time until we are finished */ count = found?((found-1) / 5 + 1):1; /* total # to be sent */ i = 0; /* pkt # counter */ -#if 0 - zdbug((LOG_DEBUG,"Found %d subscriptions for %d packets", found, count)); -#endif initfound = found; zerofound = (found == 0); while (found > 0 || zerofound) { @@ -703,9 +662,6 @@ new_old_compat_subscr_sendlist(notice, auth, who) found -= 5; zerofound = 0; } -#if 0 - zdbug((LOG_DEBUG,"subscr_sendlist acked")); -#endif if (answer) free(answer); } @@ -800,9 +756,6 @@ old_compat_subscr_sendlist(notice, auth, who) free(answer); return; } -#if 0 - zdbug((LOG_DEBUG,"subscr_sendlist acked")); -#endif if (answer) free(answer); } @@ -835,9 +788,6 @@ subscr_send_subs(Client *client) int num = 0; Code_t retval; -#if 0 - zdbug((LOG_DEBUG, "send_subs")); -#endif sprintf(buf2, "%d",ntohs(client->addr.sin_port)); list[num++] = buf2; @@ -878,14 +828,8 @@ subscr_send_subs(Client *client) #if defined(HAVE_KRB4) || defined(HAVE_KRB5) if (retval != ZERR_NONE) { -#if 0 - zdbug((LOG_DEBUG,"zmakeascii failed: %s", error_message(retval))); -#endif } else { list[num++] = buf; -#if 0 - zdbug((LOG_DEBUG, "cblock %s", buf)); -#endif } #endif /* HAVE_KRB4 || HAVE_KRB5*/ retval = bdump_send_list_tcp(SERVACK, &client->addr, ZEPHYR_ADMIN_CLASS, @@ -989,10 +933,6 @@ extract_subscriptions(ZNotice_t *notice) classinst = cp; ADVANCE(2); recip = cp; -#if 0 - zdbug((LOG_DEBUG, "ext_sub: CLS %s INST %s RCPT %s", - class_name, classinst, cp)); -#endif cp += (strlen(cp) + 1); if (cp > notice->z_message + notice->z_message_len) { syslog(LOG_WARNING, "malformed sub 3"); @@ -1062,11 +1002,6 @@ subscr_realm_sendit(Client *who, char addr[16]; /* xxx.xxx.xxx.xxx max */ char port[16]; -#if 0 - zdbug((LOG_DEBUG, "subscr_rlm_sendit")); -#endif - - if ((text=(char **)malloc((NUM_FIELDS + 2)*sizeof(char *))) == (char **)0) { syslog(LOG_ERR, "subscr_rlm_sendit malloc"); return(ENOMEM); @@ -1123,9 +1058,6 @@ subscr_realm_sendit(Client *who, return(ZERR_NONE); } -#if 0 - zdbug((LOG_DEBUG,"subscr_rlm_sendit len: %d", snotice.z_message_len)); -#endif realm_handoff(&snotice, 1, &(who->addr), realm, 0); free(pack); @@ -1141,9 +1073,6 @@ subscr_add_raw(Client *client, Destlist *subs, *subs2, **head; Code_t retval; -#if 0 - zdbug((LOG_DEBUG, "subscr_add_raw")); -#endif head = (realm) ? &realm->subs : &client->subs; /* Loop over the new subscriptions. */ @@ -1175,11 +1104,9 @@ subscr_add_raw(Client *client, sub->dest.classname = make_string(subs->dest.classname->string, 0); sub->dest.inst = make_string(subs->dest.inst->string, 0); sub->dest.recip = make_string(subs->dest.recip->string, 0); -#if 1 zdbug ((LOG_DEBUG, "subscr: add %s/%s/%s in %s", sub->dest.classname->string, sub->dest.inst->string, sub->dest.recip->string, remrealm->name)); -#endif Destlist_insert(&remrealm->remsubs, sub); } } @@ -1223,11 +1150,9 @@ subscr_unsub_sendit(Client *who, for (subsp = realm->remsubs; subsp; subsp = subsn) { subsn = subsp->next; if (ZDest_eq(&subs->dest, &subsp->dest)) { -#if 1 zdbug ((LOG_DEBUG, "subscr: del %s/%s/%s in %s", subsp->dest.classname->string, subsp->dest.inst->string, subsp->dest.recip->string, realm->name)); -#endif Destlist_delete(subsp); free_subscription(subsp); break; @@ -1283,10 +1208,6 @@ subscr_send_realm_subs(ZRealm *realm) int num = 0; Code_t retval; -#if 0 - zdbug((LOG_DEBUG, "send_realm_subs")); -#endif - strcpy(buf, realm->name); list[num++] = buf; @@ -1352,10 +1273,6 @@ subscr_realm_subs(ZRealm *realm) Client **clientp; char port[16]; -#if 0 - zdbug((LOG_DEBUG, "realm_subs")); -#endif - if (!realm->remsubs) return ZERR_NONE; @@ -1570,10 +1487,6 @@ Code_t subscr_foreign_user(ZNotice_t *notice, char *cp, *tp0, *tp1; char rlm_recipient[REALM_SZ + 1]; -#if 0 - zdbug((LOG_DEBUG, "subscr_foreign_user")); -#endif - tp0 = cp = notice->z_message; newwho.sin_addr.s_addr = inet_addr(cp); @@ -1627,9 +1540,6 @@ Code_t subscr_foreign_user(ZNotice_t *notice, /* translate the recipient to represent the foreign realm */ sprintf(rlm_recipient, "@%s", realm->name); for (temp = newsubs; temp; temp = temp->next) { -#if 0 - syslog(LOG_DEBUG, "in foreign_user: class is %s", temp->dest.classname->string); -#endif temp->dest.recip = make_string(rlm_recipient, 0); } -- 2.45.2