The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / libpurple / plugins / perl / common / Certificate.c @ a274da4f

History | View | Annotate | Download (31.4 KB)

1
/*
2
 * This file was generated automatically by ExtUtils::ParseXS version 3.18 from the
3
 * contents of Certificate.xs. Do not edit this file, edit Certificate.xs instead.
4
 *
5
 *    ANY CHANGES MADE HERE WILL BE LOST!
6
 *
7
 */
8

    
9
#line 1 "Certificate.xs"
10
#include "module.h"
11

    
12
struct cb_data {
13
        SV *cb;
14
        SV *user_data;
15
};
16

    
17
static void cb_cert_verify(PurpleCertificateVerificationStatus st, struct cb_data *d) {
18
        dSP;
19

    
20
        ENTER;
21
        SAVETMPS;
22

    
23
        PUSHMARK(SP);
24

    
25
        XPUSHs(sv_2mortal(newSViv(st)));
26
        XPUSHs(d->user_data);
27

    
28
        PUTBACK;
29

    
30
        call_sv(d->cb, G_VOID | G_EVAL);
31

    
32
        if(SvTRUE(ERRSV)) {
33
                STRLEN l_a;
34
                purple_debug_warning("perl", "Failed to run 'certificate verify' callback: %s\n", SvPV(ERRSV, l_a));
35
        }
36

    
37
        FREETMPS;
38
        LEAVE;
39

    
40
        SvREFCNT_dec(d->cb);
41
        SvREFCNT_dec(d->user_data);
42

    
43
        g_free(d);
44
}
45

    
46
#line 47 "Certificate.c"
47
#ifndef PERL_UNUSED_VAR
48
#  define PERL_UNUSED_VAR(var) if (0) var = var
49
#endif
50

    
51
#ifndef dVAR
52
#  define dVAR                dNOOP
53
#endif
54

    
55

    
56
/* This stuff is not part of the API! You have been warned. */
57
#ifndef PERL_VERSION_DECIMAL
58
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
59
#endif
60
#ifndef PERL_DECIMAL_VERSION
61
#  define PERL_DECIMAL_VERSION \
62
          PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
