static bool s_authenticate_plain (self_t *self, zap_request_t *request) { if (self->passwords) { zhash_refresh (self->passwords); char *password = (char *) zhash_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; } }
static bool s_authenticate_plain (agent_t *self, zap_request_t *request) { if (self->passwords) { zhash_refresh (self->passwords); char *password = (char *) zhash_lookup (self->passwords, request->username); if (password && streq (password, request->password)) { if (self->verbose) printf ("I: ALLOWED (PLAIN) username=%s password=%s\n", request->username, request->password); return true; } else { if (self->verbose) printf ("I: DENIED (PLAIN) username=%s password=%s\n", request->username, request->password); return false; } } else { if (self->verbose) printf ("I: DENIED (PLAIN) no password file defined\n"); return false; } }
/// // When a hash table was loaded from a file by zhash_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 QZhash::refresh () { int rv = zhash_refresh (self); return rv; }