Project

General

Profile

gwenhywfar-default-bundle-support-on-windows.patch

rhabacker, 01/18/2019 11:47 AM

Download (1.55 KB)

View differences:

src/sio/syncio_tls.c 2019-01-18 09:44:37.223530707 +0000
420 420
     */
421 421
    int trustFileSet=0;
422 422

  
423
# ifndef OS_WIN32
424 423
    /* try to find OpenSSL certificates */
425 424
    if (trustFileSet==0) {
425

  
426
#if OS_WIN32
427
      char defaultPath[2*MAX_PATH+1];
428
      const char *defaultFile = "ca-bundle.crt";
429

  
430
      if (GWEN_Directory_GetPrefixDirectory(defaultPath, sizeof(defaultPath))) {
431
          DBG_ERROR(GWEN_LOGDOMAIN, "gnutls_certificate_set_x509_key_file: could not get install prefix");
432
          return GWEN_ERROR_GENERIC;
433
      }
434
      if (strcat_s(defaultPath, sizeof(defaultPath), "\\share\\gwenhywfar")) {
435
          DBG_ERROR(GWEN_LOGDOMAIN, "gnutls_certificate_set_x509_key_file: no memory on creating search path");
436
          return GWEN_ERROR_GENERIC;
437
      }
438
#else
439
      const char *defaultPath = "/etc/ssl/certs";
440
      const char *defaultFile = "ca-certificates.crt";
441
#endif
442

  
426 443
      GWEN_STRINGLIST *paths;
427 444
      GWEN_BUFFER *nbuf;
428 445

  
429 446
      paths=GWEN_StringList_new();
430
      GWEN_StringList_AppendString(paths, "/etc/ssl/certs", 0, 0);
447
      GWEN_StringList_AppendString(paths, defaultPath, 0, 0);
431 448

  
432 449
      nbuf=GWEN_Buffer_new(0, 256, 0, 1);
433
      rv=GWEN_Directory_FindFileInPaths(paths, "ca-certificates.crt", nbuf);
450
      rv=GWEN_Directory_FindFileInPaths(paths, defaultFile, nbuf);
434 451
      GWEN_StringList_free(paths);
435 452
      if (rv==0) {
436 453
        DBG_INFO(GWEN_LOGDOMAIN,
......
453 470
      }
454 471
      GWEN_Buffer_free(nbuf);
455 472
    }
456
# endif
457 473

  
458 474

  
459 475
# ifndef OS_WIN32