Get openssh to work when installed as a developer or test pacakage.

scp hardcodes its path to ssh as /usr/bin/ssh, so symlink that.
In addition, openssh installs a pam.d configuration file. This CL
adds pam.d as a symlinked dir similar to groups / users.

BUG=chromium:350218 chromium:258027
TEST=Built / verified on build machine / on device

Change-Id: Ie06f41c0d9d20f8f793007a70f454b1fb29cff45
Reviewed-on: https://chromium-review.googlesource.com/189640
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/build_library/dev_image_util.sh b/build_library/dev_image_util.sh
index 5584fb3..474c2bd 100755
--- a/build_library/dev_image_util.sh
+++ b/build_library/dev_image_util.sh
@@ -22,11 +22,12 @@
   # Determine the root dir for developer packages.
   local root_dev_dir="${root_fs_dir}/usr/local"
 
-  # Symlink to /etc/{passwd,group} from inside the developer package root, so
-  # ebuilds can create users and groups at build time.
+  # Symlink to /etc/{passwd,group,pam.d} from inside the developer package
+  # root, so ebuilds can create users, groups, and set pam rules at build time.
   sudo mkdir -p "${root_dev_dir}/etc"
   sudo ln -s ../../../etc/passwd "${root_dev_dir}/etc/passwd"
   sudo ln -s ../../../etc/group "${root_dev_dir}/etc/group"
+  sudo ln -s ../../../etc/pam.d "${root_dev_dir}/etc/pam.d"
 
   # Install dev-specific init scripts into / from chromeos-dev-root.
   emerge_to_image --root="${root_fs_dir}" chromeos-dev-root
diff --git a/mod_for_test_scripts/370fixTestSSH b/mod_for_test_scripts/370fixTestSSH
new file mode 100755
index 0000000..fbd95b4
--- /dev/null
+++ b/mod_for_test_scripts/370fixTestSSH
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# If openssh-server is installed on in /usr/local, fix a couple items
+# that don't work.
+
+USR_LOCAL="${ROOT_FS_DIR}/usr/local"
+
+if [ ! -d "${USR_LOCAL}" ]; then
+  echo "Missing stateful mount point for developer images."
+  exit 1
+fi
+
+if [ ! -f "${USR_LOCAL}/bin/ssh" ]; then
+  echo "Nothing to do. SSH is not installed in /usr/local."
+  exit 0
+fi
+
+echo "Symlinking ssh."
+ln -sf /usr/local/bin/ssh "${ROOT_FS_DIR}/usr/bin/ssh"