summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@mit.edu>2008-01-21 07:57:32 +0000
committerGravatar Karl Ramm <kcr@mit.edu>2008-01-21 07:57:32 +0000
commitee442551e1531712226a3a3ba26afff466100bb5 (patch)
treed7907b07baecce7abe3940bec566b3bf56596f2f /server
parente6fb0737027ee97d911e8d507b1db37446067d10 (diff)
passes gcc -Wall with no warnings other than des cryppt C_block sadness and getsid problem
Diffstat (limited to 'server')
-rw-r--r--server/bdump.c18
-rw-r--r--server/class.c7
-rw-r--r--server/client.c7
-rw-r--r--server/dispatch.c28
-rw-r--r--server/kstuff.c55
-rw-r--r--server/main.c8
-rw-r--r--server/realm.c33
-rw-r--r--server/server.c15
-rw-r--r--server/subscr.c35
-rw-r--r--server/timer.c1
-rw-r--r--server/uloc.c12
-rw-r--r--server/zserver.h77
12 files changed, 135 insertions, 161 deletions
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 (&notice, 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, &notice->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 */