chiark / gitweb /
authbind: Better logging of authbind failures
[secnet.git] / udp.c
diff --git a/udp.c b/udp.c
index 06acf3345e9806ca71eaa6278544f48eb067a802..a2bb90785bbbfcacf5721d8bb35f0cbed319f948 100644 (file)
--- a/udp.c
+++ b/udp.c
@@ -54,7 +54,7 @@ static const char *udp_addr_to_string(void *commst, const struct comm_addr *ca)
     assert(ix>=0 && ix<socks->n_socks);
     snprintf(sbuf, sizeof(sbuf), "udp:%s%s-%s",
             iaddr_to_string(&socks->socks[ix].addr),
-            ca->ix<0 ? "&" : "",
+            ca->ix<0 && socks->n_socks>1 ? "&" : "",
             iaddr_to_string(&ca->ia));
     return sbuf;
 }
@@ -283,6 +283,9 @@ bool_t udp_make_socket(struct udpcommon *uc, struct udpsock *us,
     if (uc->authbind) {
        pid_t c;
        int status;
+       char desc[200];
+       snprintf(desc,sizeof(desc),"authbind for %s: %s",
+                iaddr_to_string(addr), uc->authbind);
 
        /* XXX this fork() and waitpid() business needs to be hidden
           in some system-specific library functions. */
@@ -332,10 +335,10 @@ bool_t udp_make_socket(struct udpcommon *uc, struct udpsock *us,
            if (WIFEXITED(status) && WEXITSTATUS(status)<127) {
                int es=WEXITSTATUS(status);
                lg_perror(FAIL_LG,es,
-                         "authbind exited with error exit status %d;"
-                         " indicates error",es);
+                         "%s exited with error exit status %d;"
+                         " indicates error",desc,es);
            } else {
-               lg_exitstatus(FAIL_LG,status,"authbind");
+               lg_exitstatus(FAIL_LG,status,desc);
            }
            goto failed;
        }