*
* Created by: Robert French
*
- * $Id: zaway.c,v 1.15 2000/07/05 21:22:06 ghudson Exp $
+ * $Id: zaway.c,v 1.16 2003/02/28 20:40:44 zacheiss Exp $
*
* Copyright (c) 1987, 1993 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <com_err.h>
#ifndef lint
-static const char rcsid_zaway_c[] = "$Id: zaway.c,v 1.15 2000/07/05 21:22:06 ghudson Exp $";
+static const char rcsid_zaway_c[] = "$Id: zaway.c,v 1.16 2003/02/28 20:40:44 zacheiss Exp $";
#endif
#define MESSAGE_CLASS "MESSAGE"
if (strcmp(notice.z_sender,ZGetSender()) == 0 ||
strcmp(notice.z_opcode,"PING") == 0 ||
+ strcmp(notice.z_opcode,"AUTO") == 0 ||
strcmp(notice.z_message,"Automated reply:") == 0) {
ZFreeNotice(¬ice);
continue;
*
* Created by: Robert French
*
- * $Id: zwrite.c,v 1.49 1999/08/13 00:19:42 danw Exp $
+ * $Id: zwrite.c,v 1.50 2002/05/22 15:13:51 ghudson Exp $
*
* Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <pwd.h>
#ifndef lint
-static const char rcsid_zwrite_c[] = "$Id: zwrite.c,v 1.49 1999/08/13 00:19:42 danw Exp $";
+static const char rcsid_zwrite_c[] = "$Id: zwrite.c,v 1.50 2002/05/22 15:13:51 ghudson Exp $";
#endif /* lint */
#define DEFAULT_CLASS "MESSAGE"
success = 0;
- for (i=0;i<nrecips || !nrecips;i++) {
+ for (i=0;i<nrecips || i==0;i++) {
if (realm) {
sprintf(realm_recip, "%s@%s", (nrecips) ? recips[i] : "", realm);
notice->z_recipient = realm_recip;
else
printf("Internal failure - illegal message field in server response\n");
ZFreeNotice(&retnotice);
- if (!nrecips)
- break;
}
if (!success)
exit(1);
+zephyr (2.1.20010518.SNAPSHOT-10.1) unstable; urgency=lown
+
+ * Experimental update to the latest athena code.
+
+ -- Karl Ramm <kcr@1ts.org> Fri, 30 May 2003 01:11:15 -0400
+
zephyr (2.1.20010518.SNAPSHOT-10) unstable; urgency=low
* Attack of the Standards-Version continues.
*
* Created by: Robert French
*
- * $Id: ZMkAuth.c,v 1.19 1999/01/22 23:19:16 ghudson Exp $
+ * $Id: ZMkAuth.c,v 1.20 2002/11/11 18:28:06 ghudson Exp $
*
* Copyright (c) 1987 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <internal.h>
#ifndef lint
-static const char rcsid_ZMakeAuthentication_c[] = "$Id: ZMkAuth.c,v 1.19 1999/01/22 23:19:16 ghudson Exp $";
+static const char rcsid_ZMakeAuthentication_c[] = "$Id: ZMkAuth.c,v 1.20 2002/11/11 18:28:06 ghudson Exp $";
#endif
#ifdef HAVE_KRB4
#include <krb_err.h>
-static long last_authent_time = 0L;
-static KTEXT_ST last_authent;
#endif
Code_t ZResetAuthentication () {
-#ifdef HAVE_KRB4
- last_authent_time = 0L;
-#endif
return ZERR_NONE;
}
CREDENTIALS cred;
extern unsigned long des_quad_cksum();
- now = time(0);
- if (last_authent_time == 0 || (now - last_authent_time > 120)) {
- result = krb_mk_req(&authent, SERVER_SERVICE,
- SERVER_INSTANCE, __Zephyr_realm, 0);
- if (result != MK_AP_OK) {
- last_authent_time = 0;
- return (result+krb_err_base);
- }
- last_authent_time = now;
- last_authent = authent;
- }
- else {
- authent = last_authent;
- }
+ result = krb_mk_req(&authent, SERVER_SERVICE,
+ SERVER_INSTANCE, __Zephyr_realm, 0);
+ if (result != MK_AP_OK)
+ return (result+krb_err_base);
+ result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE,
+ __Zephyr_realm, &cred);
+ if (result != KSUCCESS)
+ return (result+krb_err_base);
+
notice->z_auth = 1;
notice->z_authent_len = authent.length;
notice->z_ascii_authent = (char *)malloc((unsigned)authent.length*3);
return(result);
/* Compute a checksum over the header and message. */
- if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE,
- __Zephyr_realm, &cred)) != 0)
- return result;
checksum = des_quad_cksum(buffer, NULL, cstart - buffer, 0, cred.session);
checksum ^= des_quad_cksum(cend, NULL, buffer + *len - cend, 0,
cred.session);
*
* Created by: Robert French
*
- * $Id: ZParseNot.c,v 1.29 1999/08/13 00:19:44 danw Exp $
+ * $Id: ZParseNot.c,v 1.30 2002/09/10 16:04:29 ghudson Exp $
*
* Copyright (c) 1987,1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <internal.h>
-/* Assume that strlen is efficient on this machine... */
-#define next_field(ptr) ptr += strlen (ptr) + 1
-
-#if defined (__GNUC__) && defined (__vax__)
-#undef next_field
-static __inline__ char * Istrend (char *str) {
- /*
- * This should be faster on VAX models outside the 2 series. Don't
- * use it if you are using MicroVAX 2 servers. If you are using a
- * VS2 server, use something like
- * #define next_field(ptr) while(*ptr++)
- * instead of this code.
- *
- * This requires use of GCC to get the optimized code, but
- * everybody uses GCC, don't they? :-)
- */
- register char *str2 asm ("r1");
- /* Assumes that no field is longer than 64K.... */
- asm ("locc $0,$65535,(%1)" : "=r" (str2) : "r" (str) : "r0");
- return str2;
-}
-#define next_field(ptr) ptr = Istrend (ptr) + 1
-#endif
-
-#ifdef mips
-#undef next_field
-/*
- * The compiler doesn't optimize this macro as well as it does the
- * following function.
- */
-#define next_fieldXXX(ptr) do{register unsigned c1,c2;c1= *ptr; \
- while((ptr++,c2= *ptr,c1)&&(ptr++,c1= *ptr,c2));}while(0)
-static char *next_field_1 (s) char *s; {
- /*
- * Calling overhead is still present, but this routine is faster
- * than strlen, and doesn't bother with some of the other math
- * that we'd just have to undo later anyways.
- */
- register unsigned c1 = *s, c2;
- while (1) {
- s++; c2 = *s; if (c1 == 0) break;
- s++; c1 = *s; if (c2 == 0) break;
- s++; c2 = *s; if (c1 == 0) break;
- s++; c1 = *s; if (c2 == 0) break;
- }
- return s;
+/* Skip to the next NUL-terminated field in the packet. */
+static char *next_field(ptr, end)
+ char *ptr, *end;
+{
+ while (ptr < end && *ptr != '\0')
+ ptr++;
+ if (ptr < end)
+ ptr++;
+ return (ptr);
}
-#define next_field(ptr) ptr=next_field_1(ptr)
-#endif
Code_t ZParseNotice(buffer, len, notice)
char *buffer;
maj = atoi(ptr);
if (maj != ZVERSIONMAJOR)
return (ZERR_VERS);
- next_field (ptr);
+ ptr = next_field(ptr, end);
if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD)
BAD_PACKET;
numfields = temp;
- next_field (ptr);
+ ptr = next_field(ptr, end);
/*XXX 3 */
numfields -= 2; /* numfields, version, and checksum */
return ZERR_BADPKT;
}
- if (numfields) {
+ if (numfields && ptr < end) {
if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD)
BAD_PACKET;
notice->z_kind = (ZNotice_Kind_t)temp;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
BAD_PACKET;
- if (numfields) {
+ if (numfields && ptr < end) {
if (ZReadAscii(ptr, end-ptr, (unsigned char *)¬ice->z_uid,
sizeof(ZUnique_Id_t)) == ZERR_BADFIELD)
BAD_PACKET;
notice->z_time.tv_sec = ntohl((u_long) notice->z_uid.tv.tv_sec);
notice->z_time.tv_usec = ntohl((u_long) notice->z_uid.tv.tv_usec);
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
BAD_PACKET;
- if (numfields) {
+ if (numfields && ptr < end) {
if (ZReadAscii16(ptr, end-ptr, ¬ice->z_port) == ZERR_BADFIELD)
BAD_PACKET;
notice->z_port = htons(notice->z_port);
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
BAD_PACKET;
- if (numfields) {
+ if (numfields && ptr < end) {
if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD)
BAD_PACKET;
notice->z_auth = temp;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
BAD_PACKET;
notice->z_checked_auth = ZAUTH_UNSET;
- if (numfields) {
+ if (numfields && ptr < end) {
if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD)
BAD_PACKET;
notice->z_authent_len = temp;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
BAD_PACKET;
- if (numfields) {
+ if (numfields && ptr < end) {
notice->z_ascii_authent = ptr;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
BAD_PACKET;
- if (numfields) {
+ if (numfields && ptr < end) {
notice->z_class = ptr;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
notice->z_class = "";
- if (numfields) {
+ if (numfields && ptr < end) {
notice->z_class_inst = ptr;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
notice->z_class_inst = "";
- if (numfields) {
+ if (numfields && ptr < end) {
notice->z_opcode = ptr;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
notice->z_opcode = "";
- if (numfields) {
+ if (numfields && ptr < end) {
notice->z_sender = ptr;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
notice->z_sender = "";
- if (numfields) {
+ if (numfields && ptr < end) {
notice->z_recipient = ptr;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
notice->z_recipient = "";
- if (numfields) {
+ if (numfields && ptr < end) {
notice->z_default_format = ptr;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
notice->z_default_format = "";
-/*XXX*/
if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD)
BAD_PACKET;
notice->z_checksum = temp;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
- if (numfields) {
+ if (numfields && ptr < end) {
notice->z_multinotice = ptr;
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
notice->z_multinotice = "";
- if (numfields) {
+ if (numfields && ptr < end) {
if (ZReadAscii(ptr, end-ptr, (unsigned char *)¬ice->z_multiuid,
sizeof(ZUnique_Id_t)) == ZERR_BADFIELD)
BAD_PACKET;
notice->z_time.tv_sec = ntohl((u_long) notice->z_multiuid.tv.tv_sec);
notice->z_time.tv_usec = ntohl((u_long) notice->z_multiuid.tv.tv_usec);
numfields--;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
else
notice->z_multiuid = notice->z_uid;
- for (i=0;i<Z_MAXOTHERFIELDS && numfields;i++,numfields--) {
+ for (i=0;ptr < end && i<Z_MAXOTHERFIELDS && numfields;i++,numfields--) {
notice->z_other_fields[i] = ptr;
- next_field (ptr);
+ ptr = next_field(ptr, end);
}
notice->z_num_other_fields = i;
- for (i=0;i<numfields;i++)
- next_field (ptr);
-
+ for (i=0;ptr < end && numfields;numfields--)
+ ptr = next_field(ptr, end);
+
+ if (numfields || *(ptr - 1) != '\0')
+ BAD_PACKET;
+
notice->z_message = (caddr_t) ptr;
notice->z_message_len = len-(ptr-buffer);
*
* Created by: Robert French
*
- * $Id: ZReadAscii.c,v 1.18 1999/01/22 23:19:21 ghudson Exp $
+ * $Id: ZReadAscii.c,v 1.19 2002/09/10 16:04:30 ghudson Exp $
*
* Copyright (c) 1987, 1990 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
*/
#ifndef lint
-static char rcsid_ZReadAscii_c[] = "$Id: ZReadAscii.c,v 1.18 1999/01/22 23:19:21 ghudson Exp $";
+static char rcsid_ZReadAscii_c[] = "$Id: ZReadAscii.c,v 1.19 2002/09/10 16:04:30 ghudson Exp $";
#endif /* lint */
#include <internal.h>
register unsigned int temp;
for (i=0;i<num;i++) {
- if (*ptr == ' ') {
+ if (len >= 1 && *ptr == ' ') {
ptr++;
- if (--len < 0)
- return ZERR_BADFIELD;
- }
- if (ptr[0] == '0' && ptr[1] == 'x') {
+ len--;
+ }
+ if (len >= 2 && ptr[0] == '0' && ptr[1] == 'x') {
ptr += 2;
len -= 2;
- if (len < 0)
- return ZERR_BADFIELD;
- }
+ }
+ if (len < 2)
+ return ZERR_BADFIELD;
c1 = Z_cnvt_xtoi(ptr[0]);
if (c1 < 0)
return ZERR_BADFIELD;
field[i] = hexbyte;
ptr += 2;
len -= 2;
- if (len < 0)
- return ZERR_BADFIELD;
}
return *ptr ? ZERR_BADFIELD : ZERR_NONE;
*
* Created by: Robert French
*
- * $Id: Zinternal.c,v 1.41 2000/01/27 03:48:53 ghudson Exp $
+ * $Id: Zinternal.c,v 1.42 2002/09/10 16:04:31 ghudson Exp $
*
* Copyright (c) 1987,1988,1991 by the Massachusetts Institute of
* Technology.
#ifndef lint
static const char rcsid_Zinternal_c[] =
- "$Id: Zinternal.c,v 1.41 2000/01/27 03:48:53 ghudson Exp $";
+ "$Id: Zinternal.c,v 1.42 2002/09/10 16:04:31 ghudson Exp $";
static const char copyright[] =
"Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology.";
#endif
struct _Z_Hole *hole, *lasthole;
struct timeval tv;
+ /* Bounds check. */
+ if (part < 0 || notice->z_message_len < 0 || part > qptr->msg_len
+ || notice->z_message_len > qptr->msg_len - part)
+ return (ZERR_NONE);
+
/* Incorporate this notice's checked authentication. */
if (notice->z_checked_auth == ZAUTH_FAILED)
qptr->auth = ZAUTH_FAILED;
#ifndef lint
#ifndef SABER
-static const char rcsid_subscr_c[] = "$Id: subscr.c,v 1.58 2001/03/01 00:47:05 zacheiss Exp $";
+static const char rcsid_subscr_c[] = "$Id: subscr.c,v 1.60 2002/07/03 03:02:44 zacheiss Exp $";
#endif
#endif
}
}
}
- if (realm && !bdumping && server && server == me_server) {
- retval = subscr_realm_sendit(who, subs, notice, realm);
- if (retval != ZERR_NONE) {
- free_subscriptions(subs);
- free_string(sender);
- return(retval);
+ if (realm && !bdumping) {
+ if (server && server == me_server) {
+ retval = subscr_realm_sendit(who, subs, notice, realm);
+ if (retval != ZERR_NONE) {
+ free_subscriptions(subs);
+ free_string(sender);
+ return(retval);
+ } else {
+ /* free this one, will get from ADD */
+ free_subscription(subs);
+ }
} else {
- free_subscription(subs); /* free this one, will get from ADD */
+ /* Indicates we leaked traffic back to our realm */
}
} else {
retval = triplet_register(who, &subs->dest, NULL);
found = 0;
for (subs = newsubs; subs; subs = next) {
+ Realm *rlm;
next=subs->next;
+ if (subs->dest.recip->string[0] != '\0') {
+ rlm = realm_which_realm(who);
+ syslog(LOG_WARNING, "subscr bad recip %s by %s (%s)",
+ subs->dest.recip->string,
+ sender->string, rlm->name);
+ continue;
+ }
acl = class_get_acl(subs->dest.classname);
if (acl) {
- Realm *rlm;
rlm = realm_which_realm(who);
if (rlm && server == me_server) {
if (!realm_sender_in_realm(rlm->name, sender->string)) {
syslog(LOG_WARNING, "subscr auth not verifiable %s (%s) class %s",
sender->string, rlm->name,
subs->dest.classname->string);
- continue;
+ free_subscriptions(newsubs);
+ free_string(sender);
+ free(text);
+ return ZSRV_CLASSRESTRICTED;
}
}
if (!access_check(sender->string, acl, SUBSCRIBE)) {
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: X_gram.c,v 1.22 1999/01/22 23:20:09 ghudson Exp $
+ * $Id: X_gram.c,v 1.23 2001/07/18 14:06:32 ghudson Exp $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <sysdep.h>
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_X_gram_c[] = "$Id: X_gram.c,v 1.22 1999/01/22 23:20:09 ghudson Exp $";
+static const char rcsid_X_gram_c[] = "$Id: X_gram.c,v 1.23 2001/07/18 14:06:32 ghudson Exp $";
#endif
#include <zephyr/mit-copyright.h>
unsigned long default_fgcolor;
unsigned long default_bgcolor;
unsigned long default_bordercolor;
-long ttl = 0;
+long ttl = 500;
static int reset_saver;
static int border_width = 1;
static int cursor_code = XC_sailboat;
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: parser.y,v 1.6 1999/01/22 23:20:30 ghudson Exp $
+ * $Id: parser.y,v 1.7 2003/01/23 05:32:16 ghudson Exp $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <sysdep.h>
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_parser_y[] = "$Id: parser.y,v 1.6 1999/01/22 23:20:30 ghudson Exp $";
+static const char rcsid_parser_y[] = "$Id: parser.y,v 1.7 2003/01/23 05:32:16 ghudson Exp $";
#endif
#include <zephyr/mit-copyright.h>
$$->next = $1;
$$ = reverse_list_of_nodes($$); }
;
+
/* elseifparts needs to be reversed before using... */
elseifparts : /* empty */
{ $$ = 0; }
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: tty_filter.c,v 1.18 1999/08/13 00:19:51 danw Exp $
+ * $Id: tty_filter.c,v 1.21 2002/04/18 18:28:17 rbasch Exp $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <sysdep.h>
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_tty_filter_c[] = "$Id: tty_filter.c,v 1.18 1999/08/13 00:19:51 danw Exp $";
+static const char rcsid_tty_filter_c[] = "$Id: tty_filter.c,v 1.21 2002/04/18 18:28:17 rbasch Exp $";
#endif
#include <zephyr/mit-copyright.h>
-.\" $Id: zwgc.1,v 1.24 2000/08/10 15:10:52 ghudson Exp $
+.\" $Id: zwgc.1,v 1.25 2002/09/10 00:32:16 ghudson Exp $
' # end of TP (cf }N below)
' # copied here, since we use @ in some of our tags, and that
' # messes up \w and \h
.TP
.B break
Exits the innermost if, case, or while block.
-.\" .if n .ll +2in
.TP
\fBcase \fIexpr1\fR [ ((\fBmatch \fIexpr\fR [,\fIexpr ...\fR]) | \fBdefault\fR)\fI commands \fR] ... \fBendcase\fR
Evaluates \fIexpr1\fR. Then, each of the match expressions is
Completes processing of the current notice. The remainder of the
description file is ignored after execution of this command.
.\" hack because the following line otherwise breaks because it is too long.
-.\" .if n .ll +2in
.TP
\fBif \fIexpr1 \fBthen \fIcommands1\fR [\fBelseif \fIexpr2 \fBthen \fIcommands2\fR] ... [\fBelse \fIcommandsn\fR] \fBendif\fR
If \fIexpr1\fR evaluates to true, execute \fIcommands1\fI, etc. [A conditional
for the terminal named by the TERM environment variable.
Supported @ commands are:
.RS 10
-.\" .TQ 15
-.\" @em
-.\" Emphasis. Use underline if available, else reverse video.
-.TP
+.TP 15
@roman
Roman (plain) letters (turns off all special modes).
.TP
@beep
"bl" termcap entry, else "^G" (beep the terminal); limited to once per
message.
-.\" .TQ
-.\" @blink
-.\" "mb"/"me" termcap entry, else nothing.
-.\" .TQ
-.\" @rv
-.\" "so"/"se" termcap entry.
-.\" .TQ
-.\" @u
-.\" "us"/"ue" termcap entry.
.TP
@l or @left
left aligned
.SH EXAMPLES
For an example of a description file, see
-.IR /usr/athena/share/zephyr/zwgc.desc .
+.IR /usr/athena/lib/zephyr/zwgc.desc .
For an example of X resources, see
-.IR /usr/athena/share/zephyr/zwgc_resources .
+.IR /usr/athena/lib/zephyr/zwgc_resources .
.SH BUGS
The X selection code can highlight the wrong portions of messages