- pwnam=my_getpwnam(user);
- grnam=my_getgrnam(group);
- if (gid == -1 || pwnam==-1 || grnam==-1) {
- error_msg_and_die("%s: No such user\n", user);
+ /* Print full info like GNU id */
+ /* my_getpwuid doesn't exit on failure here */
+ status=printf_full(uid, my_getpwuid(NULL, uid, 0), 'u');
+ putchar(' ');
+ /* my_getgrgid doesn't exit on failure here */
+ status|=printf_full(gid, my_getgrgid(NULL, gid, 0), 'g');
+
+#ifdef CONFIG_SELINUX
+ if ( is_selinux_enabled() ) {
+ security_context_t mysid;
+ char context[80];
+ int len = sizeof(context);
+
+ getcon(&mysid);
+ context[0] = '\0';
+ if (mysid) {
+ len = strlen(mysid)+1;
+ safe_strncpy(context, mysid, len);
+ freecon(mysid);
+ }else{
+ safe_strncpy(context, "unknown",8);
+ }
+ bb_printf(" context=%s", context);