Exemple #1
0
static void set_debug_type (void)
{
    char cfgbuf[CONFIG_MAX];
    int ret;

    ret = get_config(pal_state.root_config, "loader.debug_type",
                     cfgbuf, CONFIG_MAX);
    if (ret <= 0)
        return;

    PAL_HANDLE handle = NULL;

    if (!memcmp(cfgbuf, "inline", 7)) {
        ret = _DkStreamOpen(&handle, "dev:tty", PAL_ACCESS_RDWR, 0, 0, 0);
        if (ret < 0)
            init_fail(-ret, "cannot open debug stream");
    } else if (!memcmp(cfgbuf, "file", 5)) {
        ret = get_config(pal_state.root_config, "loader.debug_file",
                         cfgbuf, CONFIG_MAX);
        if (ret <= 0)
            init_fail(PAL_ERROR_INVAL, "debug file not specified");

        ret = _DkStreamOpen(&handle, cfgbuf,
                            PAL_ACCESS_RDWR,
                            PAL_SHARE_OWNER_R|PAL_SHARE_OWNER_W,
                            PAL_CREAT_TRY, 0);
        if (ret < 0)
            init_fail(-ret, "cannot open debug file");
    } else if (memcmp(cfgbuf, "none", 5)) {
        init_fail(PAL_ERROR_INVAL, "unknown debug type");
    }

    __pal_control.debug_stream = handle;
}
void FileSet::add_path_to_source(const std::string& path)
{
	std::set<std::string> exts;
	exts.insert(get_config().get_header_extensions().begin(), get_config().get_header_extensions().end());
	exts.insert(get_config().get_source_extensions().begin(), get_config().get_source_extensions().end());
	add_files(path, exts);
}
Exemple #3
0
void draw_config(game *g) {
    ALLEGRO_TRANSFORM trans;
    al_identity_transform(&trans);
    al_use_transform(&trans);
    
    int x, y;
    x = (g->Size->x - 150) / 2;
    y = 0;
    al_draw_text(ttf_font, al_map_rgb(200, 200, 200), x, y, ALLEGRO_ALIGN_LEFT, "CONFIGURATION");
    
    if(get_config("display_width") == NULL) return;
    
    x = 100;
    y = 100;
    char msg[22];
    sprintf(msg, "DISPLAY WIDTH: %d", atoi(get_config("display_width")));
    al_draw_text(ttf_font, al_map_rgb(200, 200, 200), x, y, ALLEGRO_ALIGN_LEFT, msg);
    
    x = 100;
    y = 125;
    sprintf(msg, "DISPLAY HEIGHT: %d", atoi(get_config("display_height")));
    al_draw_text(ttf_font, al_map_rgb(200, 200, 200), x, y, ALLEGRO_ALIGN_LEFT, msg);
    
    al_draw_circle(80, 110 + config_pos * 25, 3.0, SHOOT_COLOR, 1.5);    
}
Exemple #4
0
/*	Query MySQL/MariaDB WS_REP Status	*/
char* mysql_status(dictionary *conf, FILE *log)
{
	MYSQL *curs = mysql_init(NULL);
	MYSQL_ROW row;	
	char *entry = NULL;

	if (!curs)
	{
		entry = concat_str("ERROR - Could not create MySQL cursor: ", mysql_error(curs), NULL);
		put_log(log, entry);
		free(entry);
		return("0");
	}

	if (mysql_real_connect(curs, get_config(conf, "mysql:host"), get_config(conf, "mysql:user"), get_config(conf, "mysql:pass"), "mysql", 0, NULL, 0) == NULL)
	{
		entry = concat_str("ERROR - Could not connect to MySQL server: ", mysql_error(curs), NULL);
                put_log(log, entry);
		free(entry);
		mysql_close(curs);
		return("0");
	}
	
	if (mysql_query(curs, "SHOW STATUS LIKE 'wsrep_local_state'"))
	{
		entry = concat_str("ERROR - Could not execute query on ws_rep status: ", mysql_error(curs), NULL);
                put_log(log, entry);
		free(entry);
		mysql_close(curs);
      		return("0");
  	}

	MYSQL_RES *result = mysql_store_result(curs);
	
	if (!result)
	{
		entry = concat_str("ERROR - Could not store MySQL result: ", mysql_error(curs), NULL);
                put_log(log, entry);
		free(entry);
		mysql_close(curs);
		return("0");
	}
	
	int num_fields = mysql_num_fields(result);

	char *ws_rep_status = NULL;

	while ((row = mysql_fetch_row(result)))
	{
		for (int i=0; i < num_fields; i++)
		{
			ws_rep_status =  (row[i]);
		}
	}

	mysql_free_result(result);
	mysql_close(curs);
	return ws_rep_status;
}
Exemple #5
0
// device should be disabled
static void detect_device(uint port, uchar enable, uchar test, uchar mask)
{
	ps2_device * ps2d;
	uchar check = 0;
	ushort type = 0;

	if (get_config() & mask) {
		outb(PS2_CMND, enable);

		if (!(get_config() & mask)) {
			outb(PS2_CMND, test);
			do_assert(wait_read());

			if (!inb(PS2_DATA)) {
				ps2_command(port, 0xFF, &check, 1);

				if (check == 0xAA) {
					ps2_command(port, 0xF5, NULL, 0);
					ps2_command(port, 0xF2, (uchar *)(&type), 2);

					if (type == PS2_NO_DEVICE) {
						type = PS2_KB_NORMAL;
					}

					if (type == PS2_KB_NORMAL || type == PS2_KB_MF2) {
						ps2_devs[port] = create_stream(
								sizeof(unsigned),
								ps2_kb_enable,
								ps2_kb_disable,
								ps2_kb_read,
								NULL
						);

						ps2d = kalloc(sizeof(ps2_device));
						ps2d->type = type;
						ps2d->port = port;
						ps2_devs[port]->data = ps2d;

						reg_dev(DEVICE_INPUT, ps2_devs[port]->hndl);
						enable_device(ps2_devs[port]);
					} else {
						ps2_devs[port] = NULL; //TODO: implement
					}

					kprintf("PS/2 Device %x detected.\n", type);
				}
			} else {
				outb(PS2_CMND, enable - 1);
			}
		}
	}
}
void
display_prefs::init()
{
  m_show_headers_level = 1;
  m_show_tags = get_config().get_bool("show_tags");
  m_threaded = get_config().get_bool("display_threads");
  m_hide_quoted = 0;
  m_clickable_urls=get_config().get_bool("body_clickable_urls", true);
  m_show_filters_trace = get_config().get_bool("display/filters_trace");
  m_show_tags_in_headers = get_config().get_bool("display/tags_in_headers", true);
  m_decode_qp = false;
  m_codec = NULL;
}
Exemple #7
0
int main(object me, string arg)
{
	int num;

	if( !arg || sscanf(arg, "%d", num)!=1 ) {
		write("Mud ├√│╞г║\t\t" + get_config(__MUD_NAME__) + "\n"); 
		write("═°┬╖╡╪╓╖├√│╞╦┼╖■╞ў▓║║┼г║" + get_config(__ADDR_SERVER_IP__) + "\n"); 
		write("Mudlib ┬╖╛╢г║\t\t" + get_config(__MUD_LIB_DIR__) + "\n"); 
		write("MudOS ╓┤╨╨╡╡┬╖╛╢г║\t" + get_config(__BIN_DIR__) + "\n"); 
		return 1;
	}

	printf("get_config(%d) = %O\n", num, get_config(num));
	return 1;
}
Exemple #8
0
int main(object me, string arg)
{
	int num;

	if( !arg || sscanf(arg, "%d", num)!=1 ) {
		write("Mud 名称:\t\t" + get_config(__MUD_NAME__) + "\n"); 
		write("网络地址名称服务器埠号:" + get_config(__ADDR_SERVER_IP__) + "\n"); 
		write("Mudlib 路径:\t\t" + get_config(__MUD_LIB_DIR__) + "\n"); 
		write("MudOS 可执行文件路径:\t" + get_config(__BIN_DIR__) + "\n"); 
		return 1;
	}

	printf("get_config(%d) = %O\n", num, get_config(num));
	return 1;
}
Exemple #9
0
/*********************
return RET_NOK on error
*********************/
static ret_code_t __read_int(const char * table, const char * file, int * res, va_list ap)
{
	const config_t * config = NULL;
	char * path=NULL;
	int result;

	SDL_LockMutex(entry_mutex);
	config = get_config(table,file);
	if(config==NULL) {
		SDL_UnlockMutex(entry_mutex);
		return RET_NOK;
	}

	path = get_path(ap);
	if(path == NULL) {
		SDL_UnlockMutex(entry_mutex);
		return RET_NOK;
	}

	if(config_lookup_int (config, path, &result)==CONFIG_FALSE) {
		SDL_UnlockMutex(entry_mutex);
		free(path);
		return RET_NOK;
	}
	free(path);

	SDL_UnlockMutex(entry_mutex);

	*res = result;

	return RET_OK;
}
Exemple #10
0
mail_listview::mail_listview(QWidget* parent): QTreeView(parent)
{
  m_msg_window = NULL;
  m_sender_column_swapped = false;

  setSelectionMode(QAbstractItemView::ExtendedSelection);
  setSelectionBehavior(QAbstractItemView::SelectRows);
  setUniformRowHeights(true);
  // Qt5: lines too close to each other as in the default QTreeView style
  // don't feel good for the list of messages, hence this hard-wired
  // 3px margin
  this->setStyleSheet("QTreeView::item { margin-bottom: 3px; }");
  mail_item_model* model = new mail_item_model(this);
  this->setModel(model);
  model->set_date_format(get_config().get_date_format_code());

  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
	  this, SLOT(popup_ctxt_menu(const QPoint&)));

  header()->setContextMenuPolicy(Qt::CustomContextMenu);
  connect(header(), SIGNAL(customContextMenuRequested(const QPoint&)),
	  this, SLOT(popup_ctxt_menu_headers(const QPoint&)));

  setEditTriggers(QAbstractItemView::NoEditTriggers);
}
Exemple #11
0
/*********************
return true if entry or group exists
*********************/
static bool __exist(const char * table, const char * file, va_list ap)
{
	const config_t * config;
	char * path;
	config_setting_t * setting = NULL;

	SDL_LockMutex(entry_mutex);
	config = get_config(table,file);
	SDL_UnlockMutex(entry_mutex);
	if(config==NULL) {
		return false;
	}

	path = get_path(ap);
	if( path == NULL ) {
		return false;
	}

	setting = config_lookup (config, path);
	free(path);
	if( setting == NULL ) {
		return false;
	}

	return true;
}
Exemple #12
0
void
msg_status_cache::db_new_mail_notif()
{
  DBG_PRINTF(5, "We have NEW MAIL!");
  db_cnx db;
  try {
    sql_stream s("SELECT ms.mail_id,ms.status,sender,sender_fullname,subject,recipients FROM mail m JOIN mail_status ms USING(mail_id) WHERE ms.mail_id>:p1", db);
    s << m_max_mail_id;
    mail_id_t mail_id;
    int status;
    int count=0;
    while (!s.eos()) {
      QString sender,sender_fullname,subject,recipients;
      s >> mail_id >> status>> sender >> sender_fullname >> subject >> recipients;
      count++;
      DBG_PRINTF(5, "Seen mail_id %d with status %d", mail_id, status);
      if (!(status & mail_msg::statusRead)) {
	gl_pApplication->desktop_notify(tr("New mail"), QString("From: %1\nSubject: %2").arg(sender_fullname.isEmpty()?sender:sender_fullname).arg(subject));
      }
      update(mail_id, status);
      message_port::instance()->broadcast_new_mail(mail_id);
    }
    if (count>0 && get_config().get_bool("fetch/auto_incorporate_new_results", false)) {
      message_port::instance()->broadcast_list_refresh_request();
    }
  }
  catch(db_excpt& p) {
    DBEXCPT(p);
  }
}
Exemple #13
0
int pre_move_catalog(char *src, char *dest) {
	char *tmp, movebuf[1024];
	int rc;

	// try rename.
	rc = rename(src, dest);

	if (rc == 0)
		return 0;

	tmp = ht_get(get_config(), PROPERTY_MOVE_EXTERNAL);

	if (!tmp)
		return -1;

	printf(", external..");

	strcpy(movebuf, tmp);
	pre_replace(movebuf, "%S", src);
	pre_replace(movebuf, "%D", dest);

	// try external move
	rc = system(movebuf);

	// return -1 if command did not return '0' = success.
	if (rc != 0)
		return -1;

	return 0;
}
void mpi_application::post_execute()
{
  if(0 == world_.rank())
  {
    get_config()->dump(get_work_directory());
  }
}
Exemple #15
0
// {int32 key, string name, string path}[] = archiver.archives()
xmlrpc_value *get_archives(xmlrpc_env *env, xmlrpc_value *args, void *user)
{
#ifdef LOGFILE
    LOG_MSG("archiver.archives\n");
#endif
    // Get Configuration
    ServerConfig config;
    if (!get_config(env, config))
        return 0;
    // Create result
    AutoXmlRpcValue result(xmlrpc_build_value(env, "()"));
    if (env->fault_occurred)
        return 0;
    stdList<ServerConfig::Entry>::const_iterator i;
    for (i=config.config.begin(); i!=config.config.end(); ++i)
    {
        AutoXmlRpcValue archive(
            xmlrpc_build_value(env, "{s:i,s:s,s:s}",
                               "key",  i->key,
                               "name", i->name.c_str(),
                               "path", i->path.c_str()));
        xmlrpc_array_append_item(env, result, archive);
    }
    return result.release();
}
Exemple #16
0
void VirtioBlk::irq_handler() {

  debug2("<VirtioBlk> IRQ handler\n");

  //Virtio Std. § 4.1.5.5, steps 1-3

  // Step 1. read ISR
  unsigned char isr = hw::inp(iobase() + VIRTIO_PCI_ISR);

  // Step 2. A) - one of the queues have changed
  if (isr & 1) {
    // This now means service RX & TX interchangeably
    service_RX();
  }

  // Step 2. B)
  if (isr & 2) {
    debug("\t <VirtioBlk> Configuration change:\n");

    // Getting the MAC + status
    //debug("\t             Old status: 0x%x\n", config.status);
    get_config();
    //debug("\t             New status: 0x%x \n", config.status);
  }

}
Exemple #17
0
/*********************
return RET_NOK on error
*********************/
static ret_code_t __write_list(const char * table, const char * file, char ** data, va_list ap)
{
	config_setting_t * setting;
	const config_t * config;
	int i=0;

	SDL_LockMutex(entry_mutex);
	config = get_config(table,file);
	if(config==NULL) {
		SDL_UnlockMutex(entry_mutex);
		return RET_NOK;
	}

	setting = create_tree(config,NULL,NULL,NULL,CONFIG_TYPE_ARRAY,ap);

	while(data[i] != NULL) {
		// First try to update existing setting
		if(config_setting_set_string_elem(setting,i,data[i])==NULL) {
			// If it down not exist, add a new setting at the end of the list
			if(config_setting_set_string_elem(setting,-1,data[i])==NULL) {
				SDL_UnlockMutex(entry_mutex);
				return RET_NOK;
			}
		}
		i++;
	}

	write_config(config,table,file);
	SDL_UnlockMutex(entry_mutex);

	return RET_OK;
}
Exemple #18
0
/*********************
return RET_NOK on error
res MUST BE FREED by caller
*********************/
static ret_code_t __read_string(const char * table, const char * file, char ** res, va_list ap)
{
	const config_t * config = NULL;
	char * path;
	const char * result;

	*res = NULL;

	SDL_LockMutex(entry_mutex);
	config = get_config(table,file);
	if(config==NULL) {
		SDL_UnlockMutex(entry_mutex);
		return RET_NOK;
	}

	path = get_path(ap);
	if(path == NULL) {
		SDL_UnlockMutex(entry_mutex);
		return RET_NOK;
	}

	if(config_lookup_string (config, path, &result)==CONFIG_FALSE) {
//		g_warning("%s: Can't read %s/%s/%s",__func__,table,file,path);
		SDL_UnlockMutex(entry_mutex);
		free(path);
		return RET_NOK;
	}
	free(path);
	SDL_UnlockMutex(entry_mutex);

	*res = strdup(result);

	return RET_OK;
}
/* Does the actual work of handling the client. This allows spawn_handler to
 * create a new thread and immediately return.
 */
static void handler(int fd)
	{
	Request req;
	
	main_log << DEBUG << "Reading request...";
	req = read_request(fd);
	
	main_log << DEBUG <<"Finished reading request.";
  
  
  
	std::string file_path(get_config("root_dir"));
	file_path=file_path + "/" + req.URI;
	
	int error_code;
	std::string response_body = get_resource(file_path,NULL,error_code);
	
	if (!response_body.size()) {
		main_log << ERROR << "Server error occurred. Ending handler...\n";
		return;
		}
  
	if (send_data(fd,response_body.c_str())) {
		main_log << WARNING << "Server error occured. Ending handler...\n";
		return;
		}
  
	return;
	}
Exemple #20
0
static optional<expr> apply_ematch() {
    flet<bool> set(get_config().m_ematch, true);
    return mk_action_strategy("ematch",
                              assert_cc_action,
                              unit_propagate,
                              ematch_action)();
}
Exemple #21
0
/*********************
return RET_NOK on error
*********************/
static ret_code_t __write_list_index(const char * table, const char * file, const char * data, int index, va_list ap)
{
	config_setting_t * setting = NULL;
	const config_t * config;
	int list_size;


	SDL_LockMutex(entry_mutex);
	config = get_config(table,file);
	if(config==NULL) {
		SDL_UnlockMutex(entry_mutex);
		return RET_NOK;
	}

	setting = create_tree(config,NULL,NULL,NULL,CONFIG_TYPE_ARRAY,ap);

	// Create empty entry before index
	list_size = config_setting_length (setting);
	while( list_size <= index ) {
		if(config_setting_set_string_elem(setting,-1,"")==NULL) {
			SDL_UnlockMutex(entry_mutex);
			return RET_NOK;
		}
		list_size++;
	}

	if(config_setting_set_string_elem(setting,index,data)==NULL) {
		SDL_UnlockMutex(entry_mutex);
		return RET_NOK;
	}

	write_config(config,table,file);
	SDL_UnlockMutex(entry_mutex);
	return RET_OK;
}
apr_array_header_t *authnz_crowd_user_groups(const char *username, request_rec *r) {
    authnz_crowd_dir_config *config = get_config(r);
    if (config == NULL) {
        return NULL;
    }
    return crowd_user_groups(username, r, config->crowd_config);
}
Exemple #23
0
/**********************
__get_unused_group_on_path
find an unused group, DO NOT CREATE IT and return its name
returned string must be freed
return NULL on error
**********************/
char * __get_unused_group_on_path(const char * table, const char * file, char * path)
{
	char tag[7];
	int index = 0;
	config_setting_t * setting;
	const config_t * config;

	SDL_LockMutex(entry_mutex);
	config = get_config(table,file);
	if(config==NULL) {
		SDL_UnlockMutex(entry_mutex);
		return NULL;
	}

	sprintf(tag,"A%05x",index);

	if(path != NULL) {
		setting = config_lookup(config,path);
		free(path);
	} else {
		setting = config_root_setting(config);
	}

	while( config_setting_add(setting,tag,CONFIG_TYPE_GROUP) == NULL ) {
		index++;
		sprintf(tag,"A%05x",index);
	}

	config_setting_remove(setting,tag);
	SDL_UnlockMutex(entry_mutex);

	return strdup(tag);
}
/**
 * This hook is used to check to see if the resource being requested
 * is available for the authenticated user (r->user and r->ap_auth_type).
 * It runs after the access_checker and check_user_id hooks. Note that
 * it will *only* be called if Apache determines that access control has
 * been applied to this resource (through a 'Require' directive).
 *
 * @param r the current request
 * @return OK, DECLINED, or HTTP_...
 */
