예제 #1
0
파일: conn.c 프로젝트: jophxy/samba
BOOL conn_idle_all(time_t t, int deadtime)
{
	pipes_struct *plist = NULL;
	BOOL allidle = True;
	connection_struct *conn, *next;

	for (conn=Connections;conn;conn=next) {
		next=conn->next;
		/* close dirptrs on connections that are idle */
		if ((t-conn->lastused) > DPTR_IDLE_TIMEOUT)
			dptr_idlecnum(conn);

		if (conn->num_files_open > 0 || 
		    (t-conn->lastused)<deadtime)
			allidle = False;
	}

	/*
	 * Check all pipes for any open handles. We cannot
	 * idle with a handle open.
	 */

	for (plist = get_first_pipe(); plist; plist = get_next_pipe(plist))
		if (plist->pipe_handles && plist->pipe_handles->count)
			allidle = False;
	
	return allidle;
}
예제 #2
0
t_bool	check_pipe(t_token *b, t_token *e, t_node **root, int flag)
{
  t_token	*begin;
  t_token	*end;

  if (flag && check_grammar_exec(b, e) != TRUE)
    return (FALSE);
  begin = (flag) ? (b) : (NULL);
  if (there_are_pipe(b, e) == TRUE && get_next_pipe(e, &begin, &end) == TRUE)
    {
      if (!end || end == e)
	check_bloc_exec(begin, end, root);
      else
	{
	  if (check_pipe_ext(root) == ERROR)
	    return (ERROR);
	  if (check_pipe(b, e, &((*root)->child->nd), 0) != TRUE)
	    return (FALSE);
	  if (add_child(root) == EXIT_FAILURE)
	    return (ERROR);
	  if (check_bloc_exec(begin, end, &((*root)->child->nd)) != TRUE)
	    return (FALSE);
	}
    }
  else
    return ((check_bloc_exec(begin, e, root) != TRUE) ? (FALSE) : (TRUE));
  return (TRUE);
}
예제 #3
0
t_bool	check_pipe(t_token *b, t_token *e, t_node **root, int flag)
{
  t_token	*begin;
  t_token	*end;

  if (flag && check_grammar_exec(b, e) != TRUE)
    return (FALSE);
  begin = (flag) ? (b) : (NULL);
  if (there_are_pipe(b, e) == TRUE)
    {
      if (get_next_pipe(e, &begin, &end) == TRUE)
	{
	  if (!end || end == e)
	    check_bloc_exec(begin, end, root);
	  else
	    {
	      add_node(root, PIPE, "|");
	      add_child(root);
	      check_pipe(b, e, &((*root)->child->nd), 0);
	      add_child(root);
	      if (check_bloc_exec(begin, end, &((*root)->child->nd)) != TRUE)
		return (FALSE);
	    }
	}
    }
  else
    if (check_bloc_exec(begin, e, root) != TRUE)
      return (FALSE);
  return (TRUE);
}
예제 #4
0
파일: srv_lsa_hnd.c 프로젝트: jophxy/samba
BOOL init_pipe_handle_list(pipes_struct *p, char *pipe_name)
{
	pipes_struct *plist = get_first_pipe();
	struct handle_list *hl = NULL;

	for (plist = get_first_pipe(); plist; plist = get_next_pipe(plist)) {
		if (strequal( plist->name, pipe_name) ||
			(is_samr_lsa_pipe(plist->name) && is_samr_lsa_pipe(pipe_name))) {
			if (!plist->pipe_handles) {
				pstring msg;
				slprintf(msg, sizeof(msg)-1, "init_pipe_handles: NULL pipe_handle pointer in pipe %s",
						pipe_name );
				smb_panic(msg);
			}
			hl = plist->pipe_handles;
			break;
		}
	}

	if (!hl) {
		/*
		 * No handle list for this pipe (first open of pipe).
		 * Create list.
		 */

		if ((hl = (struct handle_list *)malloc(sizeof(struct handle_list))) == NULL)
			return False;
		ZERO_STRUCTP(hl);

		DEBUG(10,("init_pipe_handles: created handle list for pipe %s\n", pipe_name ));
	}

	/*
	 * One more pipe is using this list.
	 */

	hl->pipe_ref_count++;

	/*
	 * Point this pipe at this list.
	 */

	p->pipe_handles = hl;

	DEBUG(10,("init_pipe_handles: pipe_handles ref count = %u for pipe %s\n",
			p->pipe_handles->pipe_ref_count, pipe_name ));

	return True;
}