URL: https://github.com/SSSD/sssd/pull/260
Author: amitkumar50
 Title: #260: Update sss_override.c
Action: synchronized

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/260/head:pr260
git checkout pr260
From d1f28e04e991d7a098b46e187323566f910c9537 Mon Sep 17 00:00:00 2001
From: AmitKumar <amitkuma...@users.noreply.github.com>
Date: Wed, 3 May 2017 18:56:49 +0530
Subject: [PATCH] TOOLS/OVERRIDE: Error out when setting uid/gid as 0

Currently sss_override silently ignores when uid/gid is set as 0. In order to inform the user that setting uid/gid to zero is not allowed, let's error out those cases.

Resolves:
https://pagure.io/SSSD/sssd/issue/2834
---
 src/tools/sss_override.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/tools/sss_override.c b/src/tools/sss_override.c
index 212bf9ab8..10e4d840d 100644
--- a/src/tools/sss_override.c
+++ b/src/tools/sss_override.c
@@ -341,6 +341,12 @@ static struct sysdb_attrs *build_attrs(TALLOC_CTX *mem_ctx,
             goto done;
         }
     }
+    
+    if(uid == 0 && gid == 0 || uid != 0 && gid == 0 || uid == 0 && gid != 0) {
+        fprintf(stderr, _("Setting uid or gid as 0 is not allowed\n"));
+        ret = EINVAL;
+        goto done;
+    }
 
     if (home != NULL) {
         ret = sysdb_attrs_add_string(attrs, SYSDB_HOMEDIR, home);
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org

Reply via email to