OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.7 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../libcap/0001-upstream-fixes.patch
  5. # Copyright (C) 2013 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. Fixes found in the upstream repository
  17. https://git.kernel.org/cgit/linux/kernel/git/morgan/libcap.git/
  18. From 616a03da55bbaefce4055d4e47a81cd85f3161e2 Mon Sep 17 00:00:00 2001
  19. From: Andrew G. Morgan <morgan@kernel.org>
  20. Date: Sun, 31 Jul 2011 00:39:27 +0000
  21. Subject: Fix a compiler warning(error) for format mismatch.
  22. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
  23. ---
  24. diff --git a/progs/capsh.c b/progs/capsh.c
  25. index 52336d7..3ceadcd 100644
  26. --- a/progs/capsh.c
  27. +++ b/progs/capsh.c
  28. @@ -520,7 +520,8 @@ int main(int argc, char *argv[], char *envp[])
  29. if (set >= 0) {
  30. const char *b;
  31. b = binary(set); /* use verilog convention for binary string */
  32. - printf("Securebits: 0%o/0x%x/%u'b%s\n", set, set, strlen(b), b);
  33. + printf("Securebits: 0%o/0x%x/%u'b%s\n", set, set,
  34. + (unsigned) strlen(b), b);
  35. printf(" secure-noroot: %s (%s)\n",
  36. (set & 1) ? "yes":"no",
  37. (set & 2) ? "locked":"unlocked");
  38. --
  39. cgit v0.9.2
  40. From 056ffb0bd25d91ffbcb83c521fc4d3d9904ec4d4 Mon Sep 17 00:00:00 2001
  41. From: Andrew G. Morgan <morgan@kernel.org>
  42. Date: Sun, 31 Jul 2011 01:22:21 +0000
  43. Subject: setcap: comment to help the user figure out why setcap is failing.
  44. The file capabilities are not as expressive as process capabilities
  45. (for a reason - see the NOTES section of 'man 3 cap_set_file').
  46. The effective bits on a file under linux are captured by a single
  47. boolean. As such attempting to partially set effective bits via the
  48. more fully expressive process capability representation (cap_from_text)
  49. sometimes yields an error. From now on, suggest that when the user
  50. attempts to do this and an error occurs, the error might be such a
  51. mismatch between effective and the other capability bits.
  52. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
  53. ---
  54. diff --git a/progs/setcap.c b/progs/setcap.c
  55. index 0215fc4..83090ae 100644
  56. --- a/progs/setcap.c
  57. +++ b/progs/setcap.c
  58. @@ -26,7 +26,7 @@ static void usage(void)
  59. static int read_caps(int quiet, const char *filename, char *buffer)
  60. {
  61. - int i=MAXCAP;
  62. + int i = MAXCAP;
  63. if (!quiet) {
  64. fprintf(stderr, "Please enter caps for file [empty line to end]:\n");
  65. @@ -170,10 +170,33 @@ int main(int argc, char **argv)
  66. }
  67. retval = cap_set_file(*++argv, cap_d);
  68. if (retval != 0) {
  69. + int explained = 0;
  70. +#ifdef linux
  71. + cap_value_t cap;
  72. + cap_flag_value_t per_state;
  73. +
  74. + for (cap = 0;
  75. + cap_get_flag(cap_d, cap, CAP_PERMITTED, &per_state) != -1;
  76. + cap++) {
  77. + cap_flag_value_t inh_state, eff_state;
  78. +
  79. + cap_get_flag(cap_d, cap, CAP_INHERITABLE, &inh_state);
  80. + cap_get_flag(cap_d, cap, CAP_EFFECTIVE, &eff_state);
  81. + if ((inh_state | per_state) != eff_state) {
  82. + fprintf(stderr, "NOTE: Under Linux, effective file capabilities must either be empty, or\n"
  83. + " exactly match the union of selected permitted and inheritable bits.\n");
  84. + explained = 1;
  85. + break;
  86. + }
  87. + }
  88. +#endif /* def linux */
  89. +
  90. fprintf(stderr,
  91. "Failed to set capabilities on file `%s' (%s)\n",
  92. argv[0], strerror(errno));
  93. - usage();
  94. + if (!explained) {
  95. + usage();
  96. + }
  97. }
  98. }
  99. if (cap_d) {
  100. --
  101. cgit v0.9.2