On 10/30/2012 01:38 PM, Jakub Hrozek wrote:
On Tue, Oct 30, 2012 at 01:27:50PM +0100, Pavel Březina wrote:
> From a6182a234b1bef9b9c4ab8fc6b925504c0135f69 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina(a)redhat.com>
> Date: Tue, 30 Oct 2012 12:03:19 +0100
> Subject: [PATCH 1/2] sudo: do not hardcode protocol version
>
> ---
> src/responder/sudo/sudosrv_cmd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/responder/sudo/sudosrv_cmd.c b/src/responder/sudo/sudosrv_cmd.c
> index
13eb4991f318f0e9824dbeb5fc80f069c476e28c..9a87ed7d768b0bf35b1d1980895d08e4cf08d5f7 100644
> --- a/src/responder/sudo/sudosrv_cmd.c
> +++ b/src/responder/sudo/sudosrv_cmd.c
> @@ -27,6 +27,7 @@
> #include "responder/common/responder_packet.h"
> #include "responder/sudo/sudosrv_private.h"
> #include "db/sysdb_sudo.h"
> +#include "sss_client/sss_cli.h"
>
> static errno_t sudosrv_cmd_send_reply(struct sudo_cmd_ctx *cmd_ctx,
> uint8_t *response_body,
> @@ -182,7 +183,7 @@ static int sudosrv_cmd(enum sss_sudo_type type, struct cli_ctx
*cli_ctx)
> }
>
> /* if protocol is invalid return */
> - if (cli_ctx->cli_protocol_version->version != 1) {
> + if (cli_ctx->cli_protocol_version->version != SSS_SUDO_PROTOCOL_VERSION)
{
> DEBUG(SSSDBG_FATAL_FAILURE, ("Invalid protocol! [%d]\n",
> cli_ctx->cli_protocol_version->version));
> ret = EFAULT;
> --
> 1.7.11.7
>
How is the sudo protocol version handled on the sudo side? Are we able
to handle the "previous" tech-preview protocol gracefully? What if we
decide to change the protocol again?
Hi,
this was already discussed and the solution was
04b3ab7658985af749460010123bbe37eccf50ed.
On the client side it uses the same macro. If the protocol doesn't match
we return EFAULT, which terminates the connection.
The discussion can be found here:
https://lists.fedorahosted.org/pipermail/sssd-devel/2012-May/009610.html
https://lists.fedorahosted.org/pipermail/sssd-devel/2012-May/009800.html
If we change the protocol again, we just add the protocol and change
SSS_SUDO_PROTOCOL_VERSION. If we decide to support the old protocol
again, we will deal with it then.