summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorMichal Zidek <mzidek@redhat.com>2012-11-14 15:36:22 +0100
committerJakub Hrozek <jhrozek@redhat.com>2012-11-28 14:45:44 +0100
commit3f964af2d45b85c8c7461f5227b343340ab06b06 (patch)
tree05005911a805f91ceb730e3221bbf7211b1e111f /src/lib
parentfac2e9f6f7551bf5bce89605cdb0672871613ca6 (diff)
downloadsssd-3f964af2d45b85c8c7461f5227b343340ab06b06.tar.gz
sssd-3f964af2d45b85c8c7461f5227b343340ab06b06.tar.xz
sssd-3f964af2d45b85c8c7461f5227b343340ab06b06.zip
idmap: Silence DEBUG messages when dealing with built-in SIDs.
When converting built-in SID to unix GID/UID a confusing debug message about the failed conversion was printed. This patch special cases these built-in objects. https://fedorahosted.org/sssd/ticket/1593
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/idmap/sss_idmap.c13
-rw-r--r--src/lib/idmap/sss_idmap.h5
2 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c
index c589bd458..d7254e3ea 100644
--- a/src/lib/idmap/sss_idmap.c
+++ b/src/lib/idmap/sss_idmap.c
@@ -280,6 +280,15 @@ fail:
return IDMAP_OUT_OF_MEMORY;
}
+static bool sss_idmap_sid_is_builtin(const char *sid)
+{
+ if (strncmp(sid, "S-1-5-32-", 9) == 0) {
+ return true;
+ }
+
+ return false;
+}
+
enum idmap_error_code sss_idmap_sid_to_unix(struct sss_idmap_ctx *ctx,
const char *sid,
uint32_t *id)
@@ -293,6 +302,10 @@ enum idmap_error_code sss_idmap_sid_to_unix(struct sss_idmap_ctx *ctx,
idmap_domain_info = ctx->idmap_domain_info;
+ if (sid && sss_idmap_sid_is_builtin(sid)) {
+ return IDMAP_BUILTIN_SID;
+ }
+
while (idmap_domain_info != NULL) {
dom_len = strlen(idmap_domain_info->sid);
if (strlen(sid) > dom_len && sid[dom_len] == '-' &&
diff --git a/src/lib/idmap/sss_idmap.h b/src/lib/idmap/sss_idmap.h
index 6b7cbe507..22a4d5484 100644
--- a/src/lib/idmap/sss_idmap.h
+++ b/src/lib/idmap/sss_idmap.h
@@ -68,7 +68,10 @@ enum idmap_error_code {
IDMAP_SID_UNKNOWN,
/** The provided UID or GID could not be mapped */
- IDMAP_NO_RANGE
+ IDMAP_NO_RANGE,
+
+ /** The provided SID is a built-in one */
+ IDMAP_BUILTIN_SID
};
/**