aboutsummaryrefslogtreecommitdiff
path: root/comms/aprsd/files
diff options
context:
space:
mode:
Diffstat (limited to 'comms/aprsd/files')
-rw-r--r--comms/aprsd/files/aprsd70
-rw-r--r--comms/aprsd/files/patch-admin_aprsd.conf35
-rw-r--r--comms/aprsd/files/patch-src_aprsString.h12
-rw-r--r--comms/aprsd/files/patch-src_aprsd.cpp41
-rw-r--r--comms/aprsd/files/patch-src_osdep.h46
-rw-r--r--comms/aprsd/files/patch-src_queryResp.cpp34
-rw-r--r--comms/aprsd/files/patch-src_servers.cpp19
-rw-r--r--comms/aprsd/files/patch-src_servers.h34
-rw-r--r--comms/aprsd/files/patch-src_utils.cpp36
-rw-r--r--comms/aprsd/files/patch-src_validate.cpp115
-rw-r--r--comms/aprsd/files/pkg_message.in9
11 files changed, 451 insertions, 0 deletions
diff --git a/comms/aprsd/files/aprsd b/comms/aprsd/files/aprsd
new file mode 100644
index 000000000000..5556e8572595
--- /dev/null
+++ b/comms/aprsd/files/aprsd
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# PROVIDE: aprsd
+# REQUIRE: NETWORKING
+#
+# Add the following lines to /etc/rc.conf
+# aprsd_enable="YES"
+# aprsd_root="YES" or aprsd_root="NO"
+
+. /etc/rc.subr
+
+name="aprsd"
+rcvar=`set_rcvar`
+load_rc_config $name
+aprsd_enable=${aprsd_enable-"NO"}
+aprsd_root=${aprsd_root-"NO"}
+
+command="/usr/local/bin/aprsd"
+start_cmd=aprsd_start
+stop_cmd=aprsd_stop
+
+PIDFILE="/var/run/aprsd.pid"
+UID="aprsd"
+GID="aprsd"
+#
+# aprsd.init for version 2.1.5. starts or stops aprsd server.
+# This file should be placed in /usr/local/etc/rc.d/
+#
+#
+#
+# Author: Dale Heatherington <aprsd1@wa4dsy.net>
+# Modified: Diane Bruce <va3db@amsat.org>
+
+# Source function library.
+#. /etc/rc.d/init.d/functions
+# See how we were called.
+aprsd_start()
+{
+ if [ -s ${PIDFILE} ] ; then
+ kill -0 `cat ${PIDFILE}` >&- 2>&-
+ if [ $? -eq 0 ]; then
+ echo "aprs server is already running."
+ return 0
+ fi
+ fi
+ if [ ${aprsd_root} != "YES" ]; then
+ echo "Starting aprs server as user ${UID}:${GID}."
+ touch ${PIDFILE}
+ chown ${UID}:${GID} ${PIDFILE}
+ chown ${UID}:${GID} /var/log/aprsd
+ chown ${UID}:${GID} /var/log/aprsd/*
+ su ${UID} -m -c "${command} -d"
+ else
+ echo "Starting aprs server as root."
+ chown root:wheel ${PIDFILE}
+ chown root:wheel /var/log/aprsd
+ chown root:wheel /var/log/aprsd/*
+
+ ${command} -d
+ fi
+ return 0
+}
+aprsd_stop()
+{
+ echo "Stopping aprs server daemon. "
+ kill -INT `cat ${PIDFILE}`
+ return 0
+}
+
+run_rc_command "$1"
diff --git a/comms/aprsd/files/patch-admin_aprsd.conf b/comms/aprsd/files/patch-admin_aprsd.conf
new file mode 100644
index 000000000000..0a5437a4b479
--- /dev/null
+++ b/comms/aprsd/files/patch-admin_aprsd.conf
@@ -0,0 +1,35 @@
+--- admin/aprsd.conf.orig 2008-01-22 20:08:12.000000000 -0500
++++ admin/aprsd.conf 2008-01-22 20:12:45.000000000 -0500
+@@ -46,7 +46,7 @@
+ #Define the TNC beacon. The TNC will supply the ax25 path header.
+ #It's optional and you may use the TNC BTEXT in the INIT.TNC file instead.
+ #
+-TncBeacon 10 !3802.21N/07830.61W& Linux APRS Server
++TncBeacon 10 !3802.21N/07830.61W& FreeBSD APRS Server
+ #
+ #
+ #Send 2 extra message acks is addition to each received ack to TNC
+@@ -65,12 +65,12 @@
+ #If undefined all TNC related functions are disabled.
+ #Permissable baud rates are 1200,2400,4800,9600 and 19200.
+ #
+-#tncport /dev/ttyS0
++#tncport /dev/cuad0
+ #tncport radio
+ #tncbaud 1200
+
+ #Define the path for transmitted packets
+-#This is only used when using Linux sockets, not the TNC.
++#This is only used when using FreeBSD sockets, not the TNC.
+ #For the TNC, set this in INIT.TNC. Note the format is
+ #slightly different to the TNC command.
+ aprspath APRS v WIDE
+@@ -97,7 +97,7 @@
+ logAllRF no
+ #
+ # Allow the insecure aprs passcodes to be used
+-# Note: "no" means all users need Linux user names and passwords
++# Note: "no" means all users need FreeBSD user names and passwords
+ # and aprsd must be run as root for that to work.
+ aprsPass yes
+ #
diff --git a/comms/aprsd/files/patch-src_aprsString.h b/comms/aprsd/files/patch-src_aprsString.h
new file mode 100644
index 000000000000..981efc52fddb
--- /dev/null
+++ b/comms/aprsd/files/patch-src_aprsString.h
@@ -0,0 +1,12 @@
+--- src/aprsString.h.orig 2008-01-12 18:11:00.000000000 -0500
++++ src/aprsString.h 2008-01-12 18:11:35.000000000 -0500
+@@ -196,7 +196,8 @@
+ void parseLogon(void);
+ bool parseCommand(void);
+ bool parsePortFilter(void);
+- void aprsString::getMsgText(string& msg);
++// void aprsString::getMsgText(string& msg);
++ void getMsgText(string& msg);
+ void print(ostream& os);
+ string getAX25Source(void);
+ string getAX25Dest(void);
diff --git a/comms/aprsd/files/patch-src_aprsd.cpp b/comms/aprsd/files/patch-src_aprsd.cpp
new file mode 100644
index 000000000000..60ae52f0a921
--- /dev/null
+++ b/comms/aprsd/files/patch-src_aprsd.cpp
@@ -0,0 +1,41 @@
+--- src/aprsd.cpp.orig 2003-05-28 23:09:39.000000000 -0400
++++ src/aprsd.cpp 2008-01-24 01:13:26.000000000 -0500
+@@ -98,7 +98,8 @@
+ int msgsn;
+
+ const string HOMEDIR("/home/aprsd2");
+-const string CONFPATH("");
++const string LOGPATH("%%LOGPATH%%");
++const string CONFPATH("%%CONFPATH%%");
+ const string CONFFILE("aprsd.conf");
+ const string MAINLOG("aprsd.log");
+ const string STSMLOG("thirdparty.log");
+@@ -126,7 +127,7 @@
+ WriteLog(string("Server Shutdown"), MAINLOG);
+ tcsetattr(fileno(stdin),TCSANOW,&initial_settings); //restore terminal mode
+
+- string outFile = CONFPATH;
++ string outFile = LOGPATH;
+ outFile += SAVE_HISTORY;
+ int n = SaveHistory(outFile);
+
+@@ -872,8 +873,8 @@
+ if (f.is_open()) {
+ f.read(s, 10);
+ xx = atoi(s);
+- kill(xx, SIGCHLD); // Meaningless kill to determine if pid is used
+- if (errno != ESRCH) {
++ kill(xx, 0); // Meaningless kill to determine if pid is used
++ if (errno == 0) {
+ cout << "aprsd already running" << endl;
+ cout << "PID: " << pid_file << endl;
+ exit(1);
+@@ -977,7 +978,7 @@
+
+ //fdump = fopen("dump.txt","w+"); //debug
+
+- string histFile = CONFPATH;
++ string histFile = LOGPATH;
+ histFile += SAVE_HISTORY;
+ ReadHistory(histFile);
+
diff --git a/comms/aprsd/files/patch-src_osdep.h b/comms/aprsd/files/patch-src_osdep.h
new file mode 100644
index 000000000000..69b2ffe64a8a
--- /dev/null
+++ b/comms/aprsd/files/patch-src_osdep.h
@@ -0,0 +1,46 @@
+--- src/osdep.h.orig 2003-04-20 14:34:47.000000000 -0400
++++ src/osdep.h 2008-01-23 23:29:47.000000000 -0500
+@@ -32,6 +32,14 @@
+ extern "C"
+ {
+ #include <netdb.h>
++#if (defined(__unix__) || defined(unix)) && !defined(USG)
++#include <sys/param.h>
++#endif
++#ifdef BSD
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <netdb.h>
++#endif
+
+ #if TIME_WITH_SYS_TIME
+ # include <sys/time.h>
+@@ -63,10 +71,27 @@
+ char *buf, size_t buflen, struct hostent **result,
+ int *h_errnop)
+ {
+-#ifdef __GLIBC__
++#ifdef BSD
++#if (__FreeBSD_version >= 600000)
+ return ::gethostbyname_r (name.c_str (), result_buf,
+ buf, buflen, result, h_errnop);
+ #else
++ struct hostent *h;
++ h = gethostbyname (name.c_str());
++ if (h != NULL) {
++ memcpy(result_buf,h,sizeof(*h));
++ *result = h;
++ *h_errnop = 0;
++ return 0;
++ } else {
++ *h_errnop = 0;
++ return 1;
++ }
++#endif
++#endif
++#ifdef __GLIBC__
++ return ::gethostbyname_r (name.c_str (), result_buf,
++ buf, buflen, result, h_errnop);
+ if (buflen < sizeof (hostent_data))
+ {
+ if (h_errnop != NULL)
diff --git a/comms/aprsd/files/patch-src_queryResp.cpp b/comms/aprsd/files/patch-src_queryResp.cpp
new file mode 100644
index 000000000000..94d0ce44ed9f
--- /dev/null
+++ b/comms/aprsd/files/patch-src_queryResp.cpp
@@ -0,0 +1,34 @@
+--- src/queryResp.cpp.orig 2003-03-30 23:49:40.000000000 -0500
++++ src/queryResp.cpp 2008-01-23 22:12:30.000000000 -0500
+@@ -40,6 +40,9 @@
+
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
++#if (defined(__unix__) || defined(unix)) && !defined(USG)
++#include <sys/param.h>
++#endif
+
+ #include "constant.h"
+ #include "utils.h"
+@@ -84,7 +87,6 @@
+ if ((rc = gethostname(hostname,80)) != 0)
+ strcpy(hostname, "Host_Unknown");
+ else {
+-
+ //Thread-Safe verison of gethostbyname()
+ h = NULL;
+ rc = gethostbyname_r(hostname,
+@@ -94,12 +96,10 @@
+ &h,
+ &h_err);
+
+-
+-
+ if ((rc == 0) && (h!= NULL)) {
+ strncpy(hostname,h->h_name,80); //Copy Full host name
+ hostname[79] = '\0'; //Be sure it's terminated
+- strncpy((char*)hip,h->h_addr_list[0],4); //Copy Host IP
++ memcpy((void*)hip,(void*)h->h_addr_list[0],4); //Copy Host IP
+ }
+ }
+
diff --git a/comms/aprsd/files/patch-src_servers.cpp b/comms/aprsd/files/patch-src_servers.cpp
new file mode 100644
index 000000000000..783b15b13da4
--- /dev/null
+++ b/comms/aprsd/files/patch-src_servers.cpp
@@ -0,0 +1,19 @@
+--- src/servers.cpp.orig 2003-10-01 12:58:27.000000000 -0400
++++ src/servers.cpp 2008-01-23 23:26:01.000000000 -0500
+@@ -2627,7 +2627,6 @@
+ &hostinfo,
+ &h_err);
+
+-
+ if (rc || (hostinfo == NULL)){
+ char* cp = new char[256];
+ memset(cp, 0, 256);
+@@ -3277,7 +3276,7 @@
+
+ //----------------------------------------------------------------------
+
+-inline string convertUpTime(int dTime)
++string convertUpTime(int dTime)
+ {
+ std::ostringstream ostr;
+ int x;
diff --git a/comms/aprsd/files/patch-src_servers.h b/comms/aprsd/files/patch-src_servers.h
new file mode 100644
index 000000000000..1812f1abf994
--- /dev/null
+++ b/comms/aprsd/files/patch-src_servers.h
@@ -0,0 +1,34 @@
+--- src/servers.h.orig 2008-01-12 18:18:53.000000000 -0500
++++ src/servers.h 2008-01-12 18:36:15.000000000 -0500
+@@ -28,6 +28,12 @@
+
+ #include <string>
+ #include <sstream>
++#if (defined(__unix__) || defined(unix)) && !defined(USG)
++#include <sys/param.h>
++#endif
++#ifdef BSD
++#include <netinet/in.h>
++#endif
+
+ #include "aprsd.h"
+ #include "mutex.h"
+@@ -135,11 +141,17 @@
+
+
+ //Stuff for trusted UDP source IPs
++#ifdef BSD
++struct sTrusted {
++ struct in_addr sin_addr; //ip address
++ struct in_addr sin_mask; //subnet mask
++};
++#else
+ struct sTrusted {
+ in_addr sin_addr; //ip address
+ in_addr sin_mask; //subnet mask
+ };
+-
++#endif
+
+ struct sLogon{
+ char *user;
diff --git a/comms/aprsd/files/patch-src_utils.cpp b/comms/aprsd/files/patch-src_utils.cpp
new file mode 100644
index 000000000000..42e7150ab10d
--- /dev/null
+++ b/comms/aprsd/files/patch-src_utils.cpp
@@ -0,0 +1,36 @@
+--- src/utils.cpp.orig 2003-10-01 12:58:27.000000000 -0400
++++ src/utils.cpp 2008-01-22 21:54:44.000000000 -0500
+@@ -41,6 +41,7 @@
+
+ static RecursiveMutex pmtxLog;
+
++const string LOGPATH("%%LOGPATH%%");
+
+ int WriteLog(const string& sp, const string& LogFile)
+ {
+@@ -50,11 +51,12 @@
+ static Lock locker(pmtxLog, false);
+
+ locker.get();
++ string pLogFile = LOGPATH + LogFile;
+
+- ofstream ofs(LogFile.c_str(), ios::out | ios::app);
++ ofstream ofs(pLogFile.c_str(), ios::out | ios::app);
+
+ if (!ofs)
+- cerr << "File I/O Error: Unable to open/create file " << LogFile << endl;
++ cerr << "File I/O Error: Unable to open/create file " << pLogFile << endl;
+
+ time(&ltime); // Timestamp
+ ctime_r(&ltime, szTime); // "threadsafe" ctime
+@@ -91,8 +93,8 @@
+
+ pthread_mutex_lock(pmtxLog);
+
+- char* pLogFile = new char[CONFPATH.length() + strlen(LogFile) +1];
+- strcpy(pLogFile,CONFPATH.c_str());
++ char* pLogFile = new char[LOGPATH.length() + strlen(LogFile) +1];
++ strcpy(pLogFile,LOGPATH.c_str());
+ strcat(pLogFile, LogFile);
+
+ f = fopen(pLogFile, "a");
diff --git a/comms/aprsd/files/patch-src_validate.cpp b/comms/aprsd/files/patch-src_validate.cpp
new file mode 100644
index 000000000000..51894c79abf4
--- /dev/null
+++ b/comms/aprsd/files/patch-src_validate.cpp
@@ -0,0 +1,115 @@
+--- src/validate.cpp.orig 2008-01-13 20:00:27.000000000 -0500
++++ src/validate.cpp 2008-01-13 20:45:17.000000000 -0500
+@@ -34,6 +34,10 @@
+ #include <iostream>
+ #include <strstream>
+ #include <iomanip>
++#include <netdb.h>
++#if (defined(__unix__) || defined(unix)) && !defined(USG)
++#include <sys/param.h>
++#endif
+
+ using namespace std;
+
+@@ -47,11 +51,17 @@
+ const string group;
+ };
+ #else
++#ifdef BSD
++#include <pwd.h>
++#include <grp.h>
++#define MAXGROUPSIZE 1024
++#else
+ #include <crypt.h>
+ #include <grp.h>
+ #include <pwd.h>
+ #include <shadow.h>
+ #endif
++#endif
+
+ #include "validate.h"
+
+@@ -140,12 +150,21 @@
+ pam_end(pamh, PAM_SUCCESS);
+ return 0;
+ #else
++#ifdef BSD
++ passwd *ppw = NULL;
++ struct group *pgrp = NULL;
++ struct spwd *pspwd = NULL;
++ char *member = NULL;
++ struct group grp;
++ struct passwd pwd;
++#else
+ passwd *ppw = NULL;
+ group *pgrp = NULL;
+ spwd *pspwd = NULL;
+ char *member = NULL;
+ struct group grp;
+ struct passwd pwd;
++#endif
+ int i;
+ char salt[16];
+ int usrfound = 0 ;
+@@ -158,7 +177,11 @@
+ #endif
+
+
++#ifdef BSD
++ size_t bufsize=MAXGROUPSIZE;
++#else
+ size_t bufsize = sysconf(_SC_GETGR_R_SIZE_MAX);
++#endif
+ char *buffer1 = new char[bufsize];
+ //Thread-Safe getgrnam()
+ getgrnam_r(szGroup.c_str(), /* Does group name szGroup exist? */
+@@ -171,9 +194,11 @@
+ delete buffer1;
+ return rc; /* return BADGROUP if not */
+ }
+-
++#ifdef BSD
++ bufsize = MAXGROUPSIZE;
++#else
+ bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
+-
++#endif
+ char *buffer2 = new char[bufsize];
+ //Thread-Safe getpwnam()
+ getpwnam_r(szUser.c_str(),
+@@ -214,6 +239,7 @@
+
+ pwLength = strlen(ppw->pw_passwd);
+
++#if 0
+ if (ppw->pw_passwd[0] != '$') {
+ /* DES salt */
+ strncpy(salt,ppw->pw_passwd,2);
+@@ -230,15 +256,18 @@
+ salt[i++] = '$';
+ salt[i] = '\0';
+ }
++#endif
++
+ #ifdef DEBUG
+ cout << "salt=" << salt << endl;
+ #endif
+
+- if (strcmp(crypt(szPass.c_str(), salt), ppw->pw_passwd) == 0 )
++ if (strcmp(crypt(szPass.c_str(), ppw->pw_passwd), ppw->pw_passwd) == 0 )
+ rc = 0;
+ else
+ rc = BADPASSWD;
+
++#ifndef BSD /* BSD passwords are always shadowed */
+ if ((rc == BADPASSWD) && (strcmp("x",ppw->pw_passwd) == 0)) {
+ #ifdef DEBUG
+ cout << "Shadow passwords enabled\n";
+@@ -288,6 +317,7 @@
+ << endl;
+ #endif
+ }
++#endif
+ delete buffer1;
+ delete buffer2;
+ return rc;
diff --git a/comms/aprsd/files/pkg_message.in b/comms/aprsd/files/pkg_message.in
new file mode 100644
index 000000000000..2ed67ce89297
--- /dev/null
+++ b/comms/aprsd/files/pkg_message.in
@@ -0,0 +1,9 @@
+aprsd is now installed
+
+aprsd has various config files to set up in %%PREFIX%%/etc/aprsd
+logs are kept in /var/log/aprsd
+
+To enable aprsd you need to add: aprsd_enable="YES" to /etc/rc.conf
+to run aprsd as UID aprsd add: aprsd_root="NO" to /etc/rc.conf
+
+- 73 Diane VA3DB