Module Name: xsrc
Committed By: mrg
Date: Thu Jul 4 08:46:44 UTC 2024
Modified Files:
xsrc/external/mit/xauth/dist: process.c
xsrc/external/mit/xdm/dist/greeter: Login.c greet.c
xsrc/external/mit/xdm/dist/include: dm.h
xsrc/external/mit/xdm/dist/xdm: dm.c session.c
Log Message:
merge xauth 1.1.3, and xdm 1.1.16.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 xsrc/external/mit/xauth/dist/process.c
cvs rdiff -u -r1.8 -r1.9 xsrc/external/mit/xdm/dist/greeter/Login.c
cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/xdm/dist/greeter/greet.c
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xdm/dist/include/dm.h
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xdm/dist/xdm/dm.c
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xdm/dist/xdm/session.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/xauth/dist/process.c
diff -u xsrc/external/mit/xauth/dist/process.c:1.9 xsrc/external/mit/xauth/dist/process.c:1.10
--- xsrc/external/mit/xauth/dist/process.c:1.9 Mon Jul 11 09:13:31 2022
+++ xsrc/external/mit/xauth/dist/process.c Thu Jul 4 08:46:43 2024
@@ -268,7 +268,6 @@ static const char **
split_into_words(char *src, int *argcp) /* argvify string */
{
char *jword;
- char savec;
const char **argv;
int cur, total;
@@ -286,6 +285,8 @@ split_into_words(char *src, int *argcp)
*/
do {
+ char savec;
+
jword = skip_space (src);
src = skip_nonspace (jword);
savec = *src;
@@ -360,14 +361,14 @@ getinput(FILE *fp)
static int
get_short(FILE *fp, unsigned short *sp) /* for reading numeric input */
{
- int c;
- int i;
unsigned short us = 0;
/*
* read family: written with %04x
*/
- for (i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
+ int c;
+
switch (c = getinput (fp)) {
case EOF:
case '\n':
@@ -385,12 +386,13 @@ get_bytes(FILE *fp, unsigned int n, char
{
char *s;
register char *cp;
- int c1, c2;
cp = s = malloc (n);
if (!cp) return 0;
while (n > 0) {
+ int c1, c2;
+
if ((c1 = getinput (fp)) == EOF || c1 == '\n' ||
(c2 = getinput (fp)) == EOF || c2 == '\n') {
free (s);
@@ -411,7 +413,7 @@ read_numeric(FILE *fp)
{
Xauth *auth;
- auth = (Xauth *) malloc (sizeof (Xauth));
+ auth = malloc (sizeof (Xauth));
if (!auth) goto bad;
auth->family = 0;
auth->address = NULL;
@@ -467,7 +469,7 @@ read_auth_entries(FILE *fp, Bool numeric
n = 0;
/* put all records into linked list */
while ((auth = ((*readfunc) (fp))) != NULL) {
- AuthList *l = (AuthList *) malloc (sizeof (AuthList));
+ AuthList *l = malloc (sizeof (AuthList));
if (!l) {
fprintf (stderr,
"%s: unable to alloc entry reading auth file\n",
@@ -572,13 +574,11 @@ cvthexkey(const char *hexstr, char **ptr
int i;
int len = 0;
char *retval;
- const char *s;
unsigned char *us;
- char c;
char savec = '\0';
/* count */
- for (s = hexstr; *s; s++) {
+ for (const char *s = hexstr; *s; s++) {
if (!isascii(*s)) return -1;
if (isspace(*s)) continue;
if (!isxdigit(*s)) return -1;
@@ -599,7 +599,7 @@ cvthexkey(const char *hexstr, char **ptr
}
for (us = (unsigned char *) retval, i = len; i > 0; hexstr++) {
- c = *hexstr;
+ char c = *hexstr;
if (isspace(c)) continue; /* already know it is ascii */
if (isupper(c))
c = tolower(c);
@@ -626,13 +626,12 @@ dispatch_command(const char *inputfilena
CommandTable *tab,
int *statusp)
{
- CommandTable *ct;
const char *cmd;
int n;
/* scan table for command */
cmd = argv[0];
n = strlen (cmd);
- for (ct = tab; ct->name; ct++) {
+ for (CommandTable *ct = tab; ct->name; ct++) {
/* look for unique prefix */
if (n >= ct->minlen && n <= ct->maxlen &&
strncmp (cmd, ct->name, n) == 0) {
@@ -657,7 +656,7 @@ static volatile Bool dying = False;
/* poor man's puts(), for under signal handlers,
extended to ignore warn_unused_result */
-#define WRITES(fd, S) {if(write((fd), (S), strlen((S))));}
+#define WRITES(fd, S) {if(write((fd), (S), strlen((S)))){}}
/* ARGSUSED */
_X_NORETURN
@@ -712,7 +711,6 @@ int
auth_initialize(const char *authfilename)
{
int n;
- AuthList *head, *tail;
FILE *authfp;
Bool exists;
@@ -794,6 +792,8 @@ auth_initialize(const char *authfilename
"%s: file %s does not exist\n",
ProgramName, authfilename);
} else {
+ AuthList *head, *tail;
+
xauth_existed = True;
n = read_auth_entries (authfp, False, &head, &tail);
(void) fclose (authfp);
@@ -826,7 +826,6 @@ write_auth_file(char *tmp_nam)
{
FILE *fp = NULL;
int fd;
- AuthList *list;
/*
* xdm and auth spec assumes auth file is 12 or fewer characters
@@ -848,7 +847,7 @@ write_auth_file(char *tmp_nam)
* Write MIT-MAGIC-COOKIE-1 first, because R4 Xlib knows
* only that and uses the first authorization it finds.
*/
- for (list = xauth_head; list; list = list->next) {
+ for (AuthList *list = xauth_head; list; list = list->next) {
if (list->auth->name_length == 18
&& strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) == 0) {
if (!XauWriteAuth(fp, list->auth)) {
@@ -857,7 +856,7 @@ write_auth_file(char *tmp_nam)
}
}
}
- for (list = xauth_head; list; list = list->next) {
+ for (AuthList *list = xauth_head; list; list = list->next) {
if (list->auth->name_length != 18
|| strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) != 0) {
if (!XauWriteAuth(fp, list->auth)) {
@@ -877,8 +876,6 @@ write_auth_file(char *tmp_nam)
int
auth_finalize(void)
{
- char temp_name[1025]; /* large filename size */
-
if (xauth_modified) {
if (dying) {
if (verbose) {
@@ -902,6 +899,8 @@ auth_finalize(void)
"%s: %s not writable, changes ignored\n",
ProgramName, xauth_filename);
} else {
+ char temp_name[1025]; /* large filename size */
+
if (verbose) {
printf ("%s authority file %s\n",
ignore_locks ? "Ignoring locks and writing" :
@@ -957,7 +956,7 @@ bintohex(unsigned int len, const char *b
char *hexdata, *starthex;
/* two chars per byte, plus null termination */
- starthex = hexdata = (char *)malloc(2*len + 1);
+ starthex = hexdata = malloc((2 * len) + 1);
if (!hexdata)
return NULL;
@@ -1124,7 +1123,7 @@ match_auth_dpy(register Xauth *a, regist
static int
merge_entries(AuthList **firstp, AuthList *second, int *nnewp, int *nreplp)
{
- AuthList *a, *b, *first, *tail;
+ AuthList *first, *tail;
int n = 0, nnew = 0, nrepl = 0;
if (!second) return 0;
@@ -1149,10 +1148,10 @@ merge_entries(AuthList **firstp, AuthLis
* bump the tail up to include it, otherwise, cut the entry out of
* the chain.
*/
- for (b = second; b; ) {
+ for (AuthList *b = second; b; ) {
AuthList *next = b->next; /* in case we free it */
+ AuthList *a = first;
- a = first;
for (;;) {
if (eq_auth_dpy_and_name (a->auth, b->auth)) { /* found a duplicate */
AuthList tmp; /* swap it in for old one */
@@ -1192,11 +1191,10 @@ sort_entries(AuthList **firstp)
/* cathegory from the given list and inserts them into the sorted list. */
AuthList *sorted = NULL, *sorted_tail = NULL;
- AuthList *prev, *iter, *next;
#define SORT_OUT(EXPRESSION) { \
- prev = NULL; \
- for (iter = *firstp; iter; iter = next) { \
+ AuthList *prev = NULL, *next; \
+ for (AuthList *iter = *firstp; iter; iter = next) { \
next = iter->next; \
if (EXPRESSION) { \
if (prev) \
@@ -1229,7 +1227,7 @@ copyAuth(Xauth *auth)
{
Xauth *a;
- a = (Xauth *)malloc(sizeof(Xauth));
+ a = malloc(sizeof(Xauth));
if (a == NULL) {
return NULL;
}
@@ -1287,18 +1285,17 @@ iterdpy (const char *inputfilename, int
int argc, const char *argv[],
YesNoFunc yfunc, YesNoFunc nfunc, char *data)
{
- int i;
- int status;
int errors = 0;
- Xauth *tmp_auth;
- AuthList *proto_head, *proto;
- AuthList *l, *next;
/*
* iterate
*/
- for (i = start; i < argc; i++) {
+ for (int i = start; i < argc; i++) {
const char *displayname = argv[i];
+ AuthList *proto_head;
+ AuthList *next;
+ int status;
+
if (!get_displayname_auth (displayname, &proto_head)) {
prefix (inputfilename, lineno);
baddisplayname (displayname, argv[0]);
@@ -1306,13 +1303,14 @@ iterdpy (const char *inputfilename, int
continue;
}
status = 0;
- for (l = xauth_head; l; l = next) {
+ for (AuthList *l = xauth_head; l; l = next) {
Bool matched = False;
+ Xauth *tmp_auth;
/* l may be freed by remove_entry below. so save its contents */
next = l->next;
tmp_auth = copyAuth(l->auth);
- for (proto = proto_head; proto; proto = proto->next) {
+ for (AuthList *proto = proto_head; proto; proto = proto->next) {
if (match_auth_dpy (proto->auth, tmp_auth)) {
matched = True;
if (yfunc) {
@@ -1331,7 +1329,7 @@ iterdpy (const char *inputfilename, int
}
if (status < 0) break;
}
- for (proto = proto_head; proto ; proto = next) {
+ for (AuthList *proto = proto_head; proto ; proto = next) {
next = proto->next;
if (proto->auth->address) free (proto->auth->address);
if (proto->auth->number) free (proto->auth->number);
@@ -1381,19 +1379,18 @@ remove_entry(const char *inputfilename,
int
print_help(FILE *fp, const char *cmd, const char *line_prefix)
{
- CommandTable *ct;
int n = 0;
if (!line_prefix) line_prefix = "";
if (!cmd) { /* if no cmd, print all help */
- for (ct = command_table; ct->name; ct++) {
+ for (CommandTable *ct = command_table; ct->name; ct++) {
fprintf (fp, "%s%s\n", line_prefix, ct->helptext);
n++;
}
} else {
int len = strlen (cmd);
- for (ct = command_table; ct->name; ct++) {
+ for (CommandTable *ct = command_table; ct->name; ct++) {
if (strncmp (cmd, ct->name, len) == 0) {
fprintf (fp, "%s%s\n", line_prefix, ct->helptext);
n++;
@@ -1438,13 +1435,11 @@ do_help(const char *inputfilename, int l
static int
do_questionmark(const char *inputfilename, int lineno, int argc, const char **argv)
{
- CommandTable *ct;
- int i;
#define WIDEST_COLUMN 72
int col = WIDEST_COLUMN;
printf ("Commands:\n");
- for (ct = command_table; ct->name; ct++) {
+ for (CommandTable *ct = command_table; ct->name; ct++) {
if ((col + ct->maxlen) > WIDEST_COLUMN) {
if (ct != command_table) {
putc ('\n', stdout);
@@ -1454,7 +1449,7 @@ do_questionmark(const char *inputfilenam
}
fputs (ct->name, stdout);
col += ct->maxlen;
- for (i = ct->maxlen; i < COMMAND_NAMES_PADDED_WIDTH; i++) {
+ for (int i = ct->maxlen; i < COMMAND_NAMES_PADDED_WIDTH; i++) {
putc (' ', stdout);
col++;
}
@@ -1490,10 +1485,8 @@ do_list (const char *inputfilename, int
ld.numeric = (argv[0][0] == 'n');
if (argc == 1) {
- register AuthList *l;
-
if (xauth_head) {
- for (l = xauth_head; l; l = l->next) {
+ for (AuthList *l = xauth_head; l; l = l->next) {
dump_entry (inputfilename, lineno, l->auth, (char *) &ld);
}
}
@@ -1510,10 +1503,8 @@ do_list (const char *inputfilename, int
static int
do_merge(const char *inputfilename, int lineno, int argc, const char **argv)
{
- int i;
int errors = 0;
- AuthList *head, *tail, *listhead, *listtail;
- int nentries, nnew, nrepl;
+ AuthList *listhead, *listtail;
Bool numeric = False;
if (argc < 2) {
@@ -1525,10 +1516,12 @@ do_merge(const char *inputfilename, int
if (argv[0][0] == 'n') numeric = True;
listhead = listtail = NULL;
- for (i = 1; i < argc; i++) {
+ for (int i = 1; i < argc; i++) {
const char *filename = argv[i];
FILE *fp;
Bool used_stdin = False;
+ int nentries;
+ AuthList *head, *tail;
fp = open_file (&filename,
numeric ? "r" : "rb",
@@ -1557,6 +1550,8 @@ do_merge(const char *inputfilename, int
* if we have new entries, merge them in (freeing any duplicates)
*/
if (listhead) {
+ int nentries, nnew, nrepl;
+
nentries = merge_entries (&xauth_head, listhead, &nnew, &nrepl);
if (verbose)
printf ("%d entries read in: %d new, %d replacement%s\n",
@@ -1811,14 +1806,10 @@ static int
do_source(const char *inputfilename, int lineno, int argc, const char **argv)
{
const char *script;
- char buf[BUFSIZ];
FILE *fp;
Bool used_stdin = False;
- int len;
- int errors = 0, status;
+ int errors = 0;
int sublineno = 0;
- const char **subargv;
- int subargc;
Bool prompt = False; /* only true if reading from tty */
if (argc != 2 || !argv[1]) {
@@ -1837,6 +1828,11 @@ do_source(const char *inputfilename, int
if (verbose && used_stdin && isatty (fileno (fp))) prompt = True;
while (!alldone) {
+ char buf[BUFSIZ];
+ int len;
+ const char **subargv;
+ int subargc;
+
buf[0] = '\0';
if (prompt) {
printf ("xauth> ");
@@ -1855,9 +1851,9 @@ do_source(const char *inputfilename, int
buf[--len] = '\0'; /* remove new line */
subargv = (const char **) split_into_words (buf, &subargc);
if (subargv) {
- status = process_command (script, sublineno, subargc, subargv);
- free (subargv);
+ int status = process_command (script, sublineno, subargc, subargv);
errors += status;
+ free (subargv);
} else {
prefix (script, sublineno);
fprintf (stderr, "unable to break line into words\n");
@@ -1898,7 +1894,6 @@ do_generate(const char *inputfilename, i
int status;
const char *args[4];
const char *protoname = ".";
- int i;
int authdatalen = 0;
const char *hexdata;
char *authdata = NULL;
@@ -1916,7 +1911,7 @@ do_generate(const char *inputfilename, i
protoname = argv[2];
}
- for (i = 3; i < argc; i++) {
+ for (int i = 3; i < argc; i++) {
if (0 == strcmp(argv[i], "timeout")) {
if (++i == argc) {
prefix (inputfilename, lineno);
Index: xsrc/external/mit/xdm/dist/greeter/Login.c
diff -u xsrc/external/mit/xdm/dist/greeter/Login.c:1.8 xsrc/external/mit/xdm/dist/greeter/Login.c:1.9
--- xsrc/external/mit/xdm/dist/greeter/Login.c:1.8 Mon Jul 11 09:13:31 2022
+++ xsrc/external/mit/xdm/dist/greeter/Login.c Thu Jul 4 08:46:43 2024
@@ -26,7 +26,7 @@ from The Open Group.
*/
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -912,7 +912,7 @@ GetPrompt(Widget ctx, int promptNum)
_X_INTERNAL
int
-SetValue(Widget ctx, int promptNum, char *value)
+SetValue(Widget ctx, int promptNum, const char *value)
{
LoginWidget w = (LoginWidget) ctx;
Index: xsrc/external/mit/xdm/dist/greeter/greet.c
diff -u xsrc/external/mit/xdm/dist/greeter/greet.c:1.7 xsrc/external/mit/xdm/dist/greeter/greet.c:1.8
--- xsrc/external/mit/xdm/dist/greeter/greet.c:1.7 Tue Mar 5 08:34:27 2019
+++ xsrc/external/mit/xdm/dist/greeter/greet.c Thu Jul 4 08:46:43 2024
@@ -26,7 +26,7 @@ from The Open Group.
*/
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -121,9 +121,7 @@ struct group *(*__xdm_getgrent)(void)
void (*__xdm_endgrent)(void) = NULL;
# ifdef HAVE_GETSPNAM
struct spwd *(*__xdm_getspnam)(GETSPNAM_ARGS) = NULL;
-# ifndef QNX4
void (*__xdm_endspent)(void) = NULL;
-# endif /* QNX4 doesn't use endspent */
# endif
struct passwd *(*__xdm_getpwnam)(GETPWNAM_ARGS) = NULL;
# if defined(linux) || defined(__GLIBC__)
@@ -153,11 +151,16 @@ static XtAppContext context;
static XtIntervalId pingTimeout;
#ifdef USE_PAM
-static int pamconv(int num_msg,
-# ifndef sun
- const
-# endif
- struct pam_message **msg,
+
+#ifdef __sun
+/* Solaris does not const qualify arguments to pam_get_item() or the
+ PAM conversation function that Linux-PAM and others do. */
+# define XDM_PAM_QUAL /**/
+#else
+# define XDM_PAM_QUAL const
+#endif
+
+static int pamconv(int num_msg, XDM_PAM_QUAL struct pam_message **msg,
struct pam_response **response, void *appdata_ptr);
# define PAM_ERROR_PRINT(pamfunc, pamh) \
@@ -453,9 +456,7 @@ greet_user_rtn GreetUser(
__xdm_endgrent = dlfuncs->_endgrent;
# ifdef HAVE_GETSPNAM
__xdm_getspnam = dlfuncs->_getspnam;
-# ifndef QNX4
__xdm_endspent = dlfuncs->_endspent;
-# endif /* QNX4 doesn't use endspent */
# endif
__xdm_getpwnam = dlfuncs->_getpwnam;
# if defined(linux) || defined(__GLIBC__)
@@ -583,7 +584,8 @@ greet_user_rtn GreetUser(
char *username = NULL;
RUN_AND_CHECK_PAM_ERROR(pam_get_item,
- (*pamhp, PAM_USER, (void *) &username));
+ (*pamhp, PAM_USER,
+ (XDM_PAM_QUAL void **) &username));
if (username != NULL) {
Debug("PAM_USER: %s\n", username);
greet->name = username;
@@ -603,12 +605,12 @@ greet_user_rtn GreetUser(
break;
} else {
/* Try to fill in username for failed login error log */
- char *username = greet->name;
+ XDM_PAM_QUAL char *username = greet->name;
if (username == NULL) {
RUN_AND_CHECK_PAM_ERROR(pam_get_item,
(*pamhp, PAM_USER,
- (void *) &username));
+ (XDM_PAM_QUAL void **) &username));
}
FailedLogin (d, username);
RUN_AND_CHECK_PAM_ERROR(pam_end,
@@ -695,11 +697,7 @@ greet_user_rtn GreetUser(
#ifdef USE_PAM
-static int pamconv(int num_msg,
-# ifndef sun
- const
-# endif
- struct pam_message **msg,
+static int pamconv(int num_msg, XDM_PAM_QUAL struct pam_message **msg,
struct pam_response **response, void *appdata_ptr)
{
int i;
@@ -730,12 +728,12 @@ static int pamconv(int num_msg,
}
for (i = 0; i < num_msg; i++ , m++ , r++) {
- char *username;
+ XDM_PAM_QUAL char *username;
int promptId = 0;
loginPromptState pStyle = LOGIN_PROMPT_ECHO_OFF;
- if ((pam_get_item(*pamhp, PAM_USER, (void *) &username) == PAM_SUCCESS)
- && (username != NULL) && (*username != '\0')) {
+ if ((pam_get_item(*pamhp, PAM_USER, (XDM_PAM_QUAL void **) &username)
+ == PAM_SUCCESS) && (username != NULL) && (*username != '\0')) {
SetPrompt(login, LOGIN_PROMPT_USERNAME,
NULL, LOGIN_TEXT_INFO, False);
SetValue(login, LOGIN_PROMPT_USERNAME, username);
Index: xsrc/external/mit/xdm/dist/include/dm.h
diff -u xsrc/external/mit/xdm/dist/include/dm.h:1.2 xsrc/external/mit/xdm/dist/include/dm.h:1.3
--- xsrc/external/mit/xdm/dist/include/dm.h:1.2 Wed Mar 6 01:14:10 2019
+++ xsrc/external/mit/xdm/dist/include/dm.h Thu Jul 4 08:46:44 2024
@@ -69,9 +69,6 @@ from The Open Group.
# include <X11/Xdmcp.h>
# endif
-# ifdef pegasus
-# undef dirty /* Some bozo put a macro called dirty in sys/param.h */
-# endif /* pegasus */
# ifndef X_NOT_POSIX
# ifdef _POSIX_SOURCE
@@ -86,18 +83,11 @@ from The Open Group.
# define waitCore(w) 0 /* not in POSIX. so what? */
typedef int waitType;
# else /* X_NOT_POSIX */
-# ifdef SYSV
-# define waitCode(w) (((w) >> 8) & 0x7f)
-# define waitSig(w) ((w) & 0xff)
-# define waitCore(w) (((w) >> 15) & 0x01)
-typedef int waitType;
-# else /* SYSV */
# include <sys/wait.h>
# define waitCode(w) ((w).w_T.w_Retcode)
# define waitSig(w) ((w).w_T.w_Termsig)
# define waitCore(w) ((w).w_T.w_Coredump)
typedef union wait waitType;
-# endif
# endif /* X_NOT_POSIX */
# ifdef USE_PAM
@@ -498,10 +488,6 @@ extern void ProcessRequestSocket(int fd)
# include <stdlib.h>
# if defined(X_NOT_POSIX) || defined(__NetBSD__) && defined(__sparc__)
-# if defined(SYSV)
-# define SIGNALS_RESET_WHEN_CAUGHT
-# define UNRELIABLE_SIGNALS
-# endif
# define Setjmp(e) setjmp(e)
# define Longjmp(e,v) longjmp(e,v)
# define Jmp_buf jmp_buf
Index: xsrc/external/mit/xdm/dist/xdm/dm.c
diff -u xsrc/external/mit/xdm/dist/xdm/dm.c:1.5 xsrc/external/mit/xdm/dist/xdm/dm.c:1.6
--- xsrc/external/mit/xdm/dist/xdm/dm.c:1.5 Mon Jul 11 09:13:32 2022
+++ xsrc/external/mit/xdm/dist/xdm/dm.c Thu Jul 4 08:46:44 2024
@@ -83,10 +83,6 @@ from The Open Group.
# endif
#endif
-#if defined(SVR4) && !defined(sun)
-extern FILE *fdopen();
-#endif
-
static void StopAll (int n), RescanNotify (int n);
static void RescanServers (void);
static void RestartDisplay (struct display *d, int forceReserver);
@@ -106,9 +102,7 @@ static char *Title;
static int TitleLen;
#endif
-#ifndef UNRELIABLE_SIGNALS
static void ChildNotify (int n);
-#endif
static long StorePid (void);
static void RemovePid (void);
@@ -248,9 +242,7 @@ main (int argc, char **argv)
AddOtherEntropy();
#endif
(void) Signal (SIGHUP, RescanNotify);
-#ifndef UNRELIABLE_SIGNALS
(void) Signal (SIGCHLD, ChildNotify);
-#endif
Debug ("startup successful; entering main loop\n");
while (
#ifdef XDMCP
@@ -263,7 +255,7 @@ main (int argc, char **argv)
RescanServers ();
Rescan = 0;
}
-#if defined(UNRELIABLE_SIGNALS) || !defined(XDMCP)
+#ifndef XDMCP
WaitForChild ();
#else
WaitForSomething ();
@@ -283,9 +275,6 @@ RescanNotify (int n)
Debug ("Caught SIGHUP\n");
Rescan = 1;
-#ifdef SIGNALS_RESET_WHEN_CAUGHT
- (void) Signal (SIGHUP, RescanNotify);
-#endif
errno = olderrno;
}
@@ -447,11 +436,6 @@ StopAll (int n)
DestroyWellKnownSockets ();
#endif
ForEachDisplay (StopDisplay);
-#ifdef SIGNALS_RESET_WHEN_CAUGHT
- /* to avoid another one from killing us unceremoniously */
- (void) Signal (SIGTERM, StopAll);
- (void) Signal (SIGINT, StopAll);
-#endif
errno = olderrno;
}
@@ -462,7 +446,6 @@ StopAll (int n)
int ChildReady;
-#ifndef UNRELIABLE_SIGNALS
/* ARGSUSED */
static void
ChildNotify (int n)
@@ -472,7 +455,6 @@ ChildNotify (int n)
ChildReady = 1;
errno = olderrno;
}
-#endif
void
WaitForChild (void)
@@ -480,16 +462,12 @@ WaitForChild (void)
pid_t pid;
struct display *d;
waitType status;
-#if !defined(X_NOT_POSIX) && !defined(__UNIXOS2__)
+#if !defined(X_NOT_POSIX)
sigset_t mask, omask;
#else
int omask;
#endif
-#ifdef UNRELIABLE_SIGNALS
- /* XXX classic System V signal race condition here with RescanNotify */
- if ((pid = wait (&status)) != -1)
-#else
# ifndef X_NOT_POSIX
sigemptyset(&mask);
sigaddset(&mask, SIGCHLD);
@@ -513,7 +491,6 @@ WaitForChild (void)
sigsetmask (omask);
# endif
while ((pid = waitpid (-1, &status, WNOHANG)) > 0)
-#endif
{
Debug ("Manager wait returns pid: %d sig %d core %d code %d\n",
pid, waitSig(status), waitCore(status), waitCode(status));
Index: xsrc/external/mit/xdm/dist/xdm/session.c
diff -u xsrc/external/mit/xdm/dist/xdm/session.c:1.4 xsrc/external/mit/xdm/dist/xdm/session.c:1.5
--- xsrc/external/mit/xdm/dist/xdm/session.c:1.4 Sun Jan 8 09:19:54 2023
+++ xsrc/external/mit/xdm/dist/xdm/session.c Thu Jul 4 08:46:44 2024
@@ -132,14 +132,9 @@ extern void endgrent(void);
#endif
#ifdef HAVE_GETSPNAM
-# if defined(SVR4)
-# include <shadow.h>
-# else
-extern struct spwd *getspnam(GETSPNAM_ARGS);
-extern void endspent(void);
-# endif
+# include <shadow.h>
#endif
-#if defined(CSRG_BASED) || defined(__GLIBC__)
+#if defined(CSRG_BASED) || defined(__GLIBC__) || defined(__sun)
# include <pwd.h>
# include <unistd.h>
# if defined(__GLIBC__) && !defined(_XOPEN_CRYPT)
@@ -199,9 +194,7 @@ static struct dlfuncs dlfuncs = {
endgrent,
#ifdef HAVE_GETSPNAM
getspnam,
-# ifndef QNX4
endspent,
-# endif /* QNX4 doesn't use endspent */
#endif
getpwnam,
#if defined(linux) || defined(__GLIBC__)
@@ -254,7 +247,7 @@ waitAbort (int n)
Longjmp (tenaciousClient, 1);
}
-#if defined(_POSIX_SOURCE) || defined(SYSV) || defined(SVR4)
+#if defined(_POSIX_SOURCE) || defined(SVR4)
# define killpg(pgrp, sig) kill(-(pgrp), sig)
#endif
@@ -638,13 +631,11 @@ StartClient (
return (0);
}
# endif
-# ifndef QNX4
if (initgroups (name, verify->gid) < 0) {
LogError ("initgroups for \"%s\" failed: %s\n",
name, _SysErrorMsg (errno));
return (0);
}
-# endif /* QNX4 doesn't support multi-groups, no initgroups() */
#endif /* !HAVE_SETUSERCONTEXT */
#ifdef USE_PAM
@@ -908,8 +899,7 @@ execute (char **argv, char **environ)
Debug ("execve() of %s failed: %s\n", argv[0], _SysErrorMsg (errno));
/*
* In case this is a shell script which hasn't been
- * made executable (or this is a SYSV box), do
- * a reasonable thing
+ * made executable, do a reasonable thing.
*/
if (err != ENOENT) {
char program[1024], *e, *p, *optarg;