Browse Source

Initial revision

pull/1/head
dscho 21 years ago
commit
757fdc2454
  1. BIN
      .DS_Store
  2. 369
      .depend
  3. 21
      .gdb_history
  4. 340
      COPYING
  5. 63
      Makefile
  6. 19
      README
  7. 17
      TODO
  8. 141
      auth.c
  9. 355
      corre.c
  10. 39
      cutpaste.c
  11. 76
      example.c
  12. 1
      go
  13. 347
      hextile.c
  14. 693
      include/X11/X.h
  15. 137
      include/X11/Xalloca.h
  16. 88
      include/X11/Xfuncproto.h
  17. 98
      include/X11/Xfuncs.h
  18. 206
      include/X11/Xmd.h
  19. 317
      include/X11/Xos.h
  20. 128
      include/X11/Xosdefs.h
  21. 2130
      include/X11/Xproto.h
  22. 79
      include/X11/Xprotostr.h
  23. 60
      include/X11/keysym.h
  24. 1572
      include/X11/keysymdef.h
  25. 239
      include/Xserver/colormap.h
  26. 152
      include/Xserver/cursor.h
  27. 1103
      include/Xserver/dix.h
  28. 232
      include/Xserver/gc.h
  29. 535
      include/Xserver/input.h
  30. 280
      include/Xserver/misc.h
  31. 73
      include/Xserver/miscstruct.h
  32. 74
      include/Xserver/opaque.h
  33. 776
      include/Xserver/os.h
  34. 124
      include/Xserver/pixmap.h
  35. 54
      include/Xserver/region.h
  36. 409
      include/Xserver/regionstr.h
  37. 171
      include/Xserver/screenint.h
  38. 934
      include/Xserver/scrnintstr.h
  39. 42
      include/Xserver/validate.h
  40. 351
      include/Xserver/window.h
  41. 31
      kbdptr.c
  42. 16
      libvncauth/Imakefile
  43. 9
      libvncauth/Makefile
  44. 440
      libvncauth/d3des.c
  45. 51
      libvncauth/d3des.h
  46. 161
      libvncauth/vncauth.c
  47. 30
      libvncauth/vncauth.h
  48. 388
      mac.c
  49. 426
      main.c
  50. 2421
      miregion.c
  51. 522
      rfb.h
  52. 785
      rfbproto.h
  53. 1443
      rfbserver.c
  54. 322
      rre.c
  55. 450
      sockets.c
  56. 99
      stats.c
  57. 46
      storepasswd.c
  58. 84
      tableinitcmtemplate.c
  59. 142
      tableinittctemplate.c
  60. 117
      tabletranstemplate.c
  61. 1772
      tight.c
  62. 400
      translate.c
  63. 205
      xalloc.c
  64. 306
      zlib.c

BIN
.DS_Store vendored

Binary file not shown.

369
.depend

@ -0,0 +1,369 @@
main.o: main.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/alloca.h /usr/include/errno.h /usr/include/bits/errno.h \
/usr/include/linux/errno.h /usr/include/asm/errno.h \
/usr/include/sys/socket.h /usr/include/bits/socket.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/limits.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
/usr/include/asm/socket.h /usr/include/asm/sockios.h \
/usr/include/netinet/in.h /usr/include/stdint.h \
/usr/include/bits/wordsize.h /usr/include/bits/in.h \
/usr/include/bits/byteswap.h /usr/include/unistd.h \
/usr/include/bits/posix_opt.h /usr/include/bits/confname.h \
/usr/include/getopt.h /usr/include/signal.h \
/usr/include/bits/signum.h /usr/include/bits/siginfo.h \
/usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \
/usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h rfb.h \
include/Xserver/scrnintstr.h include/Xserver/screenint.h \
include/Xserver/misc.h include/X11/Xosdefs.h include/X11/Xfuncproto.h \
include/X11/Xmd.h include/X11/X.h include/Xserver/os.h \
include/X11/Xalloca.h /usr/include/string.h include/X11/Xfuncs.h \
include/Xserver/miscstruct.h include/X11/Xprotostr.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/pixmap.h include/Xserver/gc.h include/X11/Xproto.h \
include/Xserver/colormap.h include/Xserver/window.h \
include/Xserver/cursor.h include/Xserver/validate.h \
include/Xserver/dix.h include/Xserver/input.h rfbproto.h \
libvncauth/vncauth.h
rfbserver.o: rfbserver.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/alloca.h /usr/include/unistd.h \
/usr/include/bits/posix_opt.h /usr/include/bits/confname.h \
/usr/include/getopt.h /usr/include/pwd.h /usr/include/sys/socket.h \
/usr/include/bits/socket.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/limits.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
/usr/include/asm/socket.h /usr/include/asm/sockios.h \
/usr/include/netinet/in.h /usr/include/stdint.h \
/usr/include/bits/wordsize.h /usr/include/bits/in.h \
/usr/include/bits/byteswap.h /usr/include/arpa/inet.h rfb.h \
include/Xserver/scrnintstr.h include/Xserver/screenint.h \
include/Xserver/misc.h include/X11/Xosdefs.h include/X11/Xfuncproto.h \
include/X11/Xmd.h include/X11/X.h include/Xserver/os.h \
include/X11/Xalloca.h /usr/include/string.h include/X11/Xfuncs.h \
include/Xserver/miscstruct.h include/X11/Xprotostr.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/pixmap.h include/Xserver/gc.h include/X11/Xproto.h \
include/Xserver/colormap.h include/Xserver/window.h \
include/Xserver/cursor.h include/Xserver/validate.h \
include/Xserver/dix.h include/Xserver/input.h rfbproto.h \
libvncauth/vncauth.h
miregion.o: miregion.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/alloca.h include/Xserver/miscstruct.h \
include/Xserver/misc.h include/X11/Xosdefs.h include/X11/Xfuncproto.h \
include/X11/Xmd.h include/X11/X.h include/Xserver/os.h \
include/X11/Xalloca.h /usr/include/string.h include/X11/Xfuncs.h \
include/X11/Xprotostr.h include/Xserver/regionstr.h \
include/Xserver/gc.h include/X11/Xproto.h include/Xserver/screenint.h \
include/Xserver/pixmap.h
auth.o: auth.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/alloca.h rfb.h include/Xserver/scrnintstr.h \
include/Xserver/screenint.h include/Xserver/misc.h \
include/X11/Xosdefs.h include/X11/Xfuncproto.h include/X11/Xmd.h \
include/X11/X.h include/Xserver/os.h include/X11/Xalloca.h \
/usr/include/string.h include/X11/Xfuncs.h \
include/Xserver/miscstruct.h include/X11/Xprotostr.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/pixmap.h include/Xserver/gc.h include/X11/Xproto.h \
include/Xserver/colormap.h include/Xserver/window.h \
include/Xserver/cursor.h include/Xserver/validate.h \
include/Xserver/dix.h include/Xserver/input.h rfbproto.h \
libvncauth/vncauth.h /usr/include/netinet/in.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/limits.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/stdint.h \
/usr/include/bits/wordsize.h /usr/include/bits/socket.h \
/usr/include/bits/sockaddr.h /usr/include/asm/socket.h \
/usr/include/asm/sockios.h /usr/include/bits/in.h \
/usr/include/bits/byteswap.h
sockets.o: sockets.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
/usr/include/bits/endian.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/sys/sysmacros.h /usr/include/sys/time.h \
/usr/include/bits/time.h /usr/include/sys/socket.h \
/usr/include/bits/socket.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/limits.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \
/usr/include/asm/socket.h /usr/include/asm/sockios.h \
/usr/include/netinet/in.h /usr/include/stdint.h \
/usr/include/bits/wordsize.h /usr/include/bits/in.h \
/usr/include/bits/byteswap.h /usr/include/netinet/tcp.h \
/usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/fcntl.h \
/usr/include/bits/fcntl.h /usr/include/errno.h \
/usr/include/bits/errno.h /usr/include/linux/errno.h \
/usr/include/asm/errno.h /usr/include/unistd.h \
/usr/include/bits/posix_opt.h /usr/include/bits/confname.h \
/usr/include/getopt.h /usr/include/pthread.h /usr/include/sched.h \
/usr/include/bits/sched.h /usr/include/signal.h \
/usr/include/bits/pthreadtypes.h /usr/include/bits/sigthread.h rfb.h \
include/Xserver/scrnintstr.h include/Xserver/screenint.h \
include/Xserver/misc.h include/X11/Xosdefs.h include/X11/Xfuncproto.h \
include/X11/Xmd.h include/X11/X.h include/Xserver/os.h \
include/X11/Xalloca.h /usr/include/string.h include/X11/Xfuncs.h \
include/Xserver/miscstruct.h include/X11/Xprotostr.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/pixmap.h include/Xserver/gc.h include/X11/Xproto.h \
include/Xserver/colormap.h include/Xserver/window.h \
include/Xserver/cursor.h include/Xserver/validate.h \
include/Xserver/dix.h include/Xserver/input.h rfbproto.h \
libvncauth/vncauth.h
xalloc.o: xalloc.c include/X11/Xos.h include/X11/Xosdefs.h \
/usr/include/sys/types.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/include/bits/types.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/string.h /usr/include/fcntl.h /usr/include/bits/fcntl.h \
/usr/include/unistd.h /usr/include/bits/posix_opt.h \
/usr/include/bits/confname.h /usr/include/getopt.h \
/usr/include/sys/time.h /usr/include/bits/time.h /usr/include/stdio.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/libio.h /usr/include/_G_config.h \
/usr/include/bits/stdio_lim.h include/Xserver/misc.h \
include/X11/Xfuncproto.h include/X11/Xmd.h include/X11/X.h \
include/Xserver/os.h include/X11/Xalloca.h include/X11/Xfuncs.h \
include/Xserver/input.h include/Xserver/screenint.h \
include/X11/Xproto.h include/X11/Xprotostr.h include/Xserver/window.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/miscstruct.h include/Xserver/opaque.h \
/usr/include/signal.h /usr/include/bits/signum.h \
/usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \
/usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \
/usr/include/bits/sigstack.h /usr/include/sys/resource.h \
/usr/include/bits/resource.h /usr/include/sys/stat.h \
/usr/include/bits/stat.h /usr/include/ctype.h /usr/include/stdlib.h \
/usr/include/alloca.h
stats.o: stats.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/alloca.h rfb.h include/Xserver/scrnintstr.h \
include/Xserver/screenint.h include/Xserver/misc.h \
include/X11/Xosdefs.h include/X11/Xfuncproto.h include/X11/Xmd.h \
include/X11/X.h include/Xserver/os.h include/X11/Xalloca.h \
/usr/include/string.h include/X11/Xfuncs.h \
include/Xserver/miscstruct.h include/X11/Xprotostr.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/pixmap.h include/Xserver/gc.h include/X11/Xproto.h \
include/Xserver/colormap.h include/Xserver/window.h \
include/Xserver/cursor.h include/Xserver/validate.h \
include/Xserver/dix.h include/Xserver/input.h rfbproto.h \
libvncauth/vncauth.h /usr/include/netinet/in.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/limits.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/stdint.h \
/usr/include/bits/wordsize.h /usr/include/bits/socket.h \
/usr/include/bits/sockaddr.h /usr/include/asm/socket.h \
/usr/include/asm/sockios.h /usr/include/bits/in.h \
/usr/include/bits/byteswap.h
corre.o: corre.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/alloca.h rfb.h include/Xserver/scrnintstr.h \
include/Xserver/screenint.h include/Xserver/misc.h \
include/X11/Xosdefs.h include/X11/Xfuncproto.h include/X11/Xmd.h \
include/X11/X.h include/Xserver/os.h include/X11/Xalloca.h \
/usr/include/string.h include/X11/Xfuncs.h \
include/Xserver/miscstruct.h include/X11/Xprotostr.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/pixmap.h include/Xserver/gc.h include/X11/Xproto.h \
include/Xserver/colormap.h include/Xserver/window.h \
include/Xserver/cursor.h include/Xserver/validate.h \
include/Xserver/dix.h include/Xserver/input.h rfbproto.h \
libvncauth/vncauth.h /usr/include/netinet/in.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/limits.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/stdint.h \
/usr/include/bits/wordsize.h /usr/include/bits/socket.h \
/usr/include/bits/sockaddr.h /usr/include/asm/socket.h \
/usr/include/asm/sockios.h /usr/include/bits/in.h \
/usr/include/bits/byteswap.h
hextile.o: hextile.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h rfb.h \
include/Xserver/scrnintstr.h include/Xserver/screenint.h \
include/Xserver/misc.h include/X11/Xosdefs.h include/X11/Xfuncproto.h \
include/X11/Xmd.h include/X11/X.h include/Xserver/os.h \
include/X11/Xalloca.h /usr/include/string.h include/X11/Xfuncs.h \
include/Xserver/miscstruct.h include/X11/Xprotostr.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/pixmap.h include/Xserver/gc.h include/X11/Xproto.h \
include/Xserver/colormap.h include/Xserver/window.h \
include/Xserver/cursor.h include/Xserver/validate.h \
include/Xserver/dix.h include/Xserver/input.h rfbproto.h \
libvncauth/vncauth.h /usr/include/netinet/in.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/limits.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/stdint.h \
/usr/include/bits/wordsize.h /usr/include/sys/types.h \
/usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/bits/socket.h /usr/include/bits/sockaddr.h \
/usr/include/asm/socket.h /usr/include/asm/sockios.h \
/usr/include/bits/in.h /usr/include/bits/byteswap.h
rre.o: rre.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h rfb.h \
include/Xserver/scrnintstr.h include/Xserver/screenint.h \
include/Xserver/misc.h include/X11/Xosdefs.h include/X11/Xfuncproto.h \
include/X11/Xmd.h include/X11/X.h include/Xserver/os.h \
include/X11/Xalloca.h /usr/include/string.h include/X11/Xfuncs.h \
include/Xserver/miscstruct.h include/X11/Xprotostr.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/pixmap.h include/Xserver/gc.h include/X11/Xproto.h \
include/Xserver/colormap.h include/Xserver/window.h \
include/Xserver/cursor.h include/Xserver/validate.h \
include/Xserver/dix.h include/Xserver/input.h rfbproto.h \
libvncauth/vncauth.h /usr/include/netinet/in.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/limits.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/stdint.h \
/usr/include/bits/wordsize.h /usr/include/sys/types.h \
/usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/bits/socket.h /usr/include/bits/sockaddr.h \
/usr/include/asm/socket.h /usr/include/asm/sockios.h \
/usr/include/bits/in.h /usr/include/bits/byteswap.h
translate.o: translate.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/alloca.h rfb.h include/Xserver/scrnintstr.h \
include/Xserver/screenint.h include/Xserver/misc.h \
include/X11/Xosdefs.h include/X11/Xfuncproto.h include/X11/Xmd.h \
include/X11/X.h include/Xserver/os.h include/X11/Xalloca.h \
/usr/include/string.h include/X11/Xfuncs.h \
include/Xserver/miscstruct.h include/X11/Xprotostr.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/pixmap.h include/Xserver/gc.h include/X11/Xproto.h \
include/Xserver/colormap.h include/Xserver/window.h \
include/Xserver/cursor.h include/Xserver/validate.h \
include/Xserver/dix.h include/Xserver/input.h rfbproto.h \
libvncauth/vncauth.h /usr/include/netinet/in.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/limits.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/stdint.h \
/usr/include/bits/wordsize.h /usr/include/bits/socket.h \
/usr/include/bits/sockaddr.h /usr/include/asm/socket.h \
/usr/include/asm/sockios.h /usr/include/bits/in.h \
/usr/include/bits/byteswap.h tableinittctemplate.c \
tabletranstemplate.c
cutpaste.o: cutpaste.c /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stddef.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/stdarg.h \
/usr/include/bits/types.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h rfb.h \
include/Xserver/scrnintstr.h include/Xserver/screenint.h \
include/Xserver/misc.h include/X11/Xosdefs.h include/X11/Xfuncproto.h \
include/X11/Xmd.h include/X11/X.h include/Xserver/os.h \
include/X11/Xalloca.h /usr/include/string.h include/X11/Xfuncs.h \
include/Xserver/miscstruct.h include/X11/Xprotostr.h \
include/Xserver/region.h include/Xserver/regionstr.h \
include/Xserver/pixmap.h include/Xserver/gc.h include/X11/Xproto.h \
include/Xserver/colormap.h include/Xserver/window.h \
include/Xserver/cursor.h include/Xserver/validate.h \
include/Xserver/dix.h include/Xserver/input.h rfbproto.h \
libvncauth/vncauth.h /usr/include/netinet/in.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/limits.h \
/usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/stdint.h \
/usr/include/bits/wordsize.h /usr/include/sys/types.h \
/usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/sys/select.h /usr/include/bits/select.h \
/usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \
/usr/include/bits/socket.h /usr/include/bits/sockaddr.h \
/usr/include/asm/socket.h /usr/include/asm/sockios.h \
/usr/include/bits/in.h /usr/include/bits/byteswap.h

21
.gdb_history

@ -0,0 +1,21 @@
set args -desktop 'foobie bletch'
r
quit
where
info thread
info threads
thr 1
where
quit
quit
r
where
info threads
thr 2
where
f 31
kill
r
r
r
quit

340
COPYING

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

63
Makefile

@ -0,0 +1,63 @@
CC=gcc
CFLAGS=-g -Wall
#CFLAGS=-O2 -Wall
RANLIB=ranlib
INCLUDES=-I. -Ilibvncauth -Iinclude -Iinclude/X11 -Iinclude/Xserver
VNCAUTHLIB=-Llibvncauth -lvncauth
VNCSERVERLIB=-L. -lvncserver -lz -ljpeg
# These two lines enable useage of PThreads
CFLAGS += -DHAVE_PTHREADS
VNCSERVERLIB += -lpthread
LIBS=$(VNCSERVERLIB) $(VNCAUTHLIB)
# for Mac OS X
OSX_LIBS = -framework ApplicationServices -framework Carbon
# for Example
PTHREAD_LIBS = -lpthread
SOURCES=main.c rfbserver.c miregion.c auth.c sockets.c xalloc.c \
stats.c corre.c hextile.c rre.c translate.c cutpaste.c \
zlib.c tight.c
OBJS=main.o rfbserver.o miregion.o auth.o sockets.o xalloc.o \
stats.o corre.o hextile.o rre.o translate.o cutpaste.o \
zlib.o tight.o
all: example storepasswd
install_OSX: OSXvnc-server
cp OSXvnc-server storepasswd ../OSXvnc/build/OSXvnc.app/Contents/MacOS
.c.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $<
libvncserver.a: $(OBJS)
$(AR) cru $@ $(OBJS)
$(RANLIB) $@
example: example.o libvncauth/libvncauth.a libvncserver.a
$(CC) -o example example.o $(LIBS) $(PTHREAD_LIBS)
OSXvnc-server: mac.o libvncauth/libvncauth.a libvncserver.a
$(CC) -o OSXvnc-server mac.o $(LIBS) $(OSX_LIBS)
storepasswd: storepasswd.o libvncauth/libvncauth.a
$(CC) -o storepasswd storepasswd.o $(VNCAUTHLIB)
libvncauth/libvncauth.a:
(cd libvncauth; make)
clean:
rm -f $(OBJS) *~ core "#"* *.bak *.orig storepasswd.o *.a example.o \
libvncauth/*.o libvncauth/*~ libvncauth/*.a
realclean: clean
rm -f OSXvnc-server storepasswd
depend:
$(CC) -M $(INCLUDES) $(SOURCES) >.depend
#include .depend

19
README

@ -0,0 +1,19 @@
OSXvnc: a VNC server for Mac OS X
Copyright (C) 2001 Dan McGuirk
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.dfdf
For help with OSXvnc, please visit http://www.osxvnc.com/.

17
TODO

@ -0,0 +1,17 @@
.cutpaste
httpd
.other encodings
adapt rdp2vnc (rdesktop)
udp
rfbCloseClient, rfbConnect, ConnectToTcpAddr
CORBA
translate.c: warning about non 8-bit colourmaps
cursors

141
auth.c

@ -0,0 +1,141 @@
/*
* auth.c - deal with authentication.
*
* This file implements the VNC authentication protocol when setting up an RFB
* connection.
*/
/*
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
* All Rights Reserved.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include "rfb.h"
char *rfbAuthPasswdFile = NULL;
/*
* rfbAuthNewClient is called when we reach the point of authenticating
* a new client. If authentication isn't being used then we simply send
* rfbNoAuth. Otherwise we send rfbVncAuth plus the challenge.
*/
void
rfbAuthNewClient(cl)
rfbClientPtr cl;
{
char buf[4 + CHALLENGESIZE];
int len;
cl->state = RFB_AUTHENTICATION;
if (rfbAuthPasswdFile && !cl->reverseConnection) {
*(CARD32 *)buf = Swap32IfLE(rfbVncAuth);
vncRandomBytes(cl->authChallenge);
memcpy(&buf[4], (char *)cl->authChallenge, CHALLENGESIZE);
len = 4 + CHALLENGESIZE;
} else {
*(CARD32 *)buf = Swap32IfLE(rfbNoAuth);
len = 4;
cl->state = RFB_INITIALISATION;
}
if (WriteExact(cl, buf, len) < 0) {
rfbLogPerror("rfbAuthNewClient: write");
rfbCloseClient(cl);
return;
}
}
/*
* rfbAuthProcessClientMessage is called when the client sends its
* authentication response.
*/
void
rfbAuthProcessClientMessage(cl)
rfbClientPtr cl;
{
char *passwd;
int i, n;
CARD8 response[CHALLENGESIZE];
CARD32 authResult;
if ((n = ReadExact(cl, (char *)response, CHALLENGESIZE)) <= 0) {
if (n != 0)
rfbLogPerror("rfbAuthProcessClientMessage: read");
rfbCloseClient(cl);
return;
}
passwd = vncDecryptPasswdFromFile(rfbAuthPasswdFile);
if (passwd == NULL) {
rfbLog("rfbAuthProcessClientMessage: could not get password from %s\n",
rfbAuthPasswdFile);
authResult = Swap32IfLE(rfbVncAuthFailed);
if (WriteExact(cl, (char *)&authResult, 4) < 0) {
rfbLogPerror("rfbAuthProcessClientMessage: write");
}
rfbCloseClient(cl);
return;
}
vncEncryptBytes(cl->authChallenge, passwd);
/* Lose the password from memory */
for (i = strlen(passwd); i >= 0; i--) {
passwd[i] = '\0';
}
free((char *)passwd);
if (memcmp(cl->authChallenge, response, CHALLENGESIZE) != 0) {
rfbLog("rfbAuthProcessClientMessage: authentication failed from %s\n",
cl->host);
authResult = Swap32IfLE(rfbVncAuthFailed);
if (WriteExact(cl, (char *)&authResult, 4) < 0) {
rfbLogPerror("rfbAuthProcessClientMessage: write");
}
rfbCloseClient(cl);
return;
}
authResult = Swap32IfLE(rfbVncAuthOK);
if (WriteExact(cl, (char *)&authResult, 4) < 0) {
rfbLogPerror("rfbAuthProcessClientMessage: write");
rfbCloseClient(cl);
return;
}
cl->state = RFB_INITIALISATION;
}

