URL: https://github.com/freeipa/freeipa/pull/762
Author: stlaz
 Title: #762: fix managed-entries printing IPA not installed
Action: opened

PR body:
"""
ipa-managed-entries would print "IPA is not configured on this system."
even though this is not true if run as a normal user. Add check for
root running the script.

https://pagure.io/freeipa/issue/6928
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/762/head:pr762
git checkout pr762
From 85deb5f7323fbeb490ae3d2195811b80a1844ad8 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Thu, 4 May 2017 09:42:36 +0200
Subject: [PATCH] fix managed-entries printing IPA not installed

ipa-managed-entries would print "IPA is not configured on this system."
even though this is not true if run as a normal user. Add check for
root running the script.

https://pagure.io/freeipa/issue/6928
---
 install/tools/ipa-managed-entries | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/install/tools/ipa-managed-entries b/install/tools/ipa-managed-entries
index 731dcc3..4aceee5 100755
--- a/install/tools/ipa-managed-entries
+++ b/install/tools/ipa-managed-entries
@@ -20,6 +20,7 @@
 
 from __future__ import print_function
 
+import os
 import re
 import sys
 from optparse import OptionParser  # pylint: disable=deprecated-module
@@ -193,4 +194,6 @@ def main():
     return retval
 
 if __name__ == '__main__':
+    if not os.geteuid() == 0:
+        sys.exit("\nMust be run as root\n")
     installutils.run_script(main, operation_name='ipa-managed-entries')
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to