~ubuntu-branches/ubuntu/hardy/pidgin/hardy

« back to all changes in this revision

Viewing changes to libpurple/protocols/silc/util.c

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2007-12-21 02:48:06 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071221024806-pd44a5k9tiyh12mp
Tags: 1:2.3.1-2ubuntu1
* Sync with Debian, remaining Ubuntu changes; (LP: #177811)
  - Set Maintainer to Ubuntu Core Developers.
  - Add build-deps on liblaunchpad-integration-dev, intltool,
    libnm-glib-dev (for --enable-nm) (Ubuntu #112720).
  - Drop build-deps on libsilc-1.1-2-dev | libsilc-dev (>= 1.1.1) as 
    this library is in universe.
  - Drop the libpurple0 recommends on libpurple-bin.
  - Add a gaim transitionnal package for upgrades.
  - Ship compatibility symlinks via debian/gaim.links.
  - Pass --enable-nm to configure to enable NetworkManager support.
  - Pass --disable-silc to configure to disable silc support even if 
    it's installed in the build environment.
  - Add X-Ubuntu-Gettext-Domain to the desktop file and update the
    translation templates in common-install-impl::.
   - Update debian/prefs.xml to set the notify plugin prefs
    /plugins/gtk/X11/notify/* and set /pidgin/plugins/loaded to load 
    the notify plugin; Ubuntu: #13389.
  - Add LPI integration patch, 02_lpi.
  - Add patch 04_let_crasher_for_apport to stop catching the SIGSEGV signal
    and let apport handle it.
  - Add patch 05_default_to_irc_ubuntu_com to set the default IRC 
    server to irc.ubuntu.com.
  - Add autoconf patch, 70_autoconf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
        pw = getpwuid(getuid());
81
81
        if (!pw) {
82
 
                purple_debug_error("silc", "silc: %s\n", strerror(errno));
 
82
                purple_debug_error("silc", "silc: %s\n", g_strerror(errno));
83
83
                return FALSE;
84
84
        }
85
85
 
108
108
                                return FALSE;
109
109
                        }
110
110
                } else {
111
 
                        purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", filename, strerror(errno));
 
111
                        purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", filename, g_strerror(errno));
112
112
                        return FALSE;
113
113
                }
114
114
        } else {
140
140
                        }
141
141
                } else {
142
142
                        purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n",
143
 
                                                         servfilename, strerror(errno));
 
143
                                                         servfilename, g_strerror(errno));
144
144
                        return FALSE;
145
145
                }
146
146
        }
163
163
                        }
164
164
                } else {
165
165
                        purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n",
166
 
                                                         clientfilename, strerror(errno));
 
166
                                                         clientfilename, g_strerror(errno));
167
167
                        return FALSE;
168
168
                }
169
169
        }
186
186
                        }
187
187
                } else {
188
188
                        purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n",
189
 
                                                         friendsfilename, strerror(errno));
 
189
                                                         friendsfilename, g_strerror(errno));
190
190
                        return FALSE;
191
191
                }
192
192
        }
212
212
                                                  (gc->password == NULL)
213
213
                                                  ? "" : gc->password,
214
214
                                                  NULL, NULL, FALSE)) {
215
 
                                purple_connection_error(gc, _("Cannot create SILC key pair\n"));
 
215
                                purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
 
216
                                                             _("Cannot create SILC key pair\n"));
216
217
                                return FALSE;
217
218
                        }
218
219
 
219
220
                        if ((g_stat(file_public_key, &st)) == -1) {
220
221
                                purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n",
221
 
                                                   file_public_key, strerror(errno));
 
222
                                                   file_public_key, g_strerror(errno));
222
223
                                return FALSE;
223
224
                        }
224
225
                } else {
225
226
                        purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n",
226
 
                                           file_public_key, strerror(errno));
 
227
                                           file_public_key, g_strerror(errno));
227
228
                        return FALSE;
228
229
                }
229
230
        }
239
240
        if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) {
240
241
                if ((fstat(fd, &st)) == -1) {
241
242
                        purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
242
 
                                           file_private_key, strerror(errno));
 
243
                                           file_private_key, g_strerror(errno));
243
244
                        close(fd);
244
245
                        return FALSE;
245
246
                }
254
255
                                                  (gc->password == NULL)
255
256
                                                  ? "" : gc->password,
256
257
                                                  NULL, NULL, FALSE)) {
257
 
                                purple_connection_error(gc, _("Cannot create SILC key pair\n"));
 
258
                                purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
 
259
                                                             _("Cannot create SILC key pair\n"));
258
260
                                return FALSE;
259
261
                        }
260
262
 
261
263
                        if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) {
262
264
                                if ((fstat(fd, &st)) == -1) {
263
265
                                        purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
264
 
                                                           file_private_key, strerror(errno));
 
266
                                                           file_private_key, g_strerror(errno));
265
267
                                        close(fd);
266
268
                                        return FALSE;
267
269
                                }
270
272
                         * will set the permissions */
271
273
                        else if ((g_stat(file_private_key, &st)) == -1) {
272
274
                                purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
273
 
                                                   file_private_key, strerror(errno));
 
275
                                                   file_private_key, g_strerror(errno));
274
276
                                return FALSE;
275
277
                        }
276
278
                } else {
277
279
                        purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
278
 
                                           file_private_key, strerror(errno));
 
280
                                           file_private_key, g_strerror(errno));
279
281
                        return FALSE;
280
282
                }
281
283
        }
347
349
        key_len = silc_pkcs_public_key_get_len(public_key);
348
350
 
349
351
        pk = silc_pkcs_public_key_encode(public_key, &pk_len);
 
352
        if (!pk)
 
353
          return;
350
354
        fingerprint = silc_hash_fingerprint(NULL, pk, pk_len);
351
355
        babbleprint = silc_hash_babbleprint(NULL, pk, pk_len);
 
356
        if (!fingerprint || !babbleprint)
 
357
          return;
352
358
 
353
359
        s = g_string_new("");
354
360
        if (ident->realname)