Commit 8df37672 authored by PhoeniX's avatar PhoeniX

Certificate out fix

parent aab5f740
......@@ -236,12 +236,7 @@ void do_certReq(int sock, const char* req, size_t len, const unsigned char* tran
{
uint32_t hash = (uint32_t)X509_NAME_hash(ncert->cert_info->subject);
char hash_str[sizeof(hash)*2+1];
#ifdef __x86_64__
const char* fmt = "%08x";
#else
const char* fmt = "%08lx";
#endif
sprintf(hash_str, fmt, hash);
sprintf(hash_str, "%08x", hash);
int i = 0;
char* filename = (char*)malloc(strlen(issued_dir)+strlen(hash_str)+8);
struct stat buf;
......@@ -250,7 +245,7 @@ void do_certReq(int sock, const char* req, size_t len, const unsigned char* tran
if (stat(filename, &buf) != 0) break;
} while (1);
FILE *f = fopen(filename, "w+");
X509_print_ex_fp(f, ncert, 0, 0);
i2d_X509_fp(f, ncert);
fclose(f);
free(filename);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment