Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[xsrc-public/trunk]: xsrc-public/external/mit merge xauth 1.1.1 and xterm 370.
details: https://anonhg.NetBSD.org/xsrc-public/rev/2ec96af62e34
branches: trunk
changeset: 6946:2ec96af62e34
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Jan 09 09:17:31 2022 +0000
description:
merge xauth 1.1.1 and xterm 370.
diffstat:
external/mit/xauth/dist/process.c | 88 ++++++-
external/mit/xterm/dist/fontutils.c | 38 ++-
external/mit/xterm/dist/linedata.c | 8 +-
external/mit/xterm/dist/misc.c | 362 ++++++++++++---------------------
external/mit/xterm/dist/ptyx.h | 58 +---
external/mit/xterm/dist/xterm.h | 31 +-
external/mit/xterm/dist/xterm.man | 43 +++-
external/mit/xterm/include/xtermcfg.h | 4 +-
8 files changed, 303 insertions(+), 329 deletions(-)
diffs (truncated from 1282 to 300 lines):
diff -r a247352600be -r 2ec96af62e34 external/mit/xauth/dist/process.c
--- a/external/mit/xauth/dist/process.c Sun Jan 09 09:15:26 2022 +0000
+++ b/external/mit/xauth/dist/process.c Sun Jan 09 09:17:31 2022 +0000
@@ -37,6 +37,7 @@
#include "xauth.h"
#include <ctype.h>
#include <errno.h>
+#include <stdint.h>
#include <sys/stat.h>
#ifndef WIN32
#include <sys/socket.h>
@@ -251,6 +252,18 @@
return s;
}
+#ifndef HAVE_REALLOCARRAY
+static inline void *
+reallocarray(void *optr, size_t nmemb, size_t size)
+{
+ if ((nmemb > 0) && (SIZE_MAX / nmemb < size)) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ return realloc(optr, size * nmemb);
+}
+#endif
+
static const char **
split_into_words(char *src, int *argcp) /* argvify string */
{
@@ -278,9 +291,15 @@
savec = *src;
*src = '\0';
if (cur == total) {
+ const char **new_argv;
total += WORDSTOALLOC;
- argv = realloc (argv, total * sizeof (char *));
- if (!argv) return NULL;
+ new_argv = reallocarray (argv, total, sizeof (char *));
+ if (new_argv != NULL) {
+ argv = new_argv;
+ } else {
+ free(argv);
+ return NULL;
+ }
}
argv[cur++] = jword;
if (savec) src++; /* if not last on line advance */
@@ -633,7 +652,7 @@
static Bool xauth_allowed = True; /* if allowed to write auth file */
static Bool xauth_locked = False; /* if has been locked */
static const char *xauth_filename = NULL;
-static volatile Bool dieing = False;
+static volatile Bool dying = False;
/* poor man's puts(), for under signal handlers,
@@ -645,7 +664,7 @@
static void
die(int sig)
{
- dieing = True;
+ dying = True;
_exit (auth_finalize ());
/* NOTREACHED */
}
@@ -697,6 +716,10 @@
FILE *authfp;
Bool exists;
+ if (strlen(authfilename) > 1022) {
+ fprintf (stderr, "%s: authority file name \"%s\" too long\n",
+ ProgramName, authfilename);
+ }
xauth_filename = authfilename; /* used in cleanup, prevent race with
signals */
register_signals ();
@@ -854,10 +877,10 @@
int
auth_finalize(void)
{
- char temp_name[1024]; /* large filename size */
+ char temp_name[1025]; /* large filename size */
if (xauth_modified) {
- if (dieing) {
+ if (dying) {
if (verbose) {
/*
* called from a signal handler -- printf is *not* reentrant; also
@@ -1614,13 +1637,22 @@
hexkey = argv[3];
len = strlen(hexkey);
- if (hexkey[0] == '"' && hexkey[len-1] == '"') {
+ if (len > 1 && hexkey[0] == '"' && hexkey[len-1] == '"') {
key = malloc(len-1);
+ if (!key) {
+ fprintf(stderr, "unable to allocate memory\n");
+ return 1;
+ }
strncpy(key, hexkey+1, len-2);
+ key[len-1] = '\0';
len -= 2;
} else if (!strcmp(protoname, SECURERPC) ||
!strcmp(protoname, K5AUTH)) {
key = malloc(len+1);
+ if (!key) {
+ fprintf(stderr, "unable to allocate memory\n");
+ return 1;
+ }
strcpy(key, hexkey);
} else {
len = cvthexkey (hexkey, &key);
@@ -1859,10 +1891,10 @@
const char *displayname;
int major_version, minor_version;
XSecurityAuthorization id_return;
- Xauth *auth_in, *auth_return;
+ Xauth *auth_in = NULL, *auth_return = NULL;
XSecurityAuthorizationAttributes attributes;
unsigned long attrmask = 0;
- Display *dpy;
+ Display *dpy = NULL;
int status;
const char *args[4];
const char *protoname = ".";
@@ -1870,7 +1902,7 @@
int authdatalen = 0;
const char *hexdata;
char *authdata = NULL;
- char *hex;
+ char *hex = NULL;
if (argc < 2 || !argv[1]) {
prefix (inputfilename, lineno);
@@ -1889,7 +1921,8 @@
if (++i == argc) {
prefix (inputfilename, lineno);
badcommandline (argv[i-1]);
- return 1;
+ status = 1;
+ goto exit_generate;
}
attributes.timeout = atoi(argv[i]);
attrmask |= XSecurityTimeout;
@@ -1906,7 +1939,8 @@
if (++i == argc) {
prefix (inputfilename, lineno);
badcommandline (argv[i-1]);
- return 1;
+ status = 1;
+ goto exit_generate;
}
attributes.group = atoi(argv[i]);
attrmask |= XSecurityGroup;
@@ -1915,13 +1949,20 @@
if (++i == argc) {
prefix (inputfilename, lineno);
badcommandline (argv[i-1]);
- return 1;
+ status = 1;
+ goto exit_generate;
}
hexdata = argv[i];
authdatalen = strlen(hexdata);
if (hexdata[0] == '"' && hexdata[authdatalen-1] == '"') {
authdata = malloc(authdatalen-1);
+ if (!authdata) {
+ fprintf(stderr, "unable to allocate memory\n");
+ status = 1;
+ goto exit_generate;
+ }
strncpy(authdata, hexdata+1, authdatalen-2);
+ authdata[authdatalen-1] = '\0';
authdatalen -= 2;
} else {
authdatalen = cvthexkey (hexdata, &authdata);
@@ -1929,13 +1970,15 @@
prefix (inputfilename, lineno);
fprintf (stderr,
"data contains odd number of or non-hex characters\n");
- return 1;
+ status = 1;
+ goto exit_generate;
}
}
} else {
prefix (inputfilename, lineno);
badcommandline (argv[i]);
- return 1;
+ status = 1;
+ goto exit_generate;
}
}
@@ -1945,7 +1988,8 @@
if (!dpy) {
prefix (inputfilename, lineno);
fprintf (stderr, "unable to open display \"%s\".\n", displayname);
- return 1;
+ status = 1;
+ goto exit_generate;
}
status = XSecurityQueryExtension(dpy, &major_version, &minor_version);
@@ -1954,7 +1998,8 @@
prefix (inputfilename, lineno);
fprintf (stderr, "couldn't query Security extension on display \"%s\"\n",
displayname);
- return 1;
+ status = 1;
+ goto exit_generate;
}
/* fill in input Xauth struct */
@@ -1979,7 +2024,8 @@
{
prefix (inputfilename, lineno);
fprintf (stderr, "couldn't generate authorization\n");
- return 1;
+ status = 1;
+ goto exit_generate;
}
if (verbose)
@@ -1994,10 +2040,12 @@
status = do_add(inputfilename, lineno, 4, args);
- if (authdata) free(authdata);
+ exit_generate:
+ free(authdata);
XSecurityFreeXauth(auth_in);
XSecurityFreeXauth(auth_return);
free(hex);
- XCloseDisplay(dpy);
+ if (dpy != NULL)
+ XCloseDisplay(dpy);
return status;
}
diff -r a247352600be -r 2ec96af62e34 external/mit/xterm/dist/fontutils.c
--- a/external/mit/xterm/dist/fontutils.c Sun Jan 09 09:15:26 2022 +0000
+++ b/external/mit/xterm/dist/fontutils.c Sun Jan 09 09:17:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.c,v 1.705 2021/06/02 23:49:10 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.709 2021/11/10 00:36:27 Rajeev.V.Pillai Exp $ */
/*
* Copyright 1998-2020,2021 by Thomas E. Dickey
@@ -180,7 +180,7 @@
SetFontWidth(screen, win, width);
TRACE(("SetFontWidth %d\n", win->f_width));
#undef SetFontWidth
-#define SetFontWidth(screen, win, height) set_font_width(screen, win, height)
+#define SetFontWidth(screen, win, width) set_font_width(screen, win, width)
}
#endif
@@ -1282,11 +1282,15 @@
unsigned
xtermUpdateItalics(XtermWidget xw, unsigned new_attrs, unsigned old_attrs)
{
- if ((new_attrs & ATR_ITALIC) && !(old_attrs & ATR_ITALIC)) {
- xtermLoadItalics(xw);
- xtermUpdateFontGCs(xw, getItalicFont);
- } else if (!(new_attrs & ATR_ITALIC) && (old_attrs & ATR_ITALIC)) {
- xtermUpdateFontGCs(xw, getNormalFont);
+ TScreen *screen = TScreenOf(xw);
+
+ if (UseItalicFont(screen)) {
+ if ((new_attrs & ATR_ITALIC) && !(old_attrs & ATR_ITALIC)) {
+ xtermLoadItalics(xw);
+ xtermUpdateFontGCs(xw, getItalicFont);
+ } else if (!(new_attrs & ATR_ITALIC) && (old_attrs & ATR_ITALIC)) {
+ xtermUpdateFontGCs(xw, getNormalFont);
+ }
}
return new_attrs;
}
@@ -1449,6 +1453,15 @@
} else {
xtermCopyFontInfo(infoOut, infoRef);
}
+#define MinWidthOf(fs) fs->min_bounds.width
+#define MaxWidthOf(fs) fs->max_bounds.width
+ xw->work.force_wideFont = False;
+ if (MaxWidthOf(infoOut->fs) != (2 * MaxWidthOf(infoRef->fs))) {
+ TRACE(("...reference width %d\n", MaxWidthOf(infoRef->fs)));
+ TRACE(("...?? double-width %d\n", 2 * MaxWidthOf(infoRef->fs)));
+ TRACE(("...actual width %d\n", MaxWidthOf(infoOut->fs)));
+ xw->work.force_wideFont = True;
+ }
return status;
}
@@ -1842,7 +1855,7 @@
{
TScreen *screen = TScreenOf(xw);
Home |
Main Index |
Thread Index |
Old Index