コード例 #1
0
ファイル: pam_hermes.c プロジェクト: ralt/hermes
PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv)
{
	const char *user;
	int retval;
	retval = pam_get_user(pamh, &user, NULL);
	if (retval != PAM_SUCCESS)
	{
		return retval;
	}

	return is_authenticated(user) ? PAM_SUCCESS : PAM_AUTH_ERR;
}
コード例 #2
0
ファイル: auth.c プロジェクト: Firef0x/burg-new
int
grub_auth_check_password (const char *userlist, const char *login,
			  const char *password)
{
  static unsigned long punishment_delay = 1;
  int result = 0;
  struct grub_auth_check_password_closure c;

  if (is_authenticated (userlist))
    {
      punishment_delay = 1;
      return 1;
    }

  if (! login)
    return 0;

  c.login = login;
  c.cur = NULL;
  grub_list_iterate (GRUB_AS_LIST (users), grub_auth_check_password_hook, &c);
  if ((c.cur) && (! c.cur->callback (login, password, c.cur->arg)))
    result = (is_authenticated (userlist));
  else
    grub_errno = 0;

  if (result)
    punishment_delay = 1;
  else
    {
      grub_sleep (punishment_delay);
      if (punishment_delay < GRUB_ULONG_MAX / 2)
	punishment_delay *= 2;
    }

  return result;
}
コード例 #3
0
ファイル: relay-ctrl-allow.c プロジェクト: bruceg/relay-ctrl
int main(int argc, char* argv[])
{
  if ((ip = getenv("TCPREMOTEIP")) == 0 || (ip = validate_ip(ip)) == 0)
    die1(111, "Must be run from tcp-env or tcpserver.");
  if ((dir = getenv("RELAY_CTRL_DIR")) == 0)
    warn1("$RELAY_CTRL_DIR is not set.");
  else
    if (is_authenticated())
      make_file(ip, argc > 1);

  if (argc > 1) {
    execvp(argv[1], argv+1);
    return 111;
  }
  return 0;
}
コード例 #4
0
/**
 * Receives standard HTTP requests from a client socket and dispatches
 * them to the doXXX methods defined in a cervlet module.
 */
static void do_service(Socket_T s) {
  volatile HttpResponse res= create_HttpResponse(s);
  volatile HttpRequest req= create_HttpRequest(s);
  
  if(res && req) {
    if(is_authenticated(req, res)) {
      if(IS(req->method, METHOD_GET)) {
	Impl.doGet(req, res);
      } else if(IS(req->method, METHOD_POST)) {
	Impl.doPost(req, res);
      } else {
	send_error(res, SC_NOT_IMPLEMENTED, "Method not implemented");
      }
    }
    send_response(res);
  }
  done(req, res);
}