[BACK]Return to match.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/match.c between version 1.41 and 1.42

version 1.41, 2019/11/13 04:47:52 version 1.42, 2020/07/05 23:59:45
Line 302 
Line 302 
   
 /*  /*
  * Filter proposal using pattern-list filter.   * Filter proposal using pattern-list filter.
  * "blacklist" determines sense of filter:   * "denylist" determines sense of filter:
  * non-zero indicates that items matching filter should be excluded.   * non-zero indicates that items matching filter should be excluded.
  * zero indicates that only items matching filter should be included.   * zero indicates that only items matching filter should be included.
  * returns NULL on allocation error, otherwise caller must free result.   * returns NULL on allocation error, otherwise caller must free result.
  */   */
 static char *  static char *
 filter_list(const char *proposal, const char *filter, int blacklist)  filter_list(const char *proposal, const char *filter, int denylist)
 {  {
         size_t len = strlen(proposal) + 1;          size_t len = strlen(proposal) + 1;
         char *fix_prop = malloc(len);          char *fix_prop = malloc(len);
Line 326 
Line 326 
         *fix_prop = '\0';          *fix_prop = '\0';
         while ((cp = strsep(&tmp, ",")) != NULL) {          while ((cp = strsep(&tmp, ",")) != NULL) {
                 r = match_pattern_list(cp, filter, 0);                  r = match_pattern_list(cp, filter, 0);
                 if ((blacklist && r != 1) || (!blacklist && r == 1)) {                  if ((denylist && r != 1) || (!denylist && r == 1)) {
                         if (*fix_prop != '\0')                          if (*fix_prop != '\0')
                                 strlcat(fix_prop, ",", len);                                  strlcat(fix_prop, ",", len);
                         strlcat(fix_prop, cp, len);                          strlcat(fix_prop, cp, len);
Line 341 
Line 341 
  * the 'filter' pattern list. Caller must free returned string.   * the 'filter' pattern list. Caller must free returned string.
  */   */
 char *  char *
 match_filter_blacklist(const char *proposal, const char *filter)  match_filter_denylist(const char *proposal, const char *filter)
 {  {
         return filter_list(proposal, filter, 1);          return filter_list(proposal, filter, 1);
 }  }
Line 351 
Line 351 
  * the 'filter' pattern list. Caller must free returned string.   * the 'filter' pattern list. Caller must free returned string.
  */   */
 char *  char *
 match_filter_whitelist(const char *proposal, const char *filter)  match_filter_allowlist(const char *proposal, const char *filter)
 {  {
         return filter_list(proposal, filter, 0);          return filter_list(proposal, filter, 0);
 }  }

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42