On Sat, 27 Aug 2011, Eric Paris <eparis@xxxxxxxxxxxxxx> wrote: > Must have come from this patch. > > commit d784fd71b56cb8f57d5b9fcd784094e004bf7c6a > Author: Russell Coker <russell@xxxxxxxxxxxx> > Date: Wed Jan 5 19:30:25 2011 +1100 > > libsemanage: patch for MCS/MLS in user files > What do you think of the attached patch? -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/
diff -ru libsemanage-2.0.46.old/src/genhomedircon.c libsemanage-2.0.46/src/genhomedircon.c --- libsemanage-2.0.46.old/src/genhomedircon.c 2011-08-29 19:51:05.000000000 +1000 +++ libsemanage-2.0.46/src/genhomedircon.c 2011-08-29 20:18:23.000000000 +1000 @@ -629,9 +629,12 @@ home = strdup(h); if (!home) goto cleanup; - level = strdup(l); - if (!level) - goto cleanup; + if(l) + { + level = strdup(l); + if (!level) + goto cleanup; + } temp->name = name; temp->sename = sename; @@ -675,15 +678,18 @@ { char *fallback_user = strdup(user); char *fallback_user_prefix = strdup(prefix); - char *fallback_user_level = strdup(level); + char *fallback_user_level; - if (fallback_user == NULL || fallback_user_prefix == NULL || fallback_user_level == NULL) { + if (fallback_user == NULL || fallback_user_prefix == NULL) { free(fallback_user); free(fallback_user_prefix); free(fallback_user_level); return STATUS_ERR; } + if(level) + fallback_user_level = strdup(level); + free(s->fallback_user); free(s->fallback_user_prefix); free(s->fallback_user_level); @@ -727,7 +733,7 @@ if (semanage_user_query(s->h_semanage, key, &the_user) < 0) { prefix = name; - level = "s0"; + level = FALLBACK_USER_LEVEL; } else { @@ -818,7 +824,7 @@ level = semanage_user_get_mlslevel(*u); } else { prefix = name; - level = "s0"; + level = FALLBACK_USER_LEVEL; } retval = getpwnam_r(name, &pwstorage, rbuf, rbuflen, &pwent);