1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #pragma weak ucred_free = _ucred_free 30*7c478bd9Sstevel@tonic-gate #pragma weak ucred_get = _ucred_get 31*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getegid = _ucred_getegid 32*7c478bd9Sstevel@tonic-gate #pragma weak ucred_geteuid = _ucred_geteuid 33*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getgroups = _ucred_getgroups 34*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getpflags = _ucred_getpflags 35*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getpid = _ucred_getpid 36*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getzoneid = _ucred_getzoneid 37*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getprojid = _ucred_getprojid 38*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getprivset = _ucred_getprivset 39*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getrgid = _ucred_getrgid 40*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getruid = _ucred_getruid 41*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getsgid = _ucred_getsgid 42*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getsuid = _ucred_getsuid 43*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getauid = _ucred_getauid 44*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getasid = _ucred_getasid 45*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getatid = _ucred_getatid 46*7c478bd9Sstevel@tonic-gate #pragma weak ucred_getamask = _ucred_getamask 47*7c478bd9Sstevel@tonic-gate #pragma weak ucred_size = _ucred_size 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate #include "synonyms.h" 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate #define _STRUCTURED_PROC 1 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate #include "priv_private.h" 54*7c478bd9Sstevel@tonic-gate #include <errno.h> 55*7c478bd9Sstevel@tonic-gate #include <priv.h> 56*7c478bd9Sstevel@tonic-gate #include <stdarg.h> 57*7c478bd9Sstevel@tonic-gate #include <stdlib.h> 58*7c478bd9Sstevel@tonic-gate #include <stdio.h> 59*7c478bd9Sstevel@tonic-gate #include <unistd.h> 60*7c478bd9Sstevel@tonic-gate #include <ucred.h> 61*7c478bd9Sstevel@tonic-gate #include <limits.h> 62*7c478bd9Sstevel@tonic-gate #include <fcntl.h> 63*7c478bd9Sstevel@tonic-gate #include <door.h> 64*7c478bd9Sstevel@tonic-gate #include <alloca.h> 65*7c478bd9Sstevel@tonic-gate #include <sys/ucred.h> 66*7c478bd9Sstevel@tonic-gate #include <sys/procfs.h> 67*7c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 68*7c478bd9Sstevel@tonic-gate #include <sys/zone.h> 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate ucred_t * 71*7c478bd9Sstevel@tonic-gate _ucred_alloc(void) 72*7c478bd9Sstevel@tonic-gate { 73*7c478bd9Sstevel@tonic-gate ucred_t *r; 74*7c478bd9Sstevel@tonic-gate size_t sz = ucred_size(); 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate r = malloc(sz); 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate if (r != NULL) 79*7c478bd9Sstevel@tonic-gate r->uc_size = (uint32_t)sz; 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate return (r); 82*7c478bd9Sstevel@tonic-gate } 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate void 85*7c478bd9Sstevel@tonic-gate ucred_free(ucred_t *uc) 86*7c478bd9Sstevel@tonic-gate { 87*7c478bd9Sstevel@tonic-gate free(uc); 88*7c478bd9Sstevel@tonic-gate } 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate ucred_t * 92*7c478bd9Sstevel@tonic-gate ucred_get(pid_t pid) 93*7c478bd9Sstevel@tonic-gate { 94*7c478bd9Sstevel@tonic-gate ucred_t *uc; 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate uc = _ucred_alloc(); 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate if (uc == NULL) 99*7c478bd9Sstevel@tonic-gate return (NULL); 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate if (syscall(SYS_ucredsys, UCREDSYS_UCREDGET, pid, uc) != 0) { 102*7c478bd9Sstevel@tonic-gate ucred_free(uc); 103*7c478bd9Sstevel@tonic-gate return (NULL); 104*7c478bd9Sstevel@tonic-gate } 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate return (uc); 107*7c478bd9Sstevel@tonic-gate } 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate uid_t 110*7c478bd9Sstevel@tonic-gate ucred_geteuid(const ucred_t *uc) 111*7c478bd9Sstevel@tonic-gate { 112*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 113*7c478bd9Sstevel@tonic-gate const prcred_t *cr = UCCRED(uc); 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate if (cr == NULL) { 116*7c478bd9Sstevel@tonic-gate errno = EINVAL; 117*7c478bd9Sstevel@tonic-gate return (-1); 118*7c478bd9Sstevel@tonic-gate } 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate return (cr->pr_euid); 121*7c478bd9Sstevel@tonic-gate } 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate uid_t 124*7c478bd9Sstevel@tonic-gate ucred_getruid(const ucred_t *uc) 125*7c478bd9Sstevel@tonic-gate { 126*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 127*7c478bd9Sstevel@tonic-gate const prcred_t *cr = UCCRED(uc); 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate if (cr == NULL) { 130*7c478bd9Sstevel@tonic-gate errno = EINVAL; 131*7c478bd9Sstevel@tonic-gate return (-1); 132*7c478bd9Sstevel@tonic-gate } 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate return (cr->pr_ruid); 135*7c478bd9Sstevel@tonic-gate } 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate uid_t 138*7c478bd9Sstevel@tonic-gate ucred_getsuid(const ucred_t *uc) 139*7c478bd9Sstevel@tonic-gate { 140*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 141*7c478bd9Sstevel@tonic-gate const prcred_t *cr = UCCRED(uc); 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate if (cr == NULL) { 144*7c478bd9Sstevel@tonic-gate errno = EINVAL; 145*7c478bd9Sstevel@tonic-gate return (-1); 146*7c478bd9Sstevel@tonic-gate } 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate return (cr->pr_suid); 149*7c478bd9Sstevel@tonic-gate } 150*7c478bd9Sstevel@tonic-gate 151*7c478bd9Sstevel@tonic-gate gid_t 152*7c478bd9Sstevel@tonic-gate ucred_getegid(const ucred_t *uc) 153*7c478bd9Sstevel@tonic-gate { 154*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 155*7c478bd9Sstevel@tonic-gate const prcred_t *cr = UCCRED(uc); 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate if (cr == NULL) { 158*7c478bd9Sstevel@tonic-gate errno = EINVAL; 159*7c478bd9Sstevel@tonic-gate return (-1); 160*7c478bd9Sstevel@tonic-gate } 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gate return (cr->pr_egid); 163*7c478bd9Sstevel@tonic-gate } 164*7c478bd9Sstevel@tonic-gate 165*7c478bd9Sstevel@tonic-gate gid_t 166*7c478bd9Sstevel@tonic-gate ucred_getrgid(const ucred_t *uc) 167*7c478bd9Sstevel@tonic-gate { 168*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 169*7c478bd9Sstevel@tonic-gate const prcred_t *cr = UCCRED(uc); 170*7c478bd9Sstevel@tonic-gate 171*7c478bd9Sstevel@tonic-gate if (cr == NULL) { 172*7c478bd9Sstevel@tonic-gate errno = EINVAL; 173*7c478bd9Sstevel@tonic-gate return (-1); 174*7c478bd9Sstevel@tonic-gate } 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate return (cr->pr_rgid); 177*7c478bd9Sstevel@tonic-gate } 178*7c478bd9Sstevel@tonic-gate 179*7c478bd9Sstevel@tonic-gate gid_t 180*7c478bd9Sstevel@tonic-gate ucred_getsgid(const ucred_t *uc) 181*7c478bd9Sstevel@tonic-gate { 182*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 183*7c478bd9Sstevel@tonic-gate const prcred_t *cr = UCCRED(uc); 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate if (cr == NULL) { 186*7c478bd9Sstevel@tonic-gate errno = EINVAL; 187*7c478bd9Sstevel@tonic-gate return (-1); 188*7c478bd9Sstevel@tonic-gate } 189*7c478bd9Sstevel@tonic-gate 190*7c478bd9Sstevel@tonic-gate return (cr->pr_sgid); 191*7c478bd9Sstevel@tonic-gate } 192*7c478bd9Sstevel@tonic-gate 193*7c478bd9Sstevel@tonic-gate int 194*7c478bd9Sstevel@tonic-gate ucred_getgroups(const ucred_t *uc, const gid_t **grps) 195*7c478bd9Sstevel@tonic-gate { 196*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 197*7c478bd9Sstevel@tonic-gate const prcred_t *cr = UCCRED(uc); 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate if (cr == NULL) { 200*7c478bd9Sstevel@tonic-gate errno = EINVAL; 201*7c478bd9Sstevel@tonic-gate return (-1); 202*7c478bd9Sstevel@tonic-gate } 203*7c478bd9Sstevel@tonic-gate 204*7c478bd9Sstevel@tonic-gate if (cr->pr_ngroups > 0) 205*7c478bd9Sstevel@tonic-gate *grps = &cr->pr_groups[0]; 206*7c478bd9Sstevel@tonic-gate else 207*7c478bd9Sstevel@tonic-gate *grps = NULL; 208*7c478bd9Sstevel@tonic-gate 209*7c478bd9Sstevel@tonic-gate return (cr->pr_ngroups); 210*7c478bd9Sstevel@tonic-gate } 211*7c478bd9Sstevel@tonic-gate 212*7c478bd9Sstevel@tonic-gate const priv_set_t * 213*7c478bd9Sstevel@tonic-gate ucred_getprivset(const ucred_t *uc, priv_ptype_t set) 214*7c478bd9Sstevel@tonic-gate { 215*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 216*7c478bd9Sstevel@tonic-gate const prpriv_t *pr = UCPRIV(uc); 217*7c478bd9Sstevel@tonic-gate int pset = priv_getsetbyname(set); 218*7c478bd9Sstevel@tonic-gate priv_data_t *d; 219*7c478bd9Sstevel@tonic-gate 220*7c478bd9Sstevel@tonic-gate if (pr == NULL || pset == -1) { 221*7c478bd9Sstevel@tonic-gate errno = EINVAL; 222*7c478bd9Sstevel@tonic-gate return (NULL); 223*7c478bd9Sstevel@tonic-gate } 224*7c478bd9Sstevel@tonic-gate 225*7c478bd9Sstevel@tonic-gate LOADPRIVDATA(d); 226*7c478bd9Sstevel@tonic-gate 227*7c478bd9Sstevel@tonic-gate return ((const priv_set_t *) 228*7c478bd9Sstevel@tonic-gate &pr->pr_sets[d->pd_pinfo->priv_setsize * pset]); 229*7c478bd9Sstevel@tonic-gate } 230*7c478bd9Sstevel@tonic-gate 231*7c478bd9Sstevel@tonic-gate pid_t 232*7c478bd9Sstevel@tonic-gate ucred_getpid(const ucred_t *uc) 233*7c478bd9Sstevel@tonic-gate { 234*7c478bd9Sstevel@tonic-gate 235*7c478bd9Sstevel@tonic-gate if (uc->uc_pid == -1) 236*7c478bd9Sstevel@tonic-gate errno = EINVAL; 237*7c478bd9Sstevel@tonic-gate 238*7c478bd9Sstevel@tonic-gate return (uc->uc_pid); 239*7c478bd9Sstevel@tonic-gate } 240*7c478bd9Sstevel@tonic-gate 241*7c478bd9Sstevel@tonic-gate projid_t 242*7c478bd9Sstevel@tonic-gate ucred_getprojid(const ucred_t *uc) 243*7c478bd9Sstevel@tonic-gate { 244*7c478bd9Sstevel@tonic-gate 245*7c478bd9Sstevel@tonic-gate if (uc->uc_projid == -1) 246*7c478bd9Sstevel@tonic-gate errno = EINVAL; 247*7c478bd9Sstevel@tonic-gate 248*7c478bd9Sstevel@tonic-gate return (uc->uc_projid); 249*7c478bd9Sstevel@tonic-gate } 250*7c478bd9Sstevel@tonic-gate 251*7c478bd9Sstevel@tonic-gate zoneid_t 252*7c478bd9Sstevel@tonic-gate ucred_getzoneid(const ucred_t *uc) 253*7c478bd9Sstevel@tonic-gate { 254*7c478bd9Sstevel@tonic-gate 255*7c478bd9Sstevel@tonic-gate if (uc->uc_zoneid < MIN_ZONEID || uc->uc_zoneid > MAX_ZONEID) { 256*7c478bd9Sstevel@tonic-gate errno = EINVAL; 257*7c478bd9Sstevel@tonic-gate return (-1); 258*7c478bd9Sstevel@tonic-gate } 259*7c478bd9Sstevel@tonic-gate 260*7c478bd9Sstevel@tonic-gate return (uc->uc_zoneid); 261*7c478bd9Sstevel@tonic-gate } 262*7c478bd9Sstevel@tonic-gate 263*7c478bd9Sstevel@tonic-gate /* 264*7c478bd9Sstevel@tonic-gate * For now, assume single bit flags. 265*7c478bd9Sstevel@tonic-gate */ 266*7c478bd9Sstevel@tonic-gate uint_t 267*7c478bd9Sstevel@tonic-gate ucred_getpflags(const ucred_t *uc, uint_t flag) 268*7c478bd9Sstevel@tonic-gate { 269*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 270*7c478bd9Sstevel@tonic-gate prpriv_t *pr = UCPRIV(uc); 271*7c478bd9Sstevel@tonic-gate char *x, *end; 272*7c478bd9Sstevel@tonic-gate 273*7c478bd9Sstevel@tonic-gate if (pr == NULL) { 274*7c478bd9Sstevel@tonic-gate errno = EINVAL; 275*7c478bd9Sstevel@tonic-gate return ((uint_t)-1); 276*7c478bd9Sstevel@tonic-gate } 277*7c478bd9Sstevel@tonic-gate 278*7c478bd9Sstevel@tonic-gate end = (char *)pr + PRIV_PRPRIV_SIZE(pr); 279*7c478bd9Sstevel@tonic-gate x = end - pr->pr_infosize; 280*7c478bd9Sstevel@tonic-gate 281*7c478bd9Sstevel@tonic-gate while (x < end) { 282*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 283*7c478bd9Sstevel@tonic-gate priv_info_t *pi = (priv_info_t *)x; 284*7c478bd9Sstevel@tonic-gate priv_info_uint_t *pii; 285*7c478bd9Sstevel@tonic-gate 286*7c478bd9Sstevel@tonic-gate switch (pi->priv_info_type) { 287*7c478bd9Sstevel@tonic-gate case PRIV_INFO_FLAGS: 288*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 289*7c478bd9Sstevel@tonic-gate pii = (priv_info_uint_t *)x; 290*7c478bd9Sstevel@tonic-gate return ((pii->val & flag) ? 1 : 0); 291*7c478bd9Sstevel@tonic-gate } 292*7c478bd9Sstevel@tonic-gate /* Forward progress */ 293*7c478bd9Sstevel@tonic-gate if (pi->priv_info_size < sizeof (priv_info_t)) 294*7c478bd9Sstevel@tonic-gate break; 295*7c478bd9Sstevel@tonic-gate x += pi->priv_info_size; 296*7c478bd9Sstevel@tonic-gate } 297*7c478bd9Sstevel@tonic-gate 298*7c478bd9Sstevel@tonic-gate errno = EINVAL; 299*7c478bd9Sstevel@tonic-gate return ((uint_t)-1); 300*7c478bd9Sstevel@tonic-gate } 301*7c478bd9Sstevel@tonic-gate 302*7c478bd9Sstevel@tonic-gate au_id_t 303*7c478bd9Sstevel@tonic-gate ucred_getauid(const ucred_t *uc) 304*7c478bd9Sstevel@tonic-gate { 305*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 306*7c478bd9Sstevel@tonic-gate const auditinfo64_addr_t *ainfo = UCAUD(uc); 307*7c478bd9Sstevel@tonic-gate 308*7c478bd9Sstevel@tonic-gate if (ainfo == NULL) 309*7c478bd9Sstevel@tonic-gate return (AU_NOAUDITID); 310*7c478bd9Sstevel@tonic-gate 311*7c478bd9Sstevel@tonic-gate return (ainfo->ai_auid); 312*7c478bd9Sstevel@tonic-gate } 313*7c478bd9Sstevel@tonic-gate 314*7c478bd9Sstevel@tonic-gate au_asid_t 315*7c478bd9Sstevel@tonic-gate ucred_getasid(const ucred_t *uc) 316*7c478bd9Sstevel@tonic-gate { 317*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 318*7c478bd9Sstevel@tonic-gate const auditinfo64_addr_t *ainfo = UCAUD(uc); 319*7c478bd9Sstevel@tonic-gate 320*7c478bd9Sstevel@tonic-gate if (ainfo == NULL) 321*7c478bd9Sstevel@tonic-gate return (-1); 322*7c478bd9Sstevel@tonic-gate 323*7c478bd9Sstevel@tonic-gate return (ainfo->ai_asid); 324*7c478bd9Sstevel@tonic-gate } 325*7c478bd9Sstevel@tonic-gate 326*7c478bd9Sstevel@tonic-gate const au_tid64_addr_t * 327*7c478bd9Sstevel@tonic-gate ucred_getatid(const ucred_t *uc) 328*7c478bd9Sstevel@tonic-gate { 329*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 330*7c478bd9Sstevel@tonic-gate const auditinfo64_addr_t *ainfo = UCAUD(uc); 331*7c478bd9Sstevel@tonic-gate 332*7c478bd9Sstevel@tonic-gate if (ainfo == NULL) { 333*7c478bd9Sstevel@tonic-gate errno = EINVAL; 334*7c478bd9Sstevel@tonic-gate return (NULL); 335*7c478bd9Sstevel@tonic-gate } 336*7c478bd9Sstevel@tonic-gate 337*7c478bd9Sstevel@tonic-gate return (&ainfo->ai_termid); 338*7c478bd9Sstevel@tonic-gate } 339*7c478bd9Sstevel@tonic-gate 340*7c478bd9Sstevel@tonic-gate const au_mask_t * 341*7c478bd9Sstevel@tonic-gate ucred_getamask(const ucred_t *uc) 342*7c478bd9Sstevel@tonic-gate { 343*7c478bd9Sstevel@tonic-gate /* LINTED: alignment */ 344*7c478bd9Sstevel@tonic-gate const auditinfo64_addr_t *ainfo = UCAUD(uc); 345*7c478bd9Sstevel@tonic-gate 346*7c478bd9Sstevel@tonic-gate if (ainfo == NULL) { 347*7c478bd9Sstevel@tonic-gate errno = EINVAL; 348*7c478bd9Sstevel@tonic-gate return (NULL); 349*7c478bd9Sstevel@tonic-gate } 350*7c478bd9Sstevel@tonic-gate 351*7c478bd9Sstevel@tonic-gate return (&ainfo->ai_mask); 352*7c478bd9Sstevel@tonic-gate } 353*7c478bd9Sstevel@tonic-gate 354*7c478bd9Sstevel@tonic-gate size_t 355*7c478bd9Sstevel@tonic-gate ucred_size(void) 356*7c478bd9Sstevel@tonic-gate { 357*7c478bd9Sstevel@tonic-gate priv_data_t *d; 358*7c478bd9Sstevel@tonic-gate 359*7c478bd9Sstevel@tonic-gate LOADPRIVDATA(d); 360*7c478bd9Sstevel@tonic-gate 361*7c478bd9Sstevel@tonic-gate return (d->pd_ucredsize); 362*7c478bd9Sstevel@tonic-gate } 363