Lines Matching refs:cip

2212 get_projid(const char *str, struct method_context *cip)  in get_projid()  argument
2220 if (cip->uid == 0) { in get_projid()
2222 cip->project = NULL; in get_projid()
2226 switch (ret = lookup_pwd(cip)) { in get_projid()
2247 pp = getdefaultproj(cip->pwd.pw_name, &proj, buf, in get_projid()
2257 cip->project = strdup(str); in get_projid()
2258 return (cip->project != NULL ? 0 : ENOMEM); in get_projid()
2287 cip->project = strdup(pp->pj_name); in get_projid()
2289 return (cip->project != NULL ? 0 : ENOMEM); in get_projid()
2805 struct method_context *cip; in restarter_get_method_context() local
2835 cip = malloc(sizeof (*cip)); in restarter_get_method_context()
2836 if (cip == NULL) in restarter_get_method_context()
2839 (void) memset(cip, 0, sizeof (*cip)); in restarter_get_method_context()
2840 cip->uid = (uid_t)-1; in restarter_get_method_context()
2841 cip->euid = (uid_t)-1; in restarter_get_method_context()
2842 cip->gid = (gid_t)-1; in restarter_get_method_context()
2843 cip->egid = (gid_t)-1; in restarter_get_method_context()
2845 cip->vbuf_sz = scf_limit(SCF_LIMIT_MAX_VALUE_LENGTH); in restarter_get_method_context()
2846 assert(cip->vbuf_sz >= 0); in restarter_get_method_context()
2847 cip->vbuf = malloc(cip->vbuf_sz); in restarter_get_method_context()
2848 if (cip->vbuf == NULL) { in restarter_get_method_context()
2849 free(cip); in restarter_get_method_context()
2892 ret = get_environment(h, methpg, cip, prop, val); in restarter_get_method_context()
2894 ret = get_environment(h, instpg, cip, prop, val); in restarter_get_method_context()
2928 cip->uid = 0; in restarter_get_method_context()
2929 cip->gid = 0; in restarter_get_method_context()
3017 cip, err); in restarter_get_method_context()
3020 err = get_ids(pg, instpg, prop, val, cip, err); in restarter_get_method_context()
3059 ret = scf_value_get_astring(val, cip->vbuf, cip->vbuf_sz); in restarter_get_method_context()
3066 (void) strcpy(cip->vbuf, ":default"); in restarter_get_method_context()
3086 if (strcmp(cip->vbuf, ":default") == 0 || in restarter_get_method_context()
3087 strcmp(cip->vbuf, ":home") == 0) { in restarter_get_method_context()
3088 switch (ret = lookup_pwd(cip)) { in restarter_get_method_context()
3108 cip->working_dir = strdup(cip->pwd.pw_dir); in restarter_get_method_context()
3109 if (cip->working_dir == NULL) { in restarter_get_method_context()
3114 cip->working_dir = strdup(cip->vbuf); in restarter_get_method_context()
3115 if (cip->working_dir == NULL) { in restarter_get_method_context()
3149 (void) strlcpy(cip->vbuf, ":default", cip->vbuf_sz); in restarter_get_method_context()
3151 ret = scf_value_get_astring(val, cip->vbuf, in restarter_get_method_context()
3152 cip->vbuf_sz); in restarter_get_method_context()
3161 (void) strlcpy(cip->vbuf, ":default", cip->vbuf_sz); in restarter_get_method_context()
3182 if (scf_default_secflags(h, &cip->def_secflags) != 0) { in restarter_get_method_context()
3188 if (strcmp(cip->vbuf, ":default") != 0) { in restarter_get_method_context()
3189 if (secflags_parse(NULL, cip->vbuf, in restarter_get_method_context()
3190 &cip->secflag_delta) != 0) { in restarter_get_method_context()
3192 "security flags: %s", cip->vbuf); in restarter_get_method_context()
3227 ret = scf_value_get_astring(val, cip->vbuf, in restarter_get_method_context()
3228 cip->vbuf_sz); in restarter_get_method_context()
3231 cip->corefile_pattern = strdup(cip->vbuf); in restarter_get_method_context()
3232 if (cip->corefile_pattern == NULL) { in restarter_get_method_context()
3293 (void) strcpy(cip->vbuf, ":default"); in restarter_get_method_context()
3295 ret = scf_value_get_astring(val, cip->vbuf, in restarter_get_method_context()
3296 cip->vbuf_sz); in restarter_get_method_context()
3302 (void) strcpy(cip->vbuf, ":default"); in restarter_get_method_context()
3305 switch (ret = get_projid(cip->vbuf, cip)) { in restarter_get_method_context()
3316 cip->vbuf); in restarter_get_method_context()
3337 "Project ID \"%s\" too big.", cip->vbuf); in restarter_get_method_context()
3342 "Project ID \"%s\" is invalid.", cip->vbuf); in restarter_get_method_context()
3380 (void) strcpy(cip->vbuf, ":default"); in restarter_get_method_context()
3382 ret = scf_value_get_astring(val, cip->vbuf, in restarter_get_method_context()
3383 cip->vbuf_sz); in restarter_get_method_context()
3393 (void) strcpy(cip->vbuf, ":default"); in restarter_get_method_context()
3413 if (strcmp(cip->vbuf, ":default") != 0) { in restarter_get_method_context()
3414 cip->resource_pool = strdup(cip->vbuf); in restarter_get_method_context()
3415 if (cip->resource_pool == NULL) { in restarter_get_method_context()
3428 free(cip->pwbuf); in restarter_get_method_context()
3429 free(cip->vbuf); in restarter_get_method_context()
3430 free(cip->working_dir); in restarter_get_method_context()
3432 (void) memset(cip, 0, sizeof (*cip)); in restarter_get_method_context()
3433 cip->uid = 0; in restarter_get_method_context()
3434 cip->gid = 0; in restarter_get_method_context()
3435 cip->euid = (uid_t)-1; in restarter_get_method_context()
3436 cip->egid = (gid_t)-1; in restarter_get_method_context()
3438 if (scf_default_secflags(h, &cip->def_secflags) != 0) { in restarter_get_method_context()
3449 free(cip->working_dir); in restarter_get_method_context()
3450 cip->working_dir = NULL; in restarter_get_method_context()
3453 *mcpp = cip; in restarter_get_method_context()
3461 if (cip->pwbuf != NULL) { in restarter_get_method_context()
3462 free(cip->pwbuf); in restarter_get_method_context()
3463 cip->pwbuf = NULL; in restarter_get_method_context()
3466 free(cip->vbuf); in restarter_get_method_context()
3469 restarter_free_method_context(cip); in restarter_get_method_context()
3519 restarter_set_method_context(struct method_context *cip, const char **fp) in restarter_set_method_context() argument
3524 cip->pwbuf = NULL; in restarter_set_method_context()
3527 if (cip->gid != (gid_t)-1) { in restarter_set_method_context()
3528 if (setregid(cip->gid, in restarter_set_method_context()
3529 cip->egid != (gid_t)-1 ? cip->egid : cip->gid) != 0) { in restarter_set_method_context()
3537 if (cip->pwbuf == NULL) { in restarter_set_method_context()
3538 switch (ret = lookup_pwd(cip)) { in restarter_set_method_context()
3558 if (setregid(cip->pwd.pw_gid, in restarter_set_method_context()
3559 cip->egid != (gid_t)-1 ? in restarter_set_method_context()
3560 cip->egid : cip->pwd.pw_gid) != 0) { in restarter_set_method_context()
3569 if (cip->ngroups == -1) { in restarter_set_method_context()
3570 if (cip->pwbuf == NULL) { in restarter_set_method_context()
3571 switch (ret = lookup_pwd(cip)) { in restarter_set_method_context()
3592 if (initgroups(cip->pwd.pw_name, cip->gid) != 0) { in restarter_set_method_context()
3598 } else if (cip->ngroups > 0 && in restarter_set_method_context()
3599 setgroups(cip->ngroups, cip->groups) != 0) { in restarter_set_method_context()
3607 if (cip->corefile_pattern != NULL) { in restarter_set_method_context()
3610 if (core_set_process_path(cip->corefile_pattern, in restarter_set_method_context()
3611 strlen(cip->corefile_pattern) + 1, mypid) != 0) { in restarter_set_method_context()
3620 &cip->def_secflags.ss_default) != 0) { in restarter_set_method_context()
3627 &cip->def_secflags.ss_lower) != 0) { in restarter_set_method_context()
3634 &cip->def_secflags.ss_upper) != 0) { in restarter_set_method_context()
3641 &cip->secflag_delta) != 0) { in restarter_set_method_context()
3648 if (cip->project == NULL) { in restarter_set_method_context()
3663 switch (ret = lookup_pwd(cip)) { in restarter_set_method_context()
3684 switch (setproject(cip->project, cip->pwd.pw_name, in restarter_set_method_context()
3700 if (cip->resource_pool != NULL) { in restarter_set_method_context()
3706 if (pool_set_binding(cip->resource_pool, P_PID, in restarter_set_method_context()
3744 if (cip->lpriv_set != NULL) { in restarter_set_method_context()
3745 if (setppriv(PRIV_SET, PRIV_LIMIT, cip->lpriv_set) != 0) { in restarter_set_method_context()
3751 if (cip->priv_set != NULL) { in restarter_set_method_context()
3752 if (setppriv(PRIV_SET, PRIV_INHERITABLE, cip->priv_set) != 0) { in restarter_set_method_context()
3765 if (cip->lpriv_set == NULL && cip->priv_set != NULL) { in restarter_set_method_context()
3771 if (setreuid(cip->uid, in restarter_set_method_context()
3772 cip->euid != (uid_t)-1 ? cip->euid : cip->uid) != 0) { in restarter_set_method_context()
3779 if (cip->priv_set != NULL) { in restarter_set_method_context()
3780 if (setppriv(PRIV_SET, PRIV_PERMITTED, cip->priv_set) != 0) { in restarter_set_method_context()
3792 if (cip->working_dir != NULL) { in restarter_set_method_context()
3794 r = chdir(cip->working_dir); in restarter_set_method_context()
3805 free(cip->pwbuf); in restarter_set_method_context()
3806 cip->pwbuf = NULL; in restarter_set_method_context()