Commit f61274c8 authored by François Revol's avatar François Revol Committed by Joel Martin

wsproxy: Mac OS X build fixes

- pass CFLAGS and LDFLAGS in case one needs to use -m32
- link to libcrypto for _ERR_print_errors_fp
- __THROW is non-standard define it to nothing by default
- use b64_ntop and b64_pton instead of mangled versions, OSX doesn't mangle them in the same way
- access() takes two arguments!
Signed-off-by: 's avatarFrançois Revol <revol@free.fr>
parent 1f758e87
wsproxy: wsproxy.o websocket.o md5.o wsproxy: wsproxy.o websocket.o md5.o
$(CC) $^ -l ssl -l resolv -o $@ $(CC) $(LDFLAGS) $^ -l ssl -lcrypto -l resolv -o $@
websocket.o: websocket.c websocket.h md5.h websocket.o: websocket.c websocket.h md5.h
wsproxy.o: wsproxy.c websocket.h wsproxy.o: wsproxy.c websocket.h
md5.o: md5.c md5.h md5.o: md5.c md5.h
$(CC) -c -o $@ $*.c -DHAVE_MEMCPY -DSTDC_HEADERS $(CC) $(CFLAGS) -c -o $@ $*.c -DHAVE_MEMCPY -DSTDC_HEADERS
clean: clean:
rm -f wsproxy wsproxy.o websocket.o md5.o rm -f wsproxy wsproxy.o websocket.o md5.o
......
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
# endif # endif
#endif #endif
#ifndef __THROW
#define __THROW
#endif
#include "md5.h" #include "md5.h"
#ifdef _LIBC #ifdef _LIBC
......
...@@ -191,7 +191,7 @@ int encode(u_char const *src, size_t srclength, char *target, size_t targsize) { ...@@ -191,7 +191,7 @@ int encode(u_char const *src, size_t srclength, char *target, size_t targsize) {
int i, sz = 0, len = 0; int i, sz = 0, len = 0;
unsigned char chr; unsigned char chr;
target[sz++] = '\x00'; target[sz++] = '\x00';
len = __b64_ntop(src, srclength, target+sz, targsize-sz); len = b64_ntop(src, srclength, target+sz, targsize-sz);
if (len < 0) { if (len < 0) {
return len; return len;
} }
...@@ -213,7 +213,7 @@ int decode(char *src, size_t srclength, u_char *target, size_t targsize) { ...@@ -213,7 +213,7 @@ int decode(char *src, size_t srclength, u_char *target, size_t targsize) {
/* We may have more than one frame */ /* We may have more than one frame */
end = memchr(start, '\xff', srclength); end = memchr(start, '\xff', srclength);
*end = '\x00'; *end = '\x00';
len = __b64_pton(start, target+retlen, targsize-retlen); len = b64_pton(start, target+retlen, targsize-retlen);
if (len < 0) { if (len < 0) {
return len; return len;
} }
......
...@@ -324,7 +324,7 @@ int main(int argc, char *argv[]) ...@@ -324,7 +324,7 @@ int main(int argc, char *argv[])
if (ssl_only) { if (ssl_only) {
printf("cert: %s\n", settings.cert); printf("cert: %s\n", settings.cert);
if (!settings.cert || !access(settings.cert)) { if (!settings.cert || !access(settings.cert, R_OK)) {
usage("SSL only and cert file not found\n"); usage("SSL only and cert file not found\n");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment