summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/auth/addr
Commit message (Expand)AuthorAgeFilesLines
* protocol/auth: Fix a possible double free.Raghavendra Talur2014-02-191-0/+1
* dual license: update remaining files with correct license textKaleb S. KEITHLEY2013-10-241-13/+4
* Use proper libtool option -avoid-version instead of bogus -avoidversionAnand Avati2013-02-071-1/+1
* build: split CPPFLAGS from CFLAGSJeff Darcy2012-10-031-2/+4
* build: remove useless explicit -fPIC -shared fromJeff Darcy2012-10-031-2/+2
* build: remove -nostartfiles flagJeff Darcy2012-10-021-1/+1
* build: consolidate common compilation flags into one variableJeff Darcy2012-10-011-1/+1
* remove useless if-before-free (and free-like) functionsJim Meyering2012-07-131-2/+1
* license: dual license under GPLV2 and LGPLV3+Kaleb KEITHLEY2012-05-101-1/+1
* mgmt/glusterd : volume set validation fixesKaushal M2012-03-181-3/+3
* glusterd: auth allow enhancementsRajesh Amaravathi2012-02-202-8/+3
* Change Copyright current yearPranith Kumar K2011-08-101-1/+1
* LICENSE: s/GNU Affero General Public/GNU General Public/Pranith Kumar K2011-08-061-3/+3
* gf_auth also needs to handle server.allow-insecureshishir gowda2011-05-041-1/+15
* protocol/auth directory updated with whitespace cleanup and proper logsAmar Tumballi2011-03-171-196/+196
* Copyright changesVijay Bellur2010-10-111-1/+1
* Change GNU GPL to GNU AGPLPranith K2010-10-041-3/+3
* protocol/lib: rename files to standardized names and placesAnand Avati2010-07-141-3/+2
* rpc protocolAmar Tumballi2010-06-212-4/+0
* renamed xlator/protocol to xlator/protocol/legacyAmar Tumballi2010-06-212-1/+8
* structuring of protocol - 2Amar Tumballi2010-05-033-0/+241
class='del'>- else {
- GF_FREE (mygroups);
- return -1;
- }
- }
+ return ret;
+ }
- if (root->ngrps == 0) {
- ret = 0;
- goto out;
- }
+ ret = getpwuid_r(root->uid, &mypw, mystrs, sizeof(mystrs), &result);
+ if (ret != 0) {
+ gf_smsg("gid-cache", GF_LOG_ERROR, errno, PS_MSG_GET_UID_FAILED,
+ "uid=%u", root->uid, NULL);
+ return -1;
+ }
- call_stack_set_groups (root, root->ngrps, mygroups);
+ if (!result) {
+ gf_smsg("gid-cache", GF_LOG_ERROR, 0, PS_MSG_UID_NOT_FOUND, "uid=%u",
+ root->uid, NULL);
+ return -1;
+ }
-out:
- if (agl) {
- gid_cache_release (&conf->gid_cache, agl);
- } else {
- if (gid_cache_add (&conf->gid_cache, &gl) != 1)
- GF_FREE (gl.gl_list);
- }
+ gf_msg_trace("gid-cache", 0, "mapped %u => %s", root->uid, result->pw_name);
- return ret;
+ ngroups = gf_getgrouplist(result->pw_name, root->gid, &mygroups);
+ if (ngroups == -1) {
+ gf_smsg("gid-cache", GF_LOG_ERROR, 0, PS_MSG_MAPPING_ERROR,
+ "pw_name=%s", result->pw_name, "root->ngtps=%d", root->ngrps,
+ NULL);
+ return -1;
+ }
+ root->ngrps = (uint16_t)ngroups;
+
+ /* setup a full gid_list_t to add it to the gid_cache */
+ gl.gl_id = root->uid;
+ gl.gl_uid = root->uid;
+ gl.gl_gid = root->gid;
+ gl.gl_count = root->ngrps;
+
+ gl.gl_list = GF_MALLOC(root->ngrps * sizeof(gid_t), gf_common_mt_groups_t);
+ if (gl.gl_list)
+ memcpy(gl.gl_list, mygroups, sizeof(gid_t) * root->ngrps);
+ else {
+ GF_FREE(mygroups);
+ return -1;
+ }
+
+ if (root->ngrps > 0) {
+ call_stack_set_groups(root, root->ngrps, &mygroups);
+ }
+
+ if (gid_cache_add(&conf->gid_cache, &gl) != 1)
+ GF_FREE(gl.gl_list);
+
+ return ret;
}
int
-server_resolve_groups (call_frame_t *frame, rpcsvc_request_t *req)
+server_resolve_groups(call_frame_t *frame, rpcsvc_request_t *req)
{
- xlator_t *this = NULL;
- server_conf_t *conf = NULL;
+ xlator_t *this = NULL;
+ server_conf_t *conf = NULL;
- GF_VALIDATE_OR_GOTO ("server", frame, out);
- GF_VALIDATE_OR_GOTO ("server", req, out);
+ GF_VALIDATE_OR_GOTO("server", frame, out);
+ GF_VALIDATE_OR_GOTO("server", req, out);
- this = req->trans->xl;
- conf = this->private;
+ this = req->trans->xl;
+ conf = this->private;
- return gid_resolve (conf, frame->root);
+ return gid_resolve(conf, frame->root);
out:
- return -1;
+ return -1;
}
int
-server_decode_groups (call_frame_t *frame, rpcsvc_request_t *req)
+server_decode_groups(call_frame_t *frame, rpcsvc_request_t *req)
{
- int i = 0;
+ int i = 0;
- GF_VALIDATE_OR_GOTO ("server", frame, out);
- GF_VALIDATE_OR_GOTO ("server", req, out);
+ GF_VALIDATE_OR_GOTO("server", frame, out);
+ GF_VALIDATE_OR_GOTO("server", req, out);
- if (call_stack_alloc_groups (frame->root, req->auxgidcount) != 0)
- return -1;
+ if (call_stack_alloc_groups(frame->root, req->auxgidcount) != 0)
+ return -1;
- frame->root->ngrps = req->auxgidcount;
- if (frame->root->ngrps == 0)
- return 0;
+ frame->root->ngrps = req->auxgidcount;
+ if (frame->root->ngrps == 0)
+ return 0;
- /* ngrps cannot be bigger than USHRT_MAX(65535) */
- if (frame->root->ngrps > GF_MAX_AUX_GROUPS)
- return -1;
+ /* ngrps cannot be bigger than USHRT_MAX(65535) */
+ if (frame->root->ngrps > GF_MAX_AUX_GROUPS)
+ return -1;
- for (; i < frame->root->ngrps; ++i)
- frame->root->groups[i] = req->auxgids[i];
+ for (; i < frame->root->ngrps; ++i)
+ frame->root->groups[i] = req->auxgids[i];
out:
- return 0;
+ return 0;
}
-
void
-server_loc_wipe (loc_t *loc)