Privileged outgoing connections.
[fwd] / socket.c
index 5f1a731..bbc1f9e 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: socket.c,v 1.10 2003/11/25 14:08:23 mdw Exp $
+ * $Id: socket.c,v 1.11 2003/11/29 20:36:07 mdw Exp $
  *
  * Socket source and target definitions
  *
@@ -29,6 +29,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: socket.c,v $
+ * Revision 1.11  2003/11/29 20:36:07  mdw
+ * Privileged outgoing connections.
+ *
  * Revision 1.10  2003/11/25 14:08:23  mdw
  * Debianization.  Socket target options.  Internet binding.
  *
@@ -576,6 +579,11 @@ static void ssource_attach(source *s, scanner *sc, target *t)
     dstr_destroy(&d);
   }
 
+  /* --- Confirm the address --- */
+
+  if (ss->a->ops->confirm)
+    ss->a->ops->confirm(ss->a, ADDR_SRC, ss->ao);
+
   /* --- Initialize the socket for listening --- */
 
   if ((fd = ss->a->ops->bind(ss->a, ss->ao)) < 0)
@@ -675,15 +683,17 @@ static target *starget_read(scanner *sc)
   return (&st->t);
 }
 
-/* --- @create@ --- *
- *
- * Arguments:  @target *t@ = pointer to target
- *             @const char *desc@ = description of connection
- *
- * Returns:    Pointer to a created endpoint.
- *
- * Use:                Generates a target endpoint for communication.
- */
+/* --- @confirm@ --- */
+
+static void starget_confirm(target *t)
+{
+  starget *st = (starget *)t;
+
+  if (st->a->ops->confirm)
+    st->a->ops->confirm(st->a, ADDR_DEST, st->ao);
+}
+
+/* --- @create@ --- */
 
 static endpt *starget_create(target *t, const char *desc)
 {
@@ -722,7 +732,8 @@ static void starget_destroy(target *t)
 
 target_ops starget_ops = {
   "socket",
-  starget_option, starget_read, starget_create, starget_destroy
+  starget_option, starget_read, starget_confirm,
+  starget_create, starget_destroy
 };
 
 /*----- That's all, folks -------------------------------------------------*/