static int auth_checker(request_rec *r) {

    authnz_crowd_dir_config *config = get_config(r);
    if (config == NULL) {
        return HTTP_INTERNAL_SERVER_ERROR;
    }

    if (r->user == NULL) {
        ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, "Authorisation requested, but no user provided.");
        return HTTP_INTERNAL_SERVER_ERROR;
    }

    /* Iterate over requirements */
    const apr_array_header_t *requires = ap_requires(r);
    apr_array_header_t *user_groups = NULL;
    int x;
    for (x = 0; x < requires->nelts; x++) {

        require_line require = APR_ARRAY_IDX(requires, x, require_line);

        /* Ignore this requirement if it does not apply to the HTTP method used in the request. */
        if (!(require.method_mask & (AP_METHOD_BIT << r->method_number))) {
            continue;
        }

        const char *next_word = require.requirement;

        /* Only process group requirements */
        if (strcasecmp(ap_getword_white(r->pool, &next_word), "group") == 0) {

            /* Fetch groups only if actually needed. */
            if (user_groups == NULL) {
                user_groups = crowd_user_groups(r->user, r, config->crowd_config);
                if (user_groups == NULL) {
                    return HTTP_INTERNAL_SERVER_ERROR;
                }
            }

            /* Iterate over the groups mentioned in the requirement. */
            while (*next_word != '\0') {
                const char *required_group = ap_getword_conf(r->pool, &next_word);
                /* Iterate over the user's groups. */
                int y;
                for (y = 0; y < user_groups->nelts; y++) {
                    const char *user_group = APR_ARRAY_IDX(user_groups, y, const char *);
                    if (strcasecmp(user_group, required_group) == 0) {
                        ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
                            "Granted authorisation to '%s' on the basis of membership of '%s'.", r->user, user_group);
                        return OK;
                    }
                }

            }
        }

    }
    
    ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "Denied authorisation to '%s'.", r->user);
    return config->authoritative ? HTTP_UNAUTHORIZED : DECLINED;
}
Exemple #25
0
void bound_position(point *p) {
    float x = atoi(get_config("display_width")), y = atoi(get_config("display_height"));
    
    while(p->x > x) {
        p->x -= x;
    }
    while(p->x < 0.) {
        p->x += x;
    }
    while(p->y > y) {
        p->y -= y;
    }
    while(p->y < 0.) {
        p->y += y;
    }
}
Exemple #26
0
void main_get_config()
{
	
	memset(&g_config,0,sizeof(g_config));
	get_config(&c);
	show_config(&c);
}
Exemple #27
0
static void game_draw(context *ctx)
{
  struct game_context *game = (struct game_context *)ctx;
  struct config_info *conf = get_config();
  struct world *mzx_world = ctx->world;

  // No game state change has happened (yet)
  mzx_world->change_game_state = CHANGE_STATE_NONE;

  if(game->is_title && game->fade_in)
  {
    // Focus on center
    int x, y;
    set_screen_coords(640/2, 350/2, &x, &y);
    focus_pixel(x, y);
  }

  if(!mzx_world->active)
  {
    // There is no MZX_SPEED to derive a framerate from, so use the UI rate.
    set_context_framerate_mode(ctx, FRAMERATE_UI);
    if(!conf->standalone_mode)
      draw_intro_mesg(mzx_world);
    m_show();
    return;
  }

  set_context_framerate_mode(ctx, FRAMERATE_MZX_SPEED);
  update_world(ctx, game->is_title);
  draw_world(ctx, game->is_title);
}
Exemple #28
0
static DEVICE_IMAGE_LOAD( cartslot )
{
	int result;
	device_t *device = &image.device();
	cartslot_t *cart = get_token(device);
	const cartslot_config *config = get_config(device);

	/* if this cartridge has a custom DEVICE_IMAGE_LOAD, use it */
	if (config->device_load != NULL)
		return (*config->device_load)(image);

	/* try opening this as if it were a multicart */
	multicart_open(device->machine().options(), image.filename(), device->machine().system().name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc);
	if (cart->mc == NULL)
	{


		/* otherwise try the normal route */
		result = process_cartridge(&image, PROCESS_LOAD);
		if (result != IMAGE_INIT_PASS)
			return result;
	}

	return IMAGE_INIT_PASS;
}
Exemple #29
0
void ungrab_keys ( )
{
    Display* xdisplay;
    int screen;
    PluginConfig* plugin_cfg = get_config();
    HotkeyConfiguration *hotkey;

    XErrorHandler old_handler = 0;
     xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());

    if (!grabbed) return;
    if (!xdisplay) return;

    XSync(xdisplay, False);
    old_handler = XSetErrorHandler (x11_error_handler);

    get_offending_modifiers(xdisplay);

    hotkey = &(plugin_cfg->first);
    while (hotkey)
    {
        for (screen=0;screen<ScreenCount(xdisplay);screen++)
        {
            ungrab_key(hotkey, xdisplay, RootWindow(xdisplay, screen));
        }
        hotkey = hotkey->next;
    }

    XSync(xdisplay, False);
    XSetErrorHandler (old_handler);

    grabbed = 0;
}
Exemple #30
0
/*
  Creates global config structure from config entry at plugin startup
*/
int
acct_policy_load_config_startup( Slapi_PBlock* pb, void* plugin_id ) {
	acctPluginCfg *newcfg;
	Slapi_Entry *config_entry = NULL;
	Slapi_DN *config_sdn = NULL;
	int rc;

	/* Retrieve the config entry */
	config_sdn = slapi_sdn_new_normdn_byref( PLUGIN_CONFIG_DN );
	rc = slapi_search_internal_get_entry( config_sdn, NULL, &config_entry,
		plugin_id);
	slapi_sdn_free( &config_sdn );

	if( rc != LDAP_SUCCESS || config_entry == NULL ) {
		slapi_log_err(SLAPI_LOG_ERR, PLUGIN_NAME,
			"acct_policy_load_config_startup - Failed to retrieve configuration entry %s: %d\n",
			PLUGIN_CONFIG_DN, rc );
		return( -1 );
	}
	config_wr_lock();
	free_config();
	newcfg = get_config();
	rc = acct_policy_entry2config( config_entry, newcfg );
	config_unlock();

	slapi_entry_free( config_entry );

	return( rc );
}