busybox: squashed commit of merging cm-12.1

With fixes to LOCAL_C_INCLUDES for libsepol in M and fixed
some missing includes to enable building for 64 bit devices

Conflicts:
	Android.mk
	android/libc/arch-x86/syscalls/swapoff.S
	android/libc/arch-x86/syscalls/swapon.S
	android/libc/arch-x86/syscalls/sysinfo.S
	android/librpc/pmap_rmt.c
	android/reboot.c
	include-full/copy-current.sh
	include-minimal/copy-current.sh
	include/platform.h
	networking/interface.c
	networking/nslookup.c

Change-Id: If6092fa87f3d21190db1af4f70daa150eb462660
diff --git a/loginutils/login.c b/loginutils/login.c
index 6ec8dc4..862104c 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -17,9 +17,11 @@
 
 #if ENABLE_SELINUX
 # include <selinux/selinux.h>  /* for is_selinux_enabled()  */
+#ifndef __BIONIC__
 # include <selinux/get_context_list.h> /* for get_default_context() */
 # include <selinux/flask.h> /* for security class definitions  */
 #endif
+#endif
 
 #if ENABLE_PAM
 /* PAM may include <locale.h>. We may need to undefine bbox's stub define: */
@@ -118,7 +120,8 @@
 		bb_perror_msg_and_die("security_change_sid(%s) failed", full_tty);
 	}
 	if (setfilecon(full_tty, new_tty_sid) != 0) {
-		bb_perror_msg_and_die("chsid(%s, %s) failed", full_tty, new_tty_sid);
+		if (strcmp(old_tty_sid, new_tty_sid))
+			bb_perror_msg_and_die("chsid(%s, %s) failed", full_tty, new_tty_sid);
 	}
 }
 #endif
@@ -397,7 +400,7 @@
 					pam_strerror(pamh, pamret), pamret);
 		safe_strncpy(username, "UNKNOWN", sizeof(username));
 #else /* not PAM */
-		pw = getpwnam(username);
+		pw = safegetpwnam(username);
 		if (!pw) {
 			strcpy(username, "UNKNOWN");
 			goto fake_it;
@@ -420,7 +423,7 @@
 		 * Note that reads (in no-echo mode) trash tty attributes.
 		 * If we get interrupted by SIGALRM, we need to restore attrs.
 		 */
-		if (correct_password(pw))
+		if (ask_and_check_password(pw) > 0)
 			break;
 #endif /* ENABLE_PAM */
  auth_failed: