# HG changeset patch # User Sebastien Decugis # Date 1274077428 -32400 # Node ID 5f882de409eb6380424c03dd7aece3a0a464482f # Parent b49f187df50ddedbc645cd3e9a500474143b1d87 Added test for file access diff -r b49f187df50d -r 5f882de409eb freeDiameter/fdd.y --- a/freeDiameter/fdd.y Mon May 17 15:00:52 2010 +0900 +++ b/freeDiameter/fdd.y Mon May 17 15:23:48 2010 +0900 @@ -495,6 +495,23 @@ tls_cred: TLS_CRED '=' QSTRING ',' QSTRING ';' { + FILE * fd; + fd = fopen($3, "r"); + if (fd == NULL) { + int ret = errno; + TRACE_DEBUG(INFO, "Unable to open certificate file %s for reading: %s\n", $3, strerror(ret)); + yyerror (&yylloc, conf, "Error on file name"); + YYERROR; + } + fclose(fd); + fd = fopen($5, "r"); + if (fd == NULL) { + int ret = errno; + TRACE_DEBUG(INFO, "Unable to open private key file %s for reading: %s\n", $5, strerror(ret)); + yyerror (&yylloc, conf, "Error on file name"); + YYERROR; + } + fclose(fd); conf->cnf_sec_data.cert_file = $3; conf->cnf_sec_data.key_file = $5; @@ -509,6 +526,15 @@ tls_ca: TLS_CA '=' QSTRING ';' { + FILE * fd; + fd = fopen($3, "r"); + if (fd == NULL) { + int ret = errno; + TRACE_DEBUG(INFO, "Unable to open CA file %s for reading: %s\n", $3, strerror(ret)); + yyerror (&yylloc, conf, "Error on file name"); + YYERROR; + } + fclose(fd); conf->cnf_sec_data.ca_file = $3; CHECK_GNUTLS_DO( conf->cnf_sec_data.ca_file_nr += gnutls_certificate_set_x509_trust_file( conf->cnf_sec_data.credentials, @@ -520,6 +546,15 @@ tls_crl: TLS_CRL '=' QSTRING ';' { + FILE * fd; + fd = fopen($3, "r"); + if (fd == NULL) { + int ret = errno; + TRACE_DEBUG(INFO, "Unable to open CRL file %s for reading: %s\n", $3, strerror(ret)); + yyerror (&yylloc, conf, "Error on file name"); + YYERROR; + } + fclose(fd); conf->cnf_sec_data.crl_file = $3; CHECK_GNUTLS_DO( gnutls_certificate_set_x509_crl_file( conf->cnf_sec_data.credentials,