Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
Index: create.patch.sh
===================================================================
--- create.patch.sh	(nonexistent)
+++ create.patch.sh	(revision 5)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+VERSION=0.17
+
+tar --files-from=file.list -xzvf ../netkit-ntalk-$VERSION.tar.gz
+mv netkit-ntalk-$VERSION netkit-ntalk-$VERSION-orig
+
+cp -rf ./netkit-ntalk-$VERSION-new ./netkit-ntalk-$VERSION
+
+diff --unified -Nr  netkit-ntalk-$VERSION-orig  netkit-ntalk-$VERSION > netkit-ntalk-$VERSION.patch
+
+mv netkit-ntalk-$VERSION.patch ../patches
+
+rm -rf ./netkit-ntalk-$VERSION
+rm -rf ./netkit-ntalk-$VERSION-orig

Property changes on: create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: file.list
===================================================================
--- file.list	(nonexistent)
+++ file.list	(revision 5)
@@ -0,0 +1,4 @@
+netkit-ntalk-0.17/configure
+netkit-ntalk-0.17/talkd/announce.c
+netkit-ntalk-0.17/talkd/table.c
+netkit-ntalk-0.17/talkd/talkd.c
Index: netkit-ntalk-0.17-new/configure
===================================================================
--- netkit-ntalk-0.17-new/configure	(nonexistent)
+++ netkit-ntalk-0.17-new/configure	(revision 5)
@@ -0,0 +1,372 @@
+#!/bin/sh
+#
+# This file was generated by confgen version 2.
+# Do not edit.
+#
+
+PREFIX='/usr'
+#EXECPREFIX='$PREFIX'
+INSTALLROOT=''
+BINMODE='755'
+#DAEMONMODE='$BINMODE'
+MANMODE='644'
+
+while [ x$1 != x ]; do case $1 in
+
+	--help)
+	cat <<EOF
+Usage: configure [options]
+    --help                Show this message
+    --with-debug          Enable debugging
+    --prefix=path         Prefix for location of files [/usr]
+    --exec-prefix=path    Location for arch-depedent files [prefix]
+    --installroot=root    Top of filesystem tree to install in [/]
+    --binmode=mode        Mode for binaries [755]
+    --daemonmode=mode     Mode for daemon binaries [same as binmode]
+    --manmode=mode        Mode for manual pages [644]
+    --with-c-compiler=cc  Program for compiling C source [guessed]
+EOF
+	exit 0;;
+	--verbose) ;;
+	--quiet) ;;
+
+	--subdir) . ../configure.defs;;
+
+	--with-debug|--debug) DEBUG=1;;
+	--prefix=*) PREFIX=`echo $1 | sed 's/^[^=]*=//'` ;;
+	--exec-prefix=*) EXECPREFIX=`echo $1 | sed 's/^[^=]*=//'` ;;
+	--installroot=*) INSTALLROOT=`echo $1 | sed 's/^[^=]*=//'` ;;
+	--binmode=*) BINMODE=`echo $1 | sed 's/^[^=]*=//'` ;;
+	--daemonmode=*) DAEMONMODE=`echo $1 | sed 's/^[^=]*=//'` ;;
+	--manmode=*) MANMODE=`echo $1 | sed 's/^[^=]*=//'` ;;
+	--with-c-compiler=*) CC=`echo $1 | sed 's/^[^=]*=//'` ;;
+	*) echo "Unrecognized option: $1"; exit 1;;
+esac 
+shift
+done
+
+if [ x$EXECPREFIX = x ]; then 
+	EXECPREFIX="$PREFIX"
+fi
+
+if [ x$DAEMONMODE = x ]; then 
+	DAEMONMODE="$BINMODE"
+fi
+
+BINDIR="$EXECPREFIX/bin"
+SBINDIR="$EXECPREFIX/sbin"
+MANDIR="$PREFIX/share/man"
+
+echo "Directories: $BINDIR $SBINDIR $MANDIR "
+
+if [ x$INSTALLROOT != x ]; then
+    echo "Installing in chroot tree rooted at $INSTALLROOT"
+fi
+
+##################################################
+
+WARNINGS='-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline '
+
+cat << EOF > __conftest.c
+    int main() { int class=0; return class; }
+EOF
+
+if [ x"$CC" = x ]; then
+    echo -n 'Looking for a C compiler... '
+    for TRY in egcs gcc g++ CC c++ cc; do
+       (
+           $TRY __conftest.c -o __conftest || exit 1;
+#           ./__conftest || exit 1;
+       ) >/dev/null 2>&1 || continue;
+       CC=$TRY
+       break;
+    done
+    if [ x"$CC" = x ]; then
+        echo 'failed.'
+        echo 'Cannot find a C compiler. Run configure with --with-c-compiler.'
+        rm -f __conftest*
+        exit
+    fi
+    echo "$CC"
+else
+    echo -n 'Checking if C compiler works... '
+    if (
+          $CC __conftest.c -o __conftest || exit 1
+#          ./__conftest || exit 1
+       ) >/dev/null 2>&1; then
+         echo 'yes'
+     else
+         echo 'no'
+         echo 'Compiler '"$CC"' does not exist or cannot compile C; try another.'
+         rm -f __conftest*
+         exit
+     fi
+fi
+
+echo -n "Checking if $CC accepts gcc warnings... "
+if (
+    $CC $WARNINGS __conftest.c -o __conftest || exit 1
+   ) >/dev/null 2>&1; then
+     echo 'yes'
+     CC_WARNINGS=1
+else
+     echo 'no'
+fi
+
+if [ x$DEBUG = x ]; then
+    echo -n "Checking if $CC accepts -O2... "
+    if (
+         $CC -O2 __conftest.c -o __conftest
+       ) >/dev/null 2>&1; then
+         echo 'yes'
+         CFLAGS="$CFLAGS -O2"
+    else
+         echo 'no'
+         echo -n "Checking if $CC accepts -O... "
+         if (
+              $CC -O __conftest.c -o __conftest
+            ) >/dev/null 2>&1; then
+              echo 'yes'
+              CFLAGS="$CFLAGS -O"
+         else
+              echo 'no'
+         fi
+    fi
+
+else
+    echo -n "Checking if $CC accepts -g... "
+    if (
+         $CC -g __conftest.c -o __conftest
+       ) >/dev/null 2>&1; then
+         echo 'yes'
+         CFLAGS="$CFLAGS -g"
+    else
+         echo 'no'
+    fi
+
+fi
+
+LDFLAGS=$LDFLAGS
+LIBS=$LIBS
+
+rm -f __conftest*
+
+##################################################
+
+echo -n 'Checking for ncurses... '
+cat <<EOF >__conftest.c
+#include <stdio.h>
+#include <curses.h>
+#ifndef KEY_DOWN
+syntax error. /* not ncurses */
+#endif
+int main() {
+    endwin();
+    return 0;
+}
+
+EOF
+if (
+      $CC $CFLAGS  __conftest.c -lncurses -o __conftest || exit 1
+   ) >/dev/null 2>&1; then
+    echo 'yes'
+    NCURSES=1
+else
+    if (
+          $CC $CFLAGS -I/usr/include/ncurses __conftest.c -lncurses -o __conftest || exit 1
+       ) >/dev/null 2>&1; then
+        echo '-I/usr/include/ncurses'
+        CFLAGS="$CFLAGS -I/usr/include/ncurses"
+        NCURSES=1
+    else
+        echo 'no'
+    fi
+fi
+
+if [ x$NCURSES != x ]; then
+    LIBCURSES=-lncurses
+else
+    echo -n 'Checking for traditional curses... '
+cat <<EOF >__conftest.c
+#include <stdio.h>
+#include <termcap.h>
+#include <curses.h>
+int main() {
+    tgetent(NULL, NULL); endwin(); return 0;
+}
+
+EOF
+    if (
+          $CC $CFLAGS  __conftest.c -lcurses -o __conftest || exit 1
+       ) >/dev/null 2>&1; then
+        echo '-lcurses'
+        LIBCURSES=-lcurses
+    else
+        if (
+              $CC $CFLAGS  __conftest.c -lcurses -ltermcap -o __conftest || exit 1
+           ) >/dev/null 2>&1; then
+            echo '-lcurses -ltermcap'
+            LIBCURSES='-lcurses -ltermcap'
+        else
+            echo 'not found'
+            echo 'This package needs curses to run.'
+            rm -f __conftest*
+            exit
+        fi
+    fi
+fi
+rm -f __conftest*
+
+##################################################
+
+echo -n 'Checking for socklen_t... '
+cat <<EOF >__conftest.c
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+int main() {
+    struct sockaddr_in sn;
+    socklen_t len = sizeof(sn);
+    getpeername(0, (struct sockaddr *)&sn, &len);
+    return 0;
+}
+
+EOF
+if (
+      $CC $CFLAGS  __conftest.c  -o __conftest || exit 1
+   ) >/dev/null 2>&1; then
+    echo 'yes'
+else
+    if (
+          $CC $CFLAGS -Dsocklen_t=int __conftest.c  -o __conftest || exit 1
+       ) >/dev/null 2>&1; then
+        echo 'int'
+        CFLAGS="$CFLAGS -Dsocklen_t=int"
+    else
+        if (
+              $CC $CFLAGS -Dsocklen_t=size_t __conftest.c  -o __conftest || exit 1
+           ) >/dev/null 2>&1; then
+            echo 'size_t'
+            CFLAGS="$CFLAGS -Dsocklen_t=size_t"
+        else
+            echo 'no'
+            echo 'Cannot work out what to use for socklen_t. Help...'
+            rm -f __conftest*
+            exit
+        fi
+    fi
+fi
+rm -f __conftest*
+
+##################################################
+
+echo -n 'Checking for snprintf declaration... '
+cat <<EOF >__conftest.c
+#include <stdio.h>
+int main() {
+    void *x = (void *)snprintf;
+    printf("%lx", (long)x);
+    return 0;
+}
+
+EOF
+if (
+      $CC $CFLAGS  __conftest.c  -o __conftest || exit 1
+   ) >/dev/null 2>&1; then
+    echo 'ok'
+else
+    if (
+          $CC $CFLAGS -D_GNU_SOURCE __conftest.c  -o __conftest || exit 1
+#          ./__conftest || exit 1
+       ) >/dev/null 2>&1; then
+        echo '-D_GNU_SOURCE'
+        CFLAGS="$CFLAGS -D_GNU_SOURCE"
+    else
+        echo 'manual'
+        CFLAGS="$CFLAGS -DDECLARE_SNPRINTF"
+    fi
+fi
+rm -f __conftest*
+
+echo -n 'Checking for snprintf implementation... '
+cat <<EOF >__conftest.c
+#include <stdio.h>
+#include <string.h>
+#ifdef DECLARE_SNPRINTF
+#ifdef __cplusplus
+extern "C"
+#endif /*__cplusplus*/
+int snprintf(char *, int, const char *, ...);
+#endif /*DECLARE_SNPRINTF*/
+int main() {
+    char buf[32];
+    snprintf(buf, 8, "%s", "1234567890");
+    if (strlen(buf)!=7) return 1;
+    return 0;
+}
+
+EOF
+if (
+      $CC $CFLAGS  __conftest.c $LIBBSD -o __conftest || exit 1
+#      ./__conftest || exit 1
+   ) >/dev/null 2>&1; then
+    echo 'ok'
+else
+    if (
+          $CC $CFLAGS  __conftest.c -lsnprintf $LIBBSD -o __conftest || exit 1
+#          ./__conftest || exit 1
+       ) >/dev/null 2>&1; then
+        echo '-lsnprintf'
+        LIBS="$LIBS -lsnprintf"
+    else
+        if (
+              $CC $CFLAGS  __conftest.c -ldb $LIBBSD -o __conftest || exit 1
+#              ./__conftest || exit 1
+           ) >/dev/null 2>&1; then
+            echo '-ldb'
+            LIBS="$LIBS -ldb"
+        else
+            echo 'missing'
+            echo 'This package requires snprintf.'
+            rm -f __conftest*
+            exit
+        fi
+    fi
+fi
+rm -f __conftest*
+
+##################################################
+
+## libbsd should go last in case it's broken
+if [ "x$LIBBSD" != x ]; then
+    LIBS="$LIBS $LIBBSD"
+fi
+
+echo 'Generating MCONFIG...'
+(
+    echo -n '# Generated by configure (confgen version 2) on '
+    date
+    echo '#'
+    echo
+
+    echo "BINDIR=$BINDIR"
+    echo "SBINDIR=$SBINDIR"
+    echo "MANDIR=$MANDIR"
+    echo "BINMODE=$BINMODE"
+    echo "DAEMONMODE=$DAEMONMODE"
+    echo "MANMODE=$MANMODE"
+    echo "PREFIX=$PREFIX"
+    echo "EXECPREFIX=$EXECPREFIX"
+    echo "INSTALLROOT=$INSTALLROOT"
+    echo "CC=$CC"
+    if [ x$CC_WARNINGS != x ]; then
+        CFLAGS="$CFLAGS $WARNINGS"
+    fi
+
+    echo "CFLAGS=$CFLAGS" | sed 's/= */=/'
+    echo "LDFLAGS=$LDFLAGS" | sed 's/= */=/'
+    echo "LIBS=$LIBS" | sed 's/= */=/'
+
+    echo "LIBCURSES=$LIBCURSES"
+) > MCONFIG
+

Property changes on: netkit-ntalk-0.17-new/configure
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: netkit-ntalk-0.17-new/talkd/announce.c
===================================================================
--- netkit-ntalk-0.17-new/talkd/announce.c	(nonexistent)
+++ netkit-ntalk-0.17-new/talkd/announce.c	(revision 5)
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * From: @(#)announce.c	5.9 (Berkeley) 2/26/91
+ */
+char ann_rcsid[] = 
+  "$Id: announce.c,v 1.8 2000/07/22 15:27:39 dholland Exp $";
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <time.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <syslog.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <string.h>
+#include <paths.h>
+#include "prot_talkd.h"
+#include "proto.h"
+
+/*
+ * Announce an invitation to talk.
+ *
+ * Because the tty driver insists on attaching a terminal-less
+ * process to any terminal that it writes on, we must fork a child
+ * to protect ourselves.
+ *
+ * That hasn't been true since, hrm, 4.2BSD maybe? Even in System V,
+ * we can use O_NOCTTY. On the other hand, forking is a good idea in
+ * case the tty hangs. But at present we don't take advantage of that;
+ * we'd wait() forever.
+ */
+
+
+/*
+ * Reject control codes and other crap.
+ * FUTURE: don't clear high ascii if the tty is in 8-bit mode
+ * Note that we don't need to let through tabs or newlines here.
+ */
+static int safechar(int ch) {
+    if (ch>127 || ch<32) ch = '?';
+    return ch;
+}
+
+#define max(a,b) ( (a) > (b) ? (a) : (b) )
+#define N_LINES 5
+#define N_CHARS 120
+
+/*
+ * Build a block of characters containing the message. 
+ * It is sent blank filled and in a single block to
+ * try to keep the message in one piece if the recipient
+ * is in, say, vi at the time.
+ */
+static void
+print_mesg(int fd, CTL_MSG *request, const char *remote_machine)
+{
+	struct timeval clocc;
+	struct timezone zone;
+	struct tm *localclock;
+	char line_buf[N_LINES][N_CHARS];
+	int sizes[N_LINES];
+	char big_buf[N_LINES*(N_CHARS+2)+16];
+	char *bptr, *lptr;
+	int i, j, max_size;
+	time_t footime;
+
+	i = 0;
+	max_size = 0;
+	gettimeofday(&clocc, &zone);
+	footime = clocc.tv_sec;
+	localclock = localtime(&footime);
+	snprintf(line_buf[i], N_CHARS, " ");
+	sizes[i] = strlen(line_buf[i]);
+	max_size = max(max_size, sizes[i]);
+	i++;
+	snprintf(line_buf[i], N_CHARS, 
+		 "Message from Talk_Daemon@%s at %d:%02d ...",
+		 ourhostname, localclock->tm_hour, localclock->tm_min);
+	sizes[i] = strlen(line_buf[i]);
+	max_size = max(max_size, sizes[i]);
+	i++;
+	snprintf(line_buf[i], N_CHARS, "talk: connection requested by %s@%s.",
+		request->l_name, remote_machine);
+	sizes[i] = strlen(line_buf[i]);
+	max_size = max(max_size, sizes[i]);
+	i++;
+	snprintf(line_buf[i], N_CHARS, "talk: respond with:  talk %s@%s",
+		 request->l_name, remote_machine);
+	sizes[i] = strlen(line_buf[i]);
+	max_size = max(max_size, sizes[i]);
+	i++;
+	snprintf(line_buf[i], N_CHARS, " ");
+	sizes[i] = strlen(line_buf[i]);
+	max_size = max(max_size, sizes[i]);
+	i++;
+	bptr = big_buf;
+	*bptr++ = ''; /* send something to wake them up */
+	*bptr++ = '\r';	/* add a \r in case of raw mode */
+	*bptr++ = '\n';
+	for (i = 0; i < N_LINES; i++) {
+		/* copy the line into the big buffer */
+		lptr = line_buf[i];
+		while (*lptr != '\0')
+			*(bptr++) = safechar(*(lptr++));
+		/* pad out the rest of the lines with blanks */
+		for (j = sizes[i]; j < max_size + 2; j++)
+			*(bptr++) = ' ';
+		*(bptr++) = '\r';	/* add a \r in case of raw mode */
+		*(bptr++) = '\n';
+	}
+	*bptr = 0;
+	write(fd, big_buf, strlen(big_buf));
+}
+
+/*
+ * See if the user is accepting messages. If so, announce that 
+ * a talk is requested.
+ */
+static int
+announce_proc(CTL_MSG *request, const char *remote_machine)
+{
+	char full_tty[32];
+	int fd;
+	struct stat stbuf;
+
+	snprintf(full_tty, sizeof(full_tty), "%s/%s", _PATH_DEV, 
+		 request->r_tty);
+	if (access(full_tty, F_OK) != 0)
+		return FAILED;
+	fd = open(full_tty, O_WRONLY|O_NOCTTY);
+	if (fd<0) {
+		return (PERMISSION_DENIED);
+	}
+	if (fstat(fd, &stbuf) < 0) {
+		return (PERMISSION_DENIED);
+	}
+	if ((stbuf.st_mode&020) == 0) {
+		return (PERMISSION_DENIED);
+	}
+	print_mesg(fd, request, remote_machine);
+	close(fd);
+	return SUCCESS;
+}
+
+int
+announce(CTL_MSG *request, const char *remote_machine)
+{
+	int pid, val, status;
+
+	pid = fork();
+	if (pid==-1) {
+		/* fork failed */
+		return FAILED;
+	}
+	if (pid==0) {
+		/* child */
+		status = announce_proc(request, remote_machine);
+		_exit(status);
+	}
+
+	/* we are the parent, so wait for the child */
+	do {
+		val = wait(&status);
+		if (val == -1) {
+			if (errno == EINTR || errno == EAGAIN)
+				continue;
+			/* shouldn't happen */
+			syslog(LOG_WARNING, "announce: wait: %m");
+			return (FAILED);
+		}
+	} while (val != pid);
+
+	if (WIFSIGNALED(status)) {
+		/* we were killed by some signal */
+		return FAILED;
+	}
+	/* Send back the exit/return code */
+	return (WEXITSTATUS(status));
+}
Index: netkit-ntalk-0.17-new/talkd/table.c
===================================================================
--- netkit-ntalk-0.17-new/talkd/table.c	(nonexistent)
+++ netkit-ntalk-0.17-new/talkd/table.c	(revision 5)
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * From: @(#)table.c	5.7 (Berkeley) 2/26/91
+ */
+char table_rcsid[] = 
+  "$Id: table.c,v 1.9 1998/11/27 07:58:47 dholland Exp $";
+
+/*
+ * Routines to handle insertion, deletion, etc on the table
+ * of requests kept by the daemon. Nothing fancy here, linear
+ * search on a double-linked list. A time is kept with each 
+ * entry so that overly old invitations can be eliminated.
+ *
+ * Consider this a mis-guided attempt at modularity
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <time.h>
+#include <sys/socket.h>
+#include <syslog.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h>
+
+#include "prot_talkd.h"
+#include "proto.h"
+
+#define MAX_ID 16000	/* << 2^15 so I don't have sign troubles */
+
+typedef struct table_entry {
+	struct table_entry *next;
+	struct table_entry *last;
+	CTL_MSG request;
+	time_t time;
+} TABLE_ENTRY;
+
+static TABLE_ENTRY *table = NULL;
+
+/*
+ * Generate a unique non-zero sequence number
+ */
+int
+new_id(void)
+{
+	static int current_id = 0;
+
+	current_id = (current_id + 1) % MAX_ID;
+	/* 0 is reserved, helps to pick up bugs */
+	if (current_id == 0)
+		current_id = 1;
+	return current_id;
+}
+
+/*
+ * Classic delete from a double-linked list
+ */
+static void
+deleteit(TABLE_ENTRY *ptr)
+{
+	print_request("deleteit", &ptr->request);
+	if (table == ptr) {
+		table = ptr->next;
+	}
+	else if (ptr->last != NULL) {
+		ptr->last->next = ptr->next;
+	}
+	if (ptr->next != NULL) {
+		ptr->next->last = ptr->last;
+	}
+	free(ptr);
+}
+
+/*
+ * Go through the table and chuck out anything out of date
+ */
+static void
+expire(void)
+{
+	time_t current_time = time(NULL);
+	TABLE_ENTRY *ptr;
+
+	for (ptr = table; ptr != NULL; ptr = ptr->next) {
+		if ((current_time - ptr->time) > MAX_LIFE) {
+			/* the entry is too old */
+			print_request("deleting expired entry",
+				      &ptr->request);
+			deleteit(ptr);
+		}
+	}
+}
+
+/*
+ * Look in the table for an invitation that matches the current
+ * request looking for an invitation
+ */
+CTL_MSG *
+find_match(CTL_MSG *request)
+{
+	TABLE_ENTRY *ptr;
+
+	expire();
+
+	print_request("find_match", request);
+	for (ptr = table; ptr != NULL; ptr = ptr->next) {
+		print_request("", &ptr->request);
+		if (strcmp(request->l_name, ptr->request.r_name) == 0 &&
+		    strcmp(request->r_name, ptr->request.l_name) == 0 &&
+		     ptr->request.type == LEAVE_INVITE)
+			return (&ptr->request);
+	}
+	return NULL;
+}
+
+/*
+ * Look for an identical request, as opposed to a complementary
+ * one as find_match does 
+ */
+CTL_MSG *
+find_request(CTL_MSG *request)
+{
+	TABLE_ENTRY *ptr;
+
+	expire();
+
+	/*
+	 * See if this is a repeated message.
+	 */
+	print_request("find_request", request);
+	for (ptr = table; ptr != NULL; ptr = ptr->next) {
+		print_request("", &ptr->request);
+		if (strcmp(request->r_name, ptr->request.r_name) == 0 &&
+		    strcmp(request->l_name, ptr->request.l_name) == 0 &&
+		    request->type == ptr->request.type &&
+		    request->pid == ptr->request.pid) {
+			/* update the time if we 'touch' it */
+			ptr->time = time(NULL);
+			return (&ptr->request);
+		}
+	}
+	return NULL;
+}
+
+void
+insert_table(CTL_MSG *request, CTL_RESPONSE *response)
+{
+	TABLE_ENTRY *ptr;
+
+	request->id_num = new_id();
+	response->id_num = htonl(request->id_num);
+
+	/* insert a new entry into the top of the list */
+	ptr = malloc(sizeof(TABLE_ENTRY));
+	if (ptr == NULL) {
+		syslog(LOG_ERR, "insert_table: Out of memory");
+		_exit(1);
+	}
+	ptr->time = time(NULL);
+	ptr->request = *request;
+
+	ptr->next = table;
+	if (ptr->next != NULL) {
+		ptr->next->last = ptr;
+	}
+	ptr->last = NULL;
+	table = ptr;
+}
+
+/*
+ * Delete the invitation with id 'id_num'
+ */
+int
+delete_invite(unsigned id_num)
+{
+	TABLE_ENTRY *ptr;
+
+	ptr = table;
+	debug("delete_invite(%d)\n", id_num);
+
+	for (ptr = table; ptr != NULL; ptr = ptr->next) {
+		if (ptr->request.id_num == id_num)
+			break;
+		print_request("", &ptr->request);
+	}
+	if (ptr != NULL) {
+		deleteit(ptr);
+		return SUCCESS;
+	}
+	return NOT_HERE;
+}
+
Index: netkit-ntalk-0.17-new/talkd/talkd.c
===================================================================
--- netkit-ntalk-0.17-new/talkd/talkd.c	(nonexistent)
+++ netkit-ntalk-0.17-new/talkd/talkd.c	(revision 5)
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+char copyright[] =
+  "@(#) Copyright (c) 1983 Regents of the University of California.\n"
+  "All rights reserved.\n";
+
+/*
+ * From: @(#)talkd.c	5.8 (Berkeley) 2/26/91
+ */
+char talkd_rcsid[] = 
+  "$Id: talkd.c,v 1.12 1999/09/28 22:04:15 netbug Exp $";
+
+#include "../version.h"
+
+/*
+ * talkd - internet talk daemon
+ * loops waiting for and processing requests until idle for a while,
+ * then exits.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <signal.h>
+#include <syslog.h>
+#include <time.h>
+#include <errno.h>
+#include <unistd.h>
+/*#include <stdio.h>*/
+#include <stdlib.h>
+#include <string.h>
+#include <netdb.h>
+#include <paths.h>
+#include "prot_talkd.h"
+#include "proto.h"
+
+#define TIMEOUT 30
+#define MAXIDLE 120
+#define MINUDPSRCPORT 1024
+
+#if !defined(MAXHOSTNAMELEN)
+#define	MAXHOSTNAMELEN	64
+#endif
+char ourhostname[MAXHOSTNAMELEN];
+
+static time_t lastmsgtime;
+
+static void
+timeout(int ignore)
+{
+	(void)ignore;
+
+	if (time(NULL) - lastmsgtime >= MAXIDLE)
+		_exit(0);
+	signal(SIGALRM, timeout);
+	alarm(TIMEOUT);
+}
+
+/*
+ * Returns true if the address belongs to the local host. If it's
+ * not a loopback address, try binding to it.
+ */
+static int
+is_local_address(u_int32_t addr)
+{
+	struct sockaddr_in sn;
+	int sock, ret;
+	if (addr == htonl(INADDR_LOOPBACK)) {
+		return 1;
+	}
+
+	sock = socket(AF_INET, SOCK_DGRAM, 0);
+	if (sock<0) {
+		syslog(LOG_WARNING, "socket: %s", strerror(errno));
+		return 0;
+	}
+	memset(&sn, 0, sizeof(sn));
+	sn.sin_family = AF_INET;
+	sn.sin_port = htons(0);
+	sn.sin_addr.s_addr = addr;
+	ret = bind(sock, (struct sockaddr *)&sn, sizeof(sn));
+	close(sock);
+	return ret==0;
+}
+
+static void
+send_packet(CTL_RESPONSE *response, struct sockaddr_in *sn, int quirk)
+{
+	char buf[2*sizeof(CTL_RESPONSE)];
+	size_t sz = sizeof(CTL_RESPONSE);
+	int cc, err=0;
+
+	memcpy(buf, response, sz);
+	if (quirk) {
+		sz = irrationalize_reply(buf, sizeof(buf), quirk);
+	}
+	while (sz > 0) {
+		cc = sendto(1, buf, sz, 0, (struct sockaddr *)sn, sizeof(*sn));
+		if (cc<0) {
+			syslog(LOG_WARNING, "sendto: %s", strerror(errno));
+			if (err) return;
+			err = 1;
+		}
+		else sz -= cc;
+	}
+}
+
+/*
+ * Issue an error packet. Should not assume anything other than the
+ * header part (the u_int8_t's) of mp is valid, and assume as little
+ * as possible about that, since it might have been a packet we 
+ * couldn't dequirk.
+ */
+static void 
+send_reject_packet(CTL_MSG *mp, struct sockaddr_in *sn, int code, int quirk)
+{
+	CTL_RESPONSE rsp;
+	memset(&rsp, 0, sizeof(rsp));
+	rsp.vers = TALK_VERSION;
+	rsp.type = mp->type;
+	rsp.answer = code;
+	send_packet(&rsp, sn, quirk);
+}
+
+static void
+do_one_packet(void)
+{
+	char inbuf[2*sizeof(CTL_MSG)];
+	int quirk = 0;
+	CTL_RESPONSE response;
+	CTL_MSG *mp;
+	char theirhost[MAXHOSTNAMELEN];
+	const char *theirip;
+
+	struct hostent *hp;
+	struct sockaddr_in sn;
+	int cc, i, ok;
+	socklen_t addrlen;
+ 	int theirport;
+
+	addrlen = sizeof(sn);
+	cc = recvfrom(0, inbuf, sizeof(inbuf), 0,
+		      (struct sockaddr *)&sn, &addrlen);
+	if (cc<0) {
+		if (errno==EINTR || errno==EAGAIN) {
+			return;
+		}
+		syslog(LOG_WARNING, "recvfrom: %s", strerror(errno));
+		return;
+	}
+
+	/* 
+	 * This should be set on any input, even trash, because even
+	 * trash input will cause us to be restarted if we exit.
+	 */
+	lastmsgtime = time(NULL);
+
+	if (addrlen!=sizeof(sn)) {
+		syslog(LOG_WARNING, "recvfrom: bogus address length");
+		return;
+	}
+	if (sn.sin_family!=AF_INET) {
+		syslog(LOG_WARNING, "recvfrom: bogus address family");
+		return;
+	}
+
+	theirport = ntohs(sn.sin_port);
+	if (theirport < MINUDPSRCPORT) {
+		syslog(LOG_WARNING, "%d: bad port", theirport);
+		return;
+	}
+
+	/* 
+	 * If we get here we have an address we can reply to, although
+	 * it may not be good for much. If possible, reply to it, because
+	 * if we just drop the packet the remote talk client will keep
+	 * throwing junk at us.
+	 */
+	theirip = inet_ntoa(sn.sin_addr);
+	mp = (CTL_MSG *)inbuf;
+
+	/*
+	 * Check they're not being weenies.
+	 * We should look into using libwrap here so hosts.deny works.
+	 * Wrapping talkd with tcpd isn't very useful.
+	 */
+	hp = gethostbyaddr((char *)&sn.sin_addr, sizeof(struct in_addr), 
+			   AF_INET);
+	if (hp == NULL) {
+		syslog(LOG_WARNING, "%s: bad dns", theirip);
+		send_reject_packet(mp, &sn, MACHINE_UNKNOWN, 0);
+		return;
+	}
+	strncpy(theirhost, hp->h_name, sizeof(theirhost));
+	theirhost[sizeof(theirhost)-1] = 0;
+
+	hp = gethostbyname(theirhost);
+	if (hp == NULL) {
+		syslog(LOG_WARNING, "%s: bad dns", theirip);
+		send_reject_packet(mp, &sn, MACHINE_UNKNOWN, 0);
+		return;
+	}
+
+	for (i=ok=0; hp->h_addr_list[i] && !ok; i++) {
+		if (!memcmp(hp->h_addr_list[i], &sn.sin_addr, 
+			    sizeof(sn.sin_addr))) ok = 1;
+	}
+	if (!ok) {
+		syslog(LOG_WARNING, "%s: bad dns", theirip);
+		send_reject_packet(mp, &sn, MACHINE_UNKNOWN, 0);
+		return;
+	}
+
+	/*
+	 * Try to straighten out bad packets.
+	 */
+	quirk = rationalize_packet(inbuf, cc, sizeof(inbuf), &sn);
+	if (quirk<0) {
+		print_broken_packet(inbuf, cc, &sn);
+		syslog(LOG_WARNING, "%s (%s): unintelligible packet", 
+		       theirhost, theirip);
+		send_reject_packet(mp, &sn, UNKNOWN_REQUEST, 0);
+		return;
+	}
+
+	/*
+	 * Make sure we know what we're getting into.
+	 */
+	if (mp->vers!=TALK_VERSION) {
+		syslog(LOG_WARNING, "%s (%s): bad protocol version %d", 
+		       theirhost, theirip, mp->vers);
+		send_reject_packet(mp, &sn, BADVERSION, 0);
+		return;
+	}
+
+	/*
+	 * LEAVE_INVITE messages should only come from localhost.
+	 * Of course, old talk clients send from our hostname's IP
+	 * rather than localhost, complicating the issue...
+	 */
+	if (mp->type==LEAVE_INVITE && !is_local_address(sn.sin_addr.s_addr)) {
+		syslog(LOG_WARNING, "%s (%s) sent invite packet",
+		       theirhost, theirip);
+		send_reject_packet(mp, &sn, MACHINE_UNKNOWN, quirk);
+		return;
+	}
+
+	/*
+	 * Junk the reply address they reported for themselves. Write 
+	 * the real one over it because announce.c gets it from there.
+	 */
+	mp->ctl_addr.ta_family = AF_INET;
+	mp->ctl_addr.ta_port = sn.sin_port;
+	mp->ctl_addr.ta_addr = sn.sin_addr.s_addr;
+
+	/*
+	 * Since invite messages only come from localhost, and nothing
+	 * but invite messages use the TCP address, force it to be our
+	 * address.
+	 * 
+	 * Actually, if it's a local address, leave it alone. talk has
+	 * to play games to figure out the right interface address to
+	 * use, and we don't want to get into that - they can work it
+	 * out, but we can't since we don't know who they're trying to
+	 * talk to.
+	 *
+	 * If it's not a local address, someone's trying to play games
+	 * with us. Rather than trying to pick a local address to use,
+	 * reject the packet.
+	 */
+	if (mp->type==LEAVE_INVITE) {
+		mp->addr.ta_family = AF_INET;
+		if (!is_local_address(mp->addr.ta_addr)) {
+			syslog(LOG_WARNING, 
+			       "invite packet had bad return address");
+			send_reject_packet(mp, &sn, BADADDR, quirk);
+			return;
+		}
+	}
+	else {
+		/* non-invite packets don't use this field */
+		memset(&mp->addr, 0, sizeof(mp->addr));
+	}
+
+	process_request(mp, &response, theirhost);
+
+	/* can block here, is this what I want? */
+	send_packet(&response, &sn, quirk);
+}
+
+int
+main(int argc, char *argv[])
+{
+	struct sockaddr_in sn;
+	socklen_t sz = sizeof(sn);
+	int do_debug=0, do_badpackets=0, ch;
+
+	/* make sure we're a daemon */
+	if (getsockname(0, (struct sockaddr *)&sn, &sz)) {
+		const char *msg = strerror(errno);
+		write(2, msg, strlen(msg));
+		exit(1);
+	}
+	openlog("talkd", LOG_PID, LOG_DAEMON);
+	if (gethostname(ourhostname, sizeof(ourhostname) - 1) < 0) {
+		syslog(LOG_ERR, "gethostname: %s", strerror(errno));
+		exit(1);
+	}
+	if (chdir(_PATH_DEV) < 0) {
+		syslog(LOG_ERR, "chdir: %s: %s", _PATH_DEV, strerror(errno));
+		exit(1);
+	}
+	while ((ch = getopt(argc, argv, "dp"))!=-1) {
+		switch (ch) {
+		    case 'd': do_debug=1; break;
+		    case 'p': do_badpackets=1; break;
+		}
+	}
+	set_debug(do_debug, do_badpackets);
+
+	signal(SIGALRM, timeout);
+	alarm(TIMEOUT);
+	for (;;) {
+		do_one_packet();
+	}
+/*	return 0;  <--- unreachable because of the above loop */
+}
Index: netkit-ntalk-0.17-new/talkd
===================================================================
--- netkit-ntalk-0.17-new/talkd	(nonexistent)
+++ netkit-ntalk-0.17-new/talkd	(revision 5)

Property changes on: netkit-ntalk-0.17-new/talkd
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: netkit-ntalk-0.17-new
===================================================================
--- netkit-ntalk-0.17-new	(nonexistent)
+++ netkit-ntalk-0.17-new	(revision 5)

Property changes on: netkit-ntalk-0.17-new
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: .
===================================================================
--- .	(nonexistent)
+++ .	(revision 5)

Property changes on: .
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~