summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Greg Hudson <ghudson@mit.edu>1998-07-16 10:55:05 +0000
committerGravatar Greg Hudson <ghudson@mit.edu>1998-07-16 10:55:05 +0000
commit7b0a769146e55626dcb495b3d31bf9d956c1ada9 (patch)
tree91dc58e5252fd0041986b5f3cf9b9337cc3dc938
parent4fdf8f9d3fa9fd576e93e41cd9c4c97b6c931a7e (diff)
Eliminate some cruft: nuke two unused fields in the client structure
and rename client_which_client() to client_find() and make the second argument a port instead of a notice.
-rw-r--r--server/client.c29
-rw-r--r--server/dispatch.c10
-rw-r--r--server/realm.c2
-rw-r--r--server/server.c2
-rw-r--r--server/subscr.c12
-rw-r--r--server/zserver.h5
6 files changed, 19 insertions, 41 deletions
diff --git a/server/client.c b/server/client.c
index 4e98f8f..93638e8 100644
--- a/server/client.c
+++ b/server/client.c
@@ -35,9 +35,9 @@ static const char rcsid_client_c[] =
* Host *host;
* int flush;
*
- * Client *client_which_client(who, notice)
- * struct sockaddr_in *who;
- * ZNotice_t *notice;
+ * Client *client_find(who, unsigned int port)
+ * struct in_addr *host;
+ * unsigned int port;
*
* void client_dump_clients(fp, clist)
* FILE *fp;
@@ -50,7 +50,7 @@ static const char rcsid_client_c[] =
* the host's list of clients.
*
* This routine assumes that the client has not been registered yet.
- * The caller should check by calling client_which_client
+ * The caller should check by calling client_find.
*/
#define HASHSIZE 1024
@@ -59,8 +59,6 @@ static Client *client_bucket[HASHSIZE];
#define INET_HASH(host, port) ((htonl((host)->s_addr) + \
htons((unsigned short) (port))) % HASHSIZE)
-static Client *client_find __P((struct in_addr *host, unsigned int port));
-
Code_t
client_register(notice, host, client_p, wantdefaults)
ZNotice_t *notice;
@@ -90,7 +88,6 @@ client_register(notice, host, client_p, wantdefaults)
#ifdef KERBEROS
memset(&client->session_key, 0, sizeof(client->session_key));
#endif
- client->last_msg = 0;
client->last_send = 0;
client->addr.sin_family = AF_INET;
client->addr.sin_addr.s_addr = host->s_addr;
@@ -147,18 +144,6 @@ client_flush_host(host)
uloc_hflush(host);
}
-/*
- * find the client which sent the notice
- */
-
-Client *
-client_which_client(host, notice)
- struct in_addr *host;
- ZNotice_t *notice;
-{
- return client_find(host, notice->z_port);
-}
-
Code_t
client_send_clients()
{
@@ -208,7 +193,11 @@ client_dump_clients(fp)
}
}
-static Client *
+/*
+ * find a client by host and port
+ */
+
+Client *
client_find(host, port)
struct in_addr *host;
unsigned int port;
diff --git a/server/dispatch.c b/server/dispatch.c
index 5523e1b..50769a7 100644
--- a/server/dispatch.c
+++ b/server/dispatch.c
@@ -676,7 +676,6 @@ rexmit(arg)
{
Unacked *nacked = (Unacked *) arg;
int retval;
- ZNotice_t dummy_notice;
Client *client;
#if 1
@@ -688,9 +687,8 @@ rexmit(arg)
nacked->rexmits++;
if (rexmit_times[nacked->rexmits] == -1) {
/* Unresponsive client, find it in our database. */
- dummy_notice.z_port = nacked->dest.addr.sin_port;
- client = client_which_client(&nacked->dest.addr.sin_addr,
- &dummy_notice);
+ client = client_find(&nacked->dest.addr.sin_addr,
+ nacked->dest.addr.sin_port);
/* unlink & free nacked */
LIST_DELETE(nacked);
@@ -1035,7 +1033,7 @@ control_dispatch(notice, auth, who, server)
return ZERR_NONE;
}
} else if (strcmp(opcode, CLIENT_UNSUBSCRIBE) == 0) {
- client = client_which_client(&who->sin_addr, notice);
+ client = client_find(&who->sin_addr, notice->z_port);
if (client != NULL) {
if (strcmp(client->principal->string, notice->z_sender) != 0) {
/* you may only cancel for your own clients */
@@ -1063,7 +1061,7 @@ control_dispatch(notice, auth, who, server)
}
} else if (strcmp(opcode, CLIENT_CANCELSUB) == 0) {
/* canceling subscriptions implies I can punt info about this client */
- client = client_which_client(&who->sin_addr, notice);
+ client = client_find(&who->sin_addr, notice->z_port);
if (client == NULL) {
#if 0
zdbug((LOG_DEBUG,"can_sub not found client"));
diff --git a/server/realm.c b/server/realm.c
index 537f49a..425cc36 100644
--- a/server/realm.c
+++ b/server/realm.c
@@ -450,8 +450,6 @@ realm_init()
#endif
sprintf(rlmprinc, "%s.%s@%s", SERVER_SERVICE, SERVER_INSTANCE, rlm->name);
client->principal = make_string(rlmprinc, 0);
- client->last_msg = 0;
- client->last_check = 0;
client->last_send = 0;
client->subs = NULL;
client->realm = rlm;
diff --git a/server/server.c b/server/server.c
index 186fbdf..b034dc2 100644
--- a/server/server.c
+++ b/server/server.c
@@ -688,7 +688,7 @@ kill_clt(notice, server)
#endif
if (extract_addr(notice, &who) != ZERR_NONE)
return ZERR_NONE; /* XXX */
- client = client_which_client(&who.sin_addr, notice);
+ client = client_find(&who.sin_addr, notice->z_port);
if (!client) {
syslog(LOG_NOTICE, "kill_clt: no such client (%s/%d) from %s",
inet_ntoa(who.sin_addr), ntohs(who.sin_port),
diff --git a/server/subscr.c b/server/subscr.c
index 140cdf0..b0cda3d 100644
--- a/server/subscr.c
+++ b/server/subscr.c
@@ -327,7 +327,7 @@ subscr_cancel(sin, notice)
#if 0
zdbug((LOG_DEBUG,"subscr_cancel"));
#endif
- who = client_which_client(&sin->sin_addr, notice);
+ who = client_find(&sin->sin_addr, notice->z_port);
if (!who)
return ZSRV_NOCLT;
@@ -538,7 +538,6 @@ subscr_marshal_subs(notice, auth, who, found)
struct sockaddr_in *who;
int *found;
{
- ZNotice_t reply;
char **answer = NULL;
unsigned short temp;
Code_t retval;
@@ -574,10 +573,7 @@ subscr_marshal_subs(notice, auth, who, found)
return(NULL);
}
- reply = *notice;
- reply.z_port = htons(temp);
-
- client = client_which_client(&who->sin_addr, &reply);
+ client = client_find(&who->sin_addr, htons(temp));
if (client)
subs = client->subs;
@@ -735,7 +731,7 @@ old_compat_subscr_sendlist(notice, auth, who)
int auth;
struct sockaddr_in *who;
{
- Client *client = client_which_client(&who->sin_addr, notice);
+ Client *client = client_find(&who->sin_addr, notice->z_port);
Destlist *subs;
Code_t retval;
ZNotice_t reply;
@@ -1508,7 +1504,7 @@ Code_t subscr_foreign_user(notice, who, realm)
if (!strcmp(snotice.z_opcode, REALM_ADD_SUBSCRIBE)) {
/* this was approved by the other realm, add subscriptions */
- client = client_which_client(&newwho.sin_addr, &snotice);
+ client = client_find(&newwho.sin_addr, snotice.z_port);
if (client == (Client *)0) {
syslog(LOG_WARNING, "no client at %s/%d",
inet_ntoa(newwho.sin_addr), ntohs(snotice.z_port));
diff --git a/server/zserver.h b/server/zserver.h
index b581fae..219e82b 100644
--- a/server/zserver.h
+++ b/server/zserver.h
@@ -113,9 +113,6 @@ struct _Client {
C_Block session_key; /* session key for this client */
#endif /* HAVE_KRB4 */
String *principal; /* krb principal of user */
- time_t last_check; /* last time the other server was
- asked to check */
- long last_msg; /* last message sent to this client */
int last_send; /* Counter for last sent packet. */
Realm *realm;
struct _Client *next, **prev_p;
@@ -222,7 +219,7 @@ Code_t client_register __P((ZNotice_t *notice, struct in_addr *host,
void client_deregister __P((Client *client, int flush));
void client_flush_host __P((struct in_addr *host));
void client_dump_clients __P((FILE *fp));
-Client *client_which_client __P((struct in_addr *host, ZNotice_t *notice));
+Client *client_find __P((struct in_addr *host, unsigned int port));
Code_t client_send_clients __P((void));
/* found in common.c */