diff options
author | Jonathan Beck | 2008-08-03 22:05:56 +0200 |
---|---|---|
committer | Matt Colyer | 2008-08-05 23:28:10 -0700 |
commit | 890ac04a0b4b6b6c5e3632de63ac844729f549dc (patch) | |
tree | bb6cd7d3d08b79275f6b7a1e9b05d958756caad8 /src/initconf.c | |
parent | b9f9675e1e3978693bb2e7f66a7125473b3cb30e (diff) | |
download | libplist-890ac04a0b4b6b6c5e3632de63ac844729f549dc.tar.gz libplist-890ac04a0b4b6b6c5e3632de63ac844729f549dc.tar.bz2 |
Fix mem allocation in config initialization.
Signed-off-by: Matt Colyer <matt@colyer.name>
Diffstat (limited to 'src/initconf.c')
-rw-r--r-- | src/initconf.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/initconf.c b/src/initconf.c index de583fa..7d6aa28 100644 --- a/src/initconf.c +++ b/src/initconf.c @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) { gnutls_global_init(); - char* host_id = NULL; + char* host_id = "29942970-207913891623273984"; gnutls_x509_privkey_t root_privkey; gnutls_x509_privkey_t host_privkey; @@ -42,9 +42,12 @@ int main(int argc, char *argv[]) { gnutls_x509_crt_init(&root_cert); gnutls_x509_crt_init(&host_cert); + /* generate HostID */ + //TODO + /* generate keys */ - int ret1 = gnutls_x509_privkey_generate(root_privkey, GNUTLS_PK_RSA, 2048, 0); - int ret2 = gnutls_x509_privkey_generate(host_privkey, GNUTLS_PK_RSA, 2048, 0); + gnutls_x509_privkey_generate(root_privkey, GNUTLS_PK_RSA, 2048, 0); + gnutls_x509_privkey_generate(host_privkey, GNUTLS_PK_RSA, 2048, 0); /* generate certificates */ gnutls_x509_crt_set_key(root_cert, root_privkey); @@ -73,7 +76,7 @@ int main(int argc, char *argv[]) { gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &host_key_pem.size); root_key_pem.data = gnutls_malloc(root_key_pem.size); - root_key_pem.data = gnutls_malloc(root_key_pem.size); + host_key_pem.data = gnutls_malloc(host_key_pem.size); gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &root_key_pem.size); gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &host_key_pem.size); @@ -85,7 +88,7 @@ int main(int argc, char *argv[]) { gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &host_cert_pem.size); root_cert_pem.data = gnutls_malloc(root_cert_pem.size); - root_cert_pem.data = gnutls_malloc(root_cert_pem.size); + host_cert_pem.data = gnutls_malloc(host_cert_pem.size); gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &root_cert_pem.size); gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &host_cert_pem.size); |