static int parse_chap(struct iscsi_context *iscsi, const char *target)

{

    QemuOptsList *list;

    QemuOpts *opts;

    const char *user = NULL;

    const char *password = NULL;



    list = qemu_find_opts("iscsi");

    if (!list) {

        return 0;

    }



    opts = qemu_opts_find(list, target);

    if (opts == NULL) {

        opts = QTAILQ_FIRST(&list->head);

        if (!opts) {

            return 0;

        }

    }



    user = qemu_opt_get(opts, "user");

    if (!user) {

        return 0;

    }



    password = qemu_opt_get(opts, "password");

    if (!password) {

        error_report("CHAP username specified but no password was given");

        return -1;

    }



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

        error_report("Failed to set initiator username and password");

        return -1;

    }



    return 0;

}

static int parse_chap(struct iscsi_context *iscsi, const char *target)

{

    QemuOptsList *list;

    QemuOpts *opts;

    const char *user = NULL;

    const char *password = NULL;



    list = qemu_find_opts("iscsi");

    if (!list) {

        return 0;

    }



    opts = qemu_opts_find(list, target);

    if (opts == NULL) {

        opts = QTAILQ_FIRST(&list->head);

        if (!opts) {

            return 0;

        }

    }



    user = qemu_opt_get(opts, "user");

    if (!user) {

        return 0;

    }



    password = qemu_opt_get(opts, "password");

    if (!password) {

        error_report("CHAP username specified but no password was given");

        return -1;

    }



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

        error_report("Failed to set initiator username and password");

        return -1;

    }



    return 0;

}

static int parse_chap(struct iscsi_context *iscsi, const char *target)         return 0;             return 0;         return 0;         error_report("CHAP username specified but no password was given");         return -1;         error_report("Failed to set initiator username and password");         return -1;     return 0;             return 0;
static int FUNC_0(struct iscsi_context *VAR_0, const char *VAR_1)

{

    QemuOptsList *list;

    QemuOpts *opts;

    const char *VAR_2 = NULL;

    const char *VAR_3 = NULL;



    list = qemu_find_opts("VAR_0");

    if (!list) {

        return 0;

    }



    opts = qemu_opts_find(list, VAR_1);

    if (opts == NULL) {

        opts = QTAILQ_FIRST(&list->head);

        if (!opts) {

            return 0;

        }

    }



    VAR_2 = qemu_opt_get(opts, "VAR_2");

    if (!VAR_2) {

        return 0;

    }



    VAR_3 = qemu_opt_get(opts, "VAR_3");

    if (!VAR_3) {

        error_report("CHAP username specified but no VAR_3 was given");

        return -1;

    }



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

        error_report("Failed to set initiator username and VAR_3");

        return -1;

    }



    return 0;

}

static int FUNC_0(struct iscsi_context *VAR_0, const char *VAR_1)
{ QemuOptsList *list; QemuOpts *opts; const char *VAR_2 = NULL; const char *VAR_3 = NULL; list = qemu_find_opts("VAR_0"); if (!list) { return 0; } opts = qemu_opts_find(list, VAR_1); if (opts == NULL) { opts = QTAILQ_FIRST(&list->head); if (!opts) { return 0; } } VAR_2 = qemu_opt_get(opts, "VAR_2"); if (!VAR_2) { return 0; } VAR_3 = qemu_opt_get(opts, "VAR_3"); if (!VAR_3) { error_report("CHAP username specified but no VAR_3 was given"); return -1; } if (iscsi_set_initiator_username_pwd(VAR_0, VAR_2, VAR_3)) { error_report("Failed to set initiator username and VAR_3"); return -1; } return 0; }