Exemplo n.º 1
0
static GGZHookReturn ggz_login_fail(GGZServerEvent id,
				    const void *event_data,
				    const void *user_data)
{
	const GGZErrorEventData *error = event_data;

	login_failed(error);

	return GGZ_HOOK_OK;
}
Exemplo n.º 2
0
int login(struct clientinfo* clntinfo, int stage) {
	int ret = 0;

	if (! clntinfo->user && stage >= LOGIN_ST_USER) {
		say(clntinfo->clientsocket, "500 Error logging in\r\n");
		jlog(4, "No user was set - Cannot proceed");
		return CMD_ERROR;
	}

	if ((ret = login_setforward_user(clntinfo)) < 0) {
		/* the error is logged and say()ed */
		return CMD_ERROR;
	}

	if (! clntinfo->destination) {
		say(clntinfo->clientsocket, "500 Error logging in\r\n");
		jlog(4, "No destination was set - Cannot proceed");
		if (config_compare_option("logintime", "connect")) {
			jlog(4, "This may be because of your logintime --> connect setting");
		}
		return CMD_ERROR;
	}

	if (stage >= LOGIN_ST_CONNECTED) {
		ret = login_connect(clntinfo);
		if (ret) { return ret; }
	}
	if (stage >= LOGIN_ST_USER) {
		ret = login_sendauth_user(clntinfo);
		if (ret) { return ret; }
	}
	if (stage >= LOGIN_ST_FULL) {
		ret = login_connect(clntinfo);
		if (ret) { return ret; }
		ret = login_setforward_pass(clntinfo);
		if (ret) { return ret; }
		ret = login_auth(clntinfo);
		if (ret) {
			int ret2;
			if ((ret2 = login_failed(clntinfo)) < 0) {
				return ret2;
			}
			return ret;
		} else {
			config_destroy_sectionconfig();
		}
		ret = login_loggedin_setup(clntinfo);
		if (ret) { return ret; }
	}
	return CMD_HANDLED;
}
Exemplo n.º 3
0
int login(struct pwdb_passwd *info){
  char username[USERNAME_SIZE];
  char password[PASSWORD_SIZE];
  /*
   * Write "login: "******"Locked out!\n");
    return 1;
  }

  read_password(password);
  if (was_interrupted) return 1;
  char *crypted = crypt(password, info->pw_passwd);

  if (strncmp(info->pw_passwd, crypted, HASH_SIZE) == 0){
    login_success(info);
    printf("Logged in!\n");
    return 0;
  }
  else {
    login_failed(info);
    printf("No!\n");
    return 1;
  }
}