Index: head/comms/aprsd/files/patch-admin_aprsd.conf =================================================================== --- head/comms/aprsd/files/patch-admin_aprsd.conf (revision 459383) +++ head/comms/aprsd/files/patch-admin_aprsd.conf (revision 459384) @@ -1,35 +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 @@ +--- admin/aprsd.conf.orig 2003-10-01 16:57:16 UTC ++++ admin/aprsd.conf +@@ -46,7 +46,7 @@ NetBeacon 10 !3802.21NI07830.61W& APRS Server #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 @@ +@@ -65,12 +65,12 @@ expire 35 #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 @@ +@@ -97,7 +97,7 @@ Trace no 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 # Property changes on: head/comms/aprsd/files/patch-admin_aprsd.conf ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -yes \ No newline at end of property +1 \ No newline at end of property Index: head/comms/aprsd/files/patch-src_aprsString.h =================================================================== --- head/comms/aprsd/files/patch-src_aprsString.h (revision 459383) +++ head/comms/aprsd/files/patch-src_aprsString.h (revision 459384) @@ -1,12 +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 @@ +--- src/aprsString.h.orig 2003-10-01 16:58:27 UTC ++++ src/aprsString.h +@@ -196,7 +196,8 @@ class aprsString: public string (public) 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); Property changes on: head/comms/aprsd/files/patch-src_aprsString.h ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -yes \ No newline at end of property +1 \ No newline at end of property Index: head/comms/aprsd/files/patch-src_aprsd.cpp =================================================================== --- head/comms/aprsd/files/patch-src_aprsd.cpp (revision 459383) +++ head/comms/aprsd/files/patch-src_aprsd.cpp (revision 459384) @@ -1,41 +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 @@ +--- src/aprsd.cpp.orig 2003-05-29 03:09:39 UTC ++++ src/aprsd.cpp +@@ -98,7 +98,8 @@ string szAprsPath; int msgsn; const string HOMEDIR("/home/aprsd2"); -const string CONFPATH(""); -+const string LOGPATH("%%LOGPATH%%"); -+const string CONFPATH("%%CONFPATH%%"); ++const string LOGPATH("/var/log/aprsd/"); ++const string CONFPATH("/usr/local/etc/aprsd/"); const string CONFFILE("aprsd.conf"); const string MAINLOG("aprsd.log"); const string STSMLOG("thirdparty.log"); -@@ -126,7 +127,7 @@ +@@ -126,7 +127,7 @@ void serverQuit(void) /* Invoked by console 'q' q 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 @@ +@@ -872,8 +873,8 @@ int daemonInit(void) 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 @@ +@@ -977,7 +978,7 @@ int main(int argc, char *argv[]) //fdump = fopen("dump.txt","w+"); //debug - string histFile = CONFPATH; + string histFile = LOGPATH; histFile += SAVE_HISTORY; ReadHistory(histFile); Property changes on: head/comms/aprsd/files/patch-src_aprsd.cpp ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -yes \ No newline at end of property +1 \ No newline at end of property Index: head/comms/aprsd/files/patch-src_osdep.h =================================================================== --- head/comms/aprsd/files/patch-src_osdep.h (revision 459383) +++ head/comms/aprsd/files/patch-src_osdep.h (revision 459384) @@ -1,46 +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 +--- src/osdep.h.orig 2003-04-20 18:34:47 UTC ++++ src/osdep.h @@ -32,6 +32,14 @@ extern "C" { #include +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include +#endif +#ifdef BSD +#include +#include +#include +#endif #if TIME_WITH_SYS_TIME # include -@@ -63,10 +71,27 @@ +@@ -63,10 +71,27 @@ namespace aprsd 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) Property changes on: head/comms/aprsd/files/patch-src_osdep.h ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -yes \ No newline at end of property +1 \ No newline at end of property Index: head/comms/aprsd/files/patch-src_queryResp.cpp =================================================================== --- head/comms/aprsd/files/patch-src_queryResp.cpp (revision 459383) +++ head/comms/aprsd/files/patch-src_queryResp.cpp (revision 459384) @@ -1,34 +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 +--- src/queryResp.cpp.orig 2003-03-31 04:49:40 UTC ++++ src/queryResp.cpp @@ -40,6 +40,9 @@ #include #include +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include +#endif #include "constant.h" #include "utils.h" -@@ -84,7 +87,6 @@ +@@ -84,7 +87,6 @@ void queryResp(int source, const aprsString* pkt) 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 @@ +@@ -94,12 +96,10 @@ void queryResp(int source, const aprsString* pkt) &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 } } Property changes on: head/comms/aprsd/files/patch-src_queryResp.cpp ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -yes \ No newline at end of property +1 \ No newline at end of property Index: head/comms/aprsd/files/patch-src_servers.cpp =================================================================== --- head/comms/aprsd/files/patch-src_servers.cpp (revision 459383) +++ head/comms/aprsd/files/patch-src_servers.cpp (revision 459384) @@ -1,19 +1,20 @@ ---- 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); +--- src/servers.cpp.orig 2003-10-01 16:58:27 UTC ++++ src/servers.cpp +@@ -2283,7 +2283,7 @@ void *TCPServerThread(void *p) + server.sin_addr.s_addr = INADDR_ANY; + server.sin_port = htons(sp->ServerPort); -- - if (rc || (hostinfo == NULL)){ - char* cp = new char[256]; - memset(cp, 0, 256); -@@ -3277,7 +3276,7 @@ +- if (bind(s, (struct sockaddr *)&server, sizeof(server)) < 0) { ++ if (::bind(s, (struct sockaddr *)&server, sizeof(server)) < 0) { + perror("TCPServerThread bind error"); + ShutDownServer = true; + return NULL; +@@ -2382,7 +2382,7 @@ void *UDPServerThread(void *p) + server.sin_port = htons(UDP_Port) ;/* 0 = Use any available port */ + server.sin_addr.s_addr = INADDR_ANY; /* Server's Internet Address */ - //---------------------------------------------------------------------- - --inline string convertUpTime(int dTime) -+string convertUpTime(int dTime) - { - std::ostringstream ostr; - int x; +- if (bind(s, (struct sockaddr *)&server, sizeof(server)) < 0) { ++ if (::bind(s, (struct sockaddr *)&server, sizeof(server)) < 0) { + perror("Datagram socket bind error"); + ShutDownServer = true; + return NULL; Property changes on: head/comms/aprsd/files/patch-src_servers.cpp ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -yes \ No newline at end of property +1 \ No newline at end of property Index: head/comms/aprsd/files/patch-src_servers.h =================================================================== --- head/comms/aprsd/files/patch-src_servers.h (revision 459383) +++ head/comms/aprsd/files/patch-src_servers.h (revision 459384) @@ -1,34 +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 +--- src/servers.h.orig 2003-10-01 16:58:27 UTC ++++ src/servers.h @@ -28,6 +28,12 @@ #include #include +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include +#endif +#ifdef BSD +#include +#endif #include "aprsd.h" #include "mutex.h" -@@ -135,11 +141,17 @@ +@@ -135,11 +141,17 @@ struct pidList{ //Stuff for trusted UDP source IPs +#ifdef BSD -+struct sTrusted { + struct sTrusted { + struct in_addr sin_addr; //ip address + struct in_addr sin_mask; //subnet mask +}; +#else - struct sTrusted { ++struct sTrusted { in_addr sin_addr; //ip address in_addr sin_mask; //subnet mask }; - +#endif struct sLogon{ char *user; Property changes on: head/comms/aprsd/files/patch-src_servers.h ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -yes \ No newline at end of property +1 \ No newline at end of property Index: head/comms/aprsd/files/patch-src_utils.cpp =================================================================== --- head/comms/aprsd/files/patch-src_utils.cpp (revision 459383) +++ head/comms/aprsd/files/patch-src_utils.cpp (revision 459384) @@ -1,36 +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 @@ +--- src/utils.cpp.orig 2003-10-01 16:58:27 UTC ++++ src/utils.cpp +@@ -41,6 +41,7 @@ int CountDefault = 7; //Max of 7 instances of one static RecursiveMutex pmtxLog; -+const string LOGPATH("%%LOGPATH%%"); ++const string LOGPATH("/var/log/aprsd/"); int WriteLog(const string& sp, const string& LogFile) { -@@ -50,11 +51,12 @@ +@@ -50,11 +51,12 @@ int WriteLog(const string& sp, const string& LogFile) 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(<ime); // Timestamp ctime_r(<ime, szTime); // "threadsafe" ctime -@@ -91,8 +93,8 @@ +@@ -91,8 +93,8 @@ int WriteLog(const char* pch, const char* LogFile) 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"); Property changes on: head/comms/aprsd/files/patch-src_utils.cpp ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -yes \ No newline at end of property +1 \ No newline at end of property Index: head/comms/aprsd/files/patch-src_validate.cpp =================================================================== --- head/comms/aprsd/files/patch-src_validate.cpp (revision 459383) +++ head/comms/aprsd/files/patch-src_validate.cpp (revision 459384) @@ -1,115 +1,156 @@ ---- src/validate.cpp.orig 2008-01-13 20:00:27.000000000 -0500 -+++ src/validate.cpp 2008-01-13 20:45:17.000000000 -0500 +--- src/validate.cpp.orig 2003-03-31 04:49:41 UTC ++++ src/validate.cpp @@ -34,6 +34,10 @@ #include #include #include +#include +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include +#endif using namespace std; -@@ -47,11 +51,17 @@ +@@ -47,11 +51,17 @@ struct user_info { const string group; }; #else +#ifdef BSD +#include +#include +#define MAXGROUPSIZE 1024 +#else #include #include #include #include #endif +#endif #include "validate.h" -@@ -140,12 +150,21 @@ +@@ -140,12 +150,21 @@ int checkSystemPass(const string szUser, const string pam_end(pamh, PAM_SUCCESS); return 0; #else +#ifdef BSD -+ passwd *ppw = NULL; + passwd *ppw = NULL; + struct group *pgrp = NULL; + struct spwd *pspwd = NULL; + char *member = NULL; + struct group grp; + struct passwd pwd; +#else - passwd *ppw = NULL; ++ 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 @@ +@@ -158,7 +177,11 @@ int checkSystemPass(const string szUser, const string #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; +@@ -168,12 +191,14 @@ int checkSystemPass(const string szUser, const string + &pgrp); + + if (pgrp == NULL) { +- delete buffer1; ++ 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 @@ +@@ -183,8 +208,8 @@ int checkSystemPass(const string szUser, const string + &ppw); + if (ppw == NULL){ +- delete buffer2; +- delete buffer1; ++ delete[] buffer2; ++ delete[] buffer1; + return BADUSER ; /* return BADUSER if no such user */ + } + +@@ -200,8 +225,8 @@ int checkSystemPass(const string szUser, const string + } + + if (usrfound == 0) { +- delete buffer1; +- delete buffer2; ++ delete[] buffer1; ++ delete[] buffer2; + return BADGROUP; /* return BADGROUP if user not in group */ + } + +@@ -214,6 +239,7 @@ int checkSystemPass(const string szUser, const string + pwLength = strlen(ppw->pw_passwd); +#if 0 if (ppw->pw_passwd[0] != '$') { /* DES salt */ strncpy(salt,ppw->pw_passwd,2); -@@ -230,15 +256,18 @@ +@@ -230,15 +256,18 @@ int checkSystemPass(const string szUser, const string 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 @@ +@@ -246,8 +275,8 @@ int checkSystemPass(const string szUser, const string + pspwd = getspnam(szUser.c_str()); //Get shadow password file data for user + if (pspwd == NULL) { + cout << "validate: Can't read shadowed password file. This program must run as root\n"; +- delete buffer1; +- delete buffer2; ++ delete[] buffer1; ++ delete[] buffer2; + return MUSTRUNROOT; + } + pwLength = strlen(pspwd->sp_pwdp); +@@ -288,8 +317,9 @@ int checkSystemPass(const string szUser, const string << endl; #endif } +- delete buffer1; +- delete buffer2; +#endif - delete buffer1; - delete buffer2; ++ delete[] buffer1; ++ delete[] buffer2; return rc; + #endif + } Property changes on: head/comms/aprsd/files/patch-src_validate.cpp ___________________________________________________________________ Modified: fbsd:nokeywords ## -1 +1 ## -yes \ No newline at end of property +1 \ No newline at end of property