summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2003-10-19 19:54:14 +0000
committerPeter Palfrader <peter@palfrader.org>2003-10-19 19:54:14 +0000
commit64221faef859c51b67190f74a3b8d1173d56cd43 (patch)
tree4ed3a2e54a7012d11d22dda63babd75f9da24eff /src
parent3160828378e846c7ea37bc816bbcd234f8fda89e (diff)
Do basic exit node filtering
Diffstat (limited to 'src')
-rw-r--r--src/org/noreply/fancydress/directory/ServerDescriptor.java18
-rw-r--r--src/org/noreply/fancydress/type3/Payload.java28
2 files changed, 45 insertions, 1 deletions
diff --git a/src/org/noreply/fancydress/directory/ServerDescriptor.java b/src/org/noreply/fancydress/directory/ServerDescriptor.java
index 4c0cba1..4bb866c 100644
--- a/src/org/noreply/fancydress/directory/ServerDescriptor.java
+++ b/src/org/noreply/fancydress/directory/ServerDescriptor.java
@@ -354,4 +354,22 @@ public class ServerDescriptor {
return outgoingMMTPSection;
}
+ /**
+ * Get the Delivery/MBOX section.
+ *
+ * @return this server descriptor's Delivery/MBOX section
+ */
+ public DeliveryMBOXSection getDeliveryMBOXSection() {
+ return deliveryMBOXSection;
+ }
+
+ /**
+ * Get the Delivery/SMTP section.
+ *
+ * @return this server descriptor's Delivery/SMTP section
+ */
+ public DeliverySMTPSection getDeliverySMTPSection() {
+ return deliverySMTPSection;
+ }
+
}
diff --git a/src/org/noreply/fancydress/type3/Payload.java b/src/org/noreply/fancydress/type3/Payload.java
index 0294537..30464ca 100644
--- a/src/org/noreply/fancydress/type3/Payload.java
+++ b/src/org/noreply/fancydress/type3/Payload.java
@@ -2,8 +2,10 @@
package org.noreply.fancydress.type3;
import java.io.*;
+import java.util.*;
import java.util.zip.*;
import org.noreply.fancydress.crypto.*;
+import org.noreply.fancydress.status.*;
import org.noreply.fancydress.directory.*;
import org.noreply.fancydress.misc.Util;
import org.noreply.fancydress.type3.routing.*;
@@ -80,7 +82,31 @@ public class Payload {
}
public Server[] filterExithops(Server[] s) {
- return s;
+ /* FIXME: needs to be updated once we support fragmentation and stuff */
+ /* FIXME: needFrom needs to be done */
+ RoutingDestination r = route[0];
+ ArrayList list = new ArrayList();
+ for (int i=0; i<s.length; i++) {
+ ServerDescriptor sd;
+ try {
+ sd = s[i].getDescriptor();
+ } catch (Mix3NoServerDescriptorException e) {
+ continue;
+ }
+ if (r instanceof RoutingSMTP) {
+ if (sd.getDeliverySMTPSection() == null)
+ continue;
+ list.add(s[i]);
+ } else if (r instanceof RoutingMBOX) {
+ if (sd.getDeliveryMBOXSection() == null)
+ continue;
+ list.add(s[i]);
+ } else if (r instanceof RoutingDROP) {
+ list.add(s[i]);
+ } else
+ throw new Error("Unsupported routing: "+r);
+ }
+ return (Server[]) list.toArray(new Server[list.size()]);
}
}