Bug 1315

Summary: Match Group does not support negation
Product: Portable OpenSSH Reporter: William Knox <wknox>
Component: sshdAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: enhancement CC: djm, dtucker, remy
Priority: P2    
Version: 4.6p1   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 1452    
Attachments:
Description Flags
Suggested patch
none
separate ga_match_pattern_list() function dtucker: ok+

Description William Knox 2007-05-17 17:48:25 AEST
Created attachment 1283 [details]
Suggested patch

A Match conditional with a Group keyword does not support negation of groups (i.e. don't apply if the person is a member of the named group). The following patch adds this functionality. A small change to wording on line 534 of servconf.c is also in order, but I haven't added that. I also did not check to see if this causes any major headaches with AllowGroups or DenyGroups, which also use the modified function (ga_match), but I don't believe it should. The one assumption which should be spelled out is that if you get a negation match, that is a breaker which causes further matching to stop.
Comment 1 Darren Tucker 2008-06-14 11:15:11 AEST
Target 5.1.  ga_match is used by more than just the "Match Group" so we will need to check carefully that this doesn't have side effects.
Comment 2 Damien Miller 2008-06-30 20:55:48 AEST
Yeah, the interactions between AllowGroups and DenyGroups (the two other places where ga_match is used) are weird enough without having negation thrown in the mix.

Perhaps either add a flag to ga_match() to specify whether negation is allowed and only set it for the Match case, or create a separate ga_match_list() for the Match case.
Comment 3 Damien Miller 2008-07-03 13:25:15 AEST
Created attachment 1538 [details]
separate ga_match_pattern_list() function

like this
Comment 4 Damien Miller 2008-07-04 13:45:36 AEST
patch applied - this will be in openssh-5.1. Thanks!
Comment 5 Damien Miller 2008-07-22 12:18:53 AEST
Mass update RESOLVED->CLOSED after release of openssh-5.1