*** ./unix/Makefile.gtk.ORIG Mon May 6 22:24:31 2019 --- ./unix/Makefile.gtk Tue May 7 00:14:15 2019 *************** *** 93,101 **** # completely insecure -- a FUZZING build should never be used to # connect to a real server. # You can define this path to point at your tools if you need to # TOOLPATH = /opt/gcc/bin ! CC = $(TOOLPATH)cc # If necessary set the path to krb5-config here KRB5CONFIG=krb5-config # You can manually set this to `gtk-config' or `pkg-config gtk+-1.2' --- 93,104 ---- # completely insecure -- a FUZZING build should never be used to # connect to a real server. + XFLAGS=-DDEBUG + VER=-DRELEASE="0.71 for AIX" + # You can define this path to point at your tools if you need to # TOOLPATH = /opt/gcc/bin ! CC = $(TOOLPATH)xlc_r -D_LINUX_SOURCE_COMPAT # If necessary set the path to krb5-config here KRB5CONFIG=krb5-config # You can manually set this to `gtk-config' or `pkg-config gtk+-1.2' *************** *** 103,118 **** # building with GTK 1.2, or you can set it to `pkg-config gtk+-2.0 x11' # if you want to enforce 2.0. The default is to try 2.0 and fall back # to 1.2 if it isn't found. ! GTK_CONFIG = sh -c 'pkg-config gtk+-3.0 x11 $$0 2>/dev/null || pkg-config gtk+-2.0 x11 $$0 2>/dev/null || gtk-config $$0' -include Makefile.local unexport CFLAGS # work around a weird issue with krb5-config ! CFLAGS = -O2 -Wall -Werror -std=gnu99 -Wvla -g -I.././ -I../charset/ \ ! -I../windows/ -I../unix/ $(shell $(GTK_CONFIG) --cflags) -D _FILE_OFFSET_BITS=64 ! XLDFLAGS = $(LDFLAGS) $(shell $(GTK_CONFIG) --libs) ! ULDFLAGS = $(LDFLAGS) ifeq (,$(findstring NO_GSSAPI,$(COMPAT))) ifeq (,$(findstring STATIC_GSSAPI,$(COMPAT))) XLDFLAGS+= -ldl --- 106,121 ---- # building with GTK 1.2, or you can set it to `pkg-config gtk+-2.0 x11' # if you want to enforce 2.0. The default is to try 2.0 and fall back # to 1.2 if it isn't found. ! GTK_CONFIG = pkg-config gtk+-2.0 x11 -include Makefile.local unexport CFLAGS # work around a weird issue with krb5-config ! CFLAGS = -O3 -qstrict -I.././ -I../charset/ \ ! -I../windows/ -I../unix/ $(shell $(GTK_CONFIG) --cflags) -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES ! XLDFLAGS = $(LDFLAGS) $(shell $(GTK_CONFIG) --libs) -lbsd ! ULDFLAGS = $(LDFLAGS) -lbsd ifeq (,$(findstring NO_GSSAPI,$(COMPAT))) ifeq (,$(findstring STATIC_GSSAPI,$(COMPAT))) XLDFLAGS+= -ldl *************** *** 126,132 **** INSTALL=install INSTALL_PROGRAM=$(INSTALL) INSTALL_DATA=$(INSTALL) ! prefix=/usr/local exec_prefix=$(prefix) bindir=$(exec_prefix)/bin mandir=$(prefix)/man --- 129,135 ---- INSTALL=install INSTALL_PROGRAM=$(INSTALL) INSTALL_DATA=$(INSTALL) ! prefix=/opt/freeware exec_prefix=$(prefix) bindir=$(exec_prefix)/bin mandir=$(prefix)/man *************** *** 314,320 **** time.o timing.o toucs.o tree234.o utf8.o utils.o uxcfg.o \ uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o uxsignal.o \ uxstore.o uxucs.o version.o wcwidth.o x11misc.o xenc.o \ ! xkeysym.o xpmptcfg.o xpmpterm.o $(CC) -o $@ be_none.o callback.o cmdline.o conf.o config.o dialog.o \ fromucs.o gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o \ gtkmain.o gtkmisc.o gtkwin.o ldisc.o ldiscucs.o localenc.o \ --- 317,323 ---- time.o timing.o toucs.o tree234.o utf8.o utils.o uxcfg.o \ uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o uxsignal.o \ uxstore.o uxucs.o version.o wcwidth.o x11misc.o xenc.o \ ! xkeysym.o xpmptcfg.o xpmpterm.o xutf8.o $(CC) -o $@ be_none.o callback.o cmdline.o conf.o config.o dialog.o \ fromucs.o gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o \ gtkmain.o gtkmisc.o gtkwin.o ldisc.o ldiscucs.o localenc.o \ *************** *** 324,330 **** terminal.o time.o timing.o toucs.o tree234.o utf8.o utils.o \ uxcfg.o uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o \ uxsignal.o uxstore.o uxucs.o version.o wcwidth.o x11misc.o \ ! xenc.o xkeysym.o xpmptcfg.o xpmpterm.o $(XLDFLAGS) ptermapp: be_none.o callback.o conf.o config.o dialog.o fromucs.o gtkapp.o \ gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o gtkmisc.o \ --- 327,333 ---- terminal.o time.o timing.o toucs.o tree234.o utf8.o utils.o \ uxcfg.o uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o \ uxsignal.o uxstore.o uxucs.o version.o wcwidth.o x11misc.o \ ! xenc.o xkeysym.o xpmptcfg.o xpmpterm.o xutf8.o $(XLDFLAGS) -lXmu -lXt ptermapp: be_none.o callback.o conf.o config.o dialog.o fromucs.o gtkapp.o \ gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o gtkmisc.o \ *************** *** 345,351 **** terminal.o time.o timing.o toucs.o tree234.o utf8.o utils.o \ uxcfg.o uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o \ uxsignal.o uxstore.o uxucs.o version.o wcwidth.o x11misc.o \ ! xenc.o xkeysym.o xpmptcfg.o xpmpterm.o $(XLDFLAGS) putty: agentf.o aqsync.o be_all_s.o be_misc.o callback.o cmdline.o conf.o \ config.o cproxy.o dialog.o ecc.o errsock.o fromucs.o \ --- 348,354 ---- terminal.o time.o timing.o toucs.o tree234.o utf8.o utils.o \ uxcfg.o uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o \ uxsignal.o uxstore.o uxucs.o version.o wcwidth.o x11misc.o \ ! xenc.o xkeysym.o xpmptcfg.o xpmpterm.o $(XLDFLAGS) -lXmu -lXt putty: agentf.o aqsync.o be_all_s.o be_misc.o callback.o cmdline.o conf.o \ config.o cproxy.o dialog.o ecc.o errsock.o fromucs.o \ *************** *** 369,375 **** uxnoise.o uxpeer.o uxpoll.o uxprint.o uxproxy.o uxputty.o \ uxsel.o uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o \ uxutils.o version.o wcwidth.o wildcard.o x11fwd.o x11misc.o \ ! xenc.o xkeysym.o xpmpucfg.o xpmputty.o $(CC) -o $@ agentf.o aqsync.o be_all_s.o be_misc.o callback.o \ cmdline.o conf.o config.o cproxy.o dialog.o ecc.o errsock.o \ fromucs.o gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o \ --- 372,378 ---- uxnoise.o uxpeer.o uxpoll.o uxprint.o uxproxy.o uxputty.o \ uxsel.o uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o \ uxutils.o version.o wcwidth.o wildcard.o x11fwd.o x11misc.o \ ! xenc.o xkeysym.o xpmpucfg.o xpmputty.o xutf8.o $(CC) -o $@ agentf.o aqsync.o be_all_s.o be_misc.o callback.o \ cmdline.o conf.o config.o cproxy.o dialog.o ecc.o errsock.o \ fromucs.o gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o \ *************** *** 392,398 **** uxnoise.o uxpeer.o uxpoll.o uxprint.o uxproxy.o uxputty.o \ uxsel.o uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o \ uxutils.o version.o wcwidth.o wildcard.o x11fwd.o x11misc.o \ ! xenc.o xkeysym.o xpmpucfg.o xpmputty.o $(XLDFLAGS) puttyapp: agentf.o aqsync.o be_all_s.o be_misc.o callback.o conf.o config.o \ cproxy.o dialog.o ecc.o errsock.o fromucs.o gtkapp.o \ --- 395,401 ---- uxnoise.o uxpeer.o uxpoll.o uxprint.o uxproxy.o uxputty.o \ uxsel.o uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o \ uxutils.o version.o wcwidth.o wildcard.o x11fwd.o x11misc.o \ ! xenc.o xkeysym.o xpmpucfg.o xpmputty.o xutf8.o $(XLDFLAGS) -lXmu -lXt puttyapp: agentf.o aqsync.o be_all_s.o be_misc.o callback.o conf.o config.o \ cproxy.o dialog.o ecc.o errsock.o fromucs.o gtkapp.o \ *************** *** 416,422 **** uxnoise.o uxpeer.o uxpoll.o uxprint.o uxproxy.o uxputty.o \ uxsel.o uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o \ uxutils.o version.o wcwidth.o wildcard.o x11fwd.o x11misc.o \ ! xenc.o xkeysym.o xpmpucfg.o xpmputty.o $(CC) -o $@ agentf.o aqsync.o be_all_s.o be_misc.o callback.o conf.o \ config.o cproxy.o dialog.o ecc.o errsock.o fromucs.o \ gtkapp.o gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o \ --- 419,425 ---- uxnoise.o uxpeer.o uxpoll.o uxprint.o uxproxy.o uxputty.o \ uxsel.o uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o \ uxutils.o version.o wcwidth.o wildcard.o x11fwd.o x11misc.o \ ! xenc.o xkeysym.o xpmpucfg.o xpmputty.o xutf8.o $(CC) -o $@ agentf.o aqsync.o be_all_s.o be_misc.o callback.o conf.o \ config.o cproxy.o dialog.o ecc.o errsock.o fromucs.o \ gtkapp.o gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o \ *************** *** 439,445 **** uxnoise.o uxpeer.o uxpoll.o uxprint.o uxproxy.o uxputty.o \ uxsel.o uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o \ uxutils.o version.o wcwidth.o wildcard.o x11fwd.o x11misc.o \ ! xenc.o xkeysym.o xpmpucfg.o xpmputty.o $(XLDFLAGS) puttygen: cmdgen.o conf.o ecc.o import.o marshal.o memory.o misc.o mpint.o \ notiming.o sshaes.o sshauxcrypt.o sshbcrypt.o sshblowf.o \ --- 442,448 ---- uxnoise.o uxpeer.o uxpoll.o uxprint.o uxproxy.o uxputty.o \ uxsel.o uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o \ uxutils.o version.o wcwidth.o wildcard.o x11fwd.o x11misc.o \ ! xenc.o xkeysym.o xpmpucfg.o xpmputty.o xutf8.o $(XLDFLAGS) -lXmu -lXt puttygen: cmdgen.o conf.o ecc.o import.o marshal.o memory.o misc.o mpint.o \ notiming.o sshaes.o sshauxcrypt.o sshbcrypt.o sshblowf.o \ *************** *** 468,474 **** uxmisc.o uxnet.o uxpeer.o uxpoll.o uxprint.o uxproxy.o \ uxputty.o uxsel.o uxser.o uxsignal.o uxstore.o uxucs.o \ uxutils.o version.o wcwidth.o x11misc.o xenc.o xkeysym.o \ ! xpmpucfg.o xpmputty.o $(CC) -o $@ be_misc.o be_nos_s.o callback.o cmdline.o conf.o \ config.o dialog.o errsock.o fromucs.o gtkcfg.o gtkcols.o \ gtkcomm.o gtkdlg.o gtkfont.o gtkmain.o gtkmisc.o gtkwin.o \ --- 471,477 ---- uxmisc.o uxnet.o uxpeer.o uxpoll.o uxprint.o uxproxy.o \ uxputty.o uxsel.o uxser.o uxsignal.o uxstore.o uxucs.o \ uxutils.o version.o wcwidth.o x11misc.o xenc.o xkeysym.o \ ! xpmpucfg.o xpmputty.o xutf8.o $(CC) -o $@ be_misc.o be_nos_s.o callback.o cmdline.o conf.o \ config.o dialog.o errsock.o fromucs.o gtkcfg.o gtkcols.o \ gtkcomm.o gtkdlg.o gtkfont.o gtkmain.o gtkmisc.o gtkwin.o \ *************** *** 480,486 **** utils.o uxcfg.o uxfdsock.o uxmisc.o uxnet.o uxpeer.o \ uxpoll.o uxprint.o uxproxy.o uxputty.o uxsel.o uxser.o \ uxsignal.o uxstore.o uxucs.o uxutils.o version.o wcwidth.o \ ! x11misc.o xenc.o xkeysym.o xpmpucfg.o xpmputty.o $(XLDFLAGS) testcrypt: ecc.o marshal.o memory.o mpint.o sshaes.o ssharcf.o sshauxcrypt.o \ sshblowf.o sshccp.o sshcrc.o sshcrcda.o sshdes.o sshdh.o \ --- 483,489 ---- utils.o uxcfg.o uxfdsock.o uxmisc.o uxnet.o uxpeer.o \ uxpoll.o uxprint.o uxproxy.o uxputty.o uxsel.o uxser.o \ uxsignal.o uxstore.o uxucs.o uxutils.o version.o wcwidth.o \ ! x11misc.o xenc.o xkeysym.o xpmpucfg.o xpmputty.o xutf8.o $(XLDFLAGS) -lXmu -lXt testcrypt: ecc.o marshal.o memory.o mpint.o sshaes.o ssharcf.o sshauxcrypt.o \ sshblowf.o sshccp.o sshcrc.o sshcrcda.o sshdes.o sshdh.o \ *************** *** 497,511 **** sshblowf.o sshccp.o sshcrc.o sshcrcda.o sshdes.o sshdh.o \ sshdss.o sshecc.o sshhmac.o sshmac.o sshmd5.o sshrsa.o \ sshsh256.o sshsh512.o sshsha.o testsc.o tree234.o utils.o \ ! uxutils.o wildcard.o $(CC) -o $@ ecc.o marshal.o memory.o mpint.o sshaes.o ssharcf.o \ sshauxcrypt.o sshblowf.o sshccp.o sshcrc.o sshcrcda.o \ sshdes.o sshdh.o sshdss.o sshecc.o sshhmac.o sshmac.o \ sshmd5.o sshrsa.o sshsh256.o sshsh512.o sshsha.o testsc.o \ ! tree234.o utils.o uxutils.o wildcard.o $(ULDFLAGS) ! testzlib: marshal.o memory.o sshzlib.o testzlib.o utils.o ! $(CC) -o $@ marshal.o memory.o sshzlib.o testzlib.o utils.o \ $(ULDFLAGS) uppity: be_misc.o be_none.o callback.o conf.o cproxy.o ecc.o errsock.o \ --- 500,514 ---- sshblowf.o sshccp.o sshcrc.o sshcrcda.o sshdes.o sshdh.o \ sshdss.o sshecc.o sshhmac.o sshmac.o sshmd5.o sshrsa.o \ sshsh256.o sshsh512.o sshsha.o testsc.o tree234.o utils.o \ ! uxutils.o wildcard.o uxmisc.o $(CC) -o $@ ecc.o marshal.o memory.o mpint.o sshaes.o ssharcf.o \ sshauxcrypt.o sshblowf.o sshccp.o sshcrc.o sshcrcda.o \ sshdes.o sshdh.o sshdss.o sshecc.o sshhmac.o sshmac.o \ sshmd5.o sshrsa.o sshsh256.o sshsh512.o sshsha.o testsc.o \ ! tree234.o utils.o uxutils.o wildcard.o uxmisc.o $(ULDFLAGS) ! testzlib: marshal.o memory.o sshzlib.o testzlib.o utils.o uxmisc.o ! $(CC) -o $@ marshal.o memory.o sshzlib.o testzlib.o utils.o uxmisc.o \ $(ULDFLAGS) uppity: be_misc.o be_none.o callback.o conf.o cproxy.o ecc.o errsock.o \ *************** *** 544,549 **** --- 547,555 ---- uxpeer.o uxpoll.o uxproxy.o uxpty.o uxsel.o uxserver.o \ uxsftpserver.o uxsignal.o uxstore.o uxutils.o version.o \ wcwidth.o wildcard.o x11fwd.o $(ULDFLAGS) + + xutf8.o: ./xutf8.c ./xutf8.h + $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) -c ./xutf8.c agentf.o: ../agentf.c ../putty.h ../ssh.h ../pageant.h ../sshchan.h \ ../defs.h ../puttyps.h ../network.h ../misc.h ../marshal.h \ *** ./unix/stdbool.h.ORIG Tue May 7 00:16:04 2019 --- ./unix/stdbool.h Tue May 7 00:15:31 2019 *************** *** 0 **** --- 1,6 ---- + #ifndef stdbool_h_wrapper + #define stdbool_h_wrapper + + typedef enum {false = 0, true = 1} bool; + + #endif *** ./unix/xutf8.c.ORIG Mon May 6 23:02:48 2019 --- ./unix/xutf8.c Mon May 6 23:02:07 2019 *************** *** 0 **** --- 1,301 ---- + /* $XFree86: xc/programs/xterm/xutf8.c,v 1.3 2002/10/09 16:38:20 tsi Exp $ */ + /* + Copyright (c) 2001 by Juliusz Chroboczek + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + + #include + + #include + #include + #include + #include + + #include + + #undef XA_UTF8_STRING + + Atom + _xa_utf8_string(Display * dpy) + { + static AtomPtr p = NULL; + + if (p == NULL) + p = XmuMakeAtom("UTF8_STRING"); + + return XmuInternAtom(dpy, p); + } + #define XA_UTF8_STRING(dpy) _xa_utf8_string(dpy) + + static void + utf8insert(char *dest, int c, int *len_return) + { + if (c < 0) + return; + + if (c <= 0x7F) { + dest[0] = c; + *len_return = 1; + } else if (c <= 0x7FF) { + dest[0] = 0xC0 | ((c >> 6) & 0x1F); + dest[1] = 0x80 | (c & 0x3F); + *len_return = 2; + } else if (c <= 0xFFFF) { + dest[0] = 0xE0 | ((c >> 12) & 0x0F); + dest[1] = 0x80 | ((c >> 6) & 0x3F); + dest[2] = 0x80 | (c & 0x3F); + *len_return = 3; + } else { + dest[0] = 0xF0 | ((c >> 18) & 0x07); + dest[1] = 0x80 | ((c >> 12) & 0x3f); + dest[2] = 0x80 | ((c >> 6) & 0x3f); + dest[3] = 0x80 | (c & 0x3f); + *len_return = 4; + } + } + + static int + l1countUtf8Bytes(char *s, int len) + { + int l = 0; + while (len > 0) { + if ((*s & 0x80) == 0) + l++; + else + l += 2; + s++; + len--; + } + return l; + } + + static void + l1utf8copy(char *d, char *s, int len) + { + int l; + while (len > 0) { + utf8insert(d, (*s) & 0xFF, &l); + d += l; + s++; + len--; + } + } + + static void + utf8l1strcpy(char *d, char *s) + { + #define SKIP do { s++; } while(((*s & 0x80) != 0) && (*s & 0xC0) != 0xC0) + while (*s) { + if ((*s & 0x80) == 0) + *d++ = *s++; + else if ((*s & 0x7C) == 0x40) { + if ((s[1] & 0x80) == 0) { + s++; /* incorrect UTF-8 */ + continue; + } else if ((*s & 0x7C) == 0x40) { + *d++ = ((*s & 0x03) << 6) | (s[1] & 0x3F); + s += 2; + } else { + *d++ = '?'; + SKIP; + } + } else { + *d++ = '?'; + SKIP; + } + } + *d = 0; + #undef SKIP + } + + /* Keep this in sync with utf8l1strcpy! */ + static int + utf8l1strlen(char *s) + { + #define SKIP do { s++; } while(((*s & 0x80) != 0) && (*s & 0xC0) != 0xC0) + int len = 0; + while (*s) { + if ((*s & 0x80) == 0) { + s++; + len++; + } else if ((*s & 0x7C) == 0x40) { + if ((s[1] & 0x80) == 0) { + s++; + continue; + } else if ((*s & 0x7C) == 0x40) { + len++; + s += 2; + } else { + len++; + SKIP; + } + } else { + len++; + SKIP; + } + } + #undef SKIP + return len; + } + + int + Xutf8TextPropertyToTextList(Display * dpy, + const XTextProperty * tp, + char ***list_return, + int *count_return) + { + int utf8; + char **list; + int nelements; + register char *cp; + char *start; + int i, j; + int datalen = (int) tp->nitems; + int len; + + if (tp->format != 8) + return XConverterNotFound; + + if (tp->encoding == XA_STRING) + utf8 = 0; + else if (tp->encoding == XA_UTF8_STRING(dpy)) + utf8 = 1; + else + return XConverterNotFound; + + if (datalen == 0) { + *list_return = NULL; + *count_return = 0; + return 0; + } + + nelements = 1; + for (cp = (char *) tp->value, i = datalen; i > 0; cp++, i--) { + if (*cp == '\0') + nelements++; + } + + list = (char **) malloc(nelements * sizeof(char *)); + if (!list) + return XNoMemory; + + if (utf8) + len = datalen; + else + len = l1countUtf8Bytes((char *) tp->value, datalen); + + start = (char *) malloc((len + 1) * sizeof(char)); + if (!start) { + free((char *) list); + return XNoMemory; + } + + if (utf8) + memcpy(start, (char *) tp->value, datalen); + else + l1utf8copy(start, (char *) tp->value, datalen); + start[len] = '\0'; + + for (cp = start, i = len + 1, j = 0; i > 0; cp++, i--) { + if (*cp == '\0') { + list[j] = start; + start = (cp + 1); + j++; + } + } + + list[j] = NULL; + *list_return = list; + *count_return = nelements; + return 0; + } + + int + Xutf8TextListToTextProperty(Display * dpy, + char **list, + int count, + XICCEncodingStyle style, + XTextProperty * text_prop) + { + XTextProperty proto; + unsigned int nbytes; + int i; + + if (style != XStringStyle && + style != XCompoundTextStyle && + style != XStdICCTextStyle && + style != XUTF8StringStyle) + return XConverterNotFound; + + if (style == XUTF8StringStyle) { + for (i = 0, nbytes = 0; i < count; i++) { + nbytes += (unsigned) ((list[i] ? strlen(list[i]) : 0) + 1); + } + } else { + for (i = 0, nbytes = 0; i < count; i++) { + nbytes += (unsigned) ((list[i] ? utf8l1strlen(list[i]) : 0) + 1); + } + } + + if (style == XCompoundTextStyle) + proto.encoding = XA_COMPOUND_TEXT(dpy); + else if (style == XUTF8StringStyle) + proto.encoding = XA_UTF8_STRING(dpy); + else + proto.encoding = XA_STRING; + proto.format = 8; + if (nbytes) + proto.nitems = nbytes - 1; + else + proto.nitems = 0; + proto.value = NULL; + + if (nbytes > 0) { + register char *buf = malloc(nbytes); + if (!buf) + return XNoMemory; + + proto.value = (unsigned char *) buf; + for (i = 0; i < count; i++) { + char *arg = list[i]; + + if (arg) { + if (style == XUTF8StringStyle) { + strcpy(buf, arg); + } else { + utf8l1strcpy(buf, arg); + } + buf += (strlen(buf) + 1); + } else { + *buf++ = '\0'; + } + } + } else { + proto.value = (unsigned char *) malloc(1); /* easier for client */ + if (!proto.value) + return XNoMemory; + + proto.value[0] = '\0'; + } + + *text_prop = proto; + return 0; + } + *** ./unix/xutf8.h.ORIG Mon May 6 23:02:52 2019 --- ./unix/xutf8.h Mon May 6 23:02:07 2019 *************** *** 0 **** --- 1,57 ---- + /* $XFree86: xc/programs/xterm/xutf8.h,v 1.1 2001/06/18 19:09:28 dickey Exp $ */ + /* + Copyright (c) 2001 by Juliusz Chroboczek + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + + #ifndef _XLIB_H_ + #error Please include before "xutf8.h" + #endif + + #undef XA_UTF8_STRING + Atom _xa_utf8_string(Display*); + #define XA_UTF8_STRING(dpy) _xa_utf8_string(dpy) + + #undef XUTF8StringStyle + #define XUTF8StringStyle 4 + + int Xutf8TextPropertyToTextList( + Display *, + const XTextProperty *, + char ***, + int * + ); + int + Xutf8TextListToTextProperty( + Display *, + char **, + int, + XICCEncodingStyle, + XTextProperty * + ); + int Xutf8LookupString( + XIC, + XKeyPressedEvent *, + char *, + int, + KeySym *, + Status * + ); + *** ./unix/uxpty.c.ORIG Mon May 6 23:08:20 2019 --- ./unix/uxpty.c Mon May 6 23:14:36 2019 *************** *** 4,9 **** --- 4,16 ---- #define _GNU_SOURCE + #ifdef _AIX + //#define TIOCSCTTY 0x540E + #define HAVE_NO_SETRESUID + #undef HAVE_UPDWTMPX + #define BSD_PTYS + #endif + #include #include #include *************** *** 203,208 **** --- 210,218 ---- #endif struct passwd *pw; struct timeval tv; + #ifdef _AIX + FILE *wtmp; + #endif pw = getpwuid(getuid()); memset(&utmp_entry, 0, sizeof(utmp_entry)); *************** *** 228,238 **** --- 238,255 ---- utmp_entry.ut_tv.tv_sec = tv.tv_sec; utmp_entry.ut_tv.tv_usec = tv.tv_usec; + #ifndef _AIX setutxent(); pututxline(&utmp_entry); endutxent(); updwtmpx(WTMPX_FILE, &utmp_entry); + #else + if ((wtmp = fopen(WTMP_FILE, "a")) != NULL) { + fwrite(&utmp_entry, 1, sizeof(utmp_entry), wtmp); + fclose(wtmp); + } + #endif #ifdef HAVE_LASTLOG memset(&lastlog_entry, 0, sizeof(lastlog_entry)); *************** *** 253,258 **** --- 270,278 ---- static void cleanup_utmp(void) { struct timeval tv; + #ifdef _AIX + FILE *wtmp; + #endif if (!pty_stamped_utmp) return; *************** *** 263,269 **** --- 283,296 ---- utmp_entry.ut_tv.tv_sec = tv.tv_sec; utmp_entry.ut_tv.tv_usec = tv.tv_usec; + #ifndef _AIX updwtmpx(WTMPX_FILE, &utmp_entry); + #else + if ((wtmp = fopen(WTMP_FILE, "a")) != NULL) { + fwrite(&utmp_entry, 1, sizeof(utmp_entry), wtmp); + fclose(wtmp); + } + #endif memset(utmp_entry.ut_line, 0, lenof(utmp_entry.ut_line)); utmp_entry.ut_tv.tv_sec = 0; *************** *** 813,818 **** --- 840,885 ---- */ uxsel_set(pty_signal_pipe[0], SELECT_R, pty_select_result); } + + + /*************************************************************************** + unsetenv() + ****************************************************************************/ + + #if defined(_AIX) && !defined(_AIX52) + int + unsetenv( const char *name ) + { + size_t len; + char **ep; + + if ((name == NULL) || (*name == '\0') || (strchr( name, '=' ) != NULL)) + { + errno = EINVAL; + return( -1 ); + } + + len = strlen( name ); + + ep = environ; + while (*ep != NULL) + if (! strncmp( *ep, name, len ) && (*ep)[len] == '=') + { + /* Found it. Remove this pointer by moving later ones back. */ + char **dp = ep; + + do + dp[0] = dp[1]; + while (*dp++); + /* Continue the loop in case NAME appears again. */ + } + else + ++ep; + + return( 0 ); + } + #endif + static void copy_ttymodes_into_termios( struct termios *attrs, struct ssh_ttymodes modes) *** ./unix/gtkwin.c.ORIG Mon May 6 23:24:25 2019 --- ./unix/gtkwin.c Tue May 7 00:27:11 2019 *************** *** 45,50 **** --- 45,53 ---- #endif #include "x11misc.h" + #ifdef _AIX + #include "xutf8.h" + #endif /* Colours come in two flavours: configurable, and xterm-extended. */ #define NEXTCOLOURS 240 /* 216 colour-cube plus 24 shades of grey */ *************** *** 992,997 **** --- 995,1007 ---- static void change_font_size(GtkFrontend *inst, int increment); static void key_pressed(GtkFrontend *inst); + + #ifdef _AIX + #define GDK_KEY_C 0x043 + #define GDK_KEY_V 0x056 + #define GDK_KEY_c 0x063 + #define GDK_KEY_v 0x076 + #endif gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) { *** ./unix/uxnet.c.ORIG Mon May 6 23:17:41 2019 --- ./unix/uxnet.c Mon May 6 23:18:15 2019 *************** *** 1490,1495 **** --- 1490,1499 ---- uxsel_tell(s); } + #if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) + #define ss_family __ss_family + #endif + static SocketPeerInfo *sk_net_peer_info(Socket *sock) { NetSocket *s = container_of(sock, NetSocket, sock); *** ./unix/uxsftpserver.c.ORIG Mon May 6 23:46:08 2019 --- ./unix/uxsftpserver.c Mon May 6 23:58:36 2019 *************** *** 437,442 **** --- 437,453 ---- } \ } while (0) + #ifdef _AIX + /* this is just a dummy function as AIX does not have futimes() and the + * program 'uppity' which requires this uxsftpserver.o module is not installed! + */ + int + futimes (int fd, const struct timeval tvp[2]) + { + return( 0 ); + } + #endif + #define PATH_PREFIX(func) func #define FD_PREFIX(func) f ## func *** ./unix/uxshare.c.ORIG Tue May 7 00:02:28 2019 --- ./unix/uxshare.c Tue May 7 00:04:58 2019 *************** *** 238,243 **** --- 238,246 ---- return dirname; } + /* flock() is not defined in any header file but contained libbsd.a */ + extern int flock(int fd, int operation); + int platform_ssh_share(const char *pi_name, Conf *conf, Plug *downplug, Plug *upplug, Socket **sock, char **logtext, char **ds_err, char **us_err, *** ./testcrypt.c.ORIG Mon May 6 23:29:05 2019 --- ./testcrypt.c Mon May 6 23:33:50 2019 *************** *** 347,352 **** --- 347,361 ---- fatal_error("rsaorder '%.*s': not found", PTRLEN_PRINTF(name)); } + #if defined(_AIX) && !defined(_AIX52) + #include "strtoumax.c" + #if defined(_LONG_LONG) && !defined(__64BIT__) + #define PRIXMAX "llX" + #else + #define PRIXMAX "lX" + #endif + #endif + static uintmax_t get_uint(BinarySource *in) { ptrlen word = get_word(in); *** ./strtoumax.c.ORIG Mon May 6 23:32:23 2019 --- ./strtoumax.c Mon May 6 23:31:24 2019 *************** *** 0 **** --- 1,115 ---- + /* $OpenBSD: strtoumax.c,v 1.1 2006/01/13 17:58:09 millert Exp $ */ + + /*- + * Copyright (c) 1992 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #include + #include + #include + + /* + * Convert a string to a uintmax_t. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ + uintmax_t + strtoumax(const char *nptr, char **endptr, int base) + { + const char *s; + uintmax_t acc, cutoff; + int c; + int neg, any, cutlim; + + /* + * See strtoq for comments as to the logic used. + */ + s = nptr; + do { + c = (unsigned char) *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + + /* BIONIC: avoid division and modulo for common cases */ + #define CASE_BASE(x) \ + case x: cutoff = UINTMAX_MAX / x; \ + cutlim = UINTMAX_MAX % x; \ + break + + switch (base) { + CASE_BASE(8); + CASE_BASE(10); + CASE_BASE(16); + default: + cutoff = UINTMAX_MAX / base; + cutlim = UINTMAX_MAX % base; + } + + for (acc = 0, any = 0;; c = (unsigned char) *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0) + continue; + if (acc > cutoff || (acc == cutoff && c > cutlim)) { + any = -1; + acc = UINTMAX_MAX; + errno = ERANGE; + } else { + any = 1; + acc *= (uintmax_t)base; + acc += c; + } + } + if (neg && any > 0) + acc = -acc; + if (endptr != 0) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); + } *** ./defs.h.ORIG Tue May 7 00:16:16 2019 --- ./defs.h Tue May 7 00:16:55 2019 *************** *** 12,19 **** #define PUTTY_DEFS_H #include #include ! #include #if defined _MSC_VER && _MSC_VER < 1800 /* Work around lack of inttypes.h in older MSVC */ --- 12,21 ---- #define PUTTY_DEFS_H #include + #if defined(_AIX) && defined(_AIX52) #include ! #endif ! #include "stdbool.h" #if defined _MSC_VER && _MSC_VER < 1800 /* Work around lack of inttypes.h in older MSVC */ *** ./utils.c.ORIG Tue May 7 00:19:33 2019 --- ./utils.c Tue May 7 00:20:32 2019 *************** *** 301,307 **** } /* Work around lack of va_copy in old MSC */ ! #if defined _MSC_VER && !defined va_copy #define va_copy(a, b) TYPECHECK( \ (va_list *)0 == &(a) && (va_list *)0 == &(b), \ memcpy(&a, &b, sizeof(va_list))) --- 301,307 ---- } /* Work around lack of va_copy in old MSC */ ! #if (defined(_MSC_VER) || (defined(_AIX) && !defined(_AIX52))) && !defined va_copy #define va_copy(a, b) TYPECHECK( \ (va_list *)0 == &(a) && (va_list *)0 == &(b), \ memcpy(&a, &b, sizeof(va_list)))