- 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.orig 2003-10-01 16:57:16 UTC
+++ admin/aprsd.conf 2008-01-22 20:12:45.000000000 -0500 +++ admin/aprsd.conf
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@ NetBeacon 10 !3802.21NI07830.61W& APRS Server
#Define the TNC beacon. The TNC will supply the ax25 path header. #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. #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 #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. #If undefined all TNC related functions are disabled.
#Permissable baud rates are 1200,2400,4800,9600 and 19200. #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 #For the TNC, set this in INIT.TNC. Note the format is
#slightly different to the TNC command. #slightly different to the TNC command.
aprspath APRS v WIDE aprspath APRS v WIDE
@@ -97,7 +97,7 @@ @@ -97,7 +97,7 @@ Trace no
logAllRF no logAllRF no
# #
# Allow the insecure aprs passcodes to be used # 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.orig 2003-10-01 16:58:27 UTC
+++ src/aprsString.h 2008-01-12 18:11:35.000000000 -0500 +++ src/aprsString.h
@@ -196,7 +196,8 @@ @@ -196,7 +196,8 @@ class aprsString: public string (public)
void parseLogon(void); void parseLogon(void);
bool parseCommand(void); bool parseCommand(void);
bool parsePortFilter(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.orig 2003-05-29 03:09:39 UTC
+++ src/aprsd.cpp 2008-01-24 01:13:26.000000000 -0500 +++ src/aprsd.cpp
@@ -98,7 +98,8 @@ @@ -98,7 +98,8 @@ string szAprsPath;
int msgsn; int msgsn;
const string HOMEDIR("/home/aprsd2"); const string HOMEDIR("/home/aprsd2");
-const string CONFPATH(""); -const string CONFPATH("");
+const string LOGPATH("%%LOGPATH%%"); +const string LOGPATH("/var/log/aprsd/");
+const string CONFPATH("%%CONFPATH%%"); +const string CONFPATH("/usr/local/etc/aprsd/");
const string CONFFILE("aprsd.conf"); const string CONFFILE("aprsd.conf");
const string MAINLOG("aprsd.log"); const string MAINLOG("aprsd.log");
const string STSMLOG("thirdparty.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); WriteLog(string("Server Shutdown"), MAINLOG);
tcsetattr(fileno(stdin),TCSANOW,&initial_settings); //restore terminal mode tcsetattr(fileno(stdin),TCSANOW,&initial_settings); //restore terminal mode
@ -19,7 +19,7 @@
outFile += SAVE_HISTORY; outFile += SAVE_HISTORY;
int n = SaveHistory(outFile); int n = SaveHistory(outFile);
@@ -872,8 +873,8 @@ @@ -872,8 +873,8 @@ int daemonInit(void)
if (f.is_open()) { if (f.is_open()) {
f.read(s, 10); f.read(s, 10);
xx = atoi(s); xx = atoi(s);
@ -30,7 +30,7 @@
cout << "aprsd already running" << endl; cout << "aprsd already running" << endl;
cout << "PID: " << pid_file << endl; cout << "PID: " << pid_file << endl;
exit(1); exit(1);
@@ -977,7 +978,7 @@ @@ -977,7 +978,7 @@ int main(int argc, char *argv[])
//fdump = fopen("dump.txt","w+"); //debug //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.orig 2003-04-20 18:34:47 UTC
+++ src/osdep.h 2008-01-23 23:29:47.000000000 -0500 +++ src/osdep.h
@@ -32,6 +32,14 @@ @@ -32,6 +32,14 @@
extern "C" extern "C"
{ {
@ -15,7 +15,7 @@
#if TIME_WITH_SYS_TIME #if TIME_WITH_SYS_TIME
# include <sys/time.h> # include <sys/time.h>
@@ -63,10 +71,27 @@ @@ -63,10 +71,27 @@ namespace aprsd
char *buf, size_t buflen, struct hostent **result, char *buf, size_t buflen, struct hostent **result,
int *h_errnop) int *h_errnop)
{ {

View file

@ -1,5 +1,5 @@
--- src/queryResp.cpp.orig 2003-03-30 23:49:40.000000000 -0500 --- src/queryResp.cpp.orig 2003-03-31 04:49:40 UTC
+++ src/queryResp.cpp 2008-01-23 22:12:30.000000000 -0500 +++ src/queryResp.cpp
@@ -40,6 +40,9 @@ @@ -40,6 +40,9 @@
#include <netinet/in.h> #include <netinet/in.h>
@ -10,7 +10,7 @@
#include "constant.h" #include "constant.h"
#include "utils.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) if ((rc = gethostname(hostname,80)) != 0)
strcpy(hostname, "Host_Unknown"); strcpy(hostname, "Host_Unknown");
else { else {
@ -18,7 +18,7 @@
//Thread-Safe verison of gethostbyname() //Thread-Safe verison of gethostbyname()
h = NULL; h = NULL;
rc = gethostbyname_r(hostname, rc = gethostbyname_r(hostname,
@@ -94,12 +96,10 @@ @@ -94,12 +96,10 @@ void queryResp(int source, const aprsString* pkt)
&h, &h,
&h_err); &h_err);

View file

@ -1,19 +1,20 @@
--- src/servers.cpp.orig 2003-10-01 12:58:27.000000000 -0400 --- src/servers.cpp.orig 2003-10-01 16:58:27 UTC
+++ src/servers.cpp 2008-01-23 23:26:01.000000000 -0500 +++ src/servers.cpp
@@ -2627,7 +2627,6 @@ @@ -2283,7 +2283,7 @@ void *TCPServerThread(void *p)
&hostinfo, server.sin_addr.s_addr = INADDR_ANY;
&h_err); server.sin_port = htons(sp->ServerPort);
- - if (bind(s, (struct sockaddr *)&server, sizeof(server)) < 0) {
if (rc || (hostinfo == NULL)){ + if (::bind(s, (struct sockaddr *)&server, sizeof(server)) < 0) {
char* cp = new char[256]; perror("TCPServerThread bind error");
memset(cp, 0, 256); ShutDownServer = true;
@@ -3277,7 +3276,7 @@ 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 */
//---------------------------------------------------------------------- - if (bind(s, (struct sockaddr *)&server, sizeof(server)) < 0) {
+ if (::bind(s, (struct sockaddr *)&server, sizeof(server)) < 0) {
-inline string convertUpTime(int dTime) perror("Datagram socket bind error");
+string convertUpTime(int dTime) ShutDownServer = true;
{ return NULL;
std::ostringstream ostr;
int x;

View file

@ -1,5 +1,5 @@
--- src/servers.h.orig 2008-01-12 18:18:53.000000000 -0500 --- src/servers.h.orig 2003-10-01 16:58:27 UTC
+++ src/servers.h 2008-01-12 18:36:15.000000000 -0500 +++ src/servers.h
@@ -28,6 +28,12 @@ @@ -28,6 +28,12 @@
#include <string> #include <string>
@ -13,17 +13,17 @@
#include "aprsd.h" #include "aprsd.h"
#include "mutex.h" #include "mutex.h"
@@ -135,11 +141,17 @@ @@ -135,11 +141,17 @@ struct pidList{
//Stuff for trusted UDP source IPs //Stuff for trusted UDP source IPs
+#ifdef BSD +#ifdef BSD
+struct sTrusted { struct sTrusted {
+ struct in_addr sin_addr; //ip address + struct in_addr sin_addr; //ip address
+ struct in_addr sin_mask; //subnet mask + struct in_addr sin_mask; //subnet mask
+}; +};
+#else +#else
struct sTrusted { +struct sTrusted {
in_addr sin_addr; //ip address in_addr sin_addr; //ip address
in_addr sin_mask; //subnet mask 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.orig 2003-10-01 16:58:27 UTC
+++ src/utils.cpp 2008-01-22 21:54:44.000000000 -0500 +++ src/utils.cpp
@@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@ int CountDefault = 7; //Max of 7 instances of one
static RecursiveMutex pmtxLog; static RecursiveMutex pmtxLog;
+const string LOGPATH("%%LOGPATH%%"); +const string LOGPATH("/var/log/aprsd/");
int WriteLog(const string& sp, const string& LogFile) 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); static Lock locker(pmtxLog, false);
locker.get(); locker.get();
@ -23,7 +23,7 @@
time(&ltime); // Timestamp time(&ltime); // Timestamp
ctime_r(&ltime, szTime); // "threadsafe" ctime 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); 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.orig 2003-03-31 04:49:41 UTC
+++ src/validate.cpp 2008-01-13 20:45:17.000000000 -0500 +++ src/validate.cpp
@@ -34,6 +34,10 @@ @@ -34,6 +34,10 @@
#include <iostream> #include <iostream>
#include <strstream> #include <strstream>
@ -11,7 +11,7 @@
using namespace std; using namespace std;
@@ -47,11 +51,17 @@ @@ -47,11 +51,17 @@ struct user_info {
const string group; const string group;
}; };
#else #else
@ -29,19 +29,19 @@
#include "validate.h" #include "validate.h"
@@ -140,12 +150,21 @@ @@ -140,12 +150,21 @@ int checkSystemPass(const string szUser, const string
pam_end(pamh, PAM_SUCCESS); pam_end(pamh, PAM_SUCCESS);
return 0; return 0;
#else #else
+#ifdef BSD +#ifdef BSD
+ passwd *ppw = NULL; passwd *ppw = NULL;
+ struct group *pgrp = NULL; + struct group *pgrp = NULL;
+ struct spwd *pspwd = NULL; + struct spwd *pspwd = NULL;
+ char *member = NULL; + char *member = NULL;
+ struct group grp; + struct group grp;
+ struct passwd pwd; + struct passwd pwd;
+#else +#else
passwd *ppw = NULL; + passwd *ppw = NULL;
group *pgrp = NULL; group *pgrp = NULL;
spwd *pspwd = NULL; spwd *pspwd = NULL;
char *member = NULL; char *member = NULL;
@ -51,7 +51,7 @@
int i; int i;
char salt[16]; char salt[16];
int usrfound = 0 ; int usrfound = 0 ;
@@ -158,7 +177,11 @@ @@ -158,7 +177,11 @@ int checkSystemPass(const string szUser, const string
#endif #endif
@ -63,8 +63,12 @@
char *buffer1 = new char[bufsize]; char *buffer1 = new char[bufsize];
//Thread-Safe getgrnam() //Thread-Safe getgrnam()
getgrnam_r(szGroup.c_str(), /* Does group name szGroup exist? */ getgrnam_r(szGroup.c_str(), /* Does group name szGroup exist? */
@@ -171,9 +194,11 @@ @@ -168,12 +191,14 @@ int checkSystemPass(const string szUser, const string
delete buffer1; &pgrp);
if (pgrp == NULL) {
- delete buffer1;
+ delete[] buffer1;
return rc; /* return BADGROUP if not */ return rc; /* return BADGROUP if not */
} }
- -
@ -77,7 +81,29 @@
char *buffer2 = new char[bufsize]; char *buffer2 = new char[bufsize];
//Thread-Safe getpwnam() //Thread-Safe getpwnam()
getpwnam_r(szUser.c_str(), 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); pwLength = strlen(ppw->pw_passwd);
@ -85,7 +111,7 @@
if (ppw->pw_passwd[0] != '$') { if (ppw->pw_passwd[0] != '$') {
/* DES salt */ /* DES salt */
strncpy(salt,ppw->pw_passwd,2); 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++] = '$';
salt[i] = '\0'; salt[i] = '\0';
} }
@ -105,11 +131,26 @@
if ((rc == BADPASSWD) && (strcmp("x",ppw->pw_passwd) == 0)) { if ((rc == BADPASSWD) && (strcmp("x",ppw->pw_passwd) == 0)) {
#ifdef DEBUG #ifdef DEBUG
cout << "Shadow passwords enabled\n"; 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; << endl;
#endif #endif
} }
- delete buffer1;
- delete buffer2;
+#endif +#endif
delete buffer1; + delete[] buffer1;
delete buffer2; + delete[] buffer2;
return rc; return rc;
#endif
}