Bug 1315 - Match Group does not support negation
Summary: Match Group does not support negation
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 4.6p1
Hardware: All All
: P2 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_5_1
  Show dependency treegraph
 
Reported: 2007-05-17 17:48 AEST by William Knox
Modified: 2023-01-13 13:56 AEDT (History)
3 users (show)

See Also:


Attachments
Suggested patch (756 bytes, patch)
2007-05-17 17:48 AEST, William Knox
no flags Details | Diff
separate ga_match_pattern_list() function (3.05 KB, patch)
2008-07-03 13:25 AEST, Damien Miller
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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