open-src/xserver/xorg/make_xkm_output_dir.patch
changeset 1088 1c99106ccbe0
parent 880 6dbe26dbba88
child 1124 7bc7e624f965
equal deleted inserted replaced
1087:a8aa060182e1 1088:1c99106ccbe0
    10 
    10 
    11 Updated to include changes to ensure xkb directory & files are writable
    11 Updated to include changes to ensure xkb directory & files are writable
    12 by gid 0, to fix bug:
    12 by gid 0, to fix bug:
    13 6916317 Changing xkb settings after login not working on snv130
    13 6916317 Changing xkb settings after login not working on snv130
    14 
    14 
    15 diff -urp -x '*~' -x '*.orig' xkb/Makefile.am xkb/Makefile.am
    15 diff -Nurp -x '*~' -x '*.orig' xkb/Makefile.am xkb/Makefile.am
    16 --- xkb/Makefile.am	2009-10-21 14:52:56.000000000 -0700
    16 --- xkb/Makefile.am	2010-06-05 18:17:03.000000000 -0700
    17 +++ xkb/Makefile.am	2009-11-03 22:28:52.978880918 -0800
    17 +++ xkb/Makefile.am	2010-09-03 16:44:59.203991086 -0700
    18 @@ -1,6 +1,7 @@
    18 @@ -1,6 +1,7 @@
    19  noinst_LTLIBRARIES = libxkb.la libxkbstubs.la
    19  noinst_LTLIBRARIES = libxkb.la libxkbstubs.la
    20  
    20  
    21  AM_CFLAGS = $(DIX_CFLAGS) \
    21  AM_CFLAGS = $(DIX_CFLAGS)
    22 +	-DMAKE_XKM_OUTPUT_DIR \
    22 +AM_CFLAGS += -DMAKE_XKM_OUTPUT_DIR
    23  	-DHAVE_XKB_CONFIG_H
       
    24  
    23  
    25  DDX_SRCS = \
    24  DDX_SRCS = \
    26 diff -urp -x '*~' -x '*.orig' xkb/ddxLoad.c xkb/ddxLoad.c
    25          ddxBeep.c \
    27 --- xkb/ddxLoad.c	2010-01-07 14:44:57.000000000 -0800
    26 diff -Nurp -x '*~' -x '*.orig' xkb/ddxLoad.c xkb/ddxLoad.c
    28 +++ xkb/ddxLoad.c	2010-01-12 14:52:06.919527180 -0800
    27 --- xkb/ddxLoad.c	2010-07-14 13:23:17.000000000 -0700
    29 @@ -152,6 +152,18 @@ Win32System(const char *cmdline)
    28 +++ xkb/ddxLoad.c	2010-09-03 16:44:59.204354950 -0700
       
    29 @@ -150,6 +150,18 @@ Win32System(const char *cmdline)
    30  #define System(x) Win32System(x)
    30  #define System(x) Win32System(x)
    31  #endif
    31  #endif
    32  
    32  
    33 +#ifdef MAKE_XKM_OUTPUT_DIR
    33 +#ifdef MAKE_XKM_OUTPUT_DIR
    34 +/* Borrow trans_mkdir from Xtransutil.c to more safely make directories */
    34 +/* Borrow trans_mkdir from Xtransutil.c to more safely make directories */
    43 +#endif
    43 +#endif
    44 +
    44 +
    45  static void
    45  static void
    46  OutputDirectory(
    46  OutputDirectory(
    47      char* outdir,
    47      char* outdir,
    48 @@ -159,7 +171,11 @@ OutputDirectory(
    48 @@ -157,7 +169,11 @@ OutputDirectory(
    49  {
    49  {
    50  #ifndef WIN32
    50  #ifndef WIN32
    51      /* Can we write an xkm and then open it too? */
    51      /* Can we write an xkm and then open it too? */
    52 -    if (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0 && (strlen(XKM_OUTPUT_DIR) < size))
    52 -    if (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0 && (strlen(XKM_OUTPUT_DIR) < size))
    53 +    if ( ( (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0)
    53 +    if ( ( (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0)
    56 +#endif
    56 +#endif
    57 +	     ) && (strlen(XKM_OUTPUT_DIR) < size))
    57 +	     ) && (strlen(XKM_OUTPUT_DIR) < size))
    58      {
    58      {
    59  	(void) strcpy (outdir, XKM_OUTPUT_DIR);
    59  	(void) strcpy (outdir, XKM_OUTPUT_DIR);
    60      } else
    60      } else
    61 @@ -201,6 +217,15 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		
    61 @@ -199,6 +215,15 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		
    62      const char *xkmfile = "-";
    62      const char *xkmfile = "-";
    63  #endif
    63  #endif
    64  
    64  
    65 +    /* save gid and reset to gid 0 before making xkm_output_dir or
    65 +    /* save gid and reset to gid 0 before making xkm_output_dir or
    66 +       running xkbcomp to create the xkm file in it. */
    66 +       running xkbcomp to create the xkm file in it. */
    72 +        Error("Error in setting egid to 0");
    72 +        Error("Error in setting egid to 0");
    73 +    
    73 +    
    74      snprintf(keymap, sizeof(keymap), "server-%s", display);
    74      snprintf(keymap, sizeof(keymap), "server-%s", display);
    75  
    75  
    76      OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
    76      OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
    77 @@ -245,7 +270,12 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		
    77 @@ -246,6 +271,11 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		
    78  #else
    78  #else
    79      out= fopen(tmpname, "w");
    79      out= fopen(tmpname, "w");
    80  #endif
    80  #endif
    81 +
    81 +
    82 +    if (setregid(usr_gid, 0) < 0)
    82 +    if (setregid(usr_gid, 0) < 0)
    84 +    if (setegid(usr_gid) < 0)
    84 +    if (setegid(usr_gid) < 0)
    85 +        Error("Error in resetting egid");
    85 +        Error("Error in resetting egid");
    86      
    86      
    87      if (out!=NULL) {
    87      if (out!=NULL) {
    88  #ifdef DEBUG
    88  #ifdef DEBUG
    89