diff options
author | kraxel <kraxel> | 2008-09-25 10:49:10 +0000 |
---|---|---|
committer | kraxel <kraxel> | 2008-09-25 10:49:10 +0000 |
commit | ebe77c45fa12da6537b4bb903226ced6b7a63288 (patch) | |
tree | 288078a759d1cf46651d6e027f0d68321d217ccf /monitor.c | |
parent | a3aa4e1df1e9f67ef8a0944d79666fc307416c00 (diff) | |
download | qemu-gtk-ebe77c45fa12da6537b4bb903226ced6b7a63288.tar.gz |
- rearrange menu a bit.
- wind up more monitor commands in menu.
- add fullscreen mode.
- handle password-protected vnc.
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 33 |
1 files changed, 31 insertions, 2 deletions
@@ -20,6 +20,21 @@ static int monitor_parse(struct qemu_window *win, char *buf, int len) char *reply, *prompt, *cmd; int off; + if (win->vnc_send_password && win->mrun && + !strcmp(win->mrun->cmd, "change vnc password") && + strstr(buf, "Password: ")) + { + char buf[64]; + int len; + + if (debug) + fprintf(stderr, "%s: password prompt\n", __FUNCTION__); + len = snprintf(buf, sizeof(buf), "%s\n", win->vnc_password); + write(win->monitor.handle, buf, len); + win->vnc_send_password = 0; + return 0; + } + prompt = strstr(buf, "(qemu) "); if (NULL == prompt) { return 0; @@ -54,8 +69,22 @@ static int monitor_parse(struct qemu_window *win, char *buf, int len) } else if (0 == strcmp(cmd, "info vnc")) { if (1 == sscanf(reply, "VNC server active on: %127[^\r\n]", win->vnc_display) && - strstr(reply, "No client connected")) - vnc_connect(win); + strstr(reply, "No client connected")) { + if (strstr(win->vnc_display, ",password")) { + win->vnc_password = malloc(32); +#if 1 + /* FIXME: do something less predictable */ + srand(time(NULL)+getpid()); + snprintf(win->vnc_password, 32, "%x", rand() & 0xfffffff); +#endif + win->vnc_send_password = 1; + monitor_append(win, "change vnc password"); + } else { + vnc_connect(win); + } + } + } else if (0 == strcmp(cmd, "change vnc password")) { + vnc_connect(win); } out: |