Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartatz committed Oct 3, 2024
1 parent e1b43b5 commit 471a963
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/sslcerts.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ static int sslcerts_load_file(const char* const name) {

int status = 0;
int err = M3U8ERR_SUCCESS;

printf("kkk %i\n", __LINE__);
stream = fstream_open(name, FSTREAM_READ);

if (stream == NULL) {
err = M3U8ERR_FSTREAM_OPEN_FAILURE;
goto end;
}

printf("kkk %i\n", __LINE__);
status = fstream_seek(stream, 0, FSTREAM_SEEK_END);

if (status == -1) {
err = M3U8ERR_FSTREAM_SEEK_FAILURE;
goto end;
}

printf("kkk %i\n", __LINE__);
file_size = fstream_tell(stream);

if (file_size == -1) {
Expand All @@ -82,21 +82,21 @@ static int sslcerts_load_file(const char* const name) {
err = M3U8ERR_FSTREAM_READ_EMPTY_FILE;
goto end;
}

printf("kkk %i\n", __LINE__);
status = fstream_seek(stream, 0, FSTREAM_SEEK_BEGIN);

if (status == -1) {
err = M3U8ERR_FSTREAM_SEEK_FAILURE;
goto end;
}

printf("kkk %i\n", __LINE__);
buffer = malloc((size_t) file_size);

if (buffer == NULL) {
err = M3U8ERR_MEMORY_ALLOCATE_FAILURE;
goto end;
}

printf("kkk %i\n", __LINE__);
rsize = fstream_read(stream, buffer, (size_t) file_size);

if (rsize == -1) {
Expand All @@ -116,7 +116,7 @@ static int sslcerts_load_file(const char* const name) {
}

int sslcerts_load_certificates(CURL* const curl) {
printf("kkk %i\n", __LINE__);

int err = M3U8ERR_SUCCESS;
CURLcode code = CURLE_OK;

Expand Down Expand Up @@ -148,12 +148,12 @@ int sslcerts_load_certificates(CURL* const curl) {
err = M3U8ERR_MEMORY_ALLOCATE_FAILURE;
goto end;
}
printf("kkk %i\n", __LINE__);

for (index = 0; index < sizeof(SSL_CERTIFICATE_LOCATIONS) / sizeof(*SSL_CERTIFICATE_LOCATIONS); index++) {
const char* const location = SSL_CERTIFICATE_LOCATIONS[index];
printf("kkk %i\n", __LINE__);

err = sslcerts_load_file(location);
printf("kkk %i\n", __LINE__);

if (err != M3U8ERR_SUCCESS) {
continue;
}
Expand All @@ -166,25 +166,25 @@ int sslcerts_load_certificates(CURL* const curl) {

goto end;
}
printf("kkk %i\n", __LINE__);

app_filename = get_app_filename();

if (app_filename == NULL) {
err = M3U8ERR_GET_APP_FILENAME_FAILURE;
goto end;
}
printf("kkk %i\n", __LINE__);

name = malloc(strlen(app_filename) + strlen(BUILTIN_CA_CERT_LOCATION) + 1);

if (name == NULL) {
err = M3U8ERR_MEMORY_ALLOCATE_FAILURE;
goto end;
}
printf("kkk %i\n", __LINE__);

get_parent_directory(app_filename, name, 2);

strcat(name, BUILTIN_CA_CERT_LOCATION);
printf("kkk %i\n", __LINE__);

err = sslcerts_load_file(name);

if (err != M3U8ERR_SUCCESS) {
Expand Down

0 comments on commit 471a963

Please sign in to comment.