gid_t *sgids = NULL;
int sgid_count = 0;
if (getgroups_cb) {
- sgid_count = getgroups_cb(callback_handle, uid, &sgids);
- if (sgid_count < 0) {
+ sgid_count = getgroups_cb(callback_handle, &sgids);
+ if (sgid_count > 0) {
ldout(cct, 3) << "getgroups failed!" << dendl;
- return sgid_count;
}
}
#if HAVE_GETGROUPLIST
- else {
+ if (sgid_count <= 0) {
// use PAM to get the group list
// initial number of group entries, defaults to posix standard of 16
// PAM implementations may provide more than 16 groups....
vinodeno_t ino, string& name);
typedef int (*client_remount_callback_t)(void *handle);
-typedef int (*client_getgroups_callback_t)(void *handle, uid_t uid, gid_t **sgids);
+typedef int (*client_getgroups_callback_t)(void *handle, gid_t **sgids);
typedef void(*client_switch_interrupt_callback_t)(void *req, void *data);
struct client_callback_args {
}
#endif
-#if 0
-static int getgroups_cb(void *handle, uid_t uid, gid_t **sgids)
+static int getgroups_cb(void *handle, gid_t **sgids)
{
-#ifdef HAVE_FUSE_GETGROUPS
+#if FUSE_VERSION >= FUSE_MAKE_VERSION(2, 8)
+ CephFuse::Handle *cfuse = (CephFuse::Handle *)handle;
+ fuse_req_t req = cfuse->get_fuse_req();
+
assert(sgids);
- int c = fuse_getgroups(0, NULL);
+ int c = fuse_req_getgroups(req, 0, NULL);
if (c < 0) {
return c;
}
if (!*sgids) {
return -ENOMEM;
}
- c = fuse_getgroups(c, *sgids);
+ c = fuse_req_getgroups(req, c, *sgids);
if (c < 0) {
free(*sgids);
return c;
}
return c;
+#else
+ return -ENOSYS;
#endif
- return 0;
}
-#endif
static void ino_invalidate_cb(void *handle, vinodeno_t vino, int64_t off,
int64_t len)
dentry_cb: dentry_invalidate_cb,
switch_intr_cb: switch_interrupt_cb,
remount_cb: remount_cb,
- /*
- * this is broken:
- *
- * - the cb needs the request handle to be useful; we should get the
- * gids in the method here in fuse_ll.c and pass the gid list in,
- * not use a callback.
- * - the callback mallocs the list but it is not free()'d
- *
- * so disable it for now...
- getgroups_cb: getgroups_cb,
- */
+ getgroups_cb: getgroups_cb,
};
client->ll_register_callbacks(&args);