355
corre.c

@ -0,0 +1,355 @@
/*
* corre.c
*
* Routines to implement Compact Rise-and-Run-length Encoding (CoRRE). This
* code is based on krw's original javatel rfbserver.
*/
/*
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
* All Rights Reserved.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include "rfb.h"
/*
* rreBeforeBuf contains pixel data in the client's format.
* rreAfterBuf contains the RRE encoded version. If the RRE encoded version is
* larger than the raw data or if it exceeds rreAfterBufSize then
* raw encoding is used instead.
*/
static int rreBeforeBufSize = 0;
static char *rreBeforeBuf = NULL;
static int rreAfterBufSize = 0;
static char *rreAfterBuf = NULL;
static int rreAfterBufLen;
static int subrectEncode8(CARD8 *data, int w, int h);
static int subrectEncode16(CARD16 *data, int w, int h);
static int subrectEncode32(CARD32 *data, int w, int h);
static CARD32 getBgColour(char *data, int size, int bpp);
static Bool rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl, int x, int y,
int w, int h);
/*
* rfbSendRectEncodingCoRRE - send an arbitrary size rectangle using CoRRE
* encoding.
*/
Bool
rfbSendRectEncodingCoRRE(cl, x, y, w, h)
rfbClientPtr cl;
int x, y, w, h;
{
if (h > cl->correMaxHeight) {
rfbSendRectEncodingCoRRE(cl, x, y, w, cl->correMaxHeight );
rfbSendRectEncodingCoRRE(cl, x, y + cl->correMaxHeight, w,
h - cl->correMaxHeight);
return FALSE;
}
if (w > cl->correMaxWidth) {
rfbSendRectEncodingCoRRE(cl, x, y, cl->correMaxWidth, h);
rfbSendRectEncodingCoRRE(cl, x + cl->correMaxWidth, y,
w - cl->correMaxWidth, h);
return FALSE;
}
rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h);
return TRUE;
}
/*
* rfbSendSmallRectEncodingCoRRE - send a small (guaranteed < 256x256)
* rectangle using CoRRE encoding.
*/
static Bool
rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h)
rfbClientPtr cl;
int x, y, w, h;
{
rfbFramebufferUpdateRectHeader rect;
rfbRREHeader hdr;
int nSubrects;
int i;
char *fbptr = (cl->screen->frameBuffer + (cl->screen->paddedWidthInBytes * y)
+ (x * (cl->screen->bitsPerPixel / 8)));
int maxRawSize = (cl->screen->width * cl->screen->height
* (cl->format.bitsPerPixel / 8));
if (rreBeforeBufSize < maxRawSize) {
rreBeforeBufSize = maxRawSize;
if (rreBeforeBuf == NULL)
rreBeforeBuf = (char *)xalloc(rreBeforeBufSize);
else
rreBeforeBuf = (char *)xrealloc(rreBeforeBuf, rreBeforeBufSize);
}
if (rreAfterBufSize < maxRawSize) {
rreAfterBufSize = maxRawSize;
if (rreAfterBuf == NULL)
rreAfterBuf = (char *)xalloc(rreAfterBufSize);
else
rreAfterBuf = (char *)xrealloc(rreAfterBuf, rreAfterBufSize);
}
(*cl->translateFn)(cl->translateLookupTable,&(cl->screen->rfbServerFormat),
&cl->format, fbptr, rreBeforeBuf,
cl->screen->paddedWidthInBytes, w, h);
switch (cl->format.bitsPerPixel) {
case 8:
nSubrects = subrectEncode8((CARD8 *)rreBeforeBuf, w, h);
break;
case 16:
nSubrects = subrectEncode16((CARD16 *)rreBeforeBuf, w, h);
break;
case 32:
nSubrects = subrectEncode32((CARD32 *)rreBeforeBuf, w, h);
break;
default:
rfbLog("getBgColour: bpp %d?\n",cl->format.bitsPerPixel);
exit(1);
}
if (nSubrects < 0) {
/* RRE encoding was too large, use raw */
return rfbSendRectEncodingRaw(cl, x, y, w, h);
}
cl->rfbRectanglesSent[rfbEncodingCoRRE]++;
cl->rfbBytesSent[rfbEncodingCoRRE] += (sz_rfbFramebufferUpdateRectHeader
+ sz_rfbRREHeader + rreAfterBufLen);
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader
> UPDATE_BUF_SIZE)
{
if (!rfbSendUpdateBuf(cl))
return FALSE;
}
rect.r.x = Swap16IfLE(x);
rect.r.y = Swap16IfLE(y);
rect.r.w = Swap16IfLE(w);
rect.r.h = Swap16IfLE(h);
rect.encoding = Swap32IfLE(rfbEncodingCoRRE);
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
sz_rfbFramebufferUpdateRectHeader);
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
hdr.nSubrects = Swap32IfLE(nSubrects);
memcpy(&cl->updateBuf[cl->ublen], (char *)&hdr, sz_rfbRREHeader);
cl->ublen += sz_rfbRREHeader;
for (i = 0; i < rreAfterBufLen;) {
int bytesToCopy = UPDATE_BUF_SIZE - cl->ublen;
if (i + bytesToCopy > rreAfterBufLen) {
bytesToCopy = rreAfterBufLen - i;
}
memcpy(&cl->updateBuf[cl->ublen], &rreAfterBuf[i], bytesToCopy);
cl->ublen += bytesToCopy;
i += bytesToCopy;
if (cl->ublen == UPDATE_BUF_SIZE) {
if (!rfbSendUpdateBuf(cl))
return FALSE;
}
}
return TRUE;
}
/*
* subrectEncode() encodes the given multicoloured rectangle as a background
* colour overwritten by single-coloured rectangles. It returns the number
* of subrectangles in the encoded buffer, or -1 if subrect encoding won't
* fit in the buffer. It puts the encoded rectangles in rreAfterBuf. The
* single-colour rectangle partition is not optimal, but does find the biggest
* horizontal or vertical rectangle top-left anchored to each consecutive
* coordinate position.
*
* The coding scheme is simply [<bgcolour><subrect><subrect>...] where each
* <subrect> is [<colour><x><y><w><h>].
*/
#define DEFINE_SUBRECT_ENCODE(bpp) \
static int \
subrectEncode##bpp(data,w,h) \
CARD##bpp *data; \
int w; \
int h; \
{ \
CARD##bpp cl; \
rfbCoRRERectangle subrect; \
int x,y; \
int i,j; \
int hx=0,hy,vx=0,vy; \
int hyflag; \
CARD##bpp *seg; \
CARD##bpp *line; \
int hw,hh,vw,vh; \
int thex,they,thew,theh; \
int numsubs = 0; \
int newLen; \
CARD##bpp bg = (CARD##bpp)getBgColour((char*)data,w*h,bpp); \
\
*((CARD##bpp*)rreAfterBuf) = bg; \
\
rreAfterBufLen = (bpp/8); \
\
for (y=0; y<h; y++) { \
line = data+(y*w); \
for (x=0; x<w; x++) { \
if (line[x] != bg) { \
cl = line[x]; \
hy = y-1; \
hyflag = 1; \
for (j=y; j<h; j++) { \
seg = data+(j*w); \
if (seg[x] != cl) {break;} \
i = x; \
while ((seg[i] == cl) && (i < w)) i += 1; \
i -= 1; \
if (j == y) vx = hx = i; \
if (i < vx) vx = i; \
if ((hyflag > 0) && (i >= hx)) {hy += 1;} else {hyflag = 0;} \
} \
vy = j-1; \
\
/* We now have two possible subrects: (x,y,hx,hy) and (x,y,vx,vy) \
* We'll choose the bigger of the two. \
*/ \
hw = hx-x+1; \
hh = hy-y+1; \
vw = vx-x+1; \
vh = vy-y+1; \
\
thex = x; \
they = y; \
\
if ((hw*hh) > (vw*vh)) { \
thew = hw; \
theh = hh; \
} else { \
thew = vw; \
theh = vh; \
} \
\
subrect.x = thex; \
subrect.y = they; \
subrect.w = thew; \
subrect.h = theh; \
\
newLen = rreAfterBufLen + (bpp/8) + sz_rfbCoRRERectangle; \
if ((newLen > (w * h * (bpp/8))) || (newLen > rreAfterBufSize)) \
return -1; \
\
numsubs += 1; \
*((CARD##bpp*)(rreAfterBuf + rreAfterBufLen)) = cl; \
rreAfterBufLen += (bpp/8); \
memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbCoRRERectangle); \
rreAfterBufLen += sz_rfbCoRRERectangle; \
\
/* \
* Now mark the subrect as done. \
*/ \
for (j=they; j < (they+theh); j++) { \
for (i=thex; i < (thex+thew); i++) { \
data[j*w+i] = bg; \
} \
} \
} \
} \
} \
\
return numsubs; \
}
DEFINE_SUBRECT_ENCODE(8)
DEFINE_SUBRECT_ENCODE(16)
DEFINE_SUBRECT_ENCODE(32)
/*
* getBgColour() gets the most prevalent colour in a byte array.
*/
static CARD32
getBgColour(data,size,bpp)
char *data;
int size;
int bpp;
{
#define NUMCLRS 256
static int counts[NUMCLRS];
int i,j,k;
int maxcount = 0;
CARD8 maxclr = 0;
if (bpp != 8) {
if (bpp == 16) {
return ((CARD16 *)data)[0];
} else if (bpp == 32) {
return ((CARD32 *)data)[0];
} else {
rfbLog("getBgColour: bpp %d?\n",bpp);
exit(1);
}
}
for (i=0; i<NUMCLRS; i++) {
counts[i] = 0;
}
for (j=0; j<size; j++) {
k = (int)(((CARD8 *)data)[j]);
if (k >= NUMCLRS) {
rfbLog("getBgColour: unusual colour = %d\n", k);
exit(1);
}
counts[k] += 1;
if (counts[k] > maxcount) {
maxcount = counts[k];
maxclr = ((CARD8 *)data)[j];
}
}
return maxclr;
}

39
cutpaste.c

@ -0,0 +1,39 @@
/*
* cutpaste.c - routines to deal with cut & paste buffers / selection.
*/
/*
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
* All Rights Reserved.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include <stdio.h>
#include "rfb.h"
/*
* rfbSetXCutText sets the cut buffer to be the given string. We also clear
* the primary selection. Ideally we'd like to set it to the same thing, but I
* can't work out how to do that without some kind of helper X client.
*/
void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len)
{
rfbSendServerCutText(rfbScreen, str, len);
}

76
example.c

@ -0,0 +1,76 @@
/*
*
* This is an example of how to use libvncserver.
*
* libvncserver example
* Copyright (C) 2001 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include <stdio.h>
#include <netinet/in.h>
#ifdef __IRIX__
#include <netdb.h>
#endif
#define XK_MISCELLANY
#include "rfb.h"
#include "keysymdef.h"
const int maxx=640, maxy=480, bpp=4;
void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
{
if(buttonMask && x>=0 && y>=0 && x<maxx && y<maxy) {
int i;
for(i=0;i<bpp;i++)
cl->screen->frameBuffer[y*cl->screen->paddedWidthInBytes+x*bpp+i]^=0xff;
rfbMarkRectAsModified(cl->screen,x,y,x+1,y+1);
rfbGotXCutText(cl->screen,"Hallo",5);
}
}
void dokey(Bool down,KeySym key,rfbClientPtr cl)
{
if(down && key==XK_Escape)
rfbCloseClient(cl);
}
int main(int argc,char** argv)
{
int i,j;
rfbScreenInfoPtr rfbScreen = rfbDefaultScreenInit(argc,argv);
rfbScreen->desktopName="LibVNCServer Example";
rfbScreen->frameBuffer = (char*)malloc(maxx*maxy*bpp);
rfbScreen->width=maxx;
rfbScreen->height=maxy;
rfbScreen->paddedWidthInBytes=maxx*bpp;
rfbScreen->ptrAddEvent=doptr;
rfbScreen->kbdAddEvent=dokey;
for(i=0;i<maxx;++i)
for(j=0;j<maxy;++j) {
rfbScreen->frameBuffer[(j*maxx+i)*bpp]=i*256/maxx;
rfbScreen->frameBuffer[(j*maxx+i)*bpp+1]=j*256/maxy;
rfbScreen->frameBuffer[(j*maxx+i)*bpp+2]=(i+j)*256/(maxx*maxy);
}
runEventLoop(rfbScreen,40000,FALSE);
runEventLoop(rfbScreen,40000,TRUE);
while(1);
return(0);
}

1
go

@ -0,0 +1 @@
<EFBFBD><EFBFBD>#

347
hextile.c

@ -0,0 +1,347 @@
/*
* hextile.c
*
* Routines to implement Hextile Encoding
*/
/*