Skip to content

Commit c3ec720

Browse files
committed
Serve leech2 patches from cf-testd via the enterprise hook
cf-testd now handles GETPATCH through the enterprise ServeLeech2Patch() function, the same code path as cf-serverd, instead of replying with a hardcoded empty patch. In a pure core build the stub refuses; with the enterprise plugin loaded a real patch is served from the state directory. Ticket: ENT-14105 Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent ab22fbb commit c3ec720

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

cf-testd/cf-testd.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include <mutex.h> // ThreadLock
4141
#include <net.h>
4242
#include <openssl/err.h> // ERR_get_error
43-
#include <patch_stream.h> // PatchStreamServe
4443
#include <policy_server.h> // PolicyServerReadFile
4544
#include <printsize.h> // PRINTSIZE
4645
#include <server_access.h> // acl_Free
@@ -417,15 +416,11 @@ static bool CFTestD_BusyLoop(
417416
break;
418417
}
419418

420-
/* cf-testd has no leech2 state; serve an empty patch so that the
421-
* hub's GETPATCH request succeeds. */
422-
Log(LOG_LEVEL_INFO, "Serving empty leech2 patch");
423-
if (PatchStreamServe(ConnectionInfoSSL(conn->conn_info), "", 0))
424-
{
425-
return true;
426-
}
427-
428-
break;
419+
/* Serve the patch using the same enterprise code path as cf-serverd.
420+
* In a pure core build the stub refuses; with the enterprise plugin
421+
* loaded a real leech2 patch is served from the state directory.
422+
* Keep the connection open on success. */
423+
return ServeLeech2Patch(conn, last_hash);
429424
}
430425
case PROTOCOL_COMMAND_BAD:
431426
default:

0 commit comments

Comments
 (0)