# HG changeset patch
# User John Calcote <john.calcote@gmail.com>
# Date 1491512136 21600
#      Thu Apr 06 14:55:36 2017 -0600
# Node ID df49bc4f2972edbe5aa62598af00f57277f5bded
# Parent  07c9f60808790d038865b83b216d100848b2600a
BUG#155: Daemon sends wrong service reply when security is enabled.

diff -r 07c9f6080879 -r df49bc4f2972 slpd/slpd_process.c
--- a/slpd/slpd_process.c	Thu Apr 06 12:27:49 2017 -0600
+++ b/slpd/slpd_process.c	Thu Apr 06 14:55:36 2017 -0600
@@ -615,13 +615,17 @@
          else
 #endif
          {
-            /* Use an opaque copy if available (and authentication is
-             * not being used).
-             */
+            /* Use an opaque copy if available. */
 
             /* TRICKY: Fix up the lifetime. */
             TO_UINT16(urlentry->opaque + 1, urlentry->lifetime);
             memcpy(result->curpos, urlentry->opaque, urlentry->opaquelen);
+
+            /* TRICKY: Fix up the result authblock count. */
+            if (urlentry->authcount)
+                result->curpos[1 + 2 + 2 + urlentry->urllen] = (uint8_t)urlentry->authcount;
+                /* 1 reserved + 2 lifetime + 2 url length */
+
             result->curpos += urlentry->opaquelen;
          }
       }
