Re: [xserver,1/4] os: move xf86PrivsElevated here

2018-03-10 Thread Antoine Martin
On 09/03/18 05:11, Ben Crocker wrote:
> Sent that a little too soon; please consider "Reviewed-by: Ben Crocker
> >" to be
> added after each of the "Signed-off-by: Nicolai Haehnle
> >" lines.
You can add:
Reviewed-by: Antoine Martin 

You should probably re-send the patch series as individual emails.

Cheers
Antoine


> 
> Also please note that I rebased Nicolai's original patch,
> https://patchwork.freedesktop.org/series/18684/,
> against a very recent copy of master.
> 
>   Thanks,
>   Ben
> 
> 
> On Thu, Mar 8, 2018 at 4:53 PM, Ben Crocker  > wrote:
> 
> From: Nicolai Hähnle >
> 
> From: Nicolai Hähnle  >
> 
> Having different types of code all trying to check for elevated
> privileges
> is a bad idea. This implementation is the most thorough one.
> 
> Signed-off-by: Nicolai Hähnle  >
> ---
>  hw/xfree86/common/xf86Init.c | 59
> +
>  include/os.h                 |  3 +++
>  os/utils.c                   | 63
> 
>  3 files changed, 67 insertions(+), 58 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
> index e61fe66..758b926 100644
> --- a/hw/xfree86/common/xf86Init.c
> +++ b/hw/xfree86/common/xf86Init.c
> @@ -230,78 +230,21 @@ xf86PrintBanner(void)
>      xf86ErrorFVerb(0, "Current version of pixman: %s\n",
>                     pixman_version_string());
>      xf86ErrorFVerb(0, "\tBefore reporting problems, check "
>                     "" __VENDORDWEBSUPPORT__ "\n"
>                     "\tto make sure that you have the latest
> version.\n");
>  }
> 
>  Bool
>  xf86PrivsElevated(void)
>  {
> -    static Bool privsTested = FALSE;
> -    static Bool privsElevated = TRUE;
> -
> -    if (!privsTested) {
> -#if defined(WIN32)
> -        privsElevated = FALSE;
> -#else
> -        if ((getuid() != geteuid()) || (getgid() != getegid())) {
> -            privsElevated = TRUE;
> -        }
> -        else {
> -#if defined(HAVE_ISSETUGID)
> -            privsElevated = issetugid();
> -#elif defined(HAVE_GETRESUID)
> -            uid_t ruid, euid, suid;
> -            gid_t rgid, egid, sgid;
> -
> -            if ((getresuid(, , ) == 0) &&
> -                (getresgid(, , ) == 0)) {
> -                privsElevated = (euid != suid) || (egid != sgid);
> -            }
> -            else {
> -                printf("Failed getresuid or getresgid");
> -                /* Something went wrong, make defensive assumption */
> -                privsElevated = TRUE;
> -            }
> -#else
> -            if (getuid() == 0) {
> -                /* running as root: uid==euid==0 */
> -                privsElevated = FALSE;
> -            }
> -            else {
> -                /*
> -                 * If there are saved ID's the process might still
> be privileged
> -                 * even though the above test succeeded. If
> issetugid() and
> -                 * getresgid() aren't available, test this by
> trying to set
> -                 * euid to 0.
> -                 */
> -                unsigned int oldeuid;
> -
> -                oldeuid = geteuid();
> -
> -                if (seteuid(0) != 0) {
> -                    privsElevated = FALSE;
> -                }
> -                else {
> -                    if (seteuid(oldeuid) != 0) {
> -                        FatalError("Failed to drop privileges. 
> Exiting\n");
> -                    }
> -                    privsElevated = TRUE;
> -                }
> -            }
> -#endif
> -        }
> -#endif
> -        privsTested = TRUE;
> -    }
> -    return privsElevated;
> +    return PrivsElevated();
>  }
> 
>  static void
>  TrapSignals(void)
>  {
>      if (xf86Info.notrapSignals) {
>          OsSignal(SIGSEGV, SIG_DFL);
>          OsSignal(SIGABRT, SIG_DFL);
>          OsSignal(SIGILL, SIG_DFL);
>  #ifdef SIGEMT
> diff --git a/include/os.h b/include/os.h
> index d2c41b4..686f6d6 100644
> --- a/include/os.h
> +++ b/include/os.h
> @@ -355,20 +355,23 @@ Fclose(void *);
>  extern const char *
>  Win32TempDir(void);
> 
>  extern int
>  System(const char *cmdline);
> 
>  #define Fopen(a,b) fopen(a,b)
>  #define Fclose(a) fclose(a)
>  #endif
> 
> 

[PATCH v3 app/xrandr] Document that --dpi and --fbmm options set DPI of whole X screen

2018-03-10 Thread Pali Rohár
Explicitly document and make it clear that those options do not change
DPI of some monitor output. Also state that these options have no useful
meaning for multi-monitor configuration.

Signed-off-by: Pali Rohár 
---
 man/xrandr.man | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/man/xrandr.man b/man/xrandr.man
index aa82724..1291bad 100644
--- a/man/xrandr.man
+++ b/man/xrandr.man
@@ -257,14 +257,25 @@ fit within this size. When this option is not provided, 
xrandr computes the
 smallest screen size that will hold the set of configured outputs; this
 option provides a way to override that behaviour.
 .IP "\-\-fbmm \fIwidth\fPx\fIheight\fP"
-Sets the reported values for the physical size of the screen. Normally,
+Sets the value reported as physical size of the X screen as a whole
+(union of all configured monitors). In configurations with multiple
+monitors with different DPIs, the value has no physical meaning, but
+it may be used by some legacy clients which do not support RandR
+version 1.2 to compute a reference font scaling. Normally,
 xrandr resets the reported physical size values to keep the DPI constant.
-This overrides that computation.
+This overrides that computation. Default DPI value is 96.
 .IP "\-\-dpi \fIdpi\fP"
 .IP "\-\-dpi \fIfrom-output\fP"
-This also sets the reported physical size values of the screen, it uses either
+This also sets the value reported as physical size of the X screen as a whole
+(union of all configured monitors). In configurations with multiple
+monitors with different DPIs, the value has no physical meaning, but
+it may be used by some legacy clients which do not support RandR
+version 1.2 to compute a reference font scaling. This option uses either
 the specified DPI value, or the DPI of the given output, to compute an 
appropriate
-physical size using whatever pixel size will be set.
+physical size using whatever pixel size will be set. Typical values are
+the default (96 DPI), the DPI of the only monitor in single-monitor
+configurations, or the DPI of the primary monitor in multi-monitor
+configurations.
 .IP "\-\-newmode \fIname\fP \fImode\fP"
 New modelines can be added to the server and then associated with outputs.
 This option does the former. The \fImode\fP is specified using the ModeLine
-- 
2.11.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Missing swapl() in Xext/saver.c?

2018-03-10 Thread Mihai Moldovan
Hi


In
https://cgit.freedesktop.org/xorg/xserver/commit/?id=9edcae78c46286baff42e74bfe26f6ae4d00fe01
the swapl() call for stuff->suspend was removed. That sounds like a bad idea to 
me?

xScreenSaverSuspendReq to this day defines it as a Bool, which is typedef'd to
int everywhere and includes the (ignored) B32 width specifier, so using swapl()
on the member sounds like a good idea. Definitely isn't a CARD8 object, despite
its name.



Mihai



signature.asc
Description: OpenPGP digital signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel