Date: Sat, 26 Jun 2021 22:45:43 +0000 From: bugzilla-noreply@freebsd.org To: desktop@FreeBSD.org Subject: [Bug 249445] sysutils/accountsservice: Update to 0.6.55 Message-ID: <bug-249445-39348-KNNiLxjERO@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-249445-39348@https.bugs.freebsd.org/bugzilla/> References: <bug-249445-39348@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D249445 david@dcrosstech.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@dcrosstech.com --- Comment #12 from david@dcrosstech.com --- I have been hitting this issue myself, and I think the bug exists in 2 plac= es.=20 1 in accountservice/src/daemon.c: daemon.c:197 > /* First iteration */ > if (*state =3D=3D NULL) { > GHashTable *shadow_users =3D NULL; > FILE *fp; > #ifdef HAVE_SHADOW_H > struct spwd *shadow_entry; >=20 > fp =3D fopen (PATH_SHADOW, "r"); > if (fp =3D=3D NULL) { > g_warning ("Unable to open %s: %s", PATH_SHADOW, = g_strerror (errno)); > return NULL; > } >=20 > shadow_users =3D g_hash_table_new_full (g_str_hash, g_str= _equal, g_free, g_free); >=20 > do { > int ret =3D 0; >=20 > shadow_entry_buffers =3D g_malloc0 (sizeof (*shad= ow_entry_buffers)); >=20 > ret =3D fgetspent_r (fp, &shadow_entry_buffers->s= pbuf, shadow_entry_buffers->buf, sizeof (shadow_entry_buffers->buf), &shado= w_entry); > if (ret =3D=3D 0) { > g_hash_table_insert (shadow_users, g_strd= up (shadow_entry->sp_namp), shadow_entry_buffers); > } else { > g_free (shadow_entry_buffers); >=20 > if (errno !=3D EINTR) { > break; > } > } > } while (shadow_entry !=3D NULL); >=20 > fclose (fp); >=20 > if (g_hash_table_size (shadow_users) =3D=3D 0) { > g_clear_pointer (&shadow_users, g_hash_table_unre= f); > return NULL; > } > #endif >=20 > fp =3D fopen (PATH_PASSWD, "r"); > if (fp =3D=3D NULL) { > g_clear_pointer (&shadow_users, g_hash_table_unre= f); > g_warning ("Unable to open %s: %s", PATH_PASSWD, = g_strerror (errno)); > return NULL; > } >=20 > generator_state =3D g_malloc0 (sizeof (*generator_state)); > generator_state->fp =3D fp; > generator_state->users =3D shadow_users; >=20 > *state =3D generator_state; > } >=20 > /* Every iteration */ > generator_state =3D *state; >=20 > if (g_hash_table_size (users) < MAX_LOCAL_USERS) { > pwent =3D fgetpwent (generator_state->fp); > if (pwent !=3D NULL) { > #ifdef HAVE_SHADOW_H > shadow_entry_buffers =3D g_hash_table_lookup (gen= erator_state->users, pwent->pw_name); >=20 > if (shadow_entry_buffers !=3D NULL) { > *spent =3D &shadow_entry_buffers->spbuf; > } > return pwent; > #else > if (!generator_state->users || g_hash_table_looku= p (generator_state->users, pwent->pw_name)) > return pwent; > #endif > } > } Note that my reading of the code is that it pulls all of /etc/shadow into memory (and does it extremely hamfistedly), and then uses that to prune /etc/passwd in such a way that users that aren't in /etc/shadow don't even = show up: > if (!generator_state->users || g_hash_table_lookup (generator_state->u= sers, pwent->pw_name)) > return pwent; So generator_state-> users has to be non-null, AND it has to have a user by that name in it... but in the first iteration generator_state->users is set= to shadow_users (L246), however shadow_users is set L210 (inside the #ifdef block), and populated in that block, what WE get is the initial value (NULL= ), L199.... Therefore that check NEVER passes, and we never have ANY users. So I fixed that by removing the if conditional and always returned pwent. This however did not fix it. In experimenting I would swap out JUST account-daemon (or whatever it is called), and hit gdm. THIS worked.... and later I discovered that there is libaccountservice at play here, I think t= here is a *second* bug lurking in there. I did a git diff between the two versi= ons that we upgraded and .. a lot changed.=20=20 I am not done investigating yet, but I figured more eyes will help. I hope this helps. --=20 You are receiving this mail because: You are on the CC list for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-249445-39348-KNNiLxjERO>