Ejemplo n.º 1
0
static void test_update_faction(CuTest *tc) {
    faction *f;
    int uid;

    test_setup();
    db_driver_open(DB_GAME, NULL);
    f = test_create_faction(NULL);
    uid = db_driver_faction_save(f->uid, f->no, 0,
        faction_getemail(f),
        faction_getpassword(f));
    f->uid = uid;
    uid = db_driver_faction_save(f->uid, f->no, 0,
        faction_getemail(f),
        faction_getpassword(f));
    CuAssertIntEquals(tc, f->uid, uid);
    db_driver_close(DB_GAME);
    test_teardown();
}
Ejemplo n.º 2
0
bool checkpasswd(const faction * f, const char *passwd)
{
    const char *pwhash;
    if (!passwd) return false;

    pwhash = faction_getpassword(f);
    if (pwhash && password_verify(pwhash, passwd) == VERIFY_FAIL) {
        log_info("password check failed: %s", factionname(f));
        return false;
    }
    return true;
}
Ejemplo n.º 3
0
int writepasswd(void)
{
    FILE *F;
    char zText[128];

    path_join(basepath(), "passwd", zText, sizeof(zText));
    F = fopen(zText, "w");
    if (!F) {
        perror(zText);
    }
    else {
        faction *f;
        log_info("writing passwords...");

        for (f = factions; f; f = f->next) {
            fprintf(F, "%s:%s:%s:%d\n",
                itoa36(f->no), faction_getemail(f),
               faction_getpassword(f), f->uid);
        }
        fclose(F);
        return 0;
    }
    return 1;
}
Ejemplo n.º 4
0
static int tolua_faction_get_password(lua_State * L)
{
    faction *self = (faction *)tolua_tousertype(L, 1, 0);
    tolua_pushstring(L, faction_getpassword(self));
    return 1;
}