Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic in GetOCMShareByToken #208

Open
michielbdejong opened this issue Jun 6, 2023 · 10 comments
Open

panic in GetOCMShareByToken #208

michielbdejong opened this issue Jun 6, 2023 · 10 comments

Comments

@michielbdejong
Copy link
Member

This code wasn't used in the past, but it's needed to serve WebDAV through the sender's Reva.

/snap/go/current/src/runtime/panic.go:884 +0x213                                                                               
github.com/cs3org/reva/pkg/ocm/share/repository/nextcloud.getUsername(...)                                                             
        /root/ocm-test-suite/reva/pkg/ocm/share/repository/nextcloud/nextcloud.go:410                                                  
github.com/cs3org/reva/pkg/ocm/share/repository/nextcloud.(*Manager).GetShare(0x2?, {0x2295878, 0xc0009a5f50}, 0x0, 0x0?)              
        /root/ocm-test-suite/reva/pkg/ocm/share/repository/nextcloud/nextcloud.go:172 +0x63
github.com/cs3org/reva/internal/grpc/services/ocmshareprovider.(*service).GetOCMShareByToken(0xc000a05640, {0x2295878, 0xc0009a5f50}, 0
xc0009a5ce0)
@michielbdejong
Copy link
Member Author

The existing implementation assumes that there is a user in scope. But for the WebDAV interface there is none.

@michielbdejong
Copy link
Member Author

I'm setting the username to 'nobody' and will try to deal with it on the NC/OC-10 side.

@michielbdejong
Copy link
Member Author

Now seeing

"method":"POST","url":"/index.php/apps/sciencemesh/~nobody/api/ocm/GetShare","message":"","userAgent":"Go-http-client/1.1","version":"26.0.0.6","exception":{"Exception":"Symfony\\Component\\Routing\\Exception\\MethodNotAllowedException"

on the NC side

@michielbdejong
Copy link
Member Author

It should be GetSentShare instead of GetShare

michielbdejong added a commit to cs3org/reva that referenced this issue Jun 6, 2023
@michielbdejong
Copy link
Member Author

On the NC side we have a call to GetSentShare but it should be https://github.com/nextcloud/server/blob/master/lib/public/Share/IShareProvider.php#L186

@yasharpm
Copy link

yasharpm commented Jun 6, 2023

I think I saw this when I was working on datax. When we create a share through createReceivedShare, the share type is not set priperly. It should be 6 for remote but it is not set and ends up being 0. So when the shares are queried and there is a condition for share type being 6 which then we end up with an empty list.

@yasharpm
Copy link

yasharpm commented Jun 6, 2023

To verify, simply check what is stored in the oc_share_external table.

michielbdejong added a commit to cs3org/reva that referenced this issue Jun 6, 2023
@michielbdejong
Copy link
Member Author

michielbdejong commented Jun 6, 2023

Fixed in the nextcloud-dev branch and the owncloud-dev branch.

Now still seeing:

2023-06-06 13:38:05.928 ERR ../reva/internal/grpc/services/ocminvitemanager/ocminvitemanager.go:326 > error fetching remote user details error="error: not found: " pid=216195 pkg=rgrpc traceid=da39ba7f048d0d1d60fde5f906ee6280

and:

2023-06-06 13:38:05.929 WRN ../reva/internal/grpc/services/authprovider/authprovider.go:170 > error authenticating user error="authsvc: error in Authenticate: internal error: error fetching remote user details" pid=216195 pkg=rgrpc traceid=97a2facedc1a8ec27e693ca89e5941b0

@michielbdejong
Copy link
Member Author

Current problem:

{"id":{"opaque_id":"1"},"resource_id":{"opaque_id":"fileid-\/einstein\/files\/asdf"},"permissions":{"permissions":{"add_grant":false,"create_container":false,"delete":false,"get_path":false,"get_quota":false,"initiate_file_download":false,"initiate_file_upload":false}},"grantee":{"type":1,"id":{"opaque_id":"einstein","idp":"mesh.pondersource.org"}},"owner":{"id":{"opaque_id":"unknown","idp":"unknown"}},"creator":{"id":{"opaque_id":"unknown","idp":"unknown"}},"ctime":{"seconds":0},"mtime":{"seconds":0}}

is translated to

{"status":{"code":"CODE_OK", "trace":"de59186060342862fa8979f63a46e871"}, "share":{"id":{"opaqueId":"1"}, "grantee":{"type":"GRANTEE_TYPE_USER", "userId":{}}, "owner":{}, "creator":{}, "ctime":{}, "mtime":{}}}

via

ShareAltMap &{ID:opaque_id:"1"  RemoteShareID: Permissions:permissions:<>  Grantee:0xc0003eb848 Owner: Creator: Ctime: Mtime:}

@michielbdejong
Copy link
Member Author

Should have used https://mholt.github.io/json-to-go/ a long time ago!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants