Problems with federated shares and permissions/resharing

Nextcloud version : 16.0.5.1 and 16.0.4.1 (first item is the instance on webhosting, the second on the dedicated storage box from hetzner)
Operating system and version : webhosting and storage box at hetzner.com
Apache or nginx version : nginx, i think current stable version on both boxes
PHP version : 7.3.10 and 7.3.9

The issue you are facing:
I can create federated shares between users on both servers. i also see the sharing menu on the shares with the target users. but I’m not able to reshare the federated share with local users on the target server. neither the root folder nor nested folders of the federated share.

user search is working as expected, you can select users and/or groups to share with. after selected target you see the spinner running next to the name of selected object. but after round about 5 to 10 seconds, the waiting-for-confirmation list-item simply diappears. in oc_mounts no entry is created after that trys. only in oc_storages there are some more entrys after some trys with disabling and reenabling the federated share

second thing, that I’ve noticed was, that the permission hint (“you can’t upload/edit files in here” or similar, when full rights are missing) is missing within the federated share on target site

Is this the first time you’ve seen this error? : Y

Steps to replicate it:

  1. create federated share on source server
  2. accept it on the target server with targeted user
  3. open share and try to reshare with local group/user
  4. list-item will be created, having a spinner next to them
  5. after a few seconds, the item simply disappears, nothing more happens

The output of your Nextcloud log in Admin > Logging: (attention! this is from the nextcloud instance on the webhosting box!)

{"reqId":"8qEt8biCA1njI7k1QQxz","level":3,"time":"2019-09-29T09:47:28+00:00","remoteAddr":"2003:fa:c711:aa00:5581:ec81:ca69:xxxx","user":"photos","app":"PHP","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","message":"Undefined variable: permissions at \/usr\/www\/users\/ssjbve\/nc\/lib\/private\/Share20\/Manager.php#325","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"16.0.5.1"}
{"reqId":"8qEt8biCA1njI7k1QQxz","level":3,"time":"2019-09-29T09:47:28+00:00","remoteAddr":"2003:fa:c711:aa00:5581:ec81:ca69:xxxx","user":"photos","app":"PHP","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","message":"Error: Unsupported operand types at \/usr\/www\/users\/ssjbve\/nc\/lib\/private\/Share20\/Manager.php#325","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"16.0.5.1"}
{"reqId":"me7NGMHzKPgOJ8FhWXPl","level":3,"time":"2019-09-29T10:09:12+00:00","remoteAddr":"2003:fa:c711:aa00:5581:ec81:ca69:xxxx","user":"photos","app":"PHP","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","message":"Undefined variable: permissions at \/usr\/www\/users\/ssjbve\/nc\/lib\/private\/Share20\/Manager.php#325","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"16.0.5.1"}
{"reqId":"me7NGMHzKPgOJ8FhWXPl","level":3,"time":"2019-09-29T10:09:12+00:00","remoteAddr":"2003:fa:c711:aa00:5581:ec81:ca69:xxxx","user":"photos","app":"PHP","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","message":"Error: Unsupported operand types at \/usr\/www\/users\/ssjbve\/nc\/lib\/private\/Share20\/Manager.php#325","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"16.0.5.1"}
{"reqId":"UbrnZcCJbeMHBwidsJ2T","level":3,"time":"2019-09-29T10:09:29+00:00","remoteAddr":"2003:fa:c711:aa00:5581:ec81:ca69:xxxx","user":"photos","app":"PHP","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","message":"Undefined variable: permissions at \/usr\/www\/users\/ssjbve\/nc\/lib\/private\/Share20\/Manager.php#325","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"16.0.5.1"}
{"reqId":"UbrnZcCJbeMHBwidsJ2T","level":3,"time":"2019-09-29T10:09:29+00:00","remoteAddr":"2003:fa:c711:aa00:5581:ec81:ca69:xxxx","user":"photos","app":"PHP","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","message":"Error: Unsupported operand types at \/usr\/www\/users\/ssjbve\/nc\/lib\/private\/Share20\/Manager.php#325","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"16.0.5.1"}
{"reqId":"cMNewUfa0d3vKwGQHdAx","level":3,"time":"2019-09-29T10:41:28+00:00","remoteAddr":"2003:fa:c711:aa00:5581:ec81:ca69:xxxx","user":"photos","app":"PHP","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","message":"Undefined variable: permissions at \/usr\/www\/users\/ssjbve\/nc\/lib\/private\/Share20\/Manager.php#325","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"16.0.5.1"}
{"reqId":"cMNewUfa0d3vKwGQHdAx","level":3,"time":"2019-09-29T10:41:28+00:00","remoteAddr":"2003:fa:c711:aa00:5581:ec81:ca69:xxxx","user":"photos","app":"PHP","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","message":"Error: Unsupported operand types at \/usr\/www\/users\/ssjbve\/nc\/lib\/private\/Share20\/Manager.php#325","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"16.0.5.1"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!): (attention! this is from the nextcloud instance on the webhosting box!)

  'datadirectory' => '/usr/www/users/muhar/nc/data',
  'dbtype' => 'mysql',
  'version' => '16.0.5.1',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'installed' => true,
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'skeletondirectory' => '/usr/www/users/muhar/nc/default',
  'share_folder' => '/geteilte Dateien',
  'default_language' => 'de',
  'default_locale' => 'de_DE',
  'enable_previews' => true,
  'preview_max_x' => 2048,
  'preview_max_y' => 2048,
  'jpeg_quality' => 90,
  'updater.secret' => 'xyz',
  'theme' => '',
  'loglevel' => 2,

The output of your Apache/nginx/system log in /var/log/____:

not available (because not accesible on both boxes)

cya v3g0

no idea anyone? :confused:

gnarf… if you’re not doing it yourself…

digging into code. file Manager.php in /nextcloud_dir/lib/private/share20. Line #325 (first not sure by error-code, but yes, it’s the line number.

here it fails:

// Check that we do not share with more permissions than we have if ($share->getPermissions() & [b]~$permissions[/b]) { $message_t = $this->l->t('Can’t increase permissions of %s', [$share->getNode()->getPath()]); throw new GenericShareException($message_t, $message_t, 404); }

looking through functions above. in the first part of the if clause it seems to be possible, that there is no variable called “$permissions” defined. it seems to be true, if $incomingShares is empty. so i added a little bit modified if clause there.

old:

/** @var \OCP\Share\IShare[] $incomingShares */ if (!empty($incomingShares)) { $permissions = 0; foreach ($incomingShares as $incomingShare) { $permissions |= $incomingShare->getPermissions(); } }

modified:

/** @var \OCP\Share\IShare[] $incomingShares */ if (empty($incomingShares)) { //leer? dann vom share selbst versuchen auszulesen $permissions = $share->getNode()->getPermissions(); } else { $permissions = 0; foreach ($incomingShares as $incomingShare) { $permissions |= $incomingShare->getPermissions(); } }

now it works.

cya v3g0

3d1t: your bb-code interpreter seems to be crappy/buggy…

2 Likes

We are seeing this same issue on our boxes, without federations. Also wanted to mention that the fix above works. Has this issue been fixed in later versions (17?)?

I have the same problem, and do not have any federations established.

@SSJ3Vegotenks mind to submit that as patch to https://github.com/nextcloud/server? :wink: