summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0001-Handle-missing-gshadow.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0001-Handle-missing-gshadow.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0001-Handle-missing-gshadow.patch73
1 files changed, 35 insertions, 38 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0001-Handle-missing-gshadow.patch
index 26a597d45b..723cd2e52e 100644
--- a/meta/recipes-core/systemd/systemd/0001-Handle-missing-gshadow.patch
+++ b/meta/recipes-core/systemd/systemd/0001-Handle-missing-gshadow.patch
@@ -14,10 +14,10 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
14 src/shared/userdb.c | 6 ++++++ 14 src/shared/userdb.c | 6 ++++++
15 3 files changed, 30 insertions(+) 15 3 files changed, 30 insertions(+)
16 16
17diff --git a/src/shared/group-record-nss.c b/src/shared/group-record-nss.c 17Index: systemd-stable/src/shared/group-record-nss.c
18index 77924f1c4067..c64490253ff3 100644 18===================================================================
19--- a/src/shared/group-record-nss.c 19--- systemd-stable.orig/src/shared/group-record-nss.c
20+++ b/src/shared/group-record-nss.c 20+++ systemd-stable/src/shared/group-record-nss.c
21@@ -19,8 +19,10 @@ int nss_group_to_group_record( 21@@ -19,8 +19,10 @@ int nss_group_to_group_record(
22 if (isempty(grp->gr_name)) 22 if (isempty(grp->gr_name))
23 return -EINVAL; 23 return -EINVAL;
@@ -45,7 +45,7 @@ index 77924f1c4067..c64490253ff3 100644
45 45
46 r = json_build(&g->json, JSON_BUILD_OBJECT( 46 r = json_build(&g->json, JSON_BUILD_OBJECT(
47 JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)), 47 JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
48@@ -76,6 +80,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re 48@@ -76,6 +80,7 @@ int nss_sgrp_for_group(const struct grou
49 assert(ret_sgrp); 49 assert(ret_sgrp);
50 assert(ret_buffer); 50 assert(ret_buffer);
51 51
@@ -53,7 +53,7 @@ index 77924f1c4067..c64490253ff3 100644
53 for (;;) { 53 for (;;) {
54 _cleanup_free_ char *buf = NULL; 54 _cleanup_free_ char *buf = NULL;
55 struct sgrp sgrp, *result; 55 struct sgrp sgrp, *result;
56@@ -104,6 +109,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re 56@@ -104,6 +109,9 @@ int nss_sgrp_for_group(const struct grou
57 buflen *= 2; 57 buflen *= 2;
58 buf = mfree(buf); 58 buf = mfree(buf);
59 } 59 }
@@ -62,67 +62,67 @@ index 77924f1c4067..c64490253ff3 100644
62+#endif 62+#endif
63 } 63 }
64 64
65 int nss_group_record_by_name(const char *name, GroupRecord **ret) { 65 int nss_group_record_by_name(
66@@ -111,7 +119,9 @@ int nss_group_record_by_name(const char *name, GroupRecord **ret) { 66@@ -115,7 +123,9 @@ int nss_group_record_by_name(
67 struct group grp, *result; 67 struct group grp, *result;
68 bool incomplete = false; 68 bool incomplete = false;
69 size_t buflen = 4096; 69 size_t buflen = 4096;
70+#if ENABLE_GSHADOW 70+#if ENABLE_GSHADOW
71 struct sgrp sgrp; 71 struct sgrp sgrp, *sresult = NULL;
72+#endif 72+#endif
73 int r; 73 int r;
74 74
75 assert(name); 75 assert(name);
76@@ -141,6 +151,7 @@ int nss_group_record_by_name(const char *name, GroupRecord **ret) { 76@@ -145,6 +155,7 @@ int nss_group_record_by_name(
77 buf = mfree(buf); 77 buf = mfree(buf);
78 } 78 }
79 79
80+#if ENABLE_GSHADOW 80+#if ENABLE_GSHADOW
81 r = nss_sgrp_for_group(result, &sgrp, &sbuf); 81 if (with_shadow) {
82 if (r < 0) { 82 r = nss_sgrp_for_group(result, &sgrp, &sbuf);
83 log_debug_errno(r, "Failed to do shadow lookup for group %s, ignoring: %m", result->gr_name); 83 if (r < 0) {
84@@ -148,6 +159,9 @@ int nss_group_record_by_name(const char *name, GroupRecord **ret) { 84@@ -156,6 +167,9 @@ int nss_group_record_by_name(
85 } 85 incomplete = true;
86 86
87 r = nss_group_to_group_record(result, r >= 0 ? &sgrp : NULL, ret); 87 r = nss_group_to_group_record(result, sresult, ret);
88+#else 88+#else
89+ r = nss_group_to_group_record(result, NULL, ret); 89+ r = nss_group_to_group_record(result, NULL, ret);
90+#endif 90+#endif
91 if (r < 0) 91 if (r < 0)
92 return r; 92 return r;
93 93
94@@ -160,7 +174,9 @@ int nss_group_record_by_gid(gid_t gid, GroupRecord **ret) { 94@@ -172,7 +186,9 @@ int nss_group_record_by_gid(
95 struct group grp, *result; 95 struct group grp, *result;
96 bool incomplete = false; 96 bool incomplete = false;
97 size_t buflen = 4096; 97 size_t buflen = 4096;
98+#if ENABLE_GSHADOW 98+#if ENABLE_GSHADOW
99 struct sgrp sgrp; 99 struct sgrp sgrp, *sresult = NULL;
100+#endif 100+#endif
101 int r; 101 int r;
102 102
103 assert(ret); 103 assert(ret);
104@@ -188,6 +204,7 @@ int nss_group_record_by_gid(gid_t gid, GroupRecord **ret) { 104@@ -200,6 +216,7 @@ int nss_group_record_by_gid(
105 buf = mfree(buf); 105 buf = mfree(buf);
106 } 106 }
107 107
108+#if ENABLE_GSHADOW 108+#if ENABLE_GSHADOW
109 r = nss_sgrp_for_group(result, &sgrp, &sbuf); 109 if (with_shadow) {
110 if (r < 0) { 110 r = nss_sgrp_for_group(result, &sgrp, &sbuf);
111 log_debug_errno(r, "Failed to do shadow lookup for group %s, ignoring: %m", result->gr_name); 111 if (r < 0) {
112@@ -195,6 +212,9 @@ int nss_group_record_by_gid(gid_t gid, GroupRecord **ret) { 112@@ -211,6 +228,9 @@ int nss_group_record_by_gid(
113 } 113 incomplete = true;
114 114
115 r = nss_group_to_group_record(result, r >= 0 ? &sgrp : NULL, ret); 115 r = nss_group_to_group_record(result, sresult, ret);
116+#else 116+#else
117+ r = nss_group_to_group_record(result, NULL, ret); 117+ r = nss_group_to_group_record(result, NULL, ret);
118+#endif 118+#endif
119 if (r < 0) 119 if (r < 0)
120 return r; 120 return r;
121 121
122diff --git a/src/shared/group-record-nss.h b/src/shared/group-record-nss.h 122Index: systemd-stable/src/shared/group-record-nss.h
123index 38b2995178ff..d7d95c44cf11 100644 123===================================================================
124--- a/src/shared/group-record-nss.h 124--- systemd-stable.orig/src/shared/group-record-nss.h
125+++ b/src/shared/group-record-nss.h 125+++ systemd-stable/src/shared/group-record-nss.h
126@@ -2,7 +2,11 @@ 126@@ -2,7 +2,11 @@
127 #pragma once 127 #pragma once
128 128
@@ -135,11 +135,11 @@ index 38b2995178ff..d7d95c44cf11 100644
135 135
136 #include "group-record.h" 136 #include "group-record.h"
137 137
138diff --git a/src/shared/userdb.c b/src/shared/userdb.c 138Index: systemd-stable/src/shared/userdb.c
139index 92f8796768d7..5d912862f85c 100644 139===================================================================
140--- a/src/shared/userdb.c 140--- systemd-stable.orig/src/shared/userdb.c
141+++ b/src/shared/userdb.c 141+++ systemd-stable/src/shared/userdb.c
142@@ -924,13 +924,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { 142@@ -930,13 +930,16 @@ int groupdb_iterator_get(UserDBIterator
143 if (gr) { 143 if (gr) {
144 _cleanup_free_ char *buffer = NULL; 144 _cleanup_free_ char *buffer = NULL;
145 bool incomplete = false; 145 bool incomplete = false;
@@ -156,7 +156,7 @@ index 92f8796768d7..5d912862f85c 100644
156 r = nss_sgrp_for_group(gr, &sgrp, &buffer); 156 r = nss_sgrp_for_group(gr, &sgrp, &buffer);
157 if (r < 0) { 157 if (r < 0) {
158 log_debug_errno(r, "Failed to acquire shadow entry for group %s, ignoring: %m", gr->gr_name); 158 log_debug_errno(r, "Failed to acquire shadow entry for group %s, ignoring: %m", gr->gr_name);
159@@ -938,6 +941,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { 159@@ -944,6 +947,9 @@ int groupdb_iterator_get(UserDBIterator
160 } 160 }
161 161
162 r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret); 162 r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
@@ -166,6 +166,3 @@ index 92f8796768d7..5d912862f85c 100644
166 if (r < 0) 166 if (r < 0)
167 return r; 167 return r;
168 168
169--
1702.17.1
171