} 
int mls_context_to_sid(char oldc,		       char **scontext,		       struct context *context,		       struct sidtab *s,		       u32 def_sid){	char delim;	char *scontextp, *p, *rngptr;	struct level_datum *levdatum;	struct cat_datum *catdatum, *rngdatum;	int l, rc = -EINVAL;	if (!selinux_mls_enabled)		return 0;	/*	 * No MLS component to the security context, try and map to	 * default if provided.	 */	if (!oldc) {		struct context *defcon;		if (def_sid == SECSID_NULL)			goto out;		defcon = sidtab_search(s, def_sid);		if (!defcon)			goto out;		rc = mls_copy_context(context, defcon);		goto out;	}	/* Extract low sensitivity. */	scontextp = p = *scontext;	while (*p && *p != ':' && *p != '-')		p++;	delim = *p;	if (delim != 0)		*p++ = 0;	for (l = 0; l < 2; l++) {		levdatum = hashtab_search(policydb.p_levels.table, scontextp);		if (!levdatum) {			rc = -EINVAL;			goto out;		}		context->range.level[l].sens = levdatum->level->sens;		if (delim == ':') {			/* Extract category set. */			while (1) {				scontextp = p;				while (*p && *p != ',' && *p != '-')					p++;				delim = *p;				if (delim != 0)					*p++ = 0;				/* Separate into range if exists */				if ((rngptr = strchr(scontextp, '.')) != NULL) {					/* Remove '.' */					*rngptr++ = 0;				}				catdatum = hashtab_search(policydb.p_cats.table,				                          scontextp);				if (!catdatum) {					rc = -EINVAL;					goto out;				}				rc = ebitmap_set_bit(&context->range.level[l].cat,				                     catdatum->value - 1, 1);				if (rc)					goto out;				/* If range, set all categories in range */				if (rngptr) {					int i;					rngdatum = hashtab_search(policydb.p_cats.table, rngptr);					if (!rngdatum) {						rc = -EINVAL;						goto out;					}					if (catdatum->value >= rngdatum->value) {						rc = -EINVAL;						goto out;					}					for (i = catdatum->value; i < rngdatum->value; i++) {						rc = ebitmap_set_bit(&context->range.level[l].cat, i, 1);						if (rc)							goto out;					}				}				if (delim != ',')					break;			}		}		if (delim == '-') {			/* Extract high sensitivity. */			scontextp = p;			while (*p && *p != ':')				p++;			delim = *p;			if (delim != 0)				*p++ = 0;		} else			break;	}	if (l == 0) {		context->range.level[1].sens = context->range.level[0].sens;		rc = ebitmap_cpy(&context->range.level[1].cat,				 &context->range.level[0].cat);		if (rc)			goto out;	}	*scontext = ++p;	rc = 0;out:	return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/e517a0cd859ae0c4d9451107113fc2b076456f8f/mls.c/buggy/security/selinux/ss/mls.c