void qmp_guest_set_user_password(const char *username,

                                 const char *password,

                                 bool crypted,

                                 Error **errp)

{

    NET_API_STATUS nas;

    char *rawpasswddata = NULL;

    size_t rawpasswdlen;

    wchar_t *user, *wpass;

    USER_INFO_1003 pi1003 = { 0, };



    if (crypted) {

        error_setg(errp, QERR_UNSUPPORTED);

        return;

    }



    rawpasswddata = (char *)qbase64_decode(password, -1, &rawpasswdlen, errp);

    if (!rawpasswddata) {

        return;

    }

    rawpasswddata = g_renew(char, rawpasswddata, rawpasswdlen + 1);

    rawpasswddata[rawpasswdlen] = '\0';



    user = g_utf8_to_utf16(username, -1, NULL, NULL, NULL);

    wpass = g_utf8_to_utf16(rawpasswddata, -1, NULL, NULL, NULL);



    pi1003.usri1003_password = wpass;

    nas = NetUserSetInfo(NULL, user,

                         1003, (LPBYTE)&pi1003,

                         NULL);



    if (nas != NERR_Success) {

        gchar *msg = get_net_error_message(nas);

        error_setg(errp, "failed to set password: %s", msg);

        g_free(msg);

    }



    g_free(user);

    g_free(wpass);

    g_free(rawpasswddata);

}

void qmp_guest_set_user_password(const char *username,

                                 const char *password,

                                 bool crypted,

                                 Error **errp)

{

    NET_API_STATUS nas;

    char *rawpasswddata = NULL;

    size_t rawpasswdlen;

    wchar_t *user, *wpass;

    USER_INFO_1003 pi1003 = { 0, };



    if (crypted) {

        error_setg(errp, QERR_UNSUPPORTED);

        return;

    }



    rawpasswddata = (char *)qbase64_decode(password, -1, &rawpasswdlen, errp);

    if (!rawpasswddata) {

        return;

    }

    rawpasswddata = g_renew(char, rawpasswddata, rawpasswdlen + 1);

    rawpasswddata[rawpasswdlen] = '\0';



    user = g_utf8_to_utf16(username, -1, NULL, NULL, NULL);

    wpass = g_utf8_to_utf16(rawpasswddata, -1, NULL, NULL, NULL);



    pi1003.usri1003_password = wpass;

    nas = NetUserSetInfo(NULL, user,

                         1003, (LPBYTE)&pi1003,

                         NULL);



    if (nas != NERR_Success) {

        gchar *msg = get_net_error_message(nas);

        error_setg(errp, "failed to set password: %s", msg);

        g_free(msg);

    }



    g_free(user);

    g_free(wpass);

    g_free(rawpasswddata);

}

    wchar_t *user, *wpass;     user = g_utf8_to_utf16(username, -1, NULL, NULL, NULL);     wpass = g_utf8_to_utf16(rawpasswddata, -1, NULL, NULL, NULL);
void FUNC_0(const char *VAR_0,

                                 const char *VAR_1,

                                 bool VAR_2,

                                 Error **VAR_3)

{

    NET_API_STATUS nas;

    char *VAR_4 = NULL;

    size_t rawpasswdlen;

    wchar_t *user, *wpass;

    USER_INFO_1003 pi1003 = { 0, };



    if (VAR_2) {

        error_setg(VAR_3, QERR_UNSUPPORTED);

        return;

    }



    VAR_4 = (char *)qbase64_decode(VAR_1, -1, &rawpasswdlen, VAR_3);

    if (!VAR_4) {

        return;

    }

    VAR_4 = g_renew(char, VAR_4, rawpasswdlen + 1);

    VAR_4[rawpasswdlen] = '\0';



    user = g_utf8_to_utf16(VAR_0, -1, NULL, NULL, NULL);

    wpass = g_utf8_to_utf16(VAR_4, -1, NULL, NULL, NULL);



    pi1003.usri1003_password = wpass;

    nas = NetUserSetInfo(NULL, user,

                         1003, (LPBYTE)&pi1003,

                         NULL);



    if (nas != NERR_Success) {

        gchar *msg = get_net_error_message(nas);

        error_setg(VAR_3, "failed to set VAR_1: %s", msg);

        g_free(msg);

    }



    g_free(user);

    g_free(wpass);

    g_free(VAR_4);

}

void FUNC_0(const char *VAR_0,
const char *VAR_1,
bool VAR_2,
Error **VAR_3)
{ NET_API_STATUS nas; char *VAR_4 = NULL; size_t rawpasswdlen; wchar_t *user, *wpass; USER_INFO_1003 pi1003 = { 0, }; if (VAR_2) { error_setg(VAR_3, QERR_UNSUPPORTED); return; } VAR_4 = (char *)qbase64_decode(VAR_1, -1, &rawpasswdlen, VAR_3); if (!VAR_4) { return; } VAR_4 = g_renew(char, VAR_4, rawpasswdlen + 1); VAR_4[rawpasswdlen] = '\0'; user = g_utf8_to_utf16(VAR_0, -1, NULL, NULL, NULL); wpass = g_utf8_to_utf16(VAR_4, -1, NULL, NULL, NULL); pi1003.usri1003_password = wpass; nas = NetUserSetInfo(NULL, user,
1003, (LPBYTE)&pi1003,
NULL); if (nas != NERR_Success) { gchar *msg = get_net_error_message(nas); error_setg(VAR_3, "failed to set VAR_1: %s", msg); g_free(msg); } g_free(user); g_free(wpass); g_free(VAR_4); }