Imported Upstream version 3.3.3
[debian/amanda] / common-src / security-util.c
index e3942e649f433492d843d9c4a1115bfb57ad2715..cda59ba23dd4ed80724861c663cb39345315c735 100644 (file)
@@ -1411,7 +1411,7 @@ udp_netfd_read_callback(
      * If no accept handler was setup, then just return.
      */
     if (udp->accept_fn == NULL) {
-       dbprintf(_("Receive packet from unknown source"));
+       g_debug(_("Receive packet from unknown source"));
        return;
     }
 
@@ -1739,10 +1739,10 @@ stream_read_callback(
      * We remove it first because we don't want to get in their
      * way if they reschedule it.
      */
-    tcpm_stream_read_cancel(rs);
 
     if (rs->rc->pktlen <= 0) {
        auth_debug(1, _("sec: stream_read_callback: %s\n"), rs->rc->errmsg);
+       tcpm_stream_read_cancel(rs);
        security_stream_seterror(&rs->secstr, "%s", rs->rc->errmsg);
        if(rs->closed_by_me == 0 && rs->closed_by_network == 0)
            sec_tcp_conn_put(rs->rc);
@@ -1773,7 +1773,7 @@ sec_tcp_conn_read_callback(
 
     assert(cookie != NULL);
 
-    auth_debug(1, _("sec: conn_read_callback\n"));
+    auth_debug(1, _("sec: conn_read_callback %d %d\n"), (int)rc->event_id, rc->read);
 
     /* Read the data off the wire.  If we get errors, shut down. */
     rval = tcpm_recv_token(rc, rc->read, &rc->handle, &rc->errmsg, &rc->pkt,
@@ -1793,6 +1793,7 @@ sec_tcp_conn_read_callback(
                       revent);
        /* delete our 'accept' reference */
        if (rc->accept_fn != NULL) {
+           (*rc->accept_fn)(NULL, NULL);
            if(rc->refcnt != 1) {
                dbprintf(_("STRANGE, rc->refcnt should be 1, it is %d\n"),
                          rc->refcnt);