Beispiel #1
0
static bool
s_authenticate_plain (self_t *self, zap_request_t *request)
{
    if (self->passwords) {
        zhashx_refresh (self->passwords);
        char *password = (char *) zhashx_lookup (self->passwords, request->username);
        if (password && streq (password, request->password)) {
            if (self->verbose)
                zsys_info ("zauth: - allowed (PLAIN) username=%s password=%s",
                           request->username, request->password);
            return true;
        }
        else {
            if (self->verbose)
                zsys_info ("zauth: - denied (PLAIN) username=%s password=%s",
                           request->username, request->password);
            return false;
        }
    }
    else {
        if (self->verbose)
            zsys_info ("zauth: - denied (PLAIN) no password file defined");
        return false;
    }
}
JNIEXPORT jint JNICALL
Java_org_zeromq_czmq_Zhashx__1_1refresh (JNIEnv *env, jclass c, jlong self)
{
    jint refresh_ = (jint) zhashx_refresh ((zhashx_t *) (intptr_t) self);
    return refresh_;
}
Beispiel #3
0
///
//  When a hash table was loaded from a file by zhashx_load, this method will
//  reload the file if it has been modified since, and is "stable", i.e. not 
//  still changing. Returns 0 if OK, -1 if there was an error reloading the  
//  file.                                                                    
int QZhashx::refresh ()
{
    int rv = zhashx_refresh (self);
    return rv;
}