diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2013-08-23 14:08:33 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-09-03 13:54:07 +0200 |
commit | 01d048293cba60cf45ca2791585a7d6dc3bf57b2 (patch) | |
tree | 18d488366a17a8e592733dfe78064106f04fbdee /src | |
parent | 3275c56e7b5dd36d25e0a971bf90c70179f0ab8f (diff) | |
download | sssd-01d048293cba60cf45ca2791585a7d6dc3bf57b2.tar.gz sssd-01d048293cba60cf45ca2791585a7d6dc3bf57b2.tar.bz2 sssd-01d048293cba60cf45ca2791585a7d6dc3bf57b2.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.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c index 86a11e87..b5d63ecf 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, |