[Foreign_link] Change the type of "credentials" to blob

TwitterOAuthClient::packToken uses \0 as a delimeter which can cause issues on
TEXT or VARCHAR.
This commit is contained in:
Alexei Sorokin 2020-08-25 16:06:37 +03:00 committed by Diogo Peralta Cordeiro
parent 912a0cb16c
commit 6e5217dc3a
2 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ class Foreign_link extends Managed_DataObject
public $user_id; // int(4) primary_key not_null
public $foreign_id; // bigint(8) primary_key not_null unsigned
public $service; // int(4) primary_key not_null
public $credentials; // varchar(191) not 255 because utf8mb4 takes more space
public $credentials; // blob
public $noticesync; // tinyint(1) not_null default_1
public $friendsync; // tinyint(1) not_null default_2
public $profilesync; // tinyint(1) not_null default_1
@ -48,7 +48,7 @@ class Foreign_link extends Managed_DataObject
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'link to user on this system, if exists'),
'foreign_id' => array('type' => 'int', 'size' => 'big', 'not null' => true, 'description' => 'link to user on foreign service, if exists'),
'service' => array('type' => 'int', 'not null' => true, 'description' => 'foreign key to service'),
'credentials' => array('type' => 'varchar', 'length' => 191, 'description' => 'authc credentials, typically a password'),
'credentials' => array('type' => 'blob', 'description' => 'authc credentials, typically a password'),
'noticesync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'notice synchronization, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies'),
'friendsync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 2, 'description' => 'friend synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'),
'profilesync' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 1, 'description' => 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming'),

View File

@ -228,7 +228,7 @@ class TwitterauthorizationAction extends FormAction
$creds = TwitterOAuthClient::packToken($access_token);
$flink->credentials = $creds;
$flink->credentials = DB_DataObject_Cast::blob($creds);
$flink->created = common_sql_now();
// Defaults: noticesync on, everything else off