[SSSD] [PATCH] PROXY: Handle empty GECOS
Jakub Hrozek
jhrozek at redhat.com
Fri Aug 23 12:17:48 UTC 2013
I found this bug while triaging a customer case with Chris Hudson who
ran into the same issue Simo fixed recently in the proxy provider.
-------------- next part --------------
>From e8c22e6d8656be715977382b27a77a00bbfde871 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Fri, 23 Aug 2013 14:08:33 +0200
Subject: [PATCH] PROXY: Handle empty GECOS
If the user's GECOS as returned by the proxied module is an empty string
(as opposed to NULL), the ldb transaction would error out.
---
src/providers/proxy/proxy_id.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 86a11e875d2131206c7374dcc1cd12ff58e5a50d..b5d63ecfd280c65e15714ccc98edcc639d7c852d 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -219,6 +219,7 @@ static int save_user(struct sysdb_ctx *sysdb, struct sss_domain_info *domain,
const char *alias, uint64_t cache_timeout)
{
const char *shell;
+ const char *gecos;
char *lower;
struct sysdb_attrs *attrs = NULL;
errno_t ret;
@@ -230,6 +231,12 @@ static int save_user(struct sysdb_ctx *sysdb, struct sss_domain_info *domain,
shell = NULL;
}
+ if (pwd->pw_gecos && pwd->pw_gecos[0] != '\0') {
+ gecos = pwd->pw_gecos;
+ } else {
+ gecos = NULL;
+ }
+
if (lowercase || alias) {
attrs = sysdb_new_attrs(NULL);
if (!attrs) {
@@ -274,7 +281,7 @@ static int save_user(struct sysdb_ctx *sysdb, struct sss_domain_info *domain,
pwd->pw_passwd,
pwd->pw_uid,
pwd->pw_gid,
- pwd->pw_gecos,
+ gecos,
pwd->pw_dir,
shell,
NULL,
--
1.8.3.1
More information about the sssd-devel
mailing list