summaryrefslogtreecommitdiffstats
path: root/src/userpref.c
diff options
context:
space:
mode:
authorGravatar Matt Colyer2009-07-26 19:34:22 -0700
committerGravatar Matt Colyer2009-07-26 19:34:22 -0700
commiteea538c94f01f8054f69f059614f19400187a472 (patch)
tree209a12dc8c8eaece15b8153d15e689c8c2147ab6 /src/userpref.c
parent8ebfd7d8eea89bb27e4e6dbb1f37fd90d98b439c (diff)
parent19c9750d670435ce430f0fc85a55faf127bdfbf9 (diff)
downloadlibimobiledevice-eea538c94f01f8054f69f059614f19400187a472.tar.gz
libimobiledevice-eea538c94f01f8054f69f059614f19400187a472.tar.bz2
Merge commit 'martin-s/martin'
[#46 state:resolved]
Diffstat (limited to 'src/userpref.c')
-rw-r--r--src/userpref.c164
1 files changed, 82 insertions, 82 deletions
diff --git a/src/userpref.c b/src/userpref.c
index 0e83133..4b6dd98 100644
--- a/src/userpref.c
+++ b/src/userpref.c
@@ -22,6 +22,7 @@
22#include <glib.h> 22#include <glib.h>
23#include <glib/gprintf.h> 23#include <glib/gprintf.h>
24#include <stdio.h> 24#include <stdio.h>
25#include <stdint.h>
25#include <stdlib.h> 26#include <stdlib.h>
26#include <string.h> 27#include <string.h>
27#include <gnutls/gnutls.h> 28#include <gnutls/gnutls.h>
@@ -42,7 +43,7 @@
42 43
43/** Creates a freedesktop compatible configuration directory for libiphone. 44/** Creates a freedesktop compatible configuration directory for libiphone.
44 */ 45 */
45static void create_config_dir(void) 46static void userpref_create_config_dir(void)
46{ 47{
47 gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, NULL); 48 gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, NULL);
48 49
@@ -62,9 +63,10 @@ static int get_rand(int min, int max)
62 * 63 *
63 * @return A null terminated string containing a valid HostID. 64 * @return A null terminated string containing a valid HostID.
64 */ 65 */
65static char *lockdownd_generate_hostid() 66static char *userpref_generate_host_id()
66{ 67{
67 char *hostid = (char *) malloc(sizeof(char) * 37); // HostID's are just UUID's, and UUID's are 36 characters long 68 /* HostID's are just UUID's, and UUID's are 36 characters long */
69 char *hostid = (char *) malloc(sizeof(char) * 37);
68 const char *chars = "ABCDEF0123456789"; 70 const char *chars = "ABCDEF0123456789";
69 srand(time(NULL)); 71 srand(time(NULL));
70 int i = 0; 72 int i = 0;
@@ -77,7 +79,8 @@ static char *lockdownd_generate_hostid()
77 hostid[i] = chars[get_rand(0, 16)]; 79 hostid[i] = chars[get_rand(0, 16)];
78 } 80 }
79 } 81 }
80 hostid[36] = '\0'; // make it a real string 82 /* make it a real string */
83 hostid[36] = '\0';
81 return hostid; 84 return hostid;
82} 85}
83 86
@@ -85,7 +88,7 @@ static char *lockdownd_generate_hostid()
85 * 88 *
86 * @param host_id A null terminated string containing a valid HostID. 89 * @param host_id A null terminated string containing a valid HostID.
87 */ 90 */
88static int write_host_id(char *host_id) 91static int userpref_set_host_id(char *host_id)
89{ 92{
90 GKeyFile *key_file; 93 GKeyFile *key_file;
91 gsize length; 94 gsize length;
@@ -96,13 +99,13 @@ static int write_host_id(char *host_id)
96 return 0; 99 return 0;
97 100
98 /* Make sure config directory exists */ 101 /* Make sure config directory exists */
99 create_config_dir(); 102 userpref_create_config_dir();
100 103
101 /* Now parse file to get the HostID */ 104 /* Now parse file to get the HostID */
102 key_file = g_key_file_new(); 105 key_file = g_key_file_new();
103 106
104 /* Store in config file */ 107 /* Store in config file */
105 log_debug_msg("init_config_file(): setting hostID to %s\n", host_id); 108 log_debug_msg("%s: setting hostID to %s\n", __func__, host_id);
106 g_key_file_set_value(key_file, "Global", "HostID", host_id); 109 g_key_file_set_value(key_file, "Global", "HostID", host_id);
107 110
108 /* Write config file on disk */ 111 /* Write config file on disk */
@@ -125,9 +128,8 @@ static int write_host_id(char *host_id)
125 * 128 *
126 * @return The string containing the HostID or NULL 129 * @return The string containing the HostID or NULL
127 */ 130 */
128char *get_host_id(void) 131void userpref_get_host_id(char **host_id)
129{ 132{
130 char *host_id = NULL;
131 gchar *config_file; 133 gchar *config_file;
132 GKeyFile *key_file; 134 GKeyFile *key_file;
133 gchar *loc_host_id; 135 gchar *loc_host_id;
@@ -140,20 +142,19 @@ char *get_host_id(void)
140 if (g_key_file_load_from_file(key_file, config_file, G_KEY_FILE_KEEP_COMMENTS, NULL)) { 142 if (g_key_file_load_from_file(key_file, config_file, G_KEY_FILE_KEEP_COMMENTS, NULL)) {
141 loc_host_id = g_key_file_get_value(key_file, "Global", "HostID", NULL); 143 loc_host_id = g_key_file_get_value(key_file, "Global", "HostID", NULL);
142 if (loc_host_id) 144 if (loc_host_id)
143 host_id = strdup((char *) loc_host_id); 145 *host_id = strdup((char *) loc_host_id);
144 g_free(loc_host_id); 146 g_free(loc_host_id);
145 } 147 }
146 g_key_file_free(key_file); 148 g_key_file_free(key_file);
147 g_free(config_file); 149 g_free(config_file);
148 150
149 if (!host_id) { 151 if (!host_id) {
150 //no config, generate host_id 152 /* no config, generate host_id */
151 host_id = lockdownd_generate_hostid(); 153 *host_id = userpref_generate_host_id();
152 write_host_id(host_id); 154 userpref_set_host_id(*host_id);
153 } 155 }
154 156
155 log_debug_msg("get_host_id(): Using %s as HostID\n", host_id); 157 log_debug_msg("%s: Using %s as HostID\n", __func__, *host_id);
156 return host_id;
157} 158}
158 159
159/** Determines whether this iPhone has been connected to this system before. 160/** Determines whether this iPhone has been connected to this system before.
@@ -163,13 +164,13 @@ char *get_host_id(void)
163 * @return 1 if the iPhone has been connected previously to this configuration 164 * @return 1 if the iPhone has been connected previously to this configuration
164 * or 0 otherwise. 165 * or 0 otherwise.
165 */ 166 */
166int is_device_known(char *uid) 167int userpref_has_device_public_key(char *uuid)
167{ 168{
168 int ret = 0; 169 int ret = 0;
169 gchar *config_file; 170 gchar *config_file;
170 171
171 /* first get config file */ 172 /* first get config file */
172 gchar *device_file = g_strconcat(uid, ".pem", NULL); 173 gchar *device_file = g_strconcat(uuid, ".pem", NULL);
173 config_file = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL); 174 config_file = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL);
174 if (g_file_test(config_file, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))) 175 if (g_file_test(config_file, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)))
175 ret = 1; 176 ret = 1;
@@ -186,17 +187,19 @@ int is_device_known(char *uid)
186 * @return 1 on success and 0 if no public key is given or if it has already 187 * @return 1 on success and 0 if no public key is given or if it has already
187 * been marked as connected previously. 188 * been marked as connected previously.
188 */ 189 */
189int store_device_public_key(char *uid, gnutls_datum_t public_key) 190userpref_error_t userpref_set_device_public_key(char *uuid, gnutls_datum_t public_key)
190{ 191{
191 192 if (NULL == public_key.data)
192 if (NULL == public_key.data || is_device_known(uid)) 193 return USERPREF_E_INVALID_ARG;
193 return 0; 194
195 if (userpref_has_device_public_key(uuid))
196 return USERPREF_E_SUCCESS;
194 197
195 /* ensure config directory exists */ 198 /* ensure config directory exists */
196 create_config_dir(); 199 userpref_create_config_dir();
197 200
198 /* build file path */ 201 /* build file path */
199 gchar *device_file = g_strconcat(uid, ".pem", NULL); 202 gchar *device_file = g_strconcat(uuid, ".pem", NULL);
200 gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL); 203 gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL);
201 204
202 /* store file */ 205 /* store file */
@@ -205,7 +208,8 @@ int store_device_public_key(char *uid, gnutls_datum_t public_key)
205 fclose(pFile); 208 fclose(pFile);
206 g_free(pem); 209 g_free(pem);
207 g_free(device_file); 210 g_free(device_file);
208 return 1; 211
212 return USERPREF_E_SUCCESS;
209} 213}
210 214
211/** Private function which reads the given file into a gnutls structure. 215/** Private function which reads the given file into a gnutls structure.
@@ -215,7 +219,7 @@ int store_device_public_key(char *uid, gnutls_datum_t public_key)
215 * 219 *
216 * @return 1 if the file contents where read successfully and 0 otherwise. 220 * @return 1 if the file contents where read successfully and 0 otherwise.
217 */ 221 */
218static int read_file_in_confdir(const char *file, gnutls_datum_t * data) 222static int userpref_get_file_contents(const char *file, gnutls_datum_t * data)
219{ 223{
220 gboolean success; 224 gboolean success;
221 gsize size; 225 gsize size;
@@ -237,17 +241,17 @@ static int read_file_in_confdir(const char *file, gnutls_datum_t * data)
237 return success; 241 return success;
238} 242}
239 243
240
241/** Private function which generate private keys and certificates. 244/** Private function which generate private keys and certificates.
242 * 245 *
243 * @return IPHONE_E_SUCCESS if keys were successfully generated. 246 * @return 1 if keys were successfully generated, 0 otherwise
244 */ 247 */
245static iphone_error_t gen_keys_and_cert(void) 248static userpref_error_t userpref_gen_keys_and_cert(void)
246{ 249{
247 iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; 250 userpref_error_t ret = USERPREF_E_SSL_ERROR;
251
248 gnutls_x509_privkey_t root_privkey; 252 gnutls_x509_privkey_t root_privkey;
249 gnutls_x509_privkey_t host_privkey;
250 gnutls_x509_crt_t root_cert; 253 gnutls_x509_crt_t root_cert;
254 gnutls_x509_privkey_t host_privkey;
251 gnutls_x509_crt_t host_cert; 255 gnutls_x509_crt_t host_cert;
252 256
253 gnutls_global_deinit(); 257 gnutls_global_deinit();
@@ -275,7 +279,6 @@ static iphone_error_t gen_keys_and_cert(void)
275 gnutls_x509_crt_set_expiration_time(root_cert, time(NULL) + (60 * 60 * 24 * 365 * 10)); 279 gnutls_x509_crt_set_expiration_time(root_cert, time(NULL) + (60 * 60 * 24 * 365 * 10));
276 gnutls_x509_crt_sign(root_cert, root_cert, root_privkey); 280 gnutls_x509_crt_sign(root_cert, root_cert, root_privkey);
277 281
278
279 gnutls_x509_crt_set_key(host_cert, host_privkey); 282 gnutls_x509_crt_set_key(host_cert, host_privkey);
280 gnutls_x509_crt_set_serial(host_cert, "\x00", 1); 283 gnutls_x509_crt_set_serial(host_cert, "\x00", 1);
281 gnutls_x509_crt_set_version(host_cert, 3); 284 gnutls_x509_crt_set_version(host_cert, 3);
@@ -312,14 +315,14 @@ static iphone_error_t gen_keys_and_cert(void)
312 315
313 if (NULL != root_cert_pem.data && 0 != root_cert_pem.size && 316 if (NULL != root_cert_pem.data && 0 != root_cert_pem.size &&
314 NULL != host_cert_pem.data && 0 != host_cert_pem.size) 317 NULL != host_cert_pem.data && 0 != host_cert_pem.size)
315 ret = IPHONE_E_SUCCESS; 318 ret = USERPREF_E_SUCCESS;
316 319
317 /* store values in config file */ 320 /* store values in config file */
318 init_config_file( &root_key_pem, &host_key_pem, &root_cert_pem, &host_cert_pem); 321 userpref_set_keys_and_certs( &root_key_pem, &root_cert_pem, &host_key_pem, &host_cert_pem);
319 322
320 gnutls_free(root_key_pem.data); 323 gnutls_free(root_key_pem.data);
321 gnutls_free(host_key_pem.data);
322 gnutls_free(root_cert_pem.data); 324 gnutls_free(root_cert_pem.data);
325 gnutls_free(host_key_pem.data);
323 gnutls_free(host_cert_pem.data); 326 gnutls_free(host_cert_pem.data);
324 327
325 //restore gnutls env 328 //restore gnutls env
@@ -334,18 +337,18 @@ static iphone_error_t gen_keys_and_cert(void)
334 * @param key_name The filename of the private key to import. 337 * @param key_name The filename of the private key to import.
335 * @param key the gnutls key structure. 338 * @param key the gnutls key structure.
336 * 339 *
337 * @return IPHONE_E_SUCCESS if the key was successfully imported. 340 * @return 1 if the key was successfully imported.
338 */ 341 */
339static iphone_error_t import_key(const char* key_name, gnutls_x509_privkey_t key) 342static userpref_error_t userpref_import_key(const char* key_name, gnutls_x509_privkey_t key)
340{ 343{
341 iphone_error_t ret = IPHONE_E_INVALID_CONF; 344 userpref_error_t ret = USERPREF_E_INVALID_CONF;
342 gnutls_datum_t pem_key = { NULL, 0 }; 345 gnutls_datum_t pem_key = { NULL, 0 };
343 346
344 if ( read_file_in_confdir(key_name, &pem_key) ) { 347 if (userpref_get_file_contents(key_name, &pem_key)) {
345 if (GNUTLS_E_SUCCESS == gnutls_x509_privkey_import(key, &pem_key, GNUTLS_X509_FMT_PEM)) 348 if (GNUTLS_E_SUCCESS == gnutls_x509_privkey_import(key, &pem_key, GNUTLS_X509_FMT_PEM))
346 ret = IPHONE_E_SUCCESS; 349 ret = USERPREF_E_SUCCESS;
347 else 350 else
348 ret = IPHONE_E_SSL_ERROR; 351 ret = USERPREF_E_SSL_ERROR;
349 } 352 }
350 gnutls_free(pem_key.data); 353 gnutls_free(pem_key.data);
351 return ret; 354 return ret;
@@ -358,16 +361,16 @@ static iphone_error_t import_key(const char* key_name, gnutls_x509_privkey_t key
358 * 361 *
359 * @return IPHONE_E_SUCCESS if the certificate was successfully imported. 362 * @return IPHONE_E_SUCCESS if the certificate was successfully imported.
360 */ 363 */
361static iphone_error_t import_crt(const char* crt_name, gnutls_x509_crt_t cert) 364static userpref_error_t userpref_import_crt(const char* crt_name, gnutls_x509_crt_t cert)
362{ 365{
363 iphone_error_t ret = IPHONE_E_INVALID_CONF; 366 userpref_error_t ret = USERPREF_E_INVALID_CONF;
364 gnutls_datum_t pem_cert = { NULL, 0 }; 367 gnutls_datum_t pem_cert = { NULL, 0 };
365 368
366 if ( read_file_in_confdir(crt_name, &pem_cert) ) { 369 if (userpref_get_file_contents(crt_name, &pem_cert)) {
367 if (GNUTLS_E_SUCCESS == gnutls_x509_crt_import(cert, &pem_cert, GNUTLS_X509_FMT_PEM)) 370 if (GNUTLS_E_SUCCESS == gnutls_x509_crt_import(cert, &pem_cert, GNUTLS_X509_FMT_PEM))
368 ret = IPHONE_E_SUCCESS; 371 ret = USERPREF_E_SUCCESS;
369 else 372 else
370 ret = IPHONE_E_SSL_ERROR; 373 ret = USERPREF_E_SSL_ERROR;
371 } 374 }
372 gnutls_free(pem_cert.data); 375 gnutls_free(pem_cert.data);
373 return ret; 376 return ret;
@@ -383,41 +386,41 @@ static iphone_error_t import_crt(const char* crt_name, gnutls_x509_crt_t cert)
383 * @param host_privkey The host private key. 386 * @param host_privkey The host private key.
384 * @param host_crt The host certificate. 387 * @param host_crt The host certificate.
385 * 388 *
386 * @return IPHONE_E_SUCCESS if the keys and certificates were successfully retrieved. 389 * @return 1 if the keys and certificates were successfully retrieved, 0 otherwise
387 */ 390 */
388iphone_error_t get_keys_and_certs(gnutls_x509_privkey_t root_privkey, gnutls_x509_crt_t root_crt, gnutls_x509_privkey_t host_privkey, gnutls_x509_crt_t host_crt) 391userpref_error_t userpref_get_keys_and_certs(gnutls_x509_privkey_t root_privkey, gnutls_x509_crt_t root_crt, gnutls_x509_privkey_t host_privkey, gnutls_x509_crt_t host_crt)
389{ 392{
390 iphone_error_t ret = IPHONE_E_SUCCESS; 393 userpref_error_t ret = USERPREF_E_SUCCESS;
391 394
392 if (ret == IPHONE_E_SUCCESS) 395 if (ret == USERPREF_E_SUCCESS)
393 ret = import_key(LIBIPHONE_ROOT_PRIVKEY, root_privkey); 396 ret = userpref_import_key(LIBIPHONE_ROOT_PRIVKEY, root_privkey);
394 397
395 if (ret == IPHONE_E_SUCCESS) 398 if (ret == USERPREF_E_SUCCESS)
396 ret = import_key(LIBIPHONE_HOST_PRIVKEY, host_privkey); 399 ret = userpref_import_key(LIBIPHONE_HOST_PRIVKEY, host_privkey);
397 400
398 if (ret == IPHONE_E_SUCCESS) 401 if (ret == USERPREF_E_SUCCESS)
399 ret = import_crt(LIBIPHONE_ROOT_CERTIF, root_crt); 402 ret = userpref_import_crt(LIBIPHONE_ROOT_CERTIF, root_crt);
400 403
401 if (ret == IPHONE_E_SUCCESS) 404 if (ret == USERPREF_E_SUCCESS)
402 ret = import_crt(LIBIPHONE_HOST_CERTIF, host_crt); 405 ret = userpref_import_crt(LIBIPHONE_HOST_CERTIF, host_crt);
403 406
404 407
405 if (IPHONE_E_SUCCESS != ret) { 408 if (USERPREF_E_SUCCESS != ret) {
406 //we had problem reading or importing root cert 409 //we had problem reading or importing root cert
407 //try with a new ones. 410 //try with a new ones.
408 ret = gen_keys_and_cert(); 411 ret = userpref_gen_keys_and_cert();
409 412
410 if (ret == IPHONE_E_SUCCESS) 413 if (ret == USERPREF_E_SUCCESS)
411 ret = import_key(LIBIPHONE_ROOT_PRIVKEY, root_privkey); 414 ret = userpref_import_key(LIBIPHONE_ROOT_PRIVKEY, root_privkey);
412 415
413 if (ret == IPHONE_E_SUCCESS) 416 if (ret == USERPREF_E_SUCCESS)
414 ret = import_key(LIBIPHONE_HOST_PRIVKEY, host_privkey); 417 ret = userpref_import_key(LIBIPHONE_HOST_PRIVKEY, host_privkey);
415 418
416 if (ret == IPHONE_E_SUCCESS) 419 if (ret == USERPREF_E_SUCCESS)
417 ret = import_crt(LIBIPHONE_ROOT_CERTIF, root_crt); 420 ret = userpref_import_crt(LIBIPHONE_ROOT_CERTIF, root_crt);
418 421
419 if (ret == IPHONE_E_SUCCESS) 422 if (ret == USERPREF_E_SUCCESS)
420 ret = import_crt(LIBIPHONE_HOST_CERTIF, host_crt); 423 ret = userpref_import_crt(LIBIPHONE_HOST_CERTIF, host_crt);
421 } 424 }
422 425
423 return ret; 426 return ret;
@@ -428,46 +431,43 @@ iphone_error_t get_keys_and_certs(gnutls_x509_privkey_t root_privkey, gnutls_x50
428 * @param pem_root_cert The root certificate. 431 * @param pem_root_cert The root certificate.
429 * @param pem_host_cert The host certificate. 432 * @param pem_host_cert The host certificate.
430 * 433 *
431 * @return IPHONE_E_SUCCESS if the certificates were successfully retrieved. 434 * @return 1 if the certificates were successfully retrieved, 0 otherwise
432 */ 435 */
433iphone_error_t get_certs_as_pem(gnutls_datum_t *pem_root_cert, gnutls_datum_t *pem_host_cert) 436userpref_error_t userpref_get_certs_as_pem(gnutls_datum_t *pem_root_cert, gnutls_datum_t *pem_host_cert)
434{ 437{
435 iphone_error_t ret = IPHONE_E_INVALID_CONF; 438 if (!pem_root_cert || !pem_host_cert)
436 439 return USERPREF_E_INVALID_ARG;
437 if ( !pem_root_cert || !pem_host_cert)
438 return IPHONE_E_INVALID_ARG;
439 440
440 if ( read_file_in_confdir(LIBIPHONE_ROOT_CERTIF, pem_root_cert) && read_file_in_confdir(LIBIPHONE_HOST_CERTIF, pem_host_cert)) 441 if (userpref_get_file_contents(LIBIPHONE_ROOT_CERTIF, pem_root_cert) && userpref_get_file_contents(LIBIPHONE_HOST_CERTIF, pem_host_cert))
441 ret = IPHONE_E_SUCCESS; 442 return USERPREF_E_SUCCESS;
442 else { 443 else {
443 g_free(pem_root_cert->data); 444 g_free(pem_root_cert->data);
444 g_free(pem_host_cert->data); 445 g_free(pem_host_cert->data);
445 } 446 }
446 return ret; 447 return USERPREF_E_INVALID_CONF;
447} 448}
449
448/** Create and save a configuration file containing the given data. 450/** Create and save a configuration file containing the given data.
449 * 451 *
450 * @note: All fields must specified and be non-null 452 * @note: All fields must specified and be non-null
451 * 453 *
452 * @param host_id The UUID of the host
453 * @param root_key The root key 454 * @param root_key The root key
454 * @param host_key The host key
455 * @param root_cert The root certificate 455 * @param root_cert The root certificate
456 * @param host_key The host key
456 * @param host_cert The host certificate 457 * @param host_cert The host certificate
457 * 458 *
458 * @return 1 on success and 0 otherwise. 459 * @return 1 on success and 0 otherwise.
459 */ 460 */
460int init_config_file( gnutls_datum_t * root_key, gnutls_datum_t * host_key, gnutls_datum_t * root_cert, 461userpref_error_t userpref_set_keys_and_certs(gnutls_datum_t * root_key, gnutls_datum_t * root_cert, gnutls_datum_t * host_key, gnutls_datum_t * host_cert)
461 gnutls_datum_t * host_cert)
462{ 462{
463 FILE *pFile; 463 FILE *pFile;
464 gchar *pem; 464 gchar *pem;
465 465
466 if (!root_key || !host_key || !root_cert || !host_cert) 466 if (!root_key || !host_key || !root_cert || !host_cert)
467 return 0; 467 return USERPREF_E_INVALID_ARG;
468 468
469 /* Make sure config directory exists */ 469 /* Make sure config directory exists */
470 create_config_dir(); 470 userpref_create_config_dir();
471 471
472 /* Now write keys and certificates to disk */ 472 /* Now write keys and certificates to disk */
473 pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_ROOT_PRIVKEY, NULL); 473 pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_ROOT_PRIVKEY, NULL);
@@ -494,5 +494,5 @@ int init_config_file( gnutls_datum_t * root_key, gnutls_datum_t * host_key, gnut
494 fclose(pFile); 494 fclose(pFile);
495 g_free(pem); 495 g_free(pem);
496 496
497 return 1; 497 return USERPREF_E_SUCCESS;
498} 498}