]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Add the user's primary group to the cache
authorDavid Mulder <dmulder@samba.org>
Mon, 26 Aug 2024 13:33:25 +0000 (07:33 -0600)
committerDavid Mulder <dmulder@samba.org>
Wed, 23 Oct 2024 14:21:34 +0000 (14:21 +0000)
We create a fake primary group which simply
matches the user's upn. This is because Entra ID
does not have primary groups, but we can fake it
with a primary group which is a member of all the
users groups.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
rust/himmelblaud/src/cache.rs
rust/himmelblaud/src/himmelblaud/himmelblaud_getpwnam.rs

index 5a344e5f0ddd9bc224d1e47c5295dd3d02167f5a..764753d00375d2b7ce71ee0770c51b0cb0048d49 100644 (file)
@@ -294,7 +294,6 @@ impl GroupEntry {
     }
 }
 
-#[cfg(test)]
 impl GroupEntry {
     pub fn new(uuid: &str) -> Self {
         GroupEntry {
index 576a62e78e6e1ee1bdcfbbe9147f5ed877d33634..40a7bffcbdc44e02ff47c3ca8017fff3321d339d 100644 (file)
@@ -18,6 +18,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+use crate::cache::GroupEntry;
 use crate::himmelblaud::Resolver;
 use crate::utils::split_username;
 use dbg::{DBG_ERR, DBG_WARNING};
@@ -59,6 +60,10 @@ impl Resolver {
             })?;
         // Store the calculated uid -> upn map in the cache
         self.uid_cache.store(uid, &upn)?;
+        // Store the primary group (which is a fake group matching the user upn)
+        let mut group = GroupEntry::new(upn);
+        group.add_member(upn);
+        self.group_cache.merge_groups(upn, vec![group])?;
         let (cn, domain) = match split_username(&upn) {
             Ok(res) => res,
             Err(e) => {