shill_login_user: Use InsertUserProfile instead

Use a different call handle to add user profiles which allows
the user hash to be passed.  An empty user hash is sent if
this is the guest user.

CQ-DEPEND=CL:48603
BUG=chromium:231858
TEST=Manual: Login and ensure that /var/run/shill/loaded_profile_list
contains not just the username but the hash.  Use "list-profiles" to
confirm that the "UserHash" property is set on the user profile.
Restart shill and make sure the "UserHash" property is still set on
the profile in "list-services".  Logout and login as guest.  Ensure
that "list-profiles" shows a user profile but one that contains an
empty "UserHash" property.  Restart shill to ensure that the profile
gets reloaded.  Modified version of network_ShillInitScripts

Change-Id: I9da8011f7bcb6ffab63a7c674d92c546ef2a573d
Reviewed-on: https://gerrit.chromium.org/gerrit/48584
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
diff --git a/bin/shill_login_user b/bin/shill_login_user
index ab4b62d..7a20532 100755
--- a/bin/shill_login_user
+++ b/bin/shill_login_user
@@ -34,6 +34,7 @@
 profile_link_root="${shill_state_root}/user_profiles"
 profile_link_dir="$profile_link_root/$profile_user"
 log_link_dir="${shill_state_root}/log"
+username_hash=""
 
 # For multiprofile: Choose a different link name if "chronos" exists.
 profile_user_suffix=0
@@ -51,6 +52,7 @@
       "User cryptohome dir $profile_base does not exist"
     exit 1
   fi
+  username_hash=$(basename $profile_base)
 
   # Make references to the older connection manager profiles that lived
   # in the user-owned home directory.
@@ -153,5 +155,6 @@
 
 # Push user's network profile
 dbus-send --system --dest=org.chromium.flimflam --print-reply / \
-  org.chromium.flimflam.Manager.PushProfile string:$profile_name ||
+  org.chromium.flimflam.Manager.InsertUserProfile \
+      string:$profile_name string:$username_hash ||
     logger -t "$script_name" "Failed to push $profile_name profile"