mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	audit: improve GID/EGID comparation logic
It is useful to extend GID/EGID comparation logic to be able to match not only the exact EID/EGID values but the group/egroup also. Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com> Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
		
							parent
							
								
									19f949f525
								
							
						
					
					
						commit
						37eebe39c9
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
					@ -633,9 +633,23 @@ static int audit_filter_rules(struct task_struct *tsk,
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case AUDIT_GID:
 | 
							case AUDIT_GID:
 | 
				
			||||||
			result = audit_gid_comparator(cred->gid, f->op, f->gid);
 | 
								result = audit_gid_comparator(cred->gid, f->op, f->gid);
 | 
				
			||||||
 | 
								if (f->op == Audit_equal) {
 | 
				
			||||||
 | 
									if (!result)
 | 
				
			||||||
 | 
										result = in_group_p(f->gid);
 | 
				
			||||||
 | 
								} else if (f->op == Audit_not_equal) {
 | 
				
			||||||
 | 
									if (result)
 | 
				
			||||||
 | 
										result = !in_group_p(f->gid);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case AUDIT_EGID:
 | 
							case AUDIT_EGID:
 | 
				
			||||||
			result = audit_gid_comparator(cred->egid, f->op, f->gid);
 | 
								result = audit_gid_comparator(cred->egid, f->op, f->gid);
 | 
				
			||||||
 | 
								if (f->op == Audit_equal) {
 | 
				
			||||||
 | 
									if (!result)
 | 
				
			||||||
 | 
										result = in_egroup_p(f->gid);
 | 
				
			||||||
 | 
								} else if (f->op == Audit_not_equal) {
 | 
				
			||||||
 | 
									if (result)
 | 
				
			||||||
 | 
										result = !in_egroup_p(f->gid);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case AUDIT_SGID:
 | 
							case AUDIT_SGID:
 | 
				
			||||||
			result = audit_gid_comparator(cred->sgid, f->op, f->gid);
 | 
								result = audit_gid_comparator(cred->sgid, f->op, f->gid);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue