- Unbreak with clang6

- wrong bind() was being used force network ::bind()
- calm down some other warnings while here
- regen patches

Reported by:		pkg-fallout
This commit is contained in:
Diane Bruce 2018-01-18 23:34:31 +00:00
parent 041cc9b1a3
commit 343224a06e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=459384
9 changed files with 107 additions and 65 deletions

View File

@ -1,6 +1,6 @@
--- 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.
#
@ -9,7 +9,7 @@
#
#
#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.
#
@ -24,7 +24,7 @@
#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

View File

@ -1,6 +1,6 @@
--- 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);

View File

@ -1,16 +1,16 @@
--- 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
@ -19,7 +19,7 @@
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);
@ -30,7 +30,7 @@
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

View File

@ -1,5 +1,5 @@
--- 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"
{
@ -15,7 +15,7 @@
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
@@ -63,10 +71,27 @@
@@ -63,10 +71,27 @@ namespace aprsd
char *buf, size_t buflen, struct hostent **result,
int *h_errnop)
{

View File

@ -1,5 +1,5 @@
--- 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 <netinet/in.h>
@ -10,7 +10,7 @@
#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 {
@ -18,7 +18,7 @@
//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);

View File

@ -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;

View File

@ -1,5 +1,5 @@
--- 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 <string>
@ -13,17 +13,17 @@
#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
};

View File

@ -1,14 +1,14 @@
--- 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();
@ -23,7 +23,7 @@
time(&ltime); // Timestamp
ctime_r(&ltime, szTime); // "threadsafe" ctime
@@ -91,8 +93,8 @@
@@ -91,8 +93,8 @@ int WriteLog(const char* pch, const char* LogFile)
pthread_mutex_lock(pmtxLog);

View File

@ -1,5 +1,5 @@
--- 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 <iostream>
#include <strstream>
@ -11,7 +11,7 @@
using namespace std;
@@ -47,11 +51,17 @@
@@ -47,11 +51,17 @@ struct user_info {
const string group;
};
#else
@ -29,19 +29,19 @@
#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;
@ -51,7 +51,7 @@
int i;
char salt[16];
int usrfound = 0 ;
@@ -158,7 +177,11 @@
@@ -158,7 +177,11 @@ int checkSystemPass(const string szUser, const string
#endif
@ -63,8 +63,12 @@
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 */
}
-
@ -77,7 +81,29 @@
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);
@ -85,7 +111,7 @@
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';
}
@ -105,11 +131,26 @@
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
}