[rbldnsd] Minor portability (non GCC compiller) enhancements to
0.966a
Victor Duchovni
Victor.Duchovni at MorganStanley.com
Thu Nov 23 07:54:59 MSK 2006
Index: rbldnsd.c
--- rbldnsd.c 22 Nov 2006 23:25:08 -0000 1.1.1.3
+++ rbldnsd.c 23 Nov 2006 04:24:24 -0000
@@ -331,7 +331,7 @@
for (i = 0; i < numsock; ++i) {
x = 65536;
do
- if (setsockopt(sock[i], SOL_SOCKET, SO_RCVBUF, &x, sizeof x) == 0)
+ if (setsockopt(sock[i], SOL_SOCKET, SO_RCVBUF, (char *)&x, sizeof x) == 0)
break;
while ((x -= (x >> 5)) >= 1024);
}
@@ -509,19 +509,20 @@
if (!user && !(uid = getuid()))
user = "rbldns";
- if (user && (p = strchr(user, ':')) != NULL)
- *p++ = '\0';
- if (!user)
- p = NULL;
- else if ((c = satoi(user)) >= 0)
- uid = c, gid = c;
- else {
- struct passwd *pw = getpwnam(user);
- if (!pw)
- error(0, "unknown user `%s'", user);
- uid = pw->pw_uid;
- gid = pw->pw_gid;
- endpwent();
+ p = NULL;
+ if (user) {
+ if ((p = strchr(user, ':')) != NULL)
+ *p++ = '\0';
+ if ((c = satoi(user)) >= 0)
+ uid = c, gid = c;
+ else {
+ struct passwd *pw = getpwnam(user);
+ if (!pw)
+ error(0, "unknown user `%s'", user);
+ uid = pw->pw_uid;
+ gid = pw->pw_gid;
+ endpwent();
+ }
}
if (!uid)
error(0, "daemon should not run as root, specify -u option");
@@ -1017,7 +1018,7 @@
int q, r;
socklen_t salen = sizeof(peer_sa);
- q = recvfrom(fd, pkt.p_buf, sizeof(pkt.p_buf), 0,
+ q = recvfrom(fd, (char *)pkt.p_buf, sizeof(pkt.p_buf), 0,
(struct sockaddr *)&peer_sa, &salen);
if (q <= 0) /* interrupted? */
return;
@@ -1030,7 +1031,8 @@
logreply(&pkt, flog, flushlog);
/* finally, send a reply */
- while(sendto(fd, pkt.p_buf, r, 0, (struct sockaddr *)&peer_sa, salen) < 0)
+ while(sendto(fd, (char *)pkt.p_buf, r, 0,
+ (struct sockaddr *)&peer_sa, salen) < 0)
if (errno != EINTR) break;
}
Index: rbldnsd_acl.c
--- rbldnsd_acl.c 22 Nov 2006 23:25:09 -0000 1.1.1.1
+++ rbldnsd_acl.c 23 Nov 2006 04:33:40 -0000
@@ -161,7 +161,9 @@
return NSQUERY_ALWAYS;
}
-//definedstype(acl, DSTF_SPECIAL, "Access Control List dataset");
+#if 0
+definedstype(acl, DSTF_SPECIAL, "Access Control List dataset");
+#endif
const struct dstype dataset_acl_type = {
"acl", DSTF_SPECIAL, sizeof(struct dsdata),
ds_acl_reset, ds_acl_start, ds_acl_line, ds_acl_finish,
Index: rbldnsd_ip4trie.c
--- rbldnsd_ip4trie.c 22 Nov 2006 23:25:09 -0000 1.1.1.3
+++ rbldnsd_ip4trie.c 23 Nov 2006 03:43:24 -0000
@@ -97,9 +97,9 @@
static void ds_ip4trie_finish(struct dataset *ds, struct dsctx *dsc) {
struct dsdata *dsd = ds->ds_dsd;
- dsloaded(dsc, "ent=%u nodes=%u mem=%u",
+ dsloaded(dsc, "ent=%u nodes=%u mem=%lu",
dsd->trie.ip4t_nents, dsd->trie.ip4t_nnodes,
- dsd->trie.ip4t_nnodes * sizeof(struct ip4trie_node));
+ (unsigned long)dsd->trie.ip4t_nnodes * sizeof(struct ip4trie_node));
}
static int
Index: rbldnsd_packet.c
--- rbldnsd_packet.c 22 Nov 2006 23:25:09 -0000 1.1.1.3
+++ rbldnsd_packet.c 23 Nov 2006 04:06:03 -0000
@@ -8,6 +8,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
#include <netdb.h>
#include <syslog.h>
#include "rbldnsd.h"
@@ -982,7 +983,7 @@
else
*cp++ = '?';
#else
- strcpy(cp, inet_ntoa(((struct sockaddr_in*)pkt->p_peer)->sin_addr.s_addr));
+ strcpy(cp, inet_ntoa(((struct sockaddr_in*)pkt->p_peer)->sin_addr));
cp += strlen(cp);
#endif
*cp++ = ' ';
Index: rbldnsd_util.c
--- rbldnsd_util.c 22 Nov 2006 23:25:09 -0000 1.1.1.3
+++ rbldnsd_util.c 23 Nov 2006 04:41:29 -0000
@@ -516,6 +516,9 @@
return node;
}
+#ifndef __GNUC__
+#define inline
+#endif
/* link node to either left or right of parent,
* assuming both parent's links are NULL */
static inline void
Index: rbldnsd_zones.c
--- rbldnsd_zones.c 22 Nov 2006 23:25:10 -0000 1.1.1.3
+++ rbldnsd_zones.c 23 Nov 2006 04:30:10 -0000
@@ -215,7 +215,9 @@
unsigned ttl;
#ifndef INCOMPAT_0_99
+#ifdef __GNUC__
#warning NS record compatibility mode: remove for 1.0 final
+#endif
struct dsns *dsns_first = 0;
unsigned cnt;
int newformat = 0;
@@ -529,7 +531,7 @@
const struct dslist *dsl;
{ /* zone header */
char name[DNS_MAXDOMAIN+1];
- const unsigned char **nsdna = z->z_nsdna;
+ const unsigned char * const *nsdna = z->z_nsdna;
const struct dssoa *dssoa = z->z_dssoa;
unsigned nns = z->z_nns;
unsigned n;
--
Viktor.
More information about the rbldnsd
mailing list