Lines Matching refs:cip

2210 get_projid(const char *str, struct method_context *cip)  in get_projid()  argument
2218 if (cip->uid == 0) { in get_projid()
2220 cip->project = NULL; in get_projid()
2224 switch (ret = lookup_pwd(cip)) { in get_projid()
2245 pp = getdefaultproj(cip->pwd.pw_name, &proj, buf, in get_projid()
2255 cip->project = strdup(str); in get_projid()
2256 return (cip->project != NULL ? 0 : ENOMEM); in get_projid()
2285 cip->project = strdup(pp->pj_name); in get_projid()
2287 return (cip->project != NULL ? 0 : ENOMEM); in get_projid()
2804 struct method_context *cip; in restarter_get_method_context() local
2823 cip = malloc(sizeof (*cip)); in restarter_get_method_context()
2824 if (cip == NULL) in restarter_get_method_context()
2827 (void) memset(cip, 0, sizeof (*cip)); in restarter_get_method_context()
2828 cip->uid = (uid_t)-1; in restarter_get_method_context()
2829 cip->euid = (uid_t)-1; in restarter_get_method_context()
2830 cip->gid = (gid_t)-1; in restarter_get_method_context()
2831 cip->egid = (gid_t)-1; in restarter_get_method_context()
2833 cip->vbuf_sz = scf_limit(SCF_LIMIT_MAX_VALUE_LENGTH); in restarter_get_method_context()
2834 assert(cip->vbuf_sz >= 0); in restarter_get_method_context()
2835 cip->vbuf = malloc(cip->vbuf_sz); in restarter_get_method_context()
2836 if (cip->vbuf == NULL) { in restarter_get_method_context()
2837 free(cip); in restarter_get_method_context()
2879 ret = get_environment(h, methpg, cip, prop, val); in restarter_get_method_context()
2881 ret = get_environment(h, instpg, cip, prop, val); in restarter_get_method_context()
2915 cip->uid = 0; in restarter_get_method_context()
2916 cip->gid = 0; in restarter_get_method_context()
3004 cip, err); in restarter_get_method_context()
3006 err = get_ids(pg, instpg, prop, val, cip, err); in restarter_get_method_context()
3044 ret = scf_value_get_astring(val, cip->vbuf, cip->vbuf_sz); in restarter_get_method_context()
3051 (void) strcpy(cip->vbuf, ":default"); in restarter_get_method_context()
3071 if (strcmp(cip->vbuf, ":default") == 0 || in restarter_get_method_context()
3072 strcmp(cip->vbuf, ":home") == 0) { in restarter_get_method_context()
3073 switch (ret = lookup_pwd(cip)) { in restarter_get_method_context()
3093 cip->working_dir = strdup(cip->pwd.pw_dir); in restarter_get_method_context()
3094 if (cip->working_dir == NULL) { in restarter_get_method_context()
3099 cip->working_dir = strdup(cip->vbuf); in restarter_get_method_context()
3100 if (cip->working_dir == NULL) { in restarter_get_method_context()
3136 ret = scf_value_get_astring(val, cip->vbuf, in restarter_get_method_context()
3137 cip->vbuf_sz); in restarter_get_method_context()
3140 cip->corefile_pattern = strdup(cip->vbuf); in restarter_get_method_context()
3141 if (cip->corefile_pattern == NULL) { in restarter_get_method_context()
3202 (void) strcpy(cip->vbuf, ":default"); in restarter_get_method_context()
3204 ret = scf_value_get_astring(val, cip->vbuf, in restarter_get_method_context()
3205 cip->vbuf_sz); in restarter_get_method_context()
3211 (void) strcpy(cip->vbuf, ":default"); in restarter_get_method_context()
3214 switch (ret = get_projid(cip->vbuf, cip)) { in restarter_get_method_context()
3225 cip->vbuf); in restarter_get_method_context()
3246 "Project ID \"%s\" too big.", cip->vbuf); in restarter_get_method_context()
3251 "Project ID \"%s\" is invalid.", cip->vbuf); in restarter_get_method_context()
3289 (void) strcpy(cip->vbuf, ":default"); in restarter_get_method_context()
3291 ret = scf_value_get_astring(val, cip->vbuf, in restarter_get_method_context()
3292 cip->vbuf_sz); in restarter_get_method_context()
3302 (void) strcpy(cip->vbuf, ":default"); in restarter_get_method_context()
3322 if (strcmp(cip->vbuf, ":default") != 0) { in restarter_get_method_context()
3323 cip->resource_pool = strdup(cip->vbuf); in restarter_get_method_context()
3324 if (cip->resource_pool == NULL) { in restarter_get_method_context()
3337 free(cip->pwbuf); in restarter_get_method_context()
3338 free(cip->vbuf); in restarter_get_method_context()
3339 free(cip->working_dir); in restarter_get_method_context()
3341 (void) memset(cip, 0, sizeof (*cip)); in restarter_get_method_context()
3342 cip->uid = 0; in restarter_get_method_context()
3343 cip->gid = 0; in restarter_get_method_context()
3344 cip->euid = (uid_t)-1; in restarter_get_method_context()
3345 cip->egid = (gid_t)-1; in restarter_get_method_context()
3348 *mcpp = cip; in restarter_get_method_context()
3356 if (cip->pwbuf != NULL) { in restarter_get_method_context()
3357 free(cip->pwbuf); in restarter_get_method_context()
3358 cip->pwbuf = NULL; in restarter_get_method_context()
3361 free(cip->vbuf); in restarter_get_method_context()
3364 restarter_free_method_context(cip); in restarter_get_method_context()
3414 restarter_set_method_context(struct method_context *cip, const char **fp) in restarter_set_method_context() argument
3419 cip->pwbuf = NULL; in restarter_set_method_context()
3422 if (cip->gid != (gid_t)-1) { in restarter_set_method_context()
3423 if (setregid(cip->gid, in restarter_set_method_context()
3424 cip->egid != (gid_t)-1 ? cip->egid : cip->gid) != 0) { in restarter_set_method_context()
3432 if (cip->pwbuf == NULL) { in restarter_set_method_context()
3433 switch (ret = lookup_pwd(cip)) { in restarter_set_method_context()
3453 if (setregid(cip->pwd.pw_gid, in restarter_set_method_context()
3454 cip->egid != (gid_t)-1 ? in restarter_set_method_context()
3455 cip->egid : cip->pwd.pw_gid) != 0) { in restarter_set_method_context()
3464 if (cip->ngroups == -1) { in restarter_set_method_context()
3465 if (cip->pwbuf == NULL) { in restarter_set_method_context()
3466 switch (ret = lookup_pwd(cip)) { in restarter_set_method_context()
3487 if (initgroups(cip->pwd.pw_name, cip->gid) != 0) { in restarter_set_method_context()
3493 } else if (cip->ngroups > 0 && in restarter_set_method_context()
3494 setgroups(cip->ngroups, cip->groups) != 0) { in restarter_set_method_context()
3502 if (cip->corefile_pattern != NULL) { in restarter_set_method_context()
3505 if (core_set_process_path(cip->corefile_pattern, in restarter_set_method_context()
3506 strlen(cip->corefile_pattern) + 1, mypid) != 0) { in restarter_set_method_context()
3514 if (cip->project == NULL) { in restarter_set_method_context()
3529 switch (ret = lookup_pwd(cip)) { in restarter_set_method_context()
3550 switch (setproject(cip->project, cip->pwd.pw_name, in restarter_set_method_context()
3566 if (cip->resource_pool != NULL) { in restarter_set_method_context()
3572 if (pool_set_binding(cip->resource_pool, P_PID, in restarter_set_method_context()
3610 if (cip->lpriv_set != NULL) { in restarter_set_method_context()
3611 if (setppriv(PRIV_SET, PRIV_LIMIT, cip->lpriv_set) != 0) { in restarter_set_method_context()
3617 if (cip->priv_set != NULL) { in restarter_set_method_context()
3618 if (setppriv(PRIV_SET, PRIV_INHERITABLE, cip->priv_set) != 0) { in restarter_set_method_context()
3631 if (cip->lpriv_set == NULL && cip->priv_set != NULL) { in restarter_set_method_context()
3637 if (setreuid(cip->uid, in restarter_set_method_context()
3638 cip->euid != (uid_t)-1 ? cip->euid : cip->uid) != 0) { in restarter_set_method_context()
3645 if (cip->priv_set != NULL) { in restarter_set_method_context()
3646 if (setppriv(PRIV_SET, PRIV_PERMITTED, cip->priv_set) != 0) { in restarter_set_method_context()
3658 if (cip->working_dir != NULL) { in restarter_set_method_context()
3660 r = chdir(cip->working_dir); in restarter_set_method_context()
3671 free(cip->pwbuf); in restarter_set_method_context()
3672 cip->pwbuf = NULL; in restarter_set_method_context()