ax25-tools-0.0.10-rc4/ 0000755 0000000 0000000 00000000000 12157605322 011145 5 0000000 0000000 ax25-tools-0.0.10-rc4/install-sh 0000755 0000000 0000000 00000033256 12157605222 013101 0000000 0000000 #!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-01-19.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for `test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
ax25-tools-0.0.10-rc4/depcomp 0000755 0000000 0000000 00000050643 12157605222 012451 0000000 0000000 #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2012-03-27.16; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva .
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to .
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# A tabulation character.
tab=' '
# A newline character.
nl='
'
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' "$nl" < "$tmpdepfile" |
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependent.h'.
# Do two passes, one to just change these to
# '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
# However on
# $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\':
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
# tcc 0.9.26 (FIXME still under development at the moment of writing)
# will emit a similar output, but also prepend the continuation lines
# with horizontal tabulation characters.
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form 'foo.o: dependent.h',
# or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
# Do two passes, one to just change these to
# '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
< "$tmpdepfile" > "$depfile"
sed '
s/[ '"$tab"'][ '"$tab"']*/ /g
s/^ *//
s/ *\\*$//
s/^[^:]*: *//
/^$/d
/:$/d
s/$/ :/
' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test "$stat" = 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' "$nl" < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
ax25-tools-0.0.10-rc4/INSTALL 0000644 0000000 0000000 00000036600 12157605222 012122 0000000 0000000 Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
ax25-tools-0.0.10-rc4/ax25/ 0000755 0000000 0000000 00000000000 12157605321 011723 5 0000000 0000000 ax25-tools-0.0.10-rc4/ax25/axctl.c 0000664 0000000 0000000 00000004430 12155142241 013120 0000000 0000000 #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main(int argc, char **argv)
{
struct ax25_ctl_struct ax25_ctl;
char *addr;
int s;
if (argc == 2 && strncmp(argv[1], "-v", 2) == 0) {
printf("axctl: %s\n", VERSION);
return 0;
}
if (argc < 5) {
fprintf(stderr, "Usage: axctl [-v] port dest src t1|t2|t3|n2|paclen|idle|window|maxq|kill [parm]\n");
return 1;
}
if (ax25_config_load_ports() == 0) {
fprintf(stderr, "axctl: no AX.25 port data configured\n");
return 1;
}
if ((addr = ax25_config_get_addr(argv[1])) == NULL) {
fprintf(stderr, "axctl: invalid port name - %s\n", argv[1]);
return 1;
}
if (ax25_aton_entry(addr, (char *)&ax25_ctl.port_addr) == -1)
return 1;
if (ax25_aton_entry(argv[2], (char *)&ax25_ctl.dest_addr) == -1)
return 1;
if (ax25_aton_entry(argv[3], (char *)&ax25_ctl.source_addr) == -1)
return 1;
if ((s = socket(AF_AX25, SOCK_SEQPACKET, 0)) < 0) {
perror("axctl: socket");
return 1;
}
if (strcmp(argv[4], "kill") == 0 || strcmp(argv[4], "-kill") == 0) {
ax25_ctl.cmd = AX25_KILL;
ax25_ctl.arg = 0;
} else {
if (argc < 6) {
fprintf(stderr,"axctl: parameter missing\n");
return 1;
}
ax25_ctl.arg = atoi(argv[5]);
if (strcmp(argv[4], "t1") == 0 || strcmp(argv[4], "-t1") == 0)
ax25_ctl.cmd = AX25_T1;
else if (strcmp(argv[4], "t2") == 0 || strcmp(argv[4], "-t2") == 0)
ax25_ctl.cmd = AX25_T2;
else if (strcmp(argv[4], "t3") == 0 || strcmp(argv[4], "-t3") == 0)
ax25_ctl.cmd = AX25_T3;
else if (strcmp(argv[4], "idle") == 0 || strcmp(argv[4], "-idle") == 0)
ax25_ctl.cmd = AX25_IDLE;
else if (strcmp(argv[4], "n2") == 0 || strcmp(argv[4], "-n2") == 0)
ax25_ctl.cmd = AX25_N2;
else if (strcmp(argv[4], "window") == 0 || strcmp(argv[4], "-window") == 0)
ax25_ctl.cmd = AX25_WINDOW;
else if (strcmp(argv[4], "paclen") == 0 || strcmp(argv[4], "-paclen") == 0)
ax25_ctl.cmd = AX25_PACLEN;
}
ax25_ctl.digi_count = 0;
if (ioctl(s, SIOCAX25CTLCON, &ax25_ctl) != 0) {
perror("axctl: SIOAX25CTLCON");
return 1;
}
return 0;
}
ax25-tools-0.0.10-rc4/ax25/ax25d.conf 0000664 0000000 0000000 00000002110 12155142241 013424 0000000 0000000 # /etc/ax25/ax25d.conf
#
# ax25d Configuration File.
#
# AX.25 Ports begin with a '['.
#
[OH2BNS VIA 1]
NOCALL * * * * * * L
default * * * * * * - root /usr/local/sbin/ttylinkd ttylinkd
#parameters_extAX25 VC-wait-login VC-disc-on-linkfailure-msg VC-log-connections
#
#
[OH2BNS-2 VIA 1]
NOCALL * * * * * * L
default * * * * * * - root /usr/sbin/node node
#
#
[OH2BNS VIA 2]
NOCALL * * * * * * L
default * * * * * * - root /usr/local/sbin/ttylinkd ttylinkd
#
[OH2BNS-2 VIA 2]
NOCALL * * * * * * L
default * * * * * * - root /usr/sbin/node node
#
[OH2BNS-3 VIA 2]
NOCALL * * * * * * L
default * * * * * * - root /usr/local/sbin/axwrapper axwrapper /usr/bin/finger finger
#
#[OH2BNS-9]
#NOCALL * * * * * * L
#default * * * * * * - root /usr/sbin/node node
#
# NET/ROM Ports begin with a '<'.
#
#
#NOCALL * * * * * * L
#default * * * * * * - root /usr/local/sbin/ttylinkd ttylinkd
#
NOCALL * * * * * * L
default * * * * * * - root /usr/sbin/node node
#
#
#NOCALL * * * * * * L
#default * * * * * * - root /usr/sbin/node node
#
ax25-tools-0.0.10-rc4/ax25/mheardd.8 0000664 0000000 0000000 00000003045 12155142241 013337 0000000 0000000 .TH MHEARDD 8 "27 August 1996" Linux "Linux Programmer's Manual"
.SH NAME
mheardd \- collect information about packet activity
.SH SYNOPSIS
.B mheardd [-f] [-l] [-n number] [-p [!]port1[,port2,..]] [-v]
.SH DESCRIPTION
.LP
.B Mheardd
is a daemon that collects the statistics about the activity on all the AX.25
channels that are configured. The list generated is available for viewing by
the
.BR mheard (1)
program. The information collected is a superset of the information normally
collected by similar mheard programs and this is reflected in the options
available for the viewing program. Logging to the system log file may be
enabled which will enable monitoring of pathalogical conditions, for example
invalid frame types and invalid/unknown protocol IDs.
.SH OPTIONS
.TP 10
.BI \-f
Deletes the existing mheard logging file at program startup, this is not the
default.
.TP 10
.BI \-l
Enables logging to the system log file. The default is off.
.TP 10
.BI "\-n number"
Sets the number of entries in the activity list file, the default is 100. The
minimum value allowed is 10 and the maximum is 1000.
.TP 10
.BI "\-p [!]port1[,port2,..]"
With -p, you instruct mheardd to only listen on specified ax25 ports.
You may give more ports, seperated by ','.
If you introduce the port(s) by a leading '!', then mheardd will listen
on all ports except those you specified.
.TP 10
.BI \-v
Display the version.
.SH FILES
.LP
/var/ax25/mheard/mheard.dat
.br
/etc/ax25/axports
.SH "SEE ALSO"
.BR mheard (1),
.BR ax25 (4).
.SH AUTHOR
Jonathan Naylor G4KLX
ax25-tools-0.0.10-rc4/ax25/axspawn.h 0000664 0000000 0000000 00000000236 12155142241 013473 0000000 0000000 #ifndef AXSPAWN_H
#define AXSPAWN_H
#define EXITDELAY 10
int write_ax25(char *s, int len, int kick);
int Strcasecmp(const char *s1, const char *s2);
#endif
ax25-tools-0.0.10-rc4/ax25/access.c 0000664 0000000 0000000 00000024620 12155142241 013251 0000000 0000000 #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "access.h"
#include "md5.h"
#include "axspawn.h"
#define CONV_RAND_MAX 0x7fffffff
#define SYSTEMPW 0
#define USERPW 1
long seed = 1L;
int conv_rand(void);
void conv_randomize(void);
int conv_random(int num, int base);
char *generate_rand_pw(int len);
void calc_md5_pw (const char *MD5prompt, const char *MD5pw, char *MD5result);
static void char_to_hex(char *c, char *h, int n);
/*--------------------------------------------------------------------------*/
int conv_rand(void)
{
seed = (1103515245L * seed + 12345) & CONV_RAND_MAX;
return ((int) (seed & 077777));
}
/*--------------------------------------------------------------------------*/
void conv_randomize(void)
{
seed = (time(0) & CONV_RAND_MAX);
}
/*--------------------------------------------------------------------------*/
int conv_random(int num, int base)
{
return (((long) (conv_rand() * time(0)) & CONV_RAND_MAX) % num + base);
}
/*--------------------------------------------------------------------------*/
static void char_to_hex(char *c, char *h, int n)
{
int i;
static char *hextable = "0123456789abcdef";
for (i = 0; i < n; i++) {
*h++ = hextable[(*c>>4)&0xf];
*h++ = hextable[*c++ &0xf];
}
*h = '\0';
}
/*--------------------------------------------------------------------------*/
char *generate_rand_pw(int len)
{
static char pass[PASSSIZE+1];
int i, j;
pass[0] = 0;
if (seed == 1L)
conv_randomize();
if (len < 1)
return pass;
if (len > PASSSIZE)
len = PASSSIZE;
for (i = 0; i < len; i++) {
j = conv_random(10+26*2, 0);
if (j < 10) {
pass[i] = j + '0';
continue;
}
j -= 10;
if (j < 26) {
pass[i] = j + 'A';
continue;
}
j -= 26;
pass[i] = j + 'a';
}
pass[len] = 0;
return pass;
}
/*--------------------------------------------------------------------------*/
void ask_pw_sys(char *prompt, char *pass_want, char *pw)
{
char buffer[2048];
int five_digits[5];
int pwlen;
int i, j;
pass_want[0]= 0;
if (!pw || !*pw)
return;
pwlen = strlen(pw);
if (seed == 1L)
conv_randomize();
for (i = 0; i < 5; i++) {
int k;
again:
j = conv_random(pwlen, 0);
/* store generated request-numbers */
five_digits[i] = j+1; /* pos0 refers as 1 */
/* same number again? */
for (k = 0; k < i; k++) {
if (five_digits[k] == five_digits[i])
goto again;
}
/* store expected string in cp->passwd */
pass_want[i] = pw[j];
}
/* and terminate the string */
pass_want[i] = 0;
sprintf(buffer, "\r%s> %d %d %d %d %d\r", prompt, five_digits[0], five_digits[1], five_digits[2], five_digits[3], five_digits[4]);
write_ax25(buffer, strlen(buffer), 1);
}
/*--------------------------------------------------------------------------*/
void ask_pw_md5(char *prompt, char *pass_want, char *pw)
{
#define SALT_LEN 10
char buffer[2048];
char cipher[16];
char key[256];
char *challenge;
pass_want[0]= 0;
if (!pw || !*pw)
return;
if (seed == 1L)
conv_randomize();
strncpy(key, pw, sizeof(key));
key[sizeof(key)-1] = 0;
/* compute random salt */
challenge = generate_rand_pw(SALT_LEN);
/* ask for proper response to this challenge: */
sprintf(buffer, "\r%s> [%s]\r", prompt, challenge);
write_ax25(buffer, strlen(buffer), 1);
/* compute md5 challenge */
calc_md5_pw(challenge, key, cipher);
/* store expected answer */
char_to_hex(cipher, pass_want, 16);
}
/*--------------------------------------------------------------------------*/
void calc_md5_pw (const char *MD5prompt, const char *MD5pw, char *MD5result)
{
MD5_CTX context;
short i, n, len;
char buffer[1024];
strncpy(buffer, MD5prompt, 10);
buffer[10] = 0;
strcat(buffer, MD5pw);
MD5Init(&context);
len = strlen(buffer);
for (i= 0; i < len; i += 16) {
n = (len - i) > 16 ? 16 : (len - i);
MD5Update(&context, buffer+i, n);
}
MD5Final(&context);
MD5result[0] = '\0';
for (i = 0; i < 16; i++) {
MD5result[i] = context.digest[i];
}
}
/*--------------------------------------------------------------------------*/
void write_example_passwd(char *pwfile, char pwlocation, struct passwd *pw) {
FILE * f;
int i;
if ((i = open(pwfile, O_CREAT|O_WRONLY|O_TRUNC, (S_IRUSR | S_IWUSR | (pwlocation == SYSTEMPW ? (S_IRGRP /* | S_IWGRP */ ) : 0)))) == -1)
return;
fchown(i, (pwlocation == SYSTEMPW ? 0 : pw->pw_uid), (pwlocation == SYSTEMPW ? 0 : pw->pw_gid));
close(i);
if ( ! (f = fopen(pwfile, "w")) )
return;
fprintf(f, "# %s Password file for axspawn\n", (pwlocation == SYSTEMPW ? "System" : "User"));
if (pwlocation == SYSTEMPW) {
fprintf(f, "# disable user self-administered passwords in $HOME/.%s\n", PWFILE);
fprintf(f, "# with the line \"systempasswordonly\"\n");
fprintf(f, "# systempasswordonly\n");
}
fprintf(f, "# Examples (sys and md5 passwords may differ):\n");
fprintf(f, "# md5 standard (secure) - length: >= %d and <= %d characters\n", MINPWLEN_MD5, PASSSIZE);
fprintf(f, "# %smd5:%s\n", (pwlocation == SYSTEMPW ? "username:" : ""), generate_rand_pw(MINPWLEN_MD5));
fprintf(f, "# sys/baycom standard (not very secure) - length: >= %d and <= %d characters\n", MINPWLEN_SYS, PASSSIZE);
fprintf(f, "# %ssys:%s\n", (pwlocation == SYSTEMPW ? "username:" : ""), generate_rand_pw(MINPWLEN_SYS));
fprintf(f, "# unix standard (plaintext): no password is read here. Your password is looked\n");
fprintf(f, "# up during login in the system password table /etc/passwd or /etc/shadow\n");
fprintf(f, "# unix\n");
fclose(f);
}
/*--------------------------------------------------------------------------*/
char *read_pwd (struct passwd *pw, int *pwtype)
{
FILE * f = 0;
struct stat statbuf;
char pwfile[PATH_MAX + 1];
int len;
char pwlocation;
char buf[2048];
int only_systempw = 0;
char *pass = 0;
char *p_buf;
char *p;
for (pwlocation = 0; pwlocation < 2; pwlocation++) {
if (pwlocation == SYSTEMPW) {
sprintf(pwfile, "/%s/%s", AX25_SYSCONFDIR, PWFILE);
if (stat(pwfile, &statbuf)) {
write_example_passwd(pwfile, pwlocation, pw);
continue;
}
if (!S_ISREG(statbuf.st_mode) || (statbuf.st_mode & (S_IROTH | S_IWOTH)))
continue;
if ( !(f = fopen(pwfile, "r")) )
continue;
} else {
if (only_systempw)
goto end;
snprintf(pwfile, sizeof(pwfile), "%s/.%s", pw->pw_dir, PWFILE);
pwfile[sizeof(pwfile)-1] = 0;
if (stat(pwfile, &statbuf)) {
sprintf(buf, "Notice: No .%s file found in your homedirectory (for more secure\r", PWFILE);
write_ax25(buf, strlen(buf), 1);
sprintf(buf, " password authentication than plaintext). Generating example file,\r");
write_ax25(buf, strlen(buf), 1);
sprintf(buf, " with unique passwords (which may be changed).\r");
write_ax25(buf, strlen(buf), 1);
sprintf(buf, " Please edit ~/.%s, and enable your prefered authentication type;\r", PWFILE);
write_ax25(buf, strlen(buf), 1);
sprintf(buf, " MD5 is recommended.\r");
write_ax25(buf, strlen(buf), 1);
write_example_passwd(pwfile, pwlocation, pw);
goto end;
}
if (!S_ISREG(statbuf.st_mode)) {
sprintf(buf, "Error: password file .%s should be a regular file. Skiping..\r", PWFILE);
write_ax25(buf, strlen(buf), 1);
goto end;
}
if (statbuf.st_uid != 0 && statbuf.st_uid != pw->pw_uid) {
sprintf(buf, "Error: your password file .%s is not owned by you. Skiping..\r", PWFILE);
write_ax25(buf, strlen(buf), 1);
goto end;
}
if ((statbuf.st_mode & (S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH))) {
sprintf(buf, "WARNING: your password file .%s has wrong permissions.\r", PWFILE);
write_ax25(buf, strlen(buf), 1);
sprintf(buf, " Please change it with\r");
write_ax25(buf, strlen(buf), 1);
sprintf(buf, " chmod 600 .%s\r", PWFILE);
write_ax25(buf, strlen(buf), 1);
sprintf(buf, " and don't forget to change your password stored in .%s\r", PWFILE);
write_ax25(buf, strlen(buf), 1);
sprintf(buf, " because it may be compromised.\r");
write_ax25(buf, strlen(buf), 1);
/* go on.. if user takes no action, he always gets this message */
}
if ( !(f = fopen(pwfile, "r")) )
goto end;
}
for (;;) {
if (!fgets(buf, sizeof(buf), f)) {
fclose(f);
if (pwlocation == SYSTEMPW)
break;
/* perhaps this is too irritating for the user
when the message occurs always. Thus only
write the notice, if cleartext fallback
is disabled by administrative configuration.
*/
if (!((*pwtype) & PW_CLEARTEXT)) {
sprintf(buf, "Failed to find a suitable password in %s\r", pwfile);
write_ax25(buf, strlen(buf), 1);
}
goto end;
}
if ((p = strchr(buf, '\n')))
*p = 0;
if (!*buf || isspace(*buf & 0xff))
continue;
if (*buf == '#')
continue;
if (pwlocation == SYSTEMPW) {
if (!Strcasecmp(buf, "systempasswordonly")) {
only_systempw = 1;
continue;
}
if (!(p = strchr(buf, ':')))
continue;
*p++ = 0;
if (strcmp(pw->pw_name, buf))
continue;
p_buf = p;
} else {
p_buf = buf;
}
if (!Strcasecmp(p_buf, "unix")) {
pass = p_buf;
} else {
if (!(pass = strchr(p_buf, ':')))
continue;
*pass++ = 0;
}
while (*pass && isspace(*pass & 0xff))
pass++;
for (p = pass; *p && !isspace(*p & 0xff); p++) ;
*p = 0;
if ( (*pwtype & PW_MD5) && !Strcasecmp(p_buf, "md5") ) {
fclose(f);
*pwtype = PW_MD5;
goto found;
} else if ( (*pwtype & PW_SYS) && (!Strcasecmp(p_buf, "sys") || !strcmp(p_buf, "baycom")) ) {
fclose(f);
*pwtype = PW_SYS;
goto found;
} else if ( (*pwtype & PW_UNIX) && (!Strcasecmp(p_buf, "unix") ) ) {
fclose(f);
*pwtype = PW_UNIX;
return 0;
}
}
}
found:
if (!pass || !*pwtype)
goto end;
len = strlen(pass);
if ((*pwtype == PW_SYS && len < MINPWLEN_SYS) || (*pwtype == PW_MD5 && len < MINPWLEN_MD5)) {
sprintf(buf, "Password in password file too short\r");
write_ax25(buf, strlen(buf), 1);
goto end;
}
if (strlen(pass) > PASSSIZE)
pass[PASSSIZE] = 0;
return strdup(pass);
end:
*pwtype = (((*pwtype) & PW_CLEARTEXT) ? PW_CLEARTEXT : 0);
/* ^ may allow cleartext? - then cleartext, else deny */
return 0;
}
ax25-tools-0.0.10-rc4/ax25/mheardd.c 0000664 0000000 0000000 00000024270 12155142241 013415 0000000 0000000 #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef __GLIBC__
#include
#else
#include
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "../pathnames.h"
#define KISS_MASK 0x0F
#define KISS_DATA 0x00
#define PID_SEGMENT 0x08
#define PID_ARP 0xCD
#define PID_NETROM 0xCF
#define PID_IP 0xCC
#define PID_ROSE 0x01
#define PID_TEXNET 0xC3
#define PID_FLEXNET 0xCE
#define PID_TEXT 0xF0
#define PID_PSATFT 0xBB
#define PID_PSATPB 0xBD
#define I 0x00
#define S 0x01
#define RR 0x01
#define RNR 0x05
#define REJ 0x09
#define U 0x03
#define SABM 0x2F
#define SABME 0x6F
#define DISC 0x43
#define DM 0x0F
#define UA 0x63
#define FRMR 0x87
#define UI 0x03
#define PF 0x10
#define EPF 0x01
#define MMASK 7
#define HDLCAEB 0x01
#define SSID 0x1E
#define SSSID_SPARE 0x40
#define ESSID_SPARE 0x20
#define ALEN 6
#define AXLEN 7
struct mheard_list_struct {
int in_use;
struct mheard_struct entry;
long position;
};
static struct mheard_list_struct *mheard_list;
#define MHEARD_LIST_SIZE 1000
static int mheard_list_size = MHEARD_LIST_SIZE/10;
static int logging = FALSE;
static int ftype(unsigned char *, int *, int);
static struct mheard_list_struct *findentry(ax25_address *, char *);
static void terminate(int sig)
{
if (logging) {
syslog(LOG_INFO, "terminating on SIGTERM\n");
closelog();
}
exit(0);
}
int main(int argc, char **argv)
{
struct mheard_list_struct *mheard;
unsigned char buffer[1500], *data;
int size, s;
char *port = NULL;
struct sockaddr sa;
socklen_t asize;
long position;
int ctlen, type, end, extseq, flush = FALSE;
FILE *fp;
char *p;
char ports[1024];
int ports_excl = 0;
*ports = 0;
while ((s = getopt(argc, argv, "fln:p:v")) != -1) {
switch (s) {
case 'l':
logging = TRUE;
break;
case 'f':
flush = TRUE;
break;
case 'n':
mheard_list_size = atoi(optarg);
if (mheard_list_size < 10 || mheard_list_size > MHEARD_LIST_SIZE) {
fprintf(stderr, "mheardd: list size must be between 10 and %d\n", MHEARD_LIST_SIZE);
return 1;
}
break;
case 'p':
if (strlen(optarg) > sizeof(ports)-4) {
fprintf(stderr, "mheardd: too many ports specified.");
return 1;
}
if (*optarg == '!') {
ports_excl = 1;
optarg++;
}
sprintf(ports, "|%s|", optarg);
for (p = ports; *p; p++) {
if (*p == ' ' || *p == ',')
*p = '|';
}
break;
case 'v':
printf("mheardd: %s\n", VERSION);
return 0;
case ':':
fprintf(stderr, "mheardd: option -n needs an argument\n");
return 1;
case '?':
fprintf(stderr, "Usage: mheardd [-f] [-l] [-n number] [-p [!]port1[,port2,..]] [-v]\n");
return 1;
}
}
signal(SIGTERM, terminate);
if (ax25_config_load_ports() == 0) {
fprintf(stderr, "mheardd: no AX.25 port data configured\n");
return 1;
}
if ((mheard_list = calloc(mheard_list_size, sizeof(struct mheard_list_struct))) == NULL) {
fprintf(stderr, "mheardd: cannot allocate memory\n");
return 1;
}
if (flush)
unlink(DATA_MHEARD_FILE);
/* Load an existing heard list */
if ((fp = fopen(DATA_MHEARD_FILE, "r")) != NULL) {
s = 0;
position = ftell(fp);
while (fread(buffer, sizeof(struct mheard_struct), 1, fp) == 1 && s < mheard_list_size) {
memcpy(&mheard_list[s].entry, buffer, sizeof(struct mheard_struct));
mheard_list[s].in_use = TRUE;
mheard_list[s].position = position;
position = ftell(fp);
s++;
}
fclose(fp);
} else {
if ((fp = fopen(DATA_MHEARD_FILE, "w")) != NULL)
fclose(fp);
}
if ((s = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_AX25))) == -1) {
perror("mheardd: socket");
return 1;
}
if (!daemon_start(FALSE)) {
fprintf(stderr, "mheardd: cannot become a daemon\n");
return 1;
}
/* Use syslog for error messages rather than perror/fprintf */
if (logging) {
openlog("mheardd", LOG_PID, LOG_DAEMON);
syslog(LOG_INFO, "starting");
}
for (;;) {
asize = sizeof(sa);
if ((size = recvfrom(s, buffer, sizeof(buffer), 0, &sa, &asize)) == -1) {
if (logging) {
syslog(LOG_ERR, "recv: %m");
closelog();
}
return 1;
}
if ((port = ax25_config_get_name(sa.sa_data)) == NULL) {
if (logging)
syslog(LOG_WARNING, "unknown port '%s'\n", sa.sa_data);
continue;
}
if (*ports) {
char testport[sizeof(sa.sa_data)+2];
sprintf(testport, "|%s|", sa.sa_data);
if (ports_excl) {
if (strstr(ports, testport)) {
continue;
}
} else {
if (!strstr(ports, testport)) {
continue;
}
}
}
data = buffer;
if ((*data & KISS_MASK) != KISS_DATA)
continue;
data++;
size--;
if (size < (AXLEN + AXLEN + 1)) {
if (logging)
syslog(LOG_WARNING, "packet too short\n");
continue;
}
mheard = findentry((ax25_address *)(data + AXLEN), port);
if (!ax25_validate(data + 0) || !ax25_validate(data + AXLEN)) {
if (logging)
syslog(LOG_WARNING, "invalid callsign on port %s\n", port);
continue;
}
memcpy(&mheard->entry.from_call, data + AXLEN, sizeof(ax25_address));
memcpy(&mheard->entry.to_call, data + 0, sizeof(ax25_address));
strcpy(mheard->entry.portname, port);
mheard->entry.ndigis = 0;
extseq = ((data[AXLEN + ALEN] & SSSID_SPARE) != SSSID_SPARE);
end = (data[AXLEN + ALEN] & HDLCAEB);
data += (AXLEN + AXLEN);
size -= (AXLEN + AXLEN);
while (!end) {
memcpy(&mheard->entry.digis[mheard->entry.ndigis], data, sizeof(ax25_address));
mheard->entry.ndigis++;
end = (data[ALEN] & HDLCAEB);
data += AXLEN;
size -= AXLEN;
}
if (size == 0) {
if (logging)
syslog(LOG_WARNING, "packet too short\n");
continue;
}
ctlen = ftype(data, &type, extseq);
mheard->entry.count++;
switch (type) {
case SABM:
mheard->entry.type = MHEARD_TYPE_SABM;
mheard->entry.uframes++;
break;
case SABME:
mheard->entry.type = MHEARD_TYPE_SABME;
mheard->entry.uframes++;
break;
case DISC:
mheard->entry.type = MHEARD_TYPE_DISC;
mheard->entry.uframes++;
break;
case UA:
mheard->entry.type = MHEARD_TYPE_UA;
mheard->entry.uframes++;
break;
case DM:
mheard->entry.type = MHEARD_TYPE_DM;
mheard->entry.uframes++;
break;
case RR:
mheard->entry.type = MHEARD_TYPE_RR;
mheard->entry.sframes++;
break;
case RNR:
mheard->entry.type = MHEARD_TYPE_RNR;
mheard->entry.sframes++;
break;
case REJ:
mheard->entry.type = MHEARD_TYPE_REJ;
mheard->entry.sframes++;
break;
case FRMR:
mheard->entry.type = MHEARD_TYPE_FRMR;
mheard->entry.uframes++;
break;
case I:
mheard->entry.type = MHEARD_TYPE_I;
mheard->entry.iframes++;
break;
case UI:
mheard->entry.type = MHEARD_TYPE_UI;
mheard->entry.uframes++;
break;
default:
if (logging)
syslog(LOG_WARNING, "unknown packet type %02X\n", *data);
mheard->entry.type = MHEARD_TYPE_UNKNOWN;
break;
}
data += ctlen;
size -= ctlen;
if (type == I || type == UI) {
switch (*data) {
case PID_TEXT:
mheard->entry.mode |= MHEARD_MODE_TEXT;
break;
case PID_SEGMENT:
mheard->entry.mode |= MHEARD_MODE_SEGMENT;
break;
case PID_ARP:
mheard->entry.mode |= MHEARD_MODE_ARP;
break;
case PID_NETROM:
mheard->entry.mode |= MHEARD_MODE_NETROM;
break;
case PID_IP:
mheard->entry.mode |= (type == I) ? MHEARD_MODE_IP_VC : MHEARD_MODE_IP_DG;
break;
case PID_ROSE:
mheard->entry.mode |= MHEARD_MODE_ROSE;
break;
case PID_TEXNET:
mheard->entry.mode |= MHEARD_MODE_TEXNET;
break;
case PID_FLEXNET:
mheard->entry.mode |= MHEARD_MODE_FLEXNET;
break;
case PID_PSATPB:
mheard->entry.mode |= MHEARD_MODE_PSATPB;
break;
case PID_PSATFT:
mheard->entry.mode |= MHEARD_MODE_PSATFT;
break;
default:
if (logging)
syslog(LOG_WARNING, "unknown PID %02X\n", *data);
mheard->entry.mode |= MHEARD_MODE_UNKNOWN;
break;
}
}
if (mheard->entry.first_heard == 0)
time(&mheard->entry.first_heard);
time(&mheard->entry.last_heard);
if ((fp = fopen(DATA_MHEARD_FILE, "r+")) == NULL) {
if (logging)
syslog(LOG_ERR, "cannot open mheard data file\n");
continue;
}
if (mheard->position == 0xFFFFFF) {
fseek(fp, 0L, SEEK_END);
mheard->position = ftell(fp);
}
fseek(fp, mheard->position, SEEK_SET);
fwrite(&mheard->entry, sizeof(struct mheard_struct), 1, fp);
fclose(fp);
}
}
static int ftype(unsigned char *data, int *type, int extseq)
{
if (extseq) {
if ((*data & 0x01) == 0) { /* An I frame is an I-frame ... */
*type = I;
return 2;
}
if (*data & 0x02) {
*type = *data & ~PF;
return 1;
} else {
*type = *data;
return 2;
}
} else {
if ((*data & 0x01) == 0) { /* An I frame is an I-frame ... */
*type = I;
return 1;
}
if (*data & 0x02) { /* U-frames use all except P/F bit for type */
*type = *data & ~PF;
return 1;
} else { /* S-frames use low order 4 bits for type */
*type = *data & 0x0F;
return 1;
}
}
}
static struct mheard_list_struct *findentry(ax25_address *callsign, char *port)
{
struct mheard_list_struct *oldest = NULL;
int i;
for (i = 0; i < mheard_list_size; i++)
if (mheard_list[i].in_use &&
ax25_cmp(&mheard_list[i].entry.from_call, callsign) == 0 &&
strcmp(mheard_list[i].entry.portname, port) == 0)
return mheard_list + i;
for (i = 0; i < mheard_list_size; i++) {
if (!mheard_list[i].in_use) {
mheard_list[i].in_use = TRUE;
mheard_list[i].position = 0xFFFFFF;
return mheard_list + i;
}
}
for (i = 0; i < mheard_list_size; i++) {
if (mheard_list[i].in_use) {
if (oldest == NULL) {
oldest = mheard_list + i;
} else {
if (mheard_list[i].entry.last_heard < oldest->entry.last_heard)
oldest = mheard_list + i;
}
}
}
memset(&oldest->entry, 0x00, sizeof(struct mheard_struct));
return oldest;
}
ax25-tools-0.0.10-rc4/ax25/mheard.dat 0000664 0000000 0000000 00000000000 12155142241 013560 0000000 0000000 ax25-tools-0.0.10-rc4/ax25/rxecho.c 0000664 0000000 0000000 00000030004 12155142241 013271 0000000 0000000 /*
* rxecho.c - Copies AX.25 packets from an interface to another interface.
* Reads CONFIGFILE (see below) and uses that information to
* decide what packets should be copied and where.
*
* CONFIGFILE format is:
*
* # this is a comment
* 144 kiss0 oh2bns-1,oh2bns-2
* kiss0 144 *
*
* This means that packets received on port 144 are copied to port
* kiss0 if they are destined to oh2bns-1 or oh2bns-2. Packets
* from port kiss0 are all copied to port 144.
*
* There may be empty lines and an arbirary amount of white
* space around the tokens but the callsign field must not
* have any spaces in it. There can be up to MAXCALLS call-
* signs in the callsign field (see below).
*
* Copyright (C) 1996 by Tomi Manninen, OH2BNS, .
*
* *** Modified 9/9/96 by Heikki Hannikainen, OH7LZB, :
*
* One port can actually be echoed to multiple ports (with a
* different recipient callsign, of course). The old behaviour was
* to give up on the first matching port, even if the recipient
* callsign didn't match (and the frame wasn't echoed anywhere).
*
* *** 20021206 dl9sau:
* - fixed a bug preventing echo to multible ports; it may also
* lead to retransmission on the interface where it came from
* - fixed problem that frames via sendto(...,alen) had a wrong
* protocol (because alen became larger than the size of
* struct sockaddr).
* - sockaddr_pkt is the right struct for recvfrom/sendto on
* type SOCK_PACKET family AF_INET sockets.
* - added support for new PF_PACKET family with sockaddr_ll
*
* ***
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
/*
* dl9sau:
* uncomment this if you have problems with sockaddr_pkt.
* sockaddr_pkt is the right way for type SOCK_PACKET on family AF_INET sockets.
* especially because the "sockaddr" on recvfrom is truncated (internaly
* it's sockaddr_pkt) -- and because we use this sockaddr for retransmitting,
* it's really better to use the sockaddr_spkt.
* default is to use SOCKADDR_SPKT
*/
#define USE_SOCKADDR_SPKT 1
/* dl9sau: since linux 2.2.x, SOCK_PACKET is obsolete */
#define USE_SOCKADDR_SLL 1
#ifdef USE_SOCKADDR_SLL
#undef USE_SOCKADDR_SPKT
#endif
#include /* for the glibc version number */
#if __GLIBC__ >= 2
#ifdef USE_SOCKADDR_SPKT
#include
#endif
#ifdef USE_SOCKADDR_SLL
#include
#include
#include
#endif
#include
#else
#if defined(USE_SOCKADDR_SPKT) || defined(USE_SOCKADDR_SLL)
#include
#include
#endif
#include
#endif
#include
#include
#include
#include
#include
#include
#include "../pathnames.h"
#define MAXCALLS 8
struct config {
char from[14]; /* sockaddr.sa_data is 14 bytes */
int from_idx;
char to[14];
int to_idx;
ax25_address calls[MAXCALLS];/* list of calls to echo */
int ncalls; /* number of calls to echo */
struct config *next;
};
static int logging = FALSE;
static void terminate(int sig)
{
if (logging) {
syslog(LOG_INFO, "terminating on SIGTERM\n");
closelog();
}
exit(0);
}
/*
* Read string "call1,call2,call3,..." into p.
*/
static int read_calls(struct config *p, char *s)
{
char *cp, *cp1;
if (p == NULL || s == NULL)
return -1;
p->ncalls = 0;
if (strcmp(s, "*") == 0)
return 0;
cp = s;
while ((cp1 = strchr(cp, ',')) != NULL && p->ncalls < MAXCALLS) {
*cp1 = 0;
if (ax25_aton_entry(cp, p->calls[p->ncalls].ax25_call) == -1)
return -1;
p->ncalls++;
cp = ++cp1;
}
if (p->ncalls < MAXCALLS) {
if (ax25_aton_entry(cp, p->calls[p->ncalls].ax25_call) == -1)
return -1;
p->ncalls++;
}
return p->ncalls;
}
static struct config *readconfig(void)
{
FILE *fp;
char line[80], *cp, *dev;
struct config *p, *list = NULL;
if ((fp = fopen(CONF_RXECHO_FILE, "r")) == NULL) {
fprintf(stderr, "rxecho: cannot open config file\n");
return NULL;
}
while (fgets(line, 80, fp) != NULL) {
cp = strtok(line, " \t\r\n");
if (cp == NULL || cp[0] == '#')
continue;
if ((p = calloc(1, sizeof(struct config))) == NULL) {
perror("rxecho: malloc");
return NULL;
}
if ((dev = ax25_config_get_dev(cp)) == NULL) {
fprintf(stderr, "rxecho: invalid port name - %s\n", cp);
return NULL;
}
strcpy(p->from, dev);
p->from_idx = -1;
if ((cp = strtok(NULL, " \t\r\n")) == NULL) {
fprintf(stderr, "rxecho: config file error.\n");
return NULL;
}
if ((dev = ax25_config_get_dev(cp)) == NULL) {
fprintf(stderr, "rxecho: invalid port name - %s\n", cp);
return NULL;
}
strcpy(p->to, dev);
p->to_idx = -1;
if (read_calls(p, strtok(NULL, " \t\r\n")) == -1) {
fprintf(stderr, "rxecho: config file error.\n");
return NULL;
}
p->next = list;
list = p;
}
fclose(fp);
if (list == NULL)
fprintf(stderr, "rxecho: Empty config file!\n");
return list;
}
/*
* Slightly modified from linux/include/net/ax25.h and
* linux/net/ax25/ax25_subr.c:
*/
#if 0
#define C_COMMAND 1
#define C_RESPONSE 2
#define LAPB_C 0x80
#endif
#define LAPB_E 0x01
#define AX25_ADDR_LEN 7
#define AX25_REPEATED 0x80
typedef struct {
ax25_address calls[AX25_MAX_DIGIS];
unsigned char repeated[AX25_MAX_DIGIS];
char ndigi;
char lastrepeat;
} ax25_digi;
/*
* Given an AX.25 address pull of to, from, digi list, and the start of data.
*/
static unsigned char *ax25_parse_addr(unsigned char *buf, int len, ax25_address *src, ax25_address *dest, ax25_digi *digi)
{
int d = 0;
if (len < 14) return NULL;
#if 0
if (flags != NULL) {
*flags = 0;
if (buf[6] & LAPB_C) {
*flags = C_COMMAND;
}
if (buf[13] & LAPB_C) {
*flags = C_RESPONSE;
}
}
if (dama != NULL)
*dama = ~buf[13] & DAMA_FLAG;
#endif
/* Copy to, from */
if (dest != NULL)
memcpy(dest, buf + 0, AX25_ADDR_LEN);
if (src != NULL)
memcpy(src, buf + 7, AX25_ADDR_LEN);
buf += 2 * AX25_ADDR_LEN;
len -= 2 * AX25_ADDR_LEN;
digi->lastrepeat = -1;
digi->ndigi = 0;
while (!(buf[-1] & LAPB_E)) {
if (d >= AX25_MAX_DIGIS) return NULL; /* Max of 6 digis */
if (len < 7) return NULL; /* Short packet */
if (digi != NULL) {
memcpy(&digi->calls[d], buf, AX25_ADDR_LEN);
digi->ndigi = d + 1;
if (buf[6] & AX25_REPEATED) {
digi->repeated[d] = 1;
digi->lastrepeat = d;
} else {
digi->repeated[d] = 0;
}
}
buf += AX25_ADDR_LEN;
len -= AX25_ADDR_LEN;
d++;
}
return buf;
}
/*
* Check if frame should be echoed. Return 0 if it should and -1 if not.
*/
static int check_calls(struct config *cfg, unsigned char *buf, int len)
{
ax25_address dest;
ax25_digi digi;
ax25_address *axp;
int i;
if ((buf[0] & 0x0F) != 0)
return -1; /* don't echo non-data */
if (cfg->ncalls == 0)
return 0; /* copy everything */
if (ax25_parse_addr(++buf, --len, NULL, &dest, &digi) == NULL)
return -1; /* invalid ax.25 header */
/*
* If there are no digis or all digis are already repeated
* use destination address. Else use first non-repeated digi.
*/
if (digi.ndigi == 0 || digi.ndigi == digi.lastrepeat + 1)
axp = &dest;
else
axp = &digi.calls[digi.lastrepeat + 1];
for (i = 0; i < cfg->ncalls; i++)
if (ax25_cmp(&cfg->calls[i], axp) == 0)
return 0;
return -1;
}
int main(int argc, char **argv)
{
#ifdef USE_SOCKADDR_SLL
struct sockaddr_ll sll;
struct sockaddr *psa = (struct sockaddr *)&sll;
const socklen_t sa_len = sizeof(struct sockaddr_ll);
int from_idx;
#else
#ifdef USE_SOCKADDR_SPKT
struct sockaddr_pkt spkt;
struct sockaddr *psa = (struct sockaddr *)&spkt;
const int sa_len = sizeof(struct sockaddr_pkt);
#else
struct sockaddr sa_generic;
struct sockaddr *psa = (struct sockaddr *)&sa_generic;
const int sa_len = sizeof(struct sockaddr);
#endif
char from_dev_name[sizeof(psa->sa_data)];
#endif
int s, size;
socklen_t alen;
unsigned char buf[1500];
struct config *p, *list;
while ((s = getopt(argc, argv, "lv")) != -1) {
switch (s) {
case 'l':
logging = TRUE;
break;
case 'v':
printf("rxecho: %s\n", VERSION);
return 0;
default:
fprintf(stderr, "usage: rxecho [-l] [-v]\n");
return 1;
}
}
signal(SIGTERM, terminate);
if (ax25_config_load_ports() == 0) {
fprintf(stderr, "rxecho: no AX.25 port data configured\n");
return 1;
}
if ((list = readconfig()) == NULL)
return 1;
#ifdef USE_SOCKADDR_SLL
if ((s = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_AX25))) == -1) {
#else
if ((s = socket(AF_INET, SOCK_PACKET, htons(ETH_P_AX25))) == -1) {
#endif
perror("rxecho: socket:");
return 1;
}
#ifdef USE_SOCKADDR_SLL
for (p = list; p != NULL; p = p->next) {
int i;
for (i = 0; i < 2; i++) {
struct config *q;
struct ifreq ifr;
char *p_name = (i ? p->to : p->from);
int *p_idx = (i ? &p->to_idx : &p->from_idx);
/* already set? */
if (*p_idx >= 0)
continue;
strncpy(ifr.ifr_name, p_name, sizeof(ifr.ifr_name)-1);
ifr.ifr_name[sizeof(ifr.ifr_name)-1] = 0;
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
perror("SIOCGIFINDEX");
return 1;
}
*p_idx = ifr.ifr_ifindex;
for (q = p->next; q != NULL; q = q->next) {
if (q->from_idx < 0 && !strcmp(q->from, p_name))
q->from_idx = *p_idx;
if (q->to_idx < 0 && !strcmp(q->to, p_name))
q->to_idx = *p_idx;
}
}
}
#endif
if (!daemon_start(FALSE)) {
fprintf(stderr, "rxecho: cannot become a daemon\n");
close(s);
return 1;
}
if (logging) {
openlog("rxecho", LOG_PID, LOG_DAEMON);
syslog(LOG_INFO, "starting");
}
for (;;) {
alen = sa_len;
if ((size = recvfrom(s, buf, 1500, 0, psa, &alen)) == -1) {
if (logging) {
syslog(LOG_ERR, "recvfrom: %m");
closelog();
}
return 1;
}
#ifdef USE_SOCKADDR_SLL
from_idx = sll.sll_ifindex;
#else
/*
* dl9sau: save the names of the iface the frame came from;
* we'll overwrite psa->sa_data it for sendto() and need the
* name again when multiplexing to more than one iface
*/
strncpy(from_dev_name, psa->sa_data, sizeof(from_dev_name)-1);
from_dev_name[sizeof(from_dev_name)-1] = 0;
#endif
for (p = list; p != NULL; p = p->next)
#ifdef USE_SOCKADDR_SLL
if (p->from_idx == from_idx && (check_calls(p, buf, size) == 0)) {
sll.sll_ifindex = p->to_idx;
#else
if ((strcmp(p->from, from_dev_name) == 0) && (check_calls(p, buf, size) == 0)) {
strcpy(psa->sa_data, p->to);
#endif
/*
* cave: alen (set by recvfrom()) may > salen
* which means it may point beyound of the
* end of the struct. thats why we use the
* correct len (sa_len). this fixes a bug
* where skpt->protocol on sockaddr structs
* pointed behind the struct, leading to
* funny protocol IDs.
* btw, the linux kernel internaly always
* maps to sockaddr to sockaddr_pkt
* on sockets of type SOCK_PACKET on family
* AF_INET. sockaddr_pkt is len 18, sockaddr
* is 16.
*/
if (sendto(s, buf, size, 0, psa, sa_len) == -1) {
if (logging) {
syslog(LOG_ERR, "sendto: %m");
closelog();
}
}
}
}
}
ax25-tools-0.0.10-rc4/ax25/ax25.4 0000664 0000000 0000000 00000006452 12155142241 012513 0000000 0000000 .TH AX25 4 "15 October 1996" Linux "Linux Programmer's Manual"
.SH NAME
AF_AX25 \- AX.25 amateur packet radio protocol family
.SH DESCRIPTION
.LP
.B AX.25
is a protocol used extensively by radio amateurs. The Linux AX.25 protocol
family permits access to these protocols via the standard networking
.B socket
metaphor.
.LP
The AX.25 protocol layer supports both connected mode and datagram (UI)
frame modes. IP traffic may be stacked on top of AX.25 frames for IP
transmission over the AX.25 medium.
.LP
The primary mode of operation is connected mode which is the mode used for a
socket of type SOCK_SEQPACKET (stream sockets are not available in AX.25).
This requires that the user ensures output data is suitably packetised, and
that input data is read a packet at a time into a buffer of suitable size.
The Linux AX.25 protocol layer can operate in standard AX.25 mode with three
bit sequence numbers or in PE1CHL extended AX.25 mode which uses seven bit
sequence numbers. The protocol passed to the socket is used for all outgoing
frames. Passing 0 causes the normal AX.25 Text PID to be used.
.LP
SOCK_DGRAM gives access to AX.25 UI frames. For access to special frames (of
any form) SOCK_RAW can be used. There is no SOCK_PACKET support under AX.25.
Instead an AF_INET socket of type SOCK_PACKET should be used.
.LP
AX.25 addresses consist of 6 ascii characters and a number called the SSID.
These are encoded into a sockaddr_ax25 structure which is provided to the
relevant system calls. When digipeaters are included a callsign path can be
much more complex. When this is the case a struct full_sockaddr_ax25 should
be passed to the system calls.
.LP
AX.25 has some unusual properties. Notably in a multi-user system an AX.25
address is often associated with a user, and some users may not have such an
association. a set of ioctl calls are provided to manage an association
table, and in addition the superuser may use an arbitary callsign by binding
to the callsign desired and specifying the port to use as a first digipeated
hop.
.LP
AX.25 supports the following socket options for SOL_AX25. AX25_T1 is the T1
timer in 1/10ths of a second, AX25_T2 is the T2 timer in 1/10ths of a
second, AX25_T3 is the T3 timer. The window is settable with AX25_WINDOW.
AX25_N2, the retry counter is also configurable. There is no 'infinite
retry' option supported however. The method of backoff for retries is
configurable via the socket option AX25_BACKOFF, a value of true indicates
the use of exponential backoff and false simple linear backoff. The mode of
a connection made be altered to be either standard AX.25 or extended AX.25
via AX25_EXTSEQ. It is possible to have the complete AX.25 header returned
to the application by setting AX25_HDRINCL to true, programs must be aware
of the internal structure of AX.25 frames to use this option. Note that if
AX.25 fragmentation is encountered, only the control information of the
first frame is returned along with the defragmented data.
.SH "SEE ALSO"
.BR call (1),
.BR socket (2),
.BR setsockopt (2),
.BR getsockopt (2),
.BR axctl (8),
.BR axparms (5),
.BR axassociate (8),
.BR axparms (8),
.BR kissattach (8).
.LP
.SH BUGS
.LP
Too numerous to list in full currently.
.TP 3
\(bu
Minor protocol violations exist.
.SH AUTHOR
.nf
Alan Cox GW4PTS
.br
Jonathan Naylor G4KLX
.fi
ax25-tools-0.0.10-rc4/ax25/rxecho.conf.5 0000664 0000000 0000000 00000001405 12155142241 014142 0000000 0000000 .TH RXECHO.CONF 5 "2 August 1996" Linux "Linux Programmer's Manual"
.SH NAME
rxecho.conf \- control rxecho AX.25 packet routing.
.SH DESCRIPTION
.LP
.B Rxecho.conf
controls the copying of packets between AX.25 ports performed by the program
rxecho. The format of the configuration file is:
portin portout * | callsign...
Each entry in the file represents a one-way packet flow between ports. Any
packet received on portin is copied to portout, if its destination callsign
or the next callsign to digipeat the frame is in the list of callsigns. If
the callsign list is replaced by a \(lq*\(rq then all packets are copied.
The configuration file may contain comments that begin with a #.
.SH FILES
.LP
/etc/ax25/rxecho.conf
.SH "SEE ALSO"
.BR axports (8),
.BR rxecho (8).
ax25-tools-0.0.10-rc4/ax25/axspawn.conf 0000664 0000000 0000000 00000002552 12155142241 014174 0000000 0000000 # /etc/ax25/axspawn.conf
#
# allow automatic creation of user accounts
create yes
# allow empty password field (so user may login via telnet, too) [default no]
create_empty_password no
#create_empty_password yes
# create with system utility useradd(8)? [default no]
#create_with_useradd no
create_with_useradd yes
#
# pwcheck method: password or call or group [default: password]
# "password" means, that passwords with '+' force a login without
# prompting for a password (old behaviour; backward compatibility).
# "call" means, that ham calls via ax25/netrom/rose/.. should be able
# to login without password, even if it's set (for e.g. to secure
# from abuse of inet connections)
# "group" means, that if the gid of the user matches the configured
# default user_gid, then the login is granted without password.
#pwcheck call
#pwcheck group
#pwcheck password
#
# guest user if above is 'no' or everything else fails. Disable with "no"
#guest ax25
guest guest
#
# group id or name for autoaccount
#group ax25
group hams
#
# first user id to use
first_uid 400
#
# maximum user id
max_uid 2000
#
# where to add the home directory for the new user
#home /home/ax25
home /home/hams
#
# secure homedirectories (g-rwx)
#secure_home yes
#
# user shell
shell /bin/bash
#
# bind user id to callsign for outgoing connects.
associate no
ax25-tools-0.0.10-rc4/ax25/bpqparms.c 0000664 0000000 0000000 00000006642 12155142241 013641 0000000 0000000 /*
bpqparms.c
Copyright 1996, by Joerg Reuter jreuter@poboxes.com
This program is free software; you can redistribute it and/or modify
it under the terms of the (modified) GNU General Public License
delivered with the LinuX kernel source.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should find a copy of the GNU General Public License in
/usr/src/linux/COPYING;
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef __GLIBC__
#include /* is this really needed ?? */
#endif
#include /* xlz - dammit, we need this again */
#include
void usage(void)
{
fprintf(stderr, "usage : bpqparms dev -d address [-a address]\n");
fprintf(stderr, "examples: bpqparms bpq0 -d 00:80:AD:1B:05:26\n");
fprintf(stderr, " bpqparms bpq0 -d broadcast -a 00:80:AD:1B:05:26\n");
exit(1);
}
int get_hwaddr(unsigned char *k, char *s)
{
unsigned char broadcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
unsigned int eth[ETH_ALEN];
int n;
if (strcmp(s, "default") == 0 || strcmp(s, "broadcast") == 0) {
memcpy(k, broadcast, ETH_ALEN);
} else {
n = sscanf(s, "%x:%x:%x:%x:%x:%x",
ð[0], ð[1], ð[2], ð[3], ð[4], ð[5]);
if (n < 6)
return 1;
for (n = 0; n < ETH_ALEN; n++)
k[n] = eth[n];
}
return 0;
}
int main(int argc, char **argv)
{
int fd;
int cmd, flag;
struct ifreq ifr;
char dev[40];
struct bpq_ethaddr addr;
flag = 0;
while ((cmd = getopt(argc, argv, "d:a:vVh")) != EOF) {
switch (cmd) {
case 'd':
flag |= 1;
if (get_hwaddr(addr.destination, optarg)) {
fprintf(stderr, "bpqparms: invalid 'destination' address %s\n", optarg);
return 1;
}
break;
case 'a':
flag |= 2;
if (get_hwaddr(addr.accept, optarg)) {
fprintf(stderr, "bpqparms: invalid 'accept' address %s\n", optarg);
return 1;
}
break;
case 'V':
printf("bpqparms version " VERSION "\n");
printf("Copyright 1996, Jörg Reuter (jreuter@poboxes.com)\n");
printf("This program is free software; you can redistribute it and/or modify\n");
printf("it under the terms of the GNU General Public License as published by\n");
printf("the Free Software Foundation; either version 2 of the License, or\n");
printf(" (at your option) any later version.\n\n");
printf("This program is distributed in the hope that it will be useful,\n");
printf("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
printf("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
return 0;
case 'v':
printf("bpqparms: %s\n", VERSION);
return(0);
case 'h':
case ':':
case '?':
usage();
}
}
if (!(flag & 0x01) || optind+1 > argc)
usage();
strcpy(dev, argv[optind]);
if ((flag & 0x02) == 0)
memcpy(addr.accept, addr.destination, ETH_ALEN);
fd = socket(AF_INET, SOCK_DGRAM, 0);
strcpy(ifr.ifr_name, dev);
ifr.ifr_data = (caddr_t) &addr;
if (ioctl(fd, SIOCSBPQETHADDR, &ifr) < 0) {
perror("bpqparms SIOCSBPQETHADDR");
close(fd);
return 1;
}
close(fd);
return 0;
}
ax25-tools-0.0.10-rc4/ax25/mheard.1 0000664 0000000 0000000 00000003621 12155142241 013164 0000000 0000000 .TH MHEARD 1 "19 August 1996" Linux "Linux Programmer's Manual"
.SH NAME
mheard \- display AX.25 calls recently heard.
.SH SYNOPSIS
.B mheard [-d cmns] [-n] [-o cfpt] [-v] [port...]
.SH DESCRIPTION
.LP
.B Mheard
displays information about most recently heard AX.25 callsigns, the interface
upon which they were heard, the total packets heard, the time
at which the last one was heard and other information.
.B Mheard
displays different information, in different orders depending on the
settings of the arguments. Information on specific ports can be displayed by
giving the port names as arguments.
.SH OPTIONS
.TP 13
.BI "\-d cmns"
Sets the information that is displayed for each AX.25 callsign heard. The
different arguments are:
.RS
.TP 5
.BI c
Display all the information with regard to callsigns, from-callsign,
to-callsign, port name, and any digipeaters that may be in use.
.TP 5
.BI m
Display miscellaneous information, the from-callsign, port name, no frames
heard, the last type of frames heard, and which different PIDs have been
heard from that station.
.TP 5
.BI n
Display the default information. This is the from-callsign, port name, no frames
heard and the date and time last heard.
.TP 5
.BI s
Displays statistics about the station heard, the from-callsign, port name,
no I frames, no S frames, no U frames, time first heard, and time last
heard.
.RE
.TP 13
.BI \-n
Supress the displaying of titles.
.TP 13
.BI "\-o cfpt"
Sets the ordering of the information displayed. The meanings of the
different arguments are:
.RS
.TP 5
.BI c
Sort list by from-callsign.
.TP 5
.BI f
Sort list by number of frames heard.
.TP 5
.BI p
Sort list by port name.
.TP 5
.BI t
Sort list by the time last heard, this is the default.
.RE
.TP 13
.BI \-v
Display the version.
.SH FILES
.LP
/var/ax25/mheard/mheard.dat
.br
/etc/ax25/axports
.SH "SEE ALSO"
.BR ax25 (4),
.BR mheardd (8).
.SH AUTHOR
Jonathan Naylor G4KLX
ax25-tools-0.0.10-rc4/ax25/axctl.8 0000664 0000000 0000000 00000003435 12155142241 013051 0000000 0000000 .TH AXCTL 8 "2 August 1996" Linux "Linux System Managers Manual"
.SH NAME
axctl \- Configure/Kill running AX.25 connections.
.SH SYNOPSIS
.B axctl [-v] port dest src window|t1|t2|t3|n2|idle|paclen|kill [parm]
.SH DESCRIPTION
.LP
The
.B axctl
command is designed to be a multi-function command that allows miscellaneous
commands to be issued to the Linux AX.25 protocol layer for existing AX.25
connections. The connection is uniquely identified via the combination of
port, destination callsign and source callsign, with that information the
kernel is able to change the parameters, or abort the connection.
.LP
Many of the options are similar to those found in
.B axparms
and perform the same function. Only one parameter may be changed on each
invokation of
.B axctl.
.SH OPTIONS
.TP 20
.BI \-v
Displays the version number.
.TP 20
.BI "window window"
Sets the window size for the AX.25 connection.
.TP 20
.BI "t1 t1\-timeout"
Sets the initial T1 timeout value for the AX.25 connection, the value is given in
seconds.
.TP 20
.BI "t2 t2\-timeout"
Sets the T2 timeout value for the AX.25 connection, the value is given in
seconds.
.TP 20
.BI "t3 t3\-timeout"
Sets the T3 timeout value for the AX.25 connected, the value is given in
seconds.
.TP 20
.BI "n2 n2\-count"
Sets the maximum number of tries for the AX.25 connection.
.TP 20
.BI "idle idle-timeout"
Sets the value for the idle timer for the AX.25 connection, the value is in
minutes.
.TP 20
.BI "paclen paclength"
Sets the maximum packet length that may be transmitted on the AX.25
connection.
.TP 20
.BI "kill"
Will abort an existing AX.25 connection.
.SH FILES
.LP
/etc/ax25/axports
.SH "SEE ALSO"
.BR call (1),
.BR getsockopt (2),
.BR setsockopt (2),
.BR ax25 (4),
.BR axparms (8),
.BR axports (5).
.SH AUTHORS
.nf
Joerg Reuter DL1BKE
.fi
ax25-tools-0.0.10-rc4/ax25/axgetput/ 0000755 0000000 0000000 00000000000 12157605321 013564 5 0000000 0000000 ax25-tools-0.0.10-rc4/ax25/axgetput/axgetput.1 0000664 0000000 0000000 00000004053 12155142241 015426 0000000 0000000 .TH AXGETPUT 1 "21 January 2007" Linux "Linux Programmer's Manual"
.SH NAME
axgetput \- upload or download files via AX.25 / axspawn Linux login session.
.SH SYNOPSIS
.B axgetput
[-b \fIblocksize\fR] [-i] [-v] [-h] [?] \fIfilename\fR
.br
.B axgetput
[-b \fIblocksize\fR] [-i] -s [-v] [-h] [?] [\fIfilename\fR]
.LP
.SH DESCRIPTION
.TP
\fB-b blocksize\fR
Set the blocksize (frame length) of transmitted data. Defaults to 256 bytes
which matches typical AX.25 network confurations best.
.TP
\fB-i\fR
Compute CRC checksum only.
.TP
\fB.B -s\fR
Indicates input from a stream. This option is available only if STDIN is a
pipe. The filename argument may be omitted if -s is given. The length of
the file need not to be known.
.TP
\fB\-v\fR
print version and exit.
.TP
\fB-h, ?\fR
print usage and exit.
.LP
.B axgetput
is the actual name of the program. You execute for e.g.
.B bget
or
.B bput
while axgetput is the common program to which bget and bput are linked to.
axgetput autodetermines which operation mode the user desires.
axgetput sets the pty to be 8bit clean (thus enables binary mode for the
file transfer). It requires that the user is logged in through axspawn(8).
.B I. #BIN Protocol
.B bget
is used for downloading a file on this system from the unix login shell
via his ax25 session to his packet-radio terminal program. The download
"protocol" is the "#BIN" standard known from packet radio mailboxes.
.B bput
does it the other way round: with this comand, the user may upload a
file to this computer.
The #BIN protocol provides a CRC consistency check after the file is
transfered. The transfer of the file modification time is part of the
#BIN protocol.
.LP
.B II. YAPP Protocol
.B yget
or
.B yput
is reserverd for the yapp protocol, which is not supported in this version.
.LP
.B II. DIDADIT Protocol
.B rget
or
.B rput
is reserverd for the didadit protocol, which is not supported in this version.
.LP
Anyone like to implement yapp and didadit protcols?
.LP
.SH AUTHOR
Thomas Osterried DL9SAU
Ralf Baechle DL5RB
ax25-tools-0.0.10-rc4/ax25/axgetput/includes.h 0000664 0000000 0000000 00000001105 12155142241 015455 0000000 0000000 #ifndef INCLUDES_H
#define INCLUDES_H
/*
* (c) 2002 Thomas Osterried DL9SAU
* License: GPL. See http://www.fsf.org/
* Sources: http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/axgetput/
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#endif /* INCLUDES_H */
ax25-tools-0.0.10-rc4/ax25/axgetput/proto_bin.c 0000664 0000000 0000000 00000030772 12155142241 015651 0000000 0000000 /*
* (c) 2002 Thomas Osterried DL9SAU
* License: GPL. See http://www.fsf.org/
* Sources: http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/axgetput/
*/
#include "includes.h"
#include "proto_bin.h"
#include "axgetput.h"
#include "util.h"
static int crctab[256];
static int bittab[8] = { 128,64,32,16,8,4,2,1 };
static int crcbit[8] = {
0x9188,0x48c4,0x2462,0x1231,0x8108,0x4084,0x2042,0x1021
};
/*---------------------------------------------------------------------------*/
static int init_crc(void)
{
int i,j;
for (i = 0; i < 256; i++) {
crctab[i] = 0;
for (j = 0; j < 8; j++) {
if ((bittab[j] & i) != 0) {
crctab[i] = crctab[i] ^ crcbit[j];
}
}
}
return 0;
}
/*---------------------------------------------------------------------------*/
static int do_crc(char b, int n, unsigned int crc)
{
crc = (crctab[(crc >> 8)] ^ ((crc << 8) | (b & 0xff))) & 0xffff;
return (crc);
}
/*---------------------------------------------------------------------------*/
static long parse_sfbin_date_to_unix(const char *s)
{
unsigned long x;
sscanf(s, "%lX", &x);
return date_dos2unix(((x << 16) >> 16), (x >> 16));
}
/*---------------------------------------------------------------------------*/
static char * unix_to_sfbin_date_string(long gmt)
{
static char buf[9];
unsigned short s_time, s_date;
date_unix2dos(((gmt == -1) ? time(0) : gmt), &s_time, &s_date);
sprintf(buf, "%X", ((s_date << 16) + s_time));
return buf;
}
/*---------------------------------------------------------------------------*/
int bput(void)
{
struct stat statbuf;
char buf[1024]; /* < signed int */
char filename_given[PATH_MAX];
unsigned long len_read_expected = 0L;
unsigned long len_read_left;
time_t file_time = 0L;
unsigned int msg_crc = 0;
unsigned int crc = 0;
char *term_line = 0;
int last_line_had_CR = 0;
int len_termline = 0;
int len = 0;
int fddata = fdout;
int is_eof;
int i;
char *p;
char *p_buf;
#define save_close(x) { \
if (!fdout_is_pipe) \
close(x); \
}
for (;;) {
len = my_read(fdin, buf, sizeof(buf), &is_eof, "\r\n");
if (is_eof || len < 1) {
sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
return 1;
}
if (buf[len-1] == '\n') {
#if 0
p = "warning: received. not 8bit clean?\r";
secure_write(fdout, p, strlen(p));
#endif
sprintf(err_msg, "bad EOL: \n");
return 1;
}
if (IS_BIN_ABORT(buf, len)) {
sprintf(err_msg, "Aborted by user request\n");
return 1;
}
if (buf[len-1] == '\r' && len > 5 && !memcmp(buf, "#BIN#", 5)) {
break;
}
if (len == sizeof(buf)) {
sprintf(err_msg, "line to long\n");
return 1;
}
}
buf[len-1] = 0; /* without trailing \r. and: string termination */
send_on_signal = bin_send_no_on_sig;
/* parse #BIN arguments */
*filename_given = 0;
p_buf = buf;
for (i = 0; (p = strsep(&p_buf, "#")); i++) {
switch(i) {
case 0:
case 1:
break;
case 2:
if (*p)
len_read_expected = (unsigned long ) atol(p);
break;
default:
if (*p == '|') {
msg_crc = (unsigned int ) atoi(p+1);
} else if (*p == '$') {
file_time = parse_sfbin_date_to_unix(p+1);
} else {
strncpy(filename_given, p, sizeof(filename_given)-1);
filename_given[sizeof(filename_given)-1] = 0;
}
}
}
if (!fdout_is_pipe) {
/* normal mode: store in given filename */
if (!*filename) {
p = get_fixed_filename(filename_given, len_read_expected, msg_crc, 1);
strncpy(filename, p, sizeof(filename)-1);
filename[sizeof(filename)-1] = 0;
}
if (!stat(filename, &statbuf)) {
/* file exist */
if (unlink(filename)) {
sprintf(err_msg, "error: cannot unlink %s (%s)\n", filename, strerror(errno));
goto abort;
}
}
if ((fddata = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0640)) < 0) {
sprintf(err_msg, "error: cannot open %s (%s)\n", filename, strerror(errno));
write(fderr, "\r#NO#\r", 6);
return 1;
}
}
if (!len_read_expected) {
term_line = "***END\r";
len_termline = strlen(term_line);
}
/* say helo */
send_on_signal = bin_send_abort_on_sig;
write(fderr, "\r#OK#\r", 6);
len_read_left = len_read_expected;
/* #bin# chechsum initialization */
init_crc();
for (;;) {
if ((len = my_read(fdin, buf, ((term_line || len_read_left > sizeof(buf)) ? sizeof(buf) : len_read_left), &is_eof, "\r")) < 1) {
save_close(fddata);
sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
goto abort;
}
if (!len) {
save_close(fddata);
if (!term_line) {
sprintf(err_msg, "error: unexpected end of file during read: %s\n", strerror(errno));
return 1;
}
return 0;
}
if (msg_crc) {
int i;
for (i = 0; i < len; i++)
crc = do_crc((int ) buf[i], 1, crc);
}
if (buf[len-1] == '\r') {
if (last_line_had_CR) {
if (IS_BIN_ABORT(buf, len)) {
/* "\r#ABORT#\r" was sent */
if (!fdout_is_pipe) {
close(fddata);
/* clean up */
unlink(filename);
}
return 1;
}
if (term_line && len == len_termline && !memcmp(buf, term_line, len_termline)) {
/* sucessfully read until termination string */
break;
}
}
last_line_had_CR = 1;
} else {
last_line_had_CR = 0;
}
if (!term_line)
len_read_left -= len;
if (secure_write(fddata, buf, len) == -1) {
save_close(fddata);
sprintf(err_msg, "error: write failed (%s)\n", strerror(errno));
goto abort;
}
/* nothing left? */
if (!term_line && len_read_left == 0L)
break;
if (is_eof) {
if (!term_line && len_read_left) {
save_close(fddata);
goto abort;
}
break;
}
}
if (crc != msg_crc) {
sprintf(err_msg, "Invalid crc: computed %d, expected %d.\n", crc, msg_crc);
/* don't unlink */
save_close(fddata);
return 1;
}
if (!fdout_is_pipe) {
close(fddata);
if (file_time != 0L) {
struct utimbuf utb;
utb.modtime = file_time;
utb.actime = time(0);
utime(filename, &utb);
}
}
send_on_signal = 0;
return 0;
abort:
sleep(1);
write(fderr, "\r#ABORT#\r", 9);
return 1;
#undef save_close
}
/*---------------------------------------------------------------------------*/
int bget(void) {
struct strlist {
struct strlist *next;
size_t len;
char data[1]; /* actually a the address of char * pointer */
};
struct strlist *stored_file = 0;
struct strlist *sl_tail = 0;
struct strlist *sl;
struct timeval timeout;
struct stat statbuf;
unsigned int crc = 0;
char buf[1024];
fd_set readfds;
int fddata = fdin;
int len;
unsigned long file_size = 0;
unsigned long len_remains;
int is_eof;
time_t file_time = 0L;
#define save_close(x) { \
if (!fdin_is_pipe) \
close(x); \
}
#define store_line(s, len) { \
if (!(sl = (struct strlist *) malloc(sizeof(struct strlist *) + sizeof(size_t) + len))) \
return 1; \
sl->next = 0; \
sl->len = len; \
memcpy(sl->data, s, len); \
if (!stored_file) { \
stored_file = sl; \
} else { \
sl_tail->next = sl; \
} \
sl_tail = sl; \
}
if (BLOCKSIZ < 1 || BLOCKSIZ > sizeof(buf))
BLOCKSIZ = BLOCKSIZ_DEFAULT;
init_crc();
if (!fdin_is_pipe && *filename) {
if ((fddata = open(filename, O_RDONLY)) == -1) {
sprintf(err_msg, "error: cannot open %s (%s)\n", filename, strerror(errno));
return 1;
}
if (!fstat(fddata, &statbuf))
file_time = statbuf.st_mtime;
else
file_time = time(0);
/* compute crc */
while ((len = read(fddata, buf, BLOCKSIZ)) > 0) {
int i;
for (i = 0; i < len; i++)
crc = do_crc((int ) buf[i], 1, crc);
file_size += len;
}
if (len < 0) {
sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
close(fddata);
return 1;
}
/* rewind */
if (lseek(fddata, 0L, SEEK_SET) != 0L) {
sprintf(err_msg, "error: file io failed on lseek() (%s)\n", strerror(errno));
close(fddata);
return 1;
}
sprintf(buf, "\r#BIN#%ld#|%d#$%s#%s\r", file_size, crc, unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, file_size, crc, 1));
} else {
file_time = time(0);
if (!is_stream || do_crc_only) {
sprintf(err_msg, "error: not enough memory\n");
while ((len = read(fddata, buf, sizeof(buf))) > 0) {
int i;
for (i = 0; i < len; i++)
crc = do_crc((int ) buf[i], 1, crc);
file_size += len;
if (!do_crc_only)
store_line(buf, len);
}
if (len < 0) {
sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
close(fddata);
return 1;
}
*err_msg = 0;
sprintf(buf, "\r#BIN#%ld#|%d#$%s#%s\r", file_size, crc, unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, file_size, crc, 1));
} else {
sprintf(buf, "\r#BIN###$%s#%s\r", unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, 0, 0, 1));
}
/*
* hack: check for #ABORT# from fdout (fd 1), because fddata (fd 0) is
* our pipe we read the data from, which we actually tx.
* believe me, it does work.
*/
fdin = fdout;
}
if (do_crc_only) {
printf("File information for %s:\n", get_fixed_filename(filename, file_size, crc, 1));
printf(" size %ld bytes, crc %d, date %s (%ld)\n", file_size, crc, unix_to_sfbin_date_string(file_time), file_time);
return 0;
}
send_on_signal = bin_send_abort_on_sig;
if (secure_write(fdout, buf, strlen(buf)) == -1) {
sprintf(err_msg, "error: write failed (%s)\n", strerror(errno));
save_close(fddata);
return 1;
}
/* wait for answer */
for (;;) {
/*
* make sure we do not read from a pipe. fdout is also
* assigned to the tty
*/
len = my_read(fdout, buf, sizeof(buf), &is_eof, "\r\n");
if (is_eof || len < 1) {
sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
save_close(fddata);
return 1;
}
if (buf[len-1] == '\n') {
#if 0
char *p = "warning: received. not 8bit clean?\r";
secure_write(fdout, p, strlen(p));
#endif
sprintf(err_msg, "bad EOL: \n");
goto abort;
} else if (buf[len-1] != '\r') {
sprintf(err_msg, "line to long\n");
continue;
}
if (IS_BIN_OK(buf, len))
break;
if (IS_BIN_NO(buf, len)) {
save_close(fddata);
return 0;
}
if (IS_BIN_ABORT(buf, len)) {
sprintf(err_msg, "Aborted by user request\n");
save_close(fddata);
return 1;
}
}
len_remains = file_size;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
for (;;) {
char *p_buf;
/* check for user \r#ABORT#\r on tty stream */
FD_ZERO(&readfds);
FD_SET(fdin, &readfds);
if (select(fdin+1, &readfds, 0, 0, &timeout) && FD_ISSET(fdin, &readfds)) {
if ((len = read(fdin, buf, sizeof(buf))) < 0) {
sprintf(err_msg, "read from tty failed (%s)\n", strerror(errno));
save_close(fddata);
goto abort;
}
if (IS_BIN_ABORT(buf, len)) {
sprintf(err_msg, "Aborted by user request\n");
save_close(fddata);
return 1;
}
}
/* read data */
if (!fdin_is_pipe || is_stream) {
p_buf = buf;
if ((len = my_read(fddata, buf, ((len_remains > BLOCKSIZ || is_stream) ? BLOCKSIZ : len_remains), &is_eof, 0)) < 1) {
save_close(fddata);
if (len < 0) {
sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
goto abort;
}
break;
}
len_remains -= len;
} else {
p_buf = stored_file->data;
len = stored_file->len;
}
/* write to client */
if (secure_write(fdout, p_buf, len) == -1) {
sprintf(err_msg, "error: write failed (%s)\n", strerror(errno));
save_close(fddata);
goto abort;
}
if (fdin_is_pipe && !is_stream) {
sl = stored_file;
if (!(stored_file = stored_file->next))
is_eof = 1;
free(sl);
}
if (!fdin_is_pipe && !len_remains) {
if (read(fddata, buf, 1) == 1) {
sprintf(err_msg, "Warning: file has grown in the meantime\n");
}
is_eof = 1;
break;
}
/*
* need this because my_read may returned lenth != 0 (data to be written)
* but also has detected EOF.
*/
if (is_eof)
break;
}
sleep(10);
return 0;
abort:
sleep(1);
write(fderr, "\r#ABORT#\r", 9);
return 1;
#undef save_close
}
ax25-tools-0.0.10-rc4/ax25/axgetput/proto_bin.h 0000664 0000000 0000000 00000001714 12155142241 015650 0000000 0000000 /*
* (c) 2002 Thomas Osterried DL9SAU
* License: GPL. See http://www.fsf.org/
* Sources: http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/axgetput/
*/
#ifndef PROTO_BIN_H
#define PROTO_BIN_H
extern int bget(void);
extern int bput(void);
static const char bin_s_on_ok[] = "#OK#\r";
static const int bin_len_ok = sizeof(bin_s_on_ok)-1;
static const char bin_s_on_no[] = "#NO#\r";
static const int bin_len_no = sizeof(bin_s_on_no)-1;
static const char bin_s_on_abort[] = "#ABORT#\r";
static const int bin_len_abort = sizeof(bin_s_on_abort)-1;
#define bin_send_no_on_sig "\r#NO#\r"
#define bin_send_abort_on_sig "\r#ABORT#\r"
#define IS_BIN_NO(s, len) \
len == bin_len_no && !memcmp(s, bin_s_on_no, bin_len_no)
#define IS_BIN_OK(s, len) \
len == bin_len_ok && !memcmp(s, bin_s_on_ok, bin_len_ok)
#define IS_BIN_ABORT(s, len) \
len == bin_len_abort && !memcmp(s, bin_s_on_abort, bin_len_abort)
#endif /* PROTO_BIN_H */
ax25-tools-0.0.10-rc4/ax25/axgetput/util.c 0000664 0000000 0000000 00000012051 12155142241 014621 0000000 0000000 /*
* (c) 2002 Thomas Osterried DL9SAU
* License: GPL. See http://www.fsf.org/
* Sources: http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/axgetput/
*/
#include "includes.h"
#include "axgetput.h"
/* Use private function because some platforms are broken, eg 386BSD */
static int Xtolower(int c)
{
return (c >= 'A' && c <= 'Z') ? (c - 'A' + 'a') : c;
}
/*---------------------------------------------------------------------------*/
char *strlwc(char *s)
{
char *p;
for (p = s; (*p = Xtolower(*p)); p++) ;
return s;
}
/*---------------------------------------------------------------------------*/
char *strtrim(char *s)
{
char *p;
for (p = s; *p; p++) ;
while (--p >= s && isspace(*p & 0xff)) ;
p[1] = 0;
return s;
}
/*---------------------------------------------------------------------------*/
int my_read(int fd, char *s, int len_max, int *eof, char *p_break)
{
struct timeval timeout;
fd_set errfds;
int len_got;
*eof = 0;
for (len_got = 0; len_got < len_max; ) {
int len;
char *s_curr = s + len_got;
if ((len = read(fd, s_curr, (p_break ? 1 : len_max))) < 1) {
if (len == -1 && errno == EAGAIN) {
sleep(10);
continue;
}
*eof = 1;
/*
* len = 0: normal eof. if we're looking for a string, return -1 since
* we have'nt found
*/
return (len == 0 && p_break ? -1 : (len_got ? len_got : len));
}
len_got += len;
/* read once? or char in p_break found? */
if (!p_break || strchr(p_break, *s_curr))
break;
}
timeout.tv_sec = 0;
timeout.tv_usec = 0;
FD_ZERO(&errfds);
FD_SET(fdout, &errfds);
if (select(fd+1, 0, 0, &errfds, &timeout) && FD_ISSET(fd, &errfds))
*eof = 1;
return len_got;
}
/*---------------------------------------------------------------------------*/
int secure_write(int fd, char *s, int len_write) {
int len_write_left_curr = len_write;
while (len_write_left_curr) {
int len;
if ((len = write(fd, s, len_write_left_curr)) < 0) {
if (len == -1 && errno == EAGAIN) {
sleep(10);
continue;
}
return -1;
}
if (len != len_write_left_curr) {
/* queue busy.. */
sleep(10);
}
s += len;
len_write_left_curr -= len;
}
return len_write;
}
/*---------------------------------------------------------------------------*/
char *get_fixed_filename(char *line, long size, unsigned int msg_crc, int generate_filename) {
static char filename[1024];
char *p, *q, *r;
*filename = 0;
if ((p = strchr(line, '\"'))) {
p++;
}
/* security.. */
if ((q = strrchr((p ? p : line), '/'))) {
p = ++q;
}
if ((q = strrchr((p ? p : line), '\\'))) {
p = ++q;
}
if ((q = strrchr((p ? p : line), ':'))) {
p = ++q;
}
if (!p) {
p = line;
}
while (*p && isspace(*p & 0xff))
p++;
for (r = filename, q = p; *q; q++) {
if (*q == '"' || *q == ';') {
break;
}
*r++ = *q;
}
*r = 0;
strtrim(filename);
if ((q = strrchr(filename, '.'))) {
if (!*(q+1)) {
/* remove trailing dots */
*q = 0;
} else {
/* make suffix lowercase */
strlwc(q);
}
}
if (!*filename && generate_filename) {
sprintf(filename, "unknown-%ld%d%ld.bin", size, msg_crc, time(0));
}
return filename;
}
/*---------------------------------------------------------------------------*/
/* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */
/* Linear day numbers of the respective 1sts in non-leap years. */
static int day_n[] = { 0,31,59,90,120,151,181,212,243,273,304,334,0,0,0,0 };
/* JanFebMarApr May Jun Jul Aug Sep Oct Nov Dec */
/*---------------------------------------------------------------------------*/
long date_dos2unix(unsigned short time,unsigned short date)
{
int month,year;
long secs;
month = ((date >> 5) & 15)-1;
year = date >> 9;
secs = (time & 31)*2+60*((time >> 5) & 63)+(time >> 11)*3600+86400*
((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) == 0 &&
month < 2 ? 1 : 0)+3653);
/* days since 1.1.70 plus 80's leap day */
return secs;
}
/*---------------------------------------------------------------------------*/
/* Convert linear UNIX date to a MS-DOS time/date pair. */
void date_unix2dos(int unix_date,unsigned short *time, unsigned short *date)
{
int day,year,nl_day,month;
*time = (unix_date % 60)/2+(((unix_date/60) % 60) << 5)+
(((unix_date/3600) % 24) << 11);
day = unix_date/86400-3652;
year = day/365;
if ((year+3)/4+365*year > day) year--;
day -= (year+3)/4+365*year;
if (day == 59 && !(year & 3)) {
nl_day = day;
month = 2;
}
else {
nl_day = (year & 3) || day <= 59 ? day : day-1;
for (month = 0; month < 12; month++)
if (day_n[month] > nl_day) break;
}
*date = nl_day-day_n[month-1]+1+(month << 5)+(year << 9);
}
ax25-tools-0.0.10-rc4/ax25/axgetput/TODO 0000664 0000000 0000000 00000000042 12155142241 014165 0000000 0000000
- yapp support
- didadit support
ax25-tools-0.0.10-rc4/ax25/axgetput/axgetput.c 0000664 0000000 0000000 00000023515 12155142241 015514 0000000 0000000 /*
* This is axgetput
*
* This shell utility is for up/downloading files via your ax25 unix login
* session which is managed by axspawn.
* you need a //BIN compatible axspawn, which has the functionality of making
* the stream 8bit compatible (normally the EOL-conversion <->
* prevents this). see:
* http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/patches/linux-ax25/
*
* (c) 2002 Thomas Osterried DL9SAU
* License: GPL. See http://www.fsf.org/
* Sources: http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/axgetput/
*
*/
#ifdef HAVE_CONFIG_H
#include
#endif
#include "includes.h"
#include "axgetput.h"
#include "util.h"
#include "proto_bin.h"
int fdin = 0;
int fdout = 1;
int fderr = 2;
int fdout_is_pipe = 0;
int fdin_is_pipe = 0;
int is_stream = 0;
int mode = 0;
int do_crc_only = 0;
char c_eol = '\n';
unsigned int BLOCKSIZ = BLOCKSIZ_DEFAULT;
char *send_on_signal = 0;
static struct termios prev_termios;
static int prev_termios_stored = 0;
static mode_t mode_tty = 0;
#ifndef MYNAME
#define MYNAME "axgetput"
#endif
/*---------------------------------------------------------------------------*/
static void set_tty_flags(void)
{
struct termios termios;
struct stat statbuf;
if (fdin_is_pipe)
return;
/* mesg no */
if (!fstat(fdin, &statbuf)) {
/* save old mode */
mode_tty = statbuf.st_mode;
fchmod(fdin, 0600);
}
/* make tty 8bit clean */
if (tcgetattr(fdin, &prev_termios) != -1)
prev_termios_stored = 1;
memset((char *) &termios, 0, sizeof(termios));
termios.c_iflag = IGNBRK | IGNPAR;
termios.c_oflag = 0;
termios.c_cflag = CBAUD | CS8 | CREAD | CLOCAL;
termios.c_cflag = ~(CSTOPB|PARENB|PARODD|HUPCL);
termios.c_lflag = 0;
termios.c_cc[VMIN] = 1;
termios.c_cc[VTIME] = 0;
termios.c_cc[VSTART] = -1;
termios.c_cc[VSTOP] = -1;
tcsetattr(fdin, TCSANOW, &termios);
}
/*---------------------------------------------------------------------------*/
static void restore_tty_flags(void)
{
if (fdin_is_pipe)
return;
if (prev_termios_stored)
tcsetattr(fdin, TCSANOW, &prev_termios);
if (mode_tty)
fchmod(fdin, mode_tty);
}
/*---------------------------------------------------------------------------*/
static void eol_convention(int state_should)
{
/* need patched axspawn */
#define BIN_ON "//BIN ON\r"
#define BIN_OFF "//BIN OFF\r"
static int state_is = 0;
/* already in correct state? */
if ((state_is && state_should) || (!state_is && !state_should))
return;
sleep(1);
if (state_should) {
write(fderr, BIN_ON, strlen(BIN_ON));
c_eol = '\r';
} else {
write(fderr, BIN_OFF, strlen(BIN_OFF));
c_eol = '\n';
}
state_is = state_should;
sleep(1);
}
/*---------------------------------------------------------------------------*/
static void restore_defaults(void)
{
eol_convention(0);
restore_tty_flags();
}
/*---------------------------------------------------------------------------*/
static void signal_handler(int sig)
{
if (send_on_signal)
secure_write(fdout, send_on_signal, strlen(send_on_signal));
restore_defaults();
if (*err_msg) {
fputs(err_msg, stderr);
}
fprintf(stderr, "Died by signal %d.\n", sig);
exit(sig);
}
/*---------------------------------------------------------------------------*/
void do_version(void)
{
fprintf(stderr, MYNAME " " VERSION "\n");
fprintf(stderr, " (c) 2002 Thomas Osterried \n");
fprintf(stderr, " License: GPL. See http://www.fsf.org/\n");
fprintf(stderr, " Sources: http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/axgetput/\n");
}
/*---------------------------------------------------------------------------*/
static void usage(int all) {
fprintf(stderr, "usage: %s ", myname);
if (mode % 2) {
fprintf(stderr, "[-ivh] [filename]\n");
} else {
fprintf(stderr, "[-isvh] [-b ] [filename]\n");
}
fprintf(stderr, " -h prints detailed help\n");
fprintf(stderr, " -i computes checksum only\n");
fprintf(stderr, " -v prints version and exits\n");
if (!all)
return;
if (mode % 2) {
fprintf(stderr, " filename is usually got from the remote side by the protocol\n");
fprintf(stderr, " but can be forced if you like to ignore this.\n");
fprintf(stderr, " filename should be ommitted if output is sent to a pipe\n.");
} else {
fprintf(stderr, " -b value is the blocksize (framelen) of the transmitted data\n");
fprintf(stderr, " default %d, which is a useful choice for ampr ax25.\n", BLOCKSIZ_DEFAULT);
fprintf(stderr, " -s indicates a stream with unknown size.\n");
fprintf(stderr, " otherwise, the data will be read to memory until EOF.\n");
fprintf(stderr, " -s is only available if stdin is a pipe\n");
fprintf(stderr, " if filename specified in filter, the given name will be suggested instead.\n");
fprintf(stderr, " filename may be ommited if used as filter.\n");
}
fputc('\n', stderr);
fprintf(stderr, "Tips: - compressed download:\n");
fprintf(stderr, " gzip -c foo.txt | bget foo.txt.gz\n");
fprintf(stderr, " tar cjf - ~/foo ~/bar/ | bget my_data.tar.bz2\n");
fputc('\n', stderr);
fprintf(stderr, "Other protocols:\n");
fprintf(stderr, " bget / bput: receive / send with #BIN# protocol\n");
fprintf(stderr, " yget / yput: receive / send with yapp\n");
fprintf(stderr, " rget / rput: receive / send with didadit\n");
fprintf(stderr, "These are (sym)links to one program: " MYNAME "\n");
}
/*---------------------------------------------------------------------------*/
/* not implemented */
static int yput(void) { strcpy(err_msg, "yapp: not implementet yet\n"); return 1; }
static int yget(void) { strcpy(err_msg, "yapp: not implementet yet\n"); return 1; }
static int rget(void) { strcpy(err_msg, "yapp: not implementet yet\n"); return 1; }
static int rput(void) { strcpy(err_msg, "yapp: not implementet yet\n"); return 1; }
/*---------------------------------------------------------------------------*/
int main(int argc, char *argv[])
{
int len;
int ret = 0;
int c;
char *p;
/* determine what to so in the way how we are called */
if ((p = strrchr(argv[0], '/')))
p++; /* skip '/' */
else
p = argv[0];
len = strlen(p);
if (len < 0 || len > sizeof(myname)-1)
len = sizeof(myname)-1;
strncpy(myname, p, len);
myname[len] = 0;
strlwc(myname);
fdin_is_pipe = (isatty(fdin) ? 0 : 1);
fdout_is_pipe = (isatty(fdout) ? 0 : 1);
if (fdin_is_pipe && fdout_is_pipe) {
fprintf(stderr, "error: cannot work in between two pipes\n");
exit(1);
}
*filename = 0;
*err_msg = 0;
if (!strcmp(myname, "bput"))
mode = RECV_BIN;
else if (!strcmp(myname, "bget"))
mode = SEND_BIN;
else if (!strcmp(myname, "yput"))
mode = RECV_YAPP;
else if (!strcmp(myname, "yget"))
mode = SEND_YAPP;
else if (!strcmp(myname, "rput"))
mode = RECV_DIDADIT;
else if (!strcmp(myname, "rget"))
mode = SEND_DIDADIT;
if (mode % 2) {
if (fdin_is_pipe) {
fprintf(stderr, "error: error: stdin must be a tty\n");
exit(1);
}
} else {
if (fdout_is_pipe) {
fprintf(stderr, "error: stdout must be a tty\n");
exit(1);
}
}
signal(SIGHUP, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGINT, signal_handler);
/* for difference betreen "bput -f file" and "bget file" */
#define get_filename(f) { \
if (!strcmp(f, "-")) { \
if (mode % 2) \
fdin_is_pipe = 1; \
else \
fdout_is_pipe = 1; \
} else { \
strncpy(filename, f, sizeof(filename)-1); \
filename[sizeof(filename)-1] = 0; \
if (mode % 2) { \
if (fdin_is_pipe) \
fdin_is_pipe = 0; \
} else { \
if (fdout_is_pipe) \
fdout_is_pipe = 0; \
} \
} \
}
while ((c = getopt(argc, argv, (mode % 2) ? "ivh?" : "b:isvh?")) != EOF) {
switch(c) {
case 'b':
if (((BLOCKSIZ = (unsigned ) atoi(optarg)) < BLOCKSIZ_MIN) || BLOCKSIZ > BLOCKSIZ_MAX) {
fprintf(stderr, "error: invalid blocksize: %d\n", BLOCKSIZ);
fprintf(stderr, " blocksize must be in the range %d <= x <= %d. a value\n", BLOCKSIZ_MIN, BLOCKSIZ_MAX);
fprintf(stderr, " of %d (default) is suggested, because it fits in an ax25 frame.\n", BLOCKSIZ_DEFAULT);
exit(1);
}
break;
case 'i':
do_crc_only = 1;
break;
case 's':
is_stream = 1;
break;
case 'v':
do_version();
exit(0);
break;
case 'h':
case '?':
usage((c == 'h'));
exit(0);
break;
}
}
if (mode == 0) {
usage(1);
exit(0);
}
if (optind < argc) {
get_filename(argv[optind]);
optind++;
}
if (optind < argc) {
usage(0);
exit(1);
}
if (is_stream && !fdin_is_pipe) {
fprintf(stderr, "error: -s is only available in a pipe\n");
exit(1);
}
if (do_crc_only)
goto skiped_crc_only_tag_1;
if (mode % 2) {
if (fdin_is_pipe) {
fprintf(stderr, "error: error: stdin must be a tty.\n");
exit(1);
}
if (fdout_is_pipe && *filename) {
fprintf(stderr, "error: filename in a pipe does not make sense.\n");
exit(1);
}
} else {
if (fdout_is_pipe) {
fprintf(stderr, "error: stdout must be a tty.\n");
exit(1);
}
if (!fdin_is_pipe && !*filename) {
fprintf(stderr, "error: no file to send.\n");
exit(1);
}
}
signal(SIGQUIT, signal_handler);
set_tty_flags();
eol_convention(1);
skiped_crc_only_tag_1:
switch (mode) {
case RECV_BIN:
if (do_crc_only)
ret = bget();
else
ret = bput();
break;
case SEND_BIN:
ret = bget();
break;
case RECV_YAPP:
ret = yput();
break;
case SEND_YAPP:
ret = yget();
break;
case RECV_DIDADIT:
ret = rput();
break;
case SEND_DIDADIT:
ret = rget();
break;
}
restore_defaults();
if (*err_msg) {
fputs(err_msg, stderr);
}
exit(ret);
return 0;
}
ax25-tools-0.0.10-rc4/ax25/axgetput/axgetput.h 0000664 0000000 0000000 00000002162 12155142241 015514 0000000 0000000 /*
* (c) 2002 Thomas Osterried DL9SAU
* License: GPL. See http://www.fsf.org/
* Sources: http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/axgetput/
*/
#ifndef AXGETPUT_H
#define AXGETPUT_H
extern int fdin;
extern int fdout;
extern int fderr;
extern int fdin_is_pipe;
extern int fdout_is_pipe;
char myname[PATH_MAX+1];
char filename[PATH_MAX+1];
char err_msg[2048];
extern int is_stream;
extern int mode;
extern int do_crc_only;
extern char c_eol;
extern char *send_on_signal;
/* modes */
#define RECV_BIN 1 /* #BIN# protocol: receive */
#define SEND_BIN 2 /* #BIN# protocol: send */
#define RECV_YAPP 3 /* yapp protocol: receive */
#define SEND_YAPP 4 /* yapp protocol: send */
#define RECV_DIDADIT 5 /* didadit protocol: receive */
#define SEND_DIDADIT 6 /* didadit protocol: send */
/* block sizes */
extern unsigned int BLOCKSIZ;
#define BLOCKSIZ_MIN 1 /* not suggested */
#define BLOCKSIZ_DEFAULT 256 /* useful, because it fits in an ax25 frame */
#define BLOCKSIZ_MAX 1024 /* max. our buffer relies on it */
#endif /* AXGETPUT_H */
ax25-tools-0.0.10-rc4/ax25/axgetput/Makefile.am 0000664 0000000 0000000 00000000745 12155142241 015543 0000000 0000000
installconf:
etcfiles =
varfiles =
sbin_PROGRAMS =
bin_PROGRAMS = axgetput
man_MANS = axgetput.1
EXTRA_DIST = $(man_MANS)
axgetput_SOURCES = axgetput.c axgetput.h util.h proto_bin.h util.c proto_bin.c includes.h
install-exec-hook:
(cd $(DESTDIR)$(bindir) && ln -sf axgetput bget && ln -sf axgetput bput)
install-data-hook:
(cd $(DESTDIR)$(mandir)/man1 && ln -sf axgetput.1 bget.1 && ln -sf axgetput.1 bput.1)
ax25-tools-0.0.10-rc4/ax25/axgetput/Makefile.in 0000644 0000000 0000000 00000052165 12157605222 015562 0000000 0000000 # Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
sbin_PROGRAMS =
bin_PROGRAMS = axgetput$(EXEEXT)
subdir = ax25/axgetput
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in TODO
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \
"$(DESTDIR)$(man1dir)"
PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS)
am_axgetput_OBJECTS = axgetput.$(OBJEXT) util.$(OBJEXT) \
proto_bin.$(OBJEXT)
axgetput_OBJECTS = $(am_axgetput_OBJECTS)
axgetput_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(axgetput_SOURCES)
DIST_SOURCES = $(axgetput_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
man1dir = $(mandir)/man1
NROFF = nroff
MANS = $(man_MANS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
AX25IO_LIB = @AX25IO_LIB@
AX25_LIB = @AX25_LIB@
BASEVERSION = @BASEVERSION@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTRAVERSION = @EXTRAVERSION@
FLTK_LIB = @FLTK_LIB@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NCURSES_LIB = @NCURSES_LIB@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
UTIL_LIB = @UTIL_LIB@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
Z_LIB = @Z_LIB@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
etcfiles =
varfiles =
man_MANS = axgetput.1
EXTRA_DIST = $(man_MANS)
axgetput_SOURCES = axgetput.c axgetput.h util.h proto_bin.h util.c proto_bin.c includes.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ax25/axgetput/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu ax25/axgetput/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
} \
; done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(sbindir)" && rm -f $$files
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
axgetput$(EXEEXT): $(axgetput_OBJECTS) $(axgetput_DEPENDENCIES) $(EXTRA_axgetput_DEPENDENCIES)
@rm -f axgetput$(EXEEXT)
$(LINK) $(axgetput_OBJECTS) $(axgetput_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axgetput.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proto_bin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
install-man1: $(man_MANS)
@$(NORMAL_INSTALL)
@list1=''; \
list2='$(man_MANS)'; \
test -n "$(man1dir)" \
&& test -n "`echo $$list1$$list2`" \
|| exit 0; \
echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
{ for i in $$list1; do echo "$$i"; done; \
if test -n "$$list2"; then \
for i in $$list2; do echo "$$i"; done \
| sed -n '/\.1[a-z]*$$/p'; \
fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
done; }
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man1dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.1[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
list=`for p in $$list; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
if test -n "$$list" && \
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
echo " typically \`make maintainer-clean' will remove them" >&2; \
exit 1; \
else :; fi; \
else :; fi
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(MANS)
installdirs:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-sbinPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-man
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS install-sbinPROGRAMS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man: install-man1
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-man \
uninstall-sbinPROGRAMS
uninstall-man: uninstall-man1
.MAKE: install-am install-data-am install-exec-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-sbinPROGRAMS ctags distclean \
distclean-compile distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am \
install-data-hook install-dvi install-dvi-am install-exec \
install-exec-am install-exec-hook install-html install-html-am \
install-info install-info-am install-man install-man1 \
install-pdf install-pdf-am install-ps install-ps-am \
install-sbinPROGRAMS install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS uninstall-man \
uninstall-man1 uninstall-sbinPROGRAMS
installconf:
install-exec-hook:
(cd $(DESTDIR)$(bindir) && ln -sf axgetput bget && ln -sf axgetput bput)
install-data-hook:
(cd $(DESTDIR)$(mandir)/man1 && ln -sf axgetput.1 bget.1 && ln -sf axgetput.1 bput.1)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
ax25-tools-0.0.10-rc4/ax25/axgetput/util.h 0000664 0000000 0000000 00000001271 12155142241 014630 0000000 0000000 /*
* (c) 2002 Thomas Osterried DL9SAU
* License: GPL. See http://www.fsf.org/
* Sources: http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/axgetput/
*/
#ifndef UTIL_H
#define UTIL_H
extern char *strlwc(char *s);
extern char *strtrim(char *s);
extern int my_read(int fd, char *s, int len_max, int *eof, char *p_break);
extern int secure_write(int fd, char *s, int len_write_left);
extern char *get_fixed_filename(char *line, long size, unsigned int msg_crc, int generate_filename);
extern long date_dos2unix(unsigned short time,unsigned short date);
extern void date_unix2dos(int unix_date,unsigned short *time, unsigned short *date);
#endif /* UTIL_H */
ax25-tools-0.0.10-rc4/ax25/axgetput/README 0000664 0000000 0000000 00000001012 12155142241 014353 0000000 0000000 This shell utility is for up/downloading files via your ax25 unix login
session which is managed by axspawn.
you need a //BIN compatible axspawn, which has the functionality of making
the stream 8bit compatible (normally the EOL-conversion <->
prevents this). see:
http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/patches/linux-ax25/
The location of these sources is
http://x-berg.in-berlin.de/cgi-bin/viewcvs.cgi/ampr/axgetput/
Since 2006-12-10, axgetput is part of the ax25-tools (s. linux-ax25.org).
ax25-tools-0.0.10-rc4/ax25/axparms.c 0000664 0000000 0000000 00000021203 12155142241 013455 0000000 0000000 #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "../pathnames.h"
void usage(void)
{
fprintf(stderr, "usage: axparms --assoc|--forward|--route|--setcall|--version ...\n");
}
void usageassoc(void)
{
fprintf(stderr, "usage: axparms --assoc show\n");
fprintf(stderr, "usage: axparms --assoc policy default|deny\n");
fprintf(stderr, "usage: axparms --assoc [callsign] [username]\n");
fprintf(stderr, "usage: axparms --assoc [callsign] delete\n");
}
void usageforward(void)
{
fprintf(stderr, "usage: axparms --forward \n");
fprintf(stderr, "usage: axparms --forward delete\n");
}
void usageroute(void)
{
fprintf(stderr, "usage: axparms --route add port callsign [digi ...] [--ipmode mode]\n");
fprintf(stderr, "usage: axparms --route del port callsign\n");
fprintf(stderr, "usage: axparms --route list\n");
}
void usagesetcall(void)
{
fprintf(stderr, "usage: axparms --setcall interface callsign\n");
}
int routes(int s, int argc, char *argv[], ax25_address *callsign)
{
struct ax25_routes_struct ax25_route;
struct ax25_route_opt_struct ax25_opt;
int i, j;
int ip_mode = ' ';
FILE* fp;
char routebuf[80];
if (strcmp(argv[2], "add") == 0) {
ax25_route.port_addr = *callsign;
ax25_route.digi_count = 0;
if (strcmp(argv[4], "default") == 0) {
ax25_route.dest_addr = null_ax25_address;
} else {
if (ax25_aton_entry(argv[4], (char *)&ax25_route.dest_addr) == -1)
return 1;
}
for (i = 5, j = 0; i < argc && j < 6; i++) {
if (strncmp(argv[i], "--i", 3) == 0 || strncmp(argv[i], "-i", 2) == 0) {
if (++i == argc) {
fprintf(stderr, "axparms: -i must have a parameter\n");
return 1;
}
switch (*argv[i]) {
case 'd':
case 'D':
ip_mode = 'D';
break;
case 'v':
case 'V':
ip_mode = 'V';
break;
default:
ip_mode = ' ';
break;
}
} else {
if (ax25_aton_entry(argv[i], (char *)&ax25_route.digi_addr[j]) == -1)
return 1;
ax25_route.digi_count++;
j++;
}
}
if (ioctl(s, SIOCADDRT, &ax25_route) != 0) {
perror("axparms: SIOCADDRT");
return 1;
}
ax25_opt.port_addr = *callsign;
ax25_opt.dest_addr = ax25_route.dest_addr;
ax25_opt.cmd = AX25_SET_RT_IPMODE;
ax25_opt.arg = ip_mode;
if (ioctl(s, SIOCAX25OPTRT, &ax25_opt) != 0) {
perror("axparms: SIOCAX25OPTRT");
return 1;
}
}
if (strcmp(argv[2], "del") == 0) {
ax25_route.port_addr = *callsign;
ax25_route.digi_count = 0;
if (strcmp(argv[4], "default") == 0) {
ax25_route.dest_addr = null_ax25_address;
} else {
if (ax25_aton_entry(argv[4], (char *)&ax25_route.dest_addr) == -1)
return 1;
}
if (ioctl(s, SIOCDELRT, &ax25_route) != 0) {
perror("axparms: SIOCDELRT");
return 1;
}
}
if (strcmp(argv[2], "list") == 0) {
if ((fp=fopen(PROC_AX25_ROUTE_FILE,"r")) == NULL) {
fprintf(stderr, "axparms: route: cannot open %s\n",
PROC_AX25_ROUTE_FILE);
return 1;
}
while (fgets(routebuf,80,fp))
printf(routebuf);
puts("");
}
return 0;
}
int setifcall(int s, char *ifn, char *name)
{
char call[7];
struct ifreq ifr;
if (ax25_aton_entry(name, call) == -1)
return 1;
strcpy(ifr.ifr_name, ifn);
memcpy(ifr.ifr_hwaddr.sa_data, call, 7);
ifr.ifr_hwaddr.sa_family = AF_AX25;
if (ioctl(s, SIOCSIFHWADDR, &ifr) != 0) {
perror("axparms: SIOCSIFHWADDR");
return 1;
}
return 0;
}
int associate(int s, int argc, char *argv[])
{
char buffer[80], *u, *c;
struct sockaddr_ax25 sax25;
struct passwd *pw;
int opt;
FILE *fp;
if (strcmp(argv[2], "show") == 0) {
if (argc < 3) {
usageassoc();
exit(1);
}
if ((fp = fopen(PROC_AX25_CALLS_FILE, "r")) == NULL) {
fprintf(stderr, "axparms: associate: cannot open %s\n", PROC_AX25_CALLS_FILE);
return 1;
}
fgets(buffer, 80, fp);
printf("Userid Callsign\n");
while (fgets(buffer, 80, fp) != NULL) {
u = strtok(buffer, " \t\n");
c = strtok(NULL, " \t\n");
if ((pw = getpwuid(atoi(u))) != NULL)
printf("%-10s %s\n", pw->pw_name, c);
}
fclose(fp);
return 0;
}
if (strcmp(argv[2], "policy") == 0) {
if (argc < 4) {
usageassoc();
exit(1);
}
if (strcmp(argv[3], "default") == 0) {
opt = AX25_NOUID_DEFAULT;
if (ioctl(s, SIOCAX25NOUID, &opt) == -1) {
perror("axparms: SIOCAX25NOUID");
return 1;
}
return 0;
}
if (strcmp(argv[3], "deny") == 0) {
opt = AX25_NOUID_BLOCK;
if (ioctl(s, SIOCAX25NOUID, &opt) == -1) {
perror("axparms: SIOCAX25NOUID");
return 1;
}
return 0;
}
fprintf(stderr, "axparms: associate: 'default' or 'deny' required\n");
return 1;
}
if (argc < 4) {
usageassoc();
exit(1);
}
if (ax25_aton_entry(argv[2], (char *)&sax25.sax25_call) == -1) {
fprintf(stderr, "axparms: associate: invalid callsign %s\n", argv[2]);
return 1;
}
if (strcmp(argv[3], "delete") == 0) {
if (ioctl(s, SIOCAX25DELUID, &sax25) == -1) {
perror("axparms: SIOCAX25DELUID");
return 1;
}
return 0;
}
if ((pw = getpwnam(argv[3])) == NULL) {
fprintf(stderr, "axparms: associate: unknown username %s\n", argv[3]);
return 1;
}
sax25.sax25_uid = pw->pw_uid;
if (ioctl(s, SIOCAX25ADDUID, &sax25) == -1) {
perror("axparms: SIOCAX25ADDUID");
return 1;
}
return 0;
}
int forward(int s, int argc, char *argv[])
{
#ifdef HAVE_AX25_FWD_STRUCT
struct ax25_fwd_struct ax25_fwd;
char *addr;
if (argc < 4) {
usageforward();
exit(1);
}
if (ax25_config_load_ports() == 0) {
fprintf(stderr, "axparms: no AX.25 port data configured\n");
return 1;
}
if ((addr = ax25_config_get_addr(argv[2])) == NULL) {
fprintf(stderr, "axparms: invalid port name - %s\n", argv[2]);
return 1;
}
if (ax25_aton_entry(addr, (char *)&ax25_fwd.port_from) == -1) {
fprintf(stderr, "axparms: invalid port name - %s\n", argv[2]);
return 1;
}
if (strcmp(argv[3], "delete") == 0) {
if (ioctl(s, SIOCAX25DELFWD, &ax25_fwd) == -1) {
perror("axparms: SIOCAX25DELFWD");
return 1;
}
return 0;
}
if ((addr = ax25_config_get_addr(argv[3])) == NULL) {
fprintf(stderr, "axparms: invalid port name - %s\n", argv[3]);
return 1;
}
if (ax25_aton_entry(addr, (char *)&ax25_fwd.port_to) == -1) {
fprintf(stderr, "axparms: invalid port name - %s\n", argv[3]);
return 1;
}
if (ioctl(s, SIOCAX25ADDFWD, &ax25_fwd) == -1) {
perror("axparms: SIOCAX25ADDFWD");
return 1;
}
#else
fprintf(stderr, "axparms: Not compiled in with forwarding option.\n");
#endif /* HAVE_AX25_FWD_STRUCT */
return 0;
}
int main(int argc, char **argv)
{
ax25_address callsign;
int s, n;
char *addr;
if (argc == 1) {
usage();
return 1;
}
if (strncmp(argv[1], "--v", 3) == 0 || strncmp(argv[1], "-v", 2) == 0) {
printf("axparms: %s\n", VERSION);
return 0;
}
if (strncmp(argv[1], "--a", 3) == 0 || strncmp(argv[1], "-a", 2) == 0) {
if (argc < 3) {
usageassoc();
return 1;
}
if ((s = socket(AF_AX25, SOCK_SEQPACKET, 0)) < 0) {
perror("axparms: socket");
return 1;
}
n = associate(s, argc, argv);
close(s);
return n;
}
if (strncmp(argv[1], "--f", 3) == 0 || strncmp(argv[1], "-f", 2) == 0) {
if (argc == 2) {
usageforward();
return 1;
}
if ((s = socket(AF_AX25, SOCK_SEQPACKET, 0)) < 0) {
perror("axparms: socket");
return 1;
}
n = forward(s, argc, argv);
close(s);
return n;
}
if (strncmp(argv[1], "--r", 3) == 0 || strncmp(argv[1], "-r", 2) == 0) {
if (argc < 3 ) {
usageroute();
return 1;
}
if (strcmp(argv[2], "add") != 0 && strcmp(argv[2], "del") != 0 && strcmp(argv[2], "list") != 0) {
usageroute();
return 1;
}
if (argc < 5 && strcmp(argv[2], "list") != 0) {
usageroute();
return 1;
}
if (ax25_config_load_ports() == 0) {
fprintf(stderr, "axparms: no AX.25 port data configured\n");
return 1;
}
if ((addr = ax25_config_get_addr(argv[3])) == NULL) {
fprintf(stderr, "axparms: invalid port name - %s\n", argv[3]);
return 1;
}
if (ax25_aton_entry(addr, callsign.ax25_call) == -1)
return 1;
if ((s = socket(AF_AX25, SOCK_SEQPACKET, 0)) < 0) {
perror("axparms: socket");
return 1;
}
n = routes(s, argc, argv, &callsign);
close(s);
return n;
}
if (strncmp(argv[1], "--s", 3) == 0 || strncmp(argv[1], "-s", 2) == 0) {
if (argc != 4) {
usagesetcall();
return 1;
}
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("axparms: socket");
return 1;
}
n = setifcall(s, argv[2], argv[3]);
close(s);
return n;
}
usage();
return 1;
}
ax25-tools-0.0.10-rc4/ax25/ax25.profile 0000664 0000000 0000000 00000000046 12155142241 014001 0000000 0000000 #echo "/char ibmpc ibmpc" >.conversrc
ax25-tools-0.0.10-rc4/ax25/beacon.c 0000664 0000000 0000000 00000006753 12155142241 013246 0000000 0000000 #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
static int logging = FALSE;
static int mail = FALSE;
static int single = FALSE;
static void terminate(int sig)
{
if (logging) {
syslog(LOG_INFO, "terminating on SIGTERM\n");
closelog();
}
exit(0);
}
int main(int argc, char *argv[])
{
struct full_sockaddr_ax25 dest;
struct full_sockaddr_ax25 src;
int s, n, dlen, len, interval = 30;
char *addr, *port, *message, *portcall;
char *srccall = NULL, *destcall = NULL;
while ((n = getopt(argc, argv, "c:d:lmst:v")) != -1) {
switch (n) {
case 'c':
srccall = optarg;
break;
case 'd':
destcall = optarg;
break;
case 'l':
logging = TRUE;
break;
case 'm':
mail = TRUE;
/* falls through */
case 's':
single = TRUE;
break;
case 't':
interval = atoi(optarg);
if (interval < 1) {
fprintf(stderr, "beacon: interval must be greater than on minute\n");
return 1;
}
break;
case 'v':
printf("beacon: %s\n", VERSION);
return 0;
case '?':
case ':':
fprintf(stderr, "usage: beacon [-c ] [-d ] [-l] [-m] [-s] [-t interval] [-v] \n");
return 1;
}
}
signal(SIGTERM, terminate);
if (optind == argc || optind == argc - 1) {
fprintf(stderr, "usage: beacon [-c ] [-d ] [-l] [-m] [-s] [-t interval] [-v] \n");
return 1;
}
port = argv[optind];
message = argv[optind + 1];
if (ax25_config_load_ports() == 0) {
fprintf(stderr, "beacon: no AX.25 ports defined\n");
return 1;
}
if ((portcall = ax25_config_get_addr(port)) == NULL) {
fprintf(stderr, "beacon: invalid AX.25 port setting - %s\n", port);
return 1;
}
addr = NULL;
if (mail)
addr = strdup("MAIL");
else if (destcall != NULL)
addr = strdup(destcall);
else
addr = strdup("IDENT");
if (addr == NULL)
return 1;
if ((dlen = ax25_aton(addr, &dest)) == -1) {
fprintf(stderr, "beacon: unable to convert callsign '%s'\n", addr);
return 1;
}
if (addr != NULL) free(addr); addr = NULL;
if (srccall != NULL && strcmp(srccall, portcall) != 0) {
if ((addr = (char *) malloc(strlen(srccall) + 1 + strlen(portcall) + 1)) == NULL)
return 1;
sprintf(addr, "%s %s", srccall, portcall);
} else {
if ((addr = strdup(portcall)) == NULL)
return 1;
}
if ((len = ax25_aton(addr, &src)) == -1) {
fprintf(stderr, "beacon: unable to convert callsign '%s'\n", addr);
return 1;
}
if (addr != NULL) free(addr); addr = NULL;
if (!single) {
if (!daemon_start(FALSE)) {
fprintf(stderr, "beacon: cannot become a daemon\n");
return 1;
}
}
if (logging) {
openlog("beacon", LOG_PID, LOG_DAEMON);
syslog(LOG_INFO, "starting");
}
for (;;) {
if ((s = socket(AF_AX25, SOCK_DGRAM, 0)) == -1) {
if (logging) {
syslog(LOG_ERR, "socket: %m");
closelog();
}
return 1;
}
if (bind(s, (struct sockaddr *)&src, len) == -1) {
if (logging) {
syslog(LOG_ERR, "bind: %m");
closelog();
}
return 1;
}
if (sendto(s, message, strlen(message), 0, (struct sockaddr *)&dest, dlen) == -1) {
if (logging) {
syslog(LOG_ERR, "sendto: %m");
closelog();
}
return 1;
}
close(s);
if (!single)
sleep(interval * 60);
else
break;
}
return 0;
}
ax25-tools-0.0.10-rc4/ax25/ax25d.8 0000664 0000000 0000000 00000002361 12155142241 012656 0000000 0000000 .TH AX25D 8 "27 August 1996" Linux "Linux System Managers Manual"
.SH NAME
ax25d \- General purpose AX.25, NET/ROM and Rose daemon
.SH SYNOPSIS
.B ax25d [-v] [-c altconffile] [-l]
.SH DESCRIPTION
.LP
.B Ax25d
is a general purpose server daemon that listens on a number of AX.25, NET/ROM
and Rose ports and offers different services depending upon port, callsign
and other parameters.
.B Ax25d
is driven by a complex configuration file, a full description of which may
be found in another manual page.
.sp 1
.B AX25d
has the facility to log information about incoming connections to the
system log file. By default no logging is done. When
.B ax25d
is running, and a change in the configuration file is made,
.B ax25d
can be forced to re-read its configuration file by sending it a SIGHUP.
.SH OPTIONS
.TP 15
.BI "\-c altconffile"
Specifies an alternate configuration file name.
.TP 15
.BI \-l
Specifies that messages should be logged into the system log file. By default
no messages are logged.
.TP 15
.BI \-v
Display the version.
.SH FILES
.LP
/etc/ax25/ax25d.conf
.SH "SEE ALSO"
.BR kill (1),
.BR ax25 (4),
.BR netrom (4),
.BR rose (4),
.BR ax25d.conf (5).
.SH AUTHOR
Darryl Miles G7LED
.br
Jonathan Naylor G4KLX
ax25-tools-0.0.10-rc4/ax25/ax25d.conf.5 0000664 0000000 0000000 00000022327 12155142241 013603 0000000 0000000 .TH AX25D.CONF 5 "17 January 1997" Linux "Linux Programmer's Manual"
.SH NAME
ax25d.conf \- ax25d configuration file.
.SH DESCRIPTION
.LP
.B Ax25d.conf
controls the functioning of
.B ax25d.
Its purpose is to specify on which ports to listen on, which applications
are available, and to whom they are available to. The configuration file is
common to both AX.25, NET/ROM and Rose and their is similarity between the
two parts of the file.
.sp 1
The general layout for an entry for a given port is as follows:
.sp 1
.RS
interface control
.br
callsign entry 1
.br
.
.br
.
.br
callsign entry n
.RE
.sp 1
The
.B "interface control"
line determines which port and callsigns apply to the following
.B "callsign entry"
lines, until the next
.B "interface control"
is read. There are four different variants of the
.B "interface control"
line:
.sp 1
.RS
1. [AX.25 Port Name]
.br
2. [Callsign VIA AX.25 Port Name]
.br
3.
.br
4. {Callsign VIA Rose Port Name}
.RE
.sp 1
Version 1 allows the following
.B "callsign entry"
lines to listen on the AX.25 port specified by the AX.25 port name using the
default callsign of that AX.25 port.
.sp 1
Version 2 allows the following
.B "callsign entry"
lines to listen on the AX.25 port specified by the AX.25 port name using the
callsign specified instead of the default callsign of that AX.25 port.
Specifying a * for the AX.25 port name allows the following
.B "callsign entries"
to be valid for all the operating AX.25 ports using the callsign specified. VIA
can be abbreviated to just V. If the callsign has an asterisk appended to it
then the system will be listening on the port with the callsign, but as a
pseudo-digipeater instead of being the normal destination callsign.
.sp 1
Version 3 allows the following
.B "callsign entry"
lines to listen on the NET/ROM port specified by the NET/ROM port name using
the default callsign of that NET/ROM port.
.sp 1
Version 4 allows the following
.B "callsign entry"
lines to listen on the Rose port using the specified Rose port name using
the callsign specified as the service access point (SAP). A * may be
specified for a callsign to allow matching to any incoming Call Requests
with any SAP.
.sp 1
The
.B "callsign entry"
lines have a similar layout for both AX.25, NET/ROM and Rose, the layout is:
.sp 1
.RS
peer window t1 t2 t3 idle n2 mode uid exec args...
.RE
.sp 1
All values must be entered for all entries even when they are not used (ie
window for NET/ROM, just enter a * instead), The meanings of each of the
fields is given below. All timings apart from the idle value are given in
seconds, the idle values is given in minutes.
.RS
.TP 10
.B peer
This specifies the callsign of the remote end of the connection that should
have the following parameters and executable set up for them. The syntax of
the peer argument is explained below.
.TP 10
.B window
This sets the the value of the window size, if a value of * is entered in this
field then the default value for the port is taken from the \(lqparameters\(rq
entry (see below) or lacking such an entry, the kernel default value is used.
This entry is used by AX.25 but not by NET/ROM or Rose.
.TP 10
.B t1
This sets the the value of the T1 timer, if a value of * is entered in this
field then the default value for the port is taken from the \(lqparameters\(rq
entry (see below) or lacking such an entry, the kernel default value is used.
This entry is used by both AX.25 and NET/ROM but not by Rose.
.TP 10
.B t2
This sets the the value of the T2 timer, if a value of * is entered in this
field then the default value for the port is taken from the \(lqparameters\(rq
entry (see below) or lacking such an entry, the kernel default value is used.
This entry is used by both AX.25 and NET/ROM but not by Rose.
.TP 10
.B t3
This sets the the value of the T3 timer, if a value of * is entered in this
field then the default value for the port is taken from the \(lqparameters\(rq
entry (see below) or lacking such an entry, the kernel default value is used.
This entry is used by AX.25 but not by NET/ROM or Rose.
.TP 10
.B idle
This sets the the value of the idle timer, if a value of * is entered in
this field then the default value for the port is taken from the
\(lqparameters\(rq entry (see below) or lacking such an entry, the kernel
default value is used.
.TP 10
.B n2
This sets the the value of the N2 counter, if a value of * is entered in this
field then the default value for the port is taken from the \(lqparameters\(rq
entry (see below) or lacking such an entry, the kernel default value is used.
This entry is used by both AX.25 and NET/ROM but not by Rose.
.TP 10
.B mode
This is a set of flags that control the various properties associated with
the incoming connection. The flags are single letters, may be in either
upper or lower case, and there may not be any spaces between them. If no
flags are to be specified either a 0, - or a * must be entered instead. The
valid mode flag letters are:
.RS
.TP 5
.B D
Do not allow connections that have passed via any digipeaters. AX.25 only.
.TP 5
.B L
Do not allow this station to connect, they are Locked out.
.TP 5
.B N
Check that the NET/ROM neighbour is allowed, currently unused.
.TP 5
.B Q
Do not make an entry into the log file for this connection.
.TP 5
.B V
Validate the callsign of the incoming connection, currently unused.
.RE
.TP 10
.B uid
This is the userid that the following command should run under when
executing.
.TP 10
.B exec
This is the executable that should be executed when an incoming connection
matches the criteria of both the
.B "interface control"
and the
.B "callsign entry".
.TP 10
.B args...
These are the optional arguments that are passed to the executable. All of
the arguments are passed literally apart from the following:
.RS
.TP 5
.B %d
The name of the port that the connection is on.
.TP 5
.B %U
The username (callsign) of the remote station in upper case without the SSID.
.TP 5
.B %u
The username (callsign) of the remote station in lower case without the SSID.
.TP 5
.B %S
The username (callsign) of the remote station in upper case with the SSID.
.TP 5
.B %s
The username (callsign) of the remote station in lower case with the SSID.
.TP 5
.B %P
The nodename of the remote station in upper case without the SSID.
This is only valid under NET/ROM and Rose, under AX.25 a % is substituted instead.
.TP 5
.B %p
The nodename of the remote station in lower case without the SSID.
This is only valid under NET/ROM and Rose, under AX.25 a % is substituted instead.
.TP 5
.B %R
The nodename of the remote station in upper case with the SSID.
This is only valid under NET/ROM and Rose, under AX.25 a % is substituted instead.
.TP 5
.B %r
The nodename of the remote station in lower case with the SSID.
This is only valid under NET/ROM and Rose, under AX.25 a % is substituted instead.
.TP 5
.B %%
A %.
.RE
.RE
.sp 1
The
.B peer
argument is dependant upon whether AX.25, NET/ROM or Rose is being used. There are
five formats of this argument:
.sp 1
.RS
1. default
.br
2. parameters
.br
3. callsign
.br
4. callsign@node
.br
5. @node
.RE
.sp 1
The first version is used by AX.25, NET/ROM and Rose to specify that all callsigns
on a given port are to be matched. The default line is usually the last of the
.B "callsign entry"
lines, so that more specific entries may have the chance to be matched
first.
.sp 1
The second version is not a
.B "callsign entry"
that is used by any incoming connections. It is a means to specify default
values for parameters such as Window, T1, T2, T3, Idle and N2. It is used for
both AX.25, NET/ROM and Rose.
.sp 1
The third version is used by both AX.25, NET/ROM and Rose to specify the callsign of
the remote station to match the
.B "callsign entry"
line. If no SSID is specified then the callsign will be matched with any
that has the same callsign and any SSID. Specifying an SSID causes the
callsign to be matched exactly. In the case of NET/ROM and Rose this entry does not
specify which node the originating callsign comes from.
.sp 1
The fourth version is used by NET/ROM and Rose to specify the callsign of the remote
station and the remote node to match the
.B "callsign entry"
line. If no SSID is specified in the callsign section then the callsign will
be matched with any that has the same callsign and any SSID. Specifying an
SSID causes the callsign to be matched exactly.
.sp 1
The fifth version is used by NET/ROM and Rose to specify only the address of the
remote node to match the
.B "callsign entry"
line. This entry will mean that all remote users at the given node will
match the entry.
.sp 1
Comments may be embedded in the configuration file by placing a # in the
first column.
.sp 1
ax25d can now honour AX.25 TCP/IP mode-VC connections in a special way.
Therefore, a new port specific option "parameters_extAX25" is available, with
the following options, which are seperated by space.
.TP 5
parameters_extAX25
VC-debug
.br
VC-reject-login|VC-wait-login|VC-login-ok
.br
VC-disc-on-linkfailure-msg, VC-send-failure-msg, VC-log-connections
.br
Recommended settings in ax25d.conf:
.br
parameters_extAX25 VC-wait-login VC-disc-on-linkfailure-msg VC-log-connections
.br
or
.br
parameters_extAX25 VC-reject-login VC-send-failure-msg VC-log-connections
.br
.SH FILES
.LP
/etc/ax25/ax25d.conf
.SH "SEE ALSO"
.BR ax25 (4),
.BR netrom (4),
.BR rose (4),
.BR axports (5),
.BR nrports (5),
.BR rsports (5),
.BR ax25d (8).
ax25-tools-0.0.10-rc4/ax25/axspawn.c 0000664 0000000 0000000 00000142714 12155142241 013476 0000000 0000000 /*
* axspawn.c - run a program from ax25d.
*
* Copyright (c) 1996 Joerg Reuter DL1BKE (jreuter@poboxes.com)
*
* This program is a hack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* It might even kill your cat... ;-)
*
* Status: alpha (still...)
*
* usage: change the "default" lines in your /usr/local/etc/ax25d.conf:
*
* default * * * * * 1 root /usr/local/sbin/axspawn axspawn
*
* a line like this would wait for an incoming info frame first.
*
* default * * * * * 1 root /usr/local/sbin/axspawn axspawn --wait
*
* The program will check if the peer is an AX.25 socket, the
* callsign is a valid amateur radio callsign, strip the SSID,
* check if UID/GID are valid, allow a password-less login if the
* password-entry in /etc/passwd is "+" or empty; in every other case
* login will prompt for a password.
*
* Still on my TODO list: a TheNet compatible or MD5 based
* authentication scheme... Won't help you if you changed the "+"-entry
* in /etc/passwd to a valid passord and login with telnet, though.
* A better solution could be a small program called from .profile.
*
* Axspawn can create user accounts automatically. You may specify
* the user shell, first and maximum user id, group ID in the config
* file and (unlike WAMPES) create a file "/usr/local/etc/ax25.profile"
* which will be copied to ~/.profile.
*
* This is an example for the config file:
*
* # this is /usr/local/etc/axspawn.conf
* #
* # allow automatic creation of user accounts
* create yes
*
* # allow empty password field (so user may login via telnet, or pop3 their
* # mail) [default no]
* create_empty_password no
*
* # pwcheck method: password or call or group [default: password]
* # "password" means, that passwords with '+' force a login without
* # prompting for a password (old behaviour; backward compatibility).
* # "call" means, that ham calls via ax25/netrom/rose/.. should be able
* # to login without password, even if it's set (for e.g. to secure
* # from abuse of inet connections)
* # "group" means, that if the gid of the user matches the configured
* # default user_gid, then the login is granted without password.
* #pwcheck call
* #pwcheck group
* #pwcheck password
*
* # create with system utility useradd(8)? [default no]
* create_with_useradd no
*
* # guest user if above is 'no' or everything else fails. Disable with "no"
* guest ax25
*
* # group id or name for autoaccount
* group ax25
*
* # first user id to use
* first_uid 400
*
* # maximum user id
* max_uid 2000
*
* # where to add the home directory for the new user
* home /home/hams
*
* # secure homedirectories (g-rwx)
* #secure_home yes
*
* # user's shell
* shell /bin/bash
*
* # bind user id to callsign for outgoing connects.
* associate yes
*
* SECURITY:
*
* Umm... auto accounting is a security problem by definition. Unlike
* WAMPES, which creates an empty password field, Axspawn adds an
* "impossible" ('+') password to /etc/passwd. Login gets called with
* the "-f" option, thus new users have the chance to login without
* a password. (I guess this won't work with the shadow password system).
* News: there are good reasons to use empty password fields. For e.g.
* at our mailbox-system db0tud where we have no inet access, so
* every user is a ham, not a hacker. We need the empty password
* so new may use ax25 for automatical account generation, and then
* could login via telnet or poll their mail with pop3.
* But i acknowledge, that this package will mostly used by hams who
* use their computer for both, inet and ampr. So the new option
* create_empty_password is not the default, but a feature
* needed because we won't patch this code after a new release.
* the useradd method and compression implementation is the the work
* of thomas , the finetune is by me. GPL
* the compression code initialy was for tnt by dl4ybg (GPL).
* - dl9sau for db0tud team.
*
* The "associate" option has to be used with great care. If a user
* logs on it removes any existing callsign from the translation table
* for this userid and replaces it with the callsign and SSID of the
* user. This will happen with multiple connects (same callsign,
* different SSIDs), too. Unless you want your users to be able
* to call out from your machine disable "associate".
*
* Of course Axspawn does callsign checking: Only letters and numbers
* are allowed, the callsign must be longer than 4 characters and
* shorter than 6 characters (without SSID). There must be at least
* one digit, and max. two digits within the call. The SSID must
* be within the range of 0 and 15. Please drop me a note if you
* know a valid Amateur Radio (sic!) callsign that does not fit this
* pattern _and_ can be represented correctly in AX.25.
*
* It uses the forkpty from libbsd.a (found after analyzing logind)
* which has no prototype in any of my .h files.
*
*/
/* removed -h from login command as it was causing hostname lookups
with new login/libc - Terry, vk2ktj. */
/*#define QUEUE_DELAY 400 / * 400 usec */
#define QUEUE_DELAY 100000 /* 10 msec */
#define USERPROFILE ".profile"
#define PASSWDFILE "/etc/passwd"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "../pathnames.h"
#include "axspawn.h"
#include "access.h"
#define MAXLEN strlen("DB0PRA-15")
#define MINLEN strlen("KA9Q")
#define AX_PACLEN 256
#define NETROM_PACLEN 236
#define ROSE_PACLEN 128
#define IS_DIGIT(x) ( (x >= '0') && (x <= '9') )
#define IS_LETTER(x) ( (x >= 'A') && (x <= 'Z') )
#define MSG_NOCALL "Sorry, you are not allowed to connect.\n"
#define MSG_CANNOTFORK "Sorry, system is overloaded.\n"
#define MSG_NOPTY "Sorry, all channels in use.\n"
#define MSG_NOTINDBF "Sorry, you are not in my database.\n"
#define write_ax25_static_line(s) { \
char *msg = strdup(s); \
if (msg) { \
write_ax25(msg, strlen(msg), 1); \
free(msg); \
} \
}
#define EXITDELAY 10
#define USERADD_CONF "/etc/default/useradd"
struct huffencodtab {
unsigned short code;
unsigned short len;
};
struct huffdecodtab {
unsigned short node1;
unsigned short node2;
};
/* huffman encoding table */
static struct huffencodtab huffencodtab[] = {
{0xab2c,15},{0xaa84,15},{0x9fc4,15},{0xab3c,15},
{0xab1c,15},{0xaafc,15},{0xaaec,15},{0xaad4,15},
{0xaab4,15},{0xf340,10},{0xaaa4,15},{0x7d64,15},
{0xaadc,15},{0xf400, 7},{0xaa94,15},{0x9ff4,15},
{0x9fd4,15},{0x7d74,15},{0xab44,15},{0xab34,15},
{0xab24,15},{0xab14,15},{0xab04,15},{0xaaf4,15},
{0xaae4,15},{0xab60,14},{0xab0c,15},{0xaacc,15},
{0xaabc,15},{0xaaac,15},{0xaa9c,15},{0xaa8c,15},
{0xc000, 3},{0x3a80, 9},{0xabc0,10},{0x0060,11},
{0x7d40,12},{0xab5c,14},{0x0000,12},{0xab58,14},
{0x7c00, 9},{0x3c80, 9},{0x7d00,11},{0x0010,12},
{0x1200, 7},{0x7a00, 7},{0xb800, 6},{0x3200, 7},
{0x2200, 7},{0xf600, 8},{0x3d00, 8},{0x9e00, 9},
{0xbd80, 9},{0x7c80, 9},{0x0080, 9},{0xaa00, 9},
{0xbd00, 9},{0x9f00, 9},{0x0300, 8},{0xab78,13},
{0xab68,13},{0x3c00, 9},{0x3000, 9},{0x0020,11},
{0x7d50,12},{0x3800, 7},{0x7800, 7},{0x9c00, 7},
{0xfe00, 7},{0x2400, 6},{0xbc00, 8},{0x0200, 8},
{0x0100, 8},{0xf100, 8},{0x0040,11},{0x3100, 8},
{0xf200, 8},{0x3400, 7},{0x1c00, 7},{0x1e00, 7},
{0xbe00, 7},{0xaba0,11},{0x3e00, 7},{0x1400, 6},
{0x3600, 7},{0xf380, 9},{0xf080, 9},{0x2000, 8},
{0xfc00, 8},{0x9f80,10},{0x9e80, 9},{0xab90,12},
{0x3b80, 9},{0xab80,12},{0xab54,14},{0x3a50,13},
{0xab50,14},{0xa000, 5},{0x1800, 6},{0x9800, 6},
{0x7000, 5},{0x4000, 3},{0x0400, 6},{0xac00, 6},
{0xf800, 6},{0x6000, 4},{0x3a00,10},{0xfd00, 8},
{0x2800, 5},{0xb000, 6},{0x8000, 4},{0xb400, 6},
{0x1000, 7},{0x7d20,12},{0xe000, 5},{0x9000, 5},
{0xe800, 5},{0x0800, 5},{0xf700, 8},{0xa800, 7},
{0x7d80, 9},{0xf300,10},{0x7e00, 7},{0xab48,14},
{0x3a48,13},{0xab4c,14},{0x3a60,12},{0x9ffc,15},
{0x9fec,15},{0x2100, 8},{0x9fdc,15},{0x9fcc,15},
{0xf000, 9},{0x7d7c,15},{0x7d6c,15},{0x3a40,14},
{0xab40,15},{0xab38,15},{0xab30,15},{0xab28,15},
{0xab20,15},{0xab18,15},{0xab70,13},{0xab10,15},
{0xab08,15},{0xab00,15},{0xaaf8,15},{0xaaf0,15},
{0x3b00, 9},{0xaae8,15},{0xaae0,15},{0xaad8,15},
{0xaad0,15},{0xab64,14},{0x7d30,12},{0xaac8,15},
{0xaac0,15},{0xaab8,15},{0xaab0,15},{0xaaa8,15},
{0xaaa0,15},{0xaa98,15},{0xaa90,15},{0xaa88,15},
{0xaa80,15},{0x9ff8,15},{0x9ff0,15},{0x9fe8,15},
{0x9fe0,15},{0x9fd8,15},{0x9fd0,15},{0x9fc8,15},
{0x9fc0,15},{0x7d78,15},{0x7d70,15},{0x3a58,13},
{0x7d68,15},{0x7d60,15},{0xab46,15},{0xab42,15},
{0xab3e,15},{0xab3a,15},{0xab36,15},{0xab32,15},
{0xab2e,15},{0xab2a,15},{0xab26,15},{0xab22,15},
{0xab1e,15},{0xab1a,15},{0xab16,15},{0xab12,15},
{0xab0e,15},{0xab0a,15},{0xab06,15},{0xab02,15},
{0xaafe,15},{0xaafa,15},{0xaaf6,15},{0xaaf2,15},
{0xaaee,15},{0xaaea,15},{0xaae6,15},{0xaae2,15},
{0xaade,15},{0xaada,15},{0xaad6,15},{0xaad2,15},
{0xaace,15},{0xaaca,15},{0xaac6,15},{0xaac2,15},
{0xaabe,15},{0xaaba,15},{0xaab6,15},{0xaab2,15},
{0xaaae,15},{0xaaaa,15},{0xaaa6,15},{0xaaa2,15},
{0xaa9e,15},{0x3a70,12},{0xaa9a,15},{0xaa96,15},
{0xaa92,15},{0x3080, 9},{0xaa8e,15},{0xaa8a,15},
{0xaa86,15},{0xaa82,15},{0x9ffe,15},{0x9ffa,15},
{0x9ff6,15},{0x9ff2,15},{0x9fee,15},{0x9fea,15},
{0x9fe6,15},{0x9fe2,15},{0x9fde,15},{0x9fda,15},
{0x9fd6,15},{0x9fd2,15},{0x9fce,15},{0x9fca,15},
{0x9fc6,15},{0x9fc2,15},{0x7d7e,15},{0x7d7a,15},
{0x7d76,15},{0x7d72,15},{0x7d6e,15},{0x7d6a,15},
{0x7d66,15},{0x7d62,15},{0x3a46,15},{0x3a44,15}
};
/* huffman decoding table */
static struct huffdecodtab huffdecodtab[] = {
{ 79, 1},{ 2, 66},{ 24, 3},{ 4,208},
{292, 5},{ 6,298},{317, 7},{ 16, 8},
{ 9,173},{ 10,116},{ 41, 11},{ 12, 37},
{125, 13},{357, 14},{ 15,438},{ 0, 0},
{229, 17},{ 18, 46},{ 19, 61},{ 20, 99},
{ 21,161},{404, 22},{ 23,483},{ 1, 0},
{306, 25},{313, 26},{294, 27},{245, 28},
{221, 29},{231, 30},{277, 31},{ 32,103},
{ 33,108},{ 34,339},{421, 35},{ 36,500},
{ 2, 0},{122, 38},{353, 39},{ 40,434},
{ 3, 0},{131, 42},{128, 43},{361, 44},
{ 45,442},{ 4, 0},{ 56, 47},{ 52, 48},
{135, 49},{370, 50},{ 51,450},{ 5, 0},
{138, 53},{375, 54},{ 55,454},{ 6, 0},
{148, 57},{ 58, 94},{381, 59},{ 60,460},
{ 7, 0},{ 75, 62},{ 63,152},{392, 64},
{ 65,469},{ 8, 0},{164, 67},{311, 68},
{ 69,246},{ 70, 97},{253, 71},{257, 72},
{ 73,270},{319, 74},{ 9, 0},{ 76,155},
{396, 77},{ 78,473},{ 10, 0},{165, 80},
{296, 81},{300, 82},{295, 83},{206, 84},
{ 85,320},{193, 86},{ 87,318},{199, 88},
{184, 89},{ 90,112},{ 91,346},{430, 92},
{ 93,508},{ 11, 0},{379, 95},{ 96,458},
{ 12, 0},{ 98,218},{ 13, 0},{100,158},
{400,101},{102,478},{ 14, 0},{331,104},
{105,328},{408,106},{107,487},{ 15, 0},
{109,336},{417,110},{111,496},{ 16, 0},
{113,343},{425,114},{115,504},{ 17, 0},
{117,141},{118,186},{119,321},{351,120},
{121,432},{ 18, 0},{355,123},{124,436},
{ 19, 0},{359,126},{127,440},{ 20, 0},
{364,129},{130,444},{ 21, 0},{132,145},
{368,133},{134,448},{ 22, 0},{372,136},
{137,452},{ 23, 0},{377,139},{140,456},
{ 24, 0},{142,234},{143,236},{144,383},
{ 25, 0},{366,146},{147,446},{ 26, 0},
{387,149},{385,150},{151,462},{ 27, 0},
{390,153},{154,467},{ 28, 0},{394,156},
{157,471},{ 29, 0},{398,159},{160,475},
{ 30, 0},{402,162},{163,481},{ 31, 0},
{ 32, 0},{175,166},{214,167},{211,168},
{169,195},{243,170},{171,281},{286,172},
{ 33, 0},{265,174},{ 34, 0},{176,202},
{177,315},{178,297},{179,232},{180,252},
{181,228},{189,182},{255,183},{ 35, 0},
{185,242},{ 36, 0},{284,187},{192,188},
{ 37, 0},{190,241},{191,201},{ 38, 0},
{ 39, 0},{194,227},{ 40, 0},{196,267},
{197,220},{237,198},{ 41, 0},{200,309},
{ 42, 0},{ 43, 0},{203,260},{204,268},
{308,205},{ 44, 0},{244,207},{ 45, 0},
{304,209},{210,223},{ 46, 0},{212,258},
{238,213},{ 47, 0},{215,303},{216,249},
{273,217},{ 48, 0},{219,316},{ 49, 0},
{ 50, 0},{222,278},{ 51, 0},{224,264},
{250,225},{230,226},{ 52, 0},{ 53, 0},
{ 54, 0},{ 55, 0},{ 56, 0},{ 57, 0},
{251,233},{ 58, 0},{363,235},{ 59, 0},
{ 60, 0},{ 61, 0},{239,256},{240,480},
{ 62, 0},{ 63, 0},{ 64, 0},{ 65, 0},
{ 66, 0},{ 67, 0},{299,247},{275,248},
{ 68, 0},{ 69, 0},{ 70, 0},{ 71, 0},
{ 72, 0},{271,254},{ 73, 0},{ 74, 0},
{ 75, 0},{ 76, 0},{259,269},{ 77, 0},
{293,261},{262,263},{ 78, 0},{ 79, 0},
{ 80, 0},{279,266},{ 81, 0},{ 82, 0},
{ 83, 0},{ 84, 0},{ 85, 0},{342,272},
{ 86, 0},{274,335},{ 87, 0},{276,302},
{ 88, 0},{ 89, 0},{ 90, 0},{283,280},
{ 91, 0},{374,282},{ 92, 0},{ 93, 0},
{291,285},{ 94, 0},{301,287},{288,326},
{323,289},{290,427},{ 95, 0},{ 96, 0},
{ 97, 0},{ 98, 0},{ 99, 0},{100, 0},
{101, 0},{102, 0},{103, 0},{104, 0},
{105, 0},{106, 0},{107, 0},{108, 0},
{305,307},{109, 0},{110, 0},{111, 0},
{112, 0},{310,384},{113, 0},{312,314},
{114, 0},{115, 0},{116, 0},{117, 0},
{118, 0},{119, 0},{120, 0},{121, 0},
{122, 0},{322,325},{123, 0},{349,324},
{124, 0},{125, 0},{327,476},{126, 0},
{406,329},{330,485},{127, 0},{412,332},
{410,333},{334,489},{128, 0},{129, 0},
{415,337},{338,494},{130, 0},{419,340},
{341,498},{131, 0},{132, 0},{423,344},
{345,502},{133, 0},{428,347},{348,506},
{134, 0},{350,510},{135, 0},{352,433},
{136, 0},{354,435},{137, 0},{356,437},
{138, 0},{358,439},{139, 0},{360,441},
{140, 0},{362,443},{141, 0},{142, 0},
{365,445},{143, 0},{367,447},{144, 0},
{369,449},{145, 0},{371,451},{146, 0},
{373,453},{147, 0},{148, 0},{376,455},
{149, 0},{378,457},{150, 0},{380,459},
{151, 0},{382,461},{152, 0},{153, 0},
{154, 0},{386,463},{155, 0},{388,464},
{389,466},{156, 0},{391,468},{157, 0},
{393,470},{158, 0},{395,472},{159, 0},
{397,474},{160, 0},{399,477},{161, 0},
{401,479},{162, 0},{403,482},{163, 0},
{405,484},{164, 0},{407,486},{165, 0},
{409,488},{166, 0},{411,490},{167, 0},
{413,491},{414,493},{168, 0},{416,495},
{169, 0},{418,497},{170, 0},{420,499},
{171, 0},{422,501},{172, 0},{424,503},
{173, 0},{426,505},{174, 0},{175, 0},
{429,507},{176, 0},{431,509},{177, 0},
{178, 0},{179, 0},{180, 0},{181, 0},
{182, 0},{183, 0},{184, 0},{185, 0},
{186, 0},{187, 0},{188, 0},{189, 0},
{190, 0},{191, 0},{192, 0},{193, 0},
{194, 0},{195, 0},{196, 0},{197, 0},
{198, 0},{199, 0},{200, 0},{201, 0},
{202, 0},{203, 0},{204, 0},{205, 0},
{206, 0},{207, 0},{208, 0},{209, 0},
{ 0,465},{210, 0},{211, 0},{212, 0},
{213, 0},{214, 0},{215, 0},{216, 0},
{217, 0},{218, 0},{219, 0},{220, 0},
{221, 0},{222, 0},{223, 0},{224, 0},
{225, 0},{226, 0},{227, 0},{228, 0},
{229, 0},{230, 0},{231, 0},{232, 0},
{233, 0},{234, 0},{235, 0},{ 0,492},
{236, 0},{237, 0},{238, 0},{239, 0},
{240, 0},{241, 0},{242, 0},{243, 0},
{244, 0},{245, 0},{246, 0},{247, 0},
{248, 0},{249, 0},{250, 0},{251, 0},
{252, 0},{253, 0},{512,511},{254, 0},
{255, 0}
};
static unsigned char mask8tab[8] = {
0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01
};
static unsigned short mask16tab[16] = {
0x8000,0x4000,0x2000,0x1000,0x0800,0x0400,0x0200,0x0100,
0x0080,0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001
};
char policy_add_user = 1;
char policy_add_empty_password = 0;
char policy_add_prog_useradd = 0;
char policy_guest = 1;
char policy_associate = 0;
char pwcheck = 1;
char secure_home = 0;
gid_t user_gid = 400;
char *user_shell = "/bin/bash";
char *start_home = "/home/hams";
char *guest = "guest";
int start_uid = 400;
int end_uid = 65535;
int paclen = ROSE_PACLEN; /* Its the shortest ie safest */
int huffman = 0;
int bin = 0;
int fdmaster;
struct write_queue {
struct write_queue *next;
char *data;
unsigned int len;
};
struct write_queue *wqueue_head = NULL;
struct write_queue *wqueue_tail = NULL;
long wqueue_length = 0L;
int encstathuf(char *src, int srclen, char *dest, int *destlen);
int decstathuf(char *src, char *dest, int srclen, int *destlen);
/*---------------------------------------------------------------------------*/
/* Use private function because some platforms are broken, eg 386BSD */
int Xtolower(int c)
{
return (c >= 'A' && c <= 'Z') ? (c - 'A' + 'a') : c;
}
/*---------------------------------------------------------------------------*/
/* Use private function because some platforms are broken, eg 386BSD */
int Xtoupper(int c)
{
return (c >= 'a' && c <= 'z') ? (c - 'a' + 'A') : c;
}
/*---------------------------------------------------------------------------*/
int Strcasecmp(const char *s1, const char *s2)
{
while (Xtolower(*s1) == Xtolower(*s2)) {
if (!*s1) return 0;
s1++;
s2++;
}
return Xtolower(*s1) - Xtolower(*s2);
}
/*---------------------------------------------------------------------------*/
int Strncasecmp(const char *s1, const char *s2, int n)
{
while (--n >= 0 && Xtolower(*s1) == Xtolower(*s2)) {
if (!*s1) return 0;
s1++;
s2++;
}
return n < 0 ? 0 : Xtolower(*s1) - Xtolower(*s2);
}
/* This one is in /usr/lib/libbsd.a, but not in bsd.h and fellows... weird. */
/* (found in logind.c) */
pid_t forkpty(int *, char *, void *, struct winsize *);
/* The buffer in src (first byte length-1) is decoded into dest
(first byte length-1). If decoding is not successful, non-0
is returned
*/
int encstathuf(char *src, int srclen, char *dest, int *destlen)
{
char *srcptr;
char *destptr;
int wrklen;
int bit16;
int bit8;
unsigned short huffcode;
int hufflen;
if ((src == NULL) || (dest == NULL)) {
syslog(LOG_NOTICE, "Huffman encode: src or dest NULL!");
return(1);
}
if (srclen > 255) {
syslog(LOG_NOTICE, "Huffman encode: srclen > 255: %d", srclen);
return(1);
}
srcptr = src;
destptr = &dest[1];
*destlen = 0;
wrklen = 0;
bit8 = 0;
*destptr = 0;
huffcode = huffencodtab[(int)*srcptr].code;
hufflen = huffencodtab[(int)*srcptr].len;
bit16 = 0;
for (;;) {
if (huffcode & mask16tab[bit16])
*destptr |= mask8tab[bit8];
bit8++;
if (bit8 > 7) {
destptr++;
(*destlen)++;
if ((*destlen) >= srclen) {
/* coding uneffective, use copy */
memcpy(&dest[1],src,srclen);
dest[0] = 255;
*destlen = srclen + 1;
return(0);
}
bit8 = 0;
*destptr = 0;
}
bit16++;
if (bit16 == hufflen) {
srcptr++;
wrklen++;
if (wrklen == srclen) break;
huffcode = huffencodtab[(int)*srcptr].code;
hufflen = huffencodtab[(int)*srcptr].len;
bit16 = 0;
}
}
if (bit8 != 0) (*destlen)++;
(*destlen)++;
dest[0] = (char)(srclen-1);
return(0);
}
/* The buffer in src (first byte length-1) is decoded into dest
(first byte length-1). If decoding is not successful, non-0
is returned
*/
int decstathuf(char *src, char *dest, int srclen, int *destlen)
{
unsigned char *srcptr;
unsigned char *destptr;
int wrklen;
unsigned char bitmask;
unsigned short decod;
unsigned short newnode;
if ((src == NULL) || (dest == NULL)) return(1);
srcptr = src;
destptr = dest;
*destlen = (int)((*srcptr)+1);
srcptr++;
if (--srclen == 0) {
return(1);
}
if (*destlen == 0) {
return(1);
}
if (*destlen == 256) {
/* no compression, only copy */
memcpy(dest,src+1,srclen);
*destlen = (unsigned char)(srclen);
return(0);
}
wrklen = 0;
decod = 0;
bitmask = 0x80;
for (;;) {
while (bitmask > 0) {
if ((*srcptr) & bitmask) {
newnode = huffdecodtab[decod].node2;
if (newnode == 0) {
*destptr = (char)huffdecodtab[decod].node1;
destptr++;
wrklen++;
if (wrklen >= *destlen) break; /* decoding finished */
decod = 0;
}
else decod = newnode;
}
else {
newnode = huffdecodtab[decod].node1;
if (huffdecodtab[decod].node2 == 0) {
*destptr = (char)huffdecodtab[decod].node1;
destptr++;
wrklen++;
if (wrklen >= *destlen) break; /* decoding finished */
decod = 0;
}
else decod = newnode;
}
if (decod) bitmask = bitmask >> 1;
}
if (wrklen >= *destlen) break;
bitmask = 0x80;
srcptr++;
if (srclen == 0) return(1);
srclen--;
}
return(0);
}
int _write_ax25(const char *s, int len)
{
int i;
if (!len)
return 0;
i = write(1, s, len);
fflush(stdout);
return (i > 0 ? i : 0); /* on error, -1 is returned */
}
int read_ax25(unsigned char *s, int size)
{
int len;
int k;
char buffer[255];
char decomp[260];
int declen;
struct termios termios;
if ((len = read(0, s, size)) < 0)
return len;
if (huffman) {
if (!decstathuf(s, decomp, len, &declen)) {
*(decomp+declen) = 0;
strcpy(s, decomp);
len = declen;
}
}
if (bin) {
return(len);
}
for (k = 0; k < len; k++)
if (s[k] == '\r') s[k] = '\n';
if (!huffman && !Strncasecmp(s, "//COMP ON\n", 10)) {
sprintf(buffer,"\r//COMP 1\r");
write_ax25(buffer, strlen(buffer), 1);
sleep(1);
memset((char *) &termios, 0, sizeof(termios));
termios.c_iflag = ICRNL | IXOFF | IGNBRK;
termios.c_oflag = 0;
termios.c_cflag = CS8 | CREAD | CLOCAL;
termios.c_lflag = 0;
termios.c_cc[VMIN] = 0;
termios.c_cc[VTIME] = 0;
tcsetattr(0, TCSANOW, &termios);
huffman = 1;
strcpy(s,"\n");
return 1;
}
if (huffman && !Strncasecmp(s, "//COMP OFF\n", 11)) {
sprintf(buffer,"\r//COMP 0\r"); fflush(stdout);
write_ax25(buffer, strlen(buffer), 1);
sleep(1);
huffman = 0;
memset((char *) &termios, 0, sizeof(termios));
termios.c_iflag = ICRNL | IXOFF;
termios.c_oflag = OPOST | ONLCR;
termios.c_cflag = CS8 | CREAD | CLOCAL;
termios.c_lflag = ISIG | ICANON;
termios.c_cc[VINTR] = 127;
termios.c_cc[VQUIT] = 28;
termios.c_cc[VERASE] = 8;
termios.c_cc[VKILL] = 24;
termios.c_cc[VEOF] = 4;
cfsetispeed(&termios, B19200);
cfsetospeed(&termios, B19200);
tcsetattr(0, TCSANOW, &termios);
strcpy(s,"\n");
return 1;
}
return len;
}
/*
* We need to buffer the data from the pipe since bash does
* a fflush() on every output line. We don't want it, it's
* PACKET radio, isn't it?
*/
void kick_wqueue(int dummy)
{
char *s, *p;
struct write_queue *w_buf, *new_head;
char *q, *r;
int i;
int len, curr_len;
struct itimerval itv;
int bufsize = (huffman ? 256-1 : paclen);
char decoded[260];
int declen;
signal(SIGALRM, SIG_IGN);
itv.it_value.tv_sec = 0;
itv.it_value.tv_usec = QUEUE_DELAY;
for (;;) {
if (wqueue_length == 0) {
return;
}
/* recompute waitqueue */
if (wqueue_head->len < bufsize && wqueue_head->next) {
int s_len;
if (!(s = malloc(bufsize))) {
break;
}
if (!(new_head = malloc(sizeof(struct write_queue)))) {
free(s);
break;
}
p = s;
s_len = 0;
while ((w_buf = wqueue_head)) {
curr_len = (w_buf->len > bufsize-s_len ? bufsize-s_len : w_buf->len);
memcpy(p, w_buf->data, curr_len);
s_len += curr_len;
p += curr_len;
if (w_buf->len > curr_len) {
/* rewrite current buffer, and break */
w_buf->len -= curr_len;
for (q = w_buf->data, r = w_buf->data+curr_len, i = 0; i < w_buf->len; i++)
*q++ = *r++;
break;
}
wqueue_head = w_buf->next;
free(w_buf->data);
free(w_buf);
}
new_head->data = s;
new_head->len = s_len;
new_head->next = wqueue_head;
wqueue_head = new_head;
}
w_buf = wqueue_head;
curr_len = w_buf->len > bufsize ? bufsize : w_buf->len;
if (huffman && !encstathuf(w_buf->data,curr_len,decoded,&declen)) {
*(decoded+declen) = 0;
s = decoded;
len = declen;
} else {
s = w_buf->data;
len = curr_len;
}
if (!_write_ax25(s, len) && errno == EAGAIN) {
/*
* socket busy?
* don't block, user may want interrupt the jam
*/
itv.it_value.tv_sec = 1;
break;
}
wqueue_length -= curr_len;
if (w_buf->len > curr_len) {
/*
* there's still data to be written - copy restbuffer
* to left
*/
w_buf->len -= curr_len;
for (q = w_buf->data, r = w_buf->data+curr_len, i = 0; i < w_buf->len; i++)
*q++ = *r++;
} else {
wqueue_head = w_buf->next;
free(w_buf->data);
free(w_buf);
if (!wqueue_head) {
wqueue_tail = NULL;
return;
}
}
/*
* if only a few bytes are left, wait a few ms if
* new data is available in order to send "full packets"
*/
if (wqueue_length < paclen)
break;
}
itv.it_interval.tv_sec = 0;
itv.it_interval.tv_usec = 0;
setitimer(ITIMER_REAL, &itv, 0);
signal(SIGALRM, kick_wqueue);
}
int write_ax25(char *s, int len, int kick)
{
struct itimerval itv, oitv;
struct write_queue * buf;
struct termios termios;
static struct termios save_termios;
static struct termios save_termios_master;
static int last_ended_with_CR = 0;
int i = 0;
int j = 0;
char *p;
if (!len)
return 0;
signal(SIGALRM, SIG_IGN);
if (!bin && !strncmp(s, "//BIN ON\r", 9)) {
tcgetattr(fdmaster, &save_termios_master);
tcgetattr(0, &save_termios);
memset((char *) &termios, 0, sizeof(termios));
termios.c_iflag = IGNBRK | IGNPAR;
termios.c_oflag = 0;
termios.c_cflag = CBAUD | CS8 | CREAD | CLOCAL;
termios.c_cflag = ~(CSTOPB|PARENB|PARODD|HUPCL);
termios.c_lflag = 0;
termios.c_cc[VMIN] = 1;
termios.c_cc[VTIME] = 0;
termios.c_cc[VSTART] = -1;
termios.c_cc[VSTOP] = -1;
tcsetattr(0, TCSANOW, &termios);
tcsetattr(fdmaster, TCSANOW, &termios);
*s= 0; len=0;
bin = 1;
kick_wqueue(0);
return 0;
}
if (bin && !strncmp(s, "//BIN OFF\r", 10)) {
kick_wqueue(0);
bin = 0;
tcsetattr(fdmaster, TCSANOW, &save_termios_master);
tcsetattr(0, TCSANOW, &save_termios);
last_ended_with_CR = 0;
return 0;
}
if (!bin) {
p = s; i = 0; j = 0;
if (last_ended_with_CR) {
/*
* \r\n was splited. wrote already \r, now ommiting \n
*/
if (*s == '\n') {
s++, p++;
len--;
}
last_ended_with_CR = 0;
if (!len) {
if (wqueue_head)
kick_wqueue(0);
return 0;
}
}
while (j < len) {
if ((j + 1 < len) && *(p + j) == '\r' && *(p + j + 1) == '\n') {
*(p + i) = '\r';
j++;
}
else
*(p + i) = *(p + j);
i++; j++;
}
len = i;
if (len && s[len-1] == '\r')
last_ended_with_CR = 1;
*(p+len) = 0;
}
buf = (struct write_queue *) malloc(sizeof(struct write_queue));
if (buf == NULL)
return 0;
buf->data = (char *) malloc(len);
if (buf->data == NULL) {
free(buf);
return 0;
}
memcpy(buf->data, s, len);
buf->len = len;
buf->next = NULL;
if (wqueue_head == NULL)
{
wqueue_head = buf;
wqueue_tail = buf;
wqueue_length = len;
} else {
wqueue_tail->next = buf;
wqueue_tail = buf;
wqueue_length += len;
}
if (wqueue_length > 7*paclen || kick || bin)
{
kick_wqueue(0);
} else {
itv.it_interval.tv_sec = 0;
itv.it_interval.tv_usec = 0;
itv.it_value.tv_sec = 0;
itv.it_value.tv_usec = QUEUE_DELAY;
setitimer(ITIMER_REAL, &itv, &oitv);
signal(SIGALRM, kick_wqueue);
}
return len;
}
int get_assoc(struct sockaddr_ax25 *sax25)
{
FILE *fp;
int uid;
char buf[81];
fp = fopen(PROC_AX25_CALLS_FILE, "r");
if (!fp) return -1;
fgets(buf, sizeof(buf)-1, fp);
while(!feof(fp))
{
if (fscanf(fp, "%d %s", &uid, buf) == 2)
if (sax25->sax25_uid == uid)
{
ax25_aton_entry(buf, (char *) &sax25->sax25_call);
fclose(fp);
return 0;
}
}
fclose(fp);
return -1;
}
void cleanup(char *tty)
{
struct utmp ut, *ut_line;
struct timeval tv;
FILE *fp;
setutent();
ut.ut_type = LOGIN_PROCESS;
strncpy(ut.ut_id, tty + 3, sizeof(ut.ut_id));
ut_line = getutid(&ut);
if (ut_line != NULL) {
ut_line->ut_type = DEAD_PROCESS;
ut_line->ut_host[0] = '\0';
ut_line->ut_user[0] = '\0';
gettimeofday(&tv, NULL);
ut_line->ut_tv.tv_sec = tv.tv_sec;
ut_line->ut_tv.tv_usec = tv.tv_usec;
if ((fp = fopen(_PATH_WTMP, "r+")) != NULL) {
fseek(fp, 0L, SEEK_END);
if (fwrite(ut_line, sizeof(ut), 1, fp) != 1)
syslog(LOG_ERR, "Ooops, I think I've just barbecued your wtmp file\n");
fclose(fp);
}
}
endutent();
}
/*
* add a new user to /etc/passwd and do some init
*/
void new_user(char *newuser)
{
struct passwd pw, *pwp;
uid_t uid;
char command[1024];
FILE *fp;
char username[80];
char homedir[256], userdir[256];
char buf[4096];
char subdir[4];
int cnt;
unsigned char *q;
char *p;
struct stat fst;
int fd_a, fd_b, fd_l;
mode_t homedir_mode = S_IRUSR|S_IWUSR|S_IXUSR|S_IXOTH|(secure_home ? 0 : (S_IRGRP|S_IXGRP));
/*
* build path for home directory
*/
strncpy(subdir, newuser, 3);
subdir[3] = '\0';
sprintf(username, "%s", newuser);
sprintf(homedir, "%s/%s.../%s", start_home, subdir, newuser);
strcpy(userdir, homedir);
fd_l = open(LOCK_AXSPAWN_FILE, O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
flock(fd_l, LOCK_EX);
retry:
/*
* find first free UID
*/
for (uid = start_uid; uid < 65535; uid++)
{
pwp = getpwuid(uid);
if (pwp == NULL)
break;
}
if (uid >= 65535 || uid < start_uid)
goto out;
/*
* build directories for home
*/
p = homedir;
while (*p == '/') p++;
chdir("/");
while(p)
{
q = strchr(p, '/');
if (q)
{
*q = '\0';
q++;
while (*q == '/') q++;
if (*q == 0) q = NULL;
}
if (stat(p, &fst) < 0)
{
if (errno == ENOENT)
{
if (q == NULL && policy_add_prog_useradd) {
/* Some useradd implementations
* fail if the directory for the
* new user already existss. That's
* why we stop here now, just before
* mkdir of ....../username/
* We had to use this function,
* because we decided to make
* directories in the form
* /home/hams/dl9.../ - and if
* for e.g. dl9.../ does not exist,
* then useradd will refuse to make
* the needed / missing subdirs
* for /home/hams/dl9.../dl9sau/
*/
goto end_mkdirs;
}
mkdir(p, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
if (q == NULL)
{
chown(p, uid, user_gid);
chmod(p, homedir_mode);
}
}
else
goto out;
}
if (chdir(p) < 0)
goto out;
p = q;
}
end_mkdirs:
/*
* add the user now
*/
if (policy_add_prog_useradd) {
char *opt_shell = "";
struct stat statbuf;
if (stat(USERADD_CONF, &statbuf) == -1) {
/* some programs need a shell explicitely specified
* in /etc/passwd, although this field is not required
* (and useradd does not set a shell when not
* specified).
* useradd has a config file. On debian for e.g.,
* there is no /etc/default/useradd. Thus we
* explecitely give the shell option to useradd, when
* no useradd config file is present.
*/
opt_shell = " -s \"/bin/sh\"";
}
sprintf(command,"/usr/sbin/useradd -p \"%s\" -c %s -d %s -u %d -g %d -m %s%s",
((policy_add_empty_password) ? "" : "+"),
username, userdir, uid, user_gid, newuser, opt_shell);
if (system(command) != 0)
goto out;
} else {
fp = fopen(PASSWDFILE, "a+");
if (fp == NULL)
goto out;
pw.pw_name = newuser;
pw.pw_passwd = ((policy_add_empty_password) ? "" : "+");
pw.pw_uid = uid;
pw.pw_gid = user_gid;
pw.pw_gecos = username;
pw.pw_dir = userdir;
pw.pw_shell = user_shell;
if (getpwuid(uid) != NULL) goto retry; /* oops?! */
if (putpwent(&pw, fp) < 0)
goto out;
fclose(fp);
}
/*
* copy ax25.profile
*/
fd_a = open(CONF_AXSPAWN_PROF_FILE, O_RDONLY);
if (fd_a > 0)
{
int first = 1;
fd_b = open(USERPROFILE, O_CREAT|O_WRONLY|O_APPEND, S_IRUSR|S_IWUSR);
if (fd_b < 0)
goto out;
/* just 2b sure */
if (lseek(fd_b, 0L, SEEK_END) > 0L)
write(fd_b, "\n", 1);
while ( (cnt = read(fd_a, &buf, sizeof(buf))) > 0 ) {
if (first) {
/* fix: profiles never start with "#!/bin/sh",
* but previous ax25.profile did. We fix this
* now. We append this profile, because .profile
* may came through /etc/skel. And because
* its there, it's intended to be used. Then
* if ax25.profile is present, it's regarded
* as an optimization.
* -> mark #!... as ##
*/
if (buf[0] == '#' && buf[1] == '!')
buf[1] = '#';
first = 0;
}
write(fd_b, &buf, cnt);
}
close(fd_b);
close(fd_a);
chown(USERPROFILE, uid, user_gid);
}
out:
flock(fd_l, LOCK_UN);
}
void read_config(void)
{
FILE *fp = fopen(CONF_AXSPAWN_FILE, "r");
char buf[512];
char cmd[40], param[80];
char *p;
if (fp == NULL)
return;
while (!feof(fp))
{
fgets(buf, sizeof(buf), fp);
p = strchr(buf, '#');
if (p) *p='\0';
if (buf[0] != '\0')
{
sscanf(buf, "%s %s", cmd, param);
if (!strncmp(cmd, "create", 6) && !cmd[6])
{
policy_add_user = (param[0] == 'y');
} else
if (!strncmp(cmd, "create_empty_password", 21))
policy_add_empty_password = (param[0] == 'y');
else
if (!strncmp(cmd, "create_with_useradd", 19))
policy_add_prog_useradd = (param[0] == 'y');
else
if (!strncmp(cmd, "pwcheck", 7)) {
if (!strncmp(param, "pass", 4))
pwcheck = 1;
else if (!strncmp(param, "call", 4))
pwcheck = 2;
else if (!strncmp(param, "group", 5))
pwcheck = 3;
} else
if (!strncmp(cmd, "guest", 5))
{
if (!strcmp(param, "no"))
{
policy_guest = 0;
} else {
policy_guest = 1;
guest = (char *) malloc(strlen(param)+1);
strcpy(guest, param);
}
} else
if (!strncmp(cmd, "group", 5))
{
user_gid = strtol(param, &p, 0);
if (*p != '\0')
{
struct group * gp = getgrnam(param);
if (gp != NULL)
user_gid = gp->gr_gid;
else
user_gid = 400;
endgrent();
}
} else
if (!strncmp(cmd, "first", 5))
{
start_uid = strtol(param, &p, 0);
if (*p != '\0')
start_uid = 400;
} else
if (!strncmp(cmd, "max", 3))
{
end_uid = strtol(param, &p, 0);
if (*p != '\0')
end_uid = 0;
} else
if (!strncmp(cmd, "home", 4))
{
start_home = (char *) malloc(strlen(param)+1);
strcpy(start_home, param);
} else
if (!strncmp(cmd, "secure_home", 11)) {
secure_home = (param[0] == 'y');
} else
if (!strncmp(cmd, "assoc", 5))
{
if (!strcmp(param, "yes"))
policy_associate = 1;
else
policy_associate = 0;
} else
if (!strncmp(cmd, "shell", 5))
{
user_shell = (char *) malloc(strlen(param)+1);
strcpy(user_shell, param);
} else
{
printf("error in config: ->%s %s<-\n", cmd, param);
}
}
}
fclose(fp);
}
char ptyslave[20];
int child_pid;
void signal_handler(int dummy)
{
kill(child_pid, SIGHUP);
cleanup(ptyslave+5);
exit(1);
}
int main(int argc, char **argv)
{
char call[20], user[20], as_user[20];
char buf[2048];
int k, cnt, digits, letters, invalid, ssid, ssidcnt;
socklen_t addrlen;
struct timeval tv;
pid_t pid = -1;
char *p;
fd_set fds_read, fds_err;
struct passwd *pw;
int chargc = 0;
char *chargv[20];
int envc = 0;
char *envp[20];
struct utmp ut_line;
struct winsize win = { 0, 0, 0, 0};
struct sockaddr_ax25 sax25;
union {
struct full_sockaddr_ax25 fsax25;
struct sockaddr_rose rose;
} sockaddr;
char *protocol = "";
char is_guest = 0;
char wait_for_tcp = 0;
char changeuser = 0;
char user_changed = 0;
char rootlogin = 0;
char dumb_embedded_system = 0;
int pwtype = 0;
int pwtype_orig = 0;
char prompt[20];
char *pwd = 0;
*prompt = 0;
digits = letters = invalid = ssid = ssidcnt = 0;
for (k = 1; k < argc; k++){
if (!strcmp(argv[k], "-w") || !strcmp(argv[k], "--wait"))
wait_for_tcp = 1;
if (!strcmp(argv[k], "-c") || !strcmp(argv[k], "--changeuser"))
changeuser = 1;
if (!strcmp(argv[k], "-r") || !strcmp(argv[k], "--rootlogin"))
rootlogin = 1;
if (!strcmp(argv[k], "-e") || !strcmp(argv[k], "--embedded"))
dumb_embedded_system = 1;
if ((!strcmp(argv[k], "-p") || !strcmp(argv[k], "--pwprompt")) && k < argc-1 ) {
strncpy(prompt, argv[k+1], sizeof(prompt));
prompt[sizeof(prompt)-1] = '\0';
k++;
}
if (!strcmp(argv[k], "--only-md5"))
pwtype = PW_MD5;
}
read_config();
if (!pwtype)
pwtype = (PW_CLEARTEXT | PW_SYS | PW_MD5 | PW_UNIX);
pwtype_orig = pwtype;
if (!*prompt) {
if (gethostname(buf, sizeof(buf)) < 0) {
strcpy(prompt, "Check");
} else {
if ((p = strchr(buf, '.')))
*p = 0;
strncpy(prompt, buf, sizeof(prompt));
prompt[sizeof(prompt)-1] = 0;
}
}
strupr(prompt);
openlog("axspawn", LOG_PID, LOG_DAEMON);
if (getuid() != 0) {
printf("permission denied\n");
syslog(LOG_NOTICE, "user %d tried to run axspawn\n", getuid());
return 1;
}
addrlen = sizeof(struct full_sockaddr_ax25);
k = getpeername(0, (struct sockaddr *) &sockaddr, &addrlen);
if (k < 0) {
syslog(LOG_NOTICE, "getpeername: %m\n");
return 1;
}
switch (sockaddr.fsax25.fsa_ax25.sax25_family) {
case AF_AX25:
strcpy(call, ax25_ntoa(&sockaddr.fsax25.fsa_ax25.sax25_call));
protocol = "AX.25";
paclen = AX_PACLEN;
break;
case AF_NETROM:
strcpy(call, ax25_ntoa(&sockaddr.fsax25.fsa_ax25.sax25_call));
protocol = "NET/ROM";
paclen = NETROM_PACLEN;
break;
case AF_ROSE:
strcpy(call, ax25_ntoa(&sockaddr.rose.srose_call));
protocol = "Rose";
paclen = ROSE_PACLEN;
break;
default:
syslog(LOG_NOTICE, "peer is not an AX.25, NET/ROM or Rose socket\n");
return 1;
}
for (k = 0; k < strlen(call); k++)
{
if (ssidcnt)
{
if (!IS_DIGIT(call[k]))
invalid++;
else
{
if (ssidcnt > 2)
invalid++;
else if (ssidcnt == 1)
ssid = (int) (call[k] - '0');
else
{
ssid *= 10;
ssid += (int) (call[k] - '0');
if (ssid > 15) invalid++;
}
ssidcnt++;
}
} else
if (IS_DIGIT(call[k]))
{
digits++;
if (k > 3) invalid++;
} else
if (IS_LETTER(call[k]))
letters++;
else
if (call[k] == '-')
{
if (k < MINLEN)
invalid++;
else
ssidcnt++;
}
else
invalid++;
}
if ( invalid || (k < MINLEN) || (digits > 2) || (digits < 1) )
{
write_ax25_static_line(MSG_NOCALL);
syslog(LOG_NOTICE, "%s is not an Amateur Radio callsign\n", call);
sleep(EXITDELAY);
return 1;
}
if (wait_for_tcp) {
/* incoming TCP/IP connection? */
if (read_ax25(buf, sizeof(buf)) < 0)
exit(0);
}
strcpy(user, call);
strlwr(user);
p = strchr(user, '-');
if (p) *p = '\0';
*as_user = 0;
if (changeuser) {
char *p_buf;
sprintf(buf, "Login (%s): ", user);
write_ax25(buf, strlen(buf), 1);
if ((cnt = read_ax25(buf, sizeof(buf)-1)) < 0)
exit(1);
buf[cnt] = 0;
/* skip leading blanks */
for (p_buf = buf; *p_buf && *p_buf != '\n' && !isalnum(*p_buf & 0xff); p_buf++) ;
/* skip trailing junk, blanks, \n, .. */
for (p = p_buf; *p && isalnum(*p & 0xff); p++) ;
*p = 0;
if (*p_buf) {
strncpy(as_user, p_buf, sizeof(as_user));
as_user[sizeof(as_user)-1] = 0;
user_changed = 1;
}
}
if (!*as_user)
strcpy(as_user, user);
pw = getpwnam(as_user);
endpwent();
if (pw == NULL)
{
if (user_changed) {
syslog(LOG_NOTICE, "%s (callsign: %s) not found in /etc/passwd\n", as_user, call);
sleep(EXITDELAY);
return 1;
}
if (policy_add_user)
{
new_user(as_user);
pw = getpwnam(as_user);
endpwent();
}
if (pw == NULL && policy_guest)
{
strcpy(as_user,guest);
pw = getpwnam(guest);
endpwent();
is_guest = 1;
}
}
if (!pw) {
write_ax25_static_line(MSG_NOTINDBF);
syslog(LOG_NOTICE, "%s (callsign: %s) not found in /etc/passwd\n", as_user, call);
sleep(EXITDELAY);
return 1;
}
if (!rootlogin && (pw->pw_uid == 0 || pw->pw_gid == 0))
{
write_ax25_static_line(MSG_NOCALL);
syslog(LOG_NOTICE, "root login of %s (callsign: %s) denied\n", as_user, call);
sleep(EXITDELAY);
return 1;
}
again:
if (!(pwd = read_pwd(pw, &pwtype))) {
if ((!pwtype || pwtype != PW_CLEARTEXT) && (pwtype != PW_UNIX)) {
sleep (EXITDELAY);
return 1;
}
}
if (pwtype == PW_UNIX) {
pwtype = PW_CLEARTEXT;
pwcheck = 1;
}
if (pwtype != PW_CLEARTEXT) {
char pass_want[PASSSIZE+1];
if (pwtype == PW_MD5)
ask_pw_md5(prompt, pass_want, pwd);
else
ask_pw_sys(prompt, pass_want, pwd);
cnt = read_ax25(buf, sizeof(buf)-1);
if (cnt <= 0) {
sprintf(buf,"no response\r");
write_ax25(buf, strlen(buf),1);
sleep (EXITDELAY);
return -11;
}
buf[cnt] = 0;
if ((p = strchr(buf, '\n')))
*p = 0;
if ((pwtype & PW_MD5) && !strcmp(buf, "sys") && (pwtype_orig & PW_SYS)) {
pwtype = (pwtype_orig & ~PW_MD5);
if (pwd)
free(pwd);
pwd = 0;
goto again;
}
if (!strstr(buf, pass_want)) {
sprintf(buf,"authentication failed\r");
write_ax25(buf, strlen(buf), 1);
sleep (EXITDELAY);
return -11;
}
if (pwd)
free(pwd);
pwd = 0;
} else {
if (pw->pw_uid == 0 || pw->pw_gid == 0) {
sprintf(buf, "Sorry, root logins are only allowed with md5- or baycom-password!\r");
write_ax25(buf, strlen(buf), 1);
syslog(LOG_NOTICE, "root login of %s (callsign: %s) denied (only with md5- or baycom-Login)!\n", user, call);
sleep(EXITDELAY);
return 1;
}
}
if (pwd)
free(pwd);
pwd = 0;
/*
* associate UID with callsign (or vice versa?)
*/
if (policy_associate)
{
int fds = socket(AF_AX25, SOCK_SEQPACKET, 0);
if (fds != -1)
{
sax25.sax25_uid = pw->pw_uid;
if (get_assoc(&sax25) != -1)
ioctl(fds, SIOCAX25DELUID, &sax25);
switch (sockaddr.fsax25.fsa_ax25.sax25_family) {
case AF_AX25:
case AF_NETROM:
sax25.sax25_call = sockaddr.fsax25.fsa_ax25.sax25_call;
break;
case AF_ROSE:
sax25.sax25_call = sockaddr.rose.srose_call;
break;
}
ioctl(fds, SIOCAX25ADDUID, &sax25);
close(fds);
}
}
fcntl(1, F_SETFL, O_NONBLOCK);
pid = forkpty(&fdmaster, ptyslave, NULL, &win);
if (pid == 0)
{
struct termios termios;
char *shell = "/bin/sh";
memset((char *) &termios, 0, sizeof(termios));
ioctl(0, TIOCSCTTY, (char *) 0);
termios.c_iflag = ICRNL | IXOFF;
termios.c_oflag = OPOST | ONLCR;
termios.c_cflag = CS8 | CREAD | CLOCAL;
termios.c_lflag = ISIG | ICANON;
termios.c_cc[VINTR] = /* 127 */ 0x03;
termios.c_cc[VQUIT] = 28;
termios.c_cc[VERASE] = 8;
termios.c_cc[VKILL] = 24;
termios.c_cc[VEOF] = 4;
cfsetispeed(&termios, B19200);
cfsetospeed(&termios, B19200);
tcsetattr(0, TCSANOW, &termios);
setutent();
ut_line.ut_type = LOGIN_PROCESS;
ut_line.ut_pid = getpid();
strncpy(ut_line.ut_line, ptyslave + 5, sizeof(ut_line.ut_line));
strncpy(ut_line.ut_id, ptyslave + 8, sizeof(ut_line.ut_id));
strncpy(ut_line.ut_user, "LOGIN", sizeof(ut_line.ut_user));
strncpy(ut_line.ut_host, protocol, sizeof(ut_line.ut_host));
gettimeofday(&tv, NULL);
ut_line.ut_tv.tv_sec = tv.tv_sec;
ut_line.ut_tv.tv_usec = tv.tv_usec;
ut_line.ut_addr = 0;
pututline(&ut_line);
endutent();
/* become process group leader, if we not already are */
if (getpid() != getsid(0)) {
if (setsid() == -1)
exit(1);
}
chargc = 0;
envc = 0;
if (dumb_embedded_system) {
int ret = -1;
char *p = 0;
chown(ptyslave, pw->pw_uid, 0);
chmod(ptyslave, 0622);
ret = -1;
if (pw->pw_dir && *(pw->pw_dir))
p = pw->pw_dir;
ret = chdir(p);
if (ret != 0) {
p = "/tmp";
chdir(p);
}
if ((envp[envc] = (char *) malloc(strlen(p)+6)))
sprintf(envp[envc++], "HOME=%s", p);
if ((envp[envc] = (char *) malloc(strlen(pw->pw_name)+6)))
sprintf(envp[envc++], "USER=%s", pw->pw_name);
if ((envp[envc] = (char *) malloc(strlen(pw->pw_name)+9)))
sprintf(envp[envc++], "LOGNAME=%s", pw->pw_name);
if (pw->pw_shell && *(pw->pw_shell)) {
shell = pw->pw_shell;
} else {
shell = "/bin/sh";
}
if ((p = strrchr(shell, '/'))) {
if (p[1]) {
if ((p = strdup(p)))
*p = '-';
} else p = 0;
}
if (!p)
p = shell;
chargv[chargc++] = p;
if ((envp[envc] = (char *) malloc(strlen(shell)+7)))
sprintf(envp[envc++], "SHELL=%s", shell);
if (pw->pw_uid == 0)
p = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin";
else
p = "/bin:/usr/bin:/usr/local/bin";
if ((envp[envc] = (char *) malloc(strlen(p)+6)))
sprintf(envp[envc++], "PATH=%s", p);
} else {
chargv[chargc++] = "/bin/login";
chargv[chargc++] = "-p";
/* there exist several conectps:
* Historicaly, the special character '+' in the password
* field indicated that users may login via ax25, netrom, rose,
* etc.. - but not via other protocols like telnet.
* This secures the digipeater from abuse by inet access of
* non-hams.
* On the other hand, this leads to the problem that telent
* via HF, pop3, etc.. do not work.
* The "pwcheck == 2 method means, that the password is used on
* every login mechanism other than this axspawn program;
* here we do not rely on the password - the ax25 call of
* the ham is enough. We have already checked above, that
* the call of the user is valid (and not root, httpd, etc..);
* thus this method is safe here.
* Another mechanism (pwcheck == 3) is to check if the gid
* equals to user_gid preference. I prefer this way, because
* this approach gives the chance to temporary lock a user
* out (abuse, ..) by changing his gid in passwd to for e.g.
* 65534 (nogroup).
*/
chargv[chargc++] = "-h";
chargv[chargc++] = protocol;
if (pwtype != PW_CLEARTEXT /* PW_SYS or PW_MD5 are already authenticated */
|| pwcheck == 2 || (pwcheck == 3 && (pw->pw_gid == user_gid || is_guest)) || !strcmp(pw->pw_passwd, "+"))
chargv[chargc++] = "-f";
chargv[chargc++] = as_user;
}
chargv[chargc] = NULL;
if ((envp[envc] = (char *) malloc(30)))
sprintf(envp[envc++], "AXCALL=%s", call);
if ((envp[envc] = (char *) malloc(30)))
sprintf(envp[envc++], "CALL=%s", user);
if ((envp[envc] = (char *) malloc(30)))
sprintf(envp[envc++], "PROTOCOL=%s", protocol);
if ((envp[envc] = (char *) malloc(30)))
sprintf(envp[envc++], "TERM=dumb"); /* SuSE bug (dump - tsts) */
/* other useful defaults */
if ((envp[envc] = (char *) malloc(30)))
sprintf(envp[envc++], "EDITOR=/usr/bin/ex");
if ((envp[envc] = (char *) malloc(30)))
sprintf(envp[envc++], "LESS=-d -E -F");
envp[envc] = NULL;
if (dumb_embedded_system) {
if (setgid(pw->pw_gid) == -1)
exit(1);
if (setuid(pw->pw_uid) == -1)
exit(1);
execve(shell, chargv, envp);
/* point of no return */
exit(1);
}
execve(chargv[0], chargv, envp);
/* point of no return */
exit(1);
}
else if (pid > 0)
{
child_pid = 0;
signal(SIGHUP, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGQUIT, signal_handler);
while(1)
{
FD_ZERO(&fds_read);
FD_ZERO(&fds_err);
FD_SET(0, &fds_read);
FD_SET(0, &fds_err);
if (wqueue_length <= paclen*7)
FD_SET(fdmaster, &fds_read);
FD_SET(fdmaster, &fds_err);
k = select(fdmaster+1, &fds_read, NULL, &fds_err, NULL);
if (k > 0)
{
if (FD_ISSET(0, &fds_err))
{
if (huffman) {
sprintf(buf,"\r//COMP 0\r");
write_ax25(buf, strlen(buf), 1);
sleep(EXITDELAY);
}
kill(pid, SIGHUP);
cleanup(ptyslave+5);
return 1;
}
if (FD_ISSET(fdmaster, &fds_err))
{
/* give the last packet in the timer controlled sendqueue a chance.. */
if (wqueue_length) {
continue;
}
if (huffman) {
sprintf(buf,"\r//COMP 0\r");
write_ax25(buf, strlen(buf), 1);
sleep(EXITDELAY);
}
cleanup(ptyslave+5);
return 1;
}
if (FD_ISSET(0, &fds_read))
{
cnt = read_ax25(buf, sizeof(buf));
if (cnt < 0) /* Connection died */
{
kill(pid, SIGHUP);
cleanup(ptyslave+5);
return 1;
} else
write(fdmaster, buf, cnt);
}
if (FD_ISSET(fdmaster, &fds_read))
{
cnt = read(fdmaster, buf, (huffman ? 254 : sizeof(buf)));
if (cnt < 0)
{
/* give the last packet in the timer controlled sendqueue a chance.. */
if (wqueue_length) {
continue;
}
if (huffman) {
sprintf(buf,"\r//COMP 0\r");
write_ax25(buf, strlen(buf), 1);
sleep(EXITDELAY);
}
cleanup(ptyslave+5);
return 1; /* Child died */
}
write_ax25(buf, cnt, 0);
}
} else
if (k < 0 && errno != EINTR)
{
if (huffman) {
sprintf(buf,"\r//COMP 0\r");
write_ax25(buf, strlen(buf), 1);
sleep(EXITDELAY);
}
kill(pid, SIGHUP); /* just in case... */
cleanup(ptyslave+5);
return 0;
}
}
}
else
{
write_ax25_static_line(MSG_CANNOTFORK);
syslog(LOG_ERR, "cannot fork %m, closing connection to %s\n", call);
sleep(EXITDELAY);
return 1;
}
sleep(EXITDELAY);
return 0;
}
ax25-tools-0.0.10-rc4/ax25/beacon.8 0000664 0000000 0000000 00000003136 12155142241 013163 0000000 0000000 .TH BEACON 8 "10 February 1997" Linux "Linux System Managers Manual"
.SH NAME
beacon \- transmit periodic messages on an AX.25 port.
.SH SYNOPSIS
.B beacon [-c ] [-d [digi ..]] [-l] [-m] [-s] [-t interval] [-v] port \(lqmessage\(rq
.SH DESCRIPTION
.LP
.B Beacon
transmits the message text on an AX.25 port every thirty minutes. The message
is addressed to \(lqIDENT\(rq and is sent using the AX.25 callsign of the port
specified on the command line. Typically the message text will contain
spaces and/or other characters, therefore the message text should be
enclosed in quotes to ensure they are passed to the
.B beacon
program untranslated.
.SH OPTIONS
.TP 16
.BI \-c
Configure the source callsign for beacons. The default is to use the
interface callsign.
.TP 16
.BI \-d
Configure the destination callsign for beacons. The default is \(lqIDENT\(rq.
Optional: Digipeaters may follow, separated with spaces. Use \-d "DEST DIGI1 DIGI2 .."
.TP 16
.BI \-l
Enables the logging of errors to the system log, the default is off.
.TP 16
.BI \-m
Changes the destination address to \(lqMAIL\(rq and sends the message text
once only. This option overrides any destination callsign given with the \-d option.
.TP 16
.BI \-s
Sends the message text once only.
.TP 16
.BI "\-t interval"
The time interval between messages, the interval is given in minutes and the
default is thirty minutes.
.TP 16
.BI \-v
Display the version.
.SH "SEE ALSO"
.BR ax25 (4),
.BR axports (5).
.SH AUTHORS
.nf
Alan Cox GW4PTS
.br
Jonathan Naylor G4KLX
.br
David Brooke G6GZH
.fi
ax25-tools-0.0.10-rc4/ax25/rxecho.conf 0000664 0000000 0000000 00000000657 12155142241 014007 0000000 0000000 # /etc/ax25/rxecho.conf
#
# This means that packets received on port '1' are copied to port '2' if they
# are destined to oh2bns-1 or oh2bns-2. All packets from port '2' are copied
# to port '1'.
#
# There may be empty lines and an arbirary amount of white space around the
# tokens but the callsign field must not have any spaces in it. There can be
# up to MAXCALLS callsigns in the callsign field.
#
1 2 oh2bns-1,oh2bns-2
2 1 *
ax25-tools-0.0.10-rc4/ax25/Makefile.am 0000664 0000000 0000000 00000002632 12155142241 013677 0000000 0000000 SUBDIRS = axgetput
etcfiles = ax25.profile ax25d.conf axspawn.conf rxecho.conf
varfiles = mheard.dat
installconf:
$(mkinstalldirs) $(DESTDIR)$(AX25_SYSCONFDIR)
@list='$(etcfiles)'; for p in $$list; do \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(AX25_SYSCONFDIR)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(AX25_SYSCONFDIR)/$$p; \
done
$(mkinstalldirs) $(DESTDIR)$(AX25_LOCALSTATEDIR)/mheard
@list='$(varfiles)'; for p in $$list; do \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(AX25_LOCALSTATEDIR)/mheard/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(AX25_LOCALSTATEDIR)/mheard/$$p; \
done
sbin_PROGRAMS = ax25d axctl axparms axspawn beacon bpqparms mheardd rxecho
bin_PROGRAMS = mheard
LDADD = $(AX25_LIB)
axspawn_LDADD = $(AX25_LIB) $(UTIL_LIB)
INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \
-DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\"
AX25_SYSCONFDIR=$(sysconfdir)/ax25/
AX25_LOCALSTATEDIR=$(localstatedir)/ax25/
man_MANS = ax25.4 ax25d.conf.5 axspawn.conf.5 rxecho.conf.5 \
ax25d.8 axctl.8 axparms.8 axspawn.8 beacon.8 bpqparms.8 \
mheard.1 mheardd.8 rxecho.8
EXTRA_DIST = $(man_MANS) $(etcfiles) $(varfiles)
ax25d_SOURCES = ax25d.c
axctl_SOURCES = axctl.c
axparms_SOURCES = axparms.c
axspawn_SOURCES = axspawn.c axspawn.h access.c access.h md5.c md5.h
beacon_SOURCES = beacon.c
bpqparms_SOURCES = bpqparms.c
mheard_SOURCES = mheard.c
mheardd_SOURCES = mheardd.c
rxecho_SOURCES = rxecho.c
ax25-tools-0.0.10-rc4/ax25/md5.c 0000664 0000000 0000000 00000025634 12155142241 012503 0000000 0000000
/*
***********************************************************************
** md5.c -- the source code for MD5 routines **
** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
** Created: 2/17/90 RLR **
** Revised: 1/91 SRD,AJ,BSK,JT Reference C ver., 7/10 constant corr. **
***********************************************************************
*/
/*
***********************************************************************
** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
** **
** License to copy and use this software is granted provided that **
** it is identified as the "RSA Data Security, Inc. MD5 Message- **
** Digest Algorithm" in all material mentioning or referencing this **
** software or this function. **
** **
** License is also granted to make and use derivative works **
** provided that such works are identified as "derived from the RSA **
** Data Security, Inc. MD5 Message-Digest Algorithm" in all **
** material mentioning or referencing the derived work. **
** **
** RSA Data Security, Inc. makes no representations concerning **
** either the merchantability of this software or the suitability **
** of this software for any particular purpose. It is provided "as **
** is" without express or implied warranty of any kind. **
** **
** These notices must be retained in any copies of any part of this **
** documentation and/or software. **
***********************************************************************
*/
#include "md5.h"
/*
***********************************************************************
** Message-digest routines: **
** To form the message digest for a message M **
** (1) Initialize a context buffer mdContext using MD5Init **
** (2) Call MD5Update on mdContext and M **
** (3) Call MD5Final on mdContext **
** The message digest is now in mdContext->digest[0...15] **
***********************************************************************
*/
/* forward declaration */
static void Transform(UINT4 *buf, UINT4 *in);
static unsigned char PADDING[64] = {
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/* F, G, H and I are basic MD5 functions */
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
/* ROTATE_LEFT rotates x left n bits */
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
/* Rotation is separate from addition to prevent recomputation */
#define FF(a, b, c, d, x, s, ac) \
{(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) \
{(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) \
{(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) \
{(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
/* The routine MD5Init initializes the message-digest context
mdContext. All fields are set to zero.
*/
void MD5Init(MD5_CTX *mdContext)
{
mdContext->i[0] = mdContext->i[1] = (UINT4)0;
/* Load magic initialization constants.
*/
mdContext->buf[0] = (UINT4)0x67452301;
mdContext->buf[1] = (UINT4)0xefcdab89;
mdContext->buf[2] = (UINT4)0x98badcfe;
mdContext->buf[3] = (UINT4)0x10325476;
}
/* The routine MD5Update updates the message-digest context to
account for the presence of each of the characters inBuf[0..inLen-1]
in the message whose digest is being computed.
*/
void MD5Update(MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen)
{
UINT4 in[16];
int mdi;
unsigned int i, ii;
/* compute number of bytes mod 64 */
mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
/* update number of bits */
if ((mdContext->i[0] + ((UINT4)inLen << 3)) < mdContext->i[0])
mdContext->i[1]++;
mdContext->i[0] += ((UINT4)inLen << 3);
mdContext->i[1] += ((UINT4)inLen >> 29);
while (inLen--) {
/* add new character to buffer, increment mdi */
mdContext->in[mdi++] = *inBuf++;
/* transform if necessary */
if (mdi == 0x40) {
for (i = 0, ii = 0; i < 16; i++, ii += 4)
in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
(((UINT4)mdContext->in[ii+2]) << 16) |
(((UINT4)mdContext->in[ii+1]) << 8) |
((UINT4)mdContext->in[ii]);
Transform (mdContext->buf, in);
mdi = 0;
}
}
}
/* The routine MD5Final terminates the message-digest computation and
ends with the desired message digest in mdContext->digest[0...15].
*/
void MD5Final(MD5_CTX *mdContext)
{
UINT4 in[16];
int mdi;
unsigned int i, ii;
unsigned int padLen;
/* save number of bits */
in[14] = mdContext->i[0];
in[15] = mdContext->i[1];
/* compute number of bytes mod 64 */
mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
/* pad out to 56 mod 64 */
padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi);
MD5Update (mdContext, PADDING, padLen);
/* append length in bits and transform */
for (i = 0, ii = 0; i < 14; i++, ii += 4)
in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
(((UINT4)mdContext->in[ii+2]) << 16) |
(((UINT4)mdContext->in[ii+1]) << 8) |
((UINT4)mdContext->in[ii]);
Transform (mdContext->buf, in);
/* store buffer in digest */
for (i = 0, ii = 0; i < 4; i++, ii += 4) {
mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF);
mdContext->digest[ii+1] =
(unsigned char)((mdContext->buf[i] >> 8) & 0xFF);
mdContext->digest[ii+2] =
(unsigned char)((mdContext->buf[i] >> 16) & 0xFF);
mdContext->digest[ii+3] =
(unsigned char)((mdContext->buf[i] >> 24) & 0xFF);
}
}
/* Basic MD5 step. Transforms buf based on in.
*/
static void Transform(UINT4 *buf, UINT4 *in)
{
UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
/* Round 1 */
#define S11 7
#define S12 12
#define S13 17
#define S14 22
FF ( a, b, c, d, in[ 0], S11, 3614090360UL); /* 1 */
FF ( d, a, b, c, in[ 1], S12, 3905402710UL); /* 2 */
FF ( c, d, a, b, in[ 2], S13, 606105819UL); /* 3 */
FF ( b, c, d, a, in[ 3], S14, 3250441966UL); /* 4 */
FF ( a, b, c, d, in[ 4], S11, 4118548399UL); /* 5 */
FF ( d, a, b, c, in[ 5], S12, 1200080426UL); /* 6 */
FF ( c, d, a, b, in[ 6], S13, 2821735955UL); /* 7 */
FF ( b, c, d, a, in[ 7], S14, 4249261313UL); /* 8 */
FF ( a, b, c, d, in[ 8], S11, 1770035416UL); /* 9 */
FF ( d, a, b, c, in[ 9], S12, 2336552879UL); /* 10 */
FF ( c, d, a, b, in[10], S13, 4294925233UL); /* 11 */
FF ( b, c, d, a, in[11], S14, 2304563134UL); /* 12 */
FF ( a, b, c, d, in[12], S11, 1804603682UL); /* 13 */
FF ( d, a, b, c, in[13], S12, 4254626195UL); /* 14 */
FF ( c, d, a, b, in[14], S13, 2792965006UL); /* 15 */
FF ( b, c, d, a, in[15], S14, 1236535329UL); /* 16 */
/* Round 2 */
#define S21 5
#define S22 9
#define S23 14
#define S24 20
GG ( a, b, c, d, in[ 1], S21, 4129170786UL); /* 17 */
GG ( d, a, b, c, in[ 6], S22, 3225465664UL); /* 18 */
GG ( c, d, a, b, in[11], S23, 643717713UL); /* 19 */
GG ( b, c, d, a, in[ 0], S24, 3921069994UL); /* 20 */
GG ( a, b, c, d, in[ 5], S21, 3593408605UL); /* 21 */
GG ( d, a, b, c, in[10], S22, 38016083UL); /* 22 */
GG ( c, d, a, b, in[15], S23, 3634488961UL); /* 23 */
GG ( b, c, d, a, in[ 4], S24, 3889429448UL); /* 24 */
GG ( a, b, c, d, in[ 9], S21, 568446438UL); /* 25 */
GG ( d, a, b, c, in[14], S22, 3275163606UL); /* 26 */
GG ( c, d, a, b, in[ 3], S23, 4107603335UL); /* 27 */
GG ( b, c, d, a, in[ 8], S24, 1163531501UL); /* 28 */
GG ( a, b, c, d, in[13], S21, 2850285829UL); /* 29 */
GG ( d, a, b, c, in[ 2], S22, 4243563512UL); /* 30 */
GG ( c, d, a, b, in[ 7], S23, 1735328473UL); /* 31 */
GG ( b, c, d, a, in[12], S24, 2368359562UL); /* 32 */
/* Round 3 */
#define S31 4
#define S32 11
#define S33 16
#define S34 23
HH ( a, b, c, d, in[ 5], S31, 4294588738UL); /* 33 */
HH ( d, a, b, c, in[ 8], S32, 2272392833UL); /* 34 */
HH ( c, d, a, b, in[11], S33, 1839030562UL); /* 35 */
HH ( b, c, d, a, in[14], S34, 4259657740UL); /* 36 */
HH ( a, b, c, d, in[ 1], S31, 2763975236UL); /* 37 */
HH ( d, a, b, c, in[ 4], S32, 1272893353UL); /* 38 */
HH ( c, d, a, b, in[ 7], S33, 4139469664UL); /* 39 */
HH ( b, c, d, a, in[10], S34, 3200236656UL); /* 40 */
HH ( a, b, c, d, in[13], S31, 681279174UL); /* 41 */
HH ( d, a, b, c, in[ 0], S32, 3936430074UL); /* 42 */
HH ( c, d, a, b, in[ 3], S33, 3572445317UL); /* 43 */
HH ( b, c, d, a, in[ 6], S34, 76029189UL); /* 44 */
HH ( a, b, c, d, in[ 9], S31, 3654602809UL); /* 45 */
HH ( d, a, b, c, in[12], S32, 3873151461UL); /* 46 */
HH ( c, d, a, b, in[15], S33, 530742520UL); /* 47 */
HH ( b, c, d, a, in[ 2], S34, 3299628645UL); /* 48 */
/* Round 4 */
#define S41 6
#define S42 10
#define S43 15
#define S44 21
II ( a, b, c, d, in[ 0], S41, 4096336452UL); /* 49 */
II ( d, a, b, c, in[ 7], S42, 1126891415UL); /* 50 */
II ( c, d, a, b, in[14], S43, 2878612391UL); /* 51 */
II ( b, c, d, a, in[ 5], S44, 4237533241UL); /* 52 */
II ( a, b, c, d, in[12], S41, 1700485571UL); /* 53 */
II ( d, a, b, c, in[ 3], S42, 2399980690UL); /* 54 */
II ( c, d, a, b, in[10], S43, 4293915773UL); /* 55 */
II ( b, c, d, a, in[ 1], S44, 2240044497UL); /* 56 */
II ( a, b, c, d, in[ 8], S41, 1873313359UL); /* 57 */
II ( d, a, b, c, in[15], S42, 4264355552UL); /* 58 */
II ( c, d, a, b, in[ 6], S43, 2734768916UL); /* 59 */
II ( b, c, d, a, in[13], S44, 1309151649UL); /* 60 */
II ( a, b, c, d, in[ 4], S41, 4149444226UL); /* 61 */
II ( d, a, b, c, in[11], S42, 3174756917UL); /* 62 */
II ( c, d, a, b, in[ 2], S43, 718787259UL); /* 63 */
II ( b, c, d, a, in[ 9], S44, 3951481745UL); /* 64 */
buf[0] += a;
buf[1] += b;
buf[2] += c;
buf[3] += d;
}
/*
***********************************************************************
** End of md5.c **
******************************** (cut) ********************************
*/
ax25-tools-0.0.10-rc4/ax25/Makefile.in 0000644 0000000 0000000 00000107034 12157605222 013715 0000000 0000000 # Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
sbin_PROGRAMS = ax25d$(EXEEXT) axctl$(EXEEXT) axparms$(EXEEXT) \
axspawn$(EXEEXT) beacon$(EXEEXT) bpqparms$(EXEEXT) \
mheardd$(EXEEXT) rxecho$(EXEEXT)
bin_PROGRAMS = mheard$(EXEEXT)
subdir = ax25
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \
"$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man4dir)" \
"$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"
PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS)
am_ax25d_OBJECTS = ax25d.$(OBJEXT)
ax25d_OBJECTS = $(am_ax25d_OBJECTS)
ax25d_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
ax25d_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_axctl_OBJECTS = axctl.$(OBJEXT)
axctl_OBJECTS = $(am_axctl_OBJECTS)
axctl_LDADD = $(LDADD)
axctl_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_axparms_OBJECTS = axparms.$(OBJEXT)
axparms_OBJECTS = $(am_axparms_OBJECTS)
axparms_LDADD = $(LDADD)
axparms_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_axspawn_OBJECTS = axspawn.$(OBJEXT) access.$(OBJEXT) md5.$(OBJEXT)
axspawn_OBJECTS = $(am_axspawn_OBJECTS)
axspawn_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am_beacon_OBJECTS = beacon.$(OBJEXT)
beacon_OBJECTS = $(am_beacon_OBJECTS)
beacon_LDADD = $(LDADD)
beacon_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_bpqparms_OBJECTS = bpqparms.$(OBJEXT)
bpqparms_OBJECTS = $(am_bpqparms_OBJECTS)
bpqparms_LDADD = $(LDADD)
bpqparms_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_mheard_OBJECTS = mheard.$(OBJEXT)
mheard_OBJECTS = $(am_mheard_OBJECTS)
mheard_LDADD = $(LDADD)
mheard_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_mheardd_OBJECTS = mheardd.$(OBJEXT)
mheardd_OBJECTS = $(am_mheardd_OBJECTS)
mheardd_LDADD = $(LDADD)
mheardd_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_rxecho_OBJECTS = rxecho.$(OBJEXT)
rxecho_OBJECTS = $(am_rxecho_OBJECTS)
rxecho_LDADD = $(LDADD)
rxecho_DEPENDENCIES = $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(ax25d_SOURCES) $(axctl_SOURCES) $(axparms_SOURCES) \
$(axspawn_SOURCES) $(beacon_SOURCES) $(bpqparms_SOURCES) \
$(mheard_SOURCES) $(mheardd_SOURCES) $(rxecho_SOURCES)
DIST_SOURCES = $(ax25d_SOURCES) $(axctl_SOURCES) $(axparms_SOURCES) \
$(axspawn_SOURCES) $(beacon_SOURCES) $(bpqparms_SOURCES) \
$(mheard_SOURCES) $(mheardd_SOURCES) $(rxecho_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
man1dir = $(mandir)/man1
man4dir = $(mandir)/man4
man5dir = $(mandir)/man5
man8dir = $(mandir)/man8
NROFF = nroff
MANS = $(man_MANS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
AX25IO_LIB = @AX25IO_LIB@
AX25_LIB = @AX25_LIB@
BASEVERSION = @BASEVERSION@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTRAVERSION = @EXTRAVERSION@
FLTK_LIB = @FLTK_LIB@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NCURSES_LIB = @NCURSES_LIB@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
UTIL_LIB = @UTIL_LIB@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
Z_LIB = @Z_LIB@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = axgetput
etcfiles = ax25.profile ax25d.conf axspawn.conf rxecho.conf
varfiles = mheard.dat
LDADD = $(AX25_LIB)
axspawn_LDADD = $(AX25_LIB) $(UTIL_LIB)
INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \
-DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\"
AX25_SYSCONFDIR = $(sysconfdir)/ax25/
AX25_LOCALSTATEDIR = $(localstatedir)/ax25/
man_MANS = ax25.4 ax25d.conf.5 axspawn.conf.5 rxecho.conf.5 \
ax25d.8 axctl.8 axparms.8 axspawn.8 beacon.8 bpqparms.8 \
mheard.1 mheardd.8 rxecho.8
EXTRA_DIST = $(man_MANS) $(etcfiles) $(varfiles)
ax25d_SOURCES = ax25d.c
axctl_SOURCES = axctl.c
axparms_SOURCES = axparms.c
axspawn_SOURCES = axspawn.c axspawn.h access.c access.h md5.c md5.h
beacon_SOURCES = beacon.c
bpqparms_SOURCES = bpqparms.c
mheard_SOURCES = mheard.c
mheardd_SOURCES = mheardd.c
rxecho_SOURCES = rxecho.c
all: all-recursive
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ax25/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu ax25/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
} \
; done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(sbindir)" && rm -f $$files
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
ax25d$(EXEEXT): $(ax25d_OBJECTS) $(ax25d_DEPENDENCIES) $(EXTRA_ax25d_DEPENDENCIES)
@rm -f ax25d$(EXEEXT)
$(LINK) $(ax25d_OBJECTS) $(ax25d_LDADD) $(LIBS)
axctl$(EXEEXT): $(axctl_OBJECTS) $(axctl_DEPENDENCIES) $(EXTRA_axctl_DEPENDENCIES)
@rm -f axctl$(EXEEXT)
$(LINK) $(axctl_OBJECTS) $(axctl_LDADD) $(LIBS)
axparms$(EXEEXT): $(axparms_OBJECTS) $(axparms_DEPENDENCIES) $(EXTRA_axparms_DEPENDENCIES)
@rm -f axparms$(EXEEXT)
$(LINK) $(axparms_OBJECTS) $(axparms_LDADD) $(LIBS)
axspawn$(EXEEXT): $(axspawn_OBJECTS) $(axspawn_DEPENDENCIES) $(EXTRA_axspawn_DEPENDENCIES)
@rm -f axspawn$(EXEEXT)
$(LINK) $(axspawn_OBJECTS) $(axspawn_LDADD) $(LIBS)
beacon$(EXEEXT): $(beacon_OBJECTS) $(beacon_DEPENDENCIES) $(EXTRA_beacon_DEPENDENCIES)
@rm -f beacon$(EXEEXT)
$(LINK) $(beacon_OBJECTS) $(beacon_LDADD) $(LIBS)
bpqparms$(EXEEXT): $(bpqparms_OBJECTS) $(bpqparms_DEPENDENCIES) $(EXTRA_bpqparms_DEPENDENCIES)
@rm -f bpqparms$(EXEEXT)
$(LINK) $(bpqparms_OBJECTS) $(bpqparms_LDADD) $(LIBS)
mheard$(EXEEXT): $(mheard_OBJECTS) $(mheard_DEPENDENCIES) $(EXTRA_mheard_DEPENDENCIES)
@rm -f mheard$(EXEEXT)
$(LINK) $(mheard_OBJECTS) $(mheard_LDADD) $(LIBS)
mheardd$(EXEEXT): $(mheardd_OBJECTS) $(mheardd_DEPENDENCIES) $(EXTRA_mheardd_DEPENDENCIES)
@rm -f mheardd$(EXEEXT)
$(LINK) $(mheardd_OBJECTS) $(mheardd_LDADD) $(LIBS)
rxecho$(EXEEXT): $(rxecho_OBJECTS) $(rxecho_DEPENDENCIES) $(EXTRA_rxecho_DEPENDENCIES)
@rm -f rxecho$(EXEEXT)
$(LINK) $(rxecho_OBJECTS) $(rxecho_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/access.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ax25d.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axctl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axparms.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axspawn.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/beacon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bpqparms.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mheard.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mheardd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rxecho.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
install-man1: $(man_MANS)
@$(NORMAL_INSTALL)
@list1=''; \
list2='$(man_MANS)'; \
test -n "$(man1dir)" \
&& test -n "`echo $$list1$$list2`" \
|| exit 0; \
echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
{ for i in $$list1; do echo "$$i"; done; \
if test -n "$$list2"; then \
for i in $$list2; do echo "$$i"; done \
| sed -n '/\.1[a-z]*$$/p'; \
fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
done; }
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man1dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.1[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
install-man4: $(man_MANS)
@$(NORMAL_INSTALL)
@list1=''; \
list2='$(man_MANS)'; \
test -n "$(man4dir)" \
&& test -n "`echo $$list1$$list2`" \
|| exit 0; \
echo " $(MKDIR_P) '$(DESTDIR)$(man4dir)'"; \
$(MKDIR_P) "$(DESTDIR)$(man4dir)" || exit 1; \
{ for i in $$list1; do echo "$$i"; done; \
if test -n "$$list2"; then \
for i in $$list2; do echo "$$i"; done \
| sed -n '/\.4[a-z]*$$/p'; \
fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^4][0-9a-z]*$$,4,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man4dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man4dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man4dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man4dir)" || exit $$?; }; \
done; }
uninstall-man4:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man4dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.4[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^4][0-9a-z]*$$,4,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man4dir)'; $(am__uninstall_files_from_dir)
install-man5: $(man_MANS)
@$(NORMAL_INSTALL)
@list1=''; \
list2='$(man_MANS)'; \
test -n "$(man5dir)" \
&& test -n "`echo $$list1$$list2`" \
|| exit 0; \
echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \
$(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \
{ for i in $$list1; do echo "$$i"; done; \
if test -n "$$list2"; then \
for i in $$list2; do echo "$$i"; done \
| sed -n '/\.5[a-z]*$$/p'; \
fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \
done; }
uninstall-man5:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man5dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.5[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
install-man8: $(man_MANS)
@$(NORMAL_INSTALL)
@list1=''; \
list2='$(man_MANS)'; \
test -n "$(man8dir)" \
&& test -n "`echo $$list1$$list2`" \
|| exit 0; \
echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \
$(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \
{ for i in $$list1; do echo "$$i"; done; \
if test -n "$$list2"; then \
for i in $$list2; do echo "$$i"; done \
| sed -n '/\.8[a-z]*$$/p'; \
fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
done; }
uninstall-man8:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man8dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.8[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
list=`for p in $$list; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
if test -n "$$list" && \
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
echo " typically \`make maintainer-clean' will remove them" >&2; \
exit 1; \
else :; fi; \
else :; fi
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile $(PROGRAMS) $(MANS)
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man4dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-binPROGRAMS clean-generic clean-sbinPROGRAMS \
mostlyclean-am
distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am: install-man
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am: install-binPROGRAMS install-sbinPROGRAMS
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man: install-man1 install-man4 install-man5 install-man8
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-man \
uninstall-sbinPROGRAMS
uninstall-man: uninstall-man1 uninstall-man4 uninstall-man5 \
uninstall-man8
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-sbinPROGRAMS ctags ctags-recursive \
distclean distclean-compile distclean-generic distclean-tags \
distdir dvi dvi-am html html-am info info-am install \
install-am install-binPROGRAMS install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-man1 install-man4 install-man5 \
install-man8 install-pdf install-pdf-am install-ps \
install-ps-am install-sbinPROGRAMS install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-binPROGRAMS uninstall-man \
uninstall-man1 uninstall-man4 uninstall-man5 uninstall-man8 \
uninstall-sbinPROGRAMS
installconf:
$(mkinstalldirs) $(DESTDIR)$(AX25_SYSCONFDIR)
@list='$(etcfiles)'; for p in $$list; do \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(AX25_SYSCONFDIR)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(AX25_SYSCONFDIR)/$$p; \
done
$(mkinstalldirs) $(DESTDIR)$(AX25_LOCALSTATEDIR)/mheard
@list='$(varfiles)'; for p in $$list; do \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(AX25_LOCALSTATEDIR)/mheard/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(AX25_LOCALSTATEDIR)/mheard/$$p; \
done
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
ax25-tools-0.0.10-rc4/ax25/rxecho.8 0000664 0000000 0000000 00000002214 12155142241 013220 0000000 0000000 .TH RXECHO 8 "15 October 1996" Linux "Linux System Managers Manual"
.SH NAME
rxecho \- Route AX.25 packets between ports transparently.
.SH SYNOPSIS
.B rxecho [-l] [-v]
.SH DESCRIPTION
.LP
.B Rxecho
copies AX.25 frames between interfaces without altering their contents. The
purpose of this utility is to allow other AX.25 aware programs/computers to
share the same AX.25 ports as the Linux kernel AX.25 code. It could be used
to route packets out onto another serial port to allow another machine
running DOS based programs to share the same radio ports as the Linux
machine, or it could route packets out onto a pseudo-tty to another
application on the same machine. The copying could even be to another
radio port.
.LP
The copying of the packets is controlled by a configuration file
rxecho.conf(5), which can be set up to selectively copy packets.
.SH OPTIONS
.TP 10
.BI \-l
Enables logging of errors to the system log, the default is off.
.TP 10
.BI \-v
Display the version.
.SH FILES
.nf
/etc/ax25/axports
.br
/etc/ax25/rxecho.conf
.fi
.SH "SEE ALSO"
.BR axports (5),
.BR rxecho.conf (5),
.BR kissattach (8).
.SH AUTHOR
Tomi Manninen OH2BNS
ax25-tools-0.0.10-rc4/ax25/mheard.c 0000664 0000000 0000000 00000016635 12155142241 013257 0000000 0000000 #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "../pathnames.h"
struct PortRecord {
struct mheard_struct entry;
struct PortRecord *Next;
};
static char *types[] = {
"SABM",
"SABME",
"DISC",
"UA",
"DM",
"RR",
"RNR",
"REJ",
"FRMR",
"I",
"UI",
"????"};
static struct PortRecord *PortList = NULL;
static void PrintHeader(int data)
{
switch (data) {
case 0:
printf("Callsign Port Packets Last Heard\n");
break;
case 1:
printf("Callsign Port\n");
break;
case 2:
printf("Callsign Port #I #S #U First Heard Last Heard\n");
break;
case 3:
printf("Callsign Port Packets Type PIDs\n");
break;
}
}
static void PrintPortEntry(struct PortRecord *pr, int data)
{
char lh[30], fh[30], *call, *s;
char buffer[80];
int i;
switch (data) {
case 0:
strcpy(lh, ctime(&pr->entry.last_heard));
lh[19] = 0;
call = ax25_ntoa(&pr->entry.from_call);
if ((s = strstr(call, "-0")) != NULL)
*s = '\0';
printf("%-10s %-5s %5d %s\n",
call, pr->entry.portname, pr->entry.count, lh);
break;
case 1:
buffer[0] = '\0';
call = ax25_ntoa(&pr->entry.from_call);
if ((s = strstr(call, "-0")) != NULL)
*s = '\0';
strcat(buffer, call);
call = ax25_ntoa(&pr->entry.to_call);
if ((s = strstr(call, "-0")) != NULL)
*s = '\0';
strcat(buffer, ">");
strcat(buffer, call);
for (i = 0; i < pr->entry.ndigis && i < 4; i++) {
strcat(buffer, ",");
call = ax25_ntoa(&pr->entry.digis[i]);
if ((s = strstr(call, "-0")) != NULL)
*s = '\0';
strcat(buffer, call);
}
if (pr->entry.ndigis >= 4)
strcat(buffer, ",...");
printf("%-70s %-5s\n",
buffer, pr->entry.portname);
break;
case 2:
strcpy(lh, ctime(&pr->entry.last_heard));
lh[19] = 0;
strcpy(fh, ctime(&pr->entry.first_heard));
fh[19] = 0;
call = ax25_ntoa(&pr->entry.from_call);
if ((s = strstr(call, "-0")) != NULL)
*s = '\0';
printf("%-10s %-5s %5d %5d %5d %s %s\n",
call, pr->entry.portname, pr->entry.iframes, pr->entry.sframes, pr->entry.uframes, fh, lh);
break;
case 3:
call = ax25_ntoa(&pr->entry.from_call);
if ((s = strstr(call, "-0")) != NULL)
*s = '\0';
printf("%-10s %-5s %5d %5s ",
call, pr->entry.portname, pr->entry.count, types[pr->entry.type]);
if (pr->entry.mode & MHEARD_MODE_ARP)
printf(" ARP");
if (pr->entry.mode & MHEARD_MODE_FLEXNET)
printf(" FlexNet");
if (pr->entry.mode & MHEARD_MODE_IP_DG)
printf(" IP-DG");
if (pr->entry.mode & MHEARD_MODE_IP_VC)
printf(" IP-VC");
if (pr->entry.mode & MHEARD_MODE_NETROM)
printf(" NET/ROM");
if (pr->entry.mode & MHEARD_MODE_ROSE)
printf(" Rose");
if (pr->entry.mode & MHEARD_MODE_SEGMENT)
printf(" Segment");
if (pr->entry.mode & MHEARD_MODE_TEXNET)
printf(" TexNet");
if (pr->entry.mode & MHEARD_MODE_TEXT)
printf(" Text");
if (pr->entry.mode & MHEARD_MODE_PSATFT)
printf(" PacsatFT");
if (pr->entry.mode & MHEARD_MODE_PSATPB)
printf(" PacsatPB");
if (pr->entry.mode & MHEARD_MODE_UNKNOWN)
printf(" Unknown");
printf("\n");
break;
}
}
static void ListAllPorts(int data)
{
struct PortRecord *pr;
for (pr = PortList; pr != NULL; pr = pr->Next)
PrintPortEntry(pr, data);
}
static void ListOnlyPort(char *name, int data)
{
struct PortRecord *pr;
for (pr = PortList; pr != NULL; pr = pr->Next)
if (strcmp(pr->entry.portname, name) == 0)
PrintPortEntry(pr, data);
}
static void LoadPortData(void)
{
FILE *fp;
struct PortRecord *pr;
struct mheard_struct mheard;
if ((fp = fopen(DATA_MHEARD_FILE, "r")) == NULL) {
fprintf(stderr, "mheard: cannot open mheard data file\n");
exit(1);
}
while (fread(&mheard, sizeof(struct mheard_struct), 1, fp) == 1) {
pr = malloc(sizeof(struct PortRecord));
pr->entry = mheard;
pr->Next = PortList;
PortList = pr;
}
fclose(fp);
}
static void SortByTime(void)
{
struct PortRecord *p = PortList;
struct PortRecord *n;
PortList = NULL;
while (p != NULL) {
struct PortRecord *w = PortList;
n = p->Next;
if (w == NULL || p->entry.last_heard > w->entry.last_heard) {
p->Next = w;
PortList = p;
p = n;
continue;
}
while (w->Next != NULL && p->entry.last_heard <= w->Next->entry.last_heard)
w = w->Next;
p->Next = w->Next;
w->Next = p;
p = n;
}
}
static void SortByPort(void)
{
struct PortRecord *p = PortList;
struct PortRecord *n;
PortList = NULL;
while (p != NULL) {
struct PortRecord *w = PortList;
n = p->Next;
if (w == NULL || strcmp(p->entry.portname, w->entry.portname) < 0) {
p->Next = w;
PortList = p;
p = n;
continue;
}
while (w->Next != NULL && strcmp(p->entry.portname, w->Next->entry.portname) >= 0)
w = w->Next;
p->Next = w->Next;
w->Next = p;
p = n;
}
}
static void SortByCall(void)
{
struct PortRecord *p = PortList;
struct PortRecord *n;
PortList = NULL;
while (p != NULL) {
struct PortRecord *w = PortList;
n = p->Next;
if (w == NULL || memcmp(&p->entry.from_call, &w->entry.from_call, sizeof(ax25_address)) < 0) {
p->Next = w;
PortList = p;
p = n;
continue;
}
while (w->Next != NULL && memcmp(&p->entry.from_call, &w->Next->entry.from_call, sizeof(ax25_address)) >= 0)
w = w->Next;
p->Next = w->Next;
w->Next = p;
p = n;
}
}
static void SortByFrame(void)
{
struct PortRecord *p = PortList;
struct PortRecord *n;
PortList = NULL;
while (p != NULL) {
struct PortRecord *w = PortList;
n = p->Next;
if (w == NULL || p->entry.count > w->entry.count) {
p->Next = w;
PortList = p;
p = n;
continue;
}
while (w->Next != NULL && p->entry.count <= w->Next->entry.count)
w = w->Next;
p->Next = w->Next;
w->Next = p;
p = n;
}
}
int main(int argc, char *argv[])
{
int headers = TRUE;
int mode = 0;
int data = 0;
int c;
while ((c = getopt(argc, argv, "d:no:v")) != -1) {
switch (c) {
case 'd':
switch (*optarg) {
case 'c':
data = 1;
break;
case 'm':
data = 3;
break;
case 'n':
data = 0;
break;
case 's':
data = 2;
break;
default:
fprintf(stderr, "mheard: invalid display type '%s'\n", optarg);
return 1;
}
break;
case 'n':
headers = FALSE;
break;
case 'o':
switch (*optarg) {
case 'c':
mode = 2;
break;
case 'f':
mode = 3;
break;
case 'p':
mode = 1;
break;
case 't':
mode = 0;
break;
default:
fprintf(stderr, "mheard: invalid ordering type '%s'\n", optarg);
return 1;
}
break;
case 'v':
printf("mheard: %s\n", VERSION);
return 0;
case '?':
case ':':
fprintf(stderr, "Usage: %s [-d cmns] [-n] [-o cfpt] [-v] [port ...]\n", argv[0]);
return 1;
}
}
LoadPortData();
switch (mode) {
case 0: SortByTime(); break;
case 1: SortByPort(); break;
case 2: SortByCall(); break;
case 3: SortByFrame(); break;
}
if (argc == optind) {
if (headers)
PrintHeader(data);
ListAllPorts(data);
} else {
while (argv[optind] != NULL) {
if (headers) {
printf("Port %s:\n", argv[optind]);
PrintHeader(data);
}
ListOnlyPort(argv[optind], data);
optind++;
}
}
return 0;
}
ax25-tools-0.0.10-rc4/ax25/bpqparms.8 0000664 0000000 0000000 00000002421 12155142241 013555 0000000 0000000 .TH BPQPARMS 8 "4 September 1996" Linux "Linux System Managers Manual"
.SH NAME
bpqparms \- Configure BPQ ethernet devices.
.SH SYNOPSIS
.B bpqparms device [-a ethaddr] [-d ethaddr] [-vV]
.SH DESCRIPTION
.LP
.B Bpqparms
allows the setting of the BPQ Ethernet options for a particular device. Each
BPQ Ethernet device appears as a device named bpq0...bpqN which overlays the
original Ethernet device, usually eth0...ethN. This device is an AX.25
device driver and allows AX.25 frames to be transmitted over an Ethernet to
another machine using the same protocol. The default for the device is to
send and receive BPQ Ethernet packets to the broadcast address. This
program replaces the previous \(lqaxparms -dev\(rq option.
.SH OPTIONS
.TP 15
.BI "\-a ethaddr"
Allows the setting of which ethernet address will be accepted by the BPQ
Ethernet device.
.TP 15
.BI "\-d ethaddr"
If specified on its own, will set the destination ethernet address will be
used for transmitting and for receiving of BPQ ethernet packets. An address
of \(lqbroadcast\(rq sets it to the ethernet broadcast address.
.TP 15
.BI \-v
Displays the version number.
.TP 15
.BI \-V
The original version messages.
.SH "SEE ALSO"
.BR ax25 (4),
.BR axports (5),
.BR ifconfig (8).
.SH AUTHOR
Joerg Reuter DL1BKE
ax25-tools-0.0.10-rc4/ax25/axparms.8 0000664 0000000 0000000 00000006756 12155142241 013422 0000000 0000000 .TH AXPARMS 8 "25 July 1997" Linux "Linux System Managers Manual"
.SH NAME
axparms \- Configure AX.25 interfaces.
.SH SYNOPSIS
.B axparms --assoc|--forward|--route|--setcall|--version ...
.SH DESCRIPTION
.LP
The
.B axparms
command is designed to be a multi-function command that allows miscellaneous
commands to be issued to the Linux AX.25 protocol layer. It includes the
functionality of
.B axassociate
and
.B axsetcall
which this command superceedes. The different modes of the command are
chosen by the first argument. Sunsequent arguments depend upon this argument
and so no generalised command format can be given.
.SH "--assoc Argument"
.LP
The format of this option is:
.LP
.nf
.B axparms --assoc
.br
.B axparms --assoc delete
.br
.B axparms --assoc policy [default|deny]
.br
.B axparms --assoc show
.fi
.LP
This option mainpulates the kernel uid/callsign mapping table, allowing
callsigns to be associated and dis-associated with a user. The
.B policy
option permits the superuser to have all other uid's either default to the
actual port name, or to block traffic.
.LP
At power up the table is blank and the policy is 'default', which is thus
backward compatible.
.SH "--forward Argument"
.LP
Allows the use of many receivers with one transmitter, known as packet
forwarding in many systems. The format of this command is:
.LP
.nf
.B axparms --forward
.br
.B axparms --forward delete
.fi
.LP
Any packets to be transmitted on port portfrom will be transmitted on port
portto. This will stay in force until the second form of the command is
issued which will remove the association.
.SH "--route Argument"
.LP
This option allows the internal AX.25 routing table to be manipulated. This
table is available for reading in /proc/net/ax25_route, and will be built up
dynamically by stations heard. However it is possible to add, delete and list
entries via this option.
.LP
The formats of this option are:
.LP
.nf
.B axparms --route add [] [--ipmode V|D]
.br
.B axparms --route del
.fi
.B axparms --route list
.fi
.LP
Routes added via this command will not be removed from the internal routing
table when they are \(lqold\(rq as normal entries are. The
.B --ipmode
option sets mode vc or mode datagram for this destination.
.LP
If the argument is set to \(lqdefault\(rq then this will set the
default route for all outgoing AX.25 connections which will be used when there
is no specific route to the required destination.
.SH "--setcall Argument"
.LP
The format of this option is:
.LP
.B axparms --setcall
.LP
This changes the callsign associated at the given physical ax25 interface.
.LP
Cave: The interface name is not the symbolic port name from axports, but
the real interface name (from ifconfig(8)):
ax0, ax1, .., sp0, .., bpq0, ... etc..
.LP
The change is permanent as long as the interface exists, or another \(lqaxparms
--setcall\(rq is issued.
.LP
The interface has to exist already in order to use this option; it
may be in state UP or DOWN.
.SH "--version Argument"
.LP
This option displays the version of the AX.25 utilities that
.B axparms
belongs to.
.SH FILES
.LP
/proc/net/ax25_bpqether
.br
/proc/net/ax25_calls
.br
/etc/ax25/axports
.SH "SEE ALSO"
.BR call (1),
.BR getsockopt (2),
.BR setsockopt (2),
.BR ax25 (4),
.BR axctl (8),
.BR axports (5).
.SH AUTHORS
.nf
Alan Cox GW4PTS
.br
Jonathan Naylor G4KLX
.br
Joerg Reuter DL1BKE
.fi
ax25-tools-0.0.10-rc4/ax25/axspawn.8 0000664 0000000 0000000 00000011234 12155142241 013413 0000000 0000000 .TH AXSPAWN 8 "25 August 1996" Linux "Linux System Managers Manual"
.SH NAME
axspawn \- Allow automatic login to a Linux system.
.SH SYNOPSIS
.B axspawn [--pwprompt PR0MPT, -p PR0MPT] [--changeuser, -c] [--rootlogin, -r] [--only-md5] [--wait, -w]
.SH DESCRIPTION
.LP
.B Axspawn
will check if the peer is an AX.25 connect, the callsign a valid Amateur
Radio callsign, strip the SSID, check if UID/GID are valid, allow a
password-less login if the password-entry in /etc/passwd is \(lq+\(rq or
empty; in every other case login will prompt for a password.
.LP
.B Axspawn
can create user accounts automatically. You may specify the user shell,
first and maximum user id, group ID in the config file and (unlike WAMPES)
create a file \(lq/etc/ax25/ax25.profile\(rq which will be copied to
~/.profile.
.SH SECURITY
.LP
Auto accounting is a security problem by definition. Unlike WAMPES, which
creates an empty password field, Axspawn adds an \(lqimpossible\(rq ('+')
password to /etc/passwd. Login gets called with the \(lq-f\(rq option, thus
new users have the chance to login without a password. (I guess this won't
work with the shadow password system).
.LP
Of course
.B axspawn
does callsign checking: Only letters and numbers are allowed, the callsign
must be longer than 4 characters and shorter than 6 characters (without
SSID). There must be at least one digit, and max. two digits within the
call. The SSID must be within the range of 0 and 15. Please drop me a note
if you know a valid Amateur Radio callsign that does not fit this pattern
_and_ can be represented correctly in AX.25.
.LP
axspawn also has the well known authentication mechanisms of the AX.25 bbs
.B baycom (sys)
and
.B md5
standards.
axspawn searches in /etc/ax25/bcpasswd (first) and ~user/.bcpasswd (second)
for a match of the required authentication mechanism and password.
md5 and baycom passwords may differ. md5 passwords gain over baycom passwords.
Note: you could "lock" special "friends" out by specifying an empty password
in /etc/ax25/bcpasswd (line "n0call:md5:"). -> md5 Passwords are enforced. But
the length is shorter than the minimum (len 8 for md5, len 20 for baycom);
user's password file is not searched because in /etc/ax25/bcpasswd its already
found..
Syntax and caveeats for /etc/ax25/bcpasswd:
- Has to be a regular file (no symlink). Not world-readable/writable.
- Example lines:
# Thomas
dl9sau:md5:abcdefgh
# Test
te1st:sys:12345678901234567890
# root
root:md5:ziz7AoxuAt6jeuthTheexet0uDa9iefuAeph3eelAetahmi0
# misconfiguration:
thisbadlineisignored
# With this line
systempasswordonly
# .. axspan will not look in user's homedir for his .bcpasswd
Syntax and caveeats for user's .bcpasswd in his $HOME:
- Has to be a regular file (no symlink). Neither group- nor world-
read-/writable. Has to be owned by the user or uid 0 (root).
- Example lines:
# could be shorter
md5:abcdefgh
# should be longer
sys:12345678901234567890
.SH OPTIONS
.TP 5
.B -p DB0FHN or --pwprompt DB0FHN
While baycom or md5 password authentication (see above), the password prompt
is set to the first argument (DB0FHN in this example). This may be needed
for some packet-radio terminal programs for detecting the password prompt
properly.
.TP 5
.B -c, --changeuser
Allow connecting ax25 users to change their username for login. They'll be
asked for their real login name.
.TP 5
.B -e, --embedded
Special treatment for axspawn on non-standard conform embedded devices.
I.e. openwrt has no true /bin/login: if you use it as a real login program,
it raises a security hole.
.TP 5
.B -r, --rootlogin
Permit login as user root. Cave: only md5 or baycom style is allowed; no
plaintext password.
.TP 5
.B --only-md5
Insist in md5 authentication during login. If no password for the user is
found, or it is not md5, then no other login mechanism is granted.
This option, in combination with -c and -r, may be a useful configuration for
systems where no ax25 user accounts are available, but you as sysop would
like to have a login access for your administrative tasks.
.TP 5
.B -w, --wait
Eats the first line the user sends. This feature is useful if you have
TCP VC connects to the same Call+SSID. It is now obsolete, because
ax25d is the right place for this and implements this functionality better.
.TP 5
Theses are options and not part of the preferences because you _may_ like to have on every interface definition in ax25d.conf (where axspawn is started from) a different behaviour.
.SH FILES
.nf
/etc/passwd
.br
/etc/ax25/ax25.profile
.br
/etc/ax25/axspawn.conf
.fi
/etc/ax25/bcpasswd
.fi
~/.bcpasswd
.fi
.SH "SEE ALSO"
.BR axspawn.conf (5),
.BR ax25d (8).
.SH AUTHOR
Joerg Reuter DL1BKE
ax25-tools-0.0.10-rc4/ax25/ax25d.c 0000664 0000000 0000000 00000110276 12155142241 012736 0000000 0000000 /*
* This is my version of axl.c, written for the LBBS code to make it
* compatable with the kernel AX25 driver. It appears to work, with
* my setup, so it'll probably not work else where :-).
*
* This was inspired by the example code written by Alan Cox (GW4PTS)
* axl.c in AX25USER.TGZ from sunacm.swan.ac.uk.
*
*
* Copyright (C) 1995, 1996 by Darryl L. Miles, G7LED.
* Copyright (C) 1996 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
*
* Just a quickie Feb 1995.
* It *was* just a quickie (at the time) but you'd know how these things
* just... Apr 1995.
*
* If your AX25/NETROM system is relying on this code for
* securetty/firewalling then please be aware this has been coded
* with the intent on striving on through system/(mis)configuration
* errors in the hope that at worst it will run with a degraded
* service. Rather than leave your system providing no service at
* all, if opinions require the old behavior back when let me know
* and I'll #ifdef it in.
*
*
* History:
*
* 1.0 Feb 1995 Basic AX25 listening daemon, Multi-port, Call
* matching, etc...
*
* 1.1 Feb 1995 Moved entry scanning before fork().
* Added setgroups() to plug security hole.
* Minor fixes + Improved handling.
*
* 1.2 Apr 1995 NETROM support added from developing AX25
* 028b/029.
* Added 'defaults' port setting.
* Added FLAG_NODIGIS.
*
* 1.3 Jul 1995 Make it a little more intelligent about what to
* do with errors.
* Added exec and argv[0] as two different fields,
* much like inetd uses.
*
* 1.4 Aug 1995 Confirmed support for AX25 030 (1.3.20 + hacks),
* it appears to work.
* It will now bootup even if initial config errors
* occur when setting up and binding (e.g. port(s)
* down), it will skip the port(s) with a problem
* and listen out on those which are left standing.
*
* 1.5 Aug 1995 Updated old (buggy) libax25.a function copies in axl.
* Causing all sorts of problems.
*
* 1.6 Aug 1995 Reset the 'defaults' entry's when we start parsing
* a new interface.
*
* 1.7 Dec 1995 Added BROKEN_NETROM_KERNEL define for setsockopt.
*
* 1.8 Jan 1996 Added support for AX25_BIND_ANY_DEVICE, specify just
* [CALL-X VIA *].
* Better param parsing, T1 and T2 now using the real
* time in seconds as params, and not kernel units.
* Connection loggin added, either via it's own logfile
* or syslog.
* Modified 'defaults' to 'parameters'.
*
* 1.9 Jun 1996 Reworked config file parsing to use port names instead
* of callsigns. Reformated source code.
*
* Under alpha:
* BPQ like clever mode called for.... also a mode that
* requires a packet to kick application open.
* A flag/mode which will cause a call to initgroups()
* based on uid.
* Callsign validation check.
* Logging of errors.
* Handling of AX25.IP mode VC connections - dl9sau
* recommended settings in ax25d.conf:
* parameters_extAX25 VC-wait-login VC-disc-on-linkfailure-msg VC-log-connections
or
* parameters_extAX25 VC-reject-login VC-send-failure-msg VC-log-connections
*
*
* TODO:
* The timing of the 'accept()' might be changed, defered to the
* child, then that child fork() itself, to stop race conditions
* around 'accept()'.
* Add a config file to allow/disallow connections/services at
* different times of the day to restrict access say.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include