--- a/src/protocols/silc/util.c Tue Apr 18 21:16:45 2006 +0000
+++ b/src/protocols/silc/util.c Wed Apr 19 02:12:45 2006 +0000
@@ -75,6 +75,7 @@
@@ -225,6 +226,7 @@
+ fd = open(file_private_key, O_RDONLY); if ((g_stat(file_private_key, &st)) == -1) {
/* If file doesn't exist */
@@ -234,10 +236,15 @@
file_public_key, file_private_key, NULL,
(gc->password == NULL) ? "" : gc->password,
NULL, NULL, NULL, FALSE);
+ fd = open(file_private_key, O_RDONLY); g_stat(file_private_key, &st);
gaim_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
file_private_key, strerror(errno));
@@ -246,23 +253,30 @@
/* Check the owner of the private key */
if (st.st_uid != 0 && st.st_uid != pw->pw_uid) {
gaim_debug_error("silc", "You don't seem to own your private key!?\n");
/* Check the permissions for the private key */
if ((st.st_mode & 0777) != 0600) {
gaim_debug_warning("silc", "Wrong permissions in your private key file `%s'!\n"
- "Trying to change them ... ", file_private_key);
- if ((chmod(file_private_key, 0600)) == -1) {
+ "Trying to change them ...\n", file_private_key); + if ((fd != -1) && (fchmod(fd, S_IRUSR | S_IWUSR)) == -1) { "Failed to change permissions for private key file!\n"
"Permissions for your private key file must be 0600.\n");
gaim_debug_warning("silc", "Done.\n\n");