mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	configtest: print ssl config options even when unset
Print "SSLOptionVar =" instead of omitting the option when running --configtest with ssl enabled. This better matches the behaviour of other options, e.g. ChrootDir.
This commit is contained in:
		| @@ -96,38 +96,42 @@ ConfSSL_Init(void) | |||||||
| } | } | ||||||
|  |  | ||||||
| static bool | static bool | ||||||
| can_open(const char *name, const char *file) | ssl_print_configvar(const char *name, const char *file) | ||||||
| { | { | ||||||
| 	FILE *fp = fopen(file, "r"); | 	FILE *fp; | ||||||
|  |  | ||||||
|  | 	if (!file) { | ||||||
|  | 		printf("  %s =\n", name); | ||||||
|  | 		return true; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	fp = fopen(file, "r"); | ||||||
| 	if (fp) | 	if (fp) | ||||||
| 		fclose(fp); | 		fclose(fp); | ||||||
| 	else | 	else | ||||||
| 		fprintf(stderr, "ERROR: %s \"%s\": %s\n", | 		fprintf(stderr, "ERROR: %s \"%s\": %s\n", | ||||||
| 			name, file, strerror(errno)); | 			name, file, strerror(errno)); | ||||||
|  |  | ||||||
|  | 	printf("  %s = %s\n", name, file); | ||||||
| 	return fp != NULL; | 	return fp != NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| static bool | static bool | ||||||
| ConfSSL_Puts(void) | ConfSSL_Puts(void) | ||||||
| { | { | ||||||
| 	bool ret = true; | 	bool ret; | ||||||
|  |  | ||||||
| 	if (Conf_SSLOptions.KeyFile) { | 	ret = ssl_print_configvar("SSLKeyFile", Conf_SSLOptions.KeyFile); | ||||||
| 		printf( "  SSLKeyFile = %s\n", Conf_SSLOptions.KeyFile); |  | ||||||
| 		ret = can_open("SSLKeyFile", Conf_SSLOptions.KeyFile); | 	if (!ssl_print_configvar("SSLCertFile", Conf_SSLOptions.CertFile)) | ||||||
| 	} |  | ||||||
| 	if (Conf_SSLOptions.CertFile) { |  | ||||||
| 		printf( "  SSLCertFile = %s\n", Conf_SSLOptions.CertFile); |  | ||||||
| 		if (!can_open("SSLCertFile", Conf_SSLOptions.CertFile)) |  | ||||||
| 		ret = false; | 		ret = false; | ||||||
| 	} |  | ||||||
| 	if (Conf_SSLOptions.DHFile) { | 	if (!ssl_print_configvar("SSLDHFile", Conf_SSLOptions.DHFile)) | ||||||
| 		printf( "  SSLDHFile = %s\n", Conf_SSLOptions.DHFile); |  | ||||||
| 		if (!can_open("SSLDHFile", Conf_SSLOptions.DHFile)) |  | ||||||
| 		ret = false; | 		ret = false; | ||||||
| 	} |  | ||||||
| 	if (array_bytes(&Conf_SSLOptions.KeyFilePassword)) | 	if (array_bytes(&Conf_SSLOptions.KeyFilePassword)) | ||||||
| 		puts("  SSLKeyFilePassword = <secret>"  ); | 		puts("  SSLKeyFilePassword = <secret>"); | ||||||
|  |  | ||||||
| 	array_free_wipe(&Conf_SSLOptions.KeyFilePassword); | 	array_free_wipe(&Conf_SSLOptions.KeyFilePassword); | ||||||
|  |  | ||||||
| 	return ret; | 	return ret; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Florian Westphal
					Florian Westphal