Lines 154-159
Link Here
|
154 |
#define MAX_LOCAL_USERS 50 |
154 |
#define MAX_LOCAL_USERS 50 |
155 |
#endif |
155 |
#endif |
156 |
|
156 |
|
|
|
157 |
#ifndef __GLIBC__ |
158 |
/* Musl libc does not support fgetspent_r(), write own |
159 |
* wrapper |
160 |
*/ |
161 |
static int fgetspent_r(FILE *fp, struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp) { |
162 |
struct spwd *shadow_entry = fgetspent(fp); |
163 |
if(!shadow_entry) |
164 |
return -1; |
165 |
size_t namplen = strlen(shadow_entry->sp_namp); |
166 |
size_t pwdplen = strlen(shadow_entry->sp_pwdp); |
167 |
|
168 |
if(namplen + pwdplen + 2 > buflen) |
169 |
return -1; |
170 |
|
171 |
*spbufp = memcpy(spbuf, shadow_entry, sizeof(struct spwd)); |
172 |
spbuf->sp_namp = strncpy(buf, shadow_entry->sp_namp, namplen + 1); |
173 |
spbuf->sp_pwdp = strncpy(buf + namplen + 1, shadow_entry->sp_pwdp, pwdplen + 1); |
174 |
|
175 |
return 0; |
176 |
} |
177 |
#endif |
178 |
|
157 |
static void |
179 |
static void |
158 |
remove_cache_files (const gchar *user_name) |
180 |
remove_cache_files (const gchar *user_name) |
159 |
{ |
181 |
{ |