Пример #1
0
zcertstore_t *
zcertstore_new (const char *location)
{
    zcertstore_t *self = (zcertstore_t *) zmalloc (sizeof (zcertstore_t));
    assert (self);
    
    self->cert_list = zlist_new ();
    self->cert_hash = zhash_new ();
    if (location) {
        self->location = strdup (location);
        s_load_certs_from_disk (self);
    }
    return self;
}
Пример #2
0
zcert_t *
zcertstore_lookup (zcertstore_t *self, char *public_key)
{
    //  If directory has changed, reload all certificates
    if (self->location) {
        zdir_t *dir = zdir_new (self->location, NULL);
        if (dir
        && (self->modified != zdir_modified (dir)
        ||  self->count    != zdir_count (dir)
        ||  self->cursize  != zdir_cursize (dir))) {
            s_load_certs_from_disk (self);
        }
        zdir_destroy (&dir);
    }
    return (zcert_t *) zhash_lookup (self->cert_hash, public_key);
}
Пример #3
0
zcertstore_t *
zcertstore_new (char *location, ...)
{
    zcertstore_t *self = (zcertstore_t *) zmalloc (sizeof (zcertstore_t));
    assert (self);
    
    self->cert_list = zlist_new ();
    self->cert_hash = zhash_new ();
    if (location) {
        va_list argptr;
        va_start (argptr, location);
        self->location = zsys_vprintf (location, argptr);
        va_end (argptr);
        s_load_certs_from_disk (self);
    }
    return self;
}
Пример #4
0
zcertstore_t *
zcertstore_new (const char *location)
{
    zcertstore_t *self = (zcertstore_t *) zmalloc (sizeof (zcertstore_t));
    assert (self);

    self->certs = zhashx_new ();
    assert (self->certs);
    zhashx_set_destructor (self->certs, (czmq_destructor *) zcert_destroy);

    if (location) {
        self->location = strdup (location);
        assert (self->location);
        s_load_certs_from_disk (self);
    }
    return self;
}
Пример #5
0
zcertstore_t *
zcertstore_new (const char *location)
{
    zcertstore_t *self = (zcertstore_t *) zmalloc (sizeof (zcertstore_t));
    if (!self)
        return NULL;

    self->certs = zhashx_new ();
    if (self->certs) {
        zhashx_set_destructor (self->certs, (czmq_destructor *) zcert_destroy);
        if (location) {
            self->location = strdup (location);
            if (!self->location) {
                zcertstore_destroy (&self);
                return NULL;
            }
            s_load_certs_from_disk (self);
        }
    }
    else
        zcertstore_destroy (&self);
    return self;
}