static void parse_chap(struct iscsi_context *iscsi, const char *target,

                       Error **errp)

{

    QemuOptsList *list;

    QemuOpts *opts;

    const char *user = NULL;

    const char *password = NULL;

    const char *secretid;

    char *secret = NULL;



    list = qemu_find_opts("iscsi");

    if (!list) {

        return;

    }



    opts = qemu_opts_find(list, target);

    if (opts == NULL) {

        opts = QTAILQ_FIRST(&list->head);

        if (!opts) {

            return;

        }

    }



    user = qemu_opt_get(opts, "user");

    if (!user) {

        return;

    }



    secretid = qemu_opt_get(opts, "password-secret");

    password = qemu_opt_get(opts, "password");

    if (secretid && password) {

        error_setg(errp, "'password' and 'password-secret' properties are "

                   "mutually exclusive");

        return;

    }

    if (secretid) {

        secret = qcrypto_secret_lookup_as_utf8(secretid, errp);

        if (!secret) {

            return;

        }

        password = secret;

    } else if (!password) {

        error_setg(errp, "CHAP username specified but no password was given");

        return;

    }



    if (iscsi_set_initiator_username_pwd(iscsi, user, password)) {

        error_setg(errp, "Failed to set initiator username and password");

    }



    g_free(secret);

}

static void parse_chap(struct iscsi_context *iscsi, const char *target,

                       Error **errp)

{

    QemuOptsList *list;

    QemuOpts *opts;

    const char *user = NULL;

    const char *password = NULL;

    const char *secretid;

    char *secret = NULL;



    list = qemu_find_opts("iscsi");

    if (!list) {

        return;

    }



    opts = qemu_opts_find(list, target);

    if (opts == NULL) {

        opts = QTAILQ_FIRST(&list->head);

        if (!opts) {

            return;

        }

    }



    user = qemu_opt_get(opts, "user");

    if (!user) {

        return;

    }



    secretid = qemu_opt_get(opts, "password-secret");

    password = qemu_opt_get(opts, "password");

    if (secretid && password) {

        error_setg(errp, "'password' and 'password-secret' properties are "

                   "mutually exclusive");

        return;

    }

    if (secretid) {

        secret = qcrypto_secret_lookup_as_utf8(secretid, errp);

        if (!secret) {

            return;

        }

        password = secret;

    } else if (!password) {

        error_setg(errp, "CHAP username specified but no password was given");

        return;

    }



    if (iscsi_set_initiator_username_pwd(iscsi, user, password)) {

        error_setg(errp, "Failed to set initiator username and password");

    }



    g_free(secret);

}

static void FUNC_0(struct iscsi_context *VAR_0, const char *VAR_1,

                       Error **VAR_2)

{

    QemuOptsList *list;

    QemuOpts *opts;

    const char *VAR_3 = NULL;

    const char *VAR_4 = NULL;

    const char *VAR_5;

    char *VAR_6 = NULL;



    list = qemu_find_opts("VAR_0");

    if (!list) {

        return;

    }



    opts = qemu_opts_find(list, VAR_1);

    if (opts == NULL) {

        opts = QTAILQ_FIRST(&list->head);

        if (!opts) {

            return;

        }

    }



    VAR_3 = qemu_opt_get(opts, "VAR_3");

    if (!VAR_3) {

        return;

    }



    VAR_5 = qemu_opt_get(opts, "VAR_4-VAR_6");

    VAR_4 = qemu_opt_get(opts, "VAR_4");

    if (VAR_5 && VAR_4) {

        error_setg(VAR_2, "'VAR_4' and 'VAR_4-VAR_6' properties are "

                   "mutually exclusive");

        return;

    }

    if (VAR_5) {

        VAR_6 = qcrypto_secret_lookup_as_utf8(VAR_5, VAR_2);

        if (!VAR_6) {

            return;

        }

        VAR_4 = VAR_6;

    } else if (!VAR_4) {

        error_setg(VAR_2, "CHAP username specified but no VAR_4 was given");

        return;

    }



    if (iscsi_set_initiator_username_pwd(VAR_0, VAR_3, VAR_4)) {

        error_setg(VAR_2, "Failed to set initiator username and VAR_4");

    }



    g_free(VAR_6);

}

static void FUNC_0(struct iscsi_context *VAR_0, const char *VAR_1,
Error **VAR_2)
{ QemuOptsList *list; QemuOpts *opts; const char *VAR_3 = NULL; const char *VAR_4 = NULL; const char *VAR_5; char *VAR_6 = NULL; list = qemu_find_opts("VAR_0"); if (!list) { return; } opts = qemu_opts_find(list, VAR_1); if (opts == NULL) { opts = QTAILQ_FIRST(&list->head); if (!opts) { return; } } VAR_3 = qemu_opt_get(opts, "VAR_3"); if (!VAR_3) { return; } VAR_5 = qemu_opt_get(opts, "VAR_4-VAR_6"); VAR_4 = qemu_opt_get(opts, "VAR_4"); if (VAR_5 && VAR_4) { error_setg(VAR_2, "'VAR_4' and 'VAR_4-VAR_6' properties are "
"mutually exclusive"); return; } if (VAR_5) { VAR_6 = qcrypto_secret_lookup_as_utf8(VAR_5, VAR_2); if (!VAR_6) { return; } VAR_4 = VAR_6; } else if (!VAR_4) { error_setg(VAR_2, "CHAP username specified but no VAR_4 was given"); return; } if (iscsi_set_initiator_username_pwd(VAR_0, VAR_3, VAR_4)) { error_setg(VAR_2, "Failed to set initiator username and VAR_4"); } g_free(VAR_6); }