Esempio n. 1
0
int main(int argc, char *argv[]) {

	if(checkPasswd())
		printf("correct\n");
	else
		printf("wrong\n");

	return 0;
}
Esempio n. 2
0
bool UserList::userExist(Proxy::usrAuthType auth, const string &domain, const string &nick)
{
  switch (auth)
    {
      case Proxy::AUTH_NONE:
      case Proxy::AUTH_IP:
      case Proxy::AUTH_HOST:
      case Proxy::AUTH_NCSA:
        return true;
      case Proxy::AUTH_NTLM:
      case Proxy::AUTH_ADLD:
        return checkPasswd (nick);
      case Proxy::AUTH_LDAP:
#ifdef USE_LDAP
        return checkLDAP (nick);
#else
        return checkPasswd (nick);;
#endif
    }

  return false;
}
Esempio n. 3
0
/*Вход*/
void login(void *buf)
{
    int checkNum;
    struct loginRequest_t *loginReq = (struct loginRequest_t *) buf;
    struct loginResponce_t *loginRes = malloc(sizeof(struct loginResponce_t));

    bzero(loginRes, sizeof(struct loginResponce_t));
    if (readFile() == -1) {
        /*Некоректное имя*/
        loginRes->status = STATUS_BAD;
        strcpy(loginRes->errorBuf, "User not found");
        send_message(CURRENT, 0, LOG_IN, sizeof(struct loginResponce_t), (void *)loginRes);
        free(loginRes);
        return;
    }
    if ((checkNum = checkName(loginReq->name)) == -1) {
        /*Пользаватель с таким именем уже есть*/
        loginRes->status = STATUS_BAD;
        strcpy(loginRes->errorBuf, "User not found");
        printf("[Logic]User input incorrectly name\n");
        send_message(CURRENT, 0, LOG_IN, sizeof(struct loginResponce_t), (void *)loginRes);
        free(loginRes);
        return;
    }
    if (checkPasswd(checkNum, loginReq->pass) == -1 ) {
        /*Некоректный пароль*/
        loginRes->status = STATUS_BAD;
        strcpy(loginRes->errorBuf, "Incorrectly password");
        printf("[Logic]User input incorrectly name\n");
        send_message(CURRENT, 0, LOG_IN, sizeof(struct loginResponce_t), (void *)loginRes); /*Некоректный пароль*/
        free(loginRes);
        return;
    } else {
        loginRes->status = STATUS_OK;
        IdName[currentPlayer].id = ++playersID;
        strncpy(IdName[currentPlayer].name, loginReq->name, MAX_NAME_LENGTH);
        currentPlayer++;
        send_message(CURRENT, 0, LOG_IN, sizeof(struct loginResponce_t), (void *)loginRes);
        printf("[Logic]User %s log in\n", loginReq->name);
        free(loginRes);
        return;
    }

}