Ticket #299: 300-fix-filechecking.patch

File 300-fix-filechecking.patch, 1.0 KB (added by MaxMuster, 9 years ago)

Simple try to fix file checking of client-config-dir with chroot set - fixed indents - fixed wrong "free"

  • src/openvpn/options.c

     
    27332733                             R_OK|W_OK|X_OK, "--tls-export-cert");
    27342734#endif /* ENABLE_SSL */
    27352735#if P2MP_SERVER
    2736   errs |= check_file_access (CHKACC_FILE, options->client_config_dir,
    2737                              R_OK|X_OK, "--client-config-dir");
     2736  /* if chroot is given, client-config-dir must be relative to this directory */
     2737  if ( options->chroot_dir )
     2738    {
     2739      char fullpath [strlen(options->chroot_dir) + strlen(options->client_config_dir) +2];
     2740      sprintf(fullpath, "%s/%s", options->chroot_dir,options->client_config_dir);
     2741      errs |= check_file_access (CHKACC_FILE, fullpath,
     2742                                 R_OK|X_OK, "--client-config-dir");
     2743    }
     2744  else
     2745    errs |= check_file_access (CHKACC_FILE, options->client_config_dir,
     2746                               R_OK|X_OK, "--client-config-dir");       
     2747
    27382748  errs |= check_file_access (CHKACC_FILE, options->tmp_dir,
    27392749                             R_OK|W_OK|X_OK, "Temporary directory (--tmp-dir)");
    27402750