diff --git a/guacamole/proxy/Makefile b/guacamole/proxy/Makefile index 13710eea9..9a3184ffe 100644 --- a/guacamole/proxy/Makefile +++ b/guacamole/proxy/Makefile @@ -1,22 +1,25 @@ +CFLAGS=-O2 -ansi -pedantic -Wall -Werror +LDFLAGS=-lpng -lvncclient + .PHONY: clean all: guacd guacd: daemon.o proxy.o guacio.o protocol.o - $(CC) -O2 daemon.o proxy.o protocol.o guacio.o -l png -l vncclient -o guacd + $(CC) $(CFLAGS) $(LDFLAGS) daemon.o proxy.o protocol.o guacio.o -o guacd proxy.o: proxy.c proxy.h guacio.h - $(CC) -O2 -c -ansi -pedantic proxy.c + $(CC) $(CFLAGS) -c proxy.c protocol.o: protocol.c protocol.h guacio.h - $(CC) -O2 -c -ansi -pedantic protocol.c + $(CC) $(CFLAGS) -c protocol.c guacio.o: guacio.c guacio.h - $(CC) -O2 -c -ansi -pedantic guacio.c + $(CC) $(CFLAGS) -c guacio.c daemon.o: daemon.c proxy.h - $(CC) -O2 -c -ansi -pedantic daemon.c + $(CC) $(CFLAGS) -c daemon.c clean: $(RM) *.o guacd diff --git a/guacamole/proxy/guacio.c b/guacamole/proxy/guacio.c index f61fe8df7..a7c0f215f 100644 --- a/guacamole/proxy/guacio.c +++ b/guacamole/proxy/guacio.c @@ -21,6 +21,8 @@ GUACIO* guac_open(int fd) { io->written = 0; io->fd = fd; + return io; + } void guac_close(GUACIO* io) { diff --git a/guacamole/proxy/protocol.c b/guacamole/proxy/protocol.c index 9a16ae387..6afae1968 100644 --- a/guacamole/proxy/protocol.c +++ b/guacamole/proxy/protocol.c @@ -60,9 +60,15 @@ char* guac_escape_string(const char* str) { } void guac_send_name(GUACIO* io, const char* name) { + + char* escaped = guac_escape_string(name); + guac_write_string(io, "name:"); guac_write_string(io, name); guac_write_string(io, ";"); + + free(escaped); + } void guac_send_size(GUACIO* io, int w, int h) { @@ -106,7 +112,6 @@ void guac_send_png(GUACIO* io, int x, int y, png_byte** png_rows, int w, int h) png_structp png; png_infop png_info; - png_byte* row; /* Write image */ diff --git a/guacamole/proxy/proxy.c b/guacamole/proxy/proxy.c index 0de577d19..2988e9f28 100644 --- a/guacamole/proxy/proxy.c +++ b/guacamole/proxy/proxy.c @@ -90,13 +90,12 @@ char* guac_vnc_get_password(rfbClient* client) { void proxy(int client_fd) { char* hostname; - char* escaped; int wait_result; rfbClient* rfb_client; png_byte** png_rows; png_byte* row; - int x, y; + int y; GUACIO* io = guac_open(client_fd); @@ -133,9 +132,7 @@ void proxy(int client_fd) { rfbClientSetClientData(rfb_client, __GUAC_VNC_TAG_PNG_ROWS, png_rows); /* Send name */ - escaped = guac_escape_string(rfb_client->desktopName); - guac_send_name(io, escaped); - free(escaped); + guac_send_name(io, rfb_client->desktopName); /* Send size */ guac_send_size(io, rfb_client->width, rfb_client->height);