mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-24 00:45:52 +00:00
This port has not been needed in a long time
2012-03-28 x11/wrapper: not needed anymore
This commit is contained in:
parent
63e9c9dd5b
commit
e874469d2a
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=294468
1
MOVED
1
MOVED
@ -3270,3 +3270,4 @@ converters/ruby-lv||2012-04-09|Has expired: upstream no longer has this
|
||||
devel/p5-Getopt-Popt||2012-04-09|Has expired: "Gone from CPAN"
|
||||
net/p5-Net-Rendezvous||2012-04-09|Has expired: Superceeded by dns/p5-Net-Bonjour
|
||||
audio/gstreamer-plugins-musicbrainz||2012-04-09|Has expired: MusicBrainz RDF webservice no longer functions
|
||||
x11/wrapper||2012-04-10|Has expired: not needed anymore
|
||||
|
@ -298,7 +298,6 @@
|
||||
SUBDIR += wmmatrix
|
||||
SUBDIR += wmxss
|
||||
SUBDIR += workrave
|
||||
SUBDIR += wrapper
|
||||
SUBDIR += wterm
|
||||
SUBDIR += x11perf
|
||||
SUBDIR += x3270
|
||||
|
@ -1,40 +0,0 @@
|
||||
# New ports collection makefile for: Xwrapper
|
||||
# Date created: 2000-09-18
|
||||
# Whom: Trevor Johnson <trevor@FreeBSD.org>
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= wrapper
|
||||
PORTVERSION= 1.0
|
||||
PORTREVISION= 10
|
||||
CATEGORIES= x11
|
||||
DISTNAME= # intentionally left blank
|
||||
EXTRACT_SUFX= # intentionally left blank
|
||||
|
||||
MAINTAINER= x11@FreeBSD.org
|
||||
COMMENT= Wrapper for X.Org X11 server
|
||||
|
||||
RUN_DEPENDS= Xorg:${PORTSDIR}/x11-servers/xorg-server
|
||||
|
||||
NO_WRKSUBDIR= yes
|
||||
USE_XORG= x11
|
||||
PLIST_FILES= bin/Xwrapper
|
||||
|
||||
XSERVER= -DXSERVER_PATH=\"${LOCALBASE}/bin/Xorg\"
|
||||
PKGNAMEPREFIX= xorg-
|
||||
|
||||
DEPRECATED= not needed anymore
|
||||
EXPIRATION_DATE= 2012-03-28
|
||||
|
||||
do-fetch:
|
||||
@${DO_NADA}
|
||||
|
||||
do-build:
|
||||
${CC} ${CFLAGS} ${XSERVER} -o ${WRKSRC}/Xwrapper ${FILESDIR}/wrapper.c
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/Xwrapper ${PREFIX}/bin
|
||||
@PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
|
||||
|
||||
.include <bsd.port.mk>
|
@ -1,304 +0,0 @@
|
||||
/*
|
||||
* X server wrapper.
|
||||
*
|
||||
* This wrapper makes some sanity checks on the command line arguments
|
||||
* and environment variables when run with euid == 0 && euid != uid.
|
||||
* If the checks fail, the wrapper exits with a message.
|
||||
* If they succeed, it exec's the Xserver.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 by The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
* 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 XFREE86 PROJECT 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of the XFree86 Project
|
||||
* shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written
|
||||
* authorization from the XFree86 Project.
|
||||
*/
|
||||
|
||||
/* $XFree86: xc/programs/Xserver/os/wrapper.c,v 1.1.2.9 1999/07/29 09:23:02 hohndel Exp $ */
|
||||
|
||||
/* This is normally set in the Imakefile */
|
||||
#ifndef XSERVER_PATH
|
||||
#define XSERVER_PATH "/usr/X11R6/bin/XFree86"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef USE_PAM
|
||||
#include <security/pam_appl.h>
|
||||
#include <security/pam_misc.h>
|
||||
#include <pwd.h>
|
||||
#endif /* USE_PAM */
|
||||
|
||||
/* Neither of these should be required for XFree86 3.3.2 */
|
||||
#ifndef REJECT_CONFIG
|
||||
#define REJECT_CONFIG 0
|
||||
#endif
|
||||
#ifndef REJECT_XKBDIR
|
||||
#define REJECT_XKBDIR 0
|
||||
#endif
|
||||
|
||||
/* Consider LD* variables insecure ? */
|
||||
#ifndef REMOVE_ENV_LD
|
||||
#define REMOVE_ENV_LD 1
|
||||
#endif
|
||||
|
||||
/* Remove long environment variables? */
|
||||
#ifndef REMOVE_LONG_ENV
|
||||
#define REMOVE_LONG_ENV 1
|
||||
#endif
|
||||
|
||||
/* Check args and env only if running setuid (euid == 0 && euid != uid) ? */
|
||||
#ifndef CHECK_EUID
|
||||
#define CHECK_EUID 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Maybe the locale can be faked to make isprint(3) report that everything
|
||||
* is printable? Avoid it by default.
|
||||
*/
|
||||
#ifndef USE_ISPRINT
|
||||
#define USE_ISPRINT 0
|
||||
#endif
|
||||
|
||||
#define MAX_ARG_LENGTH 128
|
||||
#define MAX_ENV_LENGTH 256
|
||||
#define MAX_ENV_PATH_LENGTH 2048
|
||||
|
||||
#if USE_ISPRINT
|
||||
#include <ctype.h>
|
||||
#define checkPrintable(c) isprint(c)
|
||||
#else
|
||||
#define checkPrintable(c) (((c) & 0x7f) >= 0x20 && ((c) & 0x7f) != 0x7f)
|
||||
#endif
|
||||
|
||||
enum BadCode {
|
||||
NotBad = 0,
|
||||
UnsafeArg,
|
||||
ArgTooLong,
|
||||
UnprintableArg,
|
||||
EnvTooLong,
|
||||
InternalError
|
||||
#ifdef USE_PAM
|
||||
,PamFailed,
|
||||
PamAuthFailed
|
||||
#endif /* USE_PAM */
|
||||
};
|
||||
|
||||
#define ARGMSG \
|
||||
"\nIf the arguments used are valid, and have been rejected incorrectly\n" \
|
||||
"please send details of the arguments and why they are valid to\n" \
|
||||
"XFree86@XFree86.org. In the meantime, you can start the Xserver as\n" \
|
||||
"the \"super user\" (root).\n"
|
||||
|
||||
#define ENVMSG \
|
||||
"\nIf the environment is valid, and have been rejected incorrectly\n" \
|
||||
"please send details of the environment and why it is valid to\n" \
|
||||
"XFree86@XFree86.org. In the meantime, you can start the Xserver as\n" \
|
||||
"the \"super user\" (root).\n"
|
||||
|
||||
#ifdef USE_PAM
|
||||
static struct pam_conv conv = {
|
||||
misc_conv,
|
||||
NULL
|
||||
};
|
||||
#endif /* USE_PAM */
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv, char **envp)
|
||||
{
|
||||
enum BadCode bad = NotBad;
|
||||
int i, j;
|
||||
char *a, *e;
|
||||
#ifdef USE_PAM
|
||||
pam_handle_t *pamh = NULL;
|
||||
struct passwd *pw;
|
||||
int retval;
|
||||
|
||||
pw = getpwuid(getuid());
|
||||
if (pw == NULL) {
|
||||
bad = InternalError;
|
||||
}
|
||||
|
||||
if (!bad) {
|
||||
retval = pam_start("xserver", pw->pw_name, &conv, &pamh);
|
||||
if (retval != PAM_SUCCESS)
|
||||
bad = PamFailed;
|
||||
}
|
||||
|
||||
if (!bad) {
|
||||
retval = pam_authenticate(pamh, 0);
|
||||
if (retval != PAM_SUCCESS) {
|
||||
pam_end(pamh, retval);
|
||||
bad = PamAuthFailed;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bad) {
|
||||
retval = pam_acct_mgmt(pamh, 0);
|
||||
if (retval != PAM_SUCCESS) {
|
||||
pam_end(pamh, retval);
|
||||
bad = PamAuthFailed;
|
||||
}
|
||||
}
|
||||
|
||||
/* this is not a session, so do not do session management */
|
||||
|
||||
if (!bad) pam_end(pamh, PAM_SUCCESS);
|
||||
#endif /* USE_PAM */
|
||||
|
||||
#if CHECK_EUID
|
||||
if (!bad && geteuid() == 0 && getuid() != geteuid()) {
|
||||
#else
|
||||
if (!bad) {
|
||||
#endif
|
||||
/* Check each argv[] */
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
||||
/* Check for known bad arguments */
|
||||
#if REJECT_CONFIG
|
||||
if (strcmp(argv[i], "-config") == 0) {
|
||||
bad = UnsafeArg;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if REJECT_XKBDIR
|
||||
if (strcmp(argv[i], "-xkbdir") == 0) {
|
||||
bad = UnsafeArg;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (strlen(argv[i]) > MAX_ARG_LENGTH) {
|
||||
bad = ArgTooLong;
|
||||
break;
|
||||
}
|
||||
a = argv[i];
|
||||
while (*a) {
|
||||
if (checkPrintable(*a) == 0) {
|
||||
bad = UnprintableArg;
|
||||
break;
|
||||
}
|
||||
a++;
|
||||
}
|
||||
if (bad)
|
||||
break;
|
||||
}
|
||||
/* Check each envp[] */
|
||||
if (!bad)
|
||||
for (i = 0; envp[i]; i++) {
|
||||
|
||||
/* Check for bad environment variables and values */
|
||||
#if REMOVE_ENV_LD
|
||||
while (envp[i] && (strncmp(envp[i], "LD", 2) == 0)) {
|
||||
for (j = i; envp[j]; j++) {
|
||||
envp[j] = envp[j+1];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (envp[i] && (strlen(envp[i]) > MAX_ENV_LENGTH)) {
|
||||
#if REMOVE_LONG_ENV
|
||||
for (j = i; envp[j]; j++) {
|
||||
envp[j] = envp[j+1];
|
||||
}
|
||||
i--;
|
||||
#else
|
||||
char *eq;
|
||||
int len;
|
||||
|
||||
eq = strchr(envp[i], '=');
|
||||
if (!eq)
|
||||
continue;
|
||||
len = eq - envp[i];
|
||||
e = malloc(len + 1);
|
||||
if (!e) {
|
||||
bad = InternalError;
|
||||
break;
|
||||
}
|
||||
strncpy(e, envp[i], len);
|
||||
e[len] = 0;
|
||||
if (len >= 4 &&
|
||||
(strcmp(e + len - 4, "PATH") == 0 ||
|
||||
strcmp(e, "TERMCAP") == 0)) {
|
||||
if (strlen(envp[i]) > MAX_ENV_PATH_LENGTH) {
|
||||
bad = EnvTooLong;
|
||||
break;
|
||||
} else {
|
||||
free(e);
|
||||
}
|
||||
} else {
|
||||
bad = EnvTooLong;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (bad) {
|
||||
case NotBad:
|
||||
argv[0] = XSERVER_PATH;
|
||||
execve(XSERVER_PATH, argv, envp);
|
||||
fprintf(stderr, "execve failed for %s (errno %d)\n", XSERVER_PATH,
|
||||
errno);
|
||||
break;
|
||||
case UnsafeArg:
|
||||
fprintf(stderr, "Command line argument number %d is unsafe\n", i);
|
||||
fprintf(stderr, ARGMSG);
|
||||
break;
|
||||
case ArgTooLong:
|
||||
fprintf(stderr, "Command line argument number %d is too long\n", i);
|
||||
fprintf(stderr, ARGMSG);
|
||||
break;
|
||||
case UnprintableArg:
|
||||
fprintf(stderr, "Command line argument number %d contains unprintable"
|
||||
" characters\n", i);
|
||||
fprintf(stderr, ARGMSG);
|
||||
break;
|
||||
case EnvTooLong:
|
||||
fprintf(stderr, "Environment variable `%s' is too long\n", e);
|
||||
fprintf(stderr, ENVMSG);
|
||||
break;
|
||||
case InternalError:
|
||||
fprintf(stderr, "Internal Error\n");
|
||||
break;
|
||||
#ifdef USE_PAM
|
||||
case PamFailed:
|
||||
fprintf(stderr, "Authentication System Failure, "
|
||||
"missing or mangled PAM configuration file or module?\n");
|
||||
break;
|
||||
case PamAuthFailed:
|
||||
fprintf(stderr, "Authentication failed - cannot start X server.\nPerhaps you do not have console ownership?");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
fprintf(stderr, "Unknown error\n");
|
||||
fprintf(stderr, ARGMSG);
|
||||
fprintf(stderr, ENVMSG);
|
||||
break;
|
||||
}
|
||||
exit(1);
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
if [ -e ${PKG_PREFIX}/bin/X.bck ]; then
|
||||
mv ${PKG_PREFIX}/bin/X.bck ${PKG_PREFIX}/bin/X
|
||||
else
|
||||
if [ -x ${PKG_PREFIX}/bin/XFree86 ]; then
|
||||
ln -sf ${PKG_PREFIX}/bin/XFree86 ${PKG_PREFIX}/bin/X
|
||||
exit 0
|
||||
elif [ -x ${PKG_PREFIX}/bin/Xorg ]; then
|
||||
ln -sf ${PKG_PREFIX}/bin/Xorg ${PKG_PREFIX}/bin/X
|
||||
exit 0
|
||||
else
|
||||
rm -f ${PKG_PREFIX}/bin/X
|
||||
fi
|
||||
fi
|
||||
[ -x ${PKG_PREFIX}/bin/XFree86 ] && chmod u+s ${PKG_PREFIX}/bin/XFree86
|
||||
[ -x ${PKG_PREFIX}/bin/Xorg ] && chmod u+s ${PKG_PREFIX}/bin/Xorg
|
@ -1,7 +0,0 @@
|
||||
This program runs an X server after sanity-checking the environment
|
||||
and any options passed to it. It is meant to enhance security on
|
||||
multi-user systems running XFree86 4 or the X11 server from x.org,
|
||||
where the ability to use a startx script is needed. If you have
|
||||
XFree86 3, do not install this: you do not need it and it will not
|
||||
work. If you have no untrusted users or always run the X server
|
||||
from xdm, you do not need this.
|
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "X$2" != "XPOST-INSTALL" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
[ -e ${PKG_PREFIX}/bin/X ] && mv ${PKG_PREFIX}/bin/X ${PKG_PREFIX}/bin/X.bck
|
||||
ln -sf ${PKG_PREFIX}/bin/Xwrapper ${PKG_PREFIX}/bin/X
|
||||
[ -x ${PKG_PREFIX}/bin/XFree86 ] && chmod -s ${PKG_PREFIX}/bin/XFree86
|
||||
[ -x ${PKG_PREFIX}/bin/Xorg ] && chmod -s ${PKG_PREFIX}/bin/Xorg
|
||||
chmod u+s ${PKG_PREFIX}/bin/Xwrapper
|
Loading…
Reference in New Issue
Block a user