FreeBSD/crypto/openssh/compat.c
/*
 * Filters a proposal string, excluding any algorithm matching the 'filter'
 * pattern list.
 */
Filters a proposal string, excluding any algorithm matching the 'filter'
pattern list.
Filters a proposal string excluding any algorithm matching the ' filter ' pattern list .
static char *
filter_proposal(char *proposal, const char *filter)
{
	Buffer b;
	char *orig_prop, *fix_prop;
	char *cp, *tmp;
	buffer_init(&b);
	tmp = orig_prop = xstrdup(proposal);
	while ((cp = strsep(&tmp, ",")) != NULL) {
		if (match_pattern_list(cp, filter, 0) != 1) {
			if (buffer_len(&b) > 0)
				buffer_append(&b, ",", 1);
			buffer_append(&b, cp, strlen(cp));
		} else
			debug2("Compat: skipping algorithm \"%s\"", cp);
	}
	buffer_append(&b, "\0", 1);
	fix_prop = xstrdup((char *)buffer_ptr(&b));
	buffer_free(&b);
	free(orig_prop);
	return fix_prop;
}
static char * filter_proposal ( char * proposal , const char * filter ) { Buffer b ; char * orig_prop , * fix_prop ; char * cp , * tmp ; buffer_init ( & b ) ; tmp = orig_prop = xstrdup ( proposal ) ; while ( ( cp = strsep ( & tmp , " " ) ) != NULL ) { if ( match_pattern_list ( cp , filter , 0 ) != 1 ) { if ( buffer_len ( & b ) > 0 ) buffer_append ( & b , " " , 1 ) ; buffer_append ( & b , cp , strlen ( cp ) ) ; } else debug2 ( " \" \" " , cp ) ; } buffer_append ( & b , " \0 " , 1 ) ; fix_prop = xstrdup ( ( char * ) buffer_ptr ( & b ) ) ; buffer_free ( & b ) ; free ( orig_prop ) ; return fix_prop ; }
Filters a proposal string, excluding any algorithm matching the 'filter'
 pattern list.
Filters a proposal string excluding any algorithm matching the ' filter ' pattern list .