Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 304427 | Differences between
and this patch

Collapse All | Expand All

(-)ruby-1.8.7-p249/ext/openssl/ossl_config.c (-2 / +86 lines)
Lines 303-314 Link Here
303
}
303
}
304
304
305
#ifdef IMPLEMENT_LHASH_DOALL_ARG_FN
305
#ifdef IMPLEMENT_LHASH_DOALL_ARG_FN
306
307
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
308
static void
309
get_conf_section_doall_arg(void *arg1, void *arg2)
310
{
311
    CONF_VALUE *cv;
312
    VALUE ary;
313
314
    cv = arg1;
315
    ary = (VALUE)arg2;
316
    if(cv->name) return;
317
    rb_ary_push(ary, rb_str_new2(cv->section));
318
}
319
#else
306
static void
320
static void
307
get_conf_section(CONF_VALUE *cv, VALUE ary)
321
get_conf_section(CONF_VALUE *cv, VALUE ary)
308
{
322
{
309
    if(cv->name) return;
323
    if(cv->name) return;
310
    rb_ary_push(ary, rb_str_new2(cv->section));
324
    rb_ary_push(ary, rb_str_new2(cv->section));
311
}
325
}
326
#endif
312
327
313
static IMPLEMENT_LHASH_DOALL_ARG_FN(get_conf_section, CONF_VALUE*, VALUE);
328
static IMPLEMENT_LHASH_DOALL_ARG_FN(get_conf_section, CONF_VALUE*, VALUE);
314
329
Lines 320-330 Link Here
320
335
321
    GetConfig(self, conf);
336
    GetConfig(self, conf);
322
    ary = rb_ary_new();
337
    ary = rb_ary_new();
338
339
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
340
    LHM_lh_doall_arg(CONF_VALUE, conf->data,
341
		     LHASH_DOALL_ARG_FN(get_conf_section), void, (void*)ary);
342
#else
323
    lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(get_conf_section), (void*)ary);
343
    lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(get_conf_section), (void*)ary);
344
#endif
324
345
325
    return ary;
346
    return ary;
326
}
347
}
327
348
349
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
350
static void
351
dump_conf_value_doall_arg(void *arg1, void *arg2)
352
{
353
    STACK_OF(CONF_VALUE) *sk;
354
    CONF_VALUE *cv, *v;
355
    VALUE str;
356
    int i, num;
357
358
    cv = arg1;
359
    if (cv->name) return;
360
    str = (VALUE)arg2;
361
    sk = (STACK_OF(CONF_VALUE)*)cv->value;
362
    num = sk_CONF_VALUE_num(sk);
363
    rb_str_cat2(str, "[ ");
364
    rb_str_cat2(str, cv->section);
365
    rb_str_cat2(str, " ]\n");
366
    for(i = 0; i < num; i++){
367
	v = sk_CONF_VALUE_value(sk, i);
368
	rb_str_cat2(str, v->name ? v->name : "None");
369
	rb_str_cat2(str, "=");
370
	rb_str_cat2(str, v->value ? v->value : "None");
371
	rb_str_cat2(str, "\n");
372
    }
373
    rb_str_cat2(str, "\n");
374
}
375
#else
328
static void
376
static void
329
dump_conf_value(CONF_VALUE *cv, VALUE str)
377
dump_conf_value(CONF_VALUE *cv, VALUE str)
330
{
378
{
Lines 347-352 Link Here
347
    }
395
    }
348
    rb_str_cat2(str, "\n");
396
    rb_str_cat2(str, "\n");
349
}
397
}
398
#endif
350
399
351
static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_conf_value, CONF_VALUE*, VALUE);
400
static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_conf_value, CONF_VALUE*, VALUE);
352
401
Lines 356-362 Link Here
356
    VALUE str;
405
    VALUE str;
357
406
358
    str = rb_str_new(0, 0);
407
    str = rb_str_new(0, 0);
408
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
409
    LHM_lh_doall_arg(CONF_VALUE, conf->data,
410
		     LHASH_DOALL_ARG_FN(dump_conf_value), void, (void*)str);
411
#else
359
    lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_conf_value), (void*)str);
412
    lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_conf_value), (void*)str);
413
#endif
360
414
361
    return str;
415
    return str;
