summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-08-23 14:08:33 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-12-03 15:59:33 +0100
commita9ec49574a46c91151c6e5dc237b4f12e8961430 (patch)
tree23af2acfadf52e90004dc44c526d1dca6bdd04ae /src
parent59ada2f614ecb6001e11655e7a44bca402136580 (diff)
downloadsssd-a9ec49574a46c91151c6e5dc237b4f12e8961430.tar.gz
sssd-a9ec49574a46c91151c6e5dc237b4f12e8961430.tar.xz
sssd-a9ec49574a46c91151c6e5dc237b4f12e8961430.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/providers/proxy/proxy_id.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 120946b7d..048f2690e 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -215,6 +215,7 @@ static int save_user(struct sysdb_ctx *sysdb, bool lowercase,
const char *alias, uint64_t cache_timeout)
{
const char *shell;
+ const char *gecos;
char *lower;
struct sysdb_attrs *attrs = NULL;
errno_t ret;
@@ -226,6 +227,12 @@ static int save_user(struct sysdb_ctx *sysdb, bool lowercase,
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) {
@@ -270,7 +277,7 @@ static int save_user(struct sysdb_ctx *sysdb, bool lowercase,
pwd->pw_passwd,
pwd->pw_uid,
pwd->pw_gid,
- pwd->pw_gecos,
+ gecos,
pwd->pw_dir,
shell,
NULL,