Exemplo n.º 1
0
void brw_init_metaops( struct brw_context *brw )
{
   init_attribs(brw);


   brw->intel.vtbl.install_meta_state = install_meta_state;
   brw->intel.vtbl.leave_meta_state = leave_meta_state;
   brw->intel.vtbl.meta_no_depth_write = meta_no_depth_write;
   brw->intel.vtbl.meta_no_stencil_write = meta_no_stencil_write;
   brw->intel.vtbl.meta_stencil_replace = meta_stencil_replace;
   brw->intel.vtbl.meta_depth_replace = meta_depth_replace;
   brw->intel.vtbl.meta_color_mask = meta_color_mask;
   brw->intel.vtbl.meta_no_texture = meta_no_texture;
   brw->intel.vtbl.meta_import_pixel_state = meta_import_pixel_state;
   brw->intel.vtbl.meta_frame_buffer_texture = meta_frame_buffer_texture;
   brw->intel.vtbl.meta_draw_region = meta_draw_region;
   brw->intel.vtbl.meta_draw_quad = meta_draw_quad;
   brw->intel.vtbl.meta_texture_blend_replace = meta_texture_blend_replace;
/*    brw->intel.vtbl.meta_tex_rect_source = meta_tex_rect_source; */
/*    brw->intel.vtbl.meta_draw_format = set_draw_format; */
}
Exemplo n.º 2
0
/*
 * Thread for handling command line attacks (TERM_TTY)
 * Use global variable struct term_tty *tty_tmp
 */
void *
th_tty_peer(void *args)
{
   int fail;
   time_t this_time;
   struct cl_args *arguments;
   struct term_tty *tty;
   struct term_node *term_node=NULL;
   sigset_t mask;
   
   terms->work_state = RUNNING;
   
write_log(0, "\n th_tty_peer thread = %d...\n",(int)pthread_self());
   
   sigfillset(&mask);
   
   if (pthread_sigmask(SIG_BLOCK, &mask,NULL))
   {
      thread_error("th_tty_peer pthread_sigmask()",errno);
      th_tty_peer_exit(NULL);
   }   

   if (pthread_mutex_lock(&terms->mutex) != 0)
   {
      thread_error("th_tty_peer pthread_mutex_lock",errno);
      th_tty_peer_exit(NULL);
   }
   
   fail = term_add_node(&term_node, TERM_TTY, (int)NULL, pthread_self());

   if (fail == -1)
   {
      if (pthread_mutex_unlock(&terms->mutex) != 0)
         thread_error("th_tty_peer pthread_mutex_unlock",errno);
      th_tty_peer_exit(term_node);
   }

   if (term_node == NULL)
   {
      write_log(1,"Ouch!! No more than %d %s accepted!!\n",
                  term_type[TERM_TTY].max, term_type[TERM_TTY].name);
      
      if (pthread_mutex_unlock(&terms->mutex) != 0)
         thread_error("th_tty_peer pthread_mutex_unlock",errno);
      th_tty_peer_exit(term_node);
   }

   tty = term_node->specific;

   memcpy(tty,tty_tmp,sizeof(struct term_tty));    

    this_time = time(NULL);
   
#ifdef HAVE_CTIME_R
#ifdef SOLARIS
    ctime_r(&this_time,term_node->since, sizeof(term_node->since));
#else
    ctime_r(&this_time,term_node->since);
#endif
#else
    pthread_mutex_lock(&mutex_ctime);
    strncpy(term_node->since, ctime(&this_time), sizeof(term_node->since));   
    pthread_mutex_unlock(&mutex_ctime);
#endif

    /* Just to remove the cr+lf...*/
    term_node->since[sizeof(term_node->since)-2] = 0;

    /* This is a tty so, man... ;) */
    strncpy(term_node->from_ip, "127.0.0.1", sizeof(term_node->from_ip));

   /* Parse config file */
   if (strlen(tty_tmp->config_file))
      if (parser_read_config_file(tty_tmp, term_node) < 0)
      {
         write_log(0, "Error reading configuration file\n");
         th_tty_peer_exit(term_node);
      }
   
    if (init_attribs(term_node) < 0)        
    {
       if (pthread_mutex_unlock(&terms->mutex) != 0)
         thread_error("th_tty_peer pthread_mutex_unlock",errno);
       th_tty_peer_exit(term_node);
    }

    arguments = args;
    
    /* In command line mode we initialize the values by default */
    if (protocols[arguments->proto_index].init_attribs)
    {
        fail = (*protocols[arguments->proto_index].init_attribs)
            (term_node);
    } else
        write_log(0, "Warning, proto %d has no init_attribs function!!\n", arguments->proto_index);

    /* Choose a parser */
    fail = parser_cl_proto(term_node, arguments->count, arguments->argv_tmp, arguments->proto_index);

   if (pthread_mutex_unlock(&terms->mutex) != 0)
      thread_error("th_tty_peer pthread_mutex_unlock",errno);
   
   if (fail < 0) {
       write_log(0, "Error when parsing...\n");
       th_tty_peer_exit(term_node);
   }
      
   write_log(0, "Entering command line mode...\n");
   /* Execute attack... */
   doloop(term_node, arguments->proto_index);
   
   th_tty_peer_exit(term_node);
   
   return(NULL);
}