From b8ac296454f118df339d5b7ab6fb6a3208a9998c Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Mon, 2 Apr 2018 07:27:06 -0400 Subject: [PATCH] client: remove _getgrouplist Nothing calls it. Signed-off-by: Jeff Layton --- src/client/Client.cc | 57 -------------------------------------------- src/client/Client.h | 1 - 2 files changed, 58 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 5b4305d0cde04..2b1a938961b71 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -5124,63 +5124,6 @@ void Client::handle_cap_grant(MetaSession *session, Inode *in, Cap *cap, MClient m->put(); } -int Client::_getgrouplist(gid_t** sgids, uid_t uid, gid_t gid) -{ - // cppcheck-suppress variableScope - int sgid_count; - gid_t *sgid_buf; - - if (getgroups_cb) { - sgid_count = getgroups_cb(callback_handle, &sgid_buf); - if (sgid_count > 0) { - *sgids = sgid_buf; - return sgid_count; - } - } - -#if HAVE_GETGROUPLIST - struct passwd *pw; - pw = getpwuid(uid); - if (pw == NULL) { - ldout(cct, 3) << "getting user entry failed" << dendl; - return -errno; - } - //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.... - sgid_count = 16; - sgid_buf = (gid_t*)malloc(sgid_count * sizeof(gid_t)); - if (sgid_buf == NULL) { - ldout(cct, 3) << "allocating group memory failed" << dendl; - return -ENOMEM; - } - - while (1) { -#if defined(__APPLE__) - if (getgrouplist(pw->pw_name, gid, (int*)sgid_buf, &sgid_count) == -1) { -#else - if (getgrouplist(pw->pw_name, gid, sgid_buf, &sgid_count) == -1) { -#endif - // we need to resize the group list and try again - void *_realloc = NULL; - if ((_realloc = realloc(sgid_buf, sgid_count * sizeof(gid_t))) == NULL) { - ldout(cct, 3) << "allocating group memory failed" << dendl; - free(sgid_buf); - return -ENOMEM; - } - sgid_buf = (gid_t*)_realloc; - continue; - } - // list was successfully retrieved - break; - } - *sgids = sgid_buf; - return sgid_count; -#else - return 0; -#endif -} - int Client::inode_permission(Inode *in, const UserPerm& perms, unsigned want) { if (perms.uid() == 0) diff --git a/src/client/Client.h b/src/client/Client.h index eaea2068e4f58..59479f13ccd5d 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -875,7 +875,6 @@ private: int may_hardlink(Inode *in, const UserPerm& perms); int _getattr_for_perm(Inode *in, const UserPerm& perms); - int _getgrouplist(gid_t **sgids, uid_t uid, gid_t gid); vinodeno_t _get_vino(Inode *in); inodeno_t _get_inodeno(Inode *in); -- 2.39.5