コード例 #1
0
ファイル: nasl_nessusd_glue.c プロジェクト: AntBean/MyWheel
static tree_cell * security_something(lex_ctxt * lexic, proto_post_something_t proto_post_func, post_something_t post_func)
{
 struct arglist * script_infos = lexic->script_infos;

 char* proto = get_str_local_var_by_name(lexic, "protocol");
 char* data = get_str_local_var_by_name(lexic, "data");
 int port = get_int_local_var_by_name(lexic, "port", -1); 
 char * dup = NULL;
 
 if(data != NULL)
 {
  int len = get_local_var_size_by_name(lexic, "data");
  int i;
  
  dup = nasl_strndup(data, len);
  for(i=0;i<len;i++)
   if(dup[i] == 0)dup[i]=' ';
 }

 /*if((arg_get_value(script_infos, "standalone")) != NULL)
 {
  if( data != NULL )
   fprintf(stdout, "%s\n", dup);
  else
   fprintf(stdout, "Success\n");
 }*/
   
 if(proto == NULL)
	 proto = get_str_local_var_by_name(lexic, "proto");

 if(port < 0)
	 port = get_int_var_by_num(lexic, 0, -1);

 
 if(dup != NULL)
 {
  if(proto == NULL)
   post_func(script_infos, port, dup);
  else
   proto_post_func(script_infos, port, proto, dup);

  efree(&dup);
  return FAKE_CELL;
 }
 
 if(proto == NULL)
  post_func(script_infos, port, NULL);
 else
  proto_post_func(script_infos, port, proto, NULL);
  

 return FAKE_CELL;
}
コード例 #2
0
ファイル: tabloader.c プロジェクト: JacobD10/MegaTunix
/*!
  \brief run_post_functions_with_arg() is called to run a function AFTER 
  tab loading is complete. It'll search the exported symbols of MegaTunix 
  for the function and if found execute it with the passed widget as an
  argument.
  \param functions is the CSV list of functions to run
  \param widget is the pointer to widget to be passed to the function
  */
G_MODULE_EXPORT void run_post_functions_with_arg(const gchar * functions, GtkWidget *widget)
{
	void (*post_func_w_arg)(GtkWidget *) = NULL;
	void (*post_func)(void) = NULL;
	gchar ** vector = NULL;
	guint i = 0;
	ENTER();
	vector = g_strsplit(functions,",",-1);
	for (i=0;i<g_strv_length(vector);i++)
	{
		/* If widget defined, pass to post function */
		if (widget)
		{
			if (get_symbol(vector[i],(void **)&post_func_w_arg))
				post_func_w_arg(widget);
			else
				MTXDBG(TABLOADER|CRITICAL,_("Error finding symbol \"%s\", error:\n\t%s\n"),vector[i],g_module_error());
		}
		else /* If no widget find funct with no args.. */
		{
			if (get_symbol(vector[i],(void **)&post_func))
				post_func();
			else
				MTXDBG(TABLOADER|CRITICAL,_("Error finding symbol \"%s\", error:\n\t%s\n"),vector[i],g_module_error());
		}
	}
	g_strfreev(vector);
	EXIT();
	return;
}
コード例 #3
0
ファイル: bat_sysfs.c プロジェクト: jledet/catwoman
static inline ssize_t __store_bool_attr(char *buff, size_t count,
			void (*post_func)(struct net_device *),
			struct attribute *attr,
			atomic_t *attr_store, struct net_device *net_dev)
{
	int ret;

	ret = store_bool_attr(buff, count, net_dev, attr->name, attr_store);
	if (post_func && ret)
		post_func(net_dev);

	return ret;
}
コード例 #4
0
ファイル: sysfs.c プロジェクト: ARMWorks/FA_2451_Linux_Kernel
static inline ssize_t
__batadv_store_uint_attr(const char *buff, size_t count,
			 int min, int max,
			 void (*post_func)(struct net_device *),
			 const struct attribute *attr,
			 atomic_t *attr_store, struct net_device *net_dev)
{
	int ret;

	ret = batadv_store_uint_attr(buff, count, net_dev, attr->name, min, max,
				     attr_store);
	if (post_func && ret)
		post_func(net_dev);

	return ret;
}