- if (gid == -1 || pwnam==-1 || grnam==-1) {
- error_msg_and_die("%s: No such user\n", user);
- }
- if (no_group)
- printf("%ld\n", pwnam);
- else if (no_user)
- printf("%ld\n", grnam);
- else
+
+ if (flags & (JUST_GROUP | JUST_USER)) {
+ char *s = group;
+ if (flags & JUST_USER) {
+ s = user;
+ grnam = pwnam;
+ }
+ if (flags & NAME_NOT_NUMBER) {
+ puts(s);
+ } else {
+ printf("%ld\n", grnam);
+ }
+ } else {
+#ifdef CONFIG_SELINUX
+ printf("uid=%ld(%s) gid=%ld(%s)", pwnam, user, grnam, group);
+ if(is_flask_enabled_flag)
+ {
+ security_id_t mysid = getsecsid();
+ char context[80];
+ int len = sizeof(context);
+ context[0] = '\0';
+ if(security_sid_to_context(mysid, context, &len))
+ strcpy(context, "unknown");
+ printf(" context=%s\n", context);
+ }
+ else
+ printf("\n");
+#else