Am I abusing my authorization token handler?


I have an authorization handler of the form:

Auth(AllowedGroups, Token) -> [Allow/Deny] 

Where the Token consist of the following tuple and its MAC tag.

TbsToken := (userid, usergroup, expiration) Token    := (TbsToken, MAC) 

The MAC key resides on the servers’ sides, and along with the authorization handler, is used for automatic authentication with server B once user is logged onto server A.

A while ago

Now server B gets the new function of serving objects to invitees that appear anonymous to the server. To determine which object to serve, 120-bit (padding-free in base32) random ID of the object is passed to the access point.

Along with the ID, is the said token with “userid” removed (because anonymous) and “usergroup” replaced with the object ID. And the authorization handler is reused and called as:

Auth(ID, ((anon, ID, future), MAC)) 

It raises an alarm in me because the “AllowedGroups” is now controlled by the client, but I cannot see obvious ways this leads to vulnerability.

Is the authorization handler call 1) useful but may need tweaking? 2) useless as ID is already random, or 3) a security concern that must be removed?

D8 Custom submit handler does not appear to be being called

Can anyone tell me why my custom handler is not being called when I save a new entity please, Im using D8.7


use Drupal\Core\Form\FormStateInterface; use Symfony\Component\HttpFoundation\Request;  function testmodule_form_node_form_alter(&$  form, FormStateInterface $  form_state, $  form_id) {   foreach (array_keys($  form['tasks']) as $  action) {     if ($  action != 'preview' && isset($  form['tasks'][$  action]['#type']) && $  form['tasks'][$  action]['#type'] === 'submit') {       $  form['tasks'][$  action]['#submit'][] = 'testmodule_form_submit';     }   } }   function testmodule_form_submit(array $  form, FormStateInterface $  form_state){     drupal_set_message("Why won't this message show?"); } 

I can not install any linux with kernel 4. It freezes even in the installer. “ACPI Exception: AE_TIME, Returned by Handler for [EmbeddedControl]”

Trying to install linux desktop with kernel 4, it freezes. The desktop (or sometimes even the installer) responds every 3 seconds, I mean, I can move the mouse for 3 seconds and it freezes, I use it for 3 seconds and it freezes for another 3 seconds. When I do alt+ctrl+F6, on the terminal I see these lines running and not stoping to showing command lines. My notebook is a Acer aspire 3620-32 bits and 2Gb of Ram. Ubuntu 14.04 with kernel version 3.19 runs perfectly, but any ubuntu 14 or 16.04 with kernel 4 and on, do not. So what´s the problem?

This is what terminal shows:

user@pc:~$   [ 3241.500016] ACPI Exception: AE_TIME, Returned by Handler for [EmbeddedControl] (20150619/evregion-297) [3241.500041] ACPI Error: Method parse/execution failed [\_SE_.AMWO.WMCA] Node f44894e0), AE_TIME (20150619/psparse-536) [ 3245.500018] ACPI Exception: AE_TIME, Returned by Handler for [EmbeddedControl] (20150619/evregion-297) [3245.500038] ACPI Error: Method parse/execution failed [\_SE_.AMWO.WMCA] Node f44894e0), AE_TIME (20150619/psparse-536) 

… and the lines go on.

enter image description here

How do I set up a site to use Redis as cache handler?

I’m trying to enable Redis on my Drupal site but when I check the status of the module I keep getting this warning message.

No Redis client connected, this module is useless thereof. Ensure that you enabled module using it or disable it.

The steps I followed to enable Redis are the following.

  1. I edited the config.yml file to add the following lines

    installed_extras:   - redis   - php-redis 
  2. I enabled the Redis module

  3. I edited the settings.php file to add the following lines

    $  settings['cache']['default'] = 'cache.backend.redis'; $  settings['redis.connection']['interface'] = 'PhpRedis'; $  settings['container_yamls'][] = 'modules/redis/'; $  settings['container_yamls'][] = 'modules/redis/'; 

I also tried to execute the following code in index.php and the cache appears to be working.

$  redis = new Redis(); $  redis->connect(''); $  cache = $  redis->get('key'); if ($  cache === false) {   echo "miss";   $  cache = "test";   $  redis->set('key',$  cache); } else {   echo "didn't miss"; } // At this point $  cache is either the retrieved cache or a fresh copy, so echo it. echo $  cache; exit(); 

It appears that Redis is working but for some reason it isn’t used by Drupal.

How do I set up Drupal to use Redis as cache handler?

INI File configuration handler

and have a nice day! I am currently working on a game, and I get the configuration in an .ini file, and I get information with this library I would like to improve the readability / performance of this code. So I do not know much about good practices..

   include "project.h"  // typedef struct s_server_conf { //      const char              *ip; //      unsigned int    port; // }                            t_server_conf;  // typedef struct       s_db_conf { //      const char              *host; //      const char              *user; //      const char              *passwd; //      const char              *db; //      unsigned int    port; // }                            t_db_conf;  // typedef struct s_conf { //      t_server_conf   server; //      t_db_conf               conf; // }                            t_conf;  static int      parse_server(t_conf *conf, const char *name, const char *value) {         # define MATCH(n) (strcmp(name, n) == 0)          if (MATCH("ip"))                 conf->server->ip = strdup(value);         else if (MATCH("port"))                 conf->server->port = atoi(value);         else                 return (0);         return (1); }  static int      parse_database(t_conf *conf, const char *name, const char *value) {         # define MATCH_NAME(n) (strcmp(name, n) == 0)          if (MATCH_NAME("host"))                 conf->db->host = (strdup(value));         else if (MATCH_NAME("user"))                 conf->db->user = (strdup(value));         else if (MATCH_NAME("passwd"))                 conf->db->passwd = (strdup(value));         else                 return (0);         return (1); }  static int      handler(void *conf, const char *section, const char *name, const char *value) {         # define MATCH_SECTION(s) (strcmp(section, s) == 0)          printf("Le nom du champ est %s, la valeur est %s (La section est %s)\n", name, value, section) ;          if (MATCH_SECTION("database"))                 return (parse_database((t_conf*)conf, name, value));         if (MATCH_SECTION("server"))                 return (parse_server((t_conf*)conf, name, value));         return (0); }  void            clear_conf(t_conf *conf) {         if (conf->db)                 free(conf->db);         if (conf->server)                 free(conf->server);         free(conf); }  static  t_conf          *create_conf(void) {         t_conf  *conf;          if (!(conf = (t_conf*)malloc(sizeof(t_conf))))                 return (NULL);         memset(conf, '', sizeof(t_conf));         if (!(conf->db = (t_db_conf*)malloc(sizeof(t_db_conf))))         {                 clear_conf(conf);                 return (NULL);         }         conf->db->port = 3306;         if (!(conf->server = (t_server_conf*)malloc(sizeof(t_server_conf))))         {                 clear_conf(conf);                 return (NULL);         }         return (conf); } t_conf          *get_conf(void) {         t_conf  *conf;          if (!(conf = create_conf()))                 return (NULL);         if (ini_parse("settings.ini", handler, conf) < 0)         {                 printf("Unable to load configuration\n");                 exit (1);         }         return (conf); }