Navigation


Changeset 308:5f882de409eb in freeDiameter


Ignore:
Timestamp:
May 17, 2010, 3:23:48 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Added test for file access

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/fdd.y

    r304 r308  
    496496tls_cred:               TLS_CRED '=' QSTRING ',' QSTRING ';'
    497497                        {
     498                                FILE * fd;
     499                                fd = fopen($3, "r");
     500                                if (fd == NULL) {
     501                                        int ret = errno;
     502                                        TRACE_DEBUG(INFO, "Unable to open certificate file %s for reading: %s\n", $3, strerror(ret));
     503                                        yyerror (&yylloc, conf, "Error on file name");
     504                                        YYERROR;
     505                                }
     506                                fclose(fd);
     507                                fd = fopen($5, "r");
     508                                if (fd == NULL) {
     509                                        int ret = errno;
     510                                        TRACE_DEBUG(INFO, "Unable to open private key file %s for reading: %s\n", $5, strerror(ret));
     511                                        yyerror (&yylloc, conf, "Error on file name");
     512                                        YYERROR;
     513                                }
     514                                fclose(fd);
    498515                                conf->cnf_sec_data.cert_file = $3;
    499516                                conf->cnf_sec_data.key_file = $5;
     
    510527tls_ca:                 TLS_CA '=' QSTRING ';'
    511528                        {
     529                                FILE * fd;
     530                                fd = fopen($3, "r");
     531                                if (fd == NULL) {
     532                                        int ret = errno;
     533                                        TRACE_DEBUG(INFO, "Unable to open CA file %s for reading: %s\n", $3, strerror(ret));
     534                                        yyerror (&yylloc, conf, "Error on file name");
     535                                        YYERROR;
     536                                }
     537                                fclose(fd);
    512538                                conf->cnf_sec_data.ca_file = $3;
    513539                                CHECK_GNUTLS_DO( conf->cnf_sec_data.ca_file_nr += gnutls_certificate_set_x509_trust_file(
     
    521547tls_crl:                TLS_CRL '=' QSTRING ';'
    522548                        {
     549                                FILE * fd;
     550                                fd = fopen($3, "r");
     551                                if (fd == NULL) {
     552                                        int ret = errno;
     553                                        TRACE_DEBUG(INFO, "Unable to open CRL file %s for reading: %s\n", $3, strerror(ret));
     554                                        yyerror (&yylloc, conf, "Error on file name");
     555                                        YYERROR;
     556                                }
     557                                fclose(fd);
    523558                                conf->cnf_sec_data.crl_file = $3;
    524559                                CHECK_GNUTLS_DO( gnutls_certificate_set_x509_crl_file(
Note: See TracChangeset for help on using the changeset viewer.