| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # Virtual Me2Me implementation. This script runs and manages the processes | 6 # Virtual Me2Me implementation. This script runs and manages the processes |
| 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop | 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop |
| 8 # session, and Host process. | 8 # session, and Host process. |
| 9 # This script is intended to run continuously as a background daemon | 9 # This script is intended to run continuously as a background daemon |
| 10 # process, running under an ordinary (non-root) user account. | 10 # process, running under an ordinary (non-root) user account. |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 | 818 |
| 819 if desktop.session_proc is not None and pid == desktop.session_proc.pid: | 819 if desktop.session_proc is not None and pid == desktop.session_proc.pid: |
| 820 logging.info("Session process terminated") | 820 logging.info("Session process terminated") |
| 821 desktop.session_proc = None | 821 desktop.session_proc = None |
| 822 | 822 |
| 823 if desktop.host_proc is not None and pid == desktop.host_proc.pid: | 823 if desktop.host_proc is not None and pid == desktop.host_proc.pid: |
| 824 logging.info("Host process terminated") | 824 logging.info("Host process terminated") |
| 825 desktop.host_proc = None | 825 desktop.host_proc = None |
| 826 | 826 |
| 827 # These exit-codes must match the ones used by the host. | 827 # These exit-codes must match the ones used by the host. |
| 828 # See remoting/host/host_error_codes.h. | 828 # See remoting/host/constants.h. |
| 829 # Delete the host or auth configuration depending on the returned error | 829 # Delete the host or auth configuration depending on the returned error |
| 830 # code, so the next time this script is run, a new configuration | 830 # code, so the next time this script is run, a new configuration |
| 831 # will be created and registered. | 831 # will be created and registered. |
| 832 if os.WEXITSTATUS(status) == 2: | 832 if os.WEXITSTATUS(status) == 2: |
| 833 logging.info("Host configuration is invalid - exiting.") | 833 logging.info("Host configuration is invalid - exiting.") |
| 834 host_config.clear_auth() | 834 host_config.clear_auth() |
| 835 host_config.clear_host_info() | 835 host_config.clear_host_info() |
| 836 host_config.save() | 836 host_config.save() |
| 837 return 0 | 837 return 0 |
| 838 elif os.WEXITSTATUS(status) == 3: | 838 elif os.WEXITSTATUS(status) == 3: |
| 839 logging.info("Host ID has been deleted - exiting.") | 839 logging.info("Host ID has been deleted - exiting.") |
| 840 host_config.clear_host_info() | 840 host_config.clear_host_info() |
| 841 host_config.save() | 841 host_config.save() |
| 842 return 0 | 842 return 0 |
| 843 elif os.WEXITSTATUS(status) == 4: | 843 elif os.WEXITSTATUS(status) == 4: |
| 844 logging.info("OAuth credentials are invalid - exiting.") | 844 logging.info("OAuth credentials are invalid - exiting.") |
| 845 host_config.clear_auth() | 845 host_config.clear_auth() |
| 846 host_config.save() | 846 host_config.save() |
| 847 return 0 | 847 return 0 |
| 848 elif os.WEXITSTATUS(status) == 5: | 848 elif os.WEXITSTATUS(status) == 5: |
| 849 logging.info("Host domain is blocked by policy - exiting.") | 849 logging.info("Host domain is blocked by policy - exiting.") |
| 850 os.remove(host.config_file) | 850 os.remove(host.config_file) |
| 851 return 0 | 851 return 0 |
| 852 # Nothing to do for Mac-only status 6 (login screen unsupported) | 852 # Nothing to do for Mac-only status 6 (login screen unsupported) |
| 853 | 853 |
| 854 if __name__ == "__main__": | 854 if __name__ == "__main__": |
| 855 logging.basicConfig(level=logging.DEBUG) | 855 logging.basicConfig(level=logging.DEBUG) |
| 856 sys.exit(main()) | 856 sys.exit(main()) |
| OLD | NEW |