meta-starlingx/recipes-extended/sudo/files/sudo-1.8.23-ldapsearchuidfix.patch
Sar Ashki, Babak 1a30a897a9 ansible-bootstrap fails: slapd fails to start
stx-config/puppet-manifest:
 - set ldap module path to libexec
 - default is lib64 which is not where OE installs openldap
sudo:
 - build --with-ldap and apply stx patches
 - needed for sudo.schema / slapd
openldap:
 - install ldap / la modules
packagegroups:
 - stx-python: pexpect, trove, colorama, debtcollector, mysql
 - stx: e2fsprogs-resize2fs nss-pam-ldapd openldap-devand libmysqld + deps
rabbitmq-server:
 - run under uid 0 to bypass permission errors
conf/layer.conf:
 - Add ldap user
 - set preferred versions
 - Set CONTROLLER_IP to localhost
classes/stx-postrun.bbclass:
 - Add openldap fine tuning
 - fix permissions for keystone to start
2019-12-11 19:43:19 -08:00

28 lines
1.2 KiB
Diff

diff -up sudo-1.8.23/plugins/sudoers/ldap.c.ldapsearchuidfix sudo-1.8.23/plugins/sudoers/ldap.c
--- sudo-1.8.23/plugins/sudoers/ldap.c.ldapsearchuidfix 2018-04-29 21:59:31.000000000 +0200
+++ sudo-1.8.23/plugins/sudoers/ldap.c 2018-06-18 08:34:01.202686941 +0200
@@ -1189,8 +1189,8 @@ sudo_ldap_build_pass1(LDAP *ld, struct p
if (ldap_conf.search_filter)
sz += strlen(ldap_conf.search_filter);
- /* Then add (|(sudoUser=USERNAME)(sudoUser=ALL)) + NUL */
- sz += 29 + sudo_ldap_value_len(pw->pw_name);
+ /* Then add (|(sudoUser=USERNAME)(sudoUser=#uid)(sudoUser=ALL)) + NUL */
+ sz += 29 + (12 + MAX_UID_T_LEN) + sudo_ldap_value_len(pw->pw_name);
/* Add space for primary and supplementary groups and gids */
if ((grp = sudo_getgrgid(pw->pw_gid)) != NULL) {
@@ -1253,6 +1253,12 @@ sudo_ldap_build_pass1(LDAP *ld, struct p
CHECK_LDAP_VCAT(buf, pw->pw_name, sz);
CHECK_STRLCAT(buf, ")", sz);
+ /* Append user uid */
+ (void) snprintf(gidbuf, sizeof(gidbuf), "%u", (unsigned int)pw->pw_uid);
+ (void) strlcat(buf, "(sudoUser=#", sz);
+ (void) strlcat(buf, gidbuf, sz);
+ (void) strlcat(buf, ")", sz);
+
/* Append primary group and gid */
if (grp != NULL) {
CHECK_STRLCAT(buf, "(sudoUser=%", sz);