362
}
416
}
Lines 371-378 Link Here
371
    return dump_conf(conf);
425
    return dump_conf(conf);
372
}
426
}
373
427
428
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
429
static void
430
each_conf_value_doall_arg(void *arg1, void* dummy)
431
{
432
    STACK_OF(CONF_VALUE) *sk;
433
    CONF_VALUE *cv, *v;
434
    VALUE section, name, value, args;
435
    int i, num;
436
437
    cv = arg1;
438
    if (cv->name) return;
439
    sk = (STACK_OF(CONF_VALUE)*)cv->value;
440
    num = sk_CONF_VALUE_num(sk);
441
    section = rb_str_new2(cv->section);
442
    for(i = 0; i < num; i++){
443
	v = sk_CONF_VALUE_value(sk, i);
444
	name = v->name ? rb_str_new2(v->name) : Qnil;
445
	value = v->value ? rb_str_new2(v->value) : Qnil;
446
        args = rb_ary_new3(3, section, name, value);
447
	rb_yield(args);
448
    }
449
}
450
#else
374
static void
451
static void
375
each_conf_value(CONF_VALUE *cv, void* dummy)
452
each_conf_value
453
(CONF_VALUE *cv, void* dummy)
376
{
454
{
377
    STACK_OF(CONF_VALUE) *sk;
455
    STACK_OF(CONF_VALUE) *sk;
378
    CONF_VALUE *v;
456
    CONF_VALUE *v;
Lines 391-396 Link Here
391
	rb_yield(args);
469
	rb_yield(args);
392
    }
470
    }
393
}
471
}
472
#endif
394
473
395
static IMPLEMENT_LHASH_DOALL_ARG_FN(each_conf_value, CONF_VALUE*, void*);
474
static IMPLEMENT_LHASH_DOALL_ARG_FN(each_conf_value, CONF_VALUE*, void*);
396
475
Lines 400-406 Link Here
400
    CONF *conf;
479
    CONF *conf;
401
480
402
    GetConfig(self, conf);
481
    GetConfig(self, conf);
482
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
483
    LHM_lh_doall_arg(CONF_VALUE, conf->data,
484
		     LHASH_DOALL_ARG_FN(each_conf_value), void, (void*)NULL);
485
#else
403
    lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(each_conf_value), (void*)NULL);
486
    lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(each_conf_value), (void*)NULL);
487
#endif
404
488
405
    return self;
489
    return self;
406
}
490
}
Lines 431-437 Link Here
431
ossl_config_inspect(VALUE self)
515
ossl_config_inspect(VALUE self)
432
{
516
{
433
    VALUE str, ary = ossl_config_get_sections(self);
517
    VALUE str, ary = ossl_config_get_sections(self);
434
    char *cname = rb_class2name(rb_obj_class(self));
518
    const char *cname = rb_class2name(rb_obj_class(self));
435
519
436
    str = rb_str_new2("#<");
520
    str = rb_str_new2("#<");
437
    rb_str_cat2(str, cname);
521
    rb_str_cat2(str, cname);
(-)ruby-1.8.7-p249/ext/openssl/ossl_ssl_session.c (-3 / +12 lines)
Lines 86-94 Link Here
86
	GetSSLSession(val1, ctx1);
86
	GetSSLSession(val1, ctx1);
87
	SafeGetSSLSession(val2, ctx2);
87
	SafeGetSSLSession(val2, ctx2);
88
88
89
	switch (SSL_SESSION_cmp(ctx1, ctx2)) {
89
	/*
90
	case 0:		return Qtrue;
90
	 * OpenSSL 1.0.0betas do not have non-static SSL_SESSION_cmp.
91
	default:	return Qfalse;
91
	 * ssl_session_cmp (was SSL_SESSION_cmp in 0.9.8) is for lhash
92
	 * comparing so we should not depend on it.  Just compare sessions
93
	 * by version and id.
94
	 */
95
	if ((ctx1->ssl_version == ctx2->ssl_version) &&
96
	    (ctx1->session_id_length == ctx2->session_id_length) &&
97
	    (memcmp(ctx1->session_id, ctx2->session_id, ctx1->session_id_length) == 0)) {
98
	    return Qtrue;
99
	} else {
100
	    return Qfalse;
92
	}
101
	}
93
}
102
}
94
103

Return to bug 304427