Lines Matching refs:cip
2382 get_projid(const char *str, struct method_context *cip)
2390 if (cip->uid == 0) {
2392 cip->project = NULL;
2396 switch (ret = lookup_pwd(cip)) {
2417 pp = getdefaultproj(cip->pwd.pw_name, &proj, buf,
2427 cip->project = strdup(str);
2428 return (cip->project != NULL ? 0 : ENOMEM);
2457 cip->project = strdup(pp->pj_name);
2459 return (cip->project != NULL ? 0 : ENOMEM);
2997 struct method_context *cip;
3016 cip = malloc(sizeof (*cip));
3017 if (cip == NULL)
3020 (void) memset(cip, 0, sizeof (*cip));
3021 cip->uid = (uid_t)-1;
3022 cip->euid = (uid_t)-1;
3023 cip->gid = (gid_t)-1;
3024 cip->egid = (gid_t)-1;
3026 cip->vbuf_sz = scf_limit(SCF_LIMIT_MAX_VALUE_LENGTH);
3027 assert(cip->vbuf_sz >= 0);
3028 cip->vbuf = malloc(cip->vbuf_sz);
3029 if (cip->vbuf == NULL) {
3030 free(cip);
3072 ret = get_environment(h, methpg, cip, prop, val);
3074 ret = get_environment(h, instpg, cip, prop, val);
3108 cip->uid = 0;
3109 cip->gid = 0;
3197 cip, err);
3199 err = get_ids(pg, instpg, prop, val, cip, err);
3237 ret = scf_value_get_astring(val, cip->vbuf, cip->vbuf_sz);
3244 (void) strcpy(cip->vbuf, ":default");
3264 if (strcmp(cip->vbuf, ":default") == 0 ||
3265 strcmp(cip->vbuf, ":home") == 0) {
3266 switch (ret = lookup_pwd(cip)) {
3286 cip->working_dir = strdup(cip->pwd.pw_dir);
3287 if (cip->working_dir == NULL) {
3292 cip->working_dir = strdup(cip->vbuf);
3293 if (cip->working_dir == NULL) {
3329 ret = scf_value_get_astring(val, cip->vbuf,
3330 cip->vbuf_sz);
3333 cip->corefile_pattern = strdup(cip->vbuf);
3334 if (cip->corefile_pattern == NULL) {
3395 (void) strcpy(cip->vbuf, ":default");
3397 ret = scf_value_get_astring(val, cip->vbuf,
3398 cip->vbuf_sz);
3404 (void) strcpy(cip->vbuf, ":default");
3407 switch (ret = get_projid(cip->vbuf, cip)) {
3418 cip->vbuf);
3439 "Project ID \"%s\" too big.", cip->vbuf);
3444 "Project ID \"%s\" is invalid.", cip->vbuf);
3482 (void) strcpy(cip->vbuf, ":default");
3484 ret = scf_value_get_astring(val, cip->vbuf,
3485 cip->vbuf_sz);
3495 (void) strcpy(cip->vbuf, ":default");
3515 if (strcmp(cip->vbuf, ":default") != 0) {
3516 cip->resource_pool = strdup(cip->vbuf);
3517 if (cip->resource_pool == NULL) {
3530 free(cip->pwbuf);
3531 free(cip->vbuf);
3532 free(cip->working_dir);
3534 (void) memset(cip, 0, sizeof (*cip));
3535 cip->uid = 0;
3536 cip->gid = 0;
3537 cip->euid = (uid_t)-1;
3538 cip->egid = (gid_t)-1;
3541 *mcpp = cip;
3549 if (cip->pwbuf != NULL)
3550 free(cip->pwbuf);
3551 free(cip->vbuf);
3553 cip->pwbuf = NULL;
3554 cip->vbuf = NULL;
3557 restarter_free_method_context(cip);
3569 * environment variables in cip->env.
3607 restarter_set_method_context(struct method_context *cip, const char **fp)
3612 cip->pwbuf = NULL;
3615 if (cip->gid != (gid_t)-1) {
3616 if (setregid(cip->gid,
3617 cip->egid != (gid_t)-1 ? cip->egid : cip->gid) != 0) {
3625 if (cip->pwbuf == NULL) {
3626 switch (ret = lookup_pwd(cip)) {
3646 if (setregid(cip->pwd.pw_gid,
3647 cip->egid != (gid_t)-1 ?
3648 cip->egid : cip->pwd.pw_gid) != 0) {
3657 if (cip->ngroups == -1) {
3658 if (cip->pwbuf == NULL) {
3659 switch (ret = lookup_pwd(cip)) {
3679 /* Ok if cip->gid == -1 */
3680 if (initgroups(cip->pwd.pw_name, cip->gid) != 0) {
3686 } else if (cip->ngroups > 0 &&
3687 setgroups(cip->ngroups, cip->groups) != 0) {
3695 if (cip->corefile_pattern != NULL) {
3698 if (core_set_process_path(cip->corefile_pattern,
3699 strlen(cip->corefile_pattern) + 1, mypid) != 0) {
3707 if (cip->project == NULL) {
3722 switch (ret = lookup_pwd(cip)) {
3743 switch (setproject(cip->project, cip->pwd.pw_name,
3759 if (cip->resource_pool != NULL) {
3765 if (pool_set_binding(cip->resource_pool, P_PID,
3803 if (cip->lpriv_set != NULL) {
3804 if (setppriv(PRIV_SET, PRIV_LIMIT, cip->lpriv_set) != 0) {
3810 if (cip->priv_set != NULL) {
3811 if (setppriv(PRIV_SET, PRIV_INHERITABLE, cip->priv_set) != 0) {
3817 if (cip->xpctxt != NULL) {
3818 priv_set_t *rset = xpol_restricted_privs(cip->xpctxt);
3830 if (xpol_context_install(cip->xpctxt) != 0) {
3843 if (cip->lpriv_set == NULL && cip->priv_set != NULL) {
3849 if (setreuid(cip->uid,
3850 cip->euid != (uid_t)-1 ? cip->euid : cip->uid) != 0) {
3857 if (cip->priv_set != NULL) {
3858 if (setppriv(PRIV_SET, PRIV_PERMITTED, cip->priv_set) != 0) {
3870 if (cip->working_dir != NULL) {
3872 r = chdir(cip->working_dir);
3883 free(cip->pwbuf);
3884 cip->pwbuf = NULL;