diff src/dccifd.cpp @ 214:82886d4dd71f stable-6-0-19

Fixes to compile on Fedora 9 and for const correctness.
author Carl Byington <carl@five-ten-sg.com>
date Tue, 10 Jun 2008 08:58:42 -0700
parents 92a5c866bdfa
children 3fee608becbc
line wrap: on
line diff
--- a/src/dccifd.cpp	Wed Apr 30 13:11:32 2008 -0700
+++ b/src/dccifd.cpp	Tue Jun 10 08:58:42 2008 -0700
@@ -52,7 +52,7 @@
 }
 
 
-DccInterface::DccInterface(char *port_, mlfiPriv *priv_, int ip, char *helo_, char *from)
+DccInterface::DccInterface(const char *port_, mlfiPriv *priv_, int ip, const char *helo_, const char *from)
 {
 	err 			= false;
 	first_recipient = true;
@@ -72,7 +72,7 @@
 }
 
 
-void DccInterface::mlfi_envrcpt(SMFICTX *ctx, char *envrcpt, bool grey)
+void DccInterface::mlfi_envrcpt(SMFICTX *ctx, const char *envrcpt, bool grey)
 {
 	if (first_recipient) {
 		first_recipient = false;
@@ -80,7 +80,7 @@
 		adr[0] = '\0';
 		inet_ntop(AF_INET, (const u_char *)&ip4, adr, sizeof(adr));
 		// Validated sending site's address
-		char *rdns = getmacro(ctx, "_", "");
+		const char *rdns = getmacro(ctx, "_", "");
 		char buf[maxlen+1];
 		if (*rdns == '[') rdns = "";
 		else {
@@ -93,7 +93,6 @@
 		output(options);
 		output(adr);		output("\r");
 		output(rdns);		output("\n");
-		//output("4.3.2.1\r\n");  // !! not local whitelisting
 		output(helo);		output("\n");
 		output(envfrom);	output("\n");
 	}
@@ -103,7 +102,7 @@
 }
 
 
-void DccInterface::mlfi_header(SMFICTX *ctx, char* headerf, char* headerv)
+void DccInterface::mlfi_header(SMFICTX *ctx, const char *headerf, const char *headerv)
 {
 	if (dccifd_socket == NULL_SOCKET) Connect();
 	if ((dccifd_socket != NULL_SOCKET) && (!dccifd_input.empty())) {
@@ -129,9 +128,9 @@
 }
 
 
-void DccInterface::mlfi_body(u_char *bodyp, size_t bodylen)
+void DccInterface::mlfi_body(const u_char *bodyp, size_t bodylen)
 {
-	output((char *)bodyp, bodylen);
+	output((const char *)bodyp, bodylen);
 }
 
 
@@ -317,7 +316,7 @@
 	if ((dccifd_socket == NULL_SOCKET) || err) return;
 	char buf[maxlen];
 	int rs;
-	while (rs = my_read(buf, maxlen)) {
+	while ((rs = my_read(buf, maxlen))) {
 		//my_syslog(priv, string("dcc read ") + escaper(string(buf, rs)));
 		dccifd_output.append(buf, rs);
 	}
@@ -325,9 +324,9 @@
 }
 
 
-char *DccInterface::getmacro(SMFICTX *ctx, char *macro, char *def)
+const char *DccInterface::getmacro(SMFICTX *ctx, const char *macro, const char *def)
 {
-	char *rc = smfi_getsymval(ctx, macro);
+	const char *rc = smfi_getsymval(ctx, (char*)macro);
 	if (!rc) rc = def;
 	return rc;
 }