keygen/src/main.c
/* Turn relative paths from the enftun config into absolute ones */
Turn relative paths from the enftun config into absolute ones
Turn relative paths from the enftun config into absolute ones
static void make_cfg_path_absolute(const char *enftun_path_prefix, const char *cert_file, const char *key_file, char **full_cert_path, char **full_key_path)
{
    if (cert_file[0] != '/') {
        *full_cert_path = malloc(strlen(enftun_path_prefix) + strlen(cert_file) + 2);
        memcpy(*full_cert_path, enftun_path_prefix, strlen(enftun_path_prefix));
        (*full_cert_path)[strlen(enftun_path_prefix)] = '/';
        strcpy(*full_cert_path + strlen(enftun_path_prefix) + 1, cert_file);
    } else {
        *full_cert_path = malloc(strlen(cert_file) + 1);
        strcpy(*full_cert_path, cert_file);
    }
    if (key_file[0] != '/') {
        *full_key_path = malloc(strlen(enftun_path_prefix) + strlen(key_file) + 2);
        memcpy(*full_key_path, enftun_path_prefix, strlen(enftun_path_prefix));
        (*full_key_path)[strlen(enftun_path_prefix)] = '/';
        strcpy(*full_key_path + strlen(enftun_path_prefix) + 1, key_file);
    } else {
        *full_key_path = malloc(strlen(key_file) + 1);
        strcpy(*full_key_path, key_file);
    }
}
static void make_cfg_path_absolute ( const char * enftun_path_prefix , const char * cert_file , const char * key_file , char * * full_cert_path , char * * full_key_path ) { if ( cert_file [ 0 ] != ' ' ) { * full_cert_path = malloc ( strlen ( enftun_path_prefix ) + strlen ( cert_file ) + 2 ) ; memcpy ( * full_cert_path , enftun_path_prefix , strlen ( enftun_path_prefix ) ) ; ( * full_cert_path ) [ strlen ( enftun_path_prefix ) ] = ' ' ; strcpy ( * full_cert_path + strlen ( enftun_path_prefix ) + 1 , cert_file ) ; } else { * full_cert_path = malloc ( strlen ( cert_file ) + 1 ) ; strcpy ( * full_cert_path , cert_file ) ; } if ( key_file [ 0 ] != ' ' ) { * full_key_path = malloc ( strlen ( enftun_path_prefix ) + strlen ( key_file ) + 2 ) ; memcpy ( * full_key_path , enftun_path_prefix , strlen ( enftun_path_prefix ) ) ; ( * full_key_path ) [ strlen ( enftun_path_prefix ) ] = ' ' ; strcpy ( * full_key_path + strlen ( enftun_path_prefix ) + 1 , key_file ) ; } else { * full_key_path = malloc ( strlen ( key_file ) + 1 ) ; strcpy ( * full_key_path , key_file ) ; } }
Turn relative paths from the enftun config into absolute ones
Turn relative paths from the enftun config into absolute ones