63
#endif
64
#ifndef PERL_VERSION_GE
65
#  define PERL_VERSION_GE(r,v,s) \
66
          (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
67
#endif
68
#ifndef PERL_VERSION_LE
69
#  define PERL_VERSION_LE(r,v,s) \
70
          (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
71
#endif
72

    
73
/* XS_INTERNAL is the explicit static-linkage variant of the default
74
 * XS macro.
75
 *
76
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
77
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
78
 * for anything but the BOOT XSUB.
79
 *
80
 * See XSUB.h in core!
81
 */
82

    
83

    
84
/* TODO: This might be compatible further back than 5.10.0. */
85
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
86
#  undef XS_EXTERNAL
87
#  undef XS_INTERNAL
88
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
89
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
90
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
91
#  endif
92
#  if defined(__SYMBIAN32__)
93
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
94
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
95
#  endif
96
#  ifndef XS_EXTERNAL
97
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
98
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
99
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
100
#    else
101
#      ifdef __cplusplus
102
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
103
#        define XS_INTERNAL(name) static XSPROTO(name)
104
#      else
105
#        define XS_EXTERNAL(name) XSPROTO(name)
106
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
107
#      endif
108
#    endif
109
#  endif
110
#endif
111

    
112
/* perl >= 5.10.0 && perl <= 5.15.1 */
113

    
114

    
115
/* The XS_EXTERNAL macro is used for functions that must not be static
116
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
117
 * macro defined, the best we can do is assume XS is the same.
118
 * Dito for XS_INTERNAL.
119
 */
120
#ifndef XS_EXTERNAL
121
#  define XS_EXTERNAL(name) XS(name)
122
#endif
123
#ifndef XS_INTERNAL
124
#  define XS_INTERNAL(name) XS(name)
125
#endif
126

    
127
/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
128
 * internal macro that we're free to redefine for varying linkage due
129
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
130
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
131
 */
132

    
133
#undef XS_EUPXS
134
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
135
#  define XS_EUPXS(name) XS_EXTERNAL(name)
136
#else
137
   /* default to internal */
138
#  define XS_EUPXS(name) XS_INTERNAL(name)
139
#endif
140

    
141
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
142
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
143

    
144
/* prototype to pass -Wmissing-prototypes */
145
STATIC void
146
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
147

    
148
STATIC void
149
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
150
{
151
    const GV *const gv = CvGV(cv);
152

    
153
    PERL_ARGS_ASSERT_CROAK_XS_USAGE;
154

    
155
    if (gv) {
156
        const char *const gvname = GvNAME(gv);
157
        const HV *const stash = GvSTASH(gv);
158
        const char *const hvname = stash ? HvNAME(stash) : NULL;
159

    
160
        if (hvname)
161
            Perl_croak(aTHX_ "Usage: %s::%s(%s)", hvname, gvname, params);
162
        else
163
            Perl_croak(aTHX_ "Usage: %s(%s)", gvname, params);
164
    } else {
165
        /* Pants. I don't think that it should be possible to get here. */
166
        Perl_croak(aTHX_ "Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
167
    }
168
}
169
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE
170

    
171
#ifdef PERL_IMPLICIT_CONTEXT
172
#define croak_xs_usage(a,b)    S_croak_xs_usage(aTHX_ a,b)
173
#else
174
#define croak_xs_usage        S_croak_xs_usage
175
#endif
176

    
177
#endif
178

    
179
/* NOTE: the prototype of newXSproto() is different in versions of perls,
180
 * so we define a portable version of newXSproto()
181
 */
182
#ifdef newXS_flags
183
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
184
#else
185
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
186
#endif /* !defined(newXS_flags) */
187

    
188
#line 189 "Certificate.c"
189

    
190
XS_EUPXS(XS_Purple__Certificate_add_ca_search_path); /* prototype to pass -Wmissing-prototypes */
191
XS_EUPXS(XS_Purple__Certificate_add_ca_search_path)
192
{
193
    dVAR; dXSARGS;
194
    if (items != 1)
195
       croak_xs_usage(cv,  "path");
196
    {
197
        const char*        path = (const char *)SvPV_nolen(ST(0))
198
;
199

    
200
        purple_certificate_add_ca_search_path(path);
201
    }
202
    XSRETURN_EMPTY;
203
}
204

    
205

    
206
XS_EUPXS(XS_Purple__Certificate_check_subject_name); /* prototype to pass -Wmissing-prototypes */
207
XS_EUPXS(XS_Purple__Certificate_check_subject_name)
208
{
209
    dVAR; dXSARGS;
210
    if (items != 2)
211
       croak_xs_usage(cv,  "crt, name");
212
    {
213
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
214
;
215
        const gchar*        name = (const gchar *)SvPV_nolen(ST(1))
216
;
217
        gboolean        RETVAL;
218

    
219
        RETVAL = purple_certificate_check_subject_name(crt, name);
220
        ST(0) = sv_newmortal();
221
        ST(0) = boolSV(RETVAL);
222
    }
223
    XSRETURN(1);
224
}
225

    
226

    
227
XS_EUPXS(XS_Purple__Certificate_copy); /* prototype to pass -Wmissing-prototypes */
228
XS_EUPXS(XS_Purple__Certificate_copy)
229
{
230
    dVAR; dXSARGS;
231
    if (items != 1)
232
       croak_xs_usage(cv,  "crt");
233
    {
234
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
235
;
236
        Purple__Certificate        RETVAL;
237

    
238
        RETVAL = purple_certificate_copy(crt);
239
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Certificate");
240
        sv_2mortal(ST(0));
241
    }
242
    XSRETURN(1);
243
}
244

    
245

    
246
XS_EUPXS(XS_Purple__Certificate_destroy); /* prototype to pass -Wmissing-prototypes */
247
XS_EUPXS(XS_Purple__Certificate_destroy)
248
{
249
    dVAR; dXSARGS;
250
    if (items != 1)
251
       croak_xs_usage(cv,  "crt");
252
    {
253
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
254
;
255

    
256
        purple_certificate_destroy(crt);
257
    }
258
    XSRETURN_EMPTY;
259
}
260

    
261

    
262
XS_EUPXS(XS_Purple__Certificate_display_x509); /* prototype to pass -Wmissing-prototypes */
263
XS_EUPXS(XS_Purple__Certificate_display_x509)
264
{
265
    dVAR; dXSARGS;
266
    if (items != 1)
267
       croak_xs_usage(cv,  "crt");
268
    {
269
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
270
;
271

    
272
        purple_certificate_display_x509(crt);
273
    }
274
    XSRETURN_EMPTY;
275
}
276

    
277

    
278
XS_EUPXS(XS_Purple__Certificate_export); /* prototype to pass -Wmissing-prototypes */
279
XS_EUPXS(XS_Purple__Certificate_export)
280
{
281
    dVAR; dXSARGS;
282
    if (items != 2)
283
       croak_xs_usage(cv,  "crt, filename");
284
    {
285
        const gchar*        filename = (const gchar *)SvPV_nolen(ST(1))
286
;
287
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
288
;
289
        gboolean        RETVAL;
290

    
291
        RETVAL = purple_certificate_export(filename, crt);
292
        ST(0) = sv_newmortal();
293
        ST(0) = boolSV(RETVAL);
294
    }
295
    XSRETURN(1);
296
}
297

    
298

    
299
XS_EUPXS(XS_Purple__Certificate_find_pool); /* prototype to pass -Wmissing-prototypes */
300
XS_EUPXS(XS_Purple__Certificate_find_pool)
301
{
302
    dVAR; dXSARGS;
303
    if (items != 2)
304
       croak_xs_usage(cv,  "scheme_name, pool_name");
305
    {
306
        const gchar*        scheme_name = (const gchar *)SvPV_nolen(ST(0))
307
;
308
        const gchar*        pool_name = (const gchar *)SvPV_nolen(ST(1))
309
;
310
        Purple__Certificate__Pool        RETVAL;
311

    
312
        RETVAL = purple_certificate_find_pool(scheme_name, pool_name);
313
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Certificate::Pool");
314
        sv_2mortal(ST(0));
315
    }
316
    XSRETURN(1);
317
}
318

    
319

    
320
XS_EUPXS(XS_Purple__Certificate_find_scheme); /* prototype to pass -Wmissing-prototypes */
321
XS_EUPXS(XS_Purple__Certificate_find_scheme)
322
{
323
    dVAR; dXSARGS;
324
    if (items != 1)
325
       croak_xs_usage(cv,  "name");
326
    {
327
        const gchar*        name = (const gchar *)SvPV_nolen(ST(0))
328
;
329
        Purple__Certificate__Scheme        RETVAL;
330

    
331
        RETVAL = purple_certificate_find_scheme(name);
332
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Certificate::Scheme");
333
        sv_2mortal(ST(0));
334
    }
335
    XSRETURN(1);
336
}
337

    
338

    
339
XS_EUPXS(XS_Purple__Certificate_find_verifier); /* prototype to pass -Wmissing-prototypes */
340
XS_EUPXS(XS_Purple__Certificate_find_verifier)
341
{
342
    dVAR; dXSARGS;
343
    if (items != 2)
344
       croak_xs_usage(cv,  "scheme_name, ver_name");
345
    {
346
        const gchar*        scheme_name = (const gchar *)SvPV_nolen(ST(0))
347
;
348
        const gchar*        ver_name = (const gchar *)SvPV_nolen(ST(1))
349
;
350
        Purple__Certificate__Verifier        RETVAL;
351

    
352
        RETVAL = purple_certificate_find_verifier(scheme_name, ver_name);
353
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Certificate::Verifier");
354
        sv_2mortal(ST(0));
355
    }
356
    XSRETURN(1);
357
}
358

    
359

    
360
XS_EUPXS(XS_Purple__Certificate_get_handle); /* prototype to pass -Wmissing-prototypes */
361
XS_EUPXS(XS_Purple__Certificate_get_handle)
362
{
363
    dVAR; dXSARGS;
364
    if (items != 0)
365
       croak_xs_usage(cv,  "");
366
    {
367
        Purple__Handle        RETVAL;
368

    
369
        RETVAL = purple_certificate_get_handle();
370
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Handle");
371
        sv_2mortal(ST(0));
372
    }
373
    XSRETURN(1);
374
}
375

    
376

    
377
XS_EUPXS(XS_Purple__Certificate_get_issuer_unique_id); /* prototype to pass -Wmissing-prototypes */
378
XS_EUPXS(XS_Purple__Certificate_get_issuer_unique_id)
379
{
380
    dVAR; dXSARGS;
381
    if (items != 1)
382
       croak_xs_usage(cv,  "crt");
383
    {
384
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
385
;
386
        gchar_own *        RETVAL;
387

    
388
        RETVAL = purple_certificate_get_issuer_unique_id(crt);
389
        ST(0) = sv_newmortal();
390
        /* used when we can directly own the returned string. */
391
        /* we have to copy in the case when perl's malloc != gtk's malloc,
392
         * so best copy all the time. */
393
        sv_setpv ((SV*)ST(0), RETVAL);
394
        SvUTF8_on (ST(0));
395
        g_free (RETVAL);
396
    }
397
    XSRETURN(1);
398
}
399

    
400

    
401
XS_EUPXS(XS_Purple__Certificate_get_subject_name); /* prototype to pass -Wmissing-prototypes */
402
XS_EUPXS(XS_Purple__Certificate_get_subject_name)
403
{
404
    dVAR; dXSARGS;
405
    if (items != 1)
406
       croak_xs_usage(cv,  "crt");
407
    {
408
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
409
;
410
        gchar_own *        RETVAL;
411

    
412
        RETVAL = purple_certificate_get_subject_name(crt);
413
        ST(0) = sv_newmortal();
414
        /* used when we can directly own the returned string. */
415
        /* we have to copy in the case when perl's malloc != gtk's malloc,
416
         * so best copy all the time. */
417
        sv_setpv ((SV*)ST(0), RETVAL);
418
        SvUTF8_on (ST(0));
419
        g_free (RETVAL);
420
    }
421
    XSRETURN(1);
422
}
423

    
424

    
425
XS_EUPXS(XS_Purple__Certificate_get_unique_id); /* prototype to pass -Wmissing-prototypes */
426
XS_EUPXS(XS_Purple__Certificate_get_unique_id)
427
{
428
    dVAR; dXSARGS;
429
    if (items != 1)
430
       croak_xs_usage(cv,  "crt");
431
    {
432
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
433
;
434
        gchar_own *        RETVAL;
435

    
436
        RETVAL = purple_certificate_get_unique_id(crt);
437
        ST(0) = sv_newmortal();
438
        /* used when we can directly own the returned string. */
439
        /* we have to copy in the case when perl's malloc != gtk's malloc,
440
         * so best copy all the time. */
441
        sv_setpv ((SV*)ST(0), RETVAL);
442
        SvUTF8_on (ST(0));
443
        g_free (RETVAL);
444
    }
445
    XSRETURN(1);
446
}
447

    
448

    
449
XS_EUPXS(XS_Purple__Certificate_import); /* prototype to pass -Wmissing-prototypes */
450
XS_EUPXS(XS_Purple__Certificate_import)
451
{
452
    dVAR; dXSARGS;
453
    if (items != 2)
454
       croak_xs_usage(cv,  "scheme, filename");
455
    {
456
        Purple__Certificate__Scheme        scheme = purple_perl_ref_object(ST(0))
457
;
458
        const gchar*        filename = (const gchar *)SvPV_nolen(ST(1))
459
;
460
        Purple__Certificate        RETVAL;
461

    
462
        RETVAL = purple_certificate_import(scheme, filename);
463
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Certificate");
464
        sv_2mortal(ST(0));
465
    }
466
    XSRETURN(1);
467
}
468

    
469

    
470
XS_EUPXS(XS_Purple__Certificate_register_pool); /* prototype to pass -Wmissing-prototypes */
471
XS_EUPXS(XS_Purple__Certificate_register_pool)
472
{
473
    dVAR; dXSARGS;
474
    if (items != 1)
475
       croak_xs_usage(cv,  "pool");
476
    {
477
        Purple__Certificate__Pool        pool = purple_perl_ref_object(ST(0))
478
;
479
        gboolean        RETVAL;
480

    
481
        RETVAL = purple_certificate_register_pool(pool);
482
        ST(0) = sv_newmortal();
483
        ST(0) = boolSV(RETVAL);
484
    }
485
    XSRETURN(1);
486
}
487

    
488

    
489
XS_EUPXS(XS_Purple__Certificate_register_scheme); /* prototype to pass -Wmissing-prototypes */
490
XS_EUPXS(XS_Purple__Certificate_register_scheme)
491
{
492
    dVAR; dXSARGS;
493
    if (items != 1)
494
       croak_xs_usage(cv,  "scheme");
495
    {
496
        Purple__Certificate__Scheme        scheme = purple_perl_ref_object(ST(0))
497
;
498
        gboolean        RETVAL;
499

    
500
        RETVAL = purple_certificate_register_scheme(scheme);
501
        ST(0) = sv_newmortal();
502
        ST(0) = boolSV(RETVAL);
503
    }
504
    XSRETURN(1);
505
}
506

    
507

    
508
XS_EUPXS(XS_Purple__Certificate_register_verifier); /* prototype to pass -Wmissing-prototypes */
509
XS_EUPXS(XS_Purple__Certificate_register_verifier)
510
{
511
    dVAR; dXSARGS;
512
    if (items != 1)
513
       croak_xs_usage(cv,  "vr");
514
    {
515
        Purple__Certificate__Verifier        vr = purple_perl_ref_object(ST(0))
516
;
517
        gboolean        RETVAL;
518

    
519
        RETVAL = purple_certificate_register_verifier(vr);
520
        ST(0) = sv_newmortal();
521
        ST(0) = boolSV(RETVAL);
522
    }
523
    XSRETURN(1);
524
}
525

    
526

    
527
XS_EUPXS(XS_Purple__Certificate_signed_by); /* prototype to pass -Wmissing-prototypes */
528
XS_EUPXS(XS_Purple__Certificate_signed_by)
529
{
530
    dVAR; dXSARGS;
531
    if (items != 2)
532
       croak_xs_usage(cv,  "crt, issuer");
533
    {
534
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
535
;
536
        Purple__Certificate        issuer = purple_perl_ref_object(ST(1))
537
;
538
        gboolean        RETVAL;
539

    
540
        RETVAL = purple_certificate_signed_by(crt, issuer);
541
        ST(0) = sv_newmortal();
542
        ST(0) = boolSV(RETVAL);
543
    }
544
    XSRETURN(1);
545
}
546

    
547

    
548
XS_EUPXS(XS_Purple__Certificate_unregister_pool); /* prototype to pass -Wmissing-prototypes */
549
XS_EUPXS(XS_Purple__Certificate_unregister_pool)
550
{
551
    dVAR; dXSARGS;
552
    if (items != 1)
553
       croak_xs_usage(cv,  "pool");
554
    {
555
        Purple__Certificate__Pool        pool = purple_perl_ref_object(ST(0))
556
;
557
        gboolean        RETVAL;
558

    
559
        RETVAL = purple_certificate_unregister_pool(pool);
560
        ST(0) = sv_newmortal();
561
        ST(0) = boolSV(RETVAL);
562
    }
563
    XSRETURN(1);
564
}
565

    
566

    
567
XS_EUPXS(XS_Purple__Certificate_unregister_scheme); /* prototype to pass -Wmissing-prototypes */
568
XS_EUPXS(XS_Purple__Certificate_unregister_scheme)
569
{
570
    dVAR; dXSARGS;
571
    if (items != 1)
572
       croak_xs_usage(cv,  "scheme");
573
    {
574
        Purple__Certificate__Scheme        scheme = purple_perl_ref_object(ST(0))
575
;
576
        gboolean        RETVAL;
577

    
578
        RETVAL = purple_certificate_unregister_scheme(scheme);
579
        ST(0) = sv_newmortal();
580
        ST(0) = boolSV(RETVAL);
581
    }
582
    XSRETURN(1);
583
}
584

    
585

    
586
XS_EUPXS(XS_Purple__Certificate_unregister_verifier); /* prototype to pass -Wmissing-prototypes */
587
XS_EUPXS(XS_Purple__Certificate_unregister_verifier)
588
{
589
    dVAR; dXSARGS;
590
    if (items != 1)
591
       croak_xs_usage(cv,  "vr");
592
    {
593
        Purple__Certificate__Verifier        vr = purple_perl_ref_object(ST(0))
594
;
595
        gboolean        RETVAL;
596

    
597
        RETVAL = purple_certificate_unregister_verifier(vr);
598
        ST(0) = sv_newmortal();
599
        ST(0) = boolSV(RETVAL);
600
    }
601
    XSRETURN(1);
602
}
603

    
604

    
605
XS_EUPXS(XS_Purple__Certificate_verify_complete); /* prototype to pass -Wmissing-prototypes */
606
XS_EUPXS(XS_Purple__Certificate_verify_complete)
607
{
608
    dVAR; dXSARGS;
609
    if (items != 2)
610
       croak_xs_usage(cv,  "vrq, st");
611
    {
612
        Purple__Certificate__VerificationRequest        vrq = purple_perl_ref_object(ST(0))
613
;
614
        Purple__Certificate__VerificationStatus        st = (Purple__Certificate__VerificationStatus)SvIV(ST(1))
615
;
616

    
617
        purple_certificate_verify_complete(vrq, st);
618
    }
619
    XSRETURN_EMPTY;
620
}
621

    
622

    
623
XS_EUPXS(XS_Purple__Certificate_get_times); /* prototype to pass -Wmissing-prototypes */
624
XS_EUPXS(XS_Purple__Certificate_get_times)
625
{
626
    dVAR; dXSARGS;
627
    if (items != 1)
628
       croak_xs_usage(cv,  "crt");
629
    {
630
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
631
;
632
        gboolean        RETVAL;
633
        time_t        activation;
634
        time_t        expiration;
635

    
636
        RETVAL = purple_certificate_get_times(crt, &activation, &expiration);
637
        ST(0) = sv_newmortal();
638
        ST(0) = boolSV(RETVAL);
639
        XSprePUSH;        EXTEND(SP,2);
640
        PUSHs(sv_newmortal());
641
        sv_setiv(ST(1), (IV)activation);
642
        PUSHs(sv_newmortal());
643
        sv_setiv(ST(2), (IV)expiration);
644
    }
645
    XSRETURN(3);
646
}
647

    
648

    
649
XS_EUPXS(XS_Purple__Certificate_destroy_list); /* prototype to pass -Wmissing-prototypes */
650
XS_EUPXS(XS_Purple__Certificate_destroy_list)
651
{
652
    dVAR; dXSARGS;
653
    PERL_UNUSED_VAR(cv); /* -W */
654
    {
655
#line 159 "Certificate.xs"
656
        GList* l = NULL;
657
        int i = 0;
658
#line 659 "Certificate.c"
659
#line 162 "Certificate.xs"
660
                for(i = 0; i < items; i++) { /* PurpleCertificate */
661
                        l = g_list_prepend(l, purple_perl_ref_object(ST(i)));
662
                }
663
                purple_certificate_destroy_list(l);
664
#line 665 "Certificate.c"
665
    }
666
    XSRETURN_EMPTY;
667
}
668

    
669

    
670
XS_EUPXS(XS_Purple__Certificate_get_pools); /* prototype to pass -Wmissing-prototypes */
671
XS_EUPXS(XS_Purple__Certificate_get_pools)
672
{
673
    dVAR; dXSARGS;
674
    if (items != 0)
675
       croak_xs_usage(cv,  "");
676
    PERL_UNUSED_VAR(ax); /* -Wall */
677
    SP -= items;
678
    {
679
#line 170 "Certificate.xs"
680
                GList *l;
681
#line 682 "Certificate.c"
682
#line 172 "Certificate.xs"
683
                for(l = purple_certificate_get_pools(); l; l = l->next) {
684
                        XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Pool")));
685
                }
686
#line 687 "Certificate.c"
687
        PUTBACK;
688
        return;
689
    }
690
}
691

    
692

    
693
XS_EUPXS(XS_Purple__Certificate_get_schemes); /* prototype to pass -Wmissing-prototypes */
694
XS_EUPXS(XS_Purple__Certificate_get_schemes)
695
{
696
    dVAR; dXSARGS;
697
    if (items != 0)
698
       croak_xs_usage(cv,  "");
699
    PERL_UNUSED_VAR(ax); /* -Wall */
700
    SP -= items;
701
    {
702
#line 179 "Certificate.xs"
703
                GList *l;
704
#line 705 "Certificate.c"
705
#line 181 "Certificate.xs"
706
                for(l = purple_certificate_get_schemes(); l; l = l->next) {
707
                        XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Scheme")));
708
                }
709
#line 710 "Certificate.c"
710
        PUTBACK;
711
        return;
712
    }
713
}
714

    
715

    
716
XS_EUPXS(XS_Purple__Certificate_get_verifiers); /* prototype to pass -Wmissing-prototypes */
717
XS_EUPXS(XS_Purple__Certificate_get_verifiers)
718
{
719
    dVAR; dXSARGS;
720
    if (items != 0)
721
       croak_xs_usage(cv,  "");
722
    PERL_UNUSED_VAR(ax); /* -Wall */
723
    SP -= items;
724
    {
725
#line 188 "Certificate.xs"
726
                GList *l;
727
#line 728 "Certificate.c"
728
#line 190 "Certificate.xs"
729
                for(l = purple_certificate_get_verifiers(); l; l = l->next) {
730
                        XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Verifier")));
731
                }
732
#line 733 "Certificate.c"
733
        PUTBACK;
734
        return;
735
    }
736
}
737

    
738

    
739
XS_EUPXS(XS_Purple__Certificate_check_signature_chain); /* prototype to pass -Wmissing-prototypes */
740
XS_EUPXS(XS_Purple__Certificate_check_signature_chain)
741
{
742
    dVAR; dXSARGS;
743
    PERL_UNUSED_VAR(cv); /* -W */
744
    PERL_UNUSED_VAR(ax); /* -Wall */
745
    SP -= items;
746
    {
747
#line 197 "Certificate.xs"
748
                GList *l = NULL;
749
                gboolean ret;
750
                int i;
751
#line 752 "Certificate.c"
752
#line 201 "Certificate.xs"
753
                for(i = 0; i < items; i++) { /* PurpleCertificate */
754
                        l = g_list_prepend(l, purple_perl_ref_object(ST(i)));
755
                }
756
                l = g_list_reverse(l);
757
                ret = purple_certificate_check_signature_chain(l);
758
                g_list_free(l);
759
                if(ret) XSRETURN_YES;
760
                XSRETURN_NO;
761
#line 762 "Certificate.c"
762
        PUTBACK;
763
        return;
764
    }
765
}
766

    
767

    
768
XS_EUPXS(XS_Purple__Certificate_get_fingerprint_sha1); /* prototype to pass -Wmissing-prototypes */
769
XS_EUPXS(XS_Purple__Certificate_get_fingerprint_sha1)
770
{
771
    dVAR; dXSARGS;
772
    if (items != 1)
773
       croak_xs_usage(cv,  "crt");
774
    {
775
        Purple__Certificate        crt = purple_perl_ref_object(ST(0))
776
;
777
#line 214 "Certificate.xs"
778
                GByteArray *gba = NULL;
779
#line 780 "Certificate.c"
780
        SV *        RETVAL;
781
#line 216 "Certificate.xs"
782
                gba = purple_certificate_get_fingerprint_sha1(crt);
783
                RETVAL = newSVpv((gchar *)gba->data, gba->len);
784
                g_byte_array_free(gba, TRUE);
785
#line 786 "Certificate.c"
786
        ST(0) = RETVAL;
787
        sv_2mortal(ST(0));
788
    }
789
    XSRETURN(1);
790
}
791

    
792

    
793
XS_EUPXS(XS_Purple__Certificate_verify); /* prototype to pass -Wmissing-prototypes */
794
XS_EUPXS(XS_Purple__Certificate_verify)
795
{
796
    dVAR; dXSARGS;
797
    if (items != 5)
798
       croak_xs_usage(cv,  "verifier, subject_name, cert_chain, cb, cb_data");
799
    PERL_UNUSED_VAR(ax); /* -Wall */
800
    SP -= items;
801
    {
802
        Purple__Certificate__Verifier        verifier = purple_perl_ref_object(ST(0))
803
;
804
        const gchar*        subject_name = (const gchar *)SvPV_nolen(ST(1))
805
;
806
        AV*        cert_chain;
807
        CV *        cb;
808
        SV *        cb_data = ST(4)
809
;
810
#line 230 "Certificate.xs"
811
                GList *l = NULL;
812
                int len = 0, i = 0;
813
                struct cb_data *d = NULL;
814
#line 815 "Certificate.c"
815

    
816
        STMT_START {
817
                SV* const xsub_tmp_sv = ST(2);
818
                SvGETMAGIC(xsub_tmp_sv);
819
                if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVAV){
820
                    cert_chain = (AV*)SvRV(xsub_tmp_sv);
821
                }
822
                else{
823
                    Perl_croak(aTHX_ "%s: %s is not an ARRAY reference",
824
                                "Purple::Certificate::verify",
825
                                "cert_chain");
826
                }
827
        } STMT_END
828
;
829

    
830
        STMT_START {
831
                HV *st;
832
                GV *gvp;
833
                SV * const xsub_tmp_sv = ST(3);
834
                SvGETMAGIC(xsub_tmp_sv);
835
                cb = sv_2cv(xsub_tmp_sv, &st, &gvp, 0);
836
                if (!cb) {
837
                    Perl_croak(aTHX_ "%s: %s is not a CODE reference",
838
                                "Purple::Certificate::verify",
839
                                "cb");
840
                }
841
        } STMT_END
842
;
843
#line 234 "Certificate.xs"
844
                len = av_len(cert_chain);
845
                for(i = 0; i <= len; i++) {
846
                        SV **sv = av_fetch(cert_chain, i, 0);
847
                        if(!sv || !purple_perl_is_ref_object(*sv)) {
848
                                g_list_free(l);
849
                                warn("Purple::Certificate::verify: cert_chain: non-purple object in array...");
850
                                XSRETURN_UNDEF;
851
                        }
852
                        l = g_list_prepend(l, purple_perl_ref_object(*sv));
853
                }
854
                l = g_list_reverse(l);
855

    
856
                d = g_new0(struct cb_data, 1);
857
                d->cb = newSVsv(ST(3));
858
                d->user_data = newSVsv(cb_data);
859

    
860
                purple_certificate_verify(verifier, subject_name, l, (PurpleCertificateVerifiedCallback) cb_cert_verify, d);
861

    
862
                g_list_free(l);
863
#line 864 "Certificate.c"
864
        PUTBACK;
865
        return;
866
    }
867
}
868

    
869

    
870
XS_EUPXS(XS_Purple__Certificate__Pool_get_idlist); /* prototype to pass -Wmissing-prototypes */
871
XS_EUPXS(XS_Purple__Certificate__Pool_get_idlist)
872
{
873
    dVAR; dXSARGS;
874
    if (items != 1)
875
       croak_xs_usage(cv,  "pool");
876
    PERL_UNUSED_VAR(ax); /* -Wall */
877
    SP -= items;
878
    {
879
        Purple__Certificate__Pool        pool = purple_perl_ref_object(ST(0))
880
;
881
#line 261 "Certificate.xs"
882
                GList *l, *b;
883
#line 884 "Certificate.c"
884
#line 263 "Certificate.xs"
885
                b = purple_certificate_pool_get_idlist(pool);
886
                for(l = b; l; l = l->next) {
887
                        XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
888
                }
889
                purple_certificate_pool_destroy_idlist(b);
890
#line 891 "Certificate.c"
891
        PUTBACK;
892
        return;
893
    }
894
}
895

    
896

    
897
XS_EUPXS(XS_Purple__Certificate__Pool_contains); /* prototype to pass -Wmissing-prototypes */
898
XS_EUPXS(XS_Purple__Certificate__Pool_contains)
899
{
900
    dVAR; dXSARGS;
901
    if (items != 2)
902
       croak_xs_usage(cv,  "pool, id");
903
    {
904
        Purple__Certificate__Pool        pool = purple_perl_ref_object(ST(0))
905
;
906
        const gchar*        id = (const gchar *)SvPV_nolen(ST(1))
907
;
908
        gboolean        RETVAL;
909

    
910
        RETVAL = purple_certificate_pool_contains(pool, id);
911
        ST(0) = sv_newmortal();
912
        ST(0) = boolSV(RETVAL);
913
    }
914
    XSRETURN(1);
915
}
916

    
917

    
918
XS_EUPXS(XS_Purple__Certificate__Pool_delete); /* prototype to pass -Wmissing-prototypes */
919
XS_EUPXS(XS_Purple__Certificate__Pool_delete)
920
{
921
    dVAR; dXSARGS;
922
    if (items != 2)
923
       croak_xs_usage(cv,  "pool, id");
924
    {
925
        Purple__Certificate__Pool        pool = purple_perl_ref_object(ST(0))
926
;
927
        const gchar*        id = (const gchar *)SvPV_nolen(ST(1))
928
;
929
        gboolean        RETVAL;
930

    
931
        RETVAL = purple_certificate_pool_delete(pool, id);
932
        ST(0) = sv_newmortal();
933
        ST(0) = boolSV(RETVAL);
934
    }
935
    XSRETURN(1);
936
}
937

    
938

    
939
XS_EUPXS(XS_Purple__Certificate__Pool_get_scheme); /* prototype to pass -Wmissing-prototypes */
940
XS_EUPXS(XS_Purple__Certificate__Pool_get_scheme)
941
{
942
    dVAR; dXSARGS;
943
    if (items != 1)
944
       croak_xs_usage(cv,  "pool");
945
    {
946
        Purple__Certificate__Pool        pool = purple_perl_ref_object(ST(0))
947
;
948
        Purple__Certificate__Scheme        RETVAL;
949

    
950
        RETVAL = purple_certificate_pool_get_scheme(pool);
951
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Certificate::Scheme");
952
        sv_2mortal(ST(0));
953
    }
954
    XSRETURN(1);
955
}
956

    
957

    
958
XS_EUPXS(XS_Purple__Certificate__Pool_mkpath); /* prototype to pass -Wmissing-prototypes */
959
XS_EUPXS(XS_Purple__Certificate__Pool_mkpath)
960
{
961
    dVAR; dXSARGS;
962
    if (items != 2)
963
       croak_xs_usage(cv,  "pool, id");
964
    {
965
        Purple__Certificate__Pool        pool = purple_perl_ref_object(ST(0))
966
;
967
        const gchar*        id = (const gchar *)SvPV_nolen(ST(1))
968
;
969
        gchar_own *        RETVAL;
970

    
971
        RETVAL = purple_certificate_pool_mkpath(pool, id);
972
        ST(0) = sv_newmortal();
973
        /* used when we can directly own the returned string. */
974
        /* we have to copy in the case when perl's malloc != gtk's malloc,
975
         * so best copy all the time. */
976
        sv_setpv ((SV*)ST(0), RETVAL);
977
        SvUTF8_on (ST(0));
978
        g_free (RETVAL);
979
    }
980
    XSRETURN(1);
981
}
982

    
983

    
984
XS_EUPXS(XS_Purple__Certificate__Pool_retrieve); /* prototype to pass -Wmissing-prototypes */
985
XS_EUPXS(XS_Purple__Certificate__Pool_retrieve)
986
{
987
    dVAR; dXSARGS;
988
    if (items != 2)
989
       croak_xs_usage(cv,  "pool, id");
990
    {
991
        Purple__Certificate__Pool        pool = purple_perl_ref_object(ST(0))
992
;
993
        const gchar*        id = (const gchar *)SvPV_nolen(ST(1))
994
;
995
        Purple__Certificate        RETVAL;
996

    
997
        RETVAL = purple_certificate_pool_retrieve(pool, id);
998
        ST(0) = purple_perl_bless_object(RETVAL, "Purple::Certificate");
999
        sv_2mortal(ST(0));
1000
    }
1001
    XSRETURN(1);
1002
}
1003

    
1004

    
1005
XS_EUPXS(XS_Purple__Certificate__Pool_store); /* prototype to pass -Wmissing-prototypes */
1006
XS_EUPXS(XS_Purple__Certificate__Pool_store)
1007
{
1008
    dVAR; dXSARGS;
1009
    if (items != 3)
1010
       croak_xs_usage(cv,  "pool, id, crt");
1011
    {
1012
        Purple__Certificate__Pool        pool = purple_perl_ref_object(ST(0))
1013
;
1014
        const gchar*        id = (const gchar *)SvPV_nolen(ST(1))
1015
;
1016
        Purple__Certificate        crt = purple_perl_ref_object(ST(2))
1017
;
1018
        gboolean        RETVAL;
1019

    
1020
        RETVAL = purple_certificate_pool_store(pool, id, crt);
1021
        ST(0) = sv_newmortal();
1022
        ST(0) = boolSV(RETVAL);
1023
    }
1024
    XSRETURN(1);
1025
}
1026

    
1027

    
1028
XS_EUPXS(XS_Purple__Certificate__Pool_usable); /* prototype to pass -Wmissing-prototypes */
1029
XS_EUPXS(XS_Purple__Certificate__Pool_usable)
1030
{
1031
    dVAR; dXSARGS;
1032
    if (items != 1)
1033
       croak_xs_usage(cv,  "pool");
1034
    {
1035
        Purple__Certificate__Pool        pool = purple_perl_ref_object(ST(0))
1036
;
1037
        gboolean        RETVAL;
1038

    
1039
        RETVAL = purple_certificate_pool_usable(pool);
1040
        ST(0) = sv_newmortal();
1041
        ST(0) = boolSV(RETVAL);
1042
    }
1043
    XSRETURN(1);
1044
}
1045

    
1046
#ifdef __cplusplus
1047
extern "C"
1048
#endif
1049
XS_EXTERNAL(boot_Purple__Certificate); /* prototype to pass -Wmissing-prototypes */
1050
XS_EXTERNAL(boot_Purple__Certificate)
1051
{
1052
    dVAR; dXSARGS;
1053
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
1054
    char* file = __FILE__;
1055
#else
1056
    const char* file = __FILE__;
1057
#endif
1058

    
1059
    PERL_UNUSED_VAR(cv); /* -W */
1060
    PERL_UNUSED_VAR(items); /* -W */
1061
#ifdef XS_APIVERSION_BOOTCHECK
1062
    XS_APIVERSION_BOOTCHECK;
1063
#endif
1064
    XS_VERSION_BOOTCHECK;
1065

    
1066
        (void)newXSproto_portable("Purple::Certificate::add_ca_search_path", XS_Purple__Certificate_add_ca_search_path, file, "$");
1067
        (void)newXSproto_portable("Purple::Certificate::check_subject_name", XS_Purple__Certificate_check_subject_name, file, "$$");
1068
        (void)newXSproto_portable("Purple::Certificate::copy", XS_Purple__Certificate_copy, file, "$");
1069
        (void)newXSproto_portable("Purple::Certificate::destroy", XS_Purple__Certificate_destroy, file, "$");
1070
        (void)newXSproto_portable("Purple::Certificate::display_x509", XS_Purple__Certificate_display_x509, file, "$");
1071
        (void)newXSproto_portable("Purple::Certificate::export", XS_Purple__Certificate_export, file, "$$");
1072
        (void)newXSproto_portable("Purple::Certificate::find_pool", XS_Purple__Certificate_find_pool, file, "$$");
1073
        (void)newXSproto_portable("Purple::Certificate::find_scheme", XS_Purple__Certificate_find_scheme, file, "$");
1074
        (void)newXSproto_portable("Purple::Certificate::find_verifier", XS_Purple__Certificate_find_verifier, file, "$$");
1075
        (void)newXSproto_portable("Purple::Certificate::get_handle", XS_Purple__Certificate_get_handle, file, "");
1076
        (void)newXSproto_portable("Purple::Certificate::get_issuer_unique_id", XS_Purple__Certificate_get_issuer_unique_id, file, "$");
1077
        (void)newXSproto_portable("Purple::Certificate::get_subject_name", XS_Purple__Certificate_get_subject_name, file, "$");
1078
        (void)newXSproto_portable("Purple::Certificate::get_unique_id", XS_Purple__Certificate_get_unique_id, file, "$");
1079
        (void)newXSproto_portable("Purple::Certificate::import", XS_Purple__Certificate_import, file, "$$");
1080
        (void)newXSproto_portable("Purple::Certificate::register_pool", XS_Purple__Certificate_register_pool, file, "$");
1081
        (void)newXSproto_portable("Purple::Certificate::register_scheme", XS_Purple__Certificate_register_scheme, file, "$");
1082
        (void)newXSproto_portable("Purple::Certificate::register_verifier", XS_Purple__Certificate_register_verifier, file, "$");
1083
        (void)newXSproto_portable("Purple::Certificate::signed_by", XS_Purple__Certificate_signed_by, file, "$$");
1084
        (void)newXSproto_portable("Purple::Certificate::unregister_pool", XS_Purple__Certificate_unregister_pool, file, "$");
1085
        (void)newXSproto_portable("Purple::Certificate::unregister_scheme", XS_Purple__Certificate_unregister_scheme, file, "$");
1086
        (void)newXSproto_portable("Purple::Certificate::unregister_verifier", XS_Purple__Certificate_unregister_verifier, file, "$");
1087
        (void)newXSproto_portable("Purple::Certificate::verify_complete", XS_Purple__Certificate_verify_complete, file, "$$");
1088
        (void)newXSproto_portable("Purple::Certificate::get_times", XS_Purple__Certificate_get_times, file, "$");
1089
        (void)newXSproto_portable("Purple::Certificate::destroy_list", XS_Purple__Certificate_destroy_list, file, ";@");
1090
        (void)newXSproto_portable("Purple::Certificate::get_pools", XS_Purple__Certificate_get_pools, file, "");
1091
        (void)newXSproto_portable("Purple::Certificate::get_schemes", XS_Purple__Certificate_get_schemes, file, "");
1092
        (void)newXSproto_portable("Purple::Certificate::get_verifiers", XS_Purple__Certificate_get_verifiers, file, "");
1093
        (void)newXSproto_portable("Purple::Certificate::check_signature_chain", XS_Purple__Certificate_check_signature_chain, file, ";@");
1094
        (void)newXSproto_portable("Purple::Certificate::get_fingerprint_sha1", XS_Purple__Certificate_get_fingerprint_sha1, file, "$");
1095
        (void)newXSproto_portable("Purple::Certificate::verify", XS_Purple__Certificate_verify, file, "$$$$$");
1096
        (void)newXSproto_portable("Purple::Certificate::Pool::get_idlist", XS_Purple__Certificate__Pool_get_idlist, file, "$");
1097
        (void)newXSproto_portable("Purple::Certificate::Pool::contains", XS_Purple__Certificate__Pool_contains, file, "$$");
1098
        (void)newXSproto_portable("Purple::Certificate::Pool::delete", XS_Purple__Certificate__Pool_delete, file, "$$");
1099
        (void)newXSproto_portable("Purple::Certificate::Pool::get_scheme", XS_Purple__Certificate__Pool_get_scheme, file, "$");
1100
        (void)newXSproto_portable("Purple::Certificate::Pool::mkpath", XS_Purple__Certificate__Pool_mkpath, file, "$$");
1101
        (void)newXSproto_portable("Purple::Certificate::Pool::retrieve", XS_Purple__Certificate__Pool_retrieve, file, "$$");
1102
        (void)newXSproto_portable("Purple::Certificate::Pool::store", XS_Purple__Certificate__Pool_store, file, "$$$");
1103
        (void)newXSproto_portable("Purple::Certificate::Pool::usable", XS_Purple__Certificate__Pool_usable, file, "$");
1104

    
1105
    /* Initialisation Section */
1106

    
1107
#line 41 "Certificate.xs"
1108
{
1109
        HV *stash = gv_stashpv("Purple::Certificate", 1);
1110

    
1111
        static const constiv *civ, const_iv[] = {
1112
#define const_iv(name) {#name, (IV)PURPLE_CERTIFICATE_##name}
1113
                const_iv(INVALID),
1114
                const_iv(VALID),
1115
        };
1116

    
1117
        for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
1118
                newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
1119
}
1120

    
1121
#line 1122 "Certificate.c"
1122

    
1123
    /* End of Initialisation Section */
1124

    
1125
#if (PERL_REVISION == 5 && PERL_VERSION >= 9)
1126
  if (PL_unitcheckav)
1127
       call_list(PL_scopestack_ix, PL_unitcheckav);
1128
#endif
1129
    XSRETURN_YES;
1130
}
1131