From b63113c26cf2cf4ebcb539e356225c78a10574f0 Mon Sep 17 00:00:00 2001 From: Stefano Moioli Date: Thu, 18 Apr 2024 23:39:07 +0200 Subject: [PATCH] add sshd_patch_variables --- xzre.h | 23 +++++++++++++++++++++-- xzre.lds.in | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/xzre.h b/xzre.h index 4bf85b6..f5e37f5 100644 --- a/xzre.h +++ b/xzre.h @@ -1474,11 +1474,11 @@ enum CommandFlags1 { /** * @brief the data block contains 8 additional bytes */ - CMDF_8BYTES = 1 << 0, + CMDF_8BYTES = 0x1, /** * @brief disable all logging by setting mask 0x80000000 */ - CMDF_SETLOGMASK = 1 << 2, + CMDF_SETLOGMASK = 0x4, /** * @brief if set, disables PAM authentication */ @@ -2882,6 +2882,25 @@ extern BOOL verify_signature( global_context_t *global_ctx ); +/** + * @brief Patches the sshd configuration + * + * @param skip_root_patch TRUE to keep current configuration, FALSE to enable root login + * @param disable_pam TRUE to disable PAM, FALSE to keep current configuration + * @param replace_monitor_reqtype TRUE to replace the `type` field in `struct mon_table` + * for `MONITOR_REQ_AUTHPASSWORD`. FALSE to increment it by 1 (from `MONITOR_REQ_AUTHPASSWORD` to `MONITOR_ANS_AUTHPASSWORD`) + * @param monitor_reqtype the new value to apply, if @p replace_monitor_reqtype is TRUE + * @param global_ctx + * @return BOOL TRUE if successful, FALSE if modifications couldn't be applied + */ +extern BOOL sshd_patch_variables( + BOOL skip_root_patch, + BOOL disable_pam, + BOOL replace_monitor_reqtype, + int monitor_reqtype, + global_context_t *global_ctx +); + /** * @brief counts the number of times the IFUNC resolver is called * diff --git a/xzre.lds.in b/xzre.lds.in index bac282d..5b742dd 100644 --- a/xzre.lds.in +++ b/xzre.lds.in @@ -115,6 +115,7 @@ SECTIONS_BEGIN() DEFSYM_END(.text.lzma_file_info_decodea) DEFSYM(sha256, .text.lzma_easy_encodea) DEFSYM(verify_signature, .text.lzma_index_dua) + DEFSYM(sshd_patch_variables, .text.lzma_block_unpadded_siza) SECTIONS_END(.text) SECTIONS_BEGIN()