@@ -104,6 +104,7 @@ static void check_value(const char *option, const char *value, int accepted, uin
104104 maxage = tracking_delay = 17 ;
105105 maxconn = 17 ;
106106#ifdef WITH_CLIENT_CERTIFICATE_VALIDATION
107+ /* valid assignments are 0,1,2; if invalid remain what it was */
107108 certrequest = 2 ;
108109#endif
109110 args [0 ] = xstrdup (option );
@@ -182,13 +183,16 @@ int main(void)
182183 printf ("Widths: int=%" PRIuSIZE ", long=%" PRIuSIZE ", nfds_t=%" PRIuSIZE "\n" ,
183184 sizeof (int ), sizeof (long ), sizeof (nfds_t ));
184185 for (i = 0 ; i < sizeof (options ) / sizeof (options [0 ]); i ++ ) {
186+ limit = !strcmp (options [i ], "CERTREQUEST" ) ? NETSSL_CERTREQ_MAX : 0 ;
185187 previous = !strcmp (options [i ], "CERTREQUEST" ) ? 2 : 17 ;
188+ #define EXPSET (x , y ) (limit == 0 || limit >= x ? y : 0)
189+ #define EXPLIM (x ) (limit == 0 || limit >= x ? x : previous)
186190 check_value (options [i ], "0" , 1 , 0 );
187- check_value (options [i ], "1" , 1 , 1 );
188- check_value (options [i ], "2" , 1 , 2 );
189- check_value (options [i ], "00015" , 1 , 15 );
190- check_value (options [i ], "32 \t" , 1 , 32 );
191- check_value (options [i ], "3600" , 1 , 3600 );
191+ check_value (options [i ], "1" , EXPSET ( 1 , 1 ), EXPLIM ( 1 ) );
192+ check_value (options [i ], "2" , EXPSET ( 2 , 1 ), EXPLIM ( 2 ) );
193+ check_value (options [i ], "00015" , EXPSET ( 15 , 1 ), EXPLIM ( 15 ) );
194+ check_value (options [i ], "32 \t" , EXPSET ( 32 , 1 ), EXPLIM ( 32 ) );
195+ check_value (options [i ], "3600" , EXPSET ( 3600 , 1 ), EXPLIM ( 3600 ) );
192196 for (j = 0 ; j < sizeof (invalid ) / sizeof (invalid [0 ]); j ++ )
193197 check_value (options [i ], invalid [j ], 0 , previous );
194198
@@ -197,6 +201,9 @@ int main(void)
197201 limit = (uintmax_t )((nfds_t )-1 );
198202 if (limit > (uintmax_t )LONG_MAX ) limit = (uintmax_t )LONG_MAX ;
199203 }
204+ else if (!strcmp (options [i ], "CERTREQUEST" )) {
205+ limit = (uintmax_t )(NETSSL_CERTREQ_MAX );
206+ }
200207 snprintf (number , sizeof (number ), "%" PRIuMAX , limit - 1 );
201208 check_value (options [i ], number , 1 , limit - 1 );
202209 snprintf (number , sizeof (number ), "%" PRIuMAX , limit );
@@ -212,7 +219,8 @@ int main(void)
212219 check_value ("CERTREQUEST" , "REQUIRE" , 1 , 2 );
213220 check_value ("CERTREQUEST" , "require" , 0 , 2 );
214221 /* ssl_init still owns the 0..2 domain check and its fatal error policy. */
215- check_value ("CERTREQUEST" , "3" , 1 , 3 );
222+ /*check_value("CERTREQUEST", "3", 1, 3);*/
223+ check_value ("CERTREQUEST" , "3" , 0 , 2 );
216224#endif
217225
218226 f = fopen (config_file , "w" );
0 